summaryrefslogtreecommitdiff
path: root/vcl/qt5
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2021-12-20 13:02:33 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2021-12-21 00:49:44 +0100
commite63fe68fb1d0915b64fdf63f7fa6eed866fa3a0d (patch)
tree797cebdfd84f488916fdec78ec40df0e6dccf45f /vcl/qt5
parentb8a801def427255587a7e519577d29d1acb91162 (diff)
Qt use asChild for pointer positioning
.. and refactor some variable names. Change-Id: I7d31a7a377f614bdd78f8d09852a2eda0cc47442 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127153 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/qt5')
-rw-r--r--vcl/qt5/QtFrame.cxx11
-rw-r--r--vcl/qt5/QtWidget.cxx1
2 files changed, 6 insertions, 6 deletions
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index ea1dee4fe916..15795b3e84e6 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -512,11 +512,10 @@ void QtFrame::SetDefaultPos()
if (m_pParent)
{
const qreal fRatio = devicePixelRatioF();
- QWidget* const pWindow = m_pParent->GetQWidget()->window();
- QWidget* const pWidget = asChild();
- QPoint aPos = pWindow->rect().center() - pWidget->rect().center();
- SetPosSize(round(aPos.x() * fRatio), round(aPos.y() * fRatio), 0, 0,
- SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y);
+ QWidget* const pParentWin = m_pParent->asChild()->window();
+ QWidget* const pChildWin = asChild()->window();
+ QPoint aPos = (pParentWin->rect().center() - pChildWin->rect().center()) * fRatio;
+ SetPosSize(aPos.x(), aPos.y(), 0, 0, SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y);
assert(!m_bDefaultPos);
}
else
@@ -863,7 +862,7 @@ void QtFrame::SetPointerPos(tools::Long nX, tools::Long nY)
{
// some cursor already exists (and it has m_ePointerStyle shape)
// so here we just reposition it
- QCursor::setPos(m_pQWidget->mapToGlobal(QPoint(nX, nY)));
+ QCursor::setPos(asChild()->mapToGlobal(QPoint(nX, nY)));
}
void QtFrame::Flush()
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 3078a7133764..40d912badc7d 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -257,6 +257,7 @@ void QtWidget::dropEvent(QDropEvent* pEvent) { m_rFrame.handleDrop(pEvent); }
void QtWidget::moveEvent(QMoveEvent* pEvent)
{
+ // already handled by QtMainWindow::moveEvent
if (m_rFrame.m_pTopLevel)
return;