[Qt-interest] QThread problem
prashant bhutani
prashantbhutani2008 at gmail.com
Wed Nov 3 14:51:52 CET 2010
actually calling *emit processInfoObj->getProcessInfo*();
Since, I am defining the QThread object in constructor of processInfo class
and to use this(getProcessInfo) method, I am passing the pointer to
processInfo class in the initialization of QThread Object which is
processInfoObj.
Prashant Bhutani
On Wed, Nov 3, 2010 at 7:09 PM, Donal O'Connor <donaloconnor at gmail.com>wrote:
> Are you sure you're calling "emit getProcessInfo" and not calling it
> directly?
>
>
> On Wed, Nov 3, 2010 at 1:27 PM, prashant bhutani <
> prashantbhutani2008 at gmail.com> wrote:
>
>> Hi,
>>
>> Thanks.
>> But with due respect, this is what I am reading everywhere that connecting
>>
>> signal with Qt::QueuedConnection will help me out.
>> But I am not able to sort out how it will happen!!!!!!
>> I have read the documentation and reading every other link it is guiding
>> me to
>> but still I am not able to get that* connect which signal to my method???
>> *
>> The method setting table is *void getProcessInfo(void)* and
>> it contains QTableWidget* widget now I am calling this method
>> from my run() method in other/child thread and it is where I am
>> getting the error that " *QObject::setParent: Cannot set parent, new
>> parent in a different thread*".
>>
>> PS :: This is my first time with QThread and trying to sort things out but
>> I am not able to get enough help even from googling and spent my last two
>> days in reading the documentation only.
>>
>> Prashant Bhutani
>>
>>
>>
>> On Wed, Nov 3, 2010 at 4:48 PM, Gopalakrishna Bhat <gopalakbhat at gmail.com
>> > wrote:
>>
>>> Hi,
>>>
>>> You cannot access or modify any of the widget in the main GUI thread
>>> from any other thread. You can emit a signal in your thread and
>>> connect it to a method in the main GUI thread which then does the
>>> updation.
>>>
>>> With regards,
>>> Gopalakrishna Bhat
>>>
>>>
>>> >
>>> > Hi Everyone,
>>> >
>>> > I am trying to build the System Monitor (similar to one in Linux which
>>> is in
>>> > GTK) in Qt as my OS lab project.
>>> > I have done everything needed but now I am stuck with to update it
>>> > periodically with the processes running on the system.
>>> > To do so, I thought to implement QThread in my application but since
>>> the
>>> > main Thread (GUI thread) is always running, I am not able to modify the
>>> > QTableWidget* widget which is used to show the processes in tabular
>>> form.
>>> > Whenever I run my application, in child thread, I got the output that "
>>> > Prashant Bhutani
>>> >
>>> > _______________________________________________
>>> > Qt-interest mailing list
>>> > Qt-interest at trolltech.com
>>> > http://lists.trolltech.com/mailman/listinfo/qt-interest
>>> >
>>> >
>>>
>>>
>>>
>>> --
>>> My blog http://gkbhat.blogspot.com
>>> _______________________________________________
>>> Qt-interest mailing list
>>> Qt-interest at trolltech.com
>>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>>
>>
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101103/857997ee/attachment.html
More information about the Qt-interest-old
mailing list