V
V
Victor Potebenko2021-01-09 02:49:16
Python
Victor Potebenko, 2021-01-09 02:49:16

Why is the shift done by 3 elements even though BatchSize = 100?

Explain why when scrolling the wheel in QListWidget, the top item first becomes "item 4", then "item 7", "item 10" and so on, although BatchSize = 100? That is, BatchSize is not the number of elements when scrolling the mouse wheel? Here is the code ready to run:

import sys

from PyQt5 import QtCore, QtWidgets

app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QWidget()
window.setWindowTitle("Класс QListView")
window.resize(300, 150)
view = QtWidgets.QListView()

view.setLayoutMode(QtWidgets.QListView.Batched)
view.setBatchSize(100)

L = []
for i in range(1, 100000):
    L.append("Пункт {0}".format(i))
model = QtCore.QStringListModel(L)
view.setModel(model)
box = QtWidgets.QVBoxLayout()
box.addWidget(view)
window.setLayout(box)
window.show()
sys.exit(app.exec_())

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2021-01-09
@Paitor

Is not . BatchSize - how much is rendered per approach (so that the list display does not slow down in case of very large lists)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question