2023-05-31 21:07:14 -04:00
|
|
|
import QtCore
|
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Controls.Basic
|
|
|
|
import Qt5Compat.GraphicalEffects
|
|
|
|
|
|
|
|
Button {
|
|
|
|
id: myButton
|
|
|
|
padding: 10
|
2024-01-22 14:41:47 -05:00
|
|
|
property color backgroundColor: theme.iconBackgroundDark
|
|
|
|
property color backgroundColorHovered: theme.iconBackgroundHovered
|
2024-06-24 18:49:23 -04:00
|
|
|
property color toggledColor: theme.accentColor
|
|
|
|
property real toggledWidth: 1
|
2023-06-13 20:08:27 -04:00
|
|
|
property bool toggled: false
|
2023-05-31 21:07:14 -04:00
|
|
|
property alias source: image.source
|
2023-07-06 10:53:43 -04:00
|
|
|
property alias fillMode: image.fillMode
|
2024-06-24 18:49:23 -04:00
|
|
|
property alias imageWidth: image.sourceSize.width
|
|
|
|
property alias imageHeight: image.sourceSize.height
|
2023-05-31 21:07:14 -04:00
|
|
|
contentItem: Text {
|
|
|
|
text: myButton.text
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
color: myButton.enabled ? theme.textColor : theme.mutedTextColor
|
2023-08-07 13:54:13 -04:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-05-31 21:07:14 -04:00
|
|
|
Accessible.role: Accessible.Button
|
|
|
|
Accessible.name: text
|
|
|
|
}
|
|
|
|
|
|
|
|
background: Item {
|
|
|
|
anchors.fill: parent
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
2024-06-24 18:49:23 -04:00
|
|
|
color: myButton.toggledColor
|
2023-06-13 20:08:27 -04:00
|
|
|
visible: myButton.toggled
|
2024-06-24 18:49:23 -04:00
|
|
|
border.color: myButton.toggledColor
|
|
|
|
border.width: myButton.toggledWidth
|
2024-06-28 12:57:57 -04:00
|
|
|
radius: 8
|
2023-05-31 21:07:14 -04:00
|
|
|
}
|
|
|
|
Image {
|
|
|
|
id: image
|
|
|
|
anchors.centerIn: parent
|
2024-06-24 18:49:23 -04:00
|
|
|
visible: false
|
|
|
|
fillMode: Image.PreserveAspectFit
|
2023-05-31 21:07:14 -04:00
|
|
|
mipmap: true
|
2024-06-24 18:49:23 -04:00
|
|
|
sourceSize.width: 32
|
|
|
|
sourceSize.height: 32
|
2023-05-31 21:07:14 -04:00
|
|
|
}
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: image
|
|
|
|
source: image
|
2024-01-22 14:41:47 -05:00
|
|
|
color: myButton.hovered ? backgroundColorHovered : backgroundColor
|
2023-05-31 21:07:14 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Accessible.role: Accessible.Button
|
|
|
|
Accessible.name: text
|
2024-01-22 14:41:47 -05:00
|
|
|
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
|
2023-08-07 13:54:13 -04:00
|
|
|
}
|