From: Luis G. <lui...@us...> - 2010-11-18 08:02:27
|
On Thu, Nov 18, 2010 at 5:13 AM, Tim E. Real <ter...@ro...> wrote: > But I don't see any methods in QStyle to actually set anything. > Am I missing something? Do it another way? For this I'd use a stylesheet with type or class selectors, no need to override everything in a style, it can be actually annoying if you remove padding to buttons. It is also easy to customize without recompiling. http://doc.qt.nokia.com/4.7/stylesheet-syntax.html#selector-types To do it the QStyle-way you would have to define your own style inherited from one of the existing styles and override methods like layoutSpacing(). http://doc.qt.nokia.com/4.7/qstyle.html#layoutSpacing Not worth it, IMO, and you would remove the possibility for the user to use a different style, unless you used a proxy design pattern (create a style that wraps up the user-selected style and proxy every method except layoutSpacing()). That's, incidentally, how Qt stylesheets work, IIRC. Earlier in this thread I've included an example on how to use a stylesheet. Try that, really, you will wake up to the sheer glory of stylesheets. Luis |