[PyQt] QTreeWidget qnd QPaintEngine error

NARCISO, Rui RUI.NARCISO at airbus.com
Wed Nov 18 16:02:43 GMT 2009


First of all, sorry for the disclaimer.

I'm not responsible for it and it is IMPOSSIBLE to remove it or to send any mail to any admin ...

Getting back to the issue at hand, thanks for the reply first of all.

Secondly, what I do is that from the worker thread I send a SIGNAL whenever the task is done, which is received by the MainWindow and handled by the mainwindow instance (add a node, change the properties/color of the node).

First quesiton: does this mean that it's the worker thread that is adding the node or is it the main thread that takes care of that ? If it's the thread who's doing it, how to make sure that all GUI modifications are handled only by the main thread ?

Second question: why do you mention the clipboard? No thread is fiddling with it at any time. I mean, I do have a connection between a double click on a QTreeWidgetItem and copying the data to a QClipboard but that never gets called during any of the worker threads.

Anyways thanks for your help so far

Rui

PS: Sorry for the new disclaimer

-----Message d'origine-----
De : pyqt-bounces at riverbankcomputing.com
[mailto:pyqt-bounces at riverbankcomputing.com]De la part de Hans-Peter
Jansen
Envoyé : mercredi 18 novembre 2009 16:52
À : pyqt at riverbankcomputing.com
Objet : Re: [PyQt] QTreeWidget qnd QPaintEngine error


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: 

http://www.goldmark.org/jeff/stupid-disclaimers/

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.

Pete

> 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!!!
>
> __________________________________________________
>
> Rui NARCISO
> 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


_______________________________________________
PyQt mailing list    PyQt at riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

This mail has originated outside your organization, either from an external partner or the Global Internet.
Keep this in mind if you answer this message.



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.




More information about the PyQt mailing list