Bug 491127

Summary: BaseTableView: selection(Model) is cleared when table is left using the tab key
Product: [Applications] plasma-systemmonitor Reporter: cwo <cwo.kde>
Component: generalAssignee: KSysGuard Developers <ksysguard-bugs>
Status: CONFIRMED ---    
Severity: minor CC: ahiemstra, nate, plasma-bugs-null
Priority: NOR Keywords: usability
Version First Reported In: master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description cwo 2024-08-01 14:28:27 UTC
SUMMARY

When leaving a BaseTableView table such as the applicationstable or processtable with the tab key, the currently highlighted row stays highlighted, but is no longer selected. The "Quit Application"/"End Process" buttons become disabled, and the Application Details sidebar tells you to "select an application to see its details". When only using the keyboard, sometimes this only seems to happen on the second go around the tab focus chain, but if the row is focused with the mouse it happens immediately on the first try.


STEPS TO REPRODUCE
1. Open System Monitor
2. Click Applications
3. Click one of the entries in the list, verify that "Quit Application" is enabled 
4. Press tab

OBSERVED RESULT

"Quit Application" becomes disabled

EXPECTED RESULT

"Quit Application" stays enabled

SOFTWARE/OS VERSIONS

Operating System: TUXEDO OS 3
KDE Plasma Version: 6.1.3
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.0
Kernel Version: 6.5.0-10043-tuxedo (64-bit)
Graphics Platform: Wayland

also tested on git master

ADDITIONAL INFORMATION

Putting  `onSelectionChanged: (next, prev)  => console.log(prev, " ->", next)` in the selectionModel shows that the selection in the selection model is cleared when tab is pressed, but I haven't been able to figure out why.
Comment 1 Arjen Hiemstra 2024-08-06 14:06:13 UTC
I'm reasonably sure this is a Qt bug. When trying with a more simple test case, it actually ends up with "Tab" going through the individual table view delegates and there doesn't seem to be a way to escape it, even though the arrow keys also navigate the table. More importantly, if I select something in the table then press Tab a few times to select the table, the first press just moves focus to the table and nothing changes, but the second will move the current index and with that clear the selection.