Fusion style QTableView leaving shadow highlight only on single cell
-
Thanks for the prompt reply!
I'm working in Windows 11 and I've created a minimal (compilable) example that I've pushed to GitHub showing the issue that I'm running into.
Locally my system is in a dark theme with purple as the accent color.
-
Use the windowsvista style instead to see if the problem persist.
-
Ultimate the same thing can be seen with the windowsvista style, just not as pronounced. With the windowsvista the cell retains a dashed line.
With the windowsvista style I feel that it's more clearly noted that this is "where you last clicked" whereas the fusion style makes it seem like it's actually highlighted.
Is this behavior something that can be turned off?
-
@cancech Please simplify your example - no need for a model or extra mainwindow. The less classes the less to debug here.
-
@Christian-Ehrlicher I'm not sure how to simplify my example. I don't see how to add data to the QTableView without creating my own model and I believe that mainwindow.h, mainwindow.cpp, and mainwindow.ui are all three needed. Short or removing the mainwindow.ui and reproducing the layout in code that is.
-
@cancech simply create a tableview, add a stringlist model and show it. No mainwindow or other stuff needed.
-
@Christian-Ehrlicher Got it! I've updated the example to remove the unnecessary pieces.
-
Ok, now I know what you mean. This is the marking for the currently index. There is a difference between selected indexes and current index. That's the same as when you select a file in windows explorer and then click on a blank area - the previously selected row is still painted somewhat different.
-
@Christian-Ehrlicher Ahh, I see. So it's there to indicate "if you press the arrow keys, there is where you'll be starting from". Considering that I'm using whole row selection, shouldn't the whole row be the index then? I would presume that pressing the left/right arrows wouldn't really do anything
-
@cancech In Qt there is only one 'current index' possible. And you can't change this anywhere - you can only change the selection behavior.
-
@Christian-Ehrlicher Gotcha, thanks so much for all the help and figuring out what's going on!
-
@cancech You might reset the current index flag during painting by overriding https://doc.qt.io/qt-6/qabstractitemview.html#initViewItemOption
-