Details
-
Bug
-
Resolution: Won't Do
-
P2: Important
-
None
-
5.12, 5.15
-
Tested with QtCreator version 5.11.1, 5.12.2, 5.13. Windows and centos7
Description
Hi,
I'm not an expert in Qt but I have been working with it for about a year. I'm designing a system for the DoD which requires fast reaction time. Essentially I'm reading from a database, populating the data using QStandardItem(s) into a QStandardItemModel. Nothing fancy.
In 5.11 when I insert into the model, it runs extremely fast. Delete is equally as fast. However the same code running on 5.12 is much slower. Also in 5.11 I'm able to sort using by simply
using treeView->sortByColumn(columnNumber, Qt::AscendingOrder); without the need for QSortFilterProxyModel. In addition, in 5.11 when I remove hundreds of rows at a time the memory seems to be stable (not going up), however in 5.12 the memory continues to grow.
The way I add rows is as follows:
QList<QList<QStandardItem *>> QStandardItemList QStandardItemModel *metaDataModel = new QStandardItemModel; //remove Rows (could be hundreds or even thousands - the more rows the longer it takes) >if(rowNumber > NUMBER_ROWS_TO_DISPLAY) { int numberOfRowsToRemove = rowNumber - NUMBER_ROWS_TO_DISPLAY; //this next command is very slow on 5.12 but very fast in 5.11 rowNumber -= numberOfRowsToRemove; metaDataModel->removeRows(0, numberOfRowsToRemove, QModelIndex()); } //Add a row (could be hundreds or thousands of rows) for(rowIterator = 0; rowIterator < QStandardItemList.size(); rowIterator++) { //Insert Rows //This is also slower in 5.12 but very fast in 5.11 metaDataModel->setItem(rowNumber, 0, QStandardItemList[rowIterator][colNum]); for (columnIterator = 1; columnIterator < QStandardItemList[rowIterator].size(); columnIterator++) { metaDataModel->setItem(rowNumber, columnIterator, QStandardItemList[rowIterator] [columnIterator]); } metaDataModel->setItem(rowNumber, 0, QStandardItemList[rowIterator][colNum]); rowNumber++ }
If you could let me know when you plan on investigating this issue, I would appreciate it since I need to report to my managers. The organization doesn't like going back releases only forward. So for now I'm stuck with 5.12.x. I also tried with 5.13 with the same results, very slow inserts and deletes.
Attachments
Issue Links
- resulted from
-
QTBUG-61368 QStandardItemModel: When there is a lot of rows in a QTreeView, then doing a selectAll(), followed by expanding some items then selectAll() again can cause a performance hit
- Closed