[Libreoffice-commits] core.git: vcl/qt5

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Sat Sep 26 13:53:59 UTC 2020


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

New commits:
commit 07d6371f1dc5deef461581ad73c4af5c9f5b9821
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Sep 26 11:56:03 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Sat Sep 26 15:53:20 2020 +0200

    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>.
    
    Change-Id: I6e64fc9717a9f5a85303f070c6a1b66ed21ec458
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103475
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 2d3951ad8203..40500585e1fe 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -193,7 +193,12 @@ void Qt5Widget::mouseMoveEvent(QMouseEvent* pEvent)
 void Qt5Widget::wheelEvent(QWheelEvent* pEvent)
 {
     SalWheelMouseEvent aEvent;
-    FILL_SAME(m_rFrame, width());
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+    fillSalAbstractMouseEvent(m_rFrame, pEvent, pEvent->position().toPoint(), pEvent->buttons(),
+                              width(), aEvent);
+#else
+    fillSalAbstractMouseEvent(m_rFrame, pEvent, pEvent->pos(), pEvent->buttons(), width(), aEvent);
+#endif
 
     // 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.


More information about the Libreoffice-commits mailing list