From af2daafde72db02454d24b7d691aa6861525ab99 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 18 Nov 2019 17:01:26 +0100 Subject: Deprecate constructing QFlags from a pointer This was used to support QFlags f = 0 initialization, but with 0 used as a pointer literal now considered bad form, it had been changed many places to QFlags f = nullptr, which is meaningless and confusing. Change-Id: I4bc592151c255dc5cab1a232615caecc520f02e8 Reviewed-by: Thiago Macieira --- src/gui/text/qcssparser.cpp | 2 +- src/gui/text/qdistancefield.cpp | 2 +- src/gui/text/qfontengine.cpp | 4 ++-- src/gui/text/qfontmetrics.cpp | 8 ++++---- src/gui/text/qglyphrun.cpp | 2 +- src/gui/text/qglyphrun_p.h | 3 +-- src/gui/text/qrawfont.cpp | 2 +- src/gui/text/qtextengine.cpp | 10 +++++----- 8 files changed, 16 insertions(+), 17 deletions(-) (limited to 'src/gui/text') diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 793ef5774b..cf3d8e5ea2 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -682,7 +682,7 @@ bool ValueExtractor::extractOutline(int *borders, QBrush *colors, BorderStyle *s static Qt::Alignment parseAlignment(const QCss::Value *values, int count) { - Qt::Alignment a[2] = { 0, 0 }; + Qt::Alignment a[2] = { { }, { } }; for (int i = 0; i < qMin(2, count); i++) { if (values[i].type != Value::KnownIdentifier) break; diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp index d8a971c7b7..89f943ca51 100644 --- a/src/gui/text/qdistancefield.cpp +++ b/src/gui/text/qdistancefield.cpp @@ -952,7 +952,7 @@ void QDistanceField::setGlyph(QFontEngine *fontEngine, glyph_t glyph, bool doubl { QFixedPoint position; QPainterPath path; - fontEngine->addGlyphsToPath(&glyph, &position, 1, &path, 0); + fontEngine->addGlyphsToPath(&glyph, &position, 1, &path, { }); path.translate(-path.boundingRect().topLeft()); path.setFillRule(Qt::WindingFill); diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 403a0510fa..3a1f5ed4f4 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -506,7 +506,7 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform g.numGlyphs = 1; g.glyphs = &kashidaGlyph; g.advances = &kashidaWidth; - recalcAdvances(&g, 0); + recalcAdvances(&g, { }); for (uint k = 0; k < glyphs.justifications[i].nKashidas; ++k) { xpos -= kashidaWidth; @@ -948,7 +948,7 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph) im.fill(Qt::transparent); QPainter p(&im); p.setRenderHint(QPainter::Antialiasing); - addGlyphsToPath(&glyph, &pt, 1, &path, 0); + addGlyphsToPath(&glyph, &pt, 1, &path, { }); p.setPen(Qt::NoPen); p.setBrush(Qt::black); p.drawPath(path); diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index d3e4f11e8c..906047cdb4 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -562,7 +562,7 @@ int QFontMetrics::width(const QString &text, int len, int flags) const int numGlyphs = len; QVarLengthGlyphLayoutArray glyphs(numGlyphs); QFontEngine *engine = d->engineForScript(QChar::Script_Common); - if (!engine->stringToCMap(text.data(), len, &glyphs, &numGlyphs, 0)) + if (!engine->stringToCMap(text.data(), len, &glyphs, &numGlyphs, { })) Q_UNREACHABLE(); QFixed width; @@ -684,7 +684,7 @@ int QFontMetrics::horizontalAdvance(QChar ch) const glyphs.numGlyphs = 1; glyphs.glyphs = &glyph; glyphs.advances = &advance; - engine->recalcAdvances(&glyphs, 0); + engine->recalcAdvances(&glyphs, { }); return qRound(advance); } @@ -736,7 +736,7 @@ int QFontMetrics::charWidth(const QString &text, int pos) const glyphs.numGlyphs = 1; glyphs.glyphs = &glyph; glyphs.advances = &advance; - engine->recalcAdvances(&glyphs, 0); + engine->recalcAdvances(&glyphs, { }); width = qRound(advance); } @@ -1619,7 +1619,7 @@ qreal QFontMetricsF::horizontalAdvance(QChar ch) const glyphs.numGlyphs = 1; glyphs.glyphs = &glyph; glyphs.advances = &advance; - engine->recalcAdvances(&glyphs, 0); + engine->recalcAdvances(&glyphs, { }); return advance.toReal(); } diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp index 3c16c3bf62..f4cd839f15 100644 --- a/src/gui/text/qglyphrun.cpp +++ b/src/gui/text/qglyphrun.cpp @@ -279,7 +279,7 @@ void QGlyphRun::clear() { detach(); d->rawFont = QRawFont(); - d->flags = 0; + d->flags = { }; setPositions(QVector()); setGlyphIndexes(QVector()); diff --git a/src/gui/text/qglyphrun_p.h b/src/gui/text/qglyphrun_p.h index 465c3c7000..46e2a8bbfb 100644 --- a/src/gui/text/qglyphrun_p.h +++ b/src/gui/text/qglyphrun_p.h @@ -65,8 +65,7 @@ class QGlyphRunPrivate: public QSharedData { public: QGlyphRunPrivate() - : flags(nullptr) - , glyphIndexData(glyphIndexes.constData()) + : glyphIndexData(glyphIndexes.constData()) , glyphIndexDataSize(0) , glyphPositionData(glyphPositions.constData()) , glyphPositionDataSize(0) diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index a060448924..e04c8909f3 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -303,7 +303,7 @@ QPainterPath QRawFont::pathForGlyph(quint32 glyphIndex) const QFixedPoint position; QPainterPath path; - d->fontEngine->addGlyphsToPath(&glyphIndex, &position, 1, &path, 0); + d->fontEngine->addGlyphsToPath(&glyphIndex, &position, 1, &path, { }); return path; } diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 209433dac5..40adc4a3cf 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1720,7 +1720,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, g.glyphs[i] = actualFontEngine->glyphIndex('-'); if (Q_LIKELY(g.glyphs[i] != 0)) { QGlyphLayout tmp = g.mid(i, 1); - actualFontEngine->recalcAdvances(&tmp, 0); + actualFontEngine->recalcAdvances(&tmp, { }); } g.attributes[i].dontPrint = true; } @@ -2581,7 +2581,7 @@ static void set(QJustificationPoint *point, int type, const QGlyphLayout &glyph, g.numGlyphs = 1; g.glyphs = &kashidaGlyph; g.advances = &point->kashidaWidth; - fe->recalcAdvances(&g, 0); + fe->recalcAdvances(&g, { }); if (point->kashidaWidth == 0) point->type = Justification_Prohibited; @@ -3214,13 +3214,13 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int glyphs.advances = &ellipsisWidth; if (glyph != 0) { - engine->recalcAdvances(&glyphs, 0); + engine->recalcAdvances(&glyphs, { }); ellipsisText = ellipsisChar; } else { glyph = engine->glyphIndex('.'); if (glyph != 0) { - engine->recalcAdvances(&glyphs, 0); + engine->recalcAdvances(&glyphs, { }); ellipsisWidth *= 3; ellipsisText = QStringLiteral("..."); @@ -3928,7 +3928,7 @@ void QTextItemInt::initWithScriptItem(const QScriptItem &si) { // explicitly initialize flags so that initFontAttributes can be called // multiple times on the same TextItem - flags = 0; + flags = { }; if (si.analysis.bidiLevel %2) flags |= QTextItem::RightToLeft; ascent = si.ascent; -- cgit v1.2.3