summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <[email protected]>2012-02-29 00:00:27 +0100
committerQt by Nokia <[email protected]>2012-03-01 08:44:34 +0100
commit1cd4d6b1819f67b70dd359c7fc43ab06182cc34b (patch)
treec07312c6b6e5d6e3a854f408e27920bf77f4cd80
parentfb4dccee9a8d616ec43390f855caca08594d75b8 (diff)
QEvent (and subclasses): make ctors explicit
Do this regardless of whether the event subclass is public API or only used in examples. Examples are examples, used by others as templates or even copied verbatim, so they should also follow sound engineering rules. Anyway, there's only one in examples/... Change-Id: I586ff16407a956c9e89288fdd4377eed73f45c0f Reviewed-by: Samuel Rødal <[email protected]>
-rw-r--r--examples/animation/moveblocks/main.cpp2
-rw-r--r--src/concurrent/qfutureinterface_p.h2
-rw-r--r--src/corelib/kernel/qcoreevent.h6
-rw-r--r--src/corelib/kernel/qeventdispatcher_win_p.h2
-rw-r--r--src/gui/kernel/qevent.h42
-rw-r--r--src/widgets/graphicsview/qgraphicssceneevent.h14
-rw-r--r--src/widgets/kernel/qgesture.h2
-rw-r--r--tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp2
-rw-r--r--tests/auto/other/gestures/tst_gestures.cpp2
-rw-r--r--tests/auto/testlib/selftests/alive/qtestalive.cpp2
-rw-r--r--tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp2
-rw-r--r--tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h2
12 files changed, 40 insertions, 40 deletions
diff --git a/examples/animation/moveblocks/main.cpp b/examples/animation/moveblocks/main.cpp
index 8e7c04e9f07..d807bb63d91 100644
--- a/examples/animation/moveblocks/main.cpp
+++ b/examples/animation/moveblocks/main.cpp
@@ -50,7 +50,7 @@ public:
{
}
- StateSwitchEvent(int rand)
+ explicit StateSwitchEvent(int rand)
: QEvent(Type(StateSwitchType)),
m_rand(rand)
{
diff --git a/src/concurrent/qfutureinterface_p.h b/src/concurrent/qfutureinterface_p.h
index 3a73f846ac5..b985e31ab61 100644
--- a/src/concurrent/qfutureinterface_p.h
+++ b/src/concurrent/qfutureinterface_p.h
@@ -80,7 +80,7 @@ public:
QFutureCallOutEvent()
: QEvent(QEvent::FutureCallOut), callOutType(CallOutType(0)), index1(-1), index2(-1)
{ }
- QFutureCallOutEvent(CallOutType callOutType, int index1 = -1)
+ explicit QFutureCallOutEvent(CallOutType callOutType, int index1 = -1)
: QEvent(QEvent::FutureCallOut), callOutType(callOutType), index1(index1), index2(-1)
{ }
QFutureCallOutEvent(CallOutType callOutType, int index1, int index2)
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index 1f36f9c9c8c..cac89f2b138 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -288,7 +288,7 @@ public:
MaxUser = 65535 // last user event id
};
- QEvent(Type type);
+ explicit QEvent(Type type);
virtual ~QEvent();
inline Type type() const { return static_cast<Type>(t); }
inline bool spontaneous() const { return spont; }
@@ -330,7 +330,7 @@ private:
class Q_CORE_EXPORT QTimerEvent : public QEvent
{
public:
- QTimerEvent( int timerId );
+ explicit QTimerEvent( int timerId );
~QTimerEvent();
int timerId() const { return id; }
protected:
@@ -355,7 +355,7 @@ protected:
class Q_CORE_EXPORT QDynamicPropertyChangeEvent : public QEvent
{
public:
- QDynamicPropertyChangeEvent(const QByteArray &name);
+ explicit QDynamicPropertyChangeEvent(const QByteArray &name);
~QDynamicPropertyChangeEvent();
inline QByteArray propertyName() const { return n; }
diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h
index a831ad39e8e..565f1ef4b39 100644
--- a/src/corelib/kernel/qeventdispatcher_win_p.h
+++ b/src/corelib/kernel/qeventdispatcher_win_p.h
@@ -131,7 +131,7 @@ struct WinTimerInfo { // internal timer info
class QZeroTimerEvent : public QTimerEvent
{
public:
- inline QZeroTimerEvent(int timerId)
+ explicit inline QZeroTimerEvent(int timerId)
: QTimerEvent(timerId)
{ t = QEvent::ZeroTimerEvent; }
};
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index ca93095a940..feee7fa8375 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -71,7 +71,7 @@ class QScreen;
class Q_GUI_EXPORT QInputEvent : public QEvent
{
public:
- QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+ explicit QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
~QInputEvent();
inline Qt::KeyboardModifiers modifiers() const { return modState; }
inline void setModifiers(Qt::KeyboardModifiers amodifiers) { modState = amodifiers; }
@@ -276,7 +276,7 @@ protected:
class Q_GUI_EXPORT QFocusEvent : public QEvent
{
public:
- QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason);
+ explicit QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason);
~QFocusEvent();
inline bool gotFocus() const { return type() == FocusIn; }
@@ -292,8 +292,8 @@ private:
class Q_GUI_EXPORT QPaintEvent : public QEvent
{
public:
- QPaintEvent(const QRegion& paintRegion);
- QPaintEvent(const QRect &paintRect);
+ explicit QPaintEvent(const QRegion& paintRegion);
+ explicit QPaintEvent(const QRect &paintRect);
~QPaintEvent();
inline const QRect &rect() const { return m_rect; }
@@ -311,7 +311,7 @@ protected:
class Q_GUI_EXPORT QUpdateLaterEvent : public QEvent
{
public:
- QUpdateLaterEvent(const QRegion& paintRegion);
+ explicit QUpdateLaterEvent(const QRegion& paintRegion);
~QUpdateLaterEvent();
inline const QRegion &region() const { return m_region; }
@@ -337,7 +337,7 @@ protected:
class Q_GUI_EXPORT QExposeEvent : public QEvent
{
public:
- QExposeEvent(const QRegion &rgn);
+ explicit QExposeEvent(const QRegion &rgn);
~QExposeEvent();
inline const QRegion &region() const { return rgn; }
@@ -468,7 +468,7 @@ private:
class Q_GUI_EXPORT QInputMethodQueryEvent : public QEvent
{
public:
- QInputMethodQueryEvent(Qt::InputMethodQueries queries);
+ explicit QInputMethodQueryEvent(Qt::InputMethodQueries queries);
~QInputMethodQueryEvent();
Qt::InputMethodQueries queries() const { return m_queries; }
@@ -586,7 +586,7 @@ private:
class Q_GUI_EXPORT QStatusTipEvent : public QEvent
{
public:
- QStatusTipEvent(const QString &tip);
+ explicit QStatusTipEvent(const QString &tip);
~QStatusTipEvent();
inline QString tip() const { return s; }
@@ -599,7 +599,7 @@ private:
class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent
{
public:
- QWhatsThisClickedEvent(const QString &href);
+ explicit QWhatsThisClickedEvent(const QString &href);
~QWhatsThisClickedEvent();
inline QString href() const { return s; }
@@ -624,8 +624,8 @@ public:
class Q_GUI_EXPORT QFileOpenEvent : public QEvent
{
public:
- QFileOpenEvent(const QString &file);
- QFileOpenEvent(const QUrl &url);
+ explicit QFileOpenEvent(const QString &file);
+ explicit QFileOpenEvent(const QUrl &url);
~QFileOpenEvent();
inline QString file() const { return f; }
@@ -639,7 +639,7 @@ private:
class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent
{
public:
- QToolBarChangeEvent(bool t);
+ explicit QToolBarChangeEvent(bool t);
~QToolBarChangeEvent();
inline bool toggle() const { return tog; }
@@ -669,7 +669,7 @@ protected:
class Q_GUI_EXPORT QClipboardEvent : public QEvent
{
public:
- QClipboardEvent(QEventPrivate *data);
+ explicit QClipboardEvent(QEventPrivate *data);
~QClipboardEvent();
QEventPrivate *data() { return d; }
@@ -679,7 +679,7 @@ public:
class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent
{
public:
- QWindowStateChangeEvent(Qt::WindowStates aOldState);
+ explicit QWindowStateChangeEvent(Qt::WindowStates aOldState);
QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride);
~QWindowStateChangeEvent();
@@ -711,7 +711,7 @@ public:
};
Q_DECLARE_FLAGS(InfoFlags, InfoFlag)
- TouchPoint(int id = -1);
+ explicit TouchPoint(int id = -1);
TouchPoint(const QTouchEvent::TouchPoint &other);
~TouchPoint();
@@ -783,11 +783,11 @@ public:
};
#endif
- QTouchEvent(QEvent::Type eventType,
- QTouchDevice *device = 0,
- Qt::KeyboardModifiers modifiers = Qt::NoModifier,
- Qt::TouchPointStates touchPointStates = 0,
- const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
+ explicit QTouchEvent(QEvent::Type eventType,
+ QTouchDevice *device = 0,
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier,
+ Qt::TouchPointStates touchPointStates = 0,
+ const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
~QTouchEvent();
inline QWindow *window() const { return _window; }
@@ -825,7 +825,7 @@ class QScrollPrepareEventPrivate;
class Q_GUI_EXPORT QScrollPrepareEvent : public QEvent
{
public:
- QScrollPrepareEvent(const QPointF &startPos);
+ explicit QScrollPrepareEvent(const QPointF &startPos);
~QScrollPrepareEvent();
QPointF startPos() const;
diff --git a/src/widgets/graphicsview/qgraphicssceneevent.h b/src/widgets/graphicsview/qgraphicssceneevent.h
index be93c474769..95de4358462 100644
--- a/src/widgets/graphicsview/qgraphicssceneevent.h
+++ b/src/widgets/graphicsview/qgraphicssceneevent.h
@@ -66,7 +66,7 @@ class QGraphicsSceneEventPrivate;
class Q_WIDGETS_EXPORT QGraphicsSceneEvent : public QEvent
{
public:
- QGraphicsSceneEvent(Type type);
+ explicit QGraphicsSceneEvent(Type type);
~QGraphicsSceneEvent();
QWidget *widget() const;
@@ -84,7 +84,7 @@ class QGraphicsSceneMouseEventPrivate;
class Q_WIDGETS_EXPORT QGraphicsSceneMouseEvent : public QGraphicsSceneEvent
{
public:
- QGraphicsSceneMouseEvent(Type type = None);
+ explicit QGraphicsSceneMouseEvent(Type type = None);
~QGraphicsSceneMouseEvent();
QPointF pos() const;
@@ -132,7 +132,7 @@ class QGraphicsSceneWheelEventPrivate;
class Q_WIDGETS_EXPORT QGraphicsSceneWheelEvent : public QGraphicsSceneEvent
{
public:
- QGraphicsSceneWheelEvent(Type type = None);
+ explicit QGraphicsSceneWheelEvent(Type type = None);
~QGraphicsSceneWheelEvent();
QPointF pos() const;
@@ -167,7 +167,7 @@ class Q_WIDGETS_EXPORT QGraphicsSceneContextMenuEvent : public QGraphicsSceneEve
public:
enum Reason { Mouse, Keyboard, Other };
- QGraphicsSceneContextMenuEvent(Type type = None);
+ explicit QGraphicsSceneContextMenuEvent(Type type = None);
~QGraphicsSceneContextMenuEvent();
QPointF pos() const;
@@ -194,7 +194,7 @@ class QGraphicsSceneHoverEventPrivate;
class Q_WIDGETS_EXPORT QGraphicsSceneHoverEvent : public QGraphicsSceneEvent
{
public:
- QGraphicsSceneHoverEvent(Type type = None);
+ explicit QGraphicsSceneHoverEvent(Type type = None);
~QGraphicsSceneHoverEvent();
QPointF pos() const;
@@ -227,7 +227,7 @@ class QGraphicsSceneHelpEventPrivate;
class Q_WIDGETS_EXPORT QGraphicsSceneHelpEvent : public QGraphicsSceneEvent
{
public:
- QGraphicsSceneHelpEvent(Type type = None);
+ explicit QGraphicsSceneHelpEvent(Type type = None);
~QGraphicsSceneHelpEvent();
QPointF scenePos() const;
@@ -245,7 +245,7 @@ class QGraphicsSceneDragDropEventPrivate;
class Q_WIDGETS_EXPORT QGraphicsSceneDragDropEvent : public QGraphicsSceneEvent
{
public:
- QGraphicsSceneDragDropEvent(Type type = None);
+ explicit QGraphicsSceneDragDropEvent(Type type = None);
~QGraphicsSceneDragDropEvent();
QPointF pos() const;
diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h
index 8c412680b83..5e121def411 100644
--- a/src/widgets/kernel/qgesture.h
+++ b/src/widgets/kernel/qgesture.h
@@ -270,7 +270,7 @@ class QGestureEventPrivate;
class Q_WIDGETS_EXPORT QGestureEvent : public QEvent
{
public:
- QGestureEvent(const QList<QGesture *> &gestures);
+ explicit QGestureEvent(const QList<QGesture *> &gestures);
~QGestureEvent();
QList<QGesture *> gestures() const;
diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
index e2144134d99..61484c17368 100644
--- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
+++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
@@ -132,7 +132,7 @@ public:
class StartStopEvent: public QEvent
{
public:
- StartStopEvent(int type, QEventLoop *loop = 0)
+ explicit StartStopEvent(int type, QEventLoop *loop = 0)
: QEvent(Type(type)), el(loop)
{ }
diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp
index 01e26b6608a..81881fc7007 100644
--- a/tests/auto/other/gestures/tst_gestures.cpp
+++ b/tests/auto/other/gestures/tst_gestures.cpp
@@ -87,7 +87,7 @@ class CustomEvent : public QEvent
public:
static int EventType;
- CustomEvent(int serial_ = 0)
+ explicit CustomEvent(int serial_ = 0)
: QEvent(QEvent::Type(CustomEvent::EventType)),
serial(serial_), hasHotSpot(false)
{
diff --git a/tests/auto/testlib/selftests/alive/qtestalive.cpp b/tests/auto/testlib/selftests/alive/qtestalive.cpp
index c2e597ac18d..d962b7801f4 100644
--- a/tests/auto/testlib/selftests/alive/qtestalive.cpp
+++ b/tests/auto/testlib/selftests/alive/qtestalive.cpp
@@ -50,7 +50,7 @@ public:
enum { AliveEventType = QEvent::User + 422 };
- inline QTestAliveEvent(int aSequenceId)
+ explicit inline QTestAliveEvent(int aSequenceId)
: QEvent(QEvent::Type(AliveEventType)), seqId(aSequenceId)
{}
inline int sequenceId() const { return seqId; }
diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp
index 1ebdf2e0bb7..3ce3d5c2c10 100644
--- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp
+++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp
@@ -41,7 +41,7 @@
#include "themeevent.h"
-ThemeEvent::ThemeEvent( QString newTheme, Type type) : QEvent(type),
+ThemeEvent::ThemeEvent( const QString &newTheme, Type type) : QEvent(type),
m_theme(newTheme)
{
diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h
index c98f90da553..3603b5966f2 100644
--- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h
+++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h
@@ -50,7 +50,7 @@ static QEvent::Type ThemeEventType = (QEvent::Type) 1010;
class ThemeEvent : public QEvent
{
public:
- ThemeEvent(QString newTheme, QEvent::Type type = ThemeEventType );
+ explicit ThemeEvent(const QString &newTheme, QEvent::Type type = ThemeEventType );
~ThemeEvent();
public: