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 a9ca9abf8e8541c741d86ce36db9b2cfa5fd73c3 Author: Katarina Behrens <[email protected]> AuthorDate: Wed Feb 27 09:40:50 2019 +0100 Commit: Thorsten Behrens <[email protected]> CommitDate: Thu Mar 14 13:36:21 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 <[email protected]> (cherry picked from commit 14dca9a2197f1b43bf547ee47517e76e58309b93) Reviewed-on: https://gerrit.libreoffice.org/69160 Reviewed-by: Thorsten Behrens <[email protected]> diff --git a/vcl/inc/qt5/Qt5Tools.hxx b/vcl/inc/qt5/Qt5Tools.hxx index 336a942c772b..8863e2496687 100644 --- a/vcl/inc/qt5/Qt5Tools.hxx +++ b/vcl/inc/qt5/Qt5Tools.hxx @@ -123,6 +123,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 a9b7a0b1934f..d96afa64aeb0 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 0f341999df24..334466770fd1 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> @@ -1110,7 +1111,7 @@ void Qt5Frame::draggingStarted(const int x, const int y, Qt::DropActions eAction aEvent.SourceActions = toVclDropActions(eActions); css::uno::Reference<css::datatransfer::XTransferable> xTransferable; - if (pQMimeData) + if (!pQMimeData->hasFormat(sInternalMimeType)) xTransferable = new Qt5DnDTransferable(pQMimeData); else xTransferable = Qt5DragSource::m_ActiveDragSource->GetTransferable(); @@ -1142,7 +1143,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 4335a2bcff76..8f7cb8756c25 100644 --- a/vcl/qt5/Qt5Widget.cxx +++ b/vcl/qt5/Qt5Widget.cxx @@ -192,7 +192,7 @@ void Qt5Widget::startDrag(sal_Int8 nSourceActions) { // internal drag source QMimeData* mimeData = new QMimeData; - mimeData->setData(m_InternalMimeType, nullptr); + mimeData->setData(sInternalMimeType, nullptr); QDrag* drag = new QDrag(this); drag->setMimeData(mimeData); @@ -201,7 +201,7 @@ void Qt5Widget::startDrag(sal_Int8 nSourceActions) void Qt5Widget::dragEnterEvent(QDragEnterEvent* event) { - if (event->mimeData()->hasFormat(m_InternalMimeType)) + if (event->mimeData()->hasFormat(sInternalMimeType)) event->accept(); else event->acceptProposedAction(); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
