diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-09-17 08:32:43 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-09-17 08:32:43 +0200 |
commit | d49d076431d7579ecb33147187fe07eb148112ba (patch) | |
tree | 668370fb9a2eec50000e371125136921ef4518ab /examples/widgets/graphicsview/boxes/trackball.h | |
parent | b01e69684b9b36492cc43472edeb72058be9f706 (diff) | |
parent | 35cdcddd605d8823b7b57129e8d7279133a3ca89 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ic1fd51143f903b7e9086fc19ca960dfd9654ee00
Diffstat (limited to 'examples/widgets/graphicsview/boxes/trackball.h')
-rw-r--r-- | examples/widgets/graphicsview/boxes/trackball.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/examples/widgets/graphicsview/boxes/trackball.h b/examples/widgets/graphicsview/boxes/trackball.h index e65080e089..af90e4d842 100644 --- a/examples/widgets/graphicsview/boxes/trackball.h +++ b/examples/widgets/graphicsview/boxes/trackball.h @@ -51,10 +51,9 @@ #ifndef TRACKBALL_H #define TRACKBALL_H -#include <QtWidgets> - -#include <QtGui/qvector3d.h> -#include <QtGui/qquaternion.h> +#include <QQuaternion> +#include <QTime> +#include <QVector3D> class TrackBall { @@ -65,24 +64,24 @@ public: Sphere, }; TrackBall(TrackMode mode = Sphere); - TrackBall(float angularVelocity, const QVector3D& axis, TrackMode mode = Sphere); + TrackBall(float angularVelocity, const QVector3D &axis, TrackMode mode = Sphere); // coordinates in [-1,1]x[-1,1] - void push(const QPointF& p, const QQuaternion &transformation); - void move(const QPointF& p, const QQuaternion &transformation); - void release(const QPointF& p, const QQuaternion &transformation); + void push(const QPointF &p, const QQuaternion &transformation); + void move(const QPointF &p, const QQuaternion &transformation); + void release(const QPointF &p, const QQuaternion &transformation); void start(); // starts clock void stop(); // stops clock QQuaternion rotation() const; private: QQuaternion m_rotation; - QVector3D m_axis; - float m_angularVelocity; + QVector3D m_axis = QVector3D(0, 1, 0); + float m_angularVelocity = 0; QPointF m_lastPos; - QTime m_lastTime; - bool m_paused; - bool m_pressed; + QTime m_lastTime = QTime::currentTime(); TrackMode m_mode; + bool m_paused = false; + bool m_pressed = false; }; #endif |