fix(StatusBaseButton): Mouse events ignored when button is disabled (#707)
* fix(StatusBaseButton): Mouse events ignored when button is disabled
This commit is contained in:
parent
0b855bfb48
commit
890ef86e1c
|
@ -4,6 +4,7 @@ import QtQuick.Dialogs 1.3
|
|||
|
||||
import StatusQ.Controls 0.1
|
||||
import StatusQ.Popups 0.1
|
||||
import StatusQ.Core 0.1
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
||||
Column {
|
||||
|
@ -317,4 +318,5 @@ Column {
|
|||
colorSelected = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -86,14 +86,16 @@ Rectangle {
|
|||
radius: size !== StatusBaseButton.Size.Tiny ? 8 : 6
|
||||
|
||||
color: {
|
||||
if (statusBaseButton.enabled) {
|
||||
if (statusBaseButton.enabled)
|
||||
return sensor.containsMouse || highlighted ? hoverColor
|
||||
: normalColor
|
||||
} else {
|
||||
: normalColor;
|
||||
return disaledColor
|
||||
}
|
||||
}
|
||||
|
||||
QtObject {
|
||||
id: d
|
||||
readonly property color textColor: statusBaseButton.enabled ? statusBaseButton.textColor : statusBaseButton.disabledTextColor
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: sensor
|
||||
|
@ -102,17 +104,16 @@ Rectangle {
|
|||
|
||||
cursorShape: loading ? Qt.ArrowCursor
|
||||
: Qt.PointingHandCursor
|
||||
hoverEnabled: !loading
|
||||
enabled: !loading
|
||||
|
||||
hoverEnabled: true
|
||||
enabled: !loading && statusBaseButton.enabled
|
||||
|
||||
Loader {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
active: loading
|
||||
sourceComponent: StatusLoadingIndicator {
|
||||
color: statusBaseButton.enabled ? textColor
|
||||
: disabledTextColor
|
||||
color: d.textColor
|
||||
} // Indicator
|
||||
} // Loader
|
||||
|
||||
|
@ -130,8 +131,7 @@ Rectangle {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
opacity: !loading && statusBaseButton.icon.name !== ""
|
||||
visible: statusBaseButton.icon.name !== ""
|
||||
color: statusBaseButton.enabled ? textColor
|
||||
: disabledTextColor
|
||||
color: d.textColor
|
||||
} // Icon
|
||||
StatusBaseText {
|
||||
id: label
|
||||
|
@ -139,8 +139,7 @@ Rectangle {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
font.pixelSize: size === StatusBaseButton.Size.Large ? 15 : 13 // by design
|
||||
|
||||
color: statusBaseButton.enabled ? textColor
|
||||
: disabledTextColor
|
||||
color: d.textColor
|
||||
} // Text
|
||||
} // Ro
|
||||
|
||||
|
|
|
@ -48,9 +48,6 @@ Rectangle {
|
|||
Primary,
|
||||
Secondary
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Implementation
|
||||
|
||||
QtObject {
|
||||
|
@ -84,27 +81,31 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
QtObject {
|
||||
id: d
|
||||
readonly property color iconColor: statusRoundButton.enabled ? statusRoundButton.icon.color : statusRoundButton.icon.disabledColor
|
||||
}
|
||||
|
||||
implicitWidth: 44
|
||||
implicitHeight: 44
|
||||
radius: width / 2;
|
||||
|
||||
color: {
|
||||
if (statusRoundButton.enabled) {
|
||||
if (statusRoundButton.enabled)
|
||||
return sensor.containsMouse || highlighted ? backgroundSettings.hoverColor
|
||||
: backgroundSettings.color
|
||||
} else {
|
||||
: backgroundSettings.color;
|
||||
return backgroundSettings.disabledColor
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: sensor
|
||||
|
||||
anchors.fill: parent
|
||||
cursorShape: loading ? Qt.ArrowCursor
|
||||
: Qt.PointingHandCursor
|
||||
hoverEnabled: !loading
|
||||
enabled: !loading
|
||||
|
||||
hoverEnabled: true
|
||||
enabled: !loading && statusRoundButton.enabled
|
||||
|
||||
StatusIcon {
|
||||
id: statusIcon
|
||||
|
@ -117,25 +118,13 @@ Rectangle {
|
|||
width: statusRoundButton.icon.width
|
||||
height: statusRoundButton.icon.height
|
||||
|
||||
color: {
|
||||
if (statusRoundButton.enabled) {
|
||||
return statusRoundButton.icon.color
|
||||
} else {
|
||||
return statusRoundButton.icon.disabledColor
|
||||
}
|
||||
}
|
||||
color: d.iconColor
|
||||
} // Icon
|
||||
Loader {
|
||||
active: loading
|
||||
anchors.centerIn: parent
|
||||
sourceComponent: StatusLoadingIndicator {
|
||||
color: {
|
||||
if (statusRoundButton.enabled) {
|
||||
return statusRoundButton.icon.color
|
||||
} else {
|
||||
return statusRoundButton.icon.disabledColor
|
||||
}
|
||||
}
|
||||
color: d.iconColor
|
||||
} // Indicator
|
||||
} // Loader
|
||||
|
||||
|
|
Loading…
Reference in New Issue