Results 1 to 5 of 5

Thread: Properly using QTableWidget and QTableWidgetItem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Oct 2012
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Properly using QTableWidget and QTableWidgetItem

    Zlatomir thanks for answering.

    Your point about table taking ownership is correct, thanks for explaining. However, yes, I get random string garbage in in second cell (for iter.value()). Specifically, I get text from labels on my window instead of QMap values. Yes, strange. I've debugged and the values in QMap are correct so I was guessing something has to be wrong with pointers. A screenshot:

    wxhoX.jpg



    If I put in some string to second QTableWidgetItem it displays it well. Also, I've tested the iter.value() values (qDebug() << iter.value();) and they are correct. Maybe I have to cast int to String in some special way?

    ** MAJOR EDIT:
    I was able to fill the second cell properly using
    QTableWidgetItem *item1=new QTableWidgetItem(tr("%1").arg(iter.value()));

    Why Did I have to do this it's still a mystery to me
    Last edited by c0dehunter; 27th October 2012 at 15:37.

Similar Threads

  1. Replies: 1
    Last Post: 10th January 2012, 21:59
  2. QTableWidgetItem for a QTableWidget
    By Archa4 in forum Newbie
    Replies: 1
    Last Post: 28th April 2011, 11:11
  3. QTableWidget or QTableWidgetItem CSS
    By ajayajgdeva in forum Newbie
    Replies: 0
    Last Post: 5th February 2010, 13:47
  4. QTableWidget+QTableWidgetItem trouble
    By Fastman in forum Qt Programming
    Replies: 13
    Last Post: 10th November 2007, 12:19
  5. QTableWidget QTableWidgetItem
    By TheKedge in forum Qt Programming
    Replies: 3
    Last Post: 6th September 2006, 15:03

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.