tests/auto/widgets: use QCOMPARE(., nullptr)
.. instead of manually casted 0s. QCOMPARE(., nullptr) was added for Qt 5.8. Make use of the new API. In tst_qwidget.cpp, as a drive-by, change qApp->focusWidget() -> QApplication::focusWidget() Change-Id: I1331b8916b026d48e01534d1ed0b3d72f3f3d50c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
97b8fdab7d
commit
2fd3d8ea9e
@ -1026,17 +1026,17 @@ void tst_QFiledialog::viewMode()
|
||||
void tst_QFiledialog::proxymodel()
|
||||
{
|
||||
QFileDialog fd;
|
||||
QCOMPARE(fd.proxyModel(), (QAbstractProxyModel*)0);
|
||||
QCOMPARE(fd.proxyModel(), nullptr);
|
||||
|
||||
fd.setProxyModel(0);
|
||||
QCOMPARE(fd.proxyModel(), (QAbstractProxyModel*)0);
|
||||
QCOMPARE(fd.proxyModel(), nullptr);
|
||||
|
||||
QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(&fd);
|
||||
fd.setProxyModel(proxyModel);
|
||||
QCOMPARE(fd.proxyModel(), (QAbstractProxyModel *)proxyModel);
|
||||
|
||||
fd.setProxyModel(0);
|
||||
QCOMPARE(fd.proxyModel(), (QAbstractProxyModel*)0);
|
||||
QCOMPARE(fd.proxyModel(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QFiledialog::setEmptyNameFilter()
|
||||
|
@ -135,7 +135,7 @@ tst_QFileSystemModel::tst_QFileSystemModel() : model(0)
|
||||
void tst_QFileSystemModel::init()
|
||||
{
|
||||
cleanup();
|
||||
QCOMPARE(model, (QFileSystemModel*)0);
|
||||
QCOMPARE(model, nullptr);
|
||||
model = new QFileSystemModel;
|
||||
}
|
||||
|
||||
|
@ -2400,7 +2400,7 @@ void tst_QWizard::removePage()
|
||||
QCOMPARE(arguments.at(0).toInt(), 3);
|
||||
QVERIFY(wizard.visitedPages().empty());
|
||||
QVERIFY(wizard.pageIds().empty());
|
||||
QCOMPARE(wizard.currentPage(), static_cast<QWizardPage *>(0));
|
||||
QCOMPARE(wizard.currentPage(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QWizard::sideWidget()
|
||||
|
@ -1073,7 +1073,7 @@ void tst_QGraphicsGridLayout::itemAt()
|
||||
} else {
|
||||
const QByteArray message = "QGraphicsGridLayout::itemAt: invalid index " + QByteArray::number(i);
|
||||
QTest::ignoreMessage(QtWarningMsg, message.constData());
|
||||
QCOMPARE(layout->itemAt(i), static_cast<QGraphicsLayoutItem*>(0));
|
||||
QCOMPARE(layout->itemAt(i), nullptr);
|
||||
}
|
||||
}
|
||||
delete widget;
|
||||
@ -1102,7 +1102,7 @@ void tst_QGraphicsGridLayout::removeAt()
|
||||
QGraphicsLayoutItem *item0 = layout->itemAt(0);
|
||||
QCOMPARE(item0->parentLayoutItem(), static_cast<QGraphicsLayoutItem *>(layout));
|
||||
layout->removeAt(0);
|
||||
QCOMPARE(item0->parentLayoutItem(), static_cast<QGraphicsLayoutItem *>(0));
|
||||
QCOMPARE(item0->parentLayoutItem(), nullptr);
|
||||
QCOMPARE(layout->count(), 0);
|
||||
QTest::ignoreMessage(QtWarningMsg, QString::fromLatin1("QGraphicsGridLayout::removeAt: invalid index 0").toLatin1().constData());
|
||||
layout->removeAt(0);
|
||||
|
@ -486,7 +486,7 @@ void tst_QGraphicsItem::construction()
|
||||
((QGraphicsEllipseItem *)item)->setPen(QPen(Qt::black, 0));
|
||||
QCOMPARE(int(item->type()), int(QGraphicsEllipseItem::Type));
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsEllipseItem *>(item), (QGraphicsEllipseItem *)item);
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), (QGraphicsRectItem *)0);
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), nullptr);
|
||||
QCOMPARE(item->flags(), 0);
|
||||
break;
|
||||
case 1:
|
||||
@ -494,7 +494,7 @@ void tst_QGraphicsItem::construction()
|
||||
((QGraphicsLineItem *)item)->setPen(QPen(Qt::black, 0));
|
||||
QCOMPARE(int(item->type()), int(QGraphicsLineItem::Type));
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsLineItem *>(item), (QGraphicsLineItem *)item);
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), (QGraphicsRectItem *)0);
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), nullptr);
|
||||
QCOMPARE(item->flags(), 0);
|
||||
break;
|
||||
case 2:
|
||||
@ -502,14 +502,14 @@ void tst_QGraphicsItem::construction()
|
||||
((QGraphicsPathItem *)item)->setPen(QPen(Qt::black, 0));
|
||||
QCOMPARE(int(item->type()), int(QGraphicsPathItem::Type));
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsPathItem *>(item), (QGraphicsPathItem *)item);
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), (QGraphicsRectItem *)0);
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), nullptr);
|
||||
QCOMPARE(item->flags(), 0);
|
||||
break;
|
||||
case 3:
|
||||
item = new QGraphicsPixmapItem;
|
||||
QCOMPARE(int(item->type()), int(QGraphicsPixmapItem::Type));
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsPixmapItem *>(item), (QGraphicsPixmapItem *)item);
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), (QGraphicsRectItem *)0);
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), nullptr);
|
||||
QCOMPARE(item->flags(), 0);
|
||||
break;
|
||||
case 4:
|
||||
@ -517,7 +517,7 @@ void tst_QGraphicsItem::construction()
|
||||
((QGraphicsPolygonItem *)item)->setPen(QPen(Qt::black, 0));
|
||||
QCOMPARE(int(item->type()), int(QGraphicsPolygonItem::Type));
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsPolygonItem *>(item), (QGraphicsPolygonItem *)item);
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), (QGraphicsRectItem *)0);
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), nullptr);
|
||||
QCOMPARE(item->flags(), 0);
|
||||
break;
|
||||
case 5:
|
||||
@ -525,14 +525,14 @@ void tst_QGraphicsItem::construction()
|
||||
((QGraphicsRectItem *)item)->setPen(QPen(Qt::black, 0));
|
||||
QCOMPARE(int(item->type()), int(QGraphicsRectItem::Type));
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), (QGraphicsRectItem *)item);
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsLineItem *>(item), (QGraphicsLineItem *)0);
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsLineItem *>(item), nullptr);
|
||||
QCOMPARE(item->flags(), 0);
|
||||
break;
|
||||
case 6:
|
||||
item = new QGraphicsTextItem;
|
||||
QCOMPARE(int(item->type()), int(QGraphicsTextItem::Type));
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsTextItem *>(item), (QGraphicsTextItem *)item);
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), (QGraphicsRectItem *)0);
|
||||
QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), nullptr);
|
||||
// This is the only item that uses an extended style option.
|
||||
QCOMPARE(item->flags(), QGraphicsItem::GraphicsItemFlags(QGraphicsItem::ItemUsesExtendedStyleOption));
|
||||
break;
|
||||
@ -541,8 +541,8 @@ void tst_QGraphicsItem::construction()
|
||||
break;
|
||||
}
|
||||
|
||||
QCOMPARE(item->scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(item->parentItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(item->scene(), nullptr);
|
||||
QCOMPARE(item->parentItem(), nullptr);
|
||||
QVERIFY(item->childItems().isEmpty());
|
||||
QVERIFY(item->isVisible());
|
||||
QVERIFY(item->isEnabled());
|
||||
@ -640,7 +640,7 @@ void tst_QGraphicsItem::destruction()
|
||||
QGraphicsScene scene;
|
||||
QGraphicsItem *parent = new QGraphicsRectItem;
|
||||
Item *child = new Item;
|
||||
QCOMPARE(child->parentItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(child->parentItem(), nullptr);
|
||||
child->setParentItem(parent);
|
||||
QCOMPARE(child->parentItem(), parent);
|
||||
scene.addItem(parent);
|
||||
@ -669,7 +669,7 @@ void tst_QGraphicsItem::destruction()
|
||||
scene.addItem(parent);
|
||||
QCOMPARE(child->scene(), &scene);
|
||||
scene.removeItem(parent);
|
||||
QCOMPARE(child->scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(child->scene(), nullptr);
|
||||
delete parent;
|
||||
QCOMPARE(itemDeleted, 5);
|
||||
}
|
||||
@ -678,14 +678,14 @@ void tst_QGraphicsItem::destruction()
|
||||
QGraphicsItem *parent = new QGraphicsRectItem;
|
||||
Item *child = new Item;
|
||||
child->setParentItem(parent);
|
||||
QCOMPARE(child->scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(parent->scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(child->scene(), nullptr);
|
||||
QCOMPARE(parent->scene(), nullptr);
|
||||
scene.addItem(parent);
|
||||
QCOMPARE(child->scene(), &scene);
|
||||
scene.removeItem(child);
|
||||
QCOMPARE(child->scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(child->scene(), nullptr);
|
||||
QCOMPARE(parent->scene(), &scene);
|
||||
QCOMPARE(child->parentItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(child->parentItem(), nullptr);
|
||||
QVERIFY(parent->childItems().isEmpty());
|
||||
delete parent;
|
||||
QCOMPARE(itemDeleted, 5);
|
||||
@ -799,7 +799,7 @@ void tst_QGraphicsItem::deleteChildItem()
|
||||
void tst_QGraphicsItem::scene()
|
||||
{
|
||||
QGraphicsRectItem *item = new QGraphicsRectItem;
|
||||
QCOMPARE(item->scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(item->scene(), nullptr);
|
||||
|
||||
QGraphicsScene scene;
|
||||
scene.addItem(item);
|
||||
@ -810,7 +810,7 @@ void tst_QGraphicsItem::scene()
|
||||
QCOMPARE(item->scene(), (QGraphicsScene *)&scene2);
|
||||
|
||||
scene2.removeItem(item);
|
||||
QCOMPARE(item->scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(item->scene(), nullptr);
|
||||
|
||||
delete item;
|
||||
}
|
||||
@ -818,14 +818,14 @@ void tst_QGraphicsItem::scene()
|
||||
void tst_QGraphicsItem::parentItem()
|
||||
{
|
||||
QGraphicsRectItem item;
|
||||
QCOMPARE(item.parentItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(item.parentItem(), nullptr);
|
||||
|
||||
QGraphicsRectItem *item2 = new QGraphicsRectItem(QRectF(), &item);
|
||||
QCOMPARE(item2->parentItem(), (QGraphicsItem *)&item);
|
||||
item2->setParentItem(&item);
|
||||
QCOMPARE(item2->parentItem(), (QGraphicsItem *)&item);
|
||||
item2->setParentItem(0);
|
||||
QCOMPARE(item2->parentItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(item2->parentItem(), nullptr);
|
||||
|
||||
delete item2;
|
||||
}
|
||||
@ -837,7 +837,7 @@ void tst_QGraphicsItem::setParentItem()
|
||||
QCOMPARE(item->scene(), &scene);
|
||||
|
||||
const QScopedPointer<QGraphicsRectItem> child(new QGraphicsRectItem);
|
||||
QCOMPARE(child->scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(child->scene(), nullptr);
|
||||
|
||||
// This implicitly adds the item to the parent's scene
|
||||
child->setParentItem(item.data());
|
||||
@ -850,7 +850,7 @@ void tst_QGraphicsItem::setParentItem()
|
||||
// Add the child back to the parent, then remove the parent from the scene
|
||||
child->setParentItem(item.data());
|
||||
scene.removeItem(item.data());
|
||||
QCOMPARE(child->scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(child->scene(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QGraphicsItem::children()
|
||||
@ -917,7 +917,7 @@ void tst_QGraphicsItem::flags()
|
||||
event.setButton(Qt::LeftButton);
|
||||
event.setButtons(Qt::LeftButton);
|
||||
QApplication::sendEvent(&scene, &event);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0); // mouse grabber is reset
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr); // mouse grabber is reset
|
||||
|
||||
QGraphicsSceneMouseEvent event2(QEvent::GraphicsSceneMouseMove);
|
||||
event2.setScenePos(QPointF(10, 10));
|
||||
@ -930,7 +930,7 @@ void tst_QGraphicsItem::flags()
|
||||
event3.setScenePos(QPointF(10, 10));
|
||||
event3.setButtons(0);
|
||||
QApplication::sendEvent(&scene, &event3);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
item->setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
QGraphicsSceneMouseEvent event4(QEvent::GraphicsSceneMousePress);
|
||||
@ -1122,9 +1122,9 @@ void tst_QGraphicsItem::visible()
|
||||
QApplication::sendEvent(&scene, &event);
|
||||
QCOMPARE(scene.mouseGrabberItem(), item);
|
||||
item->setVisible(false);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
item->setVisible(true);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
item->setFlag(QGraphicsItem::ItemIsFocusable);
|
||||
item->setFocus();
|
||||
@ -1378,12 +1378,12 @@ void tst_QGraphicsItem::enabled()
|
||||
event.setButton(Qt::LeftButton);
|
||||
event.setScenePos(QPointF(0, 0));
|
||||
QApplication::sendEvent(&scene, &event);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
item->setEnabled(true);
|
||||
QApplication::sendEvent(&scene, &event);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)item);
|
||||
item->setEnabled(false);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QGraphicsItem::explicitlyEnabled()
|
||||
@ -1888,7 +1888,7 @@ void tst_QGraphicsItem::acceptedMouseButtons()
|
||||
QApplication::sendEvent(&scene, &event);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)item2);
|
||||
item2->setAcceptedMouseButtons(0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
QApplication::sendEvent(&scene, &event);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)item1);
|
||||
}
|
||||
@ -2069,8 +2069,8 @@ void tst_QGraphicsItem::hasFocus()
|
||||
scene2.addItem(line);
|
||||
QVERIFY(!line->hasFocus());
|
||||
|
||||
QCOMPARE(scene.focusItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene2.focusItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.focusItem(), nullptr);
|
||||
QCOMPARE(scene2.focusItem(), nullptr);
|
||||
|
||||
line->setFocus();
|
||||
QVERIFY(line->hasFocus());
|
||||
@ -3137,7 +3137,7 @@ void tst_QGraphicsItem::commonAncestorItem()
|
||||
grandPa->setParentItem(ancestor);
|
||||
|
||||
QCOMPARE(grandMa->commonAncestorItem(grandMa), grandMa);
|
||||
QCOMPARE(grandMa->commonAncestorItem(0), (QGraphicsItem *)0);
|
||||
QCOMPARE(grandMa->commonAncestorItem(0), nullptr);
|
||||
QCOMPARE(grandMa->commonAncestorItem(grandPa), ancestor);
|
||||
QCOMPARE(grandPa->commonAncestorItem(grandMa), ancestor);
|
||||
QCOMPARE(grandPa->commonAncestorItem(husband), grandPa);
|
||||
@ -3556,9 +3556,9 @@ void tst_QGraphicsItem::group()
|
||||
parent->setPos(25, 25);
|
||||
child->setPos(25, 25);
|
||||
|
||||
QCOMPARE(parent->group(), (QGraphicsItemGroup *)0);
|
||||
QCOMPARE(parent2->group(), (QGraphicsItemGroup *)0);
|
||||
QCOMPARE(child->group(), (QGraphicsItemGroup *)0);
|
||||
QCOMPARE(parent->group(), nullptr);
|
||||
QCOMPARE(parent2->group(), nullptr);
|
||||
QCOMPARE(child->group(), nullptr);
|
||||
|
||||
QGraphicsView view(&scene);
|
||||
view.show();
|
||||
@ -3620,8 +3620,8 @@ void tst_QGraphicsItem::setGroup()
|
||||
QGraphicsItemGroup group2;
|
||||
|
||||
const QScopedPointer<QGraphicsRectItem> rect(new QGraphicsRectItem);
|
||||
QCOMPARE(rect->group(), (QGraphicsItemGroup *)0);
|
||||
QCOMPARE(rect->parentItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(rect->group(), nullptr);
|
||||
QCOMPARE(rect->parentItem(), nullptr);
|
||||
rect->setGroup(&group1);
|
||||
QCOMPARE(rect->group(), &group1);
|
||||
QCOMPARE(rect->parentItem(), (QGraphicsItem *)&group1);
|
||||
@ -3629,8 +3629,8 @@ void tst_QGraphicsItem::setGroup()
|
||||
QCOMPARE(rect->group(), &group2);
|
||||
QCOMPARE(rect->parentItem(), (QGraphicsItem *)&group2);
|
||||
rect->setGroup(0);
|
||||
QCOMPARE(rect->group(), (QGraphicsItemGroup *)0);
|
||||
QCOMPARE(rect->parentItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(rect->group(), nullptr);
|
||||
QCOMPARE(rect->parentItem(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QGraphicsItem::setGroup2()
|
||||
@ -3679,14 +3679,14 @@ void tst_QGraphicsItem::nestedGroups()
|
||||
QCOMPARE(rect->group(), group1);
|
||||
QCOMPARE(rect2->group(), group1);
|
||||
QCOMPARE(group1->group(), group2);
|
||||
QCOMPARE(group2->group(), (QGraphicsItemGroup *)0);
|
||||
QCOMPARE(group2->group(), nullptr);
|
||||
|
||||
QGraphicsScene scene;
|
||||
scene.addItem(group1);
|
||||
|
||||
QCOMPARE(rect->group(), group1);
|
||||
QCOMPARE(rect2->group(), group1);
|
||||
QCOMPARE(group1->group(), (QGraphicsItemGroup *)0);
|
||||
QCOMPARE(group1->group(), nullptr);
|
||||
QVERIFY(group2->childItems().isEmpty());
|
||||
|
||||
delete group2;
|
||||
@ -4769,8 +4769,8 @@ void tst_QGraphicsItem::itemChange()
|
||||
QCOMPARE(tester.changes.size(), ++changeCount);
|
||||
QCOMPARE(tester.changes.last(), QGraphicsItem::ItemParentChange);
|
||||
QCOMPARE(qvariant_cast<QGraphicsItem *>(tester.values.last()), (QGraphicsItem *)&testerHelper);
|
||||
QCOMPARE(qvariant_cast<QGraphicsItem *>(tester.oldValues.last()), (QGraphicsItem *)0);
|
||||
QCOMPARE(tester.parentItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(qvariant_cast<QGraphicsItem *>(tester.oldValues.last()), nullptr);
|
||||
QCOMPARE(tester.parentItem(), nullptr);
|
||||
}
|
||||
{
|
||||
// ItemOpacityChange
|
||||
@ -4866,7 +4866,7 @@ void tst_QGraphicsItem::itemChange()
|
||||
QCOMPARE(tester.changes.at(tester.changes.size() - 1), QGraphicsItem::ItemSceneHasChanged);
|
||||
// Item's old value was 0
|
||||
// Item's current value is scene
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.oldValues.last()), (QGraphicsScene *)0);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.oldValues.last()), nullptr);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.last()), (QGraphicsScene *)&scene);
|
||||
scene2.addItem(&tester);
|
||||
++changeCount; // ItemSceneChange (0) was: (scene)
|
||||
@ -4884,14 +4884,14 @@ void tst_QGraphicsItem::itemChange()
|
||||
// Item's last current value is 0
|
||||
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.oldValues.at(tester.oldValues.size() - 2)), (QGraphicsScene *)&scene);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.oldValues.at(tester.oldValues.size() - 1)), (QGraphicsScene *)0);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.at(tester.values.size() - 4)), (QGraphicsScene *)0);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.at(tester.values.size() - 3)), (QGraphicsScene *)0);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.oldValues.at(tester.oldValues.size() - 1)), nullptr);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.at(tester.values.size() - 4)), nullptr);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.at(tester.values.size() - 3)), nullptr);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.at(tester.values.size() - 2)), (QGraphicsScene *)&scene2);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.at(tester.values.size() - 1)), (QGraphicsScene *)&scene2);
|
||||
// Item's last old value was 0
|
||||
// Item's last current value is scene2
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.oldValues.last()), (QGraphicsScene *)0);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.oldValues.last()), nullptr);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.last()), (QGraphicsScene *)&scene2);
|
||||
|
||||
scene2.removeItem(&tester);
|
||||
@ -4899,14 +4899,14 @@ void tst_QGraphicsItem::itemChange()
|
||||
++changeCount; // ItemSceneHasChanged (0)
|
||||
QCOMPARE(tester.changes.size(), changeCount);
|
||||
|
||||
QCOMPARE(tester.scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(tester.scene(), nullptr);
|
||||
QCOMPARE(tester.changes.at(tester.changes.size() - 2), QGraphicsItem::ItemSceneChange);
|
||||
QCOMPARE(tester.changes.at(tester.changes.size() - 1), QGraphicsItem::ItemSceneHasChanged);
|
||||
// Item's last old value was scene2
|
||||
// Item's last current value is 0
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.oldValues.last()), (QGraphicsScene *)&scene2);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.at(tester.values.size() - 2)), (QGraphicsScene *)0);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.at(tester.values.size() - 1)), (QGraphicsScene *)0);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.at(tester.values.size() - 2)), nullptr);
|
||||
QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.at(tester.values.size() - 1)), nullptr);
|
||||
|
||||
tester.itemSceneChangeTargetScene = &scene;
|
||||
scene2.addItem(&tester);
|
||||
@ -4925,7 +4925,7 @@ void tst_QGraphicsItem::itemChange()
|
||||
scene.removeItem(&tester);
|
||||
++changeCount; // ItemSceneChange
|
||||
++changeCount; // ItemSceneHasChanged
|
||||
QCOMPARE(tester.scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(tester.scene(), nullptr);
|
||||
}
|
||||
{
|
||||
// ItemToolTipChange/ItemToolTipHasChanged
|
||||
@ -6505,7 +6505,7 @@ void tst_QGraphicsItem::task240400_clickOnTextItem()
|
||||
if (flags || textFlags)
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)item);
|
||||
else
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
{
|
||||
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseRelease);
|
||||
event.setScenePos(item->sceneBoundingRect().topLeft() + QPointF(0.1, 0.1));
|
||||
@ -6532,7 +6532,7 @@ void tst_QGraphicsItem::task240400_clickOnTextItem()
|
||||
if (flags || textFlags)
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)item);
|
||||
else
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
{
|
||||
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseRelease);
|
||||
event.setScenePos(item->sceneBoundingRect().center());
|
||||
@ -8454,17 +8454,17 @@ void tst_QGraphicsItem::focusProxy()
|
||||
QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData());
|
||||
item2->setFocusProxy(item); // fails
|
||||
QCOMPARE(item->focusProxy(), (QGraphicsItem *)item2);
|
||||
QCOMPARE(item2->focusProxy(), (QGraphicsItem *)0);
|
||||
QCOMPARE(item2->focusProxy(), nullptr);
|
||||
|
||||
// Try to assign self as focus proxy
|
||||
QTest::ignoreMessage(QtWarningMsg, "QGraphicsItem::setFocusProxy: cannot assign self as focus proxy");
|
||||
item->setFocusProxy(item); // fails
|
||||
QCOMPARE(item->focusProxy(), (QGraphicsItem *)item2);
|
||||
QCOMPARE(item2->focusProxy(), (QGraphicsItem *)0);
|
||||
QCOMPARE(item2->focusProxy(), nullptr);
|
||||
|
||||
// Reset the focus proxy
|
||||
item->setFocusProxy(0);
|
||||
QCOMPARE(item->focusProxy(), (QGraphicsItem *)0);
|
||||
QCOMPARE(item->focusProxy(), nullptr);
|
||||
QVERIFY(!item->hasFocus());
|
||||
QVERIFY(item2->hasFocus());
|
||||
|
||||
@ -8472,7 +8472,7 @@ void tst_QGraphicsItem::focusProxy()
|
||||
item->setFocusProxy(item2);
|
||||
QCOMPARE(item->focusProxy(), (QGraphicsItem *)item2);
|
||||
delete item2;
|
||||
QCOMPARE(item->focusProxy(), (QGraphicsItem *)0);
|
||||
QCOMPARE(item->focusProxy(), nullptr);
|
||||
|
||||
// Test event delivery
|
||||
item2 = scene.addRect(0, 0, 10, 10);
|
||||
@ -8502,11 +8502,11 @@ void tst_QGraphicsItem::focusProxy()
|
||||
item3->setFocusProxy(item2); // item and item3 use item2 as proxy
|
||||
|
||||
QCOMPARE(item->focusProxy(), item2);
|
||||
QCOMPARE(item2->focusProxy(), (QGraphicsItem *)0);
|
||||
QCOMPARE(item2->focusProxy(), nullptr);
|
||||
QCOMPARE(item3->focusProxy(), item2);
|
||||
delete item2;
|
||||
QCOMPARE(item->focusProxy(), (QGraphicsItem *)0);
|
||||
QCOMPARE(item3->focusProxy(), (QGraphicsItem *)0);
|
||||
QCOMPARE(item->focusProxy(), nullptr);
|
||||
QCOMPARE(item3->focusProxy(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QGraphicsItem::subFocus()
|
||||
@ -8557,8 +8557,8 @@ void tst_QGraphicsItem::subFocus()
|
||||
// readd them. Now the subfocus should kick in and give
|
||||
// text2 focus.
|
||||
scene.removeItem(text);
|
||||
QCOMPARE(text->focusItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(text2->focusItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(text->focusItem(), nullptr);
|
||||
QCOMPARE(text2->focusItem(), nullptr);
|
||||
text2->setFocus();
|
||||
QCOMPARE(text->focusItem(), (QGraphicsItem *)text2);
|
||||
QCOMPARE(text2->focusItem(), (QGraphicsItem *)text2);
|
||||
@ -8596,9 +8596,9 @@ void tst_QGraphicsItem::subFocus()
|
||||
QVERIFY(rect3->hasFocus());
|
||||
|
||||
delete rect2;
|
||||
QCOMPARE(text->focusItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(text2->focusItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(rect->focusItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(text->focusItem(), nullptr);
|
||||
QCOMPARE(text2->focusItem(), nullptr);
|
||||
QCOMPARE(rect->focusItem(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QGraphicsItem::focusProxyDeletion()
|
||||
@ -8609,7 +8609,7 @@ void tst_QGraphicsItem::focusProxyDeletion()
|
||||
QCOMPARE(rect->focusProxy(), (QGraphicsItem *)rect2);
|
||||
|
||||
delete rect2;
|
||||
QCOMPARE(rect->focusProxy(), (QGraphicsItem *)0);
|
||||
QCOMPARE(rect->focusProxy(), nullptr);
|
||||
|
||||
rect2 = new QGraphicsRectItem;
|
||||
rect->setFocusProxy(rect2);
|
||||
@ -8623,12 +8623,12 @@ void tst_QGraphicsItem::focusProxyDeletion()
|
||||
scene->addItem(rect);
|
||||
scene->addItem(rect2);
|
||||
delete rect2;
|
||||
QCOMPARE(rect->focusProxy(), (QGraphicsItem *)0);
|
||||
QCOMPARE(rect->focusProxy(), nullptr);
|
||||
|
||||
rect2 = new QGraphicsRectItem;
|
||||
QTest::ignoreMessage(QtWarningMsg, "QGraphicsItem::setFocusProxy: focus proxy must be in same scene");
|
||||
rect->setFocusProxy(rect2);
|
||||
QCOMPARE(rect->focusProxy(), (QGraphicsItem *)0);
|
||||
QCOMPARE(rect->focusProxy(), nullptr);
|
||||
scene->addItem(rect2);
|
||||
rect->setFocusProxy(rect2);
|
||||
QCOMPARE(rect->focusProxy(), (QGraphicsItem *)rect2);
|
||||
@ -9003,7 +9003,7 @@ void tst_QGraphicsItem::activate()
|
||||
QVERIFY(rect3->isActive());
|
||||
scene.removeItem(rect3);
|
||||
QVERIFY(!rect3->isActive()); // no panel is active anymore
|
||||
QCOMPARE(scene.activePanel(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.activePanel(), nullptr);
|
||||
scene.addItem(rect3);
|
||||
QVERIFY(rect3->isActive()); // second panel item is activated
|
||||
|
||||
@ -9043,7 +9043,7 @@ void tst_QGraphicsItem::activate()
|
||||
QVERIFY(!rect4->isActive());
|
||||
QVERIFY(!rect5->isActive());
|
||||
QVERIFY(!rect6->isActive());
|
||||
QCOMPARE(scene.activePanel(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.activePanel(), nullptr);
|
||||
|
||||
// Controlling auto-activation when the scene changes activation.
|
||||
rect4->setActive(true);
|
||||
@ -9071,7 +9071,7 @@ void tst_QGraphicsItem::setActivePanelOnInactiveScene()
|
||||
EventSpy sceneActivationChangeSpy(&scene, QEvent::ActivationChange);
|
||||
|
||||
scene.setActivePanel(panel);
|
||||
QCOMPARE(scene.activePanel(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.activePanel(), nullptr);
|
||||
QCOMPARE(itemActivateSpy.count(), 0);
|
||||
QCOMPARE(itemDeactivateSpy.count(), 0);
|
||||
QCOMPARE(panelActivateSpy.count(), 0);
|
||||
@ -9350,7 +9350,7 @@ void tst_QGraphicsItem::focusScope()
|
||||
QCOMPARE(scope3->focusItem(), (QGraphicsItem *)scope3);
|
||||
QCOMPARE(scope1->focusScopeItem(), (QGraphicsItem *)scope2);
|
||||
QCOMPARE(scope2->focusScopeItem(), (QGraphicsItem *)scope3);
|
||||
QCOMPARE(scope3->focusScopeItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scope3->focusScopeItem(), nullptr);
|
||||
|
||||
scene.addItem(scope1);
|
||||
|
||||
@ -9363,7 +9363,7 @@ void tst_QGraphicsItem::focusScope()
|
||||
QCOMPARE(scope3->focusItem(), (QGraphicsItem *)scope3);
|
||||
QCOMPARE(scope1->focusScopeItem(), (QGraphicsItem *)scope2);
|
||||
QCOMPARE(scope2->focusScopeItem(), (QGraphicsItem *)scope3);
|
||||
QCOMPARE(scope3->focusScopeItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scope3->focusScopeItem(), nullptr);
|
||||
|
||||
QVERIFY(scope3->hasFocus());
|
||||
|
||||
@ -9445,8 +9445,8 @@ void tst_QGraphicsItem::focusScope()
|
||||
|
||||
rect4->setParentItem(0);
|
||||
QVERIFY(rect5->hasFocus());
|
||||
QCOMPARE(scope3->focusScopeItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scope3->focusItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scope3->focusScopeItem(), nullptr);
|
||||
QCOMPARE(scope3->focusItem(), nullptr);
|
||||
QVERIFY(!scope3->hasFocus());
|
||||
|
||||
QGraphicsRectItem *rectA = new QGraphicsRectItem;
|
||||
@ -9501,7 +9501,7 @@ void tst_QGraphicsItem::focusScope2()
|
||||
siblingChild2->setParentItem(siblingFocusScope);
|
||||
|
||||
QCOMPARE(siblingFocusScope->focusScopeItem(), (QGraphicsItem *)siblingChild1);
|
||||
QCOMPARE(siblingFocusScope->focusItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(siblingFocusScope->focusItem(), nullptr);
|
||||
|
||||
QGraphicsItem *root = new QGraphicsRectItem;
|
||||
rootFocusScope->setParentItem(root);
|
||||
@ -9526,7 +9526,7 @@ void tst_QGraphicsItem::focusScope2()
|
||||
QVERIFY(!siblingChild2->hasFocus());
|
||||
QVERIFY(!siblingChild2->focusItem());
|
||||
QCOMPARE(siblingFocusScope->focusScopeItem(), (QGraphicsItem *)siblingChild2);
|
||||
QCOMPARE(siblingFocusScope->focusItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(siblingFocusScope->focusItem(), nullptr);
|
||||
|
||||
// Set focus on the scope; focus is forwarded to the focus scope item.
|
||||
siblingFocusScope->setFocus();
|
||||
@ -9571,7 +9571,7 @@ void tst_QGraphicsItem::focusScopeItemChangedWhileScopeDoesntHaveFocus()
|
||||
FocusScopeItem *child1 = new FocusScopeItem(&rect);
|
||||
FocusScopeItem *child2 = new FocusScopeItem(&rect);
|
||||
|
||||
QCOMPARE(rect.focusScopeItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(rect.focusScopeItem(), nullptr);
|
||||
QCOMPARE(child1->focusScopeChanged, 0);
|
||||
QCOMPARE(child2->focusScopeChanged, 0);
|
||||
child1->setFocus();
|
||||
@ -9587,7 +9587,7 @@ void tst_QGraphicsItem::focusScopeItemChangedWhileScopeDoesntHaveFocus()
|
||||
QCOMPARE(child1->focusScopeChanged, 3);
|
||||
QCOMPARE(child2->focusScopeChanged, 2);
|
||||
child1->clearFocus();
|
||||
QCOMPARE(rect.focusScopeItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(rect.focusScopeItem(), nullptr);
|
||||
QCOMPARE(child1->focusScopeChanged, 4);
|
||||
QCOMPARE(child2->focusScopeChanged, 2);
|
||||
}
|
||||
@ -10245,7 +10245,7 @@ void tst_QGraphicsItem::modality_mouseGrabber()
|
||||
QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 1);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 0);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
// releasing goes nowhere
|
||||
sendMouseRelease(&scene, QPoint(-25, -25));
|
||||
@ -10255,7 +10255,7 @@ void tst_QGraphicsItem::modality_mouseGrabber()
|
||||
QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 0);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::GraphicsSceneMouseRelease], 0);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
// pressing mouse on rect1 starts implicit grab on rect2 (since it is modal)
|
||||
sendMouseClick(&scene, QPoint(-25, -25));
|
||||
@ -10285,7 +10285,7 @@ void tst_QGraphicsItem::modality_mouseGrabber()
|
||||
QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 2);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 1);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 1);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
// rect1 does *not* re-grab when rect2 is no longer modal
|
||||
rect2->setPanelModality(QGraphicsItem::NonModal);
|
||||
@ -10293,7 +10293,7 @@ void tst_QGraphicsItem::modality_mouseGrabber()
|
||||
QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 2);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 1);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 1);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
// release goes nowhere
|
||||
sendMouseRelease(&scene, QPoint(-25, -25));
|
||||
@ -10302,7 +10302,7 @@ void tst_QGraphicsItem::modality_mouseGrabber()
|
||||
QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 2);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 1);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 1);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
}
|
||||
{
|
||||
// repeat the test using PanelModal
|
||||
@ -10325,7 +10325,7 @@ void tst_QGraphicsItem::modality_mouseGrabber()
|
||||
QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 1);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 0);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
// releasing goes nowhere
|
||||
sendMouseRelease(&scene, QPoint(-25, -25));
|
||||
@ -10335,7 +10335,7 @@ void tst_QGraphicsItem::modality_mouseGrabber()
|
||||
QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 0);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::GraphicsSceneMouseRelease], 0);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
// pressing mouse on rect1 starts implicit grab on rect2 (since it is modal)
|
||||
sendMouseClick(&scene, QPoint(-25, -25));
|
||||
@ -10365,7 +10365,7 @@ void tst_QGraphicsItem::modality_mouseGrabber()
|
||||
QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 2);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 1);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 1);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
// rect1 does *not* re-grab when rect2 is no longer modal
|
||||
rect2->setPanelModality(QGraphicsItem::NonModal);
|
||||
@ -10373,7 +10373,7 @@ void tst_QGraphicsItem::modality_mouseGrabber()
|
||||
QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 2);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 1);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 1);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
// release goes nowhere
|
||||
sendMouseRelease(&scene, QPoint(-25, -25));
|
||||
@ -10382,7 +10382,7 @@ void tst_QGraphicsItem::modality_mouseGrabber()
|
||||
QCOMPARE(rect1Spy.counts[QEvent::UngrabMouse], 2);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::GrabMouse], 1);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 1);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
}
|
||||
|
||||
{
|
||||
@ -10430,7 +10430,7 @@ void tst_QGraphicsItem::modality_mouseGrabber()
|
||||
QCOMPARE(rect3Spy.counts[QEvent::GrabMouse], 1);
|
||||
QCOMPARE(rect3Spy.counts[QEvent::GraphicsSceneMouseRelease], 1);
|
||||
QCOMPARE(rect3Spy.counts[QEvent::UngrabMouse], 1);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
rect2->setPanelModality(QGraphicsItem::NonModal);
|
||||
|
||||
@ -10472,7 +10472,7 @@ void tst_QGraphicsItem::modality_mouseGrabber()
|
||||
QCOMPARE(rect2Spy.counts[QEvent::UngrabMouse], 0);
|
||||
QCOMPARE(rect3Spy.counts[QEvent::GrabMouse], 2);
|
||||
QCOMPARE(rect3Spy.counts[QEvent::UngrabMouse], 2);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *) 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10512,7 +10512,7 @@ void tst_QGraphicsItem::modality_clickFocus()
|
||||
// clicking on rect1 should not set it's focus item
|
||||
rect1->clearFocus();
|
||||
sendMouseClick(&scene, QPointF(-25, -25));
|
||||
QCOMPARE(rect1->focusItem(), (QGraphicsItem *) 0);
|
||||
QCOMPARE(rect1->focusItem(), nullptr);
|
||||
QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 1);
|
||||
QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 1);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::FocusIn], 0);
|
||||
@ -10531,7 +10531,7 @@ void tst_QGraphicsItem::modality_clickFocus()
|
||||
rect1->setActive(true);
|
||||
rect1->clearFocus();
|
||||
sendMouseClick(&scene, QPointF(-25, -25));
|
||||
QCOMPARE(scene.focusItem(), (QGraphicsItem *) 0);
|
||||
QCOMPARE(scene.focusItem(), nullptr);
|
||||
QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 2);
|
||||
QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 2);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::FocusIn], 1);
|
||||
@ -10539,7 +10539,7 @@ void tst_QGraphicsItem::modality_clickFocus()
|
||||
|
||||
// focus doesn't change when leaving modality either
|
||||
rect2->setPanelModality(QGraphicsItem::NonModal);
|
||||
QCOMPARE(scene.focusItem(), (QGraphicsItem *) 0);
|
||||
QCOMPARE(scene.focusItem(), nullptr);
|
||||
QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 2);
|
||||
QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 2);
|
||||
QCOMPARE(rect2Spy.counts[QEvent::FocusIn], 1);
|
||||
@ -10938,7 +10938,7 @@ void tst_QGraphicsItem::focusHandling()
|
||||
|
||||
switch (expectedFocusItem) {
|
||||
case 0:
|
||||
QCOMPARE(scene.focusItem(), static_cast<QGraphicsRectItem *>(0));
|
||||
QCOMPARE(scene.focusItem(), nullptr);
|
||||
break;
|
||||
case 1:
|
||||
QCOMPARE(scene.focusItem(), focusableUnder);
|
||||
@ -11304,7 +11304,7 @@ void tst_QGraphicsItem::QT_2649_focusScope()
|
||||
scope->setFocus();
|
||||
subFocusItem->setParentItem(scope);
|
||||
QCOMPARE(subFocusItem->focusItem(), (QGraphicsItem *)subFocusItem);
|
||||
QCOMPARE(subFocusItem->focusScopeItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(subFocusItem->focusScopeItem(), nullptr);
|
||||
QCOMPARE(scope->focusItem(), (QGraphicsItem *)subFocusItem);
|
||||
QCOMPARE(scope->focusScopeItem(), (QGraphicsItem *)subFocusItem);
|
||||
|
||||
@ -11312,9 +11312,9 @@ void tst_QGraphicsItem::QT_2649_focusScope()
|
||||
rootItem->setFlags(QGraphicsItem::ItemIsFocusable);
|
||||
scope->setParentItem(rootItem);
|
||||
QCOMPARE(rootItem->focusItem(), (QGraphicsItem *)subFocusItem);
|
||||
QCOMPARE(rootItem->focusScopeItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(rootItem->focusScopeItem(), nullptr);
|
||||
QCOMPARE(subFocusItem->focusItem(), (QGraphicsItem *)subFocusItem);
|
||||
QCOMPARE(subFocusItem->focusScopeItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(subFocusItem->focusScopeItem(), nullptr);
|
||||
QCOMPARE(scope->focusItem(), (QGraphicsItem *)subFocusItem);
|
||||
QCOMPARE(scope->focusScopeItem(), (QGraphicsItem *)subFocusItem);
|
||||
|
||||
@ -11327,19 +11327,19 @@ void tst_QGraphicsItem::QT_2649_focusScope()
|
||||
QCOMPARE(rootItem->focusItem(), (QGraphicsItem *)subFocusItem);
|
||||
QCOMPARE(scope->focusItem(), (QGraphicsItem *)subFocusItem);
|
||||
QCOMPARE(subFocusItem->focusItem(), (QGraphicsItem *)subFocusItem);
|
||||
QCOMPARE(rootItem->focusScopeItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(rootItem->focusScopeItem(), nullptr);
|
||||
QCOMPARE(scope->focusScopeItem(), (QGraphicsItem *)subFocusItem);
|
||||
QCOMPARE(subFocusItem->focusScopeItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(subFocusItem->focusScopeItem(), nullptr);
|
||||
QVERIFY(subFocusItem->hasFocus());
|
||||
|
||||
scope->hide();
|
||||
|
||||
QCOMPARE(rootItem->focusItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scope->focusItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(subFocusItem->focusItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(rootItem->focusScopeItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(rootItem->focusItem(), nullptr);
|
||||
QCOMPARE(scope->focusItem(), nullptr);
|
||||
QCOMPARE(subFocusItem->focusItem(), nullptr);
|
||||
QCOMPARE(rootItem->focusScopeItem(), nullptr);
|
||||
QCOMPARE(scope->focusScopeItem(), (QGraphicsItem *)subFocusItem);
|
||||
QCOMPARE(subFocusItem->focusScopeItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(subFocusItem->focusScopeItem(), nullptr);
|
||||
QVERIFY(!subFocusItem->hasFocus());
|
||||
|
||||
scope->show();
|
||||
@ -11347,9 +11347,9 @@ void tst_QGraphicsItem::QT_2649_focusScope()
|
||||
QCOMPARE(rootItem->focusItem(), (QGraphicsItem *)subFocusItem);
|
||||
QCOMPARE(scope->focusItem(), (QGraphicsItem *)subFocusItem);
|
||||
QCOMPARE(subFocusItem->focusItem(), (QGraphicsItem *)subFocusItem);
|
||||
QCOMPARE(rootItem->focusScopeItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(rootItem->focusScopeItem(), nullptr);
|
||||
QCOMPARE(scope->focusScopeItem(), (QGraphicsItem *)subFocusItem);
|
||||
QCOMPARE(subFocusItem->focusScopeItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(subFocusItem->focusScopeItem(), nullptr);
|
||||
QVERIFY(subFocusItem->hasFocus());
|
||||
|
||||
// This should not crash
|
||||
|
@ -151,7 +151,7 @@ void tst_QGraphicsItemAnimation::overwriteValueForStep()
|
||||
void tst_QGraphicsItemAnimation::setTimeLine()
|
||||
{
|
||||
QGraphicsItemAnimation animation;
|
||||
QCOMPARE(animation.timeLine(), (QTimeLine *)0);
|
||||
QCOMPARE(animation.timeLine(), nullptr);
|
||||
|
||||
QPointer<QTimeLine> line1 = new QTimeLine;
|
||||
animation.setTimeLine(line1);
|
||||
@ -161,7 +161,7 @@ void tst_QGraphicsItemAnimation::setTimeLine()
|
||||
QCOMPARE(animation.timeLine(), (QTimeLine *)line1);
|
||||
|
||||
animation.setTimeLine(0);
|
||||
QCOMPARE(animation.timeLine(), (QTimeLine *)0);
|
||||
QCOMPARE(animation.timeLine(), nullptr);
|
||||
QVERIFY(!line1);
|
||||
|
||||
QTimeLine *line2 = new QTimeLine;
|
||||
@ -169,7 +169,7 @@ void tst_QGraphicsItemAnimation::setTimeLine()
|
||||
QCOMPARE(animation.timeLine(), (QTimeLine *)line2);
|
||||
|
||||
delete line2;
|
||||
QCOMPARE(animation.timeLine(), (QTimeLine *)0);
|
||||
QCOMPARE(animation.timeLine(), nullptr);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QGraphicsItemAnimation)
|
||||
|
@ -186,10 +186,10 @@ void tst_QGraphicsLayout::automaticReparenting()
|
||||
l1->addItem(w1);
|
||||
QGraphicsWidget *w2 = new QGraphicsWidget();
|
||||
l1->addItem(w2);
|
||||
QCOMPARE(w1->parentItem(), static_cast<QGraphicsItem*>(0));
|
||||
QCOMPARE(w2->parentItem(), static_cast<QGraphicsItem*>(0));
|
||||
QCOMPARE(w1->parentItem(), nullptr);
|
||||
QCOMPARE(w2->parentItem(), nullptr);
|
||||
scene.addItem(w1);
|
||||
QCOMPARE(w1->parentItem(), static_cast<QGraphicsItem*>(0));
|
||||
QCOMPARE(w1->parentItem(), nullptr);
|
||||
window->setLayout(l1);
|
||||
QCOMPARE(w1->parentItem(), static_cast<QGraphicsItem*>(window));
|
||||
QCOMPARE(w2->parentItem(), static_cast<QGraphicsItem*>(window));
|
||||
|
@ -94,7 +94,7 @@ void tst_QGraphicsLayoutItem::qgraphicslayoutitem()
|
||||
QCOMPARE(layoutItem.isLayout(), false);
|
||||
layoutItem.maximumSize();
|
||||
layoutItem.minimumSize();
|
||||
QCOMPARE(layoutItem.parentLayoutItem(), (QGraphicsLayoutItem*)0);
|
||||
QCOMPARE(layoutItem.parentLayoutItem(), nullptr);
|
||||
layoutItem.preferredSize();
|
||||
layoutItem.sizePolicy();
|
||||
layoutItem.sizeHint(Qt::MinimumSize);
|
||||
|
@ -800,7 +800,7 @@ void tst_QGraphicsLinearLayout::removeAt()
|
||||
QCOMPARE(wParent, static_cast<QGraphicsLayoutItem *>(&layout));
|
||||
layout.removeAt(removeItemAt);
|
||||
wParent = w->parentLayoutItem();
|
||||
QCOMPARE(wParent, static_cast<QGraphicsLayoutItem *>(0));
|
||||
QCOMPARE(wParent, nullptr);
|
||||
delete w;
|
||||
}
|
||||
QCOMPARE(layout.count(), itemCount + layoutCount - (w ? 1 : 0));
|
||||
|
@ -482,7 +482,7 @@ void tst_QGraphicsProxyWidget::setWidget()
|
||||
QCOMPARE((qreal)bottom, rbottom);
|
||||
} else {
|
||||
// proxy shouldn't mess with the widget if it can't insert it.
|
||||
QCOMPARE(proxy->widget(), (QWidget*)0);
|
||||
QCOMPARE(proxy->widget(), nullptr);
|
||||
QCOMPARE(proxy->acceptHoverEvents(), false);
|
||||
if (subWidget) {
|
||||
QVERIFY(!subWidget->testAttribute(Qt::WA_DontShowOnScreen));
|
||||
@ -493,7 +493,7 @@ void tst_QGraphicsProxyWidget::setWidget()
|
||||
}
|
||||
|
||||
if (widgetExists) {
|
||||
QCOMPARE(existingSubWidget->parent(), static_cast<QObject*>(0));
|
||||
QCOMPARE(existingSubWidget->parent(), nullptr);
|
||||
QVERIFY(!existingSubWidget->testAttribute(Qt::WA_DontShowOnScreen));
|
||||
QVERIFY(!existingSubWidget->testAttribute(Qt::WA_QuitOnClose));
|
||||
}
|
||||
|
@ -1539,22 +1539,22 @@ void tst_QGraphicsScene::mouseGrabberItem()
|
||||
QApplication::sendEvent(&scene, &moveEvent);
|
||||
QCOMPARE(scene.mouseGrabberItem(), item);
|
||||
item->setVisible(false);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
QApplication::sendEvent(&scene, &pressEvent);
|
||||
QCOMPARE(scene.mouseGrabberItem(), item2);
|
||||
item2->setVisible(false);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
QApplication::sendEvent(&scene, &moveEvent);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
item2->setVisible(true);
|
||||
QApplication::sendEvent(&scene, &moveEvent);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
QApplication::sendEvent(&scene, &pressEvent);
|
||||
QApplication::sendEvent(&scene, &moveEvent);
|
||||
QCOMPARE(scene.mouseGrabberItem(), item2);
|
||||
scene.removeItem(item2);
|
||||
delete item2;
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QGraphicsScene::hoverEvents_siblings()
|
||||
@ -1757,7 +1757,7 @@ void tst_QGraphicsScene::createItemGroup()
|
||||
|
||||
// These share no common parent
|
||||
group = scene.createItemGroup(children3);
|
||||
QCOMPARE(group->parentItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(group->parentItem(), nullptr);
|
||||
scene.destroyItemGroup(group);
|
||||
|
||||
// Make children3 children of parent3
|
||||
@ -1886,7 +1886,7 @@ void tst_QGraphicsScene::mouseEventPropagation()
|
||||
QCOMPARE(c->eventTypes.size(), 0);
|
||||
QCOMPARE(b->eventTypes.size(), 0);
|
||||
QCOMPARE(a->eventTypes.size(), 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
d->setAcceptedMouseButtons(Qt::RightButton);
|
||||
|
||||
@ -1927,7 +1927,7 @@ void tst_QGraphicsScene::mouseEventPropagation()
|
||||
QCOMPARE(c->eventTypes.at(5), QEvent::UngrabMouse);
|
||||
QCOMPARE(b->eventTypes.size(), 0);
|
||||
QCOMPARE(a->eventTypes.size(), 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
// Disabled items eat events. c should not get this.
|
||||
d->setEnabled(false);
|
||||
@ -1939,7 +1939,7 @@ void tst_QGraphicsScene::mouseEventPropagation()
|
||||
QCOMPARE(c->eventTypes.size(), 6);
|
||||
QCOMPARE(b->eventTypes.size(), 0);
|
||||
QCOMPARE(a->eventTypes.size(), 0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
// Send a left press. This goes to c.
|
||||
pressEvent.setButton(Qt::LeftButton);
|
||||
@ -4609,7 +4609,7 @@ void tst_QGraphicsScene::focusItemChangedSignal()
|
||||
QList<QVariant> arguments = spy.takeFirst();
|
||||
QCOMPARE(arguments.size(), 3);
|
||||
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
|
||||
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0);
|
||||
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), nullptr);
|
||||
QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason);
|
||||
QVERIFY(topLevelItem2->hasFocus());
|
||||
|
||||
@ -4617,7 +4617,7 @@ void tst_QGraphicsScene::focusItemChangedSignal()
|
||||
QCOMPARE(spy.count(), 1);
|
||||
arguments = spy.takeFirst();
|
||||
QCOMPARE(arguments.size(), 3);
|
||||
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)0);
|
||||
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), nullptr);
|
||||
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
|
||||
QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason);
|
||||
|
||||
@ -4626,7 +4626,7 @@ void tst_QGraphicsScene::focusItemChangedSignal()
|
||||
arguments = spy.takeFirst();
|
||||
QCOMPARE(arguments.size(), 3);
|
||||
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
|
||||
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0);
|
||||
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), nullptr);
|
||||
QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::MenuBarFocusReason);
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
|
@ -489,7 +489,7 @@ void tst_QGraphicsView::scene()
|
||||
QCOMPARE(view.scene(), &scene);
|
||||
}
|
||||
|
||||
QCOMPARE(view.scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(view.scene(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QGraphicsView::setScene()
|
||||
@ -529,9 +529,9 @@ void tst_QGraphicsView::deleteScene()
|
||||
QGraphicsView view3(scene);
|
||||
view3.show();
|
||||
delete scene;
|
||||
QCOMPARE(view1.scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(view2.scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(view3.scene(), (QGraphicsScene *)0);
|
||||
QCOMPARE(view1.scene(), nullptr);
|
||||
QCOMPARE(view2.scene(), nullptr);
|
||||
QCOMPARE(view3.scene(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QGraphicsView::sceneRect()
|
||||
|
@ -287,14 +287,14 @@ void tst_QGraphicsWidget::qgraphicswidget()
|
||||
|
||||
QVERIFY(!widget.isWindow());
|
||||
QCOMPARE(widget.boundingRect(), QRectF(0, 0, 0, 0));
|
||||
QCOMPARE(widget.focusWidget(), (QGraphicsWidget*)0);
|
||||
QCOMPARE(widget.focusWidget(), nullptr);
|
||||
QCOMPARE(widget.focusPolicy(), Qt::NoFocus);
|
||||
QCOMPARE(widget.font(), QFont());
|
||||
QCOMPARE(widget.geometry(), QRectF(widget.pos(), widget.size()));
|
||||
QCOMPARE(widget.layout(), (QGraphicsLayout*)0);
|
||||
QCOMPARE(widget.layout(), nullptr);
|
||||
QCOMPARE(widget.layoutDirection(), Qt::LeftToRight);
|
||||
QCOMPARE(widget.palette(), QPalette());
|
||||
QCOMPARE(widget.parentWidget(), (QGraphicsWidget*)0);
|
||||
QCOMPARE(widget.parentWidget(), nullptr);
|
||||
QCOMPARE(widget.rect(), QRectF(QPointF(), widget.size()));
|
||||
QCOMPARE(widget.size(), QSizeF(0, 0));
|
||||
QVERIFY(widget.style() != (QStyle*)0);
|
||||
@ -415,7 +415,7 @@ void tst_QGraphicsWidget::focusWidget_data()
|
||||
void tst_QGraphicsWidget::focusWidget()
|
||||
{
|
||||
SubQGraphicsWidget *parent = new SubQGraphicsWidget;
|
||||
QCOMPARE(parent->focusWidget(), (QGraphicsWidget *)0);
|
||||
QCOMPARE(parent->focusWidget(), nullptr);
|
||||
QGraphicsScene scene;
|
||||
QEvent windowActivate(QEvent::WindowActivate);
|
||||
qApp->sendEvent(&scene, &windowActivate);
|
||||
@ -1131,7 +1131,7 @@ void tst_QGraphicsWidget::layout()
|
||||
{
|
||||
SubQGraphicsWidget widget;
|
||||
widget.setContentsMargins(10, 5, 50, 100);
|
||||
QCOMPARE(widget.layout(), (QGraphicsLayout *)0);
|
||||
QCOMPARE(widget.layout(), nullptr);
|
||||
QFETCH(int, childCount);
|
||||
|
||||
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout;
|
||||
@ -1292,9 +1292,9 @@ void tst_QGraphicsWidget::parentWidget()
|
||||
SubQGraphicsWidget widgetChild(&standAlongWidget);
|
||||
SubQGraphicsWidget itemChild(&standAlongItem);
|
||||
|
||||
QCOMPARE(standAlongWidget.parentWidget(), (QGraphicsWidget*)0);
|
||||
QCOMPARE(standAlongWidget.parentWidget(), nullptr);
|
||||
QCOMPARE(widgetChild.parentWidget(), static_cast<QGraphicsWidget*>(&standAlongWidget));
|
||||
QCOMPARE(itemChild.parentWidget(), (QGraphicsWidget*)0);
|
||||
QCOMPARE(itemChild.parentWidget(), nullptr);
|
||||
|
||||
for (int i = 0; i < childrenCount; ++i) {
|
||||
SubQGraphicsWidget *item = new SubQGraphicsWidget(&standAlongWidget);
|
||||
@ -1497,7 +1497,7 @@ void tst_QGraphicsWidget::setTabOrderAndReparent()
|
||||
w[2]->setFocus();
|
||||
QVERIFY2(compareFocusChain(&view, w + 2, w + 3, &errorMessage), errorMessage.constData());
|
||||
w[2]->setParentItem(p);
|
||||
QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem*>(0));
|
||||
QCOMPARE(scene.focusItem(), nullptr);
|
||||
|
||||
scene.addItem(p);
|
||||
p->setFocus();
|
||||
@ -2117,7 +2117,7 @@ void tst_QGraphicsWidget::explicitMouseGrabber()
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)widget);
|
||||
QCOMPARE(widgetGrabEventSpy.count(), 1);
|
||||
widget->ungrabMouse();
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
QCOMPARE(widgetUngrabEventSpy.count(), 1);
|
||||
|
||||
// Grab while grabbing
|
||||
@ -2165,7 +2165,7 @@ void tst_QGraphicsWidget::explicitMouseGrabber()
|
||||
QCOMPARE(widgetGrabEventSpy.count(), 4);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)widget);
|
||||
widget->ungrabMouse();
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
// Out of order ungrab
|
||||
widget->grabMouse();
|
||||
@ -2210,7 +2210,7 @@ void tst_QGraphicsWidget::implicitMouseGrabber()
|
||||
event.setScenePos(QPointF(50, 50));
|
||||
qApp->sendEvent(&scene, &event);
|
||||
}
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
QCOMPARE(widgetGrabEventSpy.count(), 1);
|
||||
QCOMPARE(widgetUngrabEventSpy.count(), 1);
|
||||
|
||||
@ -2238,7 +2238,7 @@ void tst_QGraphicsWidget::implicitMouseGrabber()
|
||||
QCOMPARE(widgetUngrabEventSpy.count(), 1);
|
||||
widget->ungrabMouse();
|
||||
QCOMPARE(widgetUngrabEventSpy.count(), 2);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
// Implicit mouse grabber tries to explicitly grab the mouse
|
||||
{
|
||||
@ -2263,7 +2263,7 @@ void tst_QGraphicsWidget::implicitMouseGrabber()
|
||||
QCOMPARE(widgetGrabEventSpy.count(), 3);
|
||||
QCOMPARE(widgetUngrabEventSpy.count(), 2);
|
||||
widget->ungrabMouse();
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
QCOMPARE(widgetGrabEventSpy.count(), 3);
|
||||
QCOMPARE(widgetUngrabEventSpy.count(), 3);
|
||||
|
||||
@ -2293,7 +2293,7 @@ void tst_QGraphicsWidget::implicitMouseGrabber()
|
||||
|
||||
scene.removeItem(widget);
|
||||
QCOMPARE(widgetUngrabEventSpy.count(), 4);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
}
|
||||
|
||||
class GrabOnPressItem : public QGraphicsRectItem
|
||||
@ -2367,7 +2367,7 @@ void tst_QGraphicsWidget::doubleClickAfterExplicitMouseGrab()
|
||||
event.setScenePos(QPointF(50, 50));
|
||||
qApp->sendEvent(&scene, &event);
|
||||
}
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
QCOMPARE(item->nrelease, 1);
|
||||
QCOMPARE(item->nungrab, 1);
|
||||
{
|
||||
@ -2389,7 +2389,7 @@ void tst_QGraphicsWidget::doubleClickAfterExplicitMouseGrab()
|
||||
event.setScenePos(QPointF(50, 50));
|
||||
qApp->sendEvent(&scene, &event);
|
||||
}
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
QCOMPARE(item->nrelease, 2);
|
||||
QCOMPARE(item->nungrab, 2);
|
||||
}
|
||||
@ -2411,7 +2411,7 @@ void tst_QGraphicsWidget::popupMouseGrabber()
|
||||
// Hiding it loses the grab again.
|
||||
widget->hide();
|
||||
QCOMPARE(widgetUngrabEventSpy.count(), 1);
|
||||
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)0);
|
||||
QCOMPARE(scene.mouseGrabberItem(), nullptr);
|
||||
|
||||
// Showing it grabs the mouse again
|
||||
widget->show();
|
||||
|
@ -558,7 +558,7 @@ void tst_QAbstractItemView::noModel()
|
||||
view.setModel(0);
|
||||
// Due to the model is removed, this will generate a valueChanged signal on both scrollbars. (value to 0)
|
||||
QApplication::processEvents();
|
||||
QCOMPARE(view.model(), (QAbstractItemModel*)0);
|
||||
QCOMPARE(view.model(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QAbstractItemView::dragSelect()
|
||||
|
@ -770,15 +770,15 @@ void tst_QColumnView::gripMoved()
|
||||
void tst_QColumnView::preview()
|
||||
{
|
||||
QColumnView view;
|
||||
QCOMPARE(view.previewWidget(), (QWidget*)0);
|
||||
QCOMPARE(view.previewWidget(), nullptr);
|
||||
TreeModel model;
|
||||
view.setModel(&model);
|
||||
QCOMPARE(view.previewWidget(), (QWidget*)0);
|
||||
QCOMPARE(view.previewWidget(), nullptr);
|
||||
QModelIndex home = model.index(0, 0);
|
||||
QVERIFY(home.isValid());
|
||||
QVERIFY(model.hasChildren(home));
|
||||
view.setCurrentIndex(home);
|
||||
QCOMPARE(view.previewWidget(), (QWidget*)0);
|
||||
QCOMPARE(view.previewWidget(), nullptr);
|
||||
|
||||
QModelIndex file;
|
||||
QVERIFY(model.rowCount(home) > 0);
|
||||
|
@ -79,7 +79,7 @@ void tst_QDataWidgetMapper::setModel()
|
||||
{
|
||||
QDataWidgetMapper mapper;
|
||||
|
||||
QCOMPARE(mapper.model(), (QAbstractItemModel *)0);
|
||||
QCOMPARE(mapper.model(), nullptr);
|
||||
|
||||
{ // let the model go out of scope firstma
|
||||
QStandardItemModel model;
|
||||
@ -87,7 +87,7 @@ void tst_QDataWidgetMapper::setModel()
|
||||
QCOMPARE(mapper.model(), static_cast<QAbstractItemModel *>(&model));
|
||||
}
|
||||
|
||||
QCOMPARE(mapper.model(), (QAbstractItemModel *)0);
|
||||
QCOMPARE(mapper.model(), nullptr);
|
||||
|
||||
{ // let the mapper go out of scope first
|
||||
QStandardItemModel model2;
|
||||
@ -263,7 +263,7 @@ void tst_QDataWidgetMapper::addMapping()
|
||||
QCOMPARE(edit2.text(), QString("item 0 2"));
|
||||
} // let the edit go out of scope
|
||||
|
||||
QCOMPARE(mapper.mappedWidgetAt(2), (QWidget *)0);
|
||||
QCOMPARE(mapper.mappedWidgetAt(2), nullptr);
|
||||
mapper.toLast();
|
||||
}
|
||||
|
||||
@ -400,7 +400,7 @@ void tst_QDataWidgetMapper::mappedWidgetAt()
|
||||
QLineEdit lineEdit1;
|
||||
QLineEdit lineEdit2;
|
||||
|
||||
QCOMPARE(mapper.mappedWidgetAt(432312), (QWidget*)0);
|
||||
QCOMPARE(mapper.mappedWidgetAt(432312), nullptr);
|
||||
|
||||
mapper.addMapping(&lineEdit1, 1);
|
||||
mapper.addMapping(&lineEdit2, 2);
|
||||
@ -410,7 +410,7 @@ void tst_QDataWidgetMapper::mappedWidgetAt()
|
||||
|
||||
mapper.addMapping(&lineEdit2, 4242);
|
||||
|
||||
QCOMPARE(mapper.mappedWidgetAt(2), (QWidget*)0);
|
||||
QCOMPARE(mapper.mappedWidgetAt(2), nullptr);
|
||||
QCOMPARE(mapper.mappedWidgetAt(4242), static_cast<QWidget *>(&lineEdit2));
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ void tst_QListWidget::init()
|
||||
|
||||
void tst_QListWidget::checkDefaultValues()
|
||||
{
|
||||
QCOMPARE(testWidget->currentItem(), (QListWidgetItem *)0);
|
||||
QCOMPARE(testWidget->currentItem(), nullptr);
|
||||
QCOMPARE(testWidget->currentRow(), -1);
|
||||
QCOMPARE(testWidget->count(), 0);
|
||||
}
|
||||
@ -413,7 +413,7 @@ void tst_QListWidget::currentItem()
|
||||
if (currentIndex.isValid())
|
||||
QCOMPARE(testWidget->currentItem(), testWidget->item(currentIndex.row()));
|
||||
else
|
||||
QCOMPARE(testWidget->currentItem(), (QListWidgetItem*)0);
|
||||
QCOMPARE(testWidget->currentItem(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QListWidget::currentRow()
|
||||
@ -631,7 +631,7 @@ void tst_QListWidget::item()
|
||||
|
||||
QListWidgetItem *item = testWidget->item(row);
|
||||
if (outOfBounds) {
|
||||
QCOMPARE(item, static_cast<QListWidgetItem*>(0));
|
||||
QCOMPARE(item, nullptr);
|
||||
QCOMPARE(testWidget->count(), 3);
|
||||
} else {
|
||||
QCOMPARE(item->text(), QStringLiteral("item") + QString::number(row));
|
||||
@ -664,7 +664,7 @@ void tst_QListWidget::takeItem()
|
||||
|
||||
QListWidgetItem *item = testWidget->takeItem(row);
|
||||
if (outOfBounds) {
|
||||
QCOMPARE(item, static_cast<QListWidgetItem*>(0));
|
||||
QCOMPARE(item, nullptr);
|
||||
QCOMPARE(testWidget->count(), 3);
|
||||
} else {
|
||||
QCOMPARE(item->text(), QStringLiteral("item") + QString::number(row));
|
||||
@ -1445,11 +1445,11 @@ void tst_QListWidget::itemWidget()
|
||||
QListWidgetItem *item = new QListWidgetItem(&list);
|
||||
|
||||
|
||||
QCOMPARE(list.itemWidget(item), static_cast<QWidget*>(0));
|
||||
QCOMPARE(list.itemWidget(item), nullptr);
|
||||
list.setItemWidget(item, &widget);
|
||||
QCOMPARE(list.itemWidget(item), &widget);
|
||||
list.removeItemWidget(item);
|
||||
QCOMPARE(list.itemWidget(item), static_cast<QWidget*>(0));
|
||||
QCOMPARE(list.itemWidget(item), nullptr);
|
||||
}
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
|
@ -809,13 +809,13 @@ void tst_QTableWidget::itemOwnership()
|
||||
headerItem = new QObjectTableItem();
|
||||
testWidget->setVerticalHeaderItem(0, headerItem);
|
||||
delete headerItem;
|
||||
QCOMPARE(testWidget->verticalHeaderItem(0), (QTableWidgetItem *)0);
|
||||
QCOMPARE(testWidget->verticalHeaderItem(0), nullptr);
|
||||
|
||||
//delete horizontal headeritem from outside
|
||||
headerItem = new QObjectTableItem();
|
||||
testWidget->setHorizontalHeaderItem(0, headerItem);
|
||||
delete headerItem;
|
||||
QCOMPARE(testWidget->horizontalHeaderItem(0), (QTableWidgetItem *)0);
|
||||
QCOMPARE(testWidget->horizontalHeaderItem(0), nullptr);
|
||||
|
||||
//setItem
|
||||
item = new QObjectTableItem();
|
||||
|
@ -1107,10 +1107,10 @@ void tst_QTreeView::setModel()
|
||||
{
|
||||
QTreeView view;
|
||||
view.show();
|
||||
QCOMPARE(view.model(), (QAbstractItemModel*)0);
|
||||
QCOMPARE(view.selectionModel(), (QItemSelectionModel*)0);
|
||||
QCOMPARE(view.header()->model(), (QAbstractItemModel*)0);
|
||||
QCOMPARE(view.header()->selectionModel(), (QItemSelectionModel*)0);
|
||||
QCOMPARE(view.model(), nullptr);
|
||||
QCOMPARE(view.selectionModel(), nullptr);
|
||||
QCOMPARE(view.header()->model(), nullptr);
|
||||
QCOMPARE(view.header()->selectionModel(), nullptr);
|
||||
|
||||
for (int x = 0; x < 2; ++x) {
|
||||
QtTestModel *model = new QtTestModel(10, 8);
|
||||
@ -1131,9 +1131,9 @@ void tst_QTreeView::setModel()
|
||||
QTRY_COMPARE(modelDestroyedSpy.count(), 0);
|
||||
|
||||
view.setModel(0);
|
||||
QCOMPARE(view.model(), (QAbstractItemModel*)0);
|
||||
QCOMPARE(view.model(), nullptr);
|
||||
// ### shouldn't selectionModel also be 0 now?
|
||||
// QCOMPARE(view.selectionModel(), (QItemSelectionModel*)0);
|
||||
// QCOMPARE(view.selectionModel(), nullptr);
|
||||
delete model;
|
||||
}
|
||||
}
|
||||
@ -1283,7 +1283,7 @@ void tst_QTreeView::noDelegate()
|
||||
QTreeView view;
|
||||
view.setModel(&model);
|
||||
view.setItemDelegate(0);
|
||||
QCOMPARE(view.itemDelegate(), (QAbstractItemDelegate *)0);
|
||||
QCOMPARE(view.itemDelegate(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QTreeView::noModel()
|
||||
|
@ -194,7 +194,7 @@ void tst_QTreeWidget::getSetCheck()
|
||||
QCOMPARE(obj1.headerItem(), var2);
|
||||
|
||||
obj1.setHeaderItem((QTreeWidgetItem *)0);
|
||||
// QCOMPARE(obj1.headerItem(), (QTreeWidgetItem *)0);
|
||||
// QCOMPARE(obj1.headerItem(), nullptr);
|
||||
|
||||
// QTreeWidgetItem * QTreeWidget::currentItem()
|
||||
// void QTreeWidget::setCurrentItem(QTreeWidgetItem *)
|
||||
@ -203,7 +203,7 @@ void tst_QTreeWidget::getSetCheck()
|
||||
QCOMPARE(obj1.currentItem(), var3);
|
||||
|
||||
obj1.setCurrentItem((QTreeWidgetItem *)0);
|
||||
QCOMPARE(obj1.currentItem(), (QTreeWidgetItem *)0);
|
||||
QCOMPARE(obj1.currentItem(), nullptr);
|
||||
}
|
||||
|
||||
typedef QList<int> IntList;
|
||||
@ -285,9 +285,9 @@ void tst_QTreeWidget::addTopLevelItem()
|
||||
tree.addTopLevelItem(ti);
|
||||
QCOMPARE(tree.topLevelItemCount(), i+1);
|
||||
QCOMPARE(tree.topLevelItem(i), ti);
|
||||
QCOMPARE(tree.topLevelItem(-1), static_cast<TreeItem*>(0));
|
||||
QCOMPARE(tree.topLevelItem(-1), nullptr);
|
||||
QCOMPARE(tree.indexOfTopLevelItem(ti), i);
|
||||
QCOMPARE(ti->parent(), static_cast<TreeItem*>(0));
|
||||
QCOMPARE(ti->parent(), nullptr);
|
||||
tree.addTopLevelItem(ti);
|
||||
QCOMPARE(tree.topLevelItemCount(), i+1);
|
||||
tops.append(ti);
|
||||
@ -419,7 +419,7 @@ void tst_QTreeWidget::currentItem()
|
||||
|
||||
// can't set the headerItem to be the current item
|
||||
tree.setCurrentItem(tree.headerItem());
|
||||
QCOMPARE(tree.currentItem(), static_cast<TreeItem*>(0));
|
||||
QCOMPARE(tree.currentItem(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QTreeWidget::editItem_data()
|
||||
@ -520,7 +520,7 @@ void tst_QTreeWidget::takeItem()
|
||||
int count = testWidget->topLevelItemCount();
|
||||
QTreeWidgetItem *item = testWidget->takeTopLevelItem(index);
|
||||
if (outOfBounds) {
|
||||
QCOMPARE(item, (QTreeWidgetItem *)0);
|
||||
QCOMPARE(item, nullptr);
|
||||
QCOMPARE(count, testWidget->topLevelItemCount());
|
||||
} else {
|
||||
QCOMPARE(item->text(0), QStringLiteral("top") + QString::number(index));
|
||||
@ -531,7 +531,7 @@ void tst_QTreeWidget::takeItem()
|
||||
int count = testWidget->topLevelItem(0)->childCount();
|
||||
QTreeWidgetItem *item = testWidget->topLevelItem(0)->takeChild(index);
|
||||
if (outOfBounds) {
|
||||
QCOMPARE(item, (QTreeWidgetItem *)0);
|
||||
QCOMPARE(item, nullptr);
|
||||
QCOMPARE(count, testWidget->topLevelItem(0)->childCount());
|
||||
} else {
|
||||
QCOMPARE(item->text(0), QStringLiteral("child") + QString::number(index));
|
||||
@ -1664,8 +1664,8 @@ void tst_QTreeWidget::addChild()
|
||||
QCOMPARE(taken, children);
|
||||
QCOMPARE(item->childCount(), 0);
|
||||
for (int i = 0; i < taken.count(); ++i) {
|
||||
QCOMPARE(taken.at(i)->parent(), static_cast<QTreeWidgetItem*>(0));
|
||||
QCOMPARE(taken.at(i)->treeWidget(), static_cast<QTreeWidget*>(0));
|
||||
QCOMPARE(taken.at(i)->parent(), nullptr);
|
||||
QCOMPARE(taken.at(i)->treeWidget(), nullptr);
|
||||
item->addChild(taken.at(i)); // re-add
|
||||
}
|
||||
|
||||
|
@ -1160,7 +1160,7 @@ void tst_QTreeWidgetItemIterator::updateIteratorAfterDeletedItem_and_ContinueIte
|
||||
delete item;
|
||||
it+=iterator_advance_after_removal;
|
||||
if (iterator_new_value.isNull()) {
|
||||
QCOMPARE((*it), (QTreeWidgetItem*)0);
|
||||
QCOMPARE((*it), nullptr);
|
||||
} else {
|
||||
QCOMPARE((*it)->text(0), iterator_new_value);
|
||||
}
|
||||
@ -1202,7 +1202,7 @@ void tst_QTreeWidgetItemIterator::initializeIterator()
|
||||
QTreeWidget tw;
|
||||
QTreeWidgetItemIterator it(&tw);
|
||||
|
||||
QCOMPARE((*it), static_cast<QTreeWidgetItem*>(0));
|
||||
QCOMPARE((*it), nullptr);
|
||||
}
|
||||
|
||||
void tst_QTreeWidgetItemIterator::sortingEnabled()
|
||||
|
@ -297,7 +297,7 @@ void tst_QLayout::warnIfWrongParent()
|
||||
QHBoxLayout lay;
|
||||
lay.setParent(&root);
|
||||
QTest::ignoreMessage(QtWarningMsg, "QLayout::parentWidget: A layout can only have another layout as a parent.");
|
||||
QCOMPARE(lay.parentWidget(), static_cast<QWidget*>(0));
|
||||
QCOMPARE(lay.parentWidget(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QLayout::controlTypes()
|
||||
|
@ -122,7 +122,7 @@ void tst_QStackedLayout::testCase()
|
||||
|
||||
// Nothing in layout
|
||||
QCOMPARE(testLayout->currentIndex(), -1);
|
||||
QCOMPARE(testLayout->currentWidget(), static_cast<QWidget*>(0));
|
||||
QCOMPARE(testLayout->currentWidget(), nullptr);
|
||||
QCOMPARE(testLayout->count(), 0);
|
||||
|
||||
// One widget added to layout
|
||||
@ -163,7 +163,7 @@ void tst_QStackedLayout::testCase()
|
||||
QCOMPARE(spy.at(0).at(0).toInt(), -1);
|
||||
spy.clear();
|
||||
QCOMPARE(testLayout->currentIndex(), -1);
|
||||
QCOMPARE(testLayout->currentWidget(), static_cast<QWidget*>(0));
|
||||
QCOMPARE(testLayout->currentWidget(), nullptr);
|
||||
QCOMPARE(testLayout->count(), 0);
|
||||
|
||||
// Another widget inserted at current index.
|
||||
@ -217,7 +217,7 @@ void tst_QStackedLayout::testCase()
|
||||
QVERIFY(w3->isVisible());
|
||||
testLayout->removeWidget(w3);
|
||||
QCOMPARE(testLayout->currentIndex(), -1);
|
||||
QCOMPARE(testLayout->currentWidget(), static_cast<QWidget*>(0));
|
||||
QCOMPARE(testLayout->currentWidget(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QStackedLayout::deleteCurrent()
|
||||
|
@ -2188,8 +2188,8 @@ void tst_QWidget::showMinimizedKeepsFocus()
|
||||
QTRY_COMPARE(qApp->focusWidget(), child);
|
||||
|
||||
delete child;
|
||||
QCOMPARE(window.focusWidget(), static_cast<QWidget*>(0));
|
||||
QCOMPARE(qApp->focusWidget(), static_cast<QWidget*>(0));
|
||||
QCOMPARE(window.focusWidget(), nullptr);
|
||||
QCOMPARE(QApplication::focusWidget(), nullptr);
|
||||
}
|
||||
|
||||
//testing reparenting the focus widget
|
||||
@ -2207,8 +2207,8 @@ void tst_QWidget::showMinimizedKeepsFocus()
|
||||
|
||||
child->setParent(0);
|
||||
QScopedPointer<QWidget> childGuard(child);
|
||||
QCOMPARE(window.focusWidget(), static_cast<QWidget*>(0));
|
||||
QCOMPARE(qApp->focusWidget(), static_cast<QWidget*>(0));
|
||||
QCOMPARE(window.focusWidget(), nullptr);
|
||||
QCOMPARE(QApplication::focusWidget(), nullptr);
|
||||
}
|
||||
|
||||
//testing setEnabled(false)
|
||||
@ -2225,8 +2225,8 @@ void tst_QWidget::showMinimizedKeepsFocus()
|
||||
QTRY_COMPARE(qApp->focusWidget(), child);
|
||||
|
||||
child->setEnabled(false);
|
||||
QCOMPARE(window.focusWidget(), static_cast<QWidget*>(0));
|
||||
QCOMPARE(qApp->focusWidget(), static_cast<QWidget*>(0));
|
||||
QCOMPARE(window.focusWidget(), nullptr);
|
||||
QCOMPARE(QApplication::focusWidget(), nullptr);
|
||||
}
|
||||
|
||||
//testing clearFocus
|
||||
@ -2245,14 +2245,14 @@ void tst_QWidget::showMinimizedKeepsFocus()
|
||||
QTRY_COMPARE(qApp->focusWidget(), child);
|
||||
|
||||
child->clearFocus();
|
||||
QCOMPARE(window.focusWidget(), static_cast<QWidget*>(0));
|
||||
QCOMPARE(qApp->focusWidget(), static_cast<QWidget*>(0));
|
||||
QCOMPARE(window.focusWidget(), nullptr);
|
||||
QCOMPARE(QApplication::focusWidget(), nullptr);
|
||||
|
||||
window.showMinimized();
|
||||
QTest::qWait(30);
|
||||
QTRY_VERIFY(window.isMinimized());
|
||||
QCOMPARE(window.focusWidget(), static_cast<QWidget*>(0));
|
||||
QTRY_COMPARE(qApp->focusWidget(), static_cast<QWidget*>(0));
|
||||
QCOMPARE(window.focusWidget(), nullptr);
|
||||
QTRY_COMPARE(QApplication::focusWidget(), nullptr);
|
||||
|
||||
window.showNormal();
|
||||
qApp->setActiveWindow(&window);
|
||||
@ -5260,12 +5260,12 @@ void tst_QWidget::setFocus()
|
||||
child1.setFocus();
|
||||
QVERIFY(!child1.hasFocus());
|
||||
QCOMPARE(window.focusWidget(), &child1);
|
||||
QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(QApplication::focusWidget(), nullptr);
|
||||
|
||||
child2.setFocus();
|
||||
QVERIFY(!child2.hasFocus());
|
||||
QCOMPARE(window.focusWidget(), &child2);
|
||||
QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(QApplication::focusWidget(), nullptr);
|
||||
}
|
||||
|
||||
{
|
||||
@ -5294,12 +5294,12 @@ void tst_QWidget::setFocus()
|
||||
child1.setFocus();
|
||||
QVERIFY(!child1.hasFocus());
|
||||
QCOMPARE(window.focusWidget(), &child1);
|
||||
QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(QApplication::focusWidget(), nullptr);
|
||||
|
||||
child2.setFocus();
|
||||
QVERIFY(!child2.hasFocus());
|
||||
QCOMPARE(window.focusWidget(), &child2);
|
||||
QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(QApplication::focusWidget(), nullptr);
|
||||
}
|
||||
|
||||
{
|
||||
@ -5355,8 +5355,8 @@ void tst_QWidget::setFocus()
|
||||
|
||||
child1.setFocus();
|
||||
QVERIFY(!child1.hasFocus());
|
||||
QCOMPARE(window.focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(window.focusWidget(), nullptr);
|
||||
QCOMPARE(QApplication::focusWidget(), nullptr);
|
||||
|
||||
child1.show();
|
||||
QApplication::processEvents();
|
||||
@ -5396,33 +5396,33 @@ void tst_QWidget::setFocus()
|
||||
|
||||
child1.setFocus();
|
||||
QVERIFY(!child1.hasFocus());
|
||||
QCOMPARE(window.focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(window.focusWidget(), nullptr);
|
||||
QCOMPARE(QApplication::focusWidget(), nullptr);
|
||||
|
||||
child1.hide();
|
||||
QVERIFY(!child1.hasFocus());
|
||||
QCOMPARE(window.focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(window.focusWidget(), nullptr);
|
||||
QCOMPARE(QApplication::focusWidget(), nullptr);
|
||||
|
||||
child1.show();
|
||||
QVERIFY(!child1.hasFocus());
|
||||
QCOMPARE(window.focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(window.focusWidget(), nullptr);
|
||||
QCOMPARE(QApplication::focusWidget(), nullptr);
|
||||
|
||||
child2.setFocus();
|
||||
QVERIFY(!child2.hasFocus());
|
||||
QCOMPARE(window.focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(window.focusWidget(), nullptr);
|
||||
QCOMPARE(QApplication::focusWidget(), nullptr);
|
||||
|
||||
child2.hide();
|
||||
QVERIFY(!child2.hasFocus());
|
||||
QCOMPARE(window.focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(window.focusWidget(), nullptr);
|
||||
QCOMPARE(QApplication::focusWidget(), nullptr);
|
||||
|
||||
child2.show();
|
||||
QVERIFY(!child2.hasFocus());
|
||||
QCOMPARE(window.focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(0));
|
||||
QCOMPARE(window.focusWidget(), nullptr);
|
||||
QCOMPARE(QApplication::focusWidget(), nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ void tst_QWindowContainer::testOwnership()
|
||||
|
||||
delete container;
|
||||
|
||||
QCOMPARE(window.data(), (QWindow *) 0);
|
||||
QCOMPARE(window.data(), nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,7 +121,7 @@ void tst_QStyleOption::qstyleoptioncast()
|
||||
|
||||
// Cast a null pointer
|
||||
castOption = qstyleoption_cast<QStyleOption*>((QStyleOption*)0);
|
||||
QCOMPARE(castOption,(QStyleOption*)0);
|
||||
QCOMPARE(castOption, nullptr);
|
||||
|
||||
// Deallocate
|
||||
delete testOption;
|
||||
|
@ -215,7 +215,7 @@ void tst_QUndoGroup::setActive()
|
||||
QUndoGroup group;
|
||||
QUndoStack stack1(&group), stack2(&group);
|
||||
|
||||
QCOMPARE(group.activeStack(), (QUndoStack*)0);
|
||||
QCOMPARE(group.activeStack(), nullptr);
|
||||
QCOMPARE(stack1.isActive(), false);
|
||||
QCOMPARE(stack2.isActive(), false);
|
||||
|
||||
@ -238,13 +238,13 @@ void tst_QUndoGroup::setActive()
|
||||
QCOMPARE(stack3.isActive(), false);
|
||||
|
||||
group.removeStack(&stack2);
|
||||
QCOMPARE(group.activeStack(), (QUndoStack*)0);
|
||||
QCOMPARE(group.activeStack(), nullptr);
|
||||
QCOMPARE(stack1.isActive(), false);
|
||||
QCOMPARE(stack2.isActive(), true);
|
||||
QCOMPARE(stack3.isActive(), false);
|
||||
|
||||
group.removeStack(&stack2);
|
||||
QCOMPARE(group.activeStack(), (QUndoStack*)0);
|
||||
QCOMPARE(group.activeStack(), nullptr);
|
||||
QCOMPARE(stack1.isActive(), false);
|
||||
QCOMPARE(stack2.isActive(), true);
|
||||
QCOMPARE(stack3.isActive(), false);
|
||||
@ -280,7 +280,7 @@ void tst_QUndoGroup::deleteStack()
|
||||
|
||||
QUndoStack *stack1 = new QUndoStack(&group);
|
||||
QCOMPARE(group.stacks(), QList<QUndoStack*>() << stack1);
|
||||
QCOMPARE(group.activeStack(), (QUndoStack*)0);
|
||||
QCOMPARE(group.activeStack(), nullptr);
|
||||
|
||||
stack1->setActive();
|
||||
QCOMPARE(group.activeStack(), stack1);
|
||||
@ -299,17 +299,17 @@ void tst_QUndoGroup::deleteStack()
|
||||
|
||||
delete stack1;
|
||||
QCOMPARE(group.stacks(), QList<QUndoStack*>() << stack3);
|
||||
QCOMPARE(group.activeStack(), (QUndoStack*)0);
|
||||
QCOMPARE(group.activeStack(), nullptr);
|
||||
|
||||
stack3->setActive(false);
|
||||
QCOMPARE(group.activeStack(), (QUndoStack*)0);
|
||||
QCOMPARE(group.activeStack(), nullptr);
|
||||
|
||||
stack3->setActive(true);
|
||||
QCOMPARE(group.activeStack(), stack3);
|
||||
|
||||
group.removeStack(stack3);
|
||||
QCOMPARE(group.stacks(), QList<QUndoStack*>());
|
||||
QCOMPARE(group.activeStack(), (QUndoStack*)0);
|
||||
QCOMPARE(group.activeStack(), nullptr);
|
||||
|
||||
delete stack3;
|
||||
}
|
||||
|
@ -305,17 +305,17 @@ void tst_QComboBox::getSetCheck()
|
||||
obj1.setValidator(var9);
|
||||
QCOMPARE(obj1.validator(), (const QValidator *)var9);
|
||||
obj1.setValidator((QValidator *)0);
|
||||
QCOMPARE(obj1.validator(), (const QValidator *)0);
|
||||
QCOMPARE(obj1.validator(), nullptr);
|
||||
delete var9;
|
||||
|
||||
// QAbstractItemDelegate * QComboBox::itemDelegate()
|
||||
// void QComboBox::setItemDelegate(QAbstractItemDelegate *)
|
||||
MyAbstractItemDelegate *var10 = new MyAbstractItemDelegate;
|
||||
obj1.setItemDelegate(var10);
|
||||
QCOMPARE(obj1.itemDelegate(), (QAbstractItemDelegate *)var10);
|
||||
QCOMPARE(obj1.itemDelegate(), nullptr);
|
||||
QTest::ignoreMessage(QtWarningMsg, "QComboBox::setItemDelegate: cannot set a 0 delegate");
|
||||
obj1.setItemDelegate((QAbstractItemDelegate *)0);
|
||||
QCOMPARE(obj1.itemDelegate(), (QAbstractItemDelegate *)var10);
|
||||
QCOMPARE(obj1.itemDelegate(), nullptr);
|
||||
// delete var10; // No delete, since QComboBox takes ownership
|
||||
|
||||
// QAbstractItemModel * QComboBox::model()
|
||||
|
@ -857,8 +857,8 @@ void tst_QDockWidget::task165177_deleteFocusWidget()
|
||||
qApp->processEvents();
|
||||
dw->setFloating(true);
|
||||
delete ledit;
|
||||
QCOMPARE(mw.focusWidget(), (QWidget *)0);
|
||||
QCOMPARE(dw->focusWidget(), (QWidget *)0);
|
||||
QCOMPARE(mw.focusWidget(), nullptr);
|
||||
QCOMPARE(dw->focusWidget(), nullptr);
|
||||
}
|
||||
|
||||
void tst_QDockWidget::task169808_setFloating()
|
||||
|
@ -388,7 +388,7 @@ void tst_QMenu::keyboardNavigation()
|
||||
#ifndef Q_OS_MAC
|
||||
QEXPECT_FAIL("shortcut0", "QTBUG-22449: QMenu doesn't remove highlight if a menu item is activated by a shortcut", Abort);
|
||||
#endif
|
||||
QCOMPARE(menus[expected_menu]->activeAction(), (QAction *)0);
|
||||
QCOMPARE(menus[expected_menu]->activeAction(), nullptr);
|
||||
} else {
|
||||
QCOMPARE(menus[expected_menu]->activeAction(), builtins[expected_action]);
|
||||
}
|
||||
@ -396,7 +396,7 @@ void tst_QMenu::keyboardNavigation()
|
||||
if (expected_highlighted)
|
||||
QCOMPARE(menus[expected_menu]->activeAction(), highlighted);
|
||||
else
|
||||
QCOMPARE(highlighted, (QAction *)0);
|
||||
QCOMPARE(highlighted, nullptr);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
Loading…
Reference in New Issue
Block a user