Results 1 to 3 of 3

Thread: QTableWidget update problem

  1. #1
    Join Date
    Aug 2010
    Posts
    1
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default QTableWidget update problem

    I am having trouble updating cells in QTableWidget...below is the snippet


    Qt Code:
    1. //fileds are qstringlist and they are not null//
    2. QTableWidgetItem *myitem = new QTableWidgetItem(fields[i]);
    3.  
    4. //qDebug() << "my item " << myitem->text();
    5.  
    6. // resultTable is the QTableWidget from UI form
    7. ui->resultTable->setItem(row, i, myitem);
    To copy to clipboard, switch view to plain text mode 

    The above code is in a loop to update the table. I am not sure where I am going wrong or is it a bug?
    I am on Windows Vista with Qt SDK v2010.04(Open source)
    Any help would be appreciated.
    BTW this a sample program (Trip planner from Networking section) from C++ GUI Programming with QT 4 2nd edition
    Last edited by mammenj; 13th August 2010 at 07:51.

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget update problem

    * No it is not a bug.
    * What are you trying to achieve and what do you see?
    * I would have already switched to writing a custom model and ditch the QTableWidget. It provides you with more issues than you are trying to solve. QAbstractTableModel gives you a very decent starting point.
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

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

    mammenj (13th August 2010)

  4. #3
    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: QTableWidget update problem

    ...and [QTCLASS] != [CODE].

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

    mammenj (13th August 2010)

Similar Threads

  1. QTableWidget top row won't update
    By kiss-o-matic in forum Qt Programming
    Replies: 0
    Last Post: 22nd June 2010, 02:36
  2. Unable to update QTableWidget which is on Different QWidget from MainWindow
    By sagar.mangalwedhekar in forum Qt Programming
    Replies: 1
    Last Post: 12th March 2010, 07:07
  3. update items in QTableWidget
    By darshan in forum Qt Programming
    Replies: 13
    Last Post: 3rd March 2009, 22:43
  4. why there is no update on maximize? [QTableWidget]
    By macias in forum Qt Programming
    Replies: 2
    Last Post: 7th August 2007, 15:01
  5. QTableWidget Update - slow
    By DPinLV in forum Qt Programming
    Replies: 16
    Last Post: 18th August 2006, 21:09

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.