[Qt-interest] StyleSheet for custom widgets and composite widgets
Emmanuel Mayssat
emayssat at gmail.com
Wed Jan 11 16:20:56 CET 2012
Hello,
1/
I created a custom widget.
(i.e. redefined the paintEvent method)
In that widgets, I have lines (a grid) and would like to be able to
set the color through the stylesheet.
Right now, I use painter.setBrush(qcolor) and painter.setPen(qcolor)
to set the color in the paintEvent method.
Again, how is it possible to do through the stylesheet?
2/
I created a composite widget which contains X instances of my first
custom widget.
If I set the background-color in the style sheet for the composite, it works.
But if in that same stylesheet I try to set the background color of
the custom widget, then that color is ignored and the bg color of the
custom widget is the same as the composite one.
That is
styleSheet = """
LPvPatherWidget {background-color: Red }
LPvPatherComposite {background-color: Green }
"""
then the background color is Green for the entire composite widget.
Any idea how to change that?
Regards,
--
Emmanuel
More information about the Qt-interest-old
mailing list