[Development] Views

André Pönitz Andre.Poenitz at qt.io
Thu Jun 6 17:42:13 CEST 2019

Иван Комиссаров wrote:
> I think, your point is wrong. Despite the fact Qt is a GUI toolkit, it should perform well.
> Take a look at Qt Item Views. They really sucks in terms of performance.
> QAbstractItemModel can have any number of rows/columns (that fits in MAX_INT),
>  but which view can really handle that? None of them!
> I had to use a model with 3kk rows in it.

"3kk" doesn't parse as number for me, but assuming that's 3 * 1024 * 1024
the problem must have been somewhere else as the following shows
10 million entries in a standard QTreeView:

#include <QApplication>
#include <QTreeView>
#include <QAbstractItemModel>

struct Model : QAbstractItemModel
    QModelIndex index(int row, int column, const QModelIndex &) const
        return createIndex(row, column);

    QModelIndex parent(const QModelIndex &) const { return {}; }

    int rowCount(const QModelIndex &) const { return 10 * 1000 * 1000; }

    int columnCount(const QModelIndex &) const { return 1; }

    QVariant data(const QModelIndex &index, int role) const
        if (index.isValid() && role == Qt::DisplayRole)
            return index.row();
        return {};

int main(int argc, char *argv[])
    QApplication a(argc, argv);
    Model m;
    QTreeView v;
    return a.exec();


More information about the Development mailing list