[Libreoffice-commits] core.git: vcl/inc vcl/qt5

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Mar 4 13:40:13 UTC 2019


 vcl/inc/qt5/Qt5Tools.hxx  |    2 ++
 vcl/inc/qt5/Qt5Widget.hxx |    2 --
 vcl/qt5/Qt5Frame.cxx      |    5 +++--
 vcl/qt5/Qt5Widget.cxx     |    4 ++--
 4 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 14dca9a2197f1b43bf547ee47517e76e58309b93
Author:     Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Wed Feb 27 09:40:50 2019 +0100
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Mon Mar 4 14:39:48 2019 +0100

    Unbreak internal DnD by using null MimeData
    
    Regression from 67b0fcea9d748c4dd8101036cbb2c587d65f0bf7 (which
    implements external DnD). QMimeData of internal DnD is never null,
    it always contains internal MimeType (but empty byte array)
    
    Change-Id: Ie12e9c3b7a3c7cebfd98064bb2fafec27c20a442
    Reviewed-on: https://gerrit.libreoffice.org/68673
    Tested-by: Jenkins
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/vcl/inc/qt5/Qt5Tools.hxx b/vcl/inc/qt5/Qt5Tools.hxx
index 57bf94793955..18b48690377b 100644
--- a/vcl/inc/qt5/Qt5Tools.hxx
+++ b/vcl/inc/qt5/Qt5Tools.hxx
@@ -118,6 +118,8 @@ inline sal_uInt16 getFormatBits(QImage::Format eFormat)
     }
 }
 
+static const QString sInternalMimeType = "application/x-libreoffice-dnditem";
+
 typedef struct _cairo_surface cairo_surface_t;
 struct CairoDeleter
 {
diff --git a/vcl/inc/qt5/Qt5Widget.hxx b/vcl/inc/qt5/Qt5Widget.hxx
index 731498f11d13..3e5332bd77dc 100644
--- a/vcl/inc/qt5/Qt5Widget.hxx
+++ b/vcl/inc/qt5/Qt5Widget.hxx
@@ -66,8 +66,6 @@ class Qt5Widget : public QWidget
     void inputMethodEvent(QInputMethodEvent*) override;
     QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
 
-    const QString m_InternalMimeType = "application/x-libreoffice-dnditem";
-
 public slots:
     static void showTooltip(const OUString& rTip);
 
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index c687c4a279c3..958d9250c776 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -29,6 +29,7 @@
 #include <Qt5Menu.hxx>
 #include <Qt5DragAndDrop.hxx>
 
+#include <QtCore/QMimeData>
 #include <QtCore/QPoint>
 #include <QtCore/QSize>
 #include <QtGui/QIcon>
@@ -1109,7 +1110,7 @@ void Qt5Frame::draggingStarted(const int x, const int y, const QMimeData* pQMime
     aEvent.SourceActions = css::datatransfer::dnd::DNDConstants::ACTION_MOVE;
 
     css::uno::Reference<css::datatransfer::XTransferable> xTransferable;
-    if (pQMimeData)
+    if (!pQMimeData->hasFormat(sInternalMimeType))
         xTransferable = new Qt5DnDTransferable(pQMimeData);
     else
         xTransferable = Qt5DragSource::m_ActiveDragSource->GetTransferable();
@@ -1141,7 +1142,7 @@ void Qt5Frame::dropping(const int x, const int y, const QMimeData* pQMimeData)
     aEvent.SourceActions = css::datatransfer::dnd::DNDConstants::ACTION_MOVE;
 
     css::uno::Reference<css::datatransfer::XTransferable> xTransferable;
-    if (pQMimeData)
+    if (!pQMimeData->hasFormat(sInternalMimeType))
         xTransferable = new Qt5DnDTransferable(pQMimeData);
     else
         xTransferable = Qt5DragSource::m_ActiveDragSource->GetTransferable();
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 2baf7a37125a..ca2c3ada6a3c 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -193,7 +193,7 @@ void Qt5Widget::startDrag()
 {
     // internal drag source
     QMimeData* mimeData = new QMimeData;
-    mimeData->setData(m_InternalMimeType, nullptr);
+    mimeData->setData(sInternalMimeType, nullptr);
 
     QDrag* drag = new QDrag(this);
     drag->setMimeData(mimeData);
@@ -202,7 +202,7 @@ void Qt5Widget::startDrag()
 
 void Qt5Widget::dragEnterEvent(QDragEnterEvent* event)
 {
-    if (event->mimeData()->hasFormat(m_InternalMimeType))
+    if (event->mimeData()->hasFormat(sInternalMimeType))
         event->accept();
     else
         event->acceptProposedAction();


More information about the Libreoffice-commits mailing list