vcl/inc/qt5/QtWidget.hxx |    2 +-
 vcl/qt5/QtWidget.cxx     |   23 +++++++++--------------
 2 files changed, 10 insertions(+), 15 deletions(-)

New commits:
commit 6080e0aaad7e2da1b27791fa604f97eb13c8e98f
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Apr 12 15:11:29 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sun Apr 13 19:17:13 2025 +0200

    qt: Drop width param for QtWidget::fillSalAbstractMouseEvent
    
    This is always QtWidget::width(), so just call
    that method in QtWidget::fillSalAbstractMouseEvent
    instead of passing it as a param.
    
    Also drop the FILL_SAME macro.
    
    Change-Id: I2b9cd4df4d321ae4b178088f924d015d193404ca
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184103
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index 27d8c98fea93..5e5fa2dcf6a0 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -52,7 +52,7 @@ class QtWidget : public QWidget
     bool handleKeyEvent(QKeyEvent*) const;
     void handleMouseEnterLeaveEvent(QEvent*) const;
     void fillSalAbstractMouseEvent(const QInputEvent* pQEvent, const QPoint& 
rPos,
-                                   Qt::MouseButtons eButtons, int nWidth,
+                                   Qt::MouseButtons eButtons,
                                    SalAbstractMouseEvent& aSalEvent) const;
 
     virtual bool event(QEvent*) override;
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index c09b92a4c964..1c5f5c9a02f9 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -74,25 +74,23 @@ void QtWidget::fakeResize()
 }
 
 void QtWidget::fillSalAbstractMouseEvent(const QInputEvent* pQEvent, const 
QPoint& rPos,
-                                         Qt::MouseButtons eButtons, int nWidth,
+                                         Qt::MouseButtons eButtons,
                                          SalAbstractMouseEvent& aSalEvent) 
const
 {
     const qreal fRatio = m_rFrame.devicePixelRatioF();
     const Point aPos = toPoint(rPos * fRatio);
 
-    aSalEvent.mnX = QGuiApplication::isLeftToRight() ? aPos.X() : round(nWidth 
* fRatio) - aPos.X();
+    aSalEvent.mnX
+        = QGuiApplication::isLeftToRight() ? aPos.X() : round(width() * 
fRatio) - aPos.X();
     aSalEvent.mnY = aPos.Y();
     aSalEvent.mnTime = pQEvent->timestamp();
     aSalEvent.mnCode = toVclKeyboardModifiers(pQEvent->modifiers()) | 
toVclMouseButtons(eButtons);
 }
 
-#define FILL_SAME(nWidth)                                                      
                    \
-    fillSalAbstractMouseEvent(pEvent, pEvent->pos(), pEvent->buttons(), 
nWidth, aEvent)
-
 void QtWidget::handleMouseButtonEvent(const QMouseEvent* pEvent) const
 {
     SalMouseEvent aEvent;
-    FILL_SAME(width());
+    fillSalAbstractMouseEvent(pEvent, pEvent->pos(), pEvent->buttons(), 
aEvent);
 
     switch (pEvent->button())
     {
@@ -130,7 +128,7 @@ void QtWidget::mouseReleaseEvent(QMouseEvent* pEvent) { 
handleMouseButtonEvent(p
 void QtWidget::mouseMoveEvent(QMouseEvent* pEvent)
 {
     SalMouseEvent aEvent;
-    FILL_SAME(width());
+    fillSalAbstractMouseEvent(pEvent, pEvent->pos(), pEvent->buttons(), 
aEvent);
 
     aEvent.mnButton = 0;
 
@@ -174,8 +172,7 @@ void QtWidget::enterEvent(QEvent* pEvent)
 void QtWidget::wheelEvent(QWheelEvent* pEvent)
 {
     SalWheelMouseEvent aEvent;
-    fillSalAbstractMouseEvent(pEvent, pEvent->position().toPoint(), 
pEvent->buttons(), width(),
-                              aEvent);
+    fillSalAbstractMouseEvent(pEvent, pEvent->position().toPoint(), 
pEvent->buttons(), aEvent);
 
     // mouse wheel ticks are 120, which we map to 3 lines.
     // we have to accumulate for touch scroll to keep track of the absolute 
delta.
commit 79766a63479d9b273d9611cd4616027fff85a836
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Apr 12 15:05:33 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sun Apr 13 19:17:05 2025 +0200

    qt: Simply use 'this' in QtWidget methods
    
    ... instead of retrieving a pointer to self
    using `m_rFrame.GetQWidget()`.
    
    Change-Id: Ic61b2e73d6c058979e0b779eee29a32bd52b7d18
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184102
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 074d18917330..c09b92a4c964 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -92,7 +92,7 @@ void QtWidget::fillSalAbstractMouseEvent(const QInputEvent* 
pQEvent, const QPoin
 void QtWidget::handleMouseButtonEvent(const QMouseEvent* pEvent) const
 {
     SalMouseEvent aEvent;
-    FILL_SAME(m_rFrame.GetQWidget()->width());
+    FILL_SAME(width());
 
     switch (pEvent->button())
     {
@@ -141,12 +141,10 @@ void QtWidget::mouseMoveEvent(QMouseEvent* pEvent)
 void QtWidget::handleMouseEnterLeaveEvent(QEvent* pQEvent) const
 {
     const qreal fRatio = m_rFrame.devicePixelRatioF();
-    const QWidget* pWidget = m_rFrame.GetQWidget();
-    const Point aPos = toPoint(pWidget->mapFromGlobal(QCursor::pos()) * 
fRatio);
+    const Point aPos = toPoint(mapFromGlobal(QCursor::pos()) * fRatio);
 
     SalMouseEvent aEvent;
-    aEvent.mnX
-        = QGuiApplication::isLeftToRight() ? aPos.X() : round(pWidget->width() 
* fRatio) - aPos.X();
+    aEvent.mnX = QGuiApplication::isLeftToRight() ? aPos.X() : round(width() * 
fRatio) - aPos.X();
     aEvent.mnY = aPos.Y();
     aEvent.mnTime = 0;
     aEvent.mnButton = 0;
@@ -235,7 +233,7 @@ void QtWidget::moveEvent(QMoveEvent* pEvent)
 
 void QtWidget::showEvent(QShowEvent*)
 {
-    QSize aSize(m_rFrame.GetQWidget()->size() * m_rFrame.devicePixelRatioF());
+    QSize aSize(size() * m_rFrame.devicePixelRatioF());
     // forcing an immediate update somehow interferes with the hide + show
     // sequence from QtFrame::SetModal, if the frame was already set visible,
     // resulting in a hidden / unmapped window

Reply via email to