blob: 1cd332a2de624c6621e969f85154344fb28f0772 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
//![0]
import QtQuick
Rectangle {
id: button
signal clicked
property alias text: buttonLabel.text
height: Math.max(Screen.pixelDensity * 7, buttonLabel.implicitHeight * 1.2)
width: Math.max(Screen.pixelDensity * 11, buttonLabel.implicitWidth * 1.3)
radius: 3
property color dark: Qt.darker(palette.button, 1.3)
gradient: Gradient {
GradientStop { position: 0.0; color: tapHandler.pressed ? dark : palette.button }
GradientStop { position: 1.0; color: dark }
}
TapHandler {
id: tapHandler
gesturePolicy: TapHandler.ReleaseWithinBounds
onTapped: button.clicked()
}
Text {
id: buttonLabel
text: "Click Me"
color: palette.buttonText
anchors.centerIn: parent
}
}
//![0]
|