summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-09-25 15:06:21 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-09-26 07:10:52 +0200
commit79773cf27636a99c2a37373046fb448e1d754c0d (patch)
tree692627d44cca45b692b8ec80b5058e7c911202b6 /vcl
parent7198c5e49eff0b82cb423424eaed0ee94d66db7d (diff)
tdf#160837 qt: Move logic for move event handling to QtFrame
Add a new QtFrame::handleMoveEvent and move the logic previously duplicated in both, QtMainWindow::moveEvent and QtWidget::moveEvent there, then call the new method from these two. this also prevents direct access to the (currently public) SalFrame::maGeometry member from QtWidget and lets the subclass do it instead. Change-Id: I468802f204d3ac5869d833526286ca8ab349697b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173951 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/qt5/QtFrame.hxx1
-rw-r--r--vcl/qt5/QtFrame.cxx7
-rw-r--r--vcl/qt5/QtMainWindow.cxx7
-rw-r--r--vcl/qt5/QtWidget.cxx3
4 files changed, 10 insertions, 8 deletions
diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index 147c44b58085..3675df555384 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -169,6 +169,7 @@ public:
void handleDragLeave();
void handleDragMove(QDragMoveEvent* pEvent);
void handleDrop(QDropEvent* pEvent);
+ void handleMoveEvent(QMoveEvent* pEvent);
virtual void SetExtendedFrameStyle(SalExtStyle nExtStyle) override;
virtual void Show(bool bVisible, bool bNoActivate = false) override;
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 52fe03543c9a..7420278b2b88 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -1575,4 +1575,11 @@ void QtFrame::handleDragLeave()
m_bInDrag = false;
}
+void QtFrame::handleMoveEvent(QMoveEvent* pEvent)
+{
+ const qreal fRatio = devicePixelRatioF();
+ maGeometry.setPos(toPoint(pEvent->pos() * fRatio));
+ CallCallback(SalEvent::Move, nullptr);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/QtMainWindow.cxx b/vcl/qt5/QtMainWindow.cxx
index 5ff9ac9a8116..94f019735917 100644
--- a/vcl/qt5/QtMainWindow.cxx
+++ b/vcl/qt5/QtMainWindow.cxx
@@ -38,9 +38,4 @@ void QtMainWindow::closeEvent(QCloseEvent* pEvent)
pEvent->ignore();
}
-void QtMainWindow::moveEvent(QMoveEvent* pEvent)
-{
- const qreal fRatio = m_rFrame.devicePixelRatioF();
- m_rFrame.maGeometry.setPos(toPoint(pEvent->pos() * fRatio));
- m_rFrame.CallCallback(SalEvent::Move, nullptr);
-}
+void QtMainWindow::moveEvent(QMoveEvent* pEvent) { m_rFrame.handleMoveEvent(pEvent); }
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 4ee96c1dbf8c..4989a17546d5 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -294,8 +294,7 @@ void QtWidget::moveEvent(QMoveEvent* pEvent)
if (m_rFrame.m_pTopLevel)
return;
- m_rFrame.maGeometry.setPos(toPoint(pEvent->pos() * m_rFrame.devicePixelRatioF()));
- m_rFrame.CallCallback(SalEvent::Move, nullptr);
+ m_rFrame.handleMoveEvent(pEvent);
}
void QtWidget::showEvent(QShowEvent*)