Rev 1297 contains the beginnings of support for stylesheets for all Qt
widgets.
The new code is in Window.setStyleSheets. This uses a static string
to set styles for widgets. Eventually, this string will come from an
@qt-styles node in Leo settings trees, but a static string is plenty
good enough for now.
I spent over an hour playing with this. Here is the present code:
def setStyleSheets(self):
app = g.app.gui.qtApp
sheet = '''\
/* Valid color names: http://www.w3.org/TR/SVG/types.html#ColorKeywords
*/
/* A QWidget: supports only background attributes.*/
QSplitter::handle {
background-color: #CAE1FF; /* Leo's traditional lightSteelBlue1 */
}
QSplitter {
border-color: #CAE1FF; /* Leo's traditional lightSteelBlue1 */
background-color: white;
border-width: 3px;
border-style: solid;
}
'''
app.setStyleSheet(sheet)
As you can see, styles for many classes can be set, as well as styles
for components like QSplitter::handle. You can use official color
names at
http://www.w3.org/TR/SVG/types.html#ColorKeywords
And you can use color constants like #CAE1FF. BTW, I had forgotten
that Leo already contains a dictionary giving rgb values for Tk color
names. It is in leoColor.leo_color_database.
It would be possible to dynamically set colors using QColor methods,
but we don't have to worry about that at present.
This has been something of a diversion, but I never feel good about a
gui until it looks good.
Edward
P.S. As you can see, c-style block comments are valid in the
stylesheet string.
Documentation for Qt style sheets is at
http://doc.trolltech.com/4.2/stylesheet.html
EKR
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---