diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-09-26 11:56:03 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-09-26 15:53:20 +0200 |
commit | 07d6371f1dc5deef461581ad73c4af5c9f5b9821 (patch) | |
tree | 06bea8c5b7dff1cccdce31d96a66a76d81d63de1 | |
parent | ed424cf629b2ab33089b1be0dccfce60be85d726 (diff) |
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@redhat.com>
-rw-r--r-- | vcl/qt5/Qt5Widget.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
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. |