[Qt-interest] why terminated () or finsished () signals are not emitted when run() is finished.
Sean Harmer
sean.harmer at maps-technology.com
Thu Sep 3 09:31:09 CEST 2009
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.
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
More information about the Qt-interest-old
mailing list