diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-12-02 14:11:13 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-01-23 15:13:45 +0000 |
commit | aa32510430d6a5e58cb456faeb072d9f189872fe (patch) | |
tree | 449096e9edff2056d186e0b0d1ae19d52d21652b /examples/widgets/layouts | |
parent | c590aa678d5c27162b0ca7191fa76b1d3a112767 (diff) |
Cleanup Widgets examples - nullptr
Cleanup the widgets examples - replace 0 with nullptr
Change-Id: Id4bf119b9a41f6d10117f3a613a6e604128fa196
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/widgets/layouts')
-rw-r--r-- | examples/widgets/layouts/borderlayout/borderlayout.cpp | 9 | ||||
-rw-r--r-- | examples/widgets/layouts/flowlayout/flowlayout.cpp | 5 |
2 files changed, 5 insertions, 9 deletions
diff --git a/examples/widgets/layouts/borderlayout/borderlayout.cpp b/examples/widgets/layouts/borderlayout/borderlayout.cpp index 9b142584c9..c929d3b2a4 100644 --- a/examples/widgets/layouts/borderlayout/borderlayout.cpp +++ b/examples/widgets/layouts/borderlayout/borderlayout.cpp @@ -98,10 +98,7 @@ int BorderLayout::count() const QLayoutItem *BorderLayout::itemAt(int index) const { ItemWrapper *wrapper = list.value(index); - if (wrapper) - return wrapper->item; - else - return 0; + return wrapper ? wrapper->item : nullptr; } QSize BorderLayout::minimumSize() const @@ -111,7 +108,7 @@ QSize BorderLayout::minimumSize() const void BorderLayout::setGeometry(const QRect &rect) { - ItemWrapper *center = 0; + ItemWrapper *center = nullptr; int eastWidth = 0; int westWidth = 0; int northHeight = 0; @@ -189,7 +186,7 @@ QLayoutItem *BorderLayout::takeAt(int index) ItemWrapper *layoutStruct = list.takeAt(index); return layoutStruct->item; } - return 0; + return nullptr; } void BorderLayout::add(QLayoutItem *item, Position position) diff --git a/examples/widgets/layouts/flowlayout/flowlayout.cpp b/examples/widgets/layouts/flowlayout/flowlayout.cpp index 9203da0ba1..b7064d98b1 100644 --- a/examples/widgets/layouts/flowlayout/flowlayout.cpp +++ b/examples/widgets/layouts/flowlayout/flowlayout.cpp @@ -116,8 +116,7 @@ QLayoutItem *FlowLayout::takeAt(int index) { if (index >= 0 && index < itemList.size()) return itemList.takeAt(index); - else - return 0; + return nullptr; } //! [5] @@ -215,7 +214,7 @@ int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const return -1; } else if (parent->isWidgetType()) { QWidget *pw = static_cast<QWidget *>(parent); - return pw->style()->pixelMetric(pm, 0, pw); + return pw->style()->pixelMetric(pm, nullptr, pw); } else { return static_cast<QLayout *>(parent)->spacing(); } |