From 6f4bc3942dda076eedf38d8c8604eb4fa5d7bd3b Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 1 Sep 2019 17:12:01 +0200 Subject: 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 --- examples/widgets/graphicsview/boxes/trackball.h | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'examples/widgets/graphicsview/boxes/trackball.h') 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 - -#include -#include +#include +#include +#include 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 -- cgit v1.2.3