[Qt-interest] why terminated () or finsished () signals are not emitted when run() is finished.
Santhosh Y
santhosh at softjin.com
Thu Sep 3 10:39:34 CEST 2009
Sean Harmer wrote:
> Hi,
>
> On Thursday 03 Sep 2009 08:19:05 Santhosh Y wrote:
> <snip>
>
>> void
>> Thread1::run ()
>> {
>> std::cout << "Started Population in Worker Thread " << std::endl;
>> for (int i=0; i<40000; i++) {
>> for (int j=0; j<4; j++) {
>> emit itemCreated (new QTableWidgetItem(QString("Item %1 of
>> %2").arg(i).arg(j)), i, j);
>> }
>> }
>> std::cout << "End of Population in Worker Thread " << std::endl;
>> }
>>
> I doubt many people will be willing to answer your repeated questions on this
> topic because you have been told many times that you
>
> ***should not perform GUI operations from a worker thread***.
>
> Yet you continue to ignore the advice and guidance given to you.
>
Hi Sean,
Sorry for asking this question multiple times.
I thought that, QTableWidgetItem is an independent class which has no
connection to timerEvents or any event calls. That is the reason
why I want to handle them in WorkerThread.
I would like to tell the problem I am trying to solve.
Let us say I have a table widget with huge no of rows. Since this is a
time consuming operation for creating and updating, GUI freezes and
user may think that application has crashed and he may kill it.
What I want to achieve is that, When any GUI updation is taking huge
time it gives a busy cursor by default instead of that, I want to show
some timer kind of stuff / dialog which indicates some updation is
going on.
This way we can still allow the main thread to freeze but the timer will
show the status. Once GUI thread is ready we may close the timer dialog.
How can I achieve this?
Please suggest.
I tried to achieve the above problem, by opening the timer dialog on a
separate process. But when to kill the process I am not getting any idea.
I thought that when GUI Thread finishes its updation job the process
(timer dialog) has to be killed.
> As some relevant advice, if you have that many items you should consider using
> the model/view architecture.
>
> If you insist on using an item based approach then break your creation up into
> smaller chunks and *do it in the main thread*. If you call qApp-
>
>> processEvents() at regular intervals it will keep your GUI responsive.
>>
>
> And finally please try reading the documentation on threading and look at the
> examples.
>
> Sean
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
--
----------------------------------------------------
Y Santhosh Kumar
Senior Software Engineer
SoftJin Technologies Private Limited
Unit No. 102, Mobius Tower,
I Floor, SJR I - Park,
EPIP, White Field,
Bangalore - 560066, India
U : www.softjin.com
E : santhosh at softjin.com
T : +91-80-41779999
M : +91-9740535265
----------------------------------------------------
Business Disclaimer
____________________________________________________________
This e-mail message and any files transmitted with it are intended solely
for the use of the individual or entity to which they are addressed. It
may contain confidential, proprietary or legally privileged information.
If you are not the intended recipient please be advised that you have
received this message in error and any use is strictly prohibited. Please
immediately delete it and all copies of it from your system, destroy any
hard copies of it and notify the sender by return mail. You must not,
directly or indirectly, use, disclose, distribute, print, or copy any part of
this message if you are not the intended recipient.
___________________________________________________________
More information about the Qt-interest-old
mailing list