SUMMARY I have a C++ program that uses KWindowSystem and its QListview. I call setCurrentIndex to jump to specific items when searching. This works in most cases by setting the item as current and selected. But sometimes, it selects and highlights the wrong item, specifically one past the expected item; e.g., index 73 instead of 72. STEPS TO REPRODUCE 1. in my app, it can be repeated. 2. but i have not determined the pattern. 3. i have reduced the total number of items to just 4, and it misbehaves still. OBSERVED RESULT EXPECTED RESULT SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: 5.27.4 (available in About System) KDE Plasma Version: 5.27.4 KDE Frameworks Version: 5.104.0 Qt Version: 5.15.8 ADDITIONAL INFORMATION
My mistake. My bug! Sorry about that.
Described problem in SUMMARY was due to my eventFilter returning False instead of True when 's' was processed. QListview then moved to the next item; I was expecting item 72 but 73 was selected by QListview. This led me to believe .setCurrentIndex() was not working properly. So, of course, when I return true in eventFilter, my program worked as expected. My question is: is this processing of 's' (actually also 'c') by QListview documented? It seems like a bug to me.
What does this have to do with KWindowSystem? KWindowSystem is a library for doing various X11/Wayland specific things, it has nothing to do with QListView and your problem. If you think there is a bug in Qt then use https://bugreports.qt.io/ or ask in their forum