-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix several issues with the GroupedListWidget #6704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thank you. Could you please fix the conflicts, which were introduced after the merge of PR #6701? |
What timing! Hope my PR didn't cause too much trouble. I'm looking forward to testing this out; it looks like great improvements. |
…llapsed In this case the number of displayed items (the _list) may be smaller than the total number of items (the _dataList). The index passed to the function refers to the latter, but the sanity checked compared the index to the size of the former. This fixes bug #15959.
The given index needs to be mapped to a displayed item index in all cases, whether a filter is applied or not. This was done, but in a different place of the function. This is now consolidated in a single place.
Setting the selected item can fail in the GroupedListWidget if the item is not visible, either because of a filter, or because the group is collapsed. Normally this should not happen, but could happen if for example editing manually the lastselectedgame in the config file.
When rebuilding the list of games for the grouped list widget we need to apply the filter after reloading the list of closed groups. Otherwise the filter is lost when we set the closed groups.
… the filter This also ensure that kListSelectionChangedCmd command is sent even if the selection could not be preserved, which properly disables the buttons in the Launcher dialog.
…group The selection needs to be reset after reloading the closed groups and reaplying the filter. Otherwise it may be lost when we do so.
The conflict has been fixed.
Yes, I got the crash I had reported earlier again last night and finally decided to bite the bullet and debug it, and I fell into a rabbit hole. Fortunately the two PRs complemented each others well and there was only one small conflict easily resolved. |
Looks good! One issue that came up when testing is that closing a group now scrolls to the selection, causing jumping that didn't occur before:
|
This issue is related to the last bullet point in the PR description and the main reason why I wrote that "I am not sure about this change however". The last commit in this pull request changes the behaviour when opening or closing a group:
In current master, opening or closing a group clears the selection. It forgets to update the launcher button state (e.g. disable the Start Game button), but that could easily be fixed. And as we click on a header item to close or open a group, deselecting the previously selected item seems a perfectly reasonable behaviour. So we could decide to drop my last commit and instead fix the missing launcher button state update. Or we could use only part of that commit. As I see it we have several options:
|
@criezy From the available options, I believe that the second one makes more sense, i.e: Preserving the selection when closing a group will be confusing, as the user will no longer view that selection. Selecting the first item in a group when opening it sounds like a good idea |
I think that 3 means preserving the selection if it's not in the closed group. |
thank you, this drives me crazy and it's so common in programs that implement filters or multiple playlists (eyes RetroArch). |
I think that in general, opening and closing a group should not affect selection or scrolling, because they're unrelated operations. (Also, when in doubt, pull up a file browser in your operating system and see how it behaves; they're all pretty much in agreement over these basics.) Some exceptions that seem reasonable:
A common theme in the GUI issues I encounter here are unexpected side effects and uncommented opinions that once they get discovered and discussed are recognized as odd. I think "do less" is a good GUI guideline, and only "do more" when it can be justified in comments. (If a GUI choice can't be easily explained, that's a sign!) I'm not a user of the grouped list though, so weigh my opinions accordingly. I may start using it, grouping is great. But I don't understand the point of being able to open and close groups in our GUI; that feels like a feature in search of a use case. I spent my time in the list selecting games, not sure what the rest of you are up to =) |
Admiring the game list mostly. More seriously, Ags has like, a thousand freeware games and it's fairly easy to accumulate a collection over the years. Ags is also one of the first engines on that category list, so if you want to check out anything else, it's much easier to collapse the category than scroll down... Personally I'd prefer the year of release category if only there weren't so many games without one. It's also a bit funny when the name itself includes a date and it's much later (because it's a later version than the actual first release, some of the king's quest games versions are like this I think) |
Thank you all for your feedback. Indeed following what is normally done in tree views is a good idea to avoid breaking users expectations. And the standard behaviour is to preserve the selection both when closing and opening a group. So once I am back at my computer I will change that last commit to:
We could tweak that behaviour for the case were no game was selected before we open a group to select the first game in that group. I am not however sure this would be a good idea as this would deviate from the standard behaviour and also mean that when we open a group it would sometimes select the first game in the group and sometimes not, which could be a bit confusing. |
On KDE, collapsing a tree, clears the selection if the entry disappears. Else it is kept. |
The Qt QTreeView also keeps the selected collapsed entry (but does not select the parent). But in our case here selecting the parent makes no sense (we can only select games) and keeping the selection of a collapsed entry would be complicated as the selection is tracked using the index of listed items (which the collapsed entry is no longer part of). So the behaviour I pushed clears the selection in this case. But otherwise it now tries to preserve the selection. I will wait for all the checks to complete, but I think it is good to merge now. |
This pull request fixes the following issues:
sendCommand(kListSelectionChangedCmd, -1);
to properly disable the Start Game and Game Options buttons after deselecting the item. Let me know if you would prefer that approach.This also cleans a little bit the function to set the selected item in the GroupedListWidget.