[Qt-interest] Stylesheet widget reference

Thomi Richards thomir at gmail.com
Mon Sep 28 17:23:22 CEST 2009


Hi,


I'm attempting to use Qt stylesheets to style a reasonably complex UI.
So far things are going reasonably well, but I'm running into a
difficulty:

How can I work out what widget name I should be targeting for a
particular part of a UI? For example, if I want to change the font
size in the cells of a QTableView, do I write a style that targets
QTableView? or perhaps QAbstractScrollArea? or perhaps
QAbstractitemDelegate?  As it turns out none of these seem to work - I
assume this can be done, but it's a case of working out what the magic
combination of widgets is to target the right part of the UI.

The style sheet guide (http://doc.trolltech.com/4.5/stylesheet.html)
helps somewhat, but seems to be missing a lot of information - the
example for customising QTableView only mentions customising the cell
background colour, and does not mention changing font colour, size,
face, grid lines etc.

Am i missing something here? Perhaps Using stylesheets is the wrong
way to go? I certainly hope not, since the alternative (deriving from
QStyle) seems much more complicated.


Cheers,



More information about the Qt-interest-old mailing list