OK, do you see row and column labels on the table headers?
OK, do you see row and column labels on the table headers?
I see solumn headers, yes, but row headers no, because I've hide it with verticalHeader()->hide() method.
yes, I can see them.
I'd still suspect the problem is with those strings. What happens if you replace:
with something likeQt Code:
To copy to clipboard, switch view to plain text mode
?Qt Code:
To copy to clipboard, switch view to plain text mode
J-P Nurmi
I tried your stuff and it doesn't work, but found out very odd thing.
When I replace j with zero (that means this code):
tableTestSuits->insertRow(0);
tableTestSuits->setItem(0,0,item2);
tableTestSuits->setItem(0,3,item4);
tableTestSuits->setItem(0,4,item5);
tableTestSuits->setItem(0,1,item3);
tableTestSuits->setItem(0,2,item);
-----------------------------------------------
I get cell properly. I found this very odd. Have any ideas about it?
j is parameter of for loop. Look my first post on this topic
No, I don't do anything with it. Just use for indexing. Still, have no idea. Very odd...
Does this work on your system?Qt Code:
#include <QApplication> #include <QTableWidget> const int nRows = 10; const int nCols = 10; int main( int argc, char **argv ) { QTableWidget tw; tw.setColumnCount( nCols ); for( int i = 0; i < nRows; ++i ) { tw.insertRow( i ); for( int j = 0; j < nCols; ++j ) { tw.setItem( i, j, item ); } } tw.show(); return app.exec(); }To copy to clipboard, switch view to plain text mode
Yes, it runs OK. Funny, though, I've noticed some other things about my code for qtablewidget. For some iterations, qtablewidgets prints ok, and for some input not. I understand that strings are most suspicious, but, i've printed them with cout in console, and they are OK, just as they should be. Plus, if I just replace j with zero, code runs well. If I changed just index of rows, then strings aren't problem. Am I wright?
Bookmarks