PDA

View Full Version : How can I set the row height and column width of a QTableView?



mythili
7th May 2013, 13:22
I am having text and Image in one row and other rows are having only text. I want to set the height of row to the content of the row. So I am using ui->tableView->resizeColumnsToContents();
ui->tableView->resizeRowsToContents();

1)All other rows are resizing except the row which containing the image and test.
2) How to break the text in the row if its long and then set the width of column.

Please hrlp me in setting the height of rows and width of column in TableView.

Jonny174
8th May 2013, 04:02
QVariant YourTableViewModel::data( const QModelIndex &index, int role ) const
{
...

if (role == Qt::SizeHintRole)
{
...
}

...
}