Results 1 to 1 of 1

Thread: Qtableview column get increasing

  1. #1
    Join Date
    Mar 2011
    Posts
    51
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt/Embedded

    Default Re: Qtableview column get increasing

    hello every one i have i have drag and dropped a tableview and write following code the code

    Qt Code:
    1. QStandardItemModel *listmodel = new QStandardItemModel(this);
    2. QStandardItem * root = listmodel->invisibleRootItem()
    3. QList<QStandardItem *> row;
    4. for(int i =0;i<5 ;i++)
    5. {
    6. row << new QStandardItem("col1") << new QStandardItem("col2") << new QStandardItem("col3") ;
    7. root->appendRow(row);
    8.  
    9. }
    10.  
    11. ui->tableView->setModel(listmodel);
    To copy to clipboard, switch view to plain text mode 

    but the problem is that my column get increaed ist they are 3 then 6 then 9 i want column to be 3 what should i do kindly help me


    Added after 27 minutes:


    it worked i just added root->clear()
    Last edited by maarvi; 28th June 2011 at 19:21.

Similar Threads

  1. how to disbale a column in a QTableView
    By rdjenner in forum Qt Programming
    Replies: 8
    Last Post: 14th August 2019, 15:44
  2. Qtableview insert row and column
    By maarvi in forum Newbie
    Replies: 1
    Last Post: 1st July 2011, 09:26
  3. QTableView set column Decimals
    By ottoshmidt in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2010, 05:00
  4. How can I lock the first column in QTableView
    By alfred4923 in forum Qt Programming
    Replies: 1
    Last Post: 10th August 2009, 08:55
  5. Coloring a QTableview column
    By Potch in forum Qt Programming
    Replies: 2
    Last Post: 4th April 2009, 23:18

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.