Qt Components Hildon  0.20
QML components for Maemo5 with Hildon styling.
 All Classes Functions Properties Groups Pages
widget.qml
import QtQuick 1.0
import org.hildon.components 1.0
import org.hildon.desktop 1.0
HomescreenWidget {
id: widget
property Dialog settingsDialog
width: Math.max(100, widgetLabel.width * 2)
height: widgetLabel.height * 2
settingsAvailable: true
Rectangle {
id: widgetBackground
anchors {
fill: parent
margins: 1
}
color: "#000"
radius: 25
opacity: 0.5
smooth: true
}
id: widgetLabel
anchors.centerIn: parent
text: qsTr("Widget Example")
}
Component {
id: dialogComponent
id: dialog
title: qsTr("New text")
height: column.height + platformStyle.paddingMedium
Column {
id: column
anchors {
left: parent.left
right: button.left
bottom: parent.bottom
}
width: parent.width
text: qsTr("Please enter a new text:")
}
id: textField
width: parent.width
}
}
id: button
anchors {
right: parent.right
bottom: parent.bottom
}
text: qsTr("Done")
enabled: textField.text != ""
onClicked: dialog.accept()
}
onAccepted: widgetLabel.text = textField.text
onStatusChanged: {
if (status == DialogStatus.Open) {
textField.text = widgetLabel.text;
textField.forceActiveFocus();
}
}
}
}
onSettingsRequested: {
if (!settingsDialog) {
settingsDialog = dialogComponent.createObject(widget);
}
settingsDialog.open();
}
}