Results 1 to 2 of 2

Thread: Help with QTableWidget!

  1. #1
    Join Date
    Jul 2009
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Help with QTableWidget!

    Hi all,

    I create a QTableWidget, with a determined number of rows and collumns, now i need initialize all values in 0, i can initialize this, but is so slowly. In this moment i use this method to make it.

    size = rows = collumns

    Qt Code:
    1. QTableWidgetItem *tableItem;
    2. tableItem = new QTableWidgetItem();
    3. tableItem->setText("0");
    4. for(int i=0; i < size; i++){
    5. for(int j=0; j < size; j++){
    6. ui->tableWidgetMatrix->setItem(i,j,tableItem);
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 

    Is possible to make it diferent? Because i work with more than 500 rows and collumns!
    Sorry my english, and thanks for helps!
    Fernando Bottin

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Help with QTableWidget!

    Hi, instead of inserting new items for chance the value, use the already existing ones. Just change their values! -> QTableWidget::item().
    And 500x500 changes need their time...

    EDIT: also see QWidget::updatesEnabled().

  3. The following user says thank you to Lykurg for this useful post:

    bottin (29th July 2009)

Similar Threads

  1. QComboBox in QTableWidget : display troubles.
    By Nyphel in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2007, 23:29
  2. Select columns from a QTableWidget
    By toglez in forum Qt Programming
    Replies: 10
    Last Post: 7th October 2007, 15:15
  3. print QTableWidget
    By chak_med in forum Qt Programming
    Replies: 3
    Last Post: 4th November 2006, 18:46
  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

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.