diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-09-01 17:12:01 +0200 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-09-05 17:40:36 +0200 |
commit | 6f4bc3942dda076eedf38d8c8604eb4fa5d7bd3b (patch) | |
tree | 5813b88711ccfc1bb6f6948c1534fa407d4a4262 /examples/widgets/graphicsview/boxes/trackball.h | |
parent | 42011c03613b38d2bf9c7770edf1392c5f5598f2 (diff) |
Widgets/GraphicsView examples: cleanup
Cleanup GraphicsView examples with the help of clang-tidy
- modernize-use-nullptr
- modernize-use-default-member-init
- modernize-use-override.IgnoreDestructors
- Some QList -> QVector changes
- use nullptr
- use normalized includes, remove unused includes
- fix style
Change-Id: I79347e55bfde52f6ae7749cc7093fbd442044020
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
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 |