hec_mex
26th July 2012, 18:51
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 :mad: .
Here is the code
TableStruct t = ::getTable();
QTableWidget* tableWidget = new QTableWidget;
tableWidget->setRowCount(t.getRowCount()); tableWidget->setColumnCount(t.getColumnCount());
tableWidget->setHorizontalHeaderLabels(t.getColumnNames().toLis t());
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);
I looks like this:
8054
Now if i add
tableWidget->setMinimumHeight(50*t.getRowCount());
It looks like:
8055
Any help.
thanks.
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 :mad: .
Here is the code
TableStruct t = ::getTable();
QTableWidget* tableWidget = new QTableWidget;
tableWidget->setRowCount(t.getRowCount()); tableWidget->setColumnCount(t.getColumnCount());
tableWidget->setHorizontalHeaderLabels(t.getColumnNames().toLis t());
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);
I looks like this:
8054
Now if i add
tableWidget->setMinimumHeight(50*t.getRowCount());
It looks like:
8055
Any help.
thanks.