I now have a prototype for a more complete solution to the unwanted
scrolling. The prototype is kludgy, and needs a bit of polishing.
As recent work shows, it is hopeless to call w.setStyleSheet for any widget
w that is a parent of Leo's body pane. Such a call resets stylesheets
throughout the widget tree, which eventually causes the unwanted
scrolling. I wouldn't call this a Qt bug; in general any change to a
stylesheet could, in fact, cause scrolling!
Thus, we must avoid w.setStyleSheet entirely when drawing the focus border
around the body pane. Leo's body pane is contained in a QFrame whose name
is 'innerBodyFrame'. So the solution is to give this QFrame a custom
paintEvent method. Like this::
class InnerBodyFrame(QtGui.QFrame):
def paintEvent(self,event):
# A kludge. g.app.gui.innerBodyFrameColor is set by
paint_qframe.
if hasattr(g.app.gui,'innerBodyFrameColor'):
color = g.app.gui.innerBodyFrameColor
painter = QtGui.QPainter()
painter.begin(w)
painter.fillRect(w.rect(),QtGui.QColor(color))
painter.end()
As you can see, the color to be repainted is gui.innerBodyFrameColor, which
is set by the gui methods that add or remove the border colors!
For the prototype **only** I added the following to my copy of the Qt
stylesheet in myLeoSettings.leo::
QFrame#innerBodyFrame {
border: 5px solid red;
}
This won't work for production: Leo must compute the *initial* stylesheet
for the innnerBodyFrame from the @int focus_border_width setting. That
will be next.
The focus border has caused us all a great deal of trouble. Imo, all this
trouble has been worthwhile--the focus border is a great addition to Leo.
I'll be upping the complete fix sometime tomorrow after I do more extensive
testing.
Edward
P.S. Unwanted scrolling may still be a problem for those using solorized
colors in the body text. I doubt if there is any alternative to using
QTextBrowser.setStyleSheet in that case.
EKR
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/leo-editor/-/UEnkd3vOfmgJ.
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.