summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2021-12-20 13:02:33 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-12-21 12:39:59 +0100
commit27751b59bbedda69e3336a81db4acab80d1ab765 (patch)
treeb03a2fc3703755287b9de48edf09eb0c23c47130
parent6c9f77e2f776f3a28764e423bbe42696c0b0627c (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> (cherry picked from commit e63fe68fb1d0915b64fdf63f7fa6eed866fa3a0d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127173 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-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 5b8a6fad6d96..5772e7e87251 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -513,11 +513,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
@@ -864,7 +863,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 85bcd814b03a..8f672bdd6bac 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -258,6 +258,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;