On Mon, 24 Oct 2011 14:28:01 -0500
"Edward K. Ream" <[email protected]> wrote:
> What makes Leo's code work is that stylesheets *on a particular
> widget* work independently of other stylesheets on the same widget.
>
> Your example stylesheets apply to sets of widgets, and that's a
> different matter. Or so I think now.
>
> Anyway, the present Leo code appears to work. ;-)
I fear that it's only working by the skin of its teeth.
Consider this example:
import sys
from PyQt4 import Qt
a = Qt.QApplication(sys.argv)
f = Qt.QWidget()
l = Qt.QVBoxLayout()
f.setLayout(l)
w = Qt.QPushButton("A Button")
l.addWidget(w)
w.setStyleSheet("QPushButton { color: red }")
w.setStyleSheet("QPushButton { border: 3px solid green }")
f.show()
a.exec_()
same widget, two stylesheets, no independence. Again, no red
button text unless you comment out the second sheet.
I think things are working in Leo because you're dealing with extant
widgets, where rendering is occurring between each single stylesheet
change, but I bet if you try and apply two sheets at once, say in
add_border(), only the last one has an impact.
Cheers -Terry
--
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.