aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/dialogs/qml/Button.qml
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-03-11 11:42:00 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-18 13:44:23 +0100
commit7fded5040f56b8def7a93fcce03f93f06bcc6bc4 (patch)
tree8e59c40a1152684141f4ad36003e36313d44bea1 /src/imports/dialogs/qml/Button.qml
parentbb803baa360f24f9a01e1cb1652962476724dd2d (diff)
Cosmetic changes in DefaultFileDialog and dialog shared controls
Implementation of the button for QML-based dialogs matches the one for QML examples. The button and the text field use system palette colors, as does the file dialog. Change-Id: Ibf45d57bdab8799ae6aa69ba543c0e05c55b01d3 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/imports/dialogs/qml/Button.qml')
-rw-r--r--src/imports/dialogs/qml/Button.qml64
1 files changed, 31 insertions, 33 deletions
diff --git a/src/imports/dialogs/qml/Button.qml b/src/imports/dialogs/qml/Button.qml
index 936c72c876..491dc2e251 100644
--- a/src/imports/dialogs/qml/Button.qml
+++ b/src/imports/dialogs/qml/Button.qml
@@ -41,49 +41,47 @@
import QtQuick 2.1
Item {
- height: label.implicitHeight * 2
- width: Math.max(label.implicitWidth * 1.2, height * 2.5);
- anchors.verticalCenter: parent.verticalCenter
- property alias text: label.text
- property string tooltip
+ id: container
+
+ property alias text: buttonLabel.text
+ property alias label: buttonLabel
signal clicked
+ property alias containsMouse: mouseArea.containsMouse
+ property alias pressed: mouseArea.pressed
+ implicitHeight: buttonLabel.implicitHeight
+ implicitWidth: buttonLabel.implicitWidth
+ height: buttonLabel.implicitHeight + 12
+ width: Math.max(80, implicitWidth + 8)
+
SystemPalette { id: palette }
+
Rectangle {
- antialiasing: true
- border.color: mouseArea.pressed ? palette.highlight : palette.light
- color: "transparent"
- anchors.fill: parent
- anchors.rightMargin: 1
- anchors.bottomMargin: 1
- radius: 3
- }
- Rectangle {
- border.color: palette.dark
+ id: frame
anchors.fill: parent
- anchors.leftMargin: 1
- anchors.topMargin: 1
- radius: 3
- }
- Rectangle {
+ color: palette.button
gradient: Gradient {
- GradientStop { position: 0.0; color: mouseArea.pressed ? palette.dark : palette.light }
- GradientStop { position: 0.2; color: palette.button }
- GradientStop { position: 0.8; color: palette.button }
- GradientStop { position: 1.0; color: mouseArea.pressed ? palette.light : palette.dark }
+ GradientStop { position: 0.0; color: mouseArea.pressed ? Qt.darker(palette.button, 1.3) : palette.button }
+ GradientStop { position: 1.0; color: Qt.darker(palette.button, 1.3) }
}
- anchors.fill: parent
- anchors.margins: 1
- radius: 3
- }
- Text {
- id: label
- anchors.centerIn: parent
- color: palette.buttonText
+ antialiasing: true
+ radius: 5
+ border.color: Qt.darker(palette.button, 1.5)
+ border.width: 1
}
MouseArea {
id: mouseArea
anchors.fill: parent
- onClicked: parent.clicked()
+ onClicked: container.clicked()
+ hoverEnabled: true
+ }
+
+ Text {
+ id: buttonLabel
+ width: parent.width
+ horizontalAlignment: Text.Center
+ text: container.text
+ color: palette.buttonText
+ anchors.verticalCenter: parent.verticalCenter
}
}