[Libreoffice-commits] core.git: vcl/inc vcl/qt5
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Oct 18 18:39:32 UTC 2018
vcl/inc/qt5/Qt5Widget.hxx | 4 ++++
vcl/qt5/Qt5Widget.cxx | 36 ++++++++++++++++++++++++++++++++++--
2 files changed, 38 insertions(+), 2 deletions(-)
New commits:
commit ac2b58cdae26375846f67bfbe7244e4a0fd306ba
Author: Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Fri Oct 12 16:19:07 2018 +0200
Commit: Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Thu Oct 18 20:37:41 2018 +0200
Implement drag'n'drop-related qt5 events, no-op so far
Change-Id: I67b8cecdc85ad77d7ab48d229459a79bc168072d
Reviewed-on: https://gerrit.libreoffice.org/61721
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
diff --git a/vcl/inc/qt5/Qt5Widget.hxx b/vcl/inc/qt5/Qt5Widget.hxx
index 101ae6d68f67..9d4d535d2e90 100644
--- a/vcl/inc/qt5/Qt5Widget.hxx
+++ b/vcl/inc/qt5/Qt5Widget.hxx
@@ -46,6 +46,9 @@ class Qt5Widget : public QWidget
virtual void mouseMoveEvent(QMouseEvent*) override;
virtual void mousePressEvent(QMouseEvent*) override;
virtual void mouseReleaseEvent(QMouseEvent*) override;
+ virtual void dragEnterEvent(QDragEnterEvent*) override;
+ virtual void dragMoveEvent(QDragMoveEvent*) override;
+ virtual void dropEvent(QDropEvent*) override;
virtual void moveEvent(QMoveEvent*) override;
virtual void paintEvent(QPaintEvent*) override;
virtual void resizeEvent(QResizeEvent*) override;
@@ -56,6 +59,7 @@ class Qt5Widget : public QWidget
public:
Qt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f = Qt::WindowFlags());
Qt5Frame* m_pFrame;
+ void startDrag();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 00ab29744a67..5c4711afd065 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -124,10 +124,12 @@ void Qt5Widget::mouseReleaseEvent(QMouseEvent* pEvent) { handleMouseButtonEvent(
void Qt5Widget::mouseMoveEvent(QMouseEvent* pEvent)
{
+ QPoint point = pEvent->pos();
+
SalMouseEvent aEvent;
aEvent.mnTime = pEvent->timestamp();
- aEvent.mnX = pEvent->pos().x();
- aEvent.mnY = pEvent->pos().y();
+ aEvent.mnX = point.x();
+ aEvent.mnY = point.y();
aEvent.mnCode = GetKeyModCode(pEvent->modifiers()) | GetMouseModCode(pEvent->buttons());
aEvent.mnButton = 0;
@@ -163,6 +165,35 @@ void Qt5Widget::wheelEvent(QWheelEvent* pEvent)
pEvent->accept();
}
+void Qt5Widget::startDrag()
+{
+ QMimeData* mimeData = new QMimeData;
+ mimeData->setData("application/x-libreoffice-dnditem", nullptr);
+
+ QDrag* drag = new QDrag(this);
+ drag->setMimeData(mimeData);
+ drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::MoveAction);
+}
+
+void Qt5Widget::dragEnterEvent(QDragEnterEvent* event)
+{
+ SAL_WARN("vcl.qt5", "dragenterevent");
+ if (event->source() == this)
+ event->accept();
+}
+
+void Qt5Widget::dragMoveEvent(QDragMoveEvent* event)
+{
+ SAL_WARN("vcl.qt5", "dragmoveevent");
+ QWidget::dragMoveEvent(event);
+}
+
+void Qt5Widget::dropEvent(QDropEvent* event)
+{
+ SAL_WARN("vcl.qt5", "dropevent");
+ QWidget::dropEvent(event);
+}
+
void Qt5Widget::moveEvent(QMoveEvent*) { m_pFrame->CallCallback(SalEvent::Move, nullptr); }
void Qt5Widget::showEvent(QShowEvent*)
@@ -359,6 +390,7 @@ Qt5Widget::Qt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f)
{
create();
setMouseTracking(true);
+ setAcceptDrops(true);
setFocusPolicy(Qt::StrongFocus);
}
More information about the Libreoffice-commits
mailing list