Closed imonlyfourteen closed 2 months ago
Build against Qt 5.15 failed with this messages:
src\GUI\graphview.cpp(352): error C2039: 'position': is not a member of 'QMouseEvent'
C:\Qt\5.15\msvc2019_64\include\QtGui\qevent.h(104): note: see declaration of 'QMouseEvent'
src\GUI\graphview.cpp(370): error C2039: 'position': is not a member of 'QMouseEvent'
C:\Qt\5.15\msvc2019_64\include\QtGui\qevent.h(104): note: see declaration of 'QMouseEvent'
src\GUI\graphview.cpp(372): error C2039: 'position': is not a member of 'QMouseEvent'
C:\Qt\5.15\msvc2019_64\include\QtGui\qevent.h(104): note: see declaration of 'QMouseEvent'
The reason is that I just copypasted the preprocessor condition
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
from the wheelEvent() method, where event parameter is of type QWheelEvent while for mousePressEvent() and mouseMoveEvent() methods the parameter has QMouseEvent type.
And there is a difference: in Qt 5.15 QWheelEvent::pos() was marked obsolete while QMouseEvent::pos() only marked deprecated in Qt 6.0.
What if I just remove the preprocessor conditions and choose the deprecated pos() instead of position() for Qt 6 too? Or would it be better to change version in the condition to QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
?
Code pull requests are still not accepted at the moment, see the CONTRIBUTING.md file. (And shall they be enabled, they will definitely require a real identity.)
However, I have implemented the graphs mouse scrolling feature in 173f618d0bbc7d8a24144cf706705c25aa6de502, although the right mouse button, not the middle one is used.
Code pull requests are still not accepted at the moment, see the CONTRIBUTING.md file.
Oh, sorry for that. I should have read the file first.
However, I have implemented the graphs mouse scrolling feature
That is awesome! Thank you.
It is very handy to "scroll" zoomed GraphView area using middle mouse button drag. Can't live without this feature.
Dragging occurs only horizontally.
Qt5/Qt6
In Qt6
QMouseEvent::pos()
as well asQMouseEvent::x()
are marked as deprecated. For the GPXSee there was a commit back in 2020 that added support for Qt6 including preprocessor test for Qt version and choosingQMouseEvent::pos()
vsQMouseEvent::position()
. The latter is of QPointF type.So, I added that preprocessor test and choice between the methods too. I hope I did the right thing)