[PyQt] Fwd: drawComplexControl

Oleg Klimov omgtech at gmail.com
Sun Dec 23 15:30:16 GMT 2007


On Sun, 2007-12-23 at 06:18 +0100, Attila Olah wrote:

> How do I draw e.g. a tool box in a QTreeView? I tried override the
> model's delegate's paint() function, but it didn't work. I'd like to
> do something like this:
> http://doc.trolltech.com/4.3/qstyle.html#drawComplexControl
> in PyQt4. Is it the right approach?

Approach... Well, I'd suggest you re-think your approach a bit. Anything
non-standard is

 - Yes, non standard to user which have to learn how it works

 - You're somethat likely to fail to meet quality plank of the rest of
Qt (mouse events, prelight, styles, resizing etc). Think of how do you
apply a different style to your application, if you have lots of custom
drawing.

 - As you can see, many widgets use QStyle to draw themselves, it's
larger design than you probably want.

 - You may encounter conflicts with Tree widget drawing.

 - You may end up with larger and harder-to-debug, harder-to-support
code (rather then doing the standard way).

Me thinks you have to have good reasons to do custom drawing,

  Oleg




More information about the PyQt mailing list