2022-10-26 19:57:41 +03:00
|
|
|
// Copyright (C) 2022 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2022-10-26 19:57:41 +03:00
|
|
|
|
|
|
|
|
import QtQuick
|
2023-02-09 09:17:00 +01:00
|
|
|
import HelperWidgets 2.0 as HelperWidgets
|
|
|
|
|
import StudioControls 1.0 as StudioControls
|
|
|
|
|
import StudioTheme 1.0 as StudioTheme
|
2022-10-26 19:57:41 +03:00
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
signal clicked()
|
|
|
|
|
|
2023-02-09 09:17:00 +01:00
|
|
|
property alias icon: button.buttonIcon
|
|
|
|
|
property alias name: label.text
|
2022-10-26 19:57:41 +03:00
|
|
|
property bool selected: false
|
|
|
|
|
|
2023-02-09 09:17:00 +01:00
|
|
|
height: button.height
|
|
|
|
|
width: button.width + label.width + contentRow.spacing + 6
|
|
|
|
|
color: StudioTheme.Values.themeToolbarBackground
|
|
|
|
|
radius: StudioTheme.Values.smallRadius
|
2022-10-26 19:57:41 +03:00
|
|
|
|
2023-02-09 09:17:00 +01:00
|
|
|
state: "default"
|
2022-10-26 19:57:41 +03:00
|
|
|
|
2023-02-09 09:17:00 +01:00
|
|
|
Row {
|
|
|
|
|
id: contentRow
|
|
|
|
|
spacing: 6
|
2022-10-26 19:57:41 +03:00
|
|
|
|
2023-02-09 09:17:00 +01:00
|
|
|
HelperWidgets.AbstractButton {
|
|
|
|
|
id: button
|
|
|
|
|
style: StudioTheme.Values.viewBarButtonStyle
|
|
|
|
|
buttonIcon: StudioTheme.Constants.material_medium
|
|
|
|
|
hover: mouseArea.containsMouse
|
|
|
|
|
checked: root.selected
|
|
|
|
|
checkable: true
|
|
|
|
|
checkedInverted: true
|
|
|
|
|
autoExclusive: true
|
|
|
|
|
}
|
2022-10-26 19:57:41 +03:00
|
|
|
|
2023-02-09 09:17:00 +01:00
|
|
|
Text {
|
|
|
|
|
id: label
|
|
|
|
|
height: StudioTheme.Values.statusbarButtonStyle.controlSize.height
|
|
|
|
|
color: StudioTheme.Values.themeTextColor
|
|
|
|
|
text: qsTr("Materials")
|
|
|
|
|
font.pixelSize: StudioTheme.Values.baseFontSize
|
|
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
}
|
2022-10-26 19:57:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
|
id: mouseArea
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
hoverEnabled: true
|
|
|
|
|
onClicked: root.clicked()
|
|
|
|
|
}
|
2023-02-09 09:17:00 +01:00
|
|
|
|
|
|
|
|
states: [
|
|
|
|
|
State {
|
|
|
|
|
name: "default"
|
|
|
|
|
when: !mouseArea.containsMouse && !button.checked
|
|
|
|
|
},
|
|
|
|
|
State {
|
|
|
|
|
name: "hover"
|
|
|
|
|
when: mouseArea.containsMouse && !button.checked
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: root
|
|
|
|
|
color: StudioTheme.Values.themeControlBackground_topToolbarHover
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
State {
|
|
|
|
|
name: "checked"
|
|
|
|
|
when: !mouseArea.containsMouse && button.checked
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: root
|
|
|
|
|
color: StudioTheme.Values.themeInteraction
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: label
|
|
|
|
|
color: StudioTheme.Values.themeTextSelectedTextColor
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
State {
|
|
|
|
|
name: "hoverChecked"
|
|
|
|
|
when: mouseArea.containsMouse && button.checked
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: root
|
|
|
|
|
color: StudioTheme.Values.themeInteractionHover
|
|
|
|
|
}
|
|
|
|
|
PropertyChanges {
|
|
|
|
|
target: label
|
|
|
|
|
color: StudioTheme.Values.themeTextSelectedTextColor
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
2022-10-26 19:57:41 +03:00
|
|
|
}
|