Fix accidental triggering of reset in parent menu

Authored by rade on Mar 29 2018, 8:10 PM.



Fixes the following bug:

  1. Use arrow keys to select a folder such as "Popular urls" (this works

if the folder was selected by searching as well e.g typing 'popu')

  1. Use right arrow to enter folder
  2. Use left arrow or esc to close the folder submenu. Folder item in main menu

remains highlighted and we receive a 'QEvent::Close' as expected

  1. Type a letter too search
  2. Search gets reset by two spurious QEvent::Close triggered by the folder loosing focus

Note that with this patch the search result will still loose focus, but this patch fixes the reset at least.

Test Plan

Ensure that there isn't a race condition with the isVisible check. I.e is QEvent::Close always sent _before_ the menu is actually closed despite the documentation stating "was" not will be (as far as I can tell it is).

QEvent::Close | Widget was closed (QCloseEvent).

Can the menu become closed/invisible before we are done dealing with the event or does it wait for us to deal with it? I tested it by by sleeping for 5 seconds before the isVisible test and the menu didn't close until after. But that doesn't prove it conclusively or for all cases.

Diff Detail

R167 Krusader
Lint Skipped
Unit Tests Skipped
rade requested review of this revision.Mar 29 2018, 8:10 PM
rade created this revision.
rade edited the test plan for this revision. (Show Details)
rade updated this revision to Diff 30876.Mar 29 2018, 8:14 PM

Accidentally submitted the previous to last revision.

nmel added a comment.Apr 1 2018, 6:53 AM

Rade, could you please check D11829? I think it a better way to solve the problem as it doesn't rely on a menu visibility.

rade abandoned this revision.Apr 2 2018, 1:08 AM