How to avoid distant, unrelated parts of the screen flickering when scrolling ("flicking") in a QML ListView?
-
I need to show many ListViews in one large window, each of them showing long lists of strings, where the ListViews are created programmatically and arranged in the window in columns. Ultimately this program will require about a dozen ListViews with 200 or so items each.
It is very disappointing to see that, when scrolling with the middle mouse button (corresponding to "flicking" if on an Android device), parts of the screen other than the ListView being scrolled exhibit a very unattractive and disturbing flickering.
Once there are beyond about three ListViews, with about 100 items each, scrolling one of them can cause the others to flicker. There can be more ListViews without flickering if there are fewer items, or if the items are made simpler and simpler, the simplest just being one plain text item creating statically. Going to any form of rich text (with two sizes or colors of font) will also produce the bad results.
I don't really understand what is going on beneath the hood but I feel that flickering behavior outside the list being scrolled is not an acceptable result and that it should easily be avoidable. I have tried various sizes of cacheBuffer in the ListView, and made the delegate as simple as possible, and used a loader for the delegate and even made the loader asynchronous. On the whole the best results are with an asynchronous loader, but there is still flickering and this also plays havoc with the scrollbar.
I don't mind jerkier or slower scrolling in the ListView itself, but what I cannot handle is the flickering of a distant and ostensibly unrelated part of the screen when scrolling. Surely this at least can be avoided?
This is with Qt 5.12 and 5.14, on Linux (Fedora 30), onboard Intel UHD graphics with the KMS i915 driver in X. Maybe the problem lies outside Qt and my attempts to use it, but I doubt it.
EDITED TO ADD, UPDATE: I think I found the solution. Yes, the problem lies with the Linux/X/Intel relationship to Qt/QML it seems. I looked into how to force purely software rendering within QML, and one can do it with
QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software);
So with this, things seem to work very well, even though it is just software rendering. It still does pretty nice flick scrolling but without any of the flickering.
I will mark this post solved but leave it here in case anyone has any other thoughts. Pretty sure other stuff I use, like Google Earth, use the hardware acceleration, but I guess it works better with some things than others.