Bug report #17453
Right-click on QGIS Toolbars no longer shows the drop-down list of panels and toolbars
|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|
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.
#2 Updated by Michel Stuyts about 3 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 about 3 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.
#7 Updated by Steven Mizuno about 3 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 about 3 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.