From 58c14c4a7edcecdd9d58b682a9360c83e2274ec5 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Mon, 18 Sep 2017 11:49:52 +0200 Subject: Replace Q_NULLPTR with nullptr where possible Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen Reviewed-by: Lars Knoll Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/text/qabstracttextdocumentlayout.h | 2 +- src/gui/text/qfont.cpp | 4 ++-- src/gui/text/qfontdatabase.cpp | 2 +- src/gui/text/qfontengine.cpp | 6 +++--- src/gui/text/qfontmetrics.h | 10 +++++----- src/gui/text/qtextdocument.h | 6 +++--- src/gui/text/qtextengine.cpp | 4 ++-- src/gui/text/qtextlayout.h | 8 ++++---- src/gui/text/qtextobject.h | 6 +++--- src/gui/text/qtexttable.h | 4 ++-- 10 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src/gui/text') diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h index 438ad6e70b..8fea27f772 100644 --- a/src/gui/text/qabstracttextdocumentlayout.h +++ b/src/gui/text/qabstracttextdocumentlayout.h @@ -100,7 +100,7 @@ public: QTextDocument *document() const; void registerHandler(int objectType, QObject *component); - void unregisterHandler(int objectType, QObject *component = Q_NULLPTR); + void unregisterHandler(int objectType, QObject *component = nullptr); QTextObjectInterface *handlerForObject(int objectType) const; Q_SIGNALS: diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index f0a5053196..0c72ac3019 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2837,7 +2837,7 @@ QFontEngine *QFontCache::findEngine(const Key &key) end = engineCache.end(); if (it == end) return 0; - Q_ASSERT(it.value().data != Q_NULLPTR); + Q_ASSERT(it.value().data != nullptr); Q_ASSERT(key.multi == (it.value().data->type() == QFontEngine::Multi)); // found... update the hitcount and timestamp @@ -2860,7 +2860,7 @@ void QFontCache::updateHitCountAndTimeStamp(Engine &value) void QFontCache::insertEngine(const Key &key, QFontEngine *engine, bool insertMulti) { - Q_ASSERT(engine != Q_NULLPTR); + Q_ASSERT(engine != nullptr); Q_ASSERT(key.multi == (engine->type() == QFontEngine::Multi)); #ifdef QFONTCACHE_DEBUG diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 2cc071d67b..288352b370 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -2775,7 +2775,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script) if (d->engineData->engines[script]) return; - QFontEngine *fe = Q_NULLPTR; + QFontEngine *fe = nullptr; req.fallBackFamilies = fallBackFamilies; if (!req.fallBackFamilies.isEmpty()) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index e4f9b8b9d4..5be8745b15 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1080,7 +1080,7 @@ QFontEngineGlyphCache *QFontEngine::glyphCache(const void *context, GlyphFormat { const QHash::const_iterator caches = m_glyphCaches.constFind(context); if (caches == m_glyphCaches.cend()) - return Q_NULLPTR; + return nullptr; for (GlyphCaches::const_iterator it = caches->begin(), end = caches->end(); it != end; ++it) { QFontEngineGlyphCache *cache = it->cache.data(); @@ -1088,7 +1088,7 @@ QFontEngineGlyphCache *QFontEngine::glyphCache(const void *context, GlyphFormat return cache; } - return Q_NULLPTR; + return nullptr; } static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *pairs, int numPairs) @@ -1234,7 +1234,7 @@ int QFontEngine::glyphCount() const Qt::HANDLE QFontEngine::handle() const { - return Q_NULLPTR; + return nullptr; } const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize) diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h index 3eac309092..25e708be29 100644 --- a/src/gui/text/qfontmetrics.h +++ b/src/gui/text/qfontmetrics.h @@ -101,11 +101,11 @@ public: QRect boundingRect(QChar) const; QRect boundingRect(const QString &text) const; - QRect boundingRect(const QRect &r, int flags, const QString &text, int tabstops = 0, int *tabarray = Q_NULLPTR) const; + QRect boundingRect(const QRect &r, int flags, const QString &text, int tabstops = 0, int *tabarray = nullptr) const; inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text, - int tabstops = 0, int *tabarray = Q_NULLPTR) const + int tabstops = 0, int *tabarray = nullptr) const { return boundingRect(QRect(x, y, w, h), flags, text, tabstops, tabarray); } - QSize size(int flags, const QString& str, int tabstops = 0, int *tabarray = Q_NULLPTR) const; + QSize size(int flags, const QString& str, int tabstops = 0, int *tabarray = nullptr) const; QRect tightBoundingRect(const QString &text) const; @@ -170,8 +170,8 @@ public: QRectF boundingRect(const QString &string) const; QRectF boundingRect(QChar) const; - QRectF boundingRect(const QRectF &r, int flags, const QString& string, int tabstops = 0, int *tabarray = Q_NULLPTR) const; - QSizeF size(int flags, const QString& str, int tabstops = 0, int *tabarray = Q_NULLPTR) const; + QRectF boundingRect(const QRectF &r, int flags, const QString& string, int tabstops = 0, int *tabarray = nullptr) const; + QSizeF size(int flags, const QString& str, int tabstops = 0, int *tabarray = nullptr) const; QRectF tightBoundingRect(const QString &text) const; diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index c2761a39b9..41c578fc1b 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -116,11 +116,11 @@ class Q_GUI_EXPORT QTextDocument : public QObject Q_PROPERTY(QUrl baseUrl READ baseUrl WRITE setBaseUrl NOTIFY baseUrlChanged) public: - explicit QTextDocument(QObject *parent = Q_NULLPTR); - explicit QTextDocument(const QString &text, QObject *parent = Q_NULLPTR); + explicit QTextDocument(QObject *parent = nullptr); + explicit QTextDocument(const QString &text, QObject *parent = nullptr); ~QTextDocument(); - QTextDocument *clone(QObject *parent = Q_NULLPTR) const; + QTextDocument *clone(QObject *parent = nullptr) const; bool isEmpty() const; virtual void clear(); diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index faddb3552d..71f02376ac 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1242,7 +1242,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, { HB_TAG('h','l','i','g'), !dontLigate, 0, uint(-1) } }; const int num_features = dontLigate ? 5 : 1; - const char *const *shaper_list = Q_NULLPTR; + const char *const *shaper_list = nullptr; #if defined(Q_OS_DARWIN) // What's behind QFontEngine::FaceData::user_data isn't compatible between different font engines // - specifically functions in hb-coretext.cc would run into undefined behavior with data @@ -1252,7 +1252,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, "graphite2", "ot", "fallback", - Q_NULLPTR + nullptr }; shaper_list = s_shaper_list_without_coretext; } diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h index 980a099b05..67bc75a6b8 100644 --- a/src/gui/text/qtextlayout.h +++ b/src/gui/text/qtextlayout.h @@ -69,7 +69,7 @@ class Q_GUI_EXPORT QTextInlineObject { public: QTextInlineObject(int i, QTextEngine *e) : itm(i), eng(e) {} - inline QTextInlineObject() : itm(0), eng(Q_NULLPTR) {} + inline QTextInlineObject() : itm(0), eng(nullptr) {} inline bool isValid() const { return eng; } QRectF rect() const; @@ -107,7 +107,7 @@ public: // does itemization QTextLayout(); QTextLayout(const QString& text); - QTextLayout(const QString& text, const QFont &font, QPaintDevice *paintdevice = Q_NULLPTR); + QTextLayout(const QString& text, const QFont &font, QPaintDevice *paintdevice = nullptr); QTextLayout(const QTextBlock &b); ~QTextLayout(); @@ -210,7 +210,7 @@ Q_DECLARE_TYPEINFO(QTextLayout::FormatRange, Q_RELOCATABLE_TYPE); class Q_GUI_EXPORT QTextLine { public: - inline QTextLine() : index(0), eng(Q_NULLPTR) {} + inline QTextLine() : index(0), eng(nullptr) {} inline bool isValid() const { return eng; } QRectF rect() const; @@ -255,7 +255,7 @@ public: int lineNumber() const { return index; } - void draw(QPainter *p, const QPointF &point, const QTextLayout::FormatRange *selection = Q_NULLPTR) const; + void draw(QPainter *p, const QPointF &point, const QTextLayout::FormatRange *selection = nullptr) const; #if !defined(QT_NO_RAWFONT) QList glyphRuns(int from = -1, int length = -1) const; diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h index a5030de112..7e4efa28f8 100644 --- a/src/gui/text/qtextobject.h +++ b/src/gui/text/qtextobject.h @@ -203,7 +203,7 @@ class Q_GUI_EXPORT QTextBlock friend class QSyntaxHighlighter; public: inline QTextBlock(QTextDocumentPrivate *priv, int b) : p(priv), n(b) {} - inline QTextBlock() : p(Q_NULLPTR), n(0) {} + inline QTextBlock() : p(nullptr), n(0) {} inline QTextBlock(const QTextBlock &o) : p(o.p), n(o.n) {} inline QTextBlock &operator=(const QTextBlock &o) { p = o.p; n = o.n; return *this; } @@ -260,7 +260,7 @@ public: friend class QTextBlock; iterator(const QTextDocumentPrivate *priv, int begin, int end, int f) : p(priv), b(begin), e(end), n(f) {} public: - iterator() : p(Q_NULLPTR), b(0), e(0), n(0) {} + iterator() : p(nullptr), b(0), e(0), n(0) {} #if QT_VERSION < QT_VERSION_CHECK(6,0,0) iterator(const iterator &o) : p(o.p), b(o.b), e(o.e), n(o.n) {} #endif @@ -304,7 +304,7 @@ class Q_GUI_EXPORT QTextFragment { public: inline QTextFragment(const QTextDocumentPrivate *priv, int f, int fe) : p(priv), n(f), ne(fe) {} - inline QTextFragment() : p(Q_NULLPTR), n(0), ne(0) {} + inline QTextFragment() : p(nullptr), n(0), ne(0) {} inline QTextFragment(const QTextFragment &o) : p(o.p), n(o.n), ne(o.ne) {} inline QTextFragment &operator=(const QTextFragment &o) { p = o.p; n = o.n; ne = o.ne; return *this; } diff --git a/src/gui/text/qtexttable.h b/src/gui/text/qtexttable.h index ee8e974396..156b091b05 100644 --- a/src/gui/text/qtexttable.h +++ b/src/gui/text/qtexttable.h @@ -54,7 +54,7 @@ class QTextTablePrivate; class Q_GUI_EXPORT QTextTableCell { public: - QTextTableCell() : table(Q_NULLPTR) {} + QTextTableCell() : table(nullptr) {} ~QTextTableCell() {} QTextTableCell(const QTextTableCell &o) : table(o.table), fragment(o.fragment) {} QTextTableCell &operator=(const QTextTableCell &o) @@ -69,7 +69,7 @@ public: int rowSpan() const; int columnSpan() const; - inline bool isValid() const { return table != Q_NULLPTR; } + inline bool isValid() const { return table != nullptr; } QTextCursor firstCursorPosition() const; QTextCursor lastCursorPosition() const; -- cgit v1.2.3