PDA

View Full Version : Qt Style Sheet Vs Code



Ashutosh2k1
4th May 2011, 05:41
Hi All,
I want to do same effect as the style sheet do, through the code can it be possible? .
I explain the problem .Suppose for QPush Button there are different states (pseudo) like Hover checked etc .In the Qt Style sheet we can set the state and suppose change the background color . I want to do the same functionality through code Can it be possible

tbscope
4th May 2011, 06:21
I want to do same effect as the style sheet do, through the code can it be possible? .
Yes. The stylesheets make use of a special Qt Style (cpp code), so you can check out how it is done.


I explain the problem .Suppose for QPush Button there are different states (pseudo) like Hover checked etc .In the Qt Style sheet we can set the state and suppose change the background color . I want to do the same functionality through code Can it be possible
Yes.

Ashutosh2k1
4th May 2011, 06:36
Thanks
Can u Tell me where i will get the code

tbscope
4th May 2011, 06:40
http://qt.gitorious.org/qt/qt/blobs/4.7/src/gui/styles/qstylesheetstyle.cpp

More in the parent dir.

aamer4yu
4th May 2011, 06:45
For changing background and other things through code, have a look at QPalette, and QWidget::setPalette