On Mon, 24 Oct 2011 20:16:57 -0500
"Edward K. Ream" <[email protected]> wrote:

> Would you be satisfied if the Leo methods that set some stylesheet
> attributes retained the other attributes, as you do in the nested
> splitter code? Is that all that is conversation is about? :-)

Well, yes and no :-)  I would like users to be able to style Leo
according to their own tastes, and I think the most flexible way of
doing that is using stylesheets.

So yes, I want style manipulations to merge, not replace, other
styling.  But not so much on particular widgets, but in a top level
stylesheet that controls as much as possible.  Because users can
customize a top level stylesheet, they can't, without editing the GUI
in dozens of places, customize widget level style sheets.

It seems there are two limitations to Qt stylesheets that interfere
with this.

1) Only one sheet at a particular level (the top level, it this case)

   We can work around this with some sentinel controlled merging of
   style sheets, basically 

   g.setStyleOn(w, style, style_name)

   e.g. g.setStyleOn(w, "QTextEdit#richTextEdit {border: solid
   red 1px;}",
       "focused border style")

   yielding

   <other style sheet content>
   /* LEO_STYLE_BLOCK_START: focused border style */
   QTextEdit#richTextEdit {border: solid red 1px;}
   /* LEO_STYLE_BLOCK_END: focused border style */

   and a second call

   g.setStyleOn(w, "QTextEdit#richTextEdit {border: solid white 1px;}",
       "focused border style")

   yielding

   <other style sheet content>
   /* LEO_STYLE_BLOCK_START: focused border style */
   QTextEdit#richTextEdit {border: solid white 1px;}
   /* LEO_STYLE_BLOCK_END: focused border style */

  I.e. now we can have as many stylesheets as we want per widget, with a
  simple way of merging and replacing them.

2) Lack of CSS style classes, more usefully thought of as tags.

  We can work around this using in some cases the object name, and in
  some cases perhaps something like
  
   QLineEdit *nameEdit = new QLineEdit(this);
   nameEdit->setProperty("style_class", "required_field small_widget");
  
  then
  
   *[style_class~='small_widget'] { font-size: 80%; }

This raises questions about how fast Qt styling code is, which I'll
address in the next post.

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.

Reply via email to