lxqt / lxqt-panel

The LXQt desktop panel
https://lxqt-project.org
GNU Lesser General Public License v2.1
193 stars 135 forks source link

Fancy Menu: no right click menu with Qt 6.8 #2145

Closed stefonarch closed 1 month ago

stefonarch commented 1 month ago

Recompiled against Qt 6.8.

Expected Behavior

Right click on menu items: add|remove to|from favorites

Current Behavior

It opens the application.

System Information

On the positive side tooltips position not never changing on hovering is fixed in Qt 6.8

tsujan commented 1 month ago

It's reproducible everywhere, under X11 and Wayland alike.

It should be a regression in Qt 6.8. Whether searching for a workaround is worth the effort is another question.

tsujan commented 1 month ago

Apparently, there is a Qt 6.8 regression that doesn't allow right click menus in popups.

The search entry doesn't have a right click menu either. Launching of apps by right clicking their items is just a side effect of this regression, because now right clicking only activates items. When I made Fancy Menu like a normal window (in the code), right click menus were OK.

The same thing happens in Main Menu, whether under X11 or Wayland.

tsujan commented 1 month ago

I succeeded in making a small (but not so simple) workaround for right clicking app items in Fancy Menu.

We have two options for the next release:

  1. We can only tell our users to wait until the issue is fixed in Qt. If we do so, important features of Fancy Menu won't work until the fix is released.
  2. We can use the workaround. It's backward compatible, and we could remove it once the fix is released. But this kind of workaround isn't possible in Main Menu. Also, it isn't for the search entry, although the context menu of the search entry can be shown by keyboard (Menu key) and isn't important.
palinek commented 1 month ago

Did you find or raise the Qt bug? IMO, it is better to do the workaround to not sacrifice user experience until Qt fix is released.

tsujan commented 1 month ago

Did you find or raise the Qt bug?

Searched but found no report; didn't find time to think about an example code either.

Our panel suggests that the bug may happen in all popups (Fancy Menu) and menus (Main Menus).

IMO, it is better to do the workaround to not sacrifice user experience until Qt fix is released.

The logic that came to my mind was straightforward: Set the context menu policy to Qt::PreventContextMenu and use the release event of the right mouse button (by subclassing QListView) to show the context menus of items of the list view. The patch is small.

Do you know of a simpler approach?

stefonarch commented 1 month ago

I didn't even notice that the search field has a context menu. IMO the patch is needed.