diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2019-02-04 16:19:55 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2019-02-05 13:28:44 +0000 |
commit | 4e5601ac1c7aec6aba9ba09fe7adb7a0462da2f0 (patch) | |
tree | bdd0c234d3ebf328c2268ffdea9b1bca9d988a8b /src/quicktemplates2/qquickcontrol_p.h | |
parent | a59ab3ec93bc873225ccbd118ec81d023b5cb62d (diff) |
Popup: ensure that "palette" is reevaluated when enabled state changes
When changing the enabled state of a Menu after component completion,
the background would not change. The problem was that
QQuickPopup::paletteChanged() was not being emitted when the enabled
state changed, resulting in QQuickControl::palette() (which
QQuickPopup::palette() forwards calls to via its popupItem) not
being called. QQuickControl::palette() changes the palette's current
color group to QPalette::Disabled when it is disabled, so if it's not
called, the popup's colors won't change.
Fix the issue by adding a virtual enabledChange() function to
QQuickControl, which QQuickPopupItem can override to emit both
QQuickPopup::enabledChanged() (saving a connection in the process)
and QQuickPopup::paletteChanged(). This ensures that bindings to
QQuickPopup::palette are re-evaluated.
The patch adds a virtual instead of just emitting paletteChanged()
in QQuickPopup::setEnabled(), because we also want to be notified
of indirect enabled state changes, such as those coming from
parent items.
Change-Id: Ibdbd05f27b5a74fe731bda9d6698cbf6b8f81785
Fixes: QTBUG-73447
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickcontrol_p.h')
-rw-r--r-- | src/quicktemplates2/qquickcontrol_p.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickcontrol_p.h b/src/quicktemplates2/qquickcontrol_p.h index a38e34f9..3fe20f3b 100644 --- a/src/quicktemplates2/qquickcontrol_p.h +++ b/src/quicktemplates2/qquickcontrol_p.h @@ -278,6 +278,7 @@ protected: virtual void localeChange(const QLocale &newLocale, const QLocale &oldLocale); virtual void paletteChange(const QPalette &newPalette, const QPalette &oldPalette); virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset); + virtual void enabledChange(); #if QT_CONFIG(accessibility) virtual QAccessible::Role accessibleRole() const; |