Details
-
Bug
-
Resolution: Duplicate
-
P3: Somewhat important
-
None
-
6.8.0 RC
-
None
-
Ubuntu 22.04, Android
Description
The delegate positions seems to be incorrect if a large model (millions of rows) is used with a ListView (or a TableView). The first ~3.3 million items looks fine, but then spacing gets more and more distorted.
Qml:
import QtQuick import QtQuick.Controls import QtQuick.Layouts import model1 ApplicationWindow { visible: true ListView { id: listView anchors.fill: parent model: model1 ScrollBar.vertical: ScrollBar { policy: ScrollBar.AlwaysOn } delegate: Rectangle { width: listView.width height: 20 Text { text: display anchors.centerIn: parent } } } }
Model:
#include <QAbstractListModel> class Model1 : public QAbstractListModel { Q_OBJECT public: Model1(QObject* parent = nullptr): QAbstractListModel(parent) { } int rowCount(const QModelIndex& parent = QModelIndex()) const override { return 20000000; } QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override { if (role == Qt::DisplayRole) return index.row(); return QVariant(); } };
Main:
#include <QGuiApplication> #include <QQmlApplicationEngine> #include <QQmlContext> #include "model1.h" int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; Model1 model; engine.rootContext()->setContextProperty("model1", &model); engine.loadFromModule("model1", "Main"); return app.exec(); }
Attachments
Issue Links
- duplicates
-
QTBUG-43193 ListView has drawing problems with large models
-
- Reported
-
-
QTBUG-109645 When using listview to display millions of data, the spacing will become larger and smaller
-
- Closed
-