[PyQt] QTreeWidget/View: reimplementing drawTree()

James Polk jpolk5001 at yahoo.com
Fri Apr 1 17:59:50 BST 2011

Hi Phil,...thanks for your email..

mmm,..how'bout drawBranch()...is that re-implementable?

To explain a bit more,...the problem I'm having is that the "tree lines/branches"
that display in the Tree view are taking the color of the background and so
appear to be invisible.  By default, Maya uses a certain color scheme,...
if I launch with a different color scheme (which is possible with Maya but
my user base won't change) then the lines show up  (as black lines on a
very light-to-white background).

While I have familiarity with using a delegate for handling model/view items,
(Kudos to Pete ;-) it doesn't appear such a delegate is able to handle the actual
line tree/branches....

Any thoughts?


--- On Fri, 4/1/11, Phil Thompson <phil at riverbankcomputing.com> wrote:

From: Phil Thompson <phil at riverbankcomputing.com>
Subject: Re: [PyQt] QTreeWidget/View: reimplementing drawTree()
To: "James Polk" <jpolk5001 at yahoo.com>
Cc: pyqt at riverbankcomputing.com
Date: Friday, April 1, 2011, 1:28 AM

On Thu, 31 Mar 2011 16:09:16 -0700 (PDT), James Polk <jpolk5001 at yahoo.com>
> I need to change/assign a unique color to the tree and branches of a
> QTreeWidget.
> It appears I need to reimplement the drawTree() function.  While I've
> implemented
> a treeview delegate before, this is unique enough (at least to me) to
> me a
> but stumped on syntax.  I've searched high and low for documentation and
> examples
> and can't find anything definitive.
> Does anybody out there have any experience or knowledge that you can
> on this?
> Many Thanks,
> -JP

You can't reimplement drawTree() as it isn't virtual. drawRow() is

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110401/c39dfb17/attachment.html>

More information about the PyQt mailing list