PDA

View Full Version : Using more than one QStyle



Johannes
15th April 2013, 09:52
Hi.
I wanted to write an application which uses two different styles. For both styles I have a QStyle based class. I know that I can use the QStyle via QApplication and I read that I can apply a style to a (single) widget. But is there a way that all childs will use this style, too?
Can I apply a QStyle to the application and another QStyle to all widgets wich are childs (or childs of childs of childs ...) of a special widget?

(I'm using Qt 4.8)

wysota
15th April 2013, 10:21
You can write a function that recursively applies the style to all children of a widget.

Johannes
15th April 2013, 10:30
That would be a good idea, if the view would not change over time.
My view is flexible. The visible pages change regarding to user input (so also the childs of the main window change).