Bug report #17453

Right-click on QGIS Toolbars no longer shows the drop-down list of panels and toolbars

Added by Harrissou Santanna almost 7 years ago. Updated over 6 years ago.

Status:Closed
Priority:High
Assignee:-
Category:GUI
Affected QGIS version:master Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:25350

Description

To enable or disable a toolbar/panel, you could right-click any "empty" place on a toolbar, on the menu bar, on a panel and you get a list of panels and toolbars with checkbox.
This seems to no longer work in master. Right-clicking does nothing.
Tested on Windows.

Associated revisions

Revision cefb1bc7
Added by Steven Mizuno almost 7 years ago

remove Windows OS specific event filter that eats context menu events

fixes #17453

History

#1 Updated by Giovanni Manghi almost 7 years ago

  • Priority changed from Normal to High

#2 Updated by Michel Stuyts almost 7 years ago

I noticed similar behavior. The right-click functionality to enable or disable a toolbar or panel stops working when a QGIS project is opened. When QGIS is restarted without opening a project everything works as expected. Adding layers to QGIS has no effect, but when an existing project is opened right clicking on a toolbar doesn't work anymore, until QGIS is restarted. I tested this in QGIS 2.99 installed with OSGeo4W on Windows 10.

Another thing I noticed is that right-clicking only works when it's done on an active toolbar button or next to a button on the toolbar. Right clicking on a greyed out button does not show the list of toolbars and panels. Both in QGIS 2.18.15 and QGIS 2.99.

#3 Updated by Steven Mizuno almost 7 years ago

More information: I got curious enough to try multiple right-clicks on a toolbar. For me it takes 25+ right-clicks, but eventually the list of panels does appear and continues to work with a single right-click until another project is loaded or New project is chosen.

For me, right-clicking on a toolbar's empty space does work.

I am using Windows 8.1 and OSGeo4W.

#4 Updated by Nyall Dawson almost 7 years ago

  • Status changed from Open to Feedback

Likely a change in qt5. Can you find any bug reports on the qt tracker regarding this?

#5 Updated by laura costa almost 7 years ago

I have similar behavior. I've noticed it succeed when i load a saved project. No problem when i launch qgis

#6 Updated by Michel Stuyts almost 7 years ago

I tried multiple right-clicks and for me it always takes exact 21 right-clicks to make it work again, until I open a project or a New Project is created.

#7 Updated by Steven Mizuno almost 7 years ago

I believe I have tracked down the problem to QgsMapToolCapture::stopCapturing() where an event filter is installed on QgisApp (Windows only). The filter targets context menu events.

Now I need help from devs about how to fix the problem -- what is the purpose of the event filter (only on Windows)? Is it still necessary?

and a question -- is this a Windows only problem?
I'm not sure based on what is in the bug report, although no one has mentioned Linux or Mac.

----
The short version of my tracking down the problem:
I determined that in QgisApp, fileNew() and addProject() were starting the problem. I considered whether signals could be the issue. I could call a lower level project load function that didn't have any signals -- no problem.

I decided to test whether the signals newProject and projectRead would have any effect by preventing them from being sent (comment out the lines) -- the problem disappeared.

Then I tried creating my own signal and slot, with my signal replacing newProject and projectRead, and my added slot just popping a messagebox -- this worked OK; right-click on toolbar would get the menu.

A search for the use of newProject and projectRead turned up several map tools that were connecting the signals to stopCapturing (in QgsMapToolCapture), so I tried connecting my signal to stopCapturing in just one tool (add feature) -- this would require just one extra right-click before the menu would appear.

There is an event filter installed on QgisApp by stopCapturing() so I tested whether this had any effect.
I returned the modified/added signals and slots to the original state and disabled the event filter installation in QgsMapToolCapture::stopCapturing() -- now you right-click once on a toolbar and get the menu!

I have tried the add feature tool (polygon) briefly and did not see any obvious problem without the event filter.

#8 Updated by Harrissou Santanna almost 7 years ago

Steven, thanks for tracking down this issue. May i suggest you to provide your changes that fix the issue (better, like a pull-request) so that other developers can comment and improve together the fix? It will also speed up the process.
This advice would also apply to #17673.
Thanks.

#10 Updated by Steven Mizuno almost 7 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 0 to 100

#11 Updated by Giovanni Manghi over 6 years ago

  • Resolution set to fixed/implemented

Also available in: Atom PDF