PDA

View Full Version : QTableWidget in a QTreeWidget problem



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.

ChrisW67
27th July 2012, 03:39
What do you expect if you have not adjusted the height of the QTreeWidget row the table is inserted into?

hec_mex
31st July 2012, 18:22
It is adjusted.

I'm using proxys, it might be for that.

hec_mex
7th August 2012, 17:49
are you asking? or telling me? could you be more helpfull?
thanks!