[Interest] Change QML Application Style on Runtime

Alexander Dyagilev alervdvcw at gmail.com
Wed May 25 02:31:09 CEST 2022


Hello,

Try to call App.changeStyle via queued connection. I.e. your 
Button::onClicked handler must exit BEFORE you shut the engine down.


On 5/24/2022 6:45 PM, randomslap--- via Interest wrote:
> Hello Qt people!
>
>     I would like to inquire your assistance regarding this:
> Is there a way to change the style of a QML(QuickControls2) UI of an 
> application while it runs? Specifically the program should work with 
> QQmlApplicationEngine and an ApplicationWindow QML Item.
>
>     I have tried making a simple program that could reload its quick 
> style upon clicking one of the buttons on it. The program appears at 
> first and seems to close and execute the function that tries to reload 
> the style but seems to fail on engine.load(). I have sent an image of 
> all the code and the code files too.
>
>     I would specifically like to implement something like this on a 
> Desktop Environment and being able to load a new style on runtime 
> would allow for unlimited "theming" options.
>
> Thank you for maintaining the Qt Project.
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest


More information about the Interest mailing list