summaryrefslogtreecommitdiff
path: root/components/custom/BasicButton.qml
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@nokia.com>2011-02-21 10:52:17 +0100
committerJens Bache-Wiig <jens.bache-wiig@nokia.com>2011-02-21 11:03:49 +0100
commit88f140ddd7f634ad4411f4d16cae51a93eb856b7 (patch)
tree97918777eb4be0e9da103ca431f43211e4454544 /components/custom/BasicButton.qml
parent9917d1d23cced9f3f91ec8a0504c2942e72adfc7 (diff)
downloadqtquickcontrols-88f140ddd7f634ad4411f4d16cae51a93eb856b7.tar.gz
Added widgets
Diffstat (limited to 'components/custom/BasicButton.qml')
-rw-r--r--components/custom/BasicButton.qml44
1 files changed, 44 insertions, 0 deletions
diff --git a/components/custom/BasicButton.qml b/components/custom/BasicButton.qml
new file mode 100644
index 00000000..1116f0b0
--- /dev/null
+++ b/components/custom/BasicButton.qml
@@ -0,0 +1,44 @@
+import QtQuick 1.1
+import "./behaviors" // ButtonBehavior
+import "./styles/default" as DefaultStyles
+
+Item {
+ id: button
+
+ signal clicked
+ property alias pressed: behavior.pressed
+ property alias containsMouse: behavior.containsMouse
+ property alias checkable: behavior.checkable // button toggles between checked and !checked
+ property alias checked: behavior.checked
+
+ property Component background: defaultStyle.background
+
+ property color backgroundColor: syspal.button
+ property color textColor: syspal.text;
+
+ property int minimumWidth: defaultStyle.minimumWidth
+ property int minimumHeight: defaultStyle.minimumHeight
+
+ // implementation
+
+ property string __position: "only"
+ implicitWidth: Math.max(minimumWidth, backgroundLoader.item.width)
+ implicitHeight: Math.max(minimumHeight, backgroundLoader.item.height)
+
+ Loader {
+ id: backgroundLoader
+ anchors.fill: parent
+ sourceComponent: background
+ property alias styledItem: button
+ property alias position: button.__position
+ }
+
+ ButtonBehavior {
+ id: behavior
+ anchors.fill: parent
+ onClicked: button.clicked()
+ }
+
+ DefaultStyles.BasicButtonStyle { id: defaultStyle }
+ SystemPalette { id: syspal }
+}