From 6e43f08b51d0d7e53c328f6dc18b5046f7e1991a Mon Sep 17 00:00:00 2001 From: YeShanShan Date: Fri, 5 Jan 2024 18:15:53 +0800 Subject: [PATCH] fix: can't update palette when switching theme `updateChildrenPalettes` will emit QQuickPalette's changed signal instead of QQuickItem's paletteChanged in qt6. Issue: https://github.com/linuxdeepin/developer-center/issues/6724 --- src/private/dquickcontrolpalette.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/private/dquickcontrolpalette.cpp b/src/private/dquickcontrolpalette.cpp index 31c10908c..3ec5da3a1 100644 --- a/src/private/dquickcontrolpalette.cpp +++ b/src/private/dquickcontrolpalette.cpp @@ -11,6 +11,9 @@ #include #include #include +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#include +#endif #include #include @@ -427,6 +430,10 @@ void DQuickControlColorSelector::setControl(QQuickItem *newControl) m_control = newControl; if (m_control) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + auto palette = m_control->property("palette").value(); + connect(palette, &QQuickPalette::changed, this, &DQuickControlColorSelector::updateControlTheme); +#endif connect(m_control, SIGNAL(paletteChanged()), this, SLOT(updateControlTheme())); connect(m_control, SIGNAL(hoveredChanged()), this, SLOT(updateControlState())); if (m_control->metaObject()->indexOfSignal("pressedChanged()") != -1) {