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![]()
Bookmarks