Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.12.0, 5.13.0
-
None
-
-
1982d1b1aa55ae44a1a775a5745e5c2f11001398 (qt/qtdeclarative/5.12)
Description
Hello,
I think there is a bug with DragHandler.
I have encountered it on 5.12 and it still persists on 5.13.
It seems like the acceptedButtons property has no effect and the drag occurs whatever button has been pressed.
See below a minimalist code (main.cpp and the main.qml) in order to reproduce the issue.
// main.cpp #include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; const QUrl url(QStringLiteral("qrc:/main.qml")); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); return app.exec(); }
// main.qml import QtQuick 2.12 import QtQuick.Window 2.12 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Rectangle { id : dragable x: 100 y: 100 width: 200 height: 200 color: "blue" DragHandler { id: dragHandlerID acceptedButtons: Qt.RightButton onActiveChanged: { console.log("Drag is activated"); } } } }
In the code above, "Drag is activated" is printed even if drag is performed with left button.
Tks in advance for your help.
Attachments
Issue Links
- is duplicated by
-
QTBUG-76875 DragHandler doesn't respect acceptedButtons
- Closed