ScreenRecorder: check for availability

This commit is contained in:
Ly-sec 2025-09-09 13:20:46 +02:00
parent 94d64a91b8
commit 3c9ce6f8b5
5 changed files with 107 additions and 28 deletions

View file

@ -35,13 +35,13 @@ Rectangle {
opacity: root.enabled ? Style.opacityFull : Style.opacityMedium
color: root.enabled && root.hovering ? colorBgHover : colorBg
radius: width * 0.5
border.color: root.hovering ? colorBorderHover : colorBorder
border.color: root.enabled && root.hovering ? colorBorderHover : colorBorder
border.width: Math.max(1, Style.borderS * scaling)
NIcon {
icon: root.icon
font.pointSize: Style.fontSizeM * scaling
color: root.hovering ? colorFgHover : colorFg
color: root.enabled && root.hovering ? colorFgHover : colorFg
// Center horizontally
x: (root.width - width) / 2
// Center vertically accounting for font metrics
@ -56,13 +56,14 @@ Rectangle {
}
MouseArea {
enabled: root.enabled
// Always enabled to allow hover/tooltip even when the button is disabled
enabled: true
anchors.fill: parent
cursorShape: root.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
hoverEnabled: true
onEntered: {
hovering = true
hovering = root.enabled ? true : false
if (tooltipText) {
tooltip.show()
}
@ -79,6 +80,9 @@ Rectangle {
if (tooltipText) {
tooltip.hide()
}
if (!root.enabled) {
return
}
if (mouse.button === Qt.LeftButton) {
root.clicked()
} else if (mouse.button === Qt.RightButton) {