diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2022-06-02 22:42:20 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2022-06-08 18:17:17 +0200 |
commit | ea5a0918c8c32309821ab239c4b95f4d6a3b5c12 (patch) | |
tree | 04ff84b7c076a2f178e90d0eb32eb1731b10fd3c /vcl/qt5/QtWidget.cxx | |
parent | d4123356c61db269651e950a0a2cc93e6d801c90 (diff) |
VCL add vcl::WindowPosSize abstract class
... and use it to remove a duplicate and simplify code.
Should mostly be a refactoring, which was mainly done by some
larger sed calls, except for the new API calls, which helped
shrinking some LOC. All data is also now private.
Originally two of the "replaced" "classes" had unsigned width
and height and one had signed. Noel pointed out, that during
calculations, the value might get negative temporarly, so this
now settles with signed values. Still the set size should never
be negative and this is enforced this way. Not sure that is what
Noel had in mind.
This also includes:
- rename WindowState => WindowData
- rename WindowStateMask => WindowDataMask
- rename WindowStateState => WindowState
- move WindowState and WindowDataMask to vcl/windowstate.hxx
- move WindowData(Mask) and WindowState into vcl namespace
- readability: replace or'ed WindowState enums with "meta" enums
+ add "meta" WindowState enums PosSize and PosSizeState
Change-Id: Icd16cfb498531aa7238ddbde83fcb0ed6d9e4f77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135426
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/qt5/QtWidget.cxx')
-rw-r--r-- | vcl/qt5/QtWidget.cxx | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index b2451123e7e6..5c6fc002ac22 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -93,8 +93,7 @@ void QtWidget::resizeEvent(QResizeEvent* pEvent) const int nWidth = ceil(pEvent->size().width() * fRatio); const int nHeight = ceil(pEvent->size().height() * fRatio); - m_rFrame.maGeometry.nWidth = nWidth; - m_rFrame.maGeometry.nHeight = nHeight; + m_rFrame.maGeometry.setSize({ nWidth, nHeight }); if (m_rFrame.m_bUseCairo) { @@ -300,9 +299,7 @@ void QtWidget::moveEvent(QMoveEvent* pEvent) if (m_rFrame.m_pTopLevel) return; - const Point aPos = toPoint(pEvent->pos() * m_rFrame.devicePixelRatioF()); - m_rFrame.maGeometry.nX = aPos.X(); - m_rFrame.maGeometry.nY = aPos.Y(); + m_rFrame.maGeometry.setPos(toPoint(pEvent->pos() * m_rFrame.devicePixelRatioF())); m_rFrame.CallCallback(SalEvent::Move, nullptr); } |