vcl/qt5/Qt5Widget.cxx |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit b91cdd1fadc9730cb21f4793da2499cd84cfb287
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Sat Sep 26 11:56:03 2020 +0200
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Fri Mar 28 13:39:20 2025 +0100

    Avoid -Werror=deprecated-declarations
    
    ...with qt5-qtbase-devel-5.15.1-1.fc33.x86_64 on Fedora 33:
    
    > ~/lo/core/vcl/qt5/Qt5Widget.cxx: In member function ‘virtual void 
Qt5Widget::wheelEvent(QWheelEvent*)’:
    > ~/lo/core/vcl/qt5/Qt5Widget.cxx:144:59: error: ‘QPoint QWheelEvent::pos() 
const’ is deprecated: Use position() [-Werror=deprecated-declarations]
    >   144 |     fillSalAbstractMouseEvent(rFrame, pEvent, pEvent->pos(), 
pEvent->buttons(), nWidth, aEvent)
    >       |                                                           ^
    > ~/lo/core/vcl/qt5/Qt5Widget.cxx:196:5: note: in expansion of macro 
‘FILL_SAME’
    >   196 |     FILL_SAME(m_rFrame, width());
    >       |     ^~~~~~~~~
    > In file included from /usr/include/qt5/QtGui/QFocusEvent:1,
    >                  from ~/lo/core/vcl/qt5/Qt5Widget.cxx:32:
    > /usr/include/qt5/QtGui/qevent.h:225:19: note: declared here
    >   225 |     inline QPoint pos() const { return p.toPoint(); }
    >       |                   ^~~
    
    But for one the types used by the other calls of the FILL_SAME macro do not 
have
    a position member function, so stop using the macro and spell it out 
explicitly
    here.  And for another, QWheelEvent::position returns a QPointF instead of a
    QPoint, so need to convert that with toPoint.  And for a third,
    QWheelEvent::position is only available since Qt 5.14 according to
    <https://doc.qt.io/qt-5/qwheelevent.html#position>.
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103475
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>
    (cherry picked from commit 07d6371f1dc5deef461581ad73c4af5c9f5b9821)
    Conflicts:
            vcl/qt5/Qt5Widget.cxx
    
    Change-Id: I6e64fc9717a9f5a85303f070c6a1b66ed21ec458
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183438
    Tested-by: allotropia jenkins <[email protected]>
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 7569c89783f8..76fdd7cefd6d 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -181,8 +181,14 @@ void Qt5Widget::wheelEvent(QWheelEvent* pEvent)
     SalWheelMouseEvent aEvent;
 
     aEvent.mnTime = pEvent->timestamp();
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+    aEvent.mnX = QGuiApplication::isLeftToRight() ? 
pEvent->position().toPoint().x()
+                                                  : width() - 
pEvent->position().toPoint().x();
+    aEvent.mnY = pEvent->position().toPoint().y();
+#else
     aEvent.mnX = QGuiApplication::isLeftToRight() ? pEvent->pos().x() : 
width() - pEvent->pos().x();
     aEvent.mnY = pEvent->pos().y();
+#endif
     aEvent.mnCode = GetKeyModCode(pEvent->modifiers()) | 
GetMouseModCode(pEvent->buttons());
 
     // mouse wheel ticks are 120, which we map to 3 lines.

Reply via email to