From 07d6371f1dc5deef461581ad73c4af5c9f5b9821 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sat, 26 Sep 2020 11:56:03 +0200 Subject: Avoid -Werror=deprecated-declarations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...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 . Change-Id: I6e64fc9717a9f5a85303f070c6a1b66ed21ec458 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103475 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- vcl/qt5/Qt5Widget.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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. -- cgit