I have to add some additional information to answer that. If a message arrives it is stored in a list "m_msgList" which has nothing to do with my QT model. Triggered via a QTimer a method "updateMsgView()" is periodically triggered. This method moves all entries of "m_msgList" to the "m_tableViewList" that is used in the QT Model.
The following code fragment shows the part where the messages are moved to the model list. Even when "m_msgList" contains just one message the sizeHint role of all rows in the model is called.
void updateMsgView(){
...
//append the msgList to the tableViewList
iter = m_tableViewList.end();
beginInsertRows
(QModelIndex(),m_tableViewList.
size(),m_tableViewList.
size() + m_msgList.
size() -1);
m_tableViewList.splice(iter,m_msgList);
endInsertRows();
emit signalScrollToBottom();
}
void updateMsgView(){
...
//append the msgList to the tableViewList
iter = m_tableViewList.end();
beginInsertRows(QModelIndex(),m_tableViewList.size(),m_tableViewList.size() + m_msgList.size() -1);
m_tableViewList.splice(iter,m_msgList);
endInsertRows();
emit signalScrollToBottom();
}
To copy to clipboard, switch view to plain text mode
Due to the fact that the content of the messages does not change it should be possible to resize them one time (at the time they are moved to the model).
Bookmarks