NIconButton/CustomButton: added an extra flag to allow click when the button is disabled.
Helps with custom button to get redirected to the settings
This commit is contained in:
parent
8a4042913b
commit
6ed2daa386
2 changed files with 4 additions and 2 deletions
|
|
@ -38,6 +38,8 @@ NIconButton {
|
||||||
readonly property string middleClickExec: widgetSettings.middleClickExec || widgetMetadata.middleClickExec
|
readonly property string middleClickExec: widgetSettings.middleClickExec || widgetMetadata.middleClickExec
|
||||||
readonly property bool hasExec: (leftClickExec || rightClickExec || middleClickExec)
|
readonly property bool hasExec: (leftClickExec || rightClickExec || middleClickExec)
|
||||||
|
|
||||||
|
enabled: hasExec
|
||||||
|
allowClickWhenDisabled: true // we want to be able to open config with left click when its not setup properly
|
||||||
colorBorder: Color.transparent
|
colorBorder: Color.transparent
|
||||||
colorBorderHover: Color.transparent
|
colorBorderHover: Color.transparent
|
||||||
sizeRatio: 0.8
|
sizeRatio: 0.8
|
||||||
|
|
@ -59,7 +61,6 @@ NIconButton {
|
||||||
return lines.join("<br/>")
|
return lines.join("<br/>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
opacity: hasExec ? Style.opacityFull : Style.opacityMedium
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (leftClickExec) {
|
if (leftClickExec) {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ Rectangle {
|
||||||
property string icon
|
property string icon
|
||||||
property string tooltipText
|
property string tooltipText
|
||||||
property bool enabled: true
|
property bool enabled: true
|
||||||
|
property bool allowClickWhenDisabled: false
|
||||||
property bool hovering: false
|
property bool hovering: false
|
||||||
|
|
||||||
property color colorBg: Color.mSurfaceVariant
|
property color colorBg: Color.mSurfaceVariant
|
||||||
|
|
@ -94,7 +95,7 @@ Rectangle {
|
||||||
if (tooltipText) {
|
if (tooltipText) {
|
||||||
tooltip.hide()
|
tooltip.hide()
|
||||||
}
|
}
|
||||||
if (!root.enabled) {
|
if (!root.enabled && !allowClickWhenDisabled) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (mouse.button === Qt.LeftButton) {
|
if (mouse.button === Qt.LeftButton) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue