Qt::SizeHintRole isn't adjusting the height of a QTableView Row?
-
I have a QTableView where one column needs to contain both the image and text. What I have is a model that returns the QPixmap on the Qt::DecorationRole and the text on Qt::DisplayRole. The problem is the height of each row cuts off the image. How exactly do I get the height to adjust to that of the image?
I tried returning the QSize of the QPixmap on the Qt::SizeHintRole, but then there is no image at all.
What am I missing?
SAm
-
There where a number of steps, most of them I got from here:
http://developer.qt.nokia.com/faq/answer/how_can_i_change_the_row_height_of_a_qtreeview
I had to set QTableView::resizeRowsToContents to true and implement the QItemDelegate::sizeHint. In implementing the sizeHint, I had to get into the model, get the image, and return the size of the image. Once I did that, it sized correctly for me.