[Qt-interest] QTableWidget Update() problem

Constantin Makshin cmakshin at gmail.com
Mon Nov 8 08:25:25 CET 2010


Try to use QWidget::setUpdatesEnabled() function (http://doc.qt.nokia.com/4.7/qwidget.html#updatesEnabled-prop) to temporarily disable widget updates while you're change table contents. My guess is that updating the table from a child thread confuses Qt for some reason.

Also, a small self-contained compilable example of the problem would give others an opportunity to test it and, probably, find the cause or solution.

On Monday 08 November 2010 09:40:17 prashant bhutani wrote:
> Hi Everyone,
> 
> *I have asked this question before but didn't get any answer so posting it
> again.
> I hope someone might reply this time. Sorry to others for inconvenience.*
> 
> I am building System Monitor in Qt.
> When I am calling my method for periodical update of processes
> via new/child thread, an internal QWidget::update() call is being generated,
> which according to documentation occurs and calls paintEvent() and
>   erases previous widget's area.
> http://doc.qt.nokia.com/4.7/qwidget.html#update
> 
> I am using QTabWidget to show processes, file_system and system information
> in different tabs. To show processes, I am using QTableWidget.
> Now, during periodical update, I am updating the QTableWidget due to which
> update() is called. This call is giving me a blank tab (which before thread
> working
> showing the process table). But as soon as I switch between tabs and come
> back
> to process tab again, the table(new one ;) is visible again.
> 
> Now, how can I update the table without switching in between the tabs as it
> would
> not be user-friendly if user has to switch again and again between tabs to
> see the
> update.
> 
> Thanks in advance.
> 
> Regards,
> Prashant Bhutani
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101108/26217676/attachment.bin 


More information about the Qt-interest-old mailing list