What kind of possibilities there are to get faster QTableView performance when adding big amount of rows. I want to add say, 10 000 rows in "batch" and then display it to user. It seems too slow for me. I want to know what is the fastest way to add "batch" data of large amounts.
I'm using QTableView and setting QStandardItemModel as model.
int main(int argc, char *argv[])
{
for (int i = 0; i < model.rowCount(); ++i) {
for (int j = 0; j < model.columnCount(); ++j) {
model.setItem(i, j, item);
}
}
view.setModel(&model);
view.setVerticalScrollBar(new WideScrollBar(&view));
view.show();
return app.exec();
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QStandardItemModel model(50, 3);
for (int i = 0; i < model.rowCount(); ++i) {
for (int j = 0; j < model.columnCount(); ++j) {
QStandardItem *item = new QStandardItem(QString("%1, %2").arg(i).arg(j));
model.setItem(i, j, item);
}
}
QTableView view;
view.setModel(&model);
view.setVerticalScrollBar(new WideScrollBar(&view));
view.show();
return app.exec();
To copy to clipboard, switch view to plain text mode
Bookmarks