[Qt-interest] why terminated () or finsished () signals are not emitted when run() is finished.

Scott Aron Bloom Scott.Bloom at sabgroup.com
Thu Sep 3 10:03:38 CEST 2009



-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Ender EREL
Sent: Thursday, September 03, 2009 12:38 AM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] why terminated () or finsished () signals are
not emitted when run() is finished.

Bradley T. Hughes wrote:
> You are creating GUI elements in a non-GUI thread. This is not 
> supported. See http://qt.nokia.com/doc/4.5/threads.html
> 

Actually, i have a question here. QTableWidgetItem does not inherit from

QObject or QWidget, therefore it can be thought of as a collection of 
data that QTableWidget uses, not a GUI element. Of course this is just 
my observation from the documentation, I have not looked at the source 
code. Am I wrong?

Does creating a QTableWidgetItem still count as a GUI operation? What 
happens when someone creates a QTableWidgetItem in a worker thread, then

moves that to the GUI thread and then inserts to a QTableWidget?

Of course the best practice would be creating the QTableWidgetItem in 
the GUI thread with the data coming from the worker thread via a signal.

I am asking just out of curiousity.

Best Regards.

-- 

As long as you move the thread ownership of the object you will be fine
for this.. The problem would happen, when the item is added to the
table, and the table takes parental ownership, it will throw an error
saying parent child relationships have to be inside the same thread

Scott




More information about the Qt-interest-old mailing list