[Libreoffice-commits] core.git: vcl/inc vcl/qt5
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Oct 19 09:35:35 UTC 2018
vcl/inc/qt5/Qt5DragAndDrop.hxx | 1 +
vcl/inc/qt5/Qt5Frame.hxx | 1 +
vcl/qt5/Qt5DragAndDrop.cxx | 13 +++++++++++++
vcl/qt5/Qt5Frame.cxx | 19 +++++++++++++++++++
vcl/qt5/Qt5Widget.cxx | 3 +++
5 files changed, 37 insertions(+)
New commits:
commit 0fa25c261ad1bac1303f8a35d89261365bb5d849
Author: Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Thu Oct 18 01:01:14 2018 +0200
Commit: Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Fri Oct 19 11:34:02 2018 +0200
Now that initiating drag works, let's also accept drops
Change-Id: Iab328edd799dd4ce04312db4e640f86a8f7fda77
Reviewed-on: https://gerrit.libreoffice.org/61897
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
Tested-by: Katarina Behrens <Katarina.Behrens at cib.de>
diff --git a/vcl/inc/qt5/Qt5DragAndDrop.hxx b/vcl/inc/qt5/Qt5DragAndDrop.hxx
index 424a1ba638e4..d1116ddfee96 100644
--- a/vcl/inc/qt5/Qt5DragAndDrop.hxx
+++ b/vcl/inc/qt5/Qt5DragAndDrop.hxx
@@ -108,6 +108,7 @@ public:
css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
void fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde);
+ void fire_drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 9ee9f50666e9..110fa9b279cf 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -135,6 +135,7 @@ public:
virtual void registerDropTarget(Qt5DropTarget* pDropTarget);
virtual void deregisterDropTarget(Qt5DropTarget const* pDropTarget);
void draggingStarted(const int x, const int y);
+ void dropping(const int x, const int y);
virtual void SetExtendedFrameStyle(SalExtStyle nExtStyle) override;
virtual void Show(bool bVisible, bool bNoActivate = false) override;
diff --git a/vcl/qt5/Qt5DragAndDrop.cxx b/vcl/qt5/Qt5DragAndDrop.cxx
index ac9a0fdb6339..569c24f2bdac 100644
--- a/vcl/qt5/Qt5DragAndDrop.cxx
+++ b/vcl/qt5/Qt5DragAndDrop.cxx
@@ -201,6 +201,19 @@ void Qt5DropTarget::fire_dragEnter(const css::datatransfer::dnd::DropTargetDragE
}
}
+void Qt5DropTarget::fire_drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde)
+{
+ osl::ClearableGuard<osl::Mutex> aGuard(m_aMutex);
+ std::vector<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> aListeners(
+ m_aListeners);
+ aGuard.clear();
+
+ for (auto const& listener : aListeners)
+ {
+ listener->drop(dtde);
+ }
+}
+
void Qt5DropTarget::acceptDrag(sal_Int8 /*dragOperation*/) { return; }
void Qt5DropTarget::rejectDrag() { return; }
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index bbf541dea312..a58e7b18d4b4 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -901,4 +901,23 @@ void Qt5Frame::draggingStarted(const int x, const int y)
}
}
+void Qt5Frame::dropping(const int x, const int y)
+{
+ assert(m_pDropTarget);
+
+ css::datatransfer::dnd::DropTargetDropEvent aEvent;
+ aEvent.Source = static_cast<css::datatransfer::dnd::XDropTarget*>(m_pDropTarget);
+ aEvent.Context = static_cast<css::datatransfer::dnd::XDropTargetDropContext*>(m_pDropTarget);
+ aEvent.LocationX = x;
+ aEvent.LocationY = y;
+ aEvent.DropAction = css::datatransfer::dnd::DNDConstants::ACTION_MOVE; //FIXME
+ aEvent.SourceActions = css::datatransfer::dnd::DNDConstants::ACTION_MOVE;
+
+ css::uno::Reference<css::datatransfer::XTransferable> xTransferable;
+ xTransferable = m_pDragSource->GetTransferable();
+ aEvent.Transferable = xTransferable;
+
+ m_pDropTarget->fire_drop(aEvent);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 33b5faf8a9a2..a47aaca8b853 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -193,7 +193,10 @@ void Qt5Widget::dragMoveEvent(QDragMoveEvent* event)
void Qt5Widget::dropEvent(QDropEvent* event)
{
+ QPoint point = event->pos();
SAL_WARN("vcl.qt5", "dropevent");
+
+ m_pFrame->dropping(point.x(), point.y());
QWidget::dropEvent(event);
}
More information about the Libreoffice-commits
mailing list