2026-08-17 12:34:03 +03:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
2026-09-01 19:25:07 +03:00
|
|
|
import Flora
|
2026-08-17 12:34:03 +03:00
|
|
|
|
|
|
|
|
Button {
|
|
|
|
|
id: b
|
|
|
|
|
|
|
|
|
|
property string tip: ""
|
|
|
|
|
property bool bold: false
|
|
|
|
|
property bool accent: false
|
|
|
|
|
signal tapped()
|
|
|
|
|
|
2026-09-01 19:25:07 +03:00
|
|
|
implicitWidth: b.text.length > 2 ? 36 : 30
|
2026-08-17 12:34:03 +03:00
|
|
|
implicitHeight: 26
|
|
|
|
|
font.bold: bold
|
|
|
|
|
font.pixelSize: 13
|
2026-09-01 19:25:07 +03:00
|
|
|
palette.button: Theme.toolbarBg
|
|
|
|
|
palette.buttonText: Theme.text
|
|
|
|
|
palette.highlight: Theme.accent
|
2026-08-17 12:34:03 +03:00
|
|
|
|
2026-09-01 19:25:07 +03:00
|
|
|
// фон под тему
|
|
|
|
|
background: Rectangle {
|
|
|
|
|
color: b.pressed ? Theme.surfaceSelected : b.hovered ? Theme.surfaceHover : "transparent"
|
|
|
|
|
radius: 6
|
|
|
|
|
border.color: b.pressed ? Theme.accent : "transparent"
|
|
|
|
|
}
|
|
|
|
|
contentItem: Label {
|
|
|
|
|
text: b.text
|
|
|
|
|
font: b.font
|
|
|
|
|
color: b.accent ? Theme.accent : (b.enabled ? Theme.text : Theme.textFaint)
|
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
// особый стиль для цветных А
|
|
|
|
|
Rectangle {
|
|
|
|
|
visible: b.accent
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
width: parent.width - 6; height: 3
|
|
|
|
|
radius: 1
|
|
|
|
|
color: Theme.warningText
|
|
|
|
|
opacity: 0.9
|
|
|
|
|
}
|
|
|
|
|
Rectangle {
|
|
|
|
|
visible: b.bold && !b.accent
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
width: parent.width - 6; height: 3
|
|
|
|
|
radius: 1
|
|
|
|
|
color: Theme.accent
|
|
|
|
|
opacity: 0.9
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ToolTip.visible: hovered && tip.length > 0
|
2026-08-17 12:34:03 +03:00
|
|
|
ToolTip.text: tip
|
2026-09-01 19:25:07 +03:00
|
|
|
ToolTip.delay: 600
|
2026-08-17 12:34:03 +03:00
|
|
|
|
|
|
|
|
onClicked: b.tapped()
|
2026-09-01 19:25:07 +03:00
|
|
|
}
|