tst_qgraphicseffectsource: Don't use the deprecated QGraphicsItem::children()
Change-Id: I0cc0c5284a675fb1c7f960e9790baa89c56112b1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
parent
bca0ee7115
commit
f57a3c0ba3
@ -260,7 +260,7 @@ void tst_QGraphicsEffectSource::boundingRect()
|
||||
QCOMPARE(effect->source()->boundingRect(Qt::DeviceCoordinates), QRectF());
|
||||
|
||||
QRectF itemBoundingRect = item->boundingRect();
|
||||
if (!item->children().isEmpty())
|
||||
if (!item->childItems().isEmpty())
|
||||
itemBoundingRect |= item->childrenBoundingRect();
|
||||
|
||||
// We can at least check that the device bounding rect was correct in QGraphicsEffect::draw.
|
||||
|
@ -549,7 +549,7 @@ void tst_QGraphicsItem::construction()
|
||||
|
||||
QCOMPARE(item->scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(item->parentItem(), (QGraphicsItem *)0);
|
||||
QVERIFY(item->children().isEmpty());
|
||||
QVERIFY(item->childItems().isEmpty());
|
||||
QVERIFY(item->isVisible());
|
||||
QVERIFY(item->isEnabled());
|
||||
QVERIFY(!item->isSelected());
|
||||
@ -589,7 +589,7 @@ public:
|
||||
QRectF boundingRect() const
|
||||
{
|
||||
QRectF tmp = QGraphicsRectItem::boundingRect();
|
||||
foreach (QGraphicsItem *child, children())
|
||||
foreach (QGraphicsItem *child, childItems())
|
||||
tmp |= child->boundingRect(); // <- might be pure virtual
|
||||
return tmp;
|
||||
}
|
||||
@ -605,11 +605,11 @@ void tst_QGraphicsItem::constructionWithParent()
|
||||
scene.addItem(item0);
|
||||
scene.addItem(item1);
|
||||
QGraphicsItem *item2 = new BoundingRectItem(item1);
|
||||
QCOMPARE(item1->children(), QList<QGraphicsItem *>() << item2);
|
||||
QCOMPARE(item1->childItems(), QList<QGraphicsItem *>() << item2);
|
||||
QCOMPARE(item1->boundingRect(), QRectF(0, 0, 200, 200));
|
||||
|
||||
item2->setParentItem(item0);
|
||||
QCOMPARE(item0->children(), QList<QGraphicsItem *>() << item2);
|
||||
QCOMPARE(item0->childItems(), QList<QGraphicsItem *>() << item2);
|
||||
QCOMPARE(item0->boundingRect(), QRectF(0, 0, 200, 200));
|
||||
}
|
||||
|
||||
@ -636,9 +636,9 @@ void tst_QGraphicsItem::destruction()
|
||||
QGraphicsItem *parent = new QGraphicsRectItem;
|
||||
Item *child = new Item;
|
||||
child->setParentItem(parent);
|
||||
QCOMPARE(parent->children().size(), 1);
|
||||
QCOMPARE(parent->childItems().size(), 1);
|
||||
delete child;
|
||||
QCOMPARE(parent->children().size(), 0);
|
||||
QCOMPARE(parent->childItems().size(), 0);
|
||||
delete parent;
|
||||
QCOMPARE(itemDeleted, 2);
|
||||
}
|
||||
@ -661,9 +661,9 @@ void tst_QGraphicsItem::destruction()
|
||||
child->setParentItem(parent);
|
||||
scene.addItem(parent);
|
||||
QCOMPARE(child->scene(), &scene);
|
||||
QCOMPARE(parent->children().size(), 1);
|
||||
QCOMPARE(parent->childItems().size(), 1);
|
||||
delete child;
|
||||
QCOMPARE(parent->children().size(), 0);
|
||||
QCOMPARE(parent->childItems().size(), 0);
|
||||
delete parent;
|
||||
QCOMPARE(itemDeleted, 4);
|
||||
}
|
||||
@ -692,7 +692,7 @@ void tst_QGraphicsItem::destruction()
|
||||
QCOMPARE(child->scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(parent->scene(), &scene);
|
||||
QCOMPARE(child->parentItem(), (QGraphicsItem *)0);
|
||||
QVERIFY(parent->children().isEmpty());
|
||||
QVERIFY(parent->childItems().isEmpty());
|
||||
delete parent;
|
||||
QCOMPARE(itemDeleted, 5);
|
||||
delete child;
|
||||
@ -862,15 +862,15 @@ void tst_QGraphicsItem::setParentItem()
|
||||
void tst_QGraphicsItem::children()
|
||||
{
|
||||
QGraphicsRectItem item;
|
||||
QVERIFY(item.children().isEmpty());
|
||||
QVERIFY(item.childItems().isEmpty());
|
||||
|
||||
QGraphicsRectItem *item2 = new QGraphicsRectItem(QRectF(), &item);
|
||||
QCOMPARE(item.children().size(), 1);
|
||||
QCOMPARE(item.children().first(), (QGraphicsItem *)item2);
|
||||
QVERIFY(item2->children().isEmpty());
|
||||
QCOMPARE(item.childItems().size(), 1);
|
||||
QCOMPARE(item.childItems().first(), (QGraphicsItem *)item2);
|
||||
QVERIFY(item2->childItems().isEmpty());
|
||||
|
||||
delete item2;
|
||||
QVERIFY(item.children().isEmpty());
|
||||
QVERIFY(item.childItems().isEmpty());
|
||||
}
|
||||
|
||||
void tst_QGraphicsItem::flags()
|
||||
@ -3573,7 +3573,7 @@ void tst_QGraphicsItem::group()
|
||||
QCOMPARE(parent->sceneBoundingRect(), parentSceneBoundingRect);
|
||||
|
||||
QCOMPARE(parent->parentItem(), (QGraphicsItem *)group);
|
||||
QCOMPARE(group->children().size(), 1);
|
||||
QCOMPARE(group->childItems().size(), 1);
|
||||
QCOMPARE(scene.items().size(), 4);
|
||||
QCOMPARE(scene.items(group->sceneBoundingRect()).size(), 3);
|
||||
|
||||
@ -3585,7 +3585,7 @@ void tst_QGraphicsItem::group()
|
||||
QCOMPARE(parent2->sceneBoundingRect(), parent2SceneBoundingRect);
|
||||
|
||||
QCOMPARE(parent2->parentItem(), (QGraphicsItem *)group);
|
||||
QCOMPARE(group->children().size(), 2);
|
||||
QCOMPARE(group->childItems().size(), 2);
|
||||
QCOMPARE(scene.items().size(), 4);
|
||||
QCOMPARE(scene.items(group->sceneBoundingRect()).size(), 4);
|
||||
|
||||
@ -3686,7 +3686,7 @@ void tst_QGraphicsItem::nestedGroups()
|
||||
QCOMPARE(rect->group(), group1);
|
||||
QCOMPARE(rect2->group(), group1);
|
||||
QCOMPARE(group1->group(), (QGraphicsItemGroup *)0);
|
||||
QVERIFY(group2->children().isEmpty());
|
||||
QVERIFY(group2->childItems().isEmpty());
|
||||
|
||||
delete group2;
|
||||
}
|
||||
@ -3737,7 +3737,7 @@ void tst_QGraphicsItem::removeFromGroup()
|
||||
|
||||
QGraphicsItemGroup *group = scene.createItemGroup(scene.selectedItems());
|
||||
QVERIFY(group);
|
||||
QCOMPARE(group->children().size(), 2);
|
||||
QCOMPARE(group->childItems().size(), 2);
|
||||
qApp->processEvents(); // index items
|
||||
qApp->processEvents(); // emit changed
|
||||
|
||||
@ -4505,10 +4505,10 @@ protected:
|
||||
case QGraphicsItem::ItemParentHasChanged:
|
||||
break;
|
||||
case QGraphicsItem::ItemChildAddedChange:
|
||||
oldValues << children().size();
|
||||
oldValues << childItems().size();
|
||||
break;
|
||||
case QGraphicsItem::ItemChildRemovedChange:
|
||||
oldValues << children().size();
|
||||
oldValues << childItems().size();
|
||||
break;
|
||||
case QGraphicsItem::ItemSceneChange:
|
||||
oldValues << QVariant::fromValue<QGraphicsScene *>(scene());
|
||||
|
Loading…
Reference in New Issue
Block a user