Strange ListView UI Crash upon scrolling really quickly
-
Qt 6.x on Windows 10 with NVIDIA RTX 4060 Ti
I'm currently working on a passion project when I stumbled upon a bug that has had my brain scratching for a day now.. I have no idea what causes this..
The crash happens when 13-14 delegates are created using reuseItems: false.
If I have reuseItems to true the crash happens only when I move the scroll bar really fast. With a fair amount of delegates (I tested with 100)I tried commenting out the DesignEffects but when I do the crash happens the moment App.qml loads.
when I have DesignEffect uncommented is the opposite. It somehow HELPS the crash not happen.The crash is not a full application crash. The window seems to immediately close on itself with ZERO console logs on the crash. And the QApplication seems to continue running
The crash for the most part doesn't occur when the delegate is only a simple rectangle. But adding an Image or literally even text causes a crash.
Text { id: textfe anchors.fill: parent text: "Hello" }The crash only occurs in Qt Creator and not in Design Studio.
I have this custom component used as the delegate
import QtQuick import QtQuick.Controls import QtQuick.Effects import QtQuick.Studio.DesignEffects Item { id: root width: 823 height: 180 Rectangle { id: rectangleRoot width: root.width height: root.height color: "#2e2e2e" Image { source: "images/recordsBg.png" asynchronous: true fillMode: Image.PreserveAspectCrop width: rectangleRoot.width height: rectangleRoot.height } Text { id: sysName color: "white" horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignTop font.family: "Anton" width: rectangleRoot.width height: rectangleRoot.height / 2 padding: rectangleRoot.height / 8 text: "Hydrae Sector DQ-Y b4" font.pixelSize: rectangleRoot.width / 16 DesignEffect { effects: [ DesignDropShadow { } ] } } Text { id: categoryName color: "white" horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter width: rectangleRoot.width height: rectangleRoot.height leftPadding: rectangleRoot.height / 8 topPadding: rectangleRoot.height / 7 text: "Trinary collidable or something" font.pixelSize: rectangleRoot.width / 29 font.family: "Lora" DesignEffect { effects: [ DesignDropShadow { } ] } } Text { id: distance color: "white" horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignBottom font.wordSpacing: 0 width: rectangleRoot.width height: rectangleRoot.height leftPadding: rectangleRoot.height / 8 topPadding: rectangleRoot.height / 7 bottomPadding: rectangleRoot.height / 13 text: "153.8 LY" font.pixelSize: rectangleRoot.width / 21 font.family: "Lora" DesignEffect { effects: [ DesignDropShadow { } ] } } RButton { id: clickButton width: rectangleRoot.width / 4 height: rectangleRoot.height / 3 anchors.right: rectangleRoot.right anchors.rightMargin: rectangleRoot.width * 0.025 anchors.bottom: rectangleRoot.bottom anchors.bottomMargin: rectangleRoot.height * 0.133 bcolor: "#ff7700" hoverColor: "dark orange" pressedColor: "orange" Text { id: textButton color: "white" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter font.wordSpacing: 0 width: clickButton.width height: clickButton.height text: "View" font.pixelSize: clickButton.width / 8 anchors.centerIn: clickButton font.family: "Anton" DesignEffect { effects: [ DesignDropShadow { } ] } } } } }And I have this list view
ListView { id: middleBar height: parent.height width: parent.width - (parent.width / parent.sidebarwidth * 2) anchors.centerIn: parent spacing: recordsInterface.height / 60 clip: true reuseItems: true ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded } model: 100 delegate: SystemCard { width: middleBar.width height: middleBar.height / 6 } footer: Item { id: wrapper width: ListView.view.width height: recordsInterface.height / 8 RButton { id: moreButton width: parent.width / 1.5 anchors.centerIn: parent height: recordsInterface.height / 10 radii: width / 30 bcolor: "#ff7700" hoverColor: "dark orange" pressedColor: "orange" Text { id: buttonText color: "white" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter font.wordSpacing: 0 width: parent.width height: parent.height text: "Show More" font.pixelSize: parent.width / 8 anchors.centerIn: parent font.family: antonFont.name DesignEffect { effects: [ DesignDropShadow { } ] } } } } } -
After countless hours of debugging solution was really REALLY obscure. I had my QURL for QQmlApplicationEngine set to a loading screen then creating the App component from there. Qt really did not like this. returning the Original App.qml as my main URL and then running engine.load for my loading screen.
engine.load(url); engine.load("qrc:/qt/qml/ExplorariumContent/LoadingScreen.qml");TLDR: I used a very buggy method to load the app which caused ListView to freak out.
Component { id: appComponent App {} } Connections { target: loadingScreenManager function onLoadApp() { var appWindow = appComponent.createObject(null) appWindow.effect.start() Qt.callLater(function() { root.close() }) } } -
R Regza has marked this topic as solved