Results 1 to 7 of 7

Thread: Possible QTableWidget bug appeared in new Qt 4.5.3?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Location
    Craiova, Romania
    Posts
    46
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    3

    Default Possible QTableWidget bug appeared in new Qt 4.5.3?

    Hello!

    I am the author of a free software for timetabling, http://lalescu.ro/liviu/fet/

    I have met a problem with latest Qt 4.5.3 (not shown in previous versions of Qt), problem which exists on Linux and on Windows.

    The problem is that if I change data in a QTableWidget using function table->item(row,col)->setText("new text"), the first row of the table is not update until I move the mouse over it. For this, run the attached sample, press the button and see that the first row is not updated until you move mouse over table.

    I have a very small example, attached.

    I found that the bug can be avoided if I write "table->viewport()->update()" after changing of one or more values. But this may consume unnecessary time?

    Maybe you can help me with advice on how to avoid better this bug. It is important that my software works well with Qt 4.5.3 and with future versions.

    I submitted this possible bug to Qt task tracker, but I have not received answer until now.

    I write below the example (it is the same as the archived attachment):

    bug.h:

    Qt Code:
    1. #include <QApplication>
    2.  
    3. #include <QtGui>
    4.  
    5. class Dialog: public QDialog
    6. {
    7. Q_OBJECT
    8.  
    9. public:
    10. QVBoxLayout* layout;
    11. QTableWidget* table;
    12.  
    13. Dialog();
    14. ~Dialog();
    15.  
    16. public slots:
    17. void pbClicked();
    18. };
    To copy to clipboard, switch view to plain text mode 
    bug.cpp:

    Qt Code:
    1. #include "bug.h"
    2.  
    3. #include <QApplication>
    4.  
    5. #include <QtGui>
    6.  
    7. Dialog::Dialog()
    8. {
    9. layout=new QVBoxLayout(this);
    10.  
    11. table=new QTableWidget();
    12.  
    13. pb=new QPushButton("Press me");
    14.  
    15. layout->addWidget(table);
    16. layout->addWidget(pb);
    17.  
    18. connect(pb, SIGNAL(clicked()), this, SLOT(pbClicked()));
    19.  
    20. table->setRowCount(5);
    21. table->setColumnCount(5);
    22.  
    23. for(int i=0; i<5; i++)
    24. for(int j=0; j<5; j++){
    25. item->setText("initial");
    26. table->setItem(i, j, item);
    27. }
    28. table->resizeRowsToContents();
    29. }
    30.  
    31. Dialog::~Dialog()
    32. {
    33. }
    34.  
    35. void Dialog::pbClicked()
    36. {
    37. for(int i=0; i<5; i++)
    38. for(int j=0; j<5; j++)
    39. table->item(i,j)->setText(tr("Cell %1,%2 modified").arg(i).arg(j));
    40. }
    41.  
    42. int main(int argc, char** argv)
    43. {
    44. QApplication app(argc, argv);
    45.  
    46. Dialog dialog;
    47. dialog.show();
    48.  
    49. return app.exec();
    50. }
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files
    Last edited by wysota; 20th October 2009 at 18:33.

Similar Threads

  1. QComboBox in QTableWidget : display troubles.
    By Nyphel in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2007, 23:29
  2. QTableWidget (resizing rows, turning off selection, etc.)
    By kiss-o-matic in forum Qt Programming
    Replies: 6
    Last Post: 11th January 2007, 01:57
  3. QTableWidget issues
    By Djony in forum Qt Programming
    Replies: 42
    Last Post: 19th December 2006, 23:27
  4. QTableWidget editing question
    By Trasmeister in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 18:46
  5. Replies: 6
    Last Post: 5th March 2006, 21:05

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.