From 58e2b9c01b31cef8a0fa263de3d984c22f1d7ca7 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Sat, 15 Sep 2012 13:46:14 +0200 Subject: examples: Mark ctor's as explicit Make C++ class constructors that can be used with only one required argument 'explicit' to minimize wrong use of the class. Change-Id: Ida9f9c2f0c8608c35b0137b2512a6747afd69515 Reviewed-by: Mitch Curtis Reviewed-by: Thiago Macieira --- examples/tools/treemodelcompleter/treemodelcompleter.h | 4 ++-- examples/tools/undo/document.h | 2 +- examples/tools/undoframework/commands.h | 2 +- examples/tools/undoframework/diagramitem.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'examples/tools') diff --git a/examples/tools/treemodelcompleter/treemodelcompleter.h b/examples/tools/treemodelcompleter/treemodelcompleter.h index 953be62c5d..a7234a4960 100644 --- a/examples/tools/treemodelcompleter/treemodelcompleter.h +++ b/examples/tools/treemodelcompleter/treemodelcompleter.h @@ -50,8 +50,8 @@ class TreeModelCompleter : public QCompleter Q_PROPERTY(QString separator READ separator WRITE setSeparator) public: - TreeModelCompleter(QObject *parent = 0); - TreeModelCompleter(QAbstractItemModel *model, QObject *parent = 0); + explicit TreeModelCompleter(QObject *parent = 0); + explicit TreeModelCompleter(QAbstractItemModel *model, QObject *parent = 0); QString separator() const; public slots: diff --git a/examples/tools/undo/document.h b/examples/tools/undo/document.h index 713094cce3..4ffbe473d0 100644 --- a/examples/tools/undo/document.h +++ b/examples/tools/undo/document.h @@ -52,7 +52,7 @@ class Shape public: enum Type { Rectangle, Circle, Triangle }; - Shape(Type type = Rectangle, const QColor &color = Qt::red, const QRect &rect = QRect()); + explicit Shape(Type type = Rectangle, const QColor &color = Qt::red, const QRect &rect = QRect()); Type type() const; QString name() const; diff --git a/examples/tools/undoframework/commands.h b/examples/tools/undoframework/commands.h index 70667e9f2d..72f61b10a6 100644 --- a/examples/tools/undoframework/commands.h +++ b/examples/tools/undoframework/commands.h @@ -70,7 +70,7 @@ private: class DeleteCommand : public QUndoCommand { public: - DeleteCommand(QGraphicsScene *graphicsScene, QUndoCommand *parent = 0); + explicit DeleteCommand(QGraphicsScene *graphicsScene, QUndoCommand *parent = 0); void undo(); void redo(); diff --git a/examples/tools/undoframework/diagramitem.h b/examples/tools/undoframework/diagramitem.h index 849ef2132b..91ed55be39 100644 --- a/examples/tools/undoframework/diagramitem.h +++ b/examples/tools/undoframework/diagramitem.h @@ -56,7 +56,7 @@ public: enum { Type = UserType + 1 }; enum DiagramType { Box, Triangle }; - DiagramItem(DiagramType diagramType, QGraphicsItem *item = 0); + explicit DiagramItem(DiagramType diagramType, QGraphicsItem *item = 0); DiagramType diagramType() const { return polygon() == boxPolygon ? Box : Triangle; -- cgit v1.2.3