>> Right, unfortunately Qt allows only a single stylesheet at a
>> particularly level, and dinking around binding different sheets at
>> different level seems too complicated.
>
> Happily, this is not true. As discussed in the other thread, we can
> call w.setStyleSheet as many times as we like on a particular w
> without problems.
I don't think this is really the case. I think that an already existing,
shown, widget will not be restyled when the sheet governing it replaced with
one which doesn't affect it directly. But see how this simple demo works:
import sys
from PyQt4 import Qt
a = Qt.QApplication(sys.argv)
f = Qt.QWidget()
l = Qt.QVBoxLayout()
f.setLayout(l)
f.setStyleSheet("QPushButton { color: red }")
l.addWidget(Qt.QPushButton("A Button"))
f.show()
f.setStyleSheet("QLabel { color: green }")
l.addWidget(Qt.QLabel("Hello, World"))
l.addWidget(Qt.QPushButton("A Button"))
a.exec_()
...where are the red buttons? Comment out the second call to setStylesheet to
see them. Maybe a more complex example where adding the green label and second
button was a result of clicking the first would leave the first button red, but
that's not really the point. The second call to setStyleSheet is erasing all
knowledge of red buttons, even though the new stylesheet doesn't address
buttons.
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.