summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-06-06 00:27:44 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-07-13 01:32:53 +0200
commit43fa292ff621550d0977908b499fb54096251825 (patch)
tree7f4f06e5dc4f70dc01080ac2b78a4c617172c1b5 /tests/auto/widgets
parent23444d4b26a13677a2029a2b5a53bfae76647b71 (diff)
QVariant::setValue(): enable move semantics
Given we optimize for the case where the new value is of the same type of the one already stored in the variant, enable move assignment for that case. As a drive-by, avoid a path to detach() for data() if we know we're detached. Change-Id: I9abbdc10637ce77ebb747b49d83e1ef914d997bb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 1c311a27ea..aa08f1c44d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -4499,7 +4499,7 @@ protected:
break;
case QGraphicsItem::ItemTransformChange: {
QVariant variant;
- variant.setValue<QTransform>(transform());
+ variant.setValue(transform());
oldValues << variant;
}
break;
@@ -4616,7 +4616,7 @@ void tst_QGraphicsItem::itemChange()
}
{
// ItemTransformChange / ItemTransformHasChanged
- tester.itemChangeReturnValue.setValue<QTransform>(QTransform().rotate(90));
+ tester.itemChangeReturnValue.setValue(QTransform().rotate(90));
tester.setTransform(QTransform::fromTranslate(50, 0), true);
++changeCount; // notification sent too
++changeCount;
@@ -4628,7 +4628,7 @@ void tst_QGraphicsItem::itemChange()
QCOMPARE(qvariant_cast<QTransform>(tester.values.at(tester.values.size() - 1)),
QTransform().rotate(90));
QVariant variant;
- variant.setValue<QTransform>(QTransform());
+ variant.setValue(QTransform());
QCOMPARE(tester.oldValues.constLast(), variant);
QCOMPARE(tester.transform(), QTransform().rotate(90));
}
@@ -4763,7 +4763,7 @@ void tst_QGraphicsItem::itemChange()
}
{
// ItemParentChange
- tester.itemChangeReturnValue.setValue<QGraphicsItem *>(nullptr);
+ tester.itemChangeReturnValue.setValue(static_cast<QGraphicsItem *>(nullptr));
tester.setParentItem(&testerHelper);
QCOMPARE(tester.changes.size(), ++changeCount);
QCOMPARE(tester.changes.constLast(), QGraphicsItem::ItemParentChange);