Imagine: don't show hover effects when disabled

831efa14e9 made disabled items get hover
events, so we need to check if a control is disabled before showing
hover effects.

Task-number: QTBUG-94919
Pick-to: 6.2 6.3 6.4
Change-Id: Iee93a053780e7c3c604ae62a99665fdc83be5421
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Mitch Curtis 2022-07-19 13:43:26 +08:00
parent c41a456a50
commit e987d60297
31 changed files with 57 additions and 56 deletions

View File

@ -36,7 +36,7 @@ T.BusyIndicator {
{"disabled": !control.enabled},
{"running": control.running},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}
@ -48,7 +48,7 @@ T.BusyIndicator {
{"disabled": !control.enabled},
{"running": control.running},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -58,7 +58,7 @@ T.Button {
{"highlighted": control.highlighted},
{"mirrored": control.mirrored},
{"flat": control.flat},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -40,7 +40,7 @@ T.CheckBox {
{"partially-checked": control.checkState === Qt.PartiallyChecked},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}
@ -66,7 +66,7 @@ T.CheckBox {
{"partially-checked": control.checkState === Qt.PartiallyChecked},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -46,7 +46,7 @@ T.CheckDelegate {
{"focused": control.visualFocus},
{"highlighted": control.highlighted},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}
@ -77,7 +77,7 @@ T.CheckDelegate {
{"focused": control.visualFocus},
{"highlighted": control.highlighted},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -45,7 +45,7 @@ T.ComboBox {
{"open": control.down},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered},
{"hovered": control.enabled && control.hovered},
{"flat": control.flat}
]
}
@ -82,7 +82,7 @@ T.ComboBox {
{"open": control.down},
{"focused": control.visualFocus || (control.editable && control.activeFocus)},
{"mirrored": control.mirrored},
{"hovered": control.hovered},
{"hovered": control.enabled && control.hovered},
{"flat": control.flat}
]
}
@ -130,7 +130,7 @@ T.ComboBox {
{"editable": control.editable},
{"focused": control.visualFocus || (control.editable && control.activeFocus)},
{"mirrored": control.mirrored},
{"hovered": control.hovered},
{"hovered": control.enabled && control.hovered},
{"flat": control.flat}
]
}

View File

@ -48,7 +48,7 @@ T.DelayButton {
{"checked": control.checked},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
@ -66,7 +66,7 @@ T.DelayButton {
{"checked": control.checked},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}
@ -84,7 +84,7 @@ T.DelayButton {
{"checked": control.checked},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -35,7 +35,7 @@ T.Dial {
{"pressed": control.pressed},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
@ -60,7 +60,7 @@ T.Dial {
{"pressed": control.pressed},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -53,7 +53,7 @@ T.ItemDelegate {
{"focused": control.visualFocus},
{"highlighted": control.highlighted},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -23,7 +23,7 @@ T.Label {
states: [
{"disabled": !control.enabled},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -63,7 +63,7 @@ T.MenuItem {
{"focused": control.visualFocus},
{"highlighted": control.highlighted},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}
@ -82,7 +82,7 @@ T.MenuItem {
{"focused": control.visualFocus},
{"highlighted": control.highlighted},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}
@ -97,7 +97,7 @@ T.MenuItem {
{"focused": control.visualFocus},
{"highlighted": control.highlighted},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -32,7 +32,7 @@ T.PageIndicator {
{"pressed": pressed},
{"current": index === control.currentIndex},
{"mirrored": control.mirrored},
{"hovered": control.hovered} // ### TODO: context property
{"hovered": control.enabled && control.hovered} // ### TODO: context property
]
}
}
@ -52,7 +52,7 @@ T.PageIndicator {
states: [
{"disabled": !control.enabled},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -43,7 +43,7 @@ T.ProgressBar {
{"disabled": !control.enabled},
{"indeterminate": control.indeterminate},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}
@ -60,7 +60,7 @@ T.ProgressBar {
states: [
{"disabled": !control.enabled},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}
@ -76,7 +76,7 @@ T.ProgressBar {
{"disabled": !control.enabled},
{"indeterminate": control.indeterminate},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}
@ -101,7 +101,7 @@ T.ProgressBar {
{"disabled": !control.enabled},
{"indeterminate": control.indeterminate},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -39,7 +39,7 @@ T.RadioButton {
{"checked": control.checked},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}
@ -64,7 +64,7 @@ T.RadioButton {
{"checked": control.checked},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -45,7 +45,7 @@ T.RadioDelegate {
{"focused": control.visualFocus},
{"highlighted": control.highlighted},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}
@ -75,7 +75,7 @@ T.RadioDelegate {
{"focused": control.visualFocus},
{"highlighted": control.highlighted},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -75,7 +75,7 @@ T.RangeSlider {
{"disabled": !control.enabled},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
@ -93,7 +93,7 @@ T.RangeSlider {
{"disabled": !control.enabled},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -57,7 +57,7 @@ T.RoundButton {
{"highlighted": control.highlighted},
{"flat": control.flat},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -40,7 +40,7 @@ T.ScrollBar {
{"interactive": control.interactive},
{"pressed": control.pressed},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
opacity: 0.0
@ -56,7 +56,7 @@ T.ScrollBar {
{"interactive": control.interactive},
{"pressed": control.pressed},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
opacity: 0.0

View File

@ -35,7 +35,7 @@ T.ScrollIndicator {
{"horizontal": control.horizontal},
{"disabled": !control.enabled},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
opacity: 0.0
@ -49,7 +49,7 @@ T.ScrollIndicator {
{"horizontal": control.horizontal},
{"disabled": !control.enabled},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
opacity: 0.0

View File

@ -37,7 +37,7 @@ T.Slider {
{"pressed": control.pressed},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}
@ -54,7 +54,7 @@ T.Slider {
{"pressed": control.down},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
@ -79,7 +79,7 @@ T.Slider {
{"pressed": control.down},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -62,7 +62,7 @@ T.SpinBox {
{"disabled": !control.enabled},
{"focused": control.activeFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}
@ -112,7 +112,7 @@ T.SpinBox {
{"editable": control.editable},
{"focused": control.activeFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -55,7 +55,7 @@ T.SwipeDelegate {
{"focused": control.visualFocus},
{"highlighted": control.highlighted},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -41,7 +41,7 @@ T.Switch {
{"checked": control.checked},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
@ -63,7 +63,7 @@ T.Switch {
{"checked": control.checked},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
@ -94,7 +94,7 @@ T.Switch {
{"checked": control.checked},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -47,7 +47,7 @@ T.SwitchDelegate {
{"focused": control.visualFocus},
{"highlighted": control.highlighted},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
@ -70,7 +70,7 @@ T.SwitchDelegate {
{"focused": control.visualFocus},
{"highlighted": control.highlighted},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
@ -106,7 +106,7 @@ T.SwitchDelegate {
{"focused": control.visualFocus},
{"highlighted": control.highlighted},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -51,7 +51,7 @@ T.TabButton {
{"checked": control.checked},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -56,7 +56,7 @@ T.TextArea {
{"disabled": !control.enabled},
{"focused": control.activeFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -55,7 +55,7 @@ T.TextField {
{"disabled": !control.enabled},
{"focused": control.activeFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -54,7 +54,7 @@ T.ToolButton {
{"highlighted": control.highlighted},
{"flat": control.flat},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -56,7 +56,7 @@ T.Tumbler {
{"disabled": !control.enabled},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered}
{"hovered": control.enabled && control.hovered}
]
}
}

View File

@ -60,7 +60,7 @@ DialogsQuickImpl.FileDialogDelegate {
{ "focused": control.visualFocus },
{ "highlighted": control.highlighted },
{ "mirrored": control.mirrored },
{ "hovered": control.hovered }
{ "hovered": control.enabled && control.hovered }
]
}
}

View File

@ -54,7 +54,7 @@ DialogsQuickImpl.FileDialogDelegate {
{ "focused": control.visualFocus },
{ "highlighted": control.highlighted },
{ "mirrored": control.mirrored },
{ "hovered": control.hovered }
{ "hovered": control.enabled && control.hovered }
]
}
}

View File

@ -8,6 +8,7 @@ Item {
implicitWidth: delegate.implicitWidth
implicitHeight: delegate.implicitHeight
enabled: false
property var controlMetaObject
property var states