diff options
Diffstat (limited to 'vcl/qt5')
-rw-r--r-- | vcl/qt5/Qt5DragAndDrop.cxx | 2 | ||||
-rw-r--r-- | vcl/qt5/Qt5Frame.cxx | 7 | ||||
-rw-r--r-- | vcl/qt5/Qt5Widget.cxx | 6 |
3 files changed, 11 insertions, 4 deletions
diff --git a/vcl/qt5/Qt5DragAndDrop.cxx b/vcl/qt5/Qt5DragAndDrop.cxx index 280763812b72..092c2b2e10a6 100644 --- a/vcl/qt5/Qt5DragAndDrop.cxx +++ b/vcl/qt5/Qt5DragAndDrop.cxx @@ -67,6 +67,7 @@ void Qt5DragSource::startDrag( if (m_pFrame) { Qt5Widget* qw = static_cast<Qt5Widget*>(m_pFrame->GetQWidget()); + m_ActiveDragSource = this; qw->startDrag(); } else @@ -97,6 +98,7 @@ void Qt5DragSource::fire_dragEnd(sal_Int8 nAction) m_xListener.clear(); xListener->dragDropEnd(aEv); } + m_ActiveDragSource = nullptr; } OUString SAL_CALL Qt5DragSource::getImplementationName() diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx index 9304760a47c0..3ab8ead48f50 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -1014,6 +1014,9 @@ void Qt5Frame::SetApplicationID(const OUString&) } // Drag'n'drop foo + +Qt5DragSource* Qt5DragSource::m_ActiveDragSource; + void Qt5Frame::registerDragSource(Qt5DragSource* pDragSource) { assert(!m_pDragSource); @@ -1053,7 +1056,7 @@ void Qt5Frame::draggingStarted(const int x, const int y) aEvent.SourceActions = css::datatransfer::dnd::DNDConstants::ACTION_MOVE; css::uno::Reference<css::datatransfer::XTransferable> xTransferable; - xTransferable = m_pDragSource->GetTransferable(); + xTransferable = Qt5DragSource::m_ActiveDragSource->GetTransferable(); if (!m_bInDrag && xTransferable.is()) { @@ -1082,7 +1085,7 @@ void Qt5Frame::dropping(const int x, const int y) aEvent.SourceActions = css::datatransfer::dnd::DNDConstants::ACTION_MOVE; css::uno::Reference<css::datatransfer::XTransferable> xTransferable; - xTransferable = m_pDragSource->GetTransferable(); + xTransferable = Qt5DragSource::m_ActiveDragSource->GetTransferable(); aEvent.Transferable = xTransferable; m_pDropTarget->fire_drop(aEvent); diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx index ea0258589ff7..2d108fa21cd5 100644 --- a/vcl/qt5/Qt5Widget.cxx +++ b/vcl/qt5/Qt5Widget.cxx @@ -187,8 +187,9 @@ void Qt5Widget::wheelEvent(QWheelEvent* pEvent) void Qt5Widget::startDrag() { + // internal drag source QMimeData* mimeData = new QMimeData; - mimeData->setData("application/x-libreoffice-dnditem", nullptr); + mimeData->setData(m_InternalMimeType, nullptr); QDrag* drag = new QDrag(this); drag->setMimeData(mimeData); @@ -197,8 +198,9 @@ void Qt5Widget::startDrag() void Qt5Widget::dragEnterEvent(QDragEnterEvent* event) { - if (event->source() == this) + if (event->mimeData()->hasFormat(m_InternalMimeType)) event->accept(); + // else FIXME: external drag source } void Qt5Widget::dragMoveEvent(QDragMoveEvent* event) |