summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorDebao Zhang <dbzhang800@gmail.com>2012-04-29 00:11:28 -0700
committerQt by Nokia <qt-info@nokia.com>2012-05-02 08:30:59 +0200
commitade888860334d207f5f070b0bc9c4c98deaf3862 (patch)
tree133a3bde54e8ef5fa8857814a45cc5000ee5b287 /tests/auto/widgets
parent6102ab8d646d76a68bb460885394501e90b4fd1f (diff)
Don't use obsolete qVariantValue, qVariantCanConvert, etc.
qVariantValue and qVariantCanConvert are Compatibility members, while in Qt4.8 they are marked as Qt 3 Support Members. qVariantFromValue and qVariantSetValue are Obsolete members. Change-Id: Ie8505cad1e0950e40c6f6710fde9f6fb2ac670fd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp24
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp80
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp8
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp50
-rw-r--r--tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp10
6 files changed, 87 insertions, 87 deletions
diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
index 14c2be5bd8..e8fc5ad603 100644
--- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
@@ -1061,11 +1061,11 @@ void tst_QFiledialog::historyBack()
QCOMPARE(backButton->isEnabled(), true);
QCOMPARE(forwardButton->isEnabled(), true);
QCOMPARE(spy.count(), 3);
- QString currentPath = qVariantValue<QString>(spy.last().first());
+ QString currentPath = qvariant_cast<QString>(spy.last().first());
QCOMPARE(model->index(currentPath), model->index(temp));
backButton->click();
- currentPath = qVariantValue<QString>(spy.last().first());
+ currentPath = qvariant_cast<QString>(spy.last().first());
QCOMPARE(currentPath, home);
QCOMPARE(backButton->isEnabled(), false);
QCOMPARE(forwardButton->isEnabled(), true);
@@ -1101,39 +1101,39 @@ void tst_QFiledialog::historyForward()
backButton->click();
QCOMPARE(forwardButton->isEnabled(), true);
- QCOMPARE(model->index(qVariantValue<QString>(spy.last().first())), model->index(temp));
+ QCOMPARE(model->index(qvariant_cast<QString>(spy.last().first())), model->index(temp));
forwardButton->click();
- QCOMPARE(model->index(qVariantValue<QString>(spy.last().first())), model->index(desktop));
+ QCOMPARE(model->index(qvariant_cast<QString>(spy.last().first())), model->index(desktop));
QCOMPARE(backButton->isEnabled(), true);
QCOMPARE(forwardButton->isEnabled(), false);
QCOMPARE(spy.count(), 4);
backButton->click();
- QCOMPARE(model->index(qVariantValue<QString>(spy.last().first())), model->index(temp));
+ QCOMPARE(model->index(qvariant_cast<QString>(spy.last().first())), model->index(temp));
QCOMPARE(backButton->isEnabled(), true);
backButton->click();
- QCOMPARE(model->index(qVariantValue<QString>(spy.last().first())), model->index(home));
+ QCOMPARE(model->index(qvariant_cast<QString>(spy.last().first())), model->index(home));
QCOMPARE(backButton->isEnabled(), false);
QCOMPARE(forwardButton->isEnabled(), true);
QCOMPARE(spy.count(), 6);
forwardButton->click();
- QCOMPARE(model->index(qVariantValue<QString>(spy.last().first())), model->index(temp));
+ QCOMPARE(model->index(qvariant_cast<QString>(spy.last().first())), model->index(temp));
backButton->click();
- QCOMPARE(model->index(qVariantValue<QString>(spy.last().first())), model->index(home));
+ QCOMPARE(model->index(qvariant_cast<QString>(spy.last().first())), model->index(home));
QCOMPARE(spy.count(), 8);
forwardButton->click();
- QCOMPARE(model->index(qVariantValue<QString>(spy.last().first())), model->index(temp));
+ QCOMPARE(model->index(qvariant_cast<QString>(spy.last().first())), model->index(temp));
forwardButton->click();
- QCOMPARE(model->index(qVariantValue<QString>(spy.last().first())), model->index(desktop));
+ QCOMPARE(model->index(qvariant_cast<QString>(spy.last().first())), model->index(desktop));
backButton->click();
- QCOMPARE(model->index(qVariantValue<QString>(spy.last().first())), model->index(temp));
+ QCOMPARE(model->index(qvariant_cast<QString>(spy.last().first())), model->index(temp));
backButton->click();
- QCOMPARE(model->index(qVariantValue<QString>(spy.last().first())), model->index(home));
+ QCOMPARE(model->index(qvariant_cast<QString>(spy.last().first())), model->index(home));
fd.setDirectory(desktop);
QCOMPARE(forwardButton->isEnabled(), false);
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 639a1f61a9..a6f846045f 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -2219,7 +2219,7 @@ void tst_QGraphicsItem::setMatrix()
QApplication::instance()->processEvents();
QCOMPARE(spy.count(), 3);
- QList<QRectF> rlist = qVariantValue<QList<QRectF> >(spy.last().at(0));
+ QList<QRectF> rlist = qvariant_cast<QList<QRectF> >(spy.last().at(0));
QCOMPARE(rlist.size(), 3);
QCOMPARE(rlist.at(0), rotatedRect); // From item.setMatrix() (clearing rotated rect)
@@ -4450,13 +4450,13 @@ protected:
break;
case QGraphicsItem::ItemMatrixChange: {
QVariant variant;
- qVariantSetValue<QMatrix>(variant, matrix());
+ variant.setValue<QMatrix>(matrix());
oldValues << variant;
}
break;
case QGraphicsItem::ItemTransformChange: {
QVariant variant;
- qVariantSetValue<QTransform>(variant, transform());
+ variant.setValue<QTransform>(transform());
oldValues << variant;
}
break;
@@ -4478,7 +4478,7 @@ protected:
case QGraphicsItem::ItemSelectedHasChanged:
break;
case QGraphicsItem::ItemParentChange:
- oldValues << qVariantFromValue<void *>(parentItem());
+ oldValues << QVariant::fromValue<void *>(parentItem());
break;
case QGraphicsItem::ItemParentHasChanged:
break;
@@ -4489,11 +4489,11 @@ protected:
oldValues << children().size();
break;
case QGraphicsItem::ItemSceneChange:
- oldValues << qVariantFromValue<QGraphicsScene *>(scene());
+ oldValues << QVariant::fromValue<QGraphicsScene *>(scene());
if (itemSceneChangeTargetScene
- && qVariantValue<QGraphicsScene *>(value)
- && itemSceneChangeTargetScene != qVariantValue<QGraphicsScene *>(value)) {
- return qVariantFromValue<QGraphicsScene *>(itemSceneChangeTargetScene);
+ && qvariant_cast<QGraphicsScene *>(value)
+ && itemSceneChangeTargetScene != qvariant_cast<QGraphicsScene *>(value)) {
+ return QVariant::fromValue<QGraphicsScene *>(itemSceneChangeTargetScene);
}
return value;
case QGraphicsItem::ItemSceneHasChanged:
@@ -4573,17 +4573,17 @@ void tst_QGraphicsItem::itemChange()
}
{
// ItemMatrixChange / ItemTransformHasChanged
- qVariantSetValue<QMatrix>(tester.itemChangeReturnValue, QMatrix().rotate(90));
+ tester.itemChangeReturnValue.setValue<QMatrix>(QMatrix().rotate(90));
tester.setMatrix(QMatrix().translate(50, 0), true);
++changeCount; // notification sent too
QCOMPARE(tester.changes.size(), ++changeCount);
QCOMPARE(int(tester.changes.at(tester.changes.size() - 2)), int(QGraphicsItem::ItemMatrixChange));
QCOMPARE(int(tester.changes.last()), int(QGraphicsItem::ItemTransformHasChanged));
- QCOMPARE(qVariantValue<QMatrix>(tester.values.at(tester.values.size() - 2)),
+ QCOMPARE(qvariant_cast<QMatrix>(tester.values.at(tester.values.size() - 2)),
QMatrix().translate(50, 0));
QCOMPARE(tester.values.last(), QVariant(QTransform(QMatrix().rotate(90))));
QVariant variant;
- qVariantSetValue<QMatrix>(variant, QMatrix());
+ variant.setValue<QMatrix>(QMatrix());
QCOMPARE(tester.oldValues.last(), variant);
QCOMPARE(tester.matrix(), QMatrix().rotate(90));
}
@@ -4593,19 +4593,19 @@ void tst_QGraphicsItem::itemChange()
++changeCount; // notification sent too
// ItemTransformChange / ItemTransformHasChanged
- qVariantSetValue<QTransform>(tester.itemChangeReturnValue, QTransform().rotate(90));
+ tester.itemChangeReturnValue.setValue<QTransform>(QTransform().rotate(90));
tester.translate(50, 0);
++changeCount; // notification sent too
++changeCount;
QCOMPARE(tester.changes.size(), changeCount);
QCOMPARE(tester.changes.at(tester.changes.size() - 2), QGraphicsItem::ItemTransformChange);
QCOMPARE(tester.changes.at(tester.changes.size() - 1), QGraphicsItem::ItemTransformHasChanged);
- QCOMPARE(qVariantValue<QTransform>(tester.values.at(tester.values.size() - 2)),
+ QCOMPARE(qvariant_cast<QTransform>(tester.values.at(tester.values.size() - 2)),
QTransform().translate(50, 0));
- QCOMPARE(qVariantValue<QTransform>(tester.values.at(tester.values.size() - 1)),
+ QCOMPARE(qvariant_cast<QTransform>(tester.values.at(tester.values.size() - 1)),
QTransform().rotate(90));
QVariant variant;
- qVariantSetValue<QTransform>(variant, QTransform());
+ variant.setValue<QTransform>(QTransform());
QCOMPARE(tester.oldValues.last(), variant);
QCOMPARE(tester.transform(), QTransform().rotate(90));
}
@@ -4690,9 +4690,9 @@ void tst_QGraphicsItem::itemChange()
QCOMPARE(tester.changes.size(), changeCount);
QCOMPARE(tester.changes.at(tester.changes.size() - 2), QGraphicsItem::ItemFlagsChange);
QCOMPARE(tester.changes.at(tester.changes.size() - 1), QGraphicsItem::ItemFlagsHaveChanged);
- QVariant expectedFlags = qVariantFromValue<quint32>(QGraphicsItem::GraphicsItemFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemSendsGeometryChanges));
+ QVariant expectedFlags = QVariant::fromValue<quint32>(QGraphicsItem::GraphicsItemFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemSendsGeometryChanges));
QCOMPARE(tester.values.at(tester.values.size() - 2), expectedFlags);
- QCOMPARE(tester.values.at(tester.values.size() - 1), qVariantFromValue<quint32>((quint32)QGraphicsItem::ItemIsSelectable));
+ QCOMPARE(tester.values.at(tester.values.size() - 1), QVariant::fromValue<quint32>((quint32)QGraphicsItem::ItemIsSelectable));
}
{
// ItemSelectedChange
@@ -4739,12 +4739,12 @@ void tst_QGraphicsItem::itemChange()
}
{
// ItemParentChange
- qVariantSetValue<QGraphicsItem *>(tester.itemChangeReturnValue, 0);
+ tester.itemChangeReturnValue.setValue<QGraphicsItem *>(0);
tester.setParentItem(&testerHelper);
QCOMPARE(tester.changes.size(), ++changeCount);
QCOMPARE(tester.changes.last(), QGraphicsItem::ItemParentChange);
- QCOMPARE(qVariantValue<QGraphicsItem *>(tester.values.last()), (QGraphicsItem *)&testerHelper);
- QCOMPARE(qVariantValue<QGraphicsItem *>(tester.oldValues.last()), (QGraphicsItem *)0);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(tester.values.last()), (QGraphicsItem *)&testerHelper);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(tester.oldValues.last()), (QGraphicsItem *)0);
QCOMPARE(tester.parentItem(), (QGraphicsItem *)0);
}
{
@@ -4771,14 +4771,14 @@ void tst_QGraphicsItem::itemChange()
testerHelper.setParentItem(&tester);
QCOMPARE(tester.changes.size(), ++changeCount);
QCOMPARE(tester.changes.last(), QGraphicsItem::ItemChildAddedChange);
- QCOMPARE(qVariantValue<QGraphicsItem *>(tester.values.last()), (QGraphicsItem *)&testerHelper);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(tester.values.last()), (QGraphicsItem *)&testerHelper);
}
{
// ItemChildRemovedChange 1
testerHelper.setParentItem(0);
QCOMPARE(tester.changes.size(), ++changeCount);
QCOMPARE(tester.changes.last(), QGraphicsItem::ItemChildRemovedChange);
- QCOMPARE(qVariantValue<QGraphicsItem *>(tester.values.last()), (QGraphicsItem *)&testerHelper);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(tester.values.last()), (QGraphicsItem *)&testerHelper);
// ItemChildRemovedChange 1
ItemChangeTester *test = new ItemChangeTester;
@@ -4819,10 +4819,10 @@ void tst_QGraphicsItem::itemChange()
ItemChangeTester *child = new ItemChangeTester;
child->setParentItem(&parent);
QCOMPARE(parent.changes.last(), QGraphicsItem::ItemChildAddedChange);
- QCOMPARE(qVariantValue<QGraphicsItem *>(parent.values.last()), (QGraphicsItem *)child);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(parent.values.last()), (QGraphicsItem *)child);
delete child;
QCOMPARE(parent.changes.last(), QGraphicsItem::ItemChildRemovedChange);
- QCOMPARE(qVariantValue<QGraphicsItem *>(parent.values.last()), (QGraphicsItem *)child);
+ QCOMPARE(qvariant_cast<QGraphicsItem *>(parent.values.last()), (QGraphicsItem *)child);
}
{
// !!! Note: If this test crashes because of double-deletion, there's
@@ -4841,8 +4841,8 @@ 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(qVariantValue<QGraphicsScene *>(tester.oldValues.last()), (QGraphicsScene *)0);
- QCOMPARE(qVariantValue<QGraphicsScene *>(tester.values.last()), (QGraphicsScene *)&scene);
+ QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.oldValues.last()), (QGraphicsScene *)0);
+ QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.last()), (QGraphicsScene *)&scene);
scene2.addItem(&tester);
++changeCount; // ItemSceneChange (0) was: (scene)
++changeCount; // ItemSceneHasChanged (0)
@@ -4858,16 +4858,16 @@ void tst_QGraphicsItem::itemChange()
// Item's last old value was scene
// Item's last current value is 0
- QCOMPARE(qVariantValue<QGraphicsScene *>(tester.oldValues.at(tester.oldValues.size() - 2)), (QGraphicsScene *)&scene);
- QCOMPARE(qVariantValue<QGraphicsScene *>(tester.oldValues.at(tester.oldValues.size() - 1)), (QGraphicsScene *)0);
- QCOMPARE(qVariantValue<QGraphicsScene *>(tester.values.at(tester.values.size() - 4)), (QGraphicsScene *)0);
- QCOMPARE(qVariantValue<QGraphicsScene *>(tester.values.at(tester.values.size() - 3)), (QGraphicsScene *)0);
- QCOMPARE(qVariantValue<QGraphicsScene *>(tester.values.at(tester.values.size() - 2)), (QGraphicsScene *)&scene2);
- QCOMPARE(qVariantValue<QGraphicsScene *>(tester.values.at(tester.values.size() - 1)), (QGraphicsScene *)&scene2);
+ 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.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(qVariantValue<QGraphicsScene *>(tester.oldValues.last()), (QGraphicsScene *)0);
- QCOMPARE(qVariantValue<QGraphicsScene *>(tester.values.last()), (QGraphicsScene *)&scene2);
+ QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.oldValues.last()), (QGraphicsScene *)0);
+ QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.last()), (QGraphicsScene *)&scene2);
scene2.removeItem(&tester);
++changeCount; // ItemSceneChange (0) was: (scene2)
@@ -4879,9 +4879,9 @@ void tst_QGraphicsItem::itemChange()
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(qVariantValue<QGraphicsScene *>(tester.oldValues.last()), (QGraphicsScene *)&scene2);
- QCOMPARE(qVariantValue<QGraphicsScene *>(tester.values.at(tester.values.size() - 2)), (QGraphicsScene *)0);
- QCOMPARE(qVariantValue<QGraphicsScene *>(tester.values.at(tester.values.size() - 1)), (QGraphicsScene *)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);
tester.itemSceneChangeTargetScene = &scene;
scene2.addItem(&tester);
@@ -4890,9 +4890,9 @@ void tst_QGraphicsItem::itemChange()
++changeCount; // ItemSceneHasChanged (scene)
QCOMPARE(tester.values.size(), changeCount);
- QCOMPARE(qVariantValue<QGraphicsScene *>(tester.values.at(tester.values.size() - 3)), (QGraphicsScene *)&scene2);
- QCOMPARE(qVariantValue<QGraphicsScene *>(tester.values.at(tester.values.size() - 2)), (QGraphicsScene *)&scene);
- QCOMPARE(qVariantValue<QGraphicsScene *>(tester.values.at(tester.values.size() - 1)), (QGraphicsScene *)&scene);
+ QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.at(tester.values.size() - 3)), (QGraphicsScene *)&scene2);
+ QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.at(tester.values.size() - 2)), (QGraphicsScene *)&scene);
+ QCOMPARE(qvariant_cast<QGraphicsScene *>(tester.values.at(tester.values.size() - 1)), (QGraphicsScene *)&scene);
QCOMPARE(tester.scene(), &scene);
tester.itemSceneChangeTargetScene = 0;
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index df529c6095..3686619fea 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -2830,7 +2830,7 @@ void tst_QGraphicsScene::update()
// Check that the update region is correct
QCOMPARE(spy.count(), 1);
QRectF region;
- foreach (QRectF rectF, qVariantValue<QList<QRectF> >(spy.at(0).at(0)))
+ foreach (QRectF rectF, qvariant_cast<QList<QRectF> >(spy.at(0).at(0)))
region |= rectF;
QCOMPARE(region, QRectF(-100, -100, 200, 200));
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index 99353c6edf..4015cd7b6d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -3211,11 +3211,11 @@ void tst_QGraphicsWidget::itemChangeEvents()
break;
}
case QEvent::ParentAboutToChange: {
- valueDuringEvents.insert(QEvent::ParentAboutToChange, qVariantFromValue(parentItem()));
+ valueDuringEvents.insert(QEvent::ParentAboutToChange, QVariant::fromValue(parentItem()));
break;
}
case QEvent::ParentChange: {
- valueDuringEvents.insert(QEvent::ParentChange, qVariantFromValue(parentItem()));
+ valueDuringEvents.insert(QEvent::ParentChange, QVariant::fromValue(parentItem()));
break;
}
case QEvent::CursorChange: {
@@ -3252,10 +3252,10 @@ void tst_QGraphicsWidget::itemChangeEvents()
TestGraphicsWidget *item = new TestGraphicsWidget;
item->setParentItem(parent);
// ParentAboutToChange should be triggered before the parent has changed
- QTRY_COMPARE(qVariantValue<QGraphicsItem *>(item->valueDuringEvents.value(QEvent::ParentAboutToChange)),
+ QTRY_COMPARE(qvariant_cast<QGraphicsItem *>(item->valueDuringEvents.value(QEvent::ParentAboutToChange)),
static_cast<QGraphicsItem *>(0));
// ParentChange should be triggered after the parent has changed
- QTRY_COMPARE(qVariantValue<QGraphicsItem *>(item->valueDuringEvents.value(QEvent::ParentChange)),
+ QTRY_COMPARE(qvariant_cast<QGraphicsItem *>(item->valueDuringEvents.value(QEvent::ParentChange)),
static_cast<QGraphicsItem *>(parent));
// ShowEvent should be triggered before the item is shown
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index 90fa2ad716..288e41c6ef 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -1466,8 +1466,8 @@ void tst_QApplication::focusChanged()
QApplication::setActiveWindow(&parent1); // needs this on twm (focus follows mouse)
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.at(0).count(), 2);
- old = qVariantValue<QWidget*>(spy.at(0).at(0));
- now = qVariantValue<QWidget*>(spy.at(0).at(1));
+ old = qvariant_cast<QWidget*>(spy.at(0).at(0));
+ now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &le1);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == 0);
@@ -1476,8 +1476,8 @@ void tst_QApplication::focusChanged()
pb1.setFocus();
QCOMPARE(spy.count(), 1);
- old = qVariantValue<QWidget*>(spy.at(0).at(0));
- now = qVariantValue<QWidget*>(spy.at(0).at(1));
+ old = qvariant_cast<QWidget*>(spy.at(0).at(0));
+ now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &pb1);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &le1);
@@ -1485,8 +1485,8 @@ void tst_QApplication::focusChanged()
lb1.setFocus();
QCOMPARE(spy.count(), 1);
- old = qVariantValue<QWidget*>(spy.at(0).at(0));
- now = qVariantValue<QWidget*>(spy.at(0).at(1));
+ old = qvariant_cast<QWidget*>(spy.at(0).at(0));
+ now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &lb1);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &pb1);
@@ -1494,8 +1494,8 @@ void tst_QApplication::focusChanged()
lb1.clearFocus();
QCOMPARE(spy.count(), 1);
- old = qVariantValue<QWidget*>(spy.at(0).at(0));
- now = qVariantValue<QWidget*>(spy.at(0).at(1));
+ old = qvariant_cast<QWidget*>(spy.at(0).at(0));
+ now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == 0);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &lb1);
@@ -1513,8 +1513,8 @@ void tst_QApplication::focusChanged()
parent2.show();
QApplication::setActiveWindow(&parent2); // needs this on twm (focus follows mouse)
QVERIFY(spy.count() > 0); // one for deactivation, one for activation on Windows
- old = qVariantValue<QWidget*>(spy.at(spy.count()-1).at(0));
- now = qVariantValue<QWidget*>(spy.at(spy.count()-1).at(1));
+ old = qvariant_cast<QWidget*>(spy.at(spy.count()-1).at(0));
+ now = qvariant_cast<QWidget*>(spy.at(spy.count()-1).at(1));
QVERIFY(now == &le2);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == 0);
@@ -1547,8 +1547,8 @@ void tst_QApplication::focusChanged()
QVERIFY(now == QApplication::focusWidget());
} else {
QVERIFY(spy.count() > 0);
- old = qVariantValue<QWidget*>(spy.at(0).at(0));
- now = qVariantValue<QWidget*>(spy.at(0).at(1));
+ old = qvariant_cast<QWidget*>(spy.at(0).at(0));
+ now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &pb2);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &le2);
@@ -1561,8 +1561,8 @@ void tst_QApplication::focusChanged()
} else {
tab.simulate(now);
QVERIFY(spy.count() > 0);
- old = qVariantValue<QWidget*>(spy.at(0).at(0));
- now = qVariantValue<QWidget*>(spy.at(0).at(1));
+ old = qvariant_cast<QWidget*>(spy.at(0).at(0));
+ now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &le2);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &pb2);
@@ -1575,8 +1575,8 @@ void tst_QApplication::focusChanged()
} else {
backtab.simulate(now);
QVERIFY(spy.count() > 0);
- old = qVariantValue<QWidget*>(spy.at(0).at(0));
- now = qVariantValue<QWidget*>(spy.at(0).at(1));
+ old = qvariant_cast<QWidget*>(spy.at(0).at(0));
+ now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &pb2);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &le2);
@@ -1591,8 +1591,8 @@ void tst_QApplication::focusChanged()
} else {
backtab.simulate(now);
QVERIFY(spy.count() > 0);
- old = qVariantValue<QWidget*>(spy.at(0).at(0));
- now = qVariantValue<QWidget*>(spy.at(0).at(1));
+ old = qvariant_cast<QWidget*>(spy.at(0).at(0));
+ now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &le2);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &pb2);
@@ -1605,8 +1605,8 @@ void tst_QApplication::focusChanged()
QVERIFY(now == QApplication::focusWidget());
} else {
QVERIFY(spy.count() > 0);
- old = qVariantValue<QWidget*>(spy.at(0).at(0));
- now = qVariantValue<QWidget*>(spy.at(0).at(1));
+ old = qvariant_cast<QWidget*>(spy.at(0).at(0));
+ now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &pb2);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &le2);
@@ -1614,8 +1614,8 @@ void tst_QApplication::focusChanged()
click.simulate(old);
QVERIFY(spy.count() > 0);
- old = qVariantValue<QWidget*>(spy.at(0).at(0));
- now = qVariantValue<QWidget*>(spy.at(0).at(1));
+ old = qvariant_cast<QWidget*>(spy.at(0).at(0));
+ now = qvariant_cast<QWidget*>(spy.at(0).at(1));
QVERIFY(now == &le2);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &pb2);
@@ -1629,10 +1629,10 @@ void tst_QApplication::focusChanged()
//on windows, the change of focus is made in 2 steps
//(the focusChanged SIGNAL is emitted twice)
if (spy.count()==1)
- old = qVariantValue<QWidget*>(spy.at(spy.count()-1).at(0));
+ old = qvariant_cast<QWidget*>(spy.at(spy.count()-1).at(0));
else
- old = qVariantValue<QWidget*>(spy.at(spy.count()-2).at(0));
- now = qVariantValue<QWidget*>(spy.at(spy.count()-1).at(1));
+ old = qvariant_cast<QWidget*>(spy.at(spy.count()-2).at(0));
+ now = qvariant_cast<QWidget*>(spy.at(spy.count()-1).at(1));
QVERIFY(now == &le1);
QVERIFY(now == QApplication::focusWidget());
QVERIFY(old == &le2);
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
index 5c6ea19c50..a6f344c4bc 100644
--- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -2049,7 +2049,7 @@ void tst_QDateTimeEdit::dateSignalChecking()
if (timesEmitted > 0) {
QList<QVariant> list = dateSpy.takeFirst();
QDate d;
- d = qVariantValue<QDate>(list.at(0));
+ d = qvariant_cast<QDate>(list.at(0));
QCOMPARE(d, newDate);
}
QCOMPARE(dateTimeSpy.count(), timesEmitted);
@@ -2085,7 +2085,7 @@ void tst_QDateTimeEdit::timeSignalChecking()
if (timesEmitted > 0) {
QList<QVariant> list = timeSpy.takeFirst();
QTime t;
- t = qVariantValue<QTime>(list.at(0));
+ t = qvariant_cast<QTime>(list.at(0));
QCOMPARE(t, newTime);
}
QCOMPARE(dateTimeSpy.count(), timesEmitted);
@@ -2135,21 +2135,21 @@ void tst_QDateTimeEdit::dateTimeSignalChecking()
QCOMPARE(timesDateEmitted, 1);
QList<QVariant> list = dateSpy.takeFirst();
QDate d;
- d = qVariantValue<QDate>(list.at(0));
+ d = qvariant_cast<QDate>(list.at(0));
QCOMPARE(d, newDateTime.date());
}
QCOMPARE(timeSpy.count(), timesTimeEmitted);
if (timesTimeEmitted > 0) {
QList<QVariant> list = timeSpy.takeFirst();
QTime t;
- t = qVariantValue<QTime>(list.at(0));
+ t = qvariant_cast<QTime>(list.at(0));
QCOMPARE(t, newDateTime.time());
}
QCOMPARE(dateTimeSpy.count(), timesDateTimeEmitted);
if (timesDateTimeEmitted > 0) {
QList<QVariant> list = dateTimeSpy.takeFirst();
QDateTime dt;
- dt = qVariantValue<QDateTime>(list.at(0));
+ dt = qvariant_cast<QDateTime>(list.at(0));
QCOMPARE(dt, newDateTime);
}
}