Hi!
I'm setting a QTableWidget in a QTreeWidget, but the size of the table is the size of the cell of the tree (i.e. is too small) and the table doesn't fit, so i put the minimumHeight to the tableWidget bigger, now it appears but it appears on top of the other cells in the tree .
Here is the code
TableStruct t = ::getTable();
tableWidget->setRowCount(t.getRowCount()); tableWidget->setColumnCount(t.getColumnCount());
tableWidget->setHorizontalHeaderLabels(t.getColumnNames().toList());
int i = 0;
for( int row = 0; row < t.getRowCount(); ++row)
for( int col = 0; col < t.getColumnCount(); ++col, ++i )
ui.treeWidget->setItemWidget(item,1,tableWidget);
TableStruct t = ::getTable();
QTableWidget* tableWidget = new QTableWidget;
tableWidget->setRowCount(t.getRowCount()); tableWidget->setColumnCount(t.getColumnCount());
tableWidget->setHorizontalHeaderLabels(t.getColumnNames().toList());
QVector data = t.getData();
int i = 0;
for( int row = 0; row < t.getRowCount(); ++row)
for( int col = 0; col < t.getColumnCount(); ++col, ++i )
tableWidget->setItem(row,col,new QTableWidgetItem(data.at(i)));
ui.treeWidget->setItemWidget(item,1,tableWidget);
To copy to clipboard, switch view to plain text mode
I looks like this:
snap01.jpg
Now if i add
tableWidget->setMinimumHeight(50*t.getRowCount());
tableWidget->setMinimumHeight(50*t.getRowCount());
To copy to clipboard, switch view to plain text mode
It looks like:
snap02.jpg
Any help.
thanks.
Bookmarks