From 67b296e249883e559bab7edcd8360ca702e18fe9 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Wed, 1 Aug 2018 16:50:00 +0200 Subject: QLabel: Use nullptr Also, change an old-style-cast while touching its line. Change-Id: I7b4a38994fb7f52fb7fb02826a71ef4b3698aa34 Reviewed-by: Jesus Fernandez --- src/widgets/widgets/qlabel.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index c624187190..518c0275d3 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -288,7 +288,7 @@ void QLabel::setText(const QString &text) return; QWidgetTextControl *oldControl = d->control; - d->control = 0; + d->control = nullptr; d->clearContents(); d->text = text; @@ -303,7 +303,7 @@ void QLabel::setText(const QString &text) d->ensureTextControl(); } else { delete d->control; - d->control = 0; + d->control = nullptr; } if (d->isRichText) { @@ -714,7 +714,7 @@ void QLabel::setTextInteractionFlags(Qt::TextInteractionFlags flags) d->ensureTextControl(); } else { delete d->control; - d->control = 0; + d->control = nullptr; } if (d->control) @@ -1026,7 +1026,8 @@ void QLabel::paintEvent(QPaintEvent *) #endif if (d->control) { #ifndef QT_NO_SHORTCUT - const bool underline = (bool)style->styleHint(QStyle::SH_UnderlineShortcut, 0, this, 0); + const bool underline = static_cast(style->styleHint(QStyle::SH_UnderlineShortcut, + nullptr, this, nullptr)); if (d->shortcutId != 0 && underline != d->shortcutCursor.charFormat().fontUnderline()) { QTextCharFormat fmt; @@ -1293,20 +1294,20 @@ void QLabel::setMovie(QMovie *movie) void QLabelPrivate::clearContents() { delete control; - control = 0; + control = nullptr; isTextLabel = false; hasShortcut = false; #ifndef QT_NO_PICTURE delete picture; - picture = 0; + picture = nullptr; #endif delete scaledpixmap; - scaledpixmap = 0; + scaledpixmap = nullptr; delete cachedimage; - cachedimage = 0; + cachedimage = nullptr; delete pixmap; - pixmap = 0; + pixmap = nullptr; text.clear(); Q_Q(QLabel); @@ -1320,7 +1321,7 @@ void QLabelPrivate::clearContents() QObject::disconnect(movie, SIGNAL(resized(QSize)), q, SLOT(_q_movieResized(QSize))); QObject::disconnect(movie, SIGNAL(updated(QRect)), q, SLOT(_q_movieUpdated(QRect))); } - movie = 0; + movie = nullptr; #endif #ifndef QT_NO_CURSOR if (onAnchor) { @@ -1427,9 +1428,9 @@ void QLabel::setScaledContents(bool enable) d->scaledcontents = enable; if (!enable) { delete d->scaledpixmap; - d->scaledpixmap = 0; + d->scaledpixmap = nullptr; delete d->cachedimage; - d->cachedimage = 0; + d->cachedimage = nullptr; } update(contentsRect()); } @@ -1628,7 +1629,7 @@ QMenu *QLabelPrivate::createStandardContextMenu(const QPoint &pos) } if (linkToCopy.isEmpty() && !control) - return 0; + return nullptr; return control->createStandardContextMenu(p, q_func()); } -- cgit v1.2.3