Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.8, 6.9
-
0a1d8fb26 (6.8.0), 43c2c4e9f (tqtc/lts-6.5.7), 101df5c2c (dev), 8971dc7ab (6.8), cfde91bea (tqtc/lts-6.5)
Description
When a ListView has an initial size of 0 it fails to process model changes correctly resulting in countChanged never getting emitted.
I'm attaching a minimal example that makes visibility conditional on count>0. When running it through bin/qml it does not ever switch to visible because the count is always 0, despite the model growing every second.
This broke in qtdeclarative 477c15def834bd49553c00b90f3a2006456ea931.
Downstream report https://bugs.kde.org/show_bug.cgi?id=493266
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL // SPDX-FileCopyrightText: 2024 Harald Sitter <sitter@kde.org> import QtQuick import QtQuick.Layouts ColumnLayout { ListView { Layout.fillWidth: true Layout.preferredHeight: contentHeight // grow with content, initially 0 visible: count > 0 // actual defect. countChanged never fires so this never turns true model: ListModel { id: idModel } delegate: Text { required property string name text: name } Timer { running: true interval: 1000 repeat: true onTriggered: idModel.append({name:"Hello"}) } } }
Attachments
Issue Links
- relates to
-
QTBUG-129974 ListView add 2x more items when Model.roleNames is updated between beginResetModel and endResetModel
- Closed
- resulted from
-
QTBUG-125416 SwipeView shows all elements at once if it is 0x0 in size
- Closed