diff --git a/src/gui/accessible/qaccessible2.h b/src/gui/accessible/qaccessible2.h index 61e46ebf04..708910b8df 100644 --- a/src/gui/accessible/qaccessible2.h +++ b/src/gui/accessible/qaccessible2.h @@ -115,7 +115,7 @@ public: class Q_GUI_EXPORT QAccessibleSimpleEditableTextInterface: public QAccessibleEditableTextInterface { public: - QAccessibleSimpleEditableTextInterface(QAccessibleInterface *accessibleInterface); //### + explicit QAccessibleSimpleEditableTextInterface(QAccessibleInterface *accessibleInterface); //### void copyText(int startOffset, int endOffset) const; void deleteText(int startOffset, int endOffset); diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h index 9d4cb87b15..e11dea6ad3 100644 --- a/src/gui/image/qmovie.h +++ b/src/gui/image/qmovie.h @@ -83,7 +83,7 @@ public: CacheAll }; - QMovie(QObject *parent = 0); + explicit QMovie(QObject *parent = 0); explicit QMovie(QIODevice *device, const QByteArray &format = QByteArray(), QObject *parent = 0); explicit QMovie(const QString &fileName, const QByteArray &format = QByteArray(), QObject *parent = 0); ~QMovie(); diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index 3d78a43917..0b21be5c8e 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -67,10 +67,10 @@ public: QPixmap(); explicit QPixmap(QPlatformPixmap *data); QPixmap(int w, int h); - QPixmap(const QSize &); + explicit QPixmap(const QSize &); QPixmap(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); #ifndef QT_NO_IMAGEFORMAT_XPM - QPixmap(const char * const xpm[]); + explicit QPixmap(const char * const xpm[]); #endif QPixmap(const QPixmap &); ~QPixmap(); diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h index 5a251dd0ef..5c88764d88 100644 --- a/src/gui/kernel/qclipboard.h +++ b/src/gui/kernel/qclipboard.h @@ -59,7 +59,7 @@ class Q_GUI_EXPORT QClipboard : public QObject { Q_OBJECT private: - QClipboard(QObject *parent); + explicit QClipboard(QObject *parent); ~QClipboard(); public: diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h index 52f94a8a10..5e1cd17635 100644 --- a/src/gui/kernel/qopenglcontext.h +++ b/src/gui/kernel/qopenglcontext.h @@ -94,7 +94,7 @@ class Q_GUI_EXPORT QOpenGLContext : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QOpenGLContext) public: - QOpenGLContext(QObject *parent = 0); + explicit QOpenGLContext(QObject *parent = 0); ~QOpenGLContext(); void setFormat(const QSurfaceFormat &format); diff --git a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h b/src/gui/kernel/qplatformsharedgraphicscache_qpa.h index d59cd7c3c8..f8ee201d85 100644 --- a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h +++ b/src/gui/kernel/qplatformsharedgraphicscache_qpa.h @@ -65,7 +65,7 @@ public: OpenGLTexture }; - QPlatformSharedGraphicsCache(QObject *parent = 0) : QObject(parent) {} + explicit QPlatformSharedGraphicsCache(QObject *parent = 0) : QObject(parent) {} Q_INVOKABLE virtual void ensureCacheInitialized(const QByteArray &cacheId, BufferType bufferType, PixelFormat pixelFormat) = 0; diff --git a/src/gui/kernel/qplatformsurface_qpa.h b/src/gui/kernel/qplatformsurface_qpa.h index af23ad3a85..646c3b72ce 100644 --- a/src/gui/kernel/qplatformsurface_qpa.h +++ b/src/gui/kernel/qplatformsurface_qpa.h @@ -59,7 +59,7 @@ public: QSurface::SurfaceClass surfaceClass() const; private: - QPlatformSurface(QSurface::SurfaceClass type); + explicit QPlatformSurface(QSurface::SurfaceClass type); QSurface::SurfaceClass m_type; diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h index 170f62162f..a72de7b547 100644 --- a/src/gui/kernel/qplatformwindow_qpa.h +++ b/src/gui/kernel/qplatformwindow_qpa.h @@ -63,7 +63,7 @@ class Q_GUI_EXPORT QPlatformWindow : public QPlatformSurface { Q_DECLARE_PRIVATE(QPlatformWindow) public: - QPlatformWindow(QWindow *window); + explicit QPlatformWindow(QWindow *window); virtual ~QPlatformWindow(); QWindow *window() const; diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h index 111e10d340..3bd24db3ce 100644 --- a/src/gui/kernel/qscreen.h +++ b/src/gui/kernel/qscreen.h @@ -142,7 +142,7 @@ Q_SIGNALS: void orientationChanged(Qt::ScreenOrientation orientation); private: - QScreen(QPlatformScreen *screen); + explicit QScreen(QPlatformScreen *screen); Q_DISABLE_COPY(QScreen) friend class QGuiApplicationPrivate; diff --git a/src/gui/kernel/qsurface.h b/src/gui/kernel/qsurface.h index a8900fde33..befb771129 100644 --- a/src/gui/kernel/qsurface.h +++ b/src/gui/kernel/qsurface.h @@ -80,7 +80,7 @@ public: virtual QSize size() const = 0; protected: - QSurface(SurfaceClass type); + explicit QSurface(SurfaceClass type); SurfaceClass m_type; diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h index 6daa08095e..a4224bbedd 100644 --- a/src/gui/kernel/qsurfaceformat.h +++ b/src/gui/kernel/qsurfaceformat.h @@ -75,7 +75,7 @@ public: }; QSurfaceFormat(); - QSurfaceFormat(FormatOptions options); + /*implicit*/ QSurfaceFormat(FormatOptions options); QSurfaceFormat(const QSurfaceFormat &other); QSurfaceFormat &operator=(const QSurfaceFormat &other); ~QSurfaceFormat(); diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 1461f12520..62ddb66a75 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -94,8 +94,8 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface public: - QWindow(QScreen *screen = 0); - QWindow(QWindow *parent); + explicit QWindow(QScreen *screen = 0); + explicit QWindow(QWindow *parent); virtual ~QWindow(); void setSurfaceType(SurfaceType surfaceType); diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h index 0a2446587a..b987ab2334 100644 --- a/src/gui/math3d/qgenericmatrix.h +++ b/src/gui/math3d/qgenericmatrix.h @@ -102,7 +102,7 @@ private: #endif T m[N][M]; // Column-major order to match OpenGL. - QGenericMatrix(int) {} // Construct without initializing identity matrix. + explicit QGenericMatrix(int) {} // Construct without initializing identity matrix. #if !defined(Q_NO_TEMPLATE_FRIENDS) template diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h index b80fc86f45..8353adfab1 100644 --- a/src/gui/math3d/qmatrix4x4.h +++ b/src/gui/math3d/qmatrix4x4.h @@ -201,7 +201,7 @@ private: }; // Construct without initializing identity matrix. - QMatrix4x4(int) { } + explicit QMatrix4x4(int) { } QMatrix4x4 orthonormalInverse() const; diff --git a/src/gui/opengl/qopenglframebufferobject.h b/src/gui/opengl/qopenglframebufferobject.h index 63260f1940..9e69cecc58 100644 --- a/src/gui/opengl/qopenglframebufferobject.h +++ b/src/gui/opengl/qopenglframebufferobject.h @@ -67,7 +67,7 @@ public: Depth }; - QOpenGLFramebufferObject(const QSize &size, GLenum target = GL_TEXTURE_2D); + explicit QOpenGLFramebufferObject(const QSize &size, GLenum target = GL_TEXTURE_2D); QOpenGLFramebufferObject(int width, int height, GLenum target = GL_TEXTURE_2D); #if !defined(QT_OPENGL_ES) || defined(Q_QDOC) QOpenGLFramebufferObject(const QSize &size, Attachment attachment, diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h index 4e778dda66..ce36a821b6 100644 --- a/src/gui/opengl/qopenglfunctions.h +++ b/src/gui/opengl/qopenglfunctions.h @@ -198,7 +198,7 @@ class Q_GUI_EXPORT QOpenGLFunctions { public: QOpenGLFunctions(); - QOpenGLFunctions(QOpenGLContext *context); + explicit QOpenGLFunctions(QOpenGLContext *context); ~QOpenGLFunctions() {} enum OpenGLFeature diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h index ce3e7cf278..7d4b901fe7 100644 --- a/src/gui/opengl/qopenglpaintdevice.h +++ b/src/gui/opengl/qopenglpaintdevice.h @@ -71,7 +71,7 @@ class Q_GUI_EXPORT QOpenGLPaintDevice : public QPaintDevice { Q_DECLARE_PRIVATE(QOpenGLPaintDevice) public: - QOpenGLPaintDevice(const QSize &size); + explicit QOpenGLPaintDevice(const QSize &size); QOpenGLPaintDevice(int width, int height); virtual ~QOpenGLPaintDevice(); diff --git a/src/gui/painting/qbackingstore.h b/src/gui/painting/qbackingstore.h index db6884f58d..ead15e7ea6 100644 --- a/src/gui/painting/qbackingstore.h +++ b/src/gui/painting/qbackingstore.h @@ -62,7 +62,7 @@ class QPlatformBackingStore; class Q_GUI_EXPORT QBackingStore { public: - QBackingStore(QWindow *window); + explicit QBackingStore(QWindow *window); ~QBackingStore(); QWindow *window() const; diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h index 7b0547ad45..c617521369 100644 --- a/src/gui/painting/qpdfwriter.h +++ b/src/gui/painting/qpdfwriter.h @@ -57,8 +57,8 @@ class Q_GUI_EXPORT QPdfWriter : public QObject, public QPagedPaintDevice { Q_OBJECT public: - QPdfWriter(const QString &filename); - QPdfWriter(QIODevice *device); + explicit QPdfWriter(const QString &filename); + explicit QPdfWriter(QIODevice *device); ~QPdfWriter(); QString title() const; diff --git a/src/gui/painting/qplatformbackingstore_qpa.h b/src/gui/painting/qplatformbackingstore_qpa.h index 8049c64c25..042913292f 100644 --- a/src/gui/painting/qplatformbackingstore_qpa.h +++ b/src/gui/painting/qplatformbackingstore_qpa.h @@ -62,7 +62,7 @@ class QPlatformWindow; class Q_GUI_EXPORT QPlatformBackingStore { public: - QPlatformBackingStore(QWindow *window); + explicit QPlatformBackingStore(QWindow *window); virtual ~QPlatformBackingStore(); QWindow *window() const; diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h index 0a089d3cf3..726ed434ed 100644 --- a/src/gui/painting/qpolygon.h +++ b/src/gui/painting/qpolygon.h @@ -61,9 +61,9 @@ class Q_GUI_EXPORT QPolygon : public QVector public: inline QPolygon() {} inline ~QPolygon() {} - inline QPolygon(int size); + inline explicit QPolygon(int size); inline QPolygon(const QPolygon &a) : QVector(a) {} - inline QPolygon(const QVector &v) : QVector(v) {} + inline /*implicit*/ QPolygon(const QVector &v) : QVector(v) {} QPolygon(const QRect &r, bool closed=false); QPolygon(int nPoints, const int *points); inline void swap(QPolygon &other) { QVector::swap(other); } // prevent QVector<->QPolygon swaps @@ -135,11 +135,11 @@ class Q_GUI_EXPORT QPolygonF : public QVector public: inline QPolygonF() {} inline ~QPolygonF() {} - inline QPolygonF(int size); + inline explicit QPolygonF(int size); inline QPolygonF(const QPolygonF &a) : QVector(a) {} - inline QPolygonF(const QVector &v) : QVector(v) {} + inline /*implicit*/ QPolygonF(const QVector &v) : QVector(v) {} QPolygonF(const QRectF &r); - QPolygonF(const QPolygon &a); + /*implicit*/ QPolygonF(const QPolygon &a); inline void swap(QPolygonF &other) { QVector::swap(other); } // prevent QVector<->QPolygonF swaps inline void translate(qreal dx, qreal dy); diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 9cc61198a5..cd1e3f0880 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -272,7 +272,7 @@ public: inline void resolve(uint mask) { resolve_mask = mask; } private: - QFont(QFontPrivate *); + explicit QFont(QFontPrivate *); void detach(); diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 7209fbdfc3..fe9e1d16c7 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -535,7 +535,7 @@ int QFontMetrics::width(const QString &text, int len, int flags) const return qRound(width); } - QStackTextEngine layout(text, d.data()); + QStackTextEngine layout(text, QFont(d.data())); layout.ignoreBidi = true; return qRound(layout.width(0, len)); } @@ -611,7 +611,7 @@ int QFontMetrics::charWidth(const QString &text, int pos) const int from = qMax(0, pos - 8); int to = qMin(text.length(), pos + 8); QString cstr = QString::fromRawData(text.unicode() + from, to - from); - QStackTextEngine layout(cstr, d.data()); + QStackTextEngine layout(cstr, QFont(d.data())); layout.ignoreBidi = true; layout.itemize(); width = qRound(layout.width(pos-from, 1)); @@ -660,7 +660,7 @@ QRect QFontMetrics::boundingRect(const QString &text) const if (text.length() == 0) return QRect(); - QStackTextEngine layout(text, d.data()); + QStackTextEngine layout(text, QFont(d.data())); layout.ignoreBidi = true; layout.itemize(); glyph_metrics_t gm = layout.boundingBox(0, text.length()); @@ -830,7 +830,7 @@ QRect QFontMetrics::tightBoundingRect(const QString &text) const if (text.length() == 0) return QRect(); - QStackTextEngine layout(text, d.data()); + QStackTextEngine layout(text, QFont(d.data())); layout.ignoreBidi = true; layout.itemize(); glyph_metrics_t gm = layout.tightBoundingBox(0, text.length()); @@ -1364,7 +1364,7 @@ qreal QFontMetricsF::width(const QString &text) const int pos = text.indexOf(QLatin1Char('\x9c')); int len = (pos != -1) ? pos : text.length(); - QStackTextEngine layout(text, d.data()); + QStackTextEngine layout(text, QFont(d.data())); layout.ignoreBidi = true; layout.itemize(); return layout.width(0, len).toReal(); @@ -1441,7 +1441,7 @@ QRectF QFontMetricsF::boundingRect(const QString &text) const if (len == 0) return QRectF(); - QStackTextEngine layout(text, d.data()); + QStackTextEngine layout(text, QFont(d.data())); layout.ignoreBidi = true; layout.itemize(); glyph_metrics_t gm = layout.boundingBox(0, len); @@ -1614,7 +1614,7 @@ QRectF QFontMetricsF::tightBoundingRect(const QString &text) const if (text.length() == 0) return QRect(); - QStackTextEngine layout(text, d.data()); + QStackTextEngine layout(text, QFont(d.data())); layout.ignoreBidi = true; layout.itemize(); glyph_metrics_t gm = layout.tightBoundingBox(0, text.length()); diff --git a/src/gui/text/qsyntaxhighlighter.h b/src/gui/text/qsyntaxhighlighter.h index 244f40b7ed..7107238a95 100644 --- a/src/gui/text/qsyntaxhighlighter.h +++ b/src/gui/text/qsyntaxhighlighter.h @@ -66,8 +66,8 @@ class Q_GUI_EXPORT QSyntaxHighlighter : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QSyntaxHighlighter) public: - QSyntaxHighlighter(QObject *parent); - QSyntaxHighlighter(QTextDocument *parent); + explicit QSyntaxHighlighter(QObject *parent); + explicit QSyntaxHighlighter(QTextDocument *parent); virtual ~QSyntaxHighlighter(); void setDocument(QTextDocument *doc); diff --git a/src/gui/text/qtextdocumentwriter.h b/src/gui/text/qtextdocumentwriter.h index c0dea06f8f..b7743b1ff7 100644 --- a/src/gui/text/qtextdocumentwriter.h +++ b/src/gui/text/qtextdocumentwriter.h @@ -59,7 +59,7 @@ class Q_GUI_EXPORT QTextDocumentWriter public: QTextDocumentWriter(); QTextDocumentWriter(QIODevice *device, const QByteArray &format); - QTextDocumentWriter(const QString &fileName, const QByteArray &format = QByteArray()); + explicit QTextDocumentWriter(const QString &fileName, const QByteArray &format = QByteArray()); ~QTextDocumentWriter(); void setFormat (const QByteArray &format); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 56098b0bdb..95b8f48ec5 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -340,7 +340,7 @@ QTextLayout::QTextLayout(const QString& text, const QFont &font, QPaintDevice *p QFont f(font); if (paintdevice) f = QFont(font, paintdevice); - d = new QTextEngine((text.isNull() ? (const QString&)QString::fromLatin1("") : text), f.d.data()); + d = new QTextEngine((text.isNull() ? (const QString&)QString::fromLatin1("") : text), f); } /*! diff --git a/src/gui/text/qtextoption.h b/src/gui/text/qtextoption.h index a0a4c76282..96a0cdda9b 100644 --- a/src/gui/text/qtextoption.h +++ b/src/gui/text/qtextoption.h @@ -86,7 +86,7 @@ public: }; QTextOption(); - QTextOption(Qt::Alignment alignment); + /*implicit*/ QTextOption(Qt::Alignment alignment); ~QTextOption(); QTextOption(const QTextOption &o); diff --git a/src/gui/util/qvalidator.h b/src/gui/util/qvalidator.h index f3191d2b1b..7aa8ad4091 100644 --- a/src/gui/util/qvalidator.h +++ b/src/gui/util/qvalidator.h @@ -176,7 +176,7 @@ class Q_GUI_EXPORT QRegExpValidator : public QValidator public: explicit QRegExpValidator(QObject *parent = 0); - QRegExpValidator(const QRegExp& rx, QObject *parent = 0); + explicit QRegExpValidator(const QRegExp& rx, QObject *parent = 0); ~QRegExpValidator(); virtual QValidator::State validate(QString& input, int& pos) const;