I am working on a GUI to display log messages. For this I use a QTableView and a model that inherits from QAbstractTableModel. Each row in the QTableView represents one message. Due to the fact that some messages contain more text than others I have to resize the row height depending on the text length. For this I set the following:
Qt Code:
  1. tableView->setWordWrap(true);
  2. tableView->setTextElideMode(Qt::ElideNone);
  3. tableView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
To copy to clipboard, switch view to plain text mode 

This works so far. The problem is a performance issue. If I insert one item the sizeHint role is called for all rows (and their columns) in the model - not only for the ones that are visible.
Is there a way to get QT calculate sizes of visible rows only ?

After inserting a new row into the model i called "reset()" in a first version. In my newest version I use "beginInsertRows()" and "endInsertRows()" instead but anyway the sizeHints of all model elements is requested by the view.