On Fri, 1 Aug 2014 08:49:12 -0500
"Edward K. Ream" <[email protected]> wrote:

> In this
> regard, the difference in cursors between normal, input and visual
> modes are surprisingly important visual cues.  I'll be adding those
> cues to Leo's vim mode asap.

I would recommend doing it this way (this is current @data
qt-gui-plugin-style-sheet):

  QLineEdit#lineEdit {
      color: @minibuffer_foreground_color;
      background-color: @minibuffer_background_color;
  }
  
  QLineEdit#lineEdit[style_class ~= 'minibuffer_warning'] {
      background-color: @minibuffer_warning_color;
  }
  
  QLineEdit#lineEdit[style_class ~= 'minibuffer_error'] {
      color: @minibuffer_error_color;
      background-color: @minibuffer_warning_color;
  }

the point here is not the @substitutions, although you might want to
use those too, but the [style_class ~= 'minibuffer_warning']
selectors.  `style_class` is arbitrary, I chose it to match the CSS
class attribute without using the reserved word class itself.  So the
styling is visible and editable where it belongs, in the stylesheet,
and in the code you just do:

  some_widget.setProperty('style_class', 'vim_insert')
or
  some_widget.setProperty('style_class', 'vim_transmogrify')

etc.

I can't remember if you have to 

  some_widget.setStylesheet(some_widget.stylesheet())

every time to get the change to be visible, possibly.  If that's the
case, it's better to setStylesheet on the target widget than just
setting it on c.frame.top or whatever, as that seems to be a
performance hit.

Ah, google gives this, which is better:

      style()->unpolish(this);
      style()->polish(this);

it avoids having a stylesheet set on a lower level widget, translated
that would be

    some_widget.style().unpolish(some_widget)
    some_widget.style().polish(some_widget)

which avoids attaching a copy of the stylesheet to a widget way down
the hierarchy.

I'll have to try that for the places Leo currently applies the
stylesheet on individual widgets for performance reasons.

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to