Hi Marcel, > Is my use case no longer supported or is this a regression?
I don't think that this is a regression. Because the code you mentioned relies on knowledge from the private headers. Please, correct me if I'm mistaken, but it's not mentioned in the official documentation that palette from QML is QPalette. Qt developers always try to reduce inconvenience even for transitions between major releases. Unfortunately, it's not always possible. > And if not, what is the proposed way to do it? Preferrably compatible with Qt 5.15 and Qt 6. Do I have to set every single colorrole of the palette separately? Well, I have no answer for a compatible solution. Only something in C++ involved using private headers, but I wouldn't recommend it. The solution for QML looks good at a glance. Vitaly On Fri, Aug 21, 2020 at 10:26 PM Marcel Krems <marcel.k....@gmail.com> wrote: > Hi, > > I recently implemented a theming system for my Qt Quick application. > > With Qt 6 I'm getting an error: "Unable to assign QPalette to > QQuickPalette*" > This was changed in the following commits: > - https://codereview.qt-project.org/c/qt/qtquickcontrols2/+/270097 > - https://codereview.qt-project.org/c/qt/qtdeclarative/+/270092 > > My Theme class looks like this: > class Theme : public QObject > { > Q_OBJECT > Q_PROPERTY(QPalette palette MEMBER _palette NOTIFY themeChanged) > ... > }; > > In my main.qml I'm setting the palette with: > ApplicationWindow { > palette: Theme.palette > ... > } > > My question is: > Is my use case no longer supported or is this a regression? > And if not, what is the proposed way to do it? Preferrably compatible > with Qt 5.15 and Qt 6. > Do I have to set every single colorrole of the palette separately? > E.g. > ApplicationWindow { > palette { > active { > buttonText: Theme.buttonText > button: Theme.button > ... > } > > disabled { > buttonText: Theme.buttonTextDisabled > button: Theme.buttonDisabld > } > } > } > > > Kind regards, > Marcel > _______________________________________________ > Development mailing list > Development@qt-project.org > https://lists.qt-project.org/listinfo/development > -- Vitaly Fanaskov | Software Engineer
_______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development