2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2021 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2022-06-20 23:51:16 +02:00
|
|
|
|
2022-05-06 09:52:21 +03:00
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Templates 2.15
|
2022-06-20 23:51:16 +02:00
|
|
|
import LandingPage as Theme
|
2022-05-06 09:52:21 +03:00
|
|
|
|
|
|
|
|
Button {
|
|
|
|
|
id: control
|
|
|
|
|
|
2022-06-20 23:51:16 +02:00
|
|
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
|
|
|
|
implicitContentWidth + leftPadding + rightPadding)
|
|
|
|
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
|
|
|
|
implicitContentHeight + topPadding + bottomPadding)
|
2022-05-06 09:52:21 +03:00
|
|
|
leftPadding: 4
|
|
|
|
|
rightPadding: 4
|
2022-05-23 10:35:18 +03:00
|
|
|
hoverEnabled: true
|
2022-06-20 23:51:16 +02:00
|
|
|
font.family: Theme.Values.baseFont
|
|
|
|
|
font.pixelSize: 16
|
2022-05-06 09:52:21 +03:00
|
|
|
|
2022-06-20 23:51:16 +02:00
|
|
|
background: Rectangle {
|
2022-05-06 09:52:21 +03:00
|
|
|
id: buttonBackground
|
2022-06-20 23:51:16 +02:00
|
|
|
color: Theme.Colors.backgroundPrimary
|
2022-05-06 09:52:21 +03:00
|
|
|
implicitWidth: 100
|
2022-06-20 23:51:16 +02:00
|
|
|
implicitHeight: 35
|
|
|
|
|
border.color: Theme.Colors.foregroundSecondary
|
2022-05-06 09:52:21 +03:00
|
|
|
anchors.fill: parent
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-20 23:51:16 +02:00
|
|
|
contentItem: Text {
|
2022-05-06 09:52:21 +03:00
|
|
|
id: textItem
|
|
|
|
|
text: control.text
|
2022-06-20 23:51:16 +02:00
|
|
|
font: control.font
|
|
|
|
|
color: Theme.Colors.text
|
2022-05-06 09:52:21 +03:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
rightPadding: 5
|
|
|
|
|
leftPadding: 5
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
states: [
|
|
|
|
|
State {
|
2022-06-20 23:51:16 +02:00
|
|
|
name: "default"
|
|
|
|
|
when: control.enabled && !control.hovered && !control.pressed && !control.checked
|
2022-05-06 09:52:21 +03:00
|
|
|
PropertyChanges {
|
|
|
|
|
target: buttonBackground
|
2022-06-20 23:51:16 +02:00
|
|
|
color: Theme.Colors.backgroundPrimary
|
2022-05-06 09:52:21 +03:00
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: textItem
|
2022-06-20 23:51:16 +02:00
|
|
|
color: Theme.Colors.text
|
2022-05-06 09:52:21 +03:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
State {
|
|
|
|
|
name: "hover"
|
2022-06-20 23:51:16 +02:00
|
|
|
extend: "default"
|
|
|
|
|
when: control.enabled && control.hovered && !control.pressed
|
2022-05-06 09:52:21 +03:00
|
|
|
PropertyChanges {
|
|
|
|
|
target: buttonBackground
|
2022-06-20 23:51:16 +02:00
|
|
|
color: Theme.Colors.hover
|
2022-05-06 09:52:21 +03:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
State {
|
2022-06-20 23:51:16 +02:00
|
|
|
name: "press"
|
|
|
|
|
extend: "default"
|
|
|
|
|
when: control.hovered && control.pressed
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: buttonBackground
|
|
|
|
|
color: Theme.Colors.accent
|
|
|
|
|
border.color: Theme.Colors.accent
|
|
|
|
|
}
|
2022-05-06 09:52:21 +03:00
|
|
|
PropertyChanges {
|
|
|
|
|
target: textItem
|
2022-06-20 23:51:16 +02:00
|
|
|
color: Theme.Colors.backgroundPrimary
|
2022-05-06 09:52:21 +03:00
|
|
|
}
|
2022-06-20 23:51:16 +02:00
|
|
|
},
|
|
|
|
|
State {
|
|
|
|
|
name: "disable"
|
|
|
|
|
when: !control.enabled
|
2022-05-06 09:52:21 +03:00
|
|
|
PropertyChanges {
|
|
|
|
|
target: buttonBackground
|
2022-06-20 23:51:16 +02:00
|
|
|
color: Theme.Colors.backgroundPrimary
|
|
|
|
|
border.color: Theme.Colors.disabledLink
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: textItem
|
|
|
|
|
color: Theme.Colors.disabledLink
|
2022-05-06 09:52:21 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
|
Designer {
|
|
|
|
|
D{i:0;height:40;width:142}
|
|
|
|
|
}
|
|
|
|
|
##^##*/
|
|
|
|
|
|