Details
-
Suggestion
-
Resolution: Fixed
-
P2: Important
-
5.11, 5.15.7, 6.2.2
-
bbc3a7d7b (dev), 34740b936 (6.8), e7c8c2ccc (dev), 037e14dd0 (6.8), 9f75fe29d (dev), 70c61b12e (dev), 019feea9b (6.9), 0794a0e06 (dev)
Description
Currently it's not possible to react to e.g. a right click on a ToolButton in order to show a context menu.
In Photoshop, for example, you can long press on the button or right click it and it pops up a menu with more tools.
Another example is item delegates: in the Layers panel, you can right click on a delegate item to get a context menu with options for that layer.
Different platforms have different ways of triggering context menu events:
- Desktop platforms can trigger on mouse or key events, press or release
There are other areas that I'm not sure about but could conceivably be the case:
- A 5-key navigation UI could potentially show a menu for the selected item
- Touch platforms could show a context menu on long press
Users shouldn't need to deal with these differences, so having a contextMenuRequested() signal would be a good solution.
The documentation for QContextMenuEvent says:
Context menu events are sent to widgets when a user performs an action associated with opening a context menu. The actions required to open context menus vary between platforms; for example, on Windows, pressing the menu button or clicking the right mouse button will cause this event to be sent.
When this event occurs it is customary to show a QMenu with a context menu, if this is relevant to the context.
Context menu events contain a special accept flag that indicates whether the receiver accepted the event. If the event handler does not accept the event then, if possible, whatever triggered the event will be handled as a regular input event.
Attachments
Issue Links
- is required for
-
QTBUG-105531 Missing context menu for text fields
- In Progress
-
QTBUG-132041 FAIL! : tst_QInsightEventFilter::trackEvents(empty.qml) Compared values are not the same
- Closed
- relates to
-
QTBUG-60506 ItemDelegate should have an option to set captured mouse buttons
- Open
-
QTBUG-35598 QtQuick Controls TextField and TextArea miss mouse context menu
- In Progress
-
QTBUG-132393 ContextMenu on a Dialog doesn't open
- Reported
-
QTBUG-132422 Mouse cursor is I beam instead of arrow when opening menu in window-based popup over text editing control
- Reported
-
QTBUG-99887 TapHandler on TextField (for showing right click context menu) stops working in Qt6
- Closed
-
QTBUG-105609 should be able to add a TapHandler to a Button to modify behavior
- Closed
-
QTBUG-132073 Not possible to use ContextMenu on event-consuming types like Pane
- Closed
-
QTBUG-132384 TapHandler emits tapped after ContextMenu gets its context menu event when running tst_QQuickContextMenu::eventOrder
- Closed
-
QTBUG-132044 Make long touch press open ContextMenu
- Reported
-
QTBUG-131917 Allow attached types to execute code at component completion
- Reported
-
QTBUG-93486 Clean up delivery logic of QContextMenuEvent
- Reported
-
QTBUG-132265 Defer creation of Menu until it's shown
- In Progress
-
QTBUG-65951 Fusion style should offer TextField context menu
- Closed
-
QTBUG-67621 Add contextMenuRequested() signal to Control
- Closed
- resulted in
-
QTBUG-68105 Refactor context menu event handling
- Closed