PDA

View Full Version : How to apply a QStyle to a widget



Luc4
14th March 2010, 14:16
Hi! I'm trying to apply a custom style to a widget. It seems to work correctly when I try to apply it using:


QApplication::setStyle(style);

but I would like to apply this only to a specific widget, so I tried:


QGraphicsView* view = new QGraphicsView(this);
view->setStyle(style);

but this seems not to work. Any idea why?
Thanks!

aamer4yu
14th March 2010, 17:48
Whats special about the style ?
May be it doesnt have any special rendering for the graphics view,, check and let us know

Luc4
14th March 2010, 18:55
It draws the scrollbar, so yes, it should render differently the graphics view. If I apply it to QApplication, I get the scrollbars as expected, the other way I don't.
Thanks for your answer!