diff options
Diffstat (limited to 'examples/quick/shared/SimpleLauncherDelegate.qml')
-rw-r--r-- | examples/quick/shared/SimpleLauncherDelegate.qml | 73 |
1 files changed, 28 insertions, 45 deletions
diff --git a/examples/quick/shared/SimpleLauncherDelegate.qml b/examples/quick/shared/SimpleLauncherDelegate.qml index c6ca9802d2..a6ac090b34 100644 --- a/examples/quick/shared/SimpleLauncherDelegate.qml +++ b/examples/quick/shared/SimpleLauncherDelegate.qml @@ -9,7 +9,7 @@ Rectangle { property Item exampleItem width: ListView.view.width - height: button.implicitHeight + 22 + height: col.implicitHeight + 22 signal clicked() @@ -22,10 +22,18 @@ Rectangle { GradientStop { position: 1 Behavior on color {ColorAnimation { duration: 100 }} - color: tapHandler.pressed ? "#e0e0e0" : button.containsMouse ? "#f5f5f5" : "#eee" + color: tapHandler.pressed ? "#e0e0e0" : hoverHandler.hovered ? "#f5f5f5" : "#eee" } } + TapHandler { + id: tapHandler + onTapped: container.clicked() + } + HoverHandler { + id: hoverHandler + } + Image { id: image opacity: 0.7 @@ -36,53 +44,28 @@ Rectangle { anchors.rightMargin: 16 } - Item { - id: button - anchors.top: parent.top + Column { + id: col + spacing: 2 anchors.left: parent.left - anchors.bottom: parent.bottom anchors.right:image.left - implicitHeight: col.height - height: implicitHeight - width: buttonLabel.width + 20 - property alias containsMouse: hoverHandler.hovered - - TapHandler { - id: tapHandler - onTapped: container.clicked() - } - HoverHandler { - id: hoverHandler + anchors.margins: 10 + anchors.verticalCenter: parent.verticalCenter + Text { + width: parent.width + text: container.name + color: "black" + font.pixelSize: 22 + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + styleColor: "white" + style: Text.Raised } - - Column { - spacing: 2 - id: col - anchors.verticalCenter: parent.verticalCenter + Text { width: parent.width - Text { - id: buttonLabel - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.right: parent.right - anchors.rightMargin: 10 - text: container.name - color: "black" - font.pixelSize: 22 - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - styleColor: "white" - style: Text.Raised - - } - Text { - id: buttonLabel2 - anchors.left: parent.left - anchors.leftMargin: 10 - text: container.description - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - color: "#666" - font.pixelSize: 12 - } + text: container.description + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + color: "#666" + font.pixelSize: 12 } } |