summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2018-08-01 16:50:00 +0200
committerAndré Hartmann <aha_1980@gmx.de>2018-08-06 08:30:46 +0000
commit67b296e249883e559bab7edcd8360ca702e18fe9 (patch)
tree9a1a5a6df6a0eb00e6d0fb3934bf31aed35bd963
parent9514229249b6313ddb8a8a15a674c8d67f28c48e (diff)
QLabel: Use nullptr
Also, change an old-style-cast while touching its line. Change-Id: I7b4a38994fb7f52fb7fb02826a71ef4b3698aa34 Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
-rw-r--r--src/widgets/widgets/qlabel.cpp27
1 files 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<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());
}