summaryrefslogtreecommitdiff
path: root/vcl/qt5/Qt5Widget.cxx
diff options
context:
space:
mode:
authorJan-Marek Glogowski <jan-marek.glogowski@extern.cib.de>2019-08-08 17:59:20 +0000
committerJan-Marek Glogowski <glogow@fbihome.de>2019-08-22 14:29:03 +0200
commit3355be0616c24c5e44b71e7623c4191ed9c69074 (patch)
tree9343975454c1656c16222ac09bd0cc9e22a43dd4 /vcl/qt5/Qt5Widget.cxx
parentbafd4194b6ffbe4d6adfe01404196d787800dabe (diff)
tdf#126560 Qt5 fix D'n'D key-modifier handling
The patch has still one problem: the key-modifier state isn't reflected by the cursor, unless the user moves the mouse. There is an upstream Qt bug, reported in 2016-09 against Qt 5.6.1! It is supposed to be fixed in Qt 5.12, according to the bug report at https://bugreports.qt.io/browse/QTBUG-56218, which is still open. I thought about adding a configure test, but I couldn't imagine any realistic way to write it. And after Michael Weghorn found the bug is actually not fixed, as claimed in one of the comments, I decided to drop the warning. Change-Id: Ice8ebc4ea149282b4c1551e755efe3d4856cf782 Reviewed-on: https://gerrit.libreoffice.org/77174 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/qt5/Qt5Widget.cxx')
-rw-r--r--vcl/qt5/Qt5Widget.cxx32
1 files changed, 6 insertions, 26 deletions
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index f3dbfd516716..4c1c474aa159 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -24,6 +24,7 @@
#include <Qt5Graphics.hxx>
#include <Qt5Instance.hxx>
#include <Qt5SvpGraphics.hxx>
+#include <Qt5Transferable.hxx>
#include <Qt5Tools.hxx>
#include <QtCore/QMimeData>
@@ -214,41 +215,20 @@ void Qt5Widget::wheelEvent(QWheelEvent* pEvent)
pEvent->accept();
}
-void Qt5Widget::startDrag(sal_Int8 nSourceActions)
-{
- // internal drag source
- QMimeData* mimeData = new QMimeData;
- mimeData->setData(sInternalMimeType, nullptr);
-
- QDrag* drag = new QDrag(this);
- drag->setMimeData(mimeData);
- drag->exec(toQtDropActions(nSourceActions), Qt::MoveAction);
-}
-
void Qt5Widget::dragEnterEvent(QDragEnterEvent* event)
{
- if (event->mimeData()->hasFormat(sInternalMimeType))
+ if (dynamic_cast<const Qt5MimeData*>(event->mimeData()))
event->accept();
else
event->acceptProposedAction();
}
-void Qt5Widget::dragMoveEvent(QDragMoveEvent* event)
-{
- QPoint point = event->pos();
+// also called when a drop is rejected
+void Qt5Widget::dragLeaveEvent(QDragLeaveEvent*) { m_rFrame.handleDragLeave(); }
- m_rFrame.draggingStarted(point.x(), point.y(), event->possibleActions(),
- event->keyboardModifiers(), event->mimeData());
- QWidget::dragMoveEvent(event);
-}
-
-void Qt5Widget::dropEvent(QDropEvent* event)
-{
- QPoint point = event->pos();
+void Qt5Widget::dragMoveEvent(QDragMoveEvent* pEvent) { m_rFrame.handleDragMove(pEvent); }
- m_rFrame.dropping(point.x(), point.y(), event->keyboardModifiers(), event->mimeData());
- QWidget::dropEvent(event);
-}
+void Qt5Widget::dropEvent(QDropEvent* pEvent) { m_rFrame.handleDrop(pEvent); }
void Qt5Widget::moveEvent(QMoveEvent* event)
{