(search) Keep menu open when selecting tags
ClosedPublic

Authored by iasensio on Jan 1 2020, 3:06 PM.

Details

Summary

Keeps the Tags menu open while selecting and deselecting tags in the
search panel, saving many mouse clicks for multiple tags.
It cannot be done natively on QMenu (https://bugreports.qt.io/browse/QTBUG-6635)
but it is a one-liner and I haven't seen any bad behavior so far.

Test Plan

  • Tags menu does not close when selecting/deselecting tags
  • Tag search is consistent
  • Clicking anywhere else will close the menu

Diff Detail

Repository
R318 Dolphin
Branch
search_tags_sticky
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 20541
Build 20559: arc lint + arc unit
iasensio created this revision.Jan 1 2020, 3:06 PM
Restricted Application added a project: Dolphin. Β· View Herald TranscriptJan 1 2020, 3:06 PM
Restricted Application added a subscriber: kfm-devel. Β· View Herald Transcript
iasensio requested review of this revision.Jan 1 2020, 3:06 PM
iasensio edited the test plan for this revision. (Show Details)Jan 1 2020, 3:08 PM
iasensio edited the test plan for this revision. (Show Details)Jan 1 2020, 3:14 PM
broulik added a subscriber: broulik.Jan 1 2020, 3:17 PM

I think you probably want to use an event filter instead to keep the menu from closing in the first place?

I think you probably want to use an event filter instead to keep the menu from closing in the first place?

I'm not so sure I want to enter there πŸ˜ƒ

I have just tried and indeed it works but, as the file view is refreshed, there's a flickering effect,
which I find much more uncomfortable than when just reshowing the menu.
OTOH, with this method we can also set the spacebar to select/deselect tags by keyboard.

iasensio updated this revision to Diff 72549.Jan 1 2020, 5:25 PM
  • Use eventFilter

I have uploaded the version with eventFilter so you may try if the flicker is too much to be annoying or it is just me.
I'd still prefer the simplest/maybe hackiest oneliner to just re-show the menu:

m_tagsSelector->menu()->show();

Ehhhh, I find the flicker pretty annoying. :/

However aside from that, the menu population behavior with tags that include spaces is a bit... interesting...

Ehhhh, I find the flicker pretty annoying. :/

I think I'll re-upload the first revision so you can try it too, and decide on that.

However aside from that, the menu population behavior with tags that include spaces is a bit... interesting...

Oh sure! That's a thing I saw back in the day but required some other changes in the query parsing bit, and then I forgot.
Now that those changes are in master, it's quite simple: D26369

iasensio updated this revision to Diff 72625.Jan 2 2020, 3:43 PM

Going back to the simpler option.
This should have less flickering

Heh, there still seems to be a bit of flickering here even with this version. However this version has much less code! :D

The flickering in the current state is kind of unavoidable.
Every time a tag is clicked and a new search is made, the whole search url is reparsed and the menu gets repainted several times.
It seems to me that it is less annoying when the repainting is done "in the dark" and then show the menu again, that when it's keep visible the whole time.
Due to the way that tags are retrieved (using a KDirLister, as in the context menu) I cannot think of a better while simple way to do it without a major refactor and lots of extra code.

I have no strong feelings for this patch πŸ˜ƒ so if you consider the user experience is worse than just closing the menu every time, I will happily abandon it.

iasensio added a reviewer: VDG.Jan 2 2020, 4:50 PM
iasensio added a subscriber: VDG.
ngraham accepted this revision as: VDG.Jan 3 2020, 12:34 AM

No, I think it's nicer to keep it open, even with a bit of flickering.

elvisangelaccio accepted this revision.Jan 6 2020, 12:35 PM
This revision is now accepted and ready to land.Jan 6 2020, 12:35 PM
This revision was automatically updated to reflect the committed changes.

I know this topic is closed now, but I just wanted to put forward a small suggestion for any possible future revisions of this code.

When clicking on a tag droplist, it would be nice if the first entry was a "filter" textbox, so that the user can type the name (or part of the name) of the tag that they are looking for and this will reduce the number of available tags to present right below (in the tag list with the checkboxes).

The filter text could be preserved until the user changes it themselves.

As a heavy user of tags (30+ tags), that would be an amazing feature to have.