diff options
author | Kevin Funk <kevin.funk@kdab.com> | 2017-09-18 11:49:52 +0200 |
---|---|---|
committer | Kevin Funk <kevin.funk@kdab.com> | 2017-09-19 11:53:55 +0000 |
commit | 58c14c4a7edcecdd9d58b682a9360c83e2274ec5 (patch) | |
tree | 7f600686e4dd92681bec09ac745a9dcd4425844b /tests/auto/widgets/graphicsview | |
parent | 47c92fbb0b588b443cead18a5aad5a2b5ad9e4d7 (diff) |
Replace Q_NULLPTR with nullptr where possible
Remaining uses of Q_NULLPTR are in:
src/corelib/global/qcompilerdetection.h
(definition and documentation of Q_NULLPTR)
tests/manual/qcursor/qcursorhighdpi/main.cpp
(a test executable compilable both under Qt4 and Qt5)
Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto/widgets/graphicsview')
3 files changed, 21 insertions, 21 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 96827022a8..63fe2e6cb4 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -1110,11 +1110,11 @@ void tst_QGraphicsItem::visible() scene.addItem(item); QVERIFY(item->isVisible()); - QCOMPARE(scene.items(QPointF(0, 0)).value(0, Q_NULLPTR), item); + QCOMPARE(scene.items(QPointF(0, 0)).value(0, nullptr), item); item->setVisible(false); QVERIFY(scene.items(QPointF(0, 0)).isEmpty()); item->setVisible(true); - QCOMPARE(scene.items(QPointF(0, 0)).value(0, Q_NULLPTR), item); + QCOMPARE(scene.items(QPointF(0, 0)).value(0, nullptr), item); QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress); event.setButton(Qt::LeftButton); @@ -5503,16 +5503,16 @@ void tst_QGraphicsItem::itemClipsChildrenToShape2() QGraphicsScene scene; scene.addItem(parent); - QCOMPARE(scene.items(QPointF(5, 5)).value(0, Q_NULLPTR), (QGraphicsItem *)parent); + QCOMPARE(scene.items(QPointF(5, 5)).value(0, nullptr), (QGraphicsItem *)parent); QVERIFY(scene.items(QPointF(15, 5)).isEmpty()); QVERIFY(scene.items(QPointF(5, 15)).isEmpty()); QVERIFY(scene.items(QPointF(60, 60)).isEmpty()); QVERIFY(scene.items(QPointF(140, 60)).isEmpty()); QVERIFY(scene.items(QPointF(60, 140)).isEmpty()); QVERIFY(scene.items(QPointF(140, 140)).isEmpty()); - QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child2); - QCOMPARE(scene.items(QPointF(75, 100)).value(0, Q_NULLPTR), (QGraphicsItem *)child1); - QCOMPARE(scene.items(QPointF(100, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child1); + QCOMPARE(scene.items(QPointF(75, 75)).value(0, nullptr), (QGraphicsItem *)child2); + QCOMPARE(scene.items(QPointF(75, 100)).value(0, nullptr), (QGraphicsItem *)child1); + QCOMPARE(scene.items(QPointF(100, 75)).value(0, nullptr), (QGraphicsItem *)child1); QImage image(100, 100, QImage::Format_ARGB32_Premultiplied); image.fill(0); @@ -5547,9 +5547,9 @@ void tst_QGraphicsItem::itemClipsChildrenToShape3() grandchild->setPos( 50, 50 ); parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape); - QCOMPARE(scene.items(QPointF(25, 25)).value(0, Q_NULLPTR), (QGraphicsItem *)parent); - QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child); - QCOMPARE(scene.items(QPointF(125, 125)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild); + QCOMPARE(scene.items(QPointF(25, 25)).value(0, nullptr), (QGraphicsItem *)parent); + QCOMPARE(scene.items(QPointF(75, 75)).value(0, nullptr), (QGraphicsItem *)child); + QCOMPARE(scene.items(QPointF(125, 125)).value(0, nullptr), (QGraphicsItem *)grandchild); QVERIFY(scene.items(QPointF(175, 175)).isEmpty()); // Move child to fully overlap the parent. The grandchild should @@ -5557,9 +5557,9 @@ void tst_QGraphicsItem::itemClipsChildrenToShape3() child->prepareGeometryChange(); child->setPos( 0, 0 ); - QCOMPARE(scene.items(QPointF(25, 25)).value(0, Q_NULLPTR), (QGraphicsItem *)child); - QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild); - QCOMPARE(scene.items(QPointF(125, 125)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild); + QCOMPARE(scene.items(QPointF(25, 25)).value(0, nullptr), (QGraphicsItem *)child); + QCOMPARE(scene.items(QPointF(75, 75)).value(0, nullptr), (QGraphicsItem *)grandchild); + QCOMPARE(scene.items(QPointF(125, 125)).value(0, nullptr), (QGraphicsItem *)grandchild); QVERIFY(scene.items(QPointF(175, 175)).isEmpty()); } @@ -5832,8 +5832,8 @@ void tst_QGraphicsItem::itemClippingDiscovery() rightRectItem->setParentItem(clipItem); // The rects item are both visible at these points. - QCOMPARE(scene.items(QPointF(10, 10)).value(0, Q_NULLPTR), (QGraphicsItem *)leftRectItem); - QCOMPARE(scene.items(QPointF(90, 90)).value(0, Q_NULLPTR), (QGraphicsItem *)rightRectItem); + QCOMPARE(scene.items(QPointF(10, 10)).value(0, nullptr), (QGraphicsItem *)leftRectItem); + QCOMPARE(scene.items(QPointF(90, 90)).value(0, nullptr), (QGraphicsItem *)rightRectItem); // The ellipse clips the rects now. clipItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape); @@ -5873,7 +5873,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape() int oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls; // First test that both items are searched if no optimization flags are set - QGraphicsItem* item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR); + QGraphicsItem* item = scene.items(QPointF(25, 5)).value(0, nullptr); QCOMPARE(item, childOutsideShape); QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls); @@ -5884,7 +5884,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape() oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls; // Repeat the test to make sure that no caching/indexing is in effect - item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR); + item = scene.items(QPointF(25, 5)).value(0, nullptr); QCOMPARE(item, childOutsideShape); QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls); @@ -5897,7 +5897,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape() // Set the optimization flag and make sure that the child is not returned // and that the child's boundingRect() method is never called. parent->setFlag(QGraphicsItem::ItemContainsChildrenInShape); - item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR); + item = scene.items(QPointF(25, 5)).value(0, nullptr); QVERIFY(!(item)); QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls); diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 7615c5e821..6e4da153d2 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -295,7 +295,7 @@ void tst_QGraphicsScene::construction() static inline const QGraphicsItem *itemAt(const QGraphicsScene &scene, qreal x, qreal y) { - return scene.items(QPointF(x, y)).value(0, Q_NULLPTR); + return scene.items(QPointF(x, y)).value(0, nullptr); } void tst_QGraphicsScene::sceneRect() diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp index a3c6805c7e..85b42e54fe 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp @@ -2059,10 +2059,10 @@ void tst_QGraphicsWidget::task236127_bspTreeIndexFails() QTRY_VERIFY(scene.items(QPointF(25, 25)).isEmpty()); widget->setGeometry(0, 112, 360, 528); - QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, Q_NULLPTR), (QGraphicsItem *)widget); + QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, nullptr), (QGraphicsItem *)widget); widget2->setGeometry(0, 573, 360, 67); - QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, Q_NULLPTR), (QGraphicsItem *)widget); - QTRY_COMPARE(scene.items(QPointF(50, 585)).value(0, Q_NULLPTR), (QGraphicsItem *)widget2); + QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, nullptr), (QGraphicsItem *)widget); + QTRY_COMPARE(scene.items(QPointF(50, 585)).value(0, nullptr), (QGraphicsItem *)widget2); } void tst_QGraphicsWidget::defaultSize() |