QLabel: Use nullptr

Also, change an old-style-cast while touching its line.

Change-Id: I7b4a38994fb7f52fb7fb02826a71ef4b3698aa34
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
bb10
Andre Hartmann 2018-08-01 16:50:00 +02:00 committed by André Hartmann
parent 9514229249
commit 67b296e249
1 changed files with 14 additions and 13 deletions

View File

@ -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<bool>(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());
}