[PyQt] QTreeWidget qnd QPaintEngine error
RUI.NARCISO at airbus.com
Thu Nov 19 13:47:19 GMT 2009
Thanks for your help Peter.
I was not aware of that #1 rule of Qt programming and I was indeed import QtGui from my threads even if I didn't use them.
I ahve remoived all direct and indirect imports and th eproblem seems to have disappeared.
I'll come back to you on this subject if the problem reappears but if it doesn't, you are indeed a life saver.
De : pyqt-bounces at riverbankcomputing.com
[mailto:pyqt-bounces at riverbankcomputing.com]De la part de Hans-Peter
Envoyé : mercredi 18 novembre 2009 17:48
À : pyqt at riverbankcomputing.com
Objet : Re: [PyQt] QTreeWidget qnd QPaintEngine error
On Wednesday 18 November 2009, 17:02:43 NARCISO, Rui wrote:
> 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 ...
Hmm postmaster@ should be wired in any domain. Anyway..
> 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 ?
You're contradicting yourself here. Do you add items in the worker thread or
do you emit a signal add_node from your worker thread, which is processed
in the main thread (node added)? The latter is the only sane way to handle
the task in question.
IOW, and as a rule of thumb: put your threads code in extra modules, and do
not import QtGui, neither directly, nor indirectly, and do not derive
classes nor call methods or functions of other modules, that do so.
> 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.
> > 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.
but this could be just a side effect of violating law #1 in threaded Qt
programming: see above.
PyQt mailing list PyQt at riverbankcomputing.com
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