Results 1 to 4 of 4

Thread: Many cell widget in QTableWidget

  1. #1
    Join Date
    Jan 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Many cell widget in QTableWidget

    Hello,

    I have a short question about QT tables (or more precise QTableWidget). I need to build a table with about 12 000 lines and every line has a checkbox (cell widget) in it. But these checkboxes make the tablewidget very slow about half a minute until the window is redrawn. Is there a possibility to get this faster or should the concept be revised?
    I am using Windows XP. Under Linux this effect does not occur.

    Regards,
    Benarez

  2. #2
    Join Date
    Sep 2009
    Location
    Finland
    Posts
    63
    Thanks
    1
    Thanked 22 Times in 19 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: Many cell widget in QTableWidget

    Have you tried to use QTableWidgetItem (instead of cell widget) and use its checked state (QTableWidgetItem::setCheckState), is there any difference in the speed?

  3. #3
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Many cell widget in QTableWidget

    If you want good performance, then implement your own custom model where you have to return proper flags for checkable items (ItemIsUserCheckable) and proper values in data() for Qt::CheckStateRole and set proper things in your underlaying model structure for Qt::CheckStateRole. Then set this model to QTableView
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  4. #4
    Join Date
    Jan 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Many cell widget in QTableWidget

    Using QTableWidgetItem instead of cell widget already brought enough performance for me (for now). I will keep in mind implementing a new model for the table if I need even more performance.
    Thanks for the help.

    Regards,
    Benarez

Similar Threads

  1. repaint a cell or row in QTableWidget
    By alphaqt in forum Newbie
    Replies: 6
    Last Post: 26th June 2012, 11:21
  2. Replies: 1
    Last Post: 7th December 2009, 18:56
  3. Center a widget in a cell on a QTableWidget
    By roleroz in forum Qt Programming
    Replies: 16
    Last Post: 5th March 2009, 14:47
  4. Replies: 1
    Last Post: 2nd December 2008, 18:33
  5. A QListWidget in a QTableWidget cell ?
    By Nyphel in forum Newbie
    Replies: 4
    Last Post: 11th April 2007, 10:46

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.