[PyQt] QTreeWidget qnd QPaintEngine error

Hans-Peter Jansen hpj at urpla.net
Wed Nov 18 15:51:32 GMT 2009

On Tuesday 17 November 2009, 14:59:18 NARCISO, Rui wrote:
> Hi
> Having browsed through the PyQt and Qt mailing lists without finding a
> clear answer I'll ask my question here.
> I have a QTreeWidget which is populate with several hundred nodes.
> At the press of a button a loop is executed on all of the nodes whereby a
> child node is createt and a request is put in a queue which is in a
> separate thread.
> This worker thread will do it's work and send a signal per item with a
> color to assign to each child item.
> My problem is that:
>  - given the high number of nodes
>  - given the "sometimes" quick execution of the work on the worker thread
> I have the situation whereby I am trying to set the color of a child node
> at the same time that I'm adding a new node.
> I then get a
> 	QPaintEngine::setSystemClip: Should not be changed while engine is
> active QWidgetPrivate::beginSharedPainter: Painter is already active
> 	QPainter::begin: A paint device can only be painted by one painter at a
> time.
> I've tried testing for self.tree.paintingActive() before setting the
> color of my QTreeWidgetItem but it never returns any value. (self.tree
> being my QTreeWidget). I even tried self.paintingActive() (being self my
> QMainWindow) with the same result.
> So my questions are:
>  - does anyone know out the top of one's head (wihout looking at the
> code) where the problem can come from? - can anyone see a concept error
> on mmy approach?
> Thanks for the theoretical answer to my conceptual error

Given the disconcerting disclaimer below, I'm not sure, if I'm really 
allowed to answer you, since I wasn't addressed.

I will do anyway by not answering directly this time.

But before preceeding, please send this link to your mail admin: 


Since any thread is serialized by definition, it cannot happen at all. It 
sounds like you trigger some GUI/drawing code from within your worker 
threads. Given your errors, some thread is fiddling with the clipboard at 
least, I guess.


> Rui
> PS: I don't send a code to show the error cause I'd take me forever to
> try to reproduce this error given the intricated design I have ....
> sorry!!!
> __________________________________________________
> Data for Handling Qualities
> Aerodynamics Department - EDGADY  -  M01 N368
> AIRBUS Operations S.A.S.
> Phone:  +33 (0)5 61 18 10 77
> Fax: +33 (0)5 61 93 99 80
> <Mailto:rui.narciso at airbus.com>
> The information in this e-mail is confidential. The contents may not be
> disclosed or used by anyone other than the addressee. Access to this
> e-mail by anyone else is unauthorised. If you are not the intended
> recipient, please notify Airbus immediately and delete this e-mail.
> Airbus cannot accept any responsibility for the accuracy or completeness
> of this e-mail as it has been sent over public networks. If you have any
> concerns over the content of this message or its Accuracy or Integrity,
> please contact Airbus immediately. All outgoing e-mails from Airbus are
> checked using regularly updated virus scanning software but you should
> take whatever measures you deem to be appropriate to ensure that this
> message and any attachments are virus free.
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

More information about the PyQt mailing list