diff options
Diffstat (limited to 'demos/declarative/samegame/content/Button.qml')
-rw-r--r-- | demos/declarative/samegame/content/Button.qml | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/demos/declarative/samegame/content/Button.qml b/demos/declarative/samegame/content/Button.qml index 70b175c..208c502 100644 --- a/demos/declarative/samegame/content/Button.qml +++ b/demos/declarative/samegame/content/Button.qml @@ -1,18 +1,26 @@ import Qt 4.6 -Rectangle { - id: page; color: activePalette.button; width: txtItem.width+20; height: txtItem.height+4 - border.width: 1; border.color: activePalette.mid; radius: 10; +Rectangle { + id: Container + signal clicked property string text: "Button" - gradient: Gradient { - GradientStop { id:topGrad; position: 0.0; - color: if(mr.pressed){activePalette.dark;}else{activePalette.light;}} + + color: activePalette.button; smooth: true + width: txtItem.width + 20; height: txtItem.height + 6 + border.width: 1; border.color: activePalette.darker(activePalette.button); radius: 8; + + gradient: Gradient { + GradientStop { + id: topGrad; position: 0.0 + color: if (mr.pressed) { activePalette.dark } else { activePalette.light } } GradientStop { position: 1.0; color: activePalette.button } } - MouseRegion { id:mr; anchors.fill: parent; onClicked: page.clicked() } + + MouseRegion { id: mr; anchors.fill: parent; onClicked: Container.clicked() } + Text { - id: txtItem; text: page.text; anchors.centerIn: page; color: activePalette.buttonText - font.pointSize: 14; + id: txtItem; text: Container.text; anchors.centerIn: Container; color: activePalette.buttonText + font.pointSize: 10; } } |