Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Hack around palettes not loading properly for QML widgets in specific circumstances.
Wolthera van Hövell tot Westerflier63800717e2d8
diff --git a/qmlmodules/components/KisTheme.cpp b/qmlmodules/components/KisTheme.cppindex 6ef36905c5..f51d5f9a8a 100644--- a/qmlmodules/components/KisTheme.cpp+++ b/qmlmodules/components/KisTheme.cpp@@ -119,8 +119,6 @@ KisTheme::KisTheme(QObject *parent), selectionModel(KisThemeColorGroup(KColorScheme::Selection, this)), tooltipModel(KisThemeColorGroup(KColorScheme::Tooltip, this)){- slotUpdateThemes();-connect(KisConfigNotifier::instance(), SIGNAL(signalColorThemeChanged(QString)), this, SLOT(slotUpdateThemes()));connect(&viewModel, SIGNAL(schemeChanged()), this, SIGNAL(viewChanged()));@@ -128,6 +126,7 @@ KisTheme::KisTheme(QObject *parent)connect(&buttonModel, SIGNAL(schemeChanged()), this, SIGNAL(buttonChanged()));connect(&selectionModel, SIGNAL(schemeChanged()), this, SIGNAL(selectionChanged()));connect(&tooltipModel, SIGNAL(schemeChanged()), this, SIGNAL(tooltipChanged()));+ slotUpdateThemes();}KisThemeColorGroup *KisTheme::view()diff --git a/qmlmodules/components/KisTheme.h b/qmlmodules/components/KisTheme.hindex 9768ec7f0a..9e82dcaa3a 100644--- a/qmlmodules/components/KisTheme.h+++ b/qmlmodules/components/KisTheme.h@@ -115,7 +115,7 @@ public:KisThemeColorGroup *button();KisThemeColorGroup *selection();KisThemeColorGroup *tooltip();-private Q_SLOTS:+public Q_SLOTS:void slotUpdateThemes();Q_SIGNALS:void viewChanged();diff --git a/qmlmodules/components/qml/ThemedControl.qml b/qmlmodules/components/qml/ThemedControl.qmlindex 508720d0f0..0f9f8ca071 100644--- a/qmlmodules/components/qml/ThemedControl.qml+++ b/qmlmodules/components/qml/ThemedControl.qml@@ -29,6 +29,14 @@ Control {tooltip.state: colorGroup;}+ Component.onCompleted: {+ // for some reason palette doesn't get assigned when the qquickwidget has no parent,+ // so instead we force slotUpdateThemes here. This is not an issue in qt6+ if (visible && palette.buttonText !== theme.button.textColor) {+ theme.slotUpdateThemes();+ }+ }+palette.alternateBase: theme.view.alternateBackgroundColor;palette.base: theme.view.backgroundColor;palette.button: theme.button.backgroundColor;