An Aha about Qt stylesheets::

    w.setStyleSheet *only* affects the settings mentioned
    in the stylesheet, plus any "related" settings.

It is not necessary to "save" previous values of unrelated stylesheet
items!  That is, w.setStyleSheet does *not* pedantically clear all
unmentioned settings, although the docs do not say as such.

Examples:

1. As shown by experiment, one can specify border attributes of an
object without affecting other stylesheet attributes (like color
attributes). Like this:

Set:

     w.setStyleSheet("border: %spx solid %s;" % (
            c.focus_border_width,c.focus_border_color))

Clear:

    w.setStyleSheet("border: 1px solid white;")

2. Conversely, one can specify body colors without restoring border
attributes.  In fact, the Aha came when I realized that
qtBody.setEditorColors doesn't mess with borders.

3. A recent bug fix in setEditorColors came from the realization that
one must set *both* the foreground and background color in the *same*
call to w.setStyleSheet.  Using *two* calls, one for foreground color
and the other for background color doesn't work, because the two
colors are "related" and thus are set to defaults if not explicitly
specified.

This is good news.  It means we can treat independent settings
independently.  It also means that we could define a suite of leoQtGui
methods that would set various attributes of various Leo objects (body
pane, tree, etc.).  We could hide all internal details of the
implementation by defining user options that Leo *translates* (via the
leoQtGui methods) into stylesheet calls.

Again, the point is that translations can be done independently.

Edward

-- 
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.

Reply via email to