Details
-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
5.15
-
None
Description
I'm currently experiencing a problem:
#include <QApplication> #include <QWidget> #include <QMenu> #include <QDebug #include <QGuiApplication> #include <QGuiApplication #include <QStyleHints #include <QContextMenuEvent class DebugWidget : public QWidget { public. explicit DebugWidget(QWidget *parent = nullptr) : QWidget(parent) { setContextMenuPolicy(Qt::CustomContextMenu); connect(this, &QWidget::customContextMenuRequested, [this](const QPoint &pos){ QMenu menu(this); for(int i = 0; i < 30; i++) { QAction *action = menu.addAction(QString(“Test %1”).arg(i + 1)); connect(action, &QAction::triggered, [action] { qWarning() << “Clicked action:” << action->text(); } ); } menu.exec(mapToGlobal(pos)); } }); } protected. void contextMenuEvent(QContextMenuEvent *event) override { qWarning() << “Context menu triggered by:” << (event->reason() == QContextMenuEvent::Mouse ? “Mouse” : ‘Touch’); QWidget::contextMenuEvent(event); } }; int main(int argc, char *argv[]) { QApplication app(argc, argv); DebugWidget w. w.show(); return app. return app.exec(); }
Here's my demo for the current scenario:
1. The Qt environment I'm using is 5.15, I call out the context menu by touching the screen and long-pressing, when the area of the touch screen happens to be on the options of the context menu, there will be a bug, that is, when I release the touch screen, I will select the current position of the menu options, which will result in a situation similar to the “second click”.
(When using the mouse, when clicking the right mouse button to call out the menu, click not release the mouse to move to the right menu of the corresponding item area when you release the right button will also trigger triggerd, but because the mouse to release the right button will not happen to overlap with the menu options, is the need to move a little bit will be hover after triggerd, so there is no problem, and the use of the touch screen, because the When using touchscreen, because the touchupdate is updated very frequently, so the finger touch screen slightly different strength will trigger the menu item hover, I feel this is not right.)
Attachments
Issue Links
- relates to
-
QTBUG-73949 Qt should provide some right click emulation for touchscreen on non Windows platforms.
-
- Reported
-
-
QTBUG-133302 ContextMenu opened on TextField sometimes closes immediately
-
- Closed
-
-
QTBUG-128359 Right-click menu logic error
-
- Closed
-
-
QTBUG-132044 Make long touch press open ContextMenu
-
- Reported
-
-
QTBUG-84179 Decide what to do about long-press events and maybe right-click emulation in Qt 6
-
- Reported
-