diff options
Diffstat (limited to 'src/qml/doc/snippets/qmltc/MyButton.qml')
-rw-r--r-- | src/qml/doc/snippets/qmltc/MyButton.qml | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/qml/doc/snippets/qmltc/MyButton.qml b/src/qml/doc/snippets/qmltc/MyButton.qml new file mode 100644 index 0000000000..5efbd7f88d --- /dev/null +++ b/src/qml/doc/snippets/qmltc/MyButton.qml @@ -0,0 +1,30 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick + +Rectangle { + id: button + property alias text: textItem.text + signal clicked() + + readonly property color constantColor: "#63ACBE" + color: mouseArea.pressed ? Qt.lighter(constantColor) : constantColor + width: textItem.implicitWidth + 5 + height: textItem.implicitHeight + 5 + radius: 10 + + Text { + id: textItem + font.pixelSize: 22 + color: "black" + anchors.centerIn: button + } + + MouseArea { + id: mouseArea + anchors.fill: button + anchors.margins: -5 + onClicked: function(event) { button.clicked(); } + } +} |