summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qlayout.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-11-22 14:46:58 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-12-06 12:13:20 +0100
commitece0c0a5e7e0b18beb58ccd868bde54c7be64f78 (patch)
treefa4a0fdbda040d24f1a2d07a320635c76980f431 /src/widgets/kernel/qlayout.cpp
parentb19220d17fa66de5ded41690ffff263ee2af5c63 (diff)
Tidy nullptr usage
Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/widgets/kernel/qlayout.cpp')
-rw-r--r--src/widgets/kernel/qlayout.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index f0f4fc5505..d4ff9083f1 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -130,7 +130,7 @@ QLayout::QLayout(QWidget *parent)
management will work.
*/
QLayout::QLayout()
- : QObject(*new QLayoutPrivate, 0)
+ : QObject(*new QLayoutPrivate, nullptr)
{
}
@@ -149,14 +149,14 @@ QLayout::QLayout(QLayoutPrivate &dd, QLayout *lay, QWidget *w)
" already has a layout",
qUtf16Printable(QObject::objectName()), w->metaObject()->className(),
qUtf16Printable(w->objectName()));
- setParent(0);
+ setParent(nullptr);
} else {
d->topLevel = true;
w->d_func()->layout = this;
QT_TRY {
invalidate();
} QT_CATCH(...) {
- w->d_func()->layout = 0;
+ w->d_func()->layout = nullptr;
QT_RETHROW;
}
}
@@ -166,7 +166,7 @@ QLayout::QLayout(QLayoutPrivate &dd, QLayout *lay, QWidget *w)
QLayoutPrivate::QLayoutPrivate()
: QObjectPrivate(), insideSpacing(-1), userLeftMargin(-1), userTopMargin(-1), userRightMargin(-1),
userBottomMargin(-1), topLevel(false), enabled(true), activated(true), autoNewChild(false),
- constraint(QLayout::SetDefaultConstraint), menubar(0)
+ constraint(QLayout::SetDefaultConstraint), menubar(nullptr)
{
}
@@ -181,7 +181,7 @@ void QLayoutPrivate::getMargin(int *result, int userMargin, QStyle::PixelMetric
} else if (!topLevel) {
*result = 0;
} else if (QWidget *pw = q->parentWidget()) {
- *result = pw->style()->pixelMetric(pm, 0, pw);
+ *result = pw->style()->pixelMetric(pm, nullptr, pw);
} else {
*result = 0;
}
@@ -189,8 +189,8 @@ void QLayoutPrivate::getMargin(int *result, int userMargin, QStyle::PixelMetric
// Static item factory functions that allow for hooking things in Designer
-QLayoutPrivate::QWidgetItemFactoryMethod QLayoutPrivate::widgetItemFactoryMethod = 0;
-QLayoutPrivate::QSpacerItemFactoryMethod QLayoutPrivate::spacerItemFactoryMethod = 0;
+QLayoutPrivate::QWidgetItemFactoryMethod QLayoutPrivate::widgetItemFactoryMethod = nullptr;
+QLayoutPrivate::QSpacerItemFactoryMethod QLayoutPrivate::spacerItemFactoryMethod = nullptr;
QWidgetItem *QLayoutPrivate::createWidgetItem(const QLayout *layout, QWidget *widget)
{
@@ -624,7 +624,7 @@ void QLayout::widgetEvent(QEvent *e)
if (c->child()->isWidgetType()) {
#if QT_CONFIG(menubar)
if (c->child() == d->menubar)
- d->menubar = 0;
+ d->menubar = nullptr;
#endif
removeWidgetRecursively(this, c->child());
}
@@ -764,7 +764,7 @@ QLayout::~QLayout()
{
Q_D(QLayout);
if (d->topLevel && parent() && parent()->isWidgetType() && parentWidget()->layout() == this)
- parentWidget()->d_func()->layout = 0;
+ parentWidget()->d_func()->layout = nullptr;
else if (QLayout *parentLayout = qobject_cast<QLayout *>(parent()))
parentLayout->removeItem(this);
}
@@ -919,7 +919,7 @@ void QLayout::addChildWidget(QWidget *w)
qWarning("QLayout::addChildWidget: %s \"%ls\" in wrong parent; moved to correct parent",
w->metaObject()->className(), qUtf16Printable(w->objectName()));
#endif
- pw = 0;
+ pw = nullptr;
}
bool needShow = mw && mw->isVisible() && !(w->isHidden() && w->testAttribute(Qt::WA_WState_ExplicitShowHide));
if (!pw && mw)
@@ -1153,12 +1153,12 @@ QLayoutItem *QLayout::replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOpt
{
Q_D(QLayout);
if (!from || !to)
- return 0;
+ return nullptr;
if (from == to) // Do not return a QLayoutItem for \a from, since ownership still
return nullptr; // belongs to the layout (since nothing was changed)
int index = -1;
- QLayoutItem *item = 0;
+ QLayoutItem *item = nullptr;
for (int u = 0; u < count(); ++u) {
item = itemAt(u);
if (!item)
@@ -1176,7 +1176,7 @@ QLayoutItem *QLayout::replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOpt
}
}
if (index == -1)
- return 0;
+ return nullptr;
addChildWidget(to);
QLayoutItem *newitem = new QWidgetItem(to);