2022-06-03 11:26:02 +00:00
|
|
|
// Copyright (C) 2021 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2018-06-26 13:53:07 +00:00
|
|
|
|
2020-12-01 12:57:32 +00:00
|
|
|
import QtQuick
|
2021-09-14 08:36:23 +00:00
|
|
|
import QtQuick.Controls
|
2018-06-26 13:53:07 +00:00
|
|
|
|
2021-09-14 08:36:23 +00:00
|
|
|
Button {
|
2018-06-26 13:53:07 +00:00
|
|
|
id: button
|
|
|
|
property bool dimmable: false
|
|
|
|
property bool dimmed: false
|
2021-09-14 08:36:23 +00:00
|
|
|
property color textColor: "#eceeea"
|
2018-06-26 13:53:07 +00:00
|
|
|
|
2022-11-10 14:06:08 +00:00
|
|
|
width: 60
|
|
|
|
height: 64
|
2021-09-14 08:36:23 +00:00
|
|
|
contentItem: Text {
|
|
|
|
text: button.text
|
2018-06-26 13:53:07 +00:00
|
|
|
font.pixelSize: 48
|
2022-11-10 14:06:08 +00:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
2021-09-14 08:36:23 +00:00
|
|
|
color: (button.dimmable && button.dimmed) ? Qt.darker(button.textColor) : button.textColor
|
|
|
|
Behavior on color {
|
|
|
|
ColorAnimation {
|
|
|
|
duration: 120
|
|
|
|
easing.type: Easing.OutElastic
|
|
|
|
}
|
|
|
|
}
|
2018-06-26 13:53:07 +00:00
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: "pressed"
|
2021-09-14 08:36:23 +00:00
|
|
|
when: button.pressed && !button.dimmed
|
2018-06-26 13:53:07 +00:00
|
|
|
PropertyChanges {
|
2021-09-14 08:36:23 +00:00
|
|
|
target: button.contentItem
|
|
|
|
color: Qt.lighter(button.textColor)
|
2018-06-26 13:53:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2021-09-14 08:36:23 +00:00
|
|
|
background: null
|
2018-06-26 13:53:07 +00:00
|
|
|
}
|