2023-06-01 01:07:14 +00:00
|
|
|
import QtCore
|
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Controls.Basic
|
|
|
|
import Qt5Compat.GraphicalEffects
|
|
|
|
|
|
|
|
Button {
|
|
|
|
id: myButton
|
|
|
|
padding: 10
|
2024-01-22 19:41:47 +00:00
|
|
|
property color backgroundColor: theme.iconBackgroundDark
|
|
|
|
property color backgroundColorHovered: theme.iconBackgroundHovered
|
2023-06-14 00:08:27 +00:00
|
|
|
property bool toggled: false
|
2023-06-01 01:07:14 +00:00
|
|
|
property alias source: image.source
|
2023-07-06 14:53:43 +00:00
|
|
|
property alias fillMode: image.fillMode
|
2023-06-01 01:07:14 +00:00
|
|
|
contentItem: Text {
|
|
|
|
text: myButton.text
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
color: myButton.enabled ? theme.textColor : theme.mutedTextColor
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-06-01 01:07:14 +00:00
|
|
|
Accessible.role: Accessible.Button
|
|
|
|
Accessible.name: text
|
|
|
|
}
|
|
|
|
|
|
|
|
background: Item {
|
|
|
|
anchors.fill: parent
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
color: "transparent"
|
2023-06-14 00:08:27 +00:00
|
|
|
visible: myButton.toggled
|
2024-01-29 16:12:12 +00:00
|
|
|
border.color: theme.accentColor
|
2023-06-01 01:07:14 +00:00
|
|
|
border.width: 1
|
|
|
|
radius: 10
|
|
|
|
}
|
|
|
|
Image {
|
|
|
|
id: image
|
|
|
|
anchors.centerIn: parent
|
|
|
|
mipmap: true
|
|
|
|
width: 30
|
|
|
|
height: 30
|
|
|
|
}
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: image
|
|
|
|
source: image
|
2024-01-22 19:41:47 +00:00
|
|
|
color: myButton.hovered ? backgroundColorHovered : backgroundColor
|
2023-06-01 01:07:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Accessible.role: Accessible.Button
|
|
|
|
Accessible.name: text
|
2024-01-22 19:41:47 +00:00
|
|
|
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
|
2023-08-07 17:54:13 +00:00
|
|
|
}
|