QGraphicsView tests: Remove QT_DISABLE_DEPRECATED_BEFORE=0.
Fix usage of API that is marked deprecated. Change-Id: Ib9a45e93084fb5b0d0d3aefd64b755dff7c696d6 Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
This commit is contained in:
parent
d21e6cf558
commit
574c2e7fee
@ -6,4 +6,3 @@ SOURCES += tst_qgraphicsitem.cpp
|
|||||||
DEFINES += QT_NO_CAST_TO_ASCII
|
DEFINES += QT_NO_CAST_TO_ASCII
|
||||||
|
|
||||||
win32:!wince:!winrt: LIBS += -luser32
|
win32:!wince:!winrt: LIBS += -luser32
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -310,7 +310,7 @@ private slots:
|
|||||||
void selected_textItem();
|
void selected_textItem();
|
||||||
void selected_multi();
|
void selected_multi();
|
||||||
void acceptedMouseButtons();
|
void acceptedMouseButtons();
|
||||||
void acceptsHoverEvents();
|
void acceptHoverEvents();
|
||||||
void childAcceptsHoverEvents();
|
void childAcceptsHoverEvents();
|
||||||
void hasFocus();
|
void hasFocus();
|
||||||
void pos();
|
void pos();
|
||||||
@ -564,9 +564,9 @@ void tst_QGraphicsItem::construction()
|
|||||||
QVERIFY(!item->isSelected());
|
QVERIFY(!item->isSelected());
|
||||||
QCOMPARE(item->acceptedMouseButtons(), Qt::MouseButtons(0x1f));
|
QCOMPARE(item->acceptedMouseButtons(), Qt::MouseButtons(0x1f));
|
||||||
if (item->type() == QGraphicsTextItem::Type)
|
if (item->type() == QGraphicsTextItem::Type)
|
||||||
QVERIFY(item->acceptsHoverEvents());
|
QVERIFY(item->acceptHoverEvents());
|
||||||
else
|
else
|
||||||
QVERIFY(!item->acceptsHoverEvents());
|
QVERIFY(!item->acceptHoverEvents());
|
||||||
QVERIFY(!item->hasFocus());
|
QVERIFY(!item->hasFocus());
|
||||||
QCOMPARE(item->pos(), QPointF());
|
QCOMPARE(item->pos(), QPointF());
|
||||||
QCOMPARE(item->matrix(), QMatrix());
|
QCOMPARE(item->matrix(), QMatrix());
|
||||||
@ -1125,11 +1125,11 @@ void tst_QGraphicsItem::visible()
|
|||||||
|
|
||||||
scene.addItem(item);
|
scene.addItem(item);
|
||||||
QVERIFY(item->isVisible());
|
QVERIFY(item->isVisible());
|
||||||
QCOMPARE(scene.itemAt(0, 0), item);
|
QCOMPARE(scene.items(QPointF(0, 0)).value(0, Q_NULLPTR), item);
|
||||||
item->setVisible(false);
|
item->setVisible(false);
|
||||||
QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(0, 0)).isEmpty());
|
||||||
item->setVisible(true);
|
item->setVisible(true);
|
||||||
QCOMPARE(scene.itemAt(0, 0), item);
|
QCOMPARE(scene.items(QPointF(0, 0)).value(0, Q_NULLPTR), item);
|
||||||
|
|
||||||
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress);
|
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress);
|
||||||
event.setButton(Qt::LeftButton);
|
event.setButton(Qt::LeftButton);
|
||||||
@ -1930,7 +1930,7 @@ protected:
|
|||||||
{ ++hoverOutCount; }
|
{ ++hoverOutCount; }
|
||||||
};
|
};
|
||||||
|
|
||||||
void tst_QGraphicsItem::acceptsHoverEvents()
|
void tst_QGraphicsItem::acceptHoverEvents()
|
||||||
{
|
{
|
||||||
QGraphicsScene scene;
|
QGraphicsScene scene;
|
||||||
HoverItem *item1 = new HoverItem(QRectF(-10, -10, 20, 20));
|
HoverItem *item1 = new HoverItem(QRectF(-10, -10, 20, 20));
|
||||||
@ -1939,10 +1939,10 @@ void tst_QGraphicsItem::acceptsHoverEvents()
|
|||||||
scene.addItem(item2);
|
scene.addItem(item2);
|
||||||
item2->setZValue(1);
|
item2->setZValue(1);
|
||||||
|
|
||||||
QVERIFY(!item1->acceptsHoverEvents());
|
QVERIFY(!item1->acceptHoverEvents());
|
||||||
QVERIFY(!item2->acceptsHoverEvents());
|
QVERIFY(!item2->acceptHoverEvents());
|
||||||
item1->setAcceptsHoverEvents(true);
|
item1->setAcceptHoverEvents(true);
|
||||||
item2->setAcceptsHoverEvents(true);
|
item2->setAcceptHoverEvents(true);
|
||||||
|
|
||||||
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseMove);
|
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseMove);
|
||||||
event.setScenePos(QPointF(-100, -100));
|
event.setScenePos(QPointF(-100, -100));
|
||||||
@ -1953,8 +1953,8 @@ void tst_QGraphicsItem::acceptsHoverEvents()
|
|||||||
QCOMPARE(item1->hoverInCount, 0);
|
QCOMPARE(item1->hoverInCount, 0);
|
||||||
QCOMPARE(item2->hoverInCount, 1);
|
QCOMPARE(item2->hoverInCount, 1);
|
||||||
|
|
||||||
item1->setAcceptsHoverEvents(false);
|
item1->setAcceptHoverEvents(false);
|
||||||
item2->setAcceptsHoverEvents(false);
|
item2->setAcceptHoverEvents(false);
|
||||||
|
|
||||||
event.setScenePos(QPointF(-100, -100));
|
event.setScenePos(QPointF(-100, -100));
|
||||||
QApplication::sendEvent(&scene, &event);
|
QApplication::sendEvent(&scene, &event);
|
||||||
@ -1964,8 +1964,8 @@ void tst_QGraphicsItem::acceptsHoverEvents()
|
|||||||
QCOMPARE(item1->hoverInCount, 0);
|
QCOMPARE(item1->hoverInCount, 0);
|
||||||
QCOMPARE(item2->hoverInCount, 1);
|
QCOMPARE(item2->hoverInCount, 1);
|
||||||
|
|
||||||
item1->setAcceptsHoverEvents(true);
|
item1->setAcceptHoverEvents(true);
|
||||||
item2->setAcceptsHoverEvents(false);
|
item2->setAcceptHoverEvents(false);
|
||||||
|
|
||||||
event.setScenePos(QPointF(-100, -100));
|
event.setScenePos(QPointF(-100, -100));
|
||||||
QApplication::sendEvent(&scene, &event);
|
QApplication::sendEvent(&scene, &event);
|
||||||
@ -2168,27 +2168,27 @@ void tst_QGraphicsItem::matrix()
|
|||||||
line.resetMatrix();
|
line.resetMatrix();
|
||||||
QCOMPARE(line.matrix(), QMatrix());
|
QCOMPARE(line.matrix(), QMatrix());
|
||||||
|
|
||||||
line.rotate(90);
|
line.setTransform(QTransform().rotate(90), true);
|
||||||
QCOMPARE(line.matrix(), QMatrix().rotate(90));
|
QCOMPARE(line.matrix(), QMatrix().rotate(90));
|
||||||
line.rotate(90);
|
line.setTransform(QTransform().rotate(90), true);
|
||||||
QCOMPARE(line.matrix(), QMatrix().rotate(90).rotate(90));
|
QCOMPARE(line.matrix(), QMatrix().rotate(90).rotate(90));
|
||||||
line.resetMatrix();
|
line.resetMatrix();
|
||||||
|
|
||||||
line.scale(2, 4);
|
line.setTransform(QTransform::fromScale(2, 4), true);
|
||||||
QCOMPARE(line.matrix(), QMatrix().scale(2, 4));
|
QCOMPARE(line.matrix(), QMatrix().scale(2, 4));
|
||||||
line.scale(2, 4);
|
line.setTransform(QTransform::fromScale(2, 4), true);
|
||||||
QCOMPARE(line.matrix(), QMatrix().scale(2, 4).scale(2, 4));
|
QCOMPARE(line.matrix(), QMatrix().scale(2, 4).scale(2, 4));
|
||||||
line.resetMatrix();
|
line.resetMatrix();
|
||||||
|
|
||||||
line.shear(2, 4);
|
line.setTransform(QTransform().shear(2, 4), true);
|
||||||
QCOMPARE(line.matrix(), QMatrix().shear(2, 4));
|
QCOMPARE(line.matrix(), QMatrix().shear(2, 4));
|
||||||
line.shear(2, 4);
|
line.setTransform(QTransform().shear(2, 4), true);
|
||||||
QCOMPARE(line.matrix(), QMatrix().shear(2, 4).shear(2, 4));
|
QCOMPARE(line.matrix(), QMatrix().shear(2, 4).shear(2, 4));
|
||||||
line.resetMatrix();
|
line.resetMatrix();
|
||||||
|
|
||||||
line.translate(10, 10);
|
line.setTransform(QTransform::fromTranslate(10, 10), true);
|
||||||
QCOMPARE(line.matrix(), QMatrix().translate(10, 10));
|
QCOMPARE(line.matrix(), QMatrix().translate(10, 10));
|
||||||
line.translate(10, 10);
|
line.setTransform(QTransform::fromTranslate(10, 10), true);
|
||||||
QCOMPARE(line.matrix(), QMatrix().translate(10, 10).translate(10, 10));
|
QCOMPARE(line.matrix(), QMatrix().translate(10, 10).translate(10, 10));
|
||||||
line.resetMatrix();
|
line.resetMatrix();
|
||||||
}
|
}
|
||||||
@ -2201,15 +2201,15 @@ void tst_QGraphicsItem::sceneMatrix()
|
|||||||
QCOMPARE(parent->sceneMatrix(), QMatrix());
|
QCOMPARE(parent->sceneMatrix(), QMatrix());
|
||||||
QCOMPARE(child->sceneMatrix(), QMatrix());
|
QCOMPARE(child->sceneMatrix(), QMatrix());
|
||||||
|
|
||||||
parent->translate(10, 10);
|
parent->setTransform(QTransform::fromTranslate(10, 10), true);
|
||||||
QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10));
|
QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10));
|
||||||
QCOMPARE(child->sceneMatrix(), QMatrix().translate(10, 10));
|
QCOMPARE(child->sceneMatrix(), QMatrix().translate(10, 10));
|
||||||
|
|
||||||
child->translate(10, 10);
|
child->setTransform(QTransform::fromTranslate(10, 10), true);
|
||||||
QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10));
|
QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10));
|
||||||
QCOMPARE(child->sceneMatrix(), QMatrix().translate(20, 20));
|
QCOMPARE(child->sceneMatrix(), QMatrix().translate(20, 20));
|
||||||
|
|
||||||
parent->rotate(90);
|
parent->setTransform(QTransform().rotate(90), true);
|
||||||
QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10).rotate(90));
|
QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10).rotate(90));
|
||||||
QCOMPARE(child->sceneMatrix(), QMatrix().translate(10, 10).rotate(90).translate(10, 10));
|
QCOMPARE(child->sceneMatrix(), QMatrix().translate(10, 10).rotate(90).translate(10, 10));
|
||||||
|
|
||||||
@ -2645,7 +2645,7 @@ void tst_QGraphicsItem::isObscuredBy()
|
|||||||
MyItem myitem1, myitem2;
|
MyItem myitem1, myitem2;
|
||||||
|
|
||||||
myitem1.setRect(QRectF(50, 50, 40, 200));
|
myitem1.setRect(QRectF(50, 50, 40, 200));
|
||||||
myitem1.rotate(67);
|
myitem1.setTransform(QTransform().rotate(67), true);
|
||||||
|
|
||||||
myitem2.setRect(QRectF(25, 25, 20, 20));
|
myitem2.setRect(QRectF(25, 25, 20, 20));
|
||||||
myitem2.setZValue(-1.0);
|
myitem2.setZValue(-1.0);
|
||||||
@ -3271,7 +3271,7 @@ void tst_QGraphicsItem::hoverEventsGenerateRepaints()
|
|||||||
|
|
||||||
EventTester *tester = new EventTester;
|
EventTester *tester = new EventTester;
|
||||||
scene.addItem(tester);
|
scene.addItem(tester);
|
||||||
tester->setAcceptsHoverEvents(true);
|
tester->setAcceptHoverEvents(true);
|
||||||
|
|
||||||
QTRY_COMPARE(tester->repaints, 1);
|
QTRY_COMPARE(tester->repaints, 1);
|
||||||
|
|
||||||
@ -3363,7 +3363,7 @@ void tst_QGraphicsItem::sceneBoundingRect()
|
|||||||
QCOMPARE(item->boundingRect(), QRectF(0, 0, 100, 100));
|
QCOMPARE(item->boundingRect(), QRectF(0, 0, 100, 100));
|
||||||
QCOMPARE(item->sceneBoundingRect(), QRectF(100, 100, 100, 100));
|
QCOMPARE(item->sceneBoundingRect(), QRectF(100, 100, 100, 100));
|
||||||
|
|
||||||
item->rotate(90);
|
item->setTransform(QTransform().rotate(90), true);
|
||||||
|
|
||||||
QCOMPARE(item->boundingRect(), QRectF(0, 0, 100, 100));
|
QCOMPARE(item->boundingRect(), QRectF(0, 0, 100, 100));
|
||||||
QCOMPARE(item->sceneBoundingRect(), QRectF(0, 100, 100, 100));
|
QCOMPARE(item->sceneBoundingRect(), QRectF(0, 100, 100, 100));
|
||||||
@ -3391,7 +3391,7 @@ void tst_QGraphicsItem::childrenBoundingRect()
|
|||||||
QGraphicsRectItem *childChild = scene.addRect(QRectF(0, 0, 100, 100), QPen(Qt::black, 0));
|
QGraphicsRectItem *childChild = scene.addRect(QRectF(0, 0, 100, 100), QPen(Qt::black, 0));
|
||||||
childChild->setParentItem(child);
|
childChild->setParentItem(child);
|
||||||
childChild->setPos(500, 500);
|
childChild->setPos(500, 500);
|
||||||
child->rotate(90);
|
child->setTransform(QTransform().rotate(90), true);
|
||||||
|
|
||||||
scene.addPolygon(parent->mapToScene(parent->boundingRect() | parent->childrenBoundingRect()))->setPen(QPen(Qt::red));;
|
scene.addPolygon(parent->mapToScene(parent->boundingRect() | parent->childrenBoundingRect()))->setPen(QPen(Qt::red));;
|
||||||
|
|
||||||
@ -3439,11 +3439,11 @@ void tst_QGraphicsItem::childrenBoundingRectTransformed()
|
|||||||
QCOMPARE(subTreeRect.width(), qreal(351.7766952966369));
|
QCOMPARE(subTreeRect.width(), qreal(351.7766952966369));
|
||||||
QCOMPARE(subTreeRect.height(), qreal(251.7766952966369));
|
QCOMPARE(subTreeRect.height(), qreal(251.7766952966369));
|
||||||
|
|
||||||
rect->rotate(45);
|
rect->setTransform(QTransform().rotate(45), true);
|
||||||
rect2->rotate(-45);
|
rect2->setTransform(QTransform().rotate(-45), true);
|
||||||
rect3->rotate(45);
|
rect3->setTransform(QTransform().rotate(45), true);
|
||||||
rect4->rotate(-45);
|
rect4->setTransform(QTransform().rotate(-45), true);
|
||||||
rect5->rotate(45);
|
rect5->setTransform(QTransform().rotate(45), true);
|
||||||
|
|
||||||
subTreeRect = rect->childrenBoundingRect();
|
subTreeRect = rect->childrenBoundingRect();
|
||||||
QCOMPARE(rect->childrenBoundingRect(), QRectF(-100, 75, 275, 250));
|
QCOMPARE(rect->childrenBoundingRect(), QRectF(-100, 75, 275, 250));
|
||||||
@ -3565,7 +3565,7 @@ void tst_QGraphicsItem::group()
|
|||||||
QGraphicsRectItem *child = scene.addRect(QRectF(0, 0, 50, 50), QPen(Qt::black, 0), QBrush(Qt::blue));
|
QGraphicsRectItem *child = scene.addRect(QRectF(0, 0, 50, 50), QPen(Qt::black, 0), QBrush(Qt::blue));
|
||||||
QGraphicsRectItem *parent2 = scene.addRect(QRectF(0, 0, 50, 50), QPen(Qt::black, 0), QBrush(Qt::red));
|
QGraphicsRectItem *parent2 = scene.addRect(QRectF(0, 0, 50, 50), QPen(Qt::black, 0), QBrush(Qt::red));
|
||||||
parent2->setPos(-50, 50);
|
parent2->setPos(-50, 50);
|
||||||
child->rotate(45);
|
child->setTransform(QTransform().rotate(45), true);
|
||||||
child->setParentItem(parent);
|
child->setParentItem(parent);
|
||||||
parent->setPos(25, 25);
|
parent->setPos(25, 25);
|
||||||
child->setPos(25, 25);
|
child->setPos(25, 25);
|
||||||
@ -3614,7 +3614,7 @@ void tst_QGraphicsItem::group()
|
|||||||
newItems << item;
|
newItems << item;
|
||||||
item->setPos(-1000 + rand() % 2000,
|
item->setPos(-1000 + rand() % 2000,
|
||||||
-1000 + rand() % 2000);
|
-1000 + rand() % 2000);
|
||||||
item->rotate(rand() % 90);
|
item->setTransform(QTransform().rotate(rand() % 90), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
view.fitInView(scene.itemsBoundingRect());
|
view.fitInView(scene.itemsBoundingRect());
|
||||||
@ -3657,8 +3657,8 @@ void tst_QGraphicsItem::setGroup2()
|
|||||||
rect->setTransformOriginPoint(50,50);
|
rect->setTransformOriginPoint(50,50);
|
||||||
rect->setRotation(45);
|
rect->setRotation(45);
|
||||||
rect->setScale(1.5);
|
rect->setScale(1.5);
|
||||||
rect->translate(20,20);
|
rect->setTransform(QTransform::fromTranslate(20,20), true);
|
||||||
group.translate(-30,-40);
|
group.setTransform(QTransform::fromTranslate(-30, -40), true);
|
||||||
group.setRotation(180);
|
group.setRotation(180);
|
||||||
group.setScale(0.5);
|
group.setScale(0.5);
|
||||||
|
|
||||||
@ -3711,7 +3711,7 @@ void tst_QGraphicsItem::warpChildrenIntoGroup()
|
|||||||
QGraphicsScene scene;
|
QGraphicsScene scene;
|
||||||
QGraphicsRectItem *parentRectItem = scene.addRect(QRectF(0, 0, 100, 100));
|
QGraphicsRectItem *parentRectItem = scene.addRect(QRectF(0, 0, 100, 100));
|
||||||
QGraphicsRectItem *childRectItem = scene.addRect(QRectF(0, 0, 100, 100));
|
QGraphicsRectItem *childRectItem = scene.addRect(QRectF(0, 0, 100, 100));
|
||||||
parentRectItem->rotate(90);
|
parentRectItem->setTransform(QTransform().rotate(90), true);
|
||||||
childRectItem->setPos(-50, -25);
|
childRectItem->setPos(-50, -25);
|
||||||
childRectItem->setParentItem(parentRectItem);
|
childRectItem->setParentItem(parentRectItem);
|
||||||
|
|
||||||
@ -3720,7 +3720,7 @@ void tst_QGraphicsItem::warpChildrenIntoGroup()
|
|||||||
|
|
||||||
QGraphicsRectItem *parentOfGroup = scene.addRect(QRectF(0, 0, 100, 100));
|
QGraphicsRectItem *parentOfGroup = scene.addRect(QRectF(0, 0, 100, 100));
|
||||||
parentOfGroup->setPos(-200, -200);
|
parentOfGroup->setPos(-200, -200);
|
||||||
parentOfGroup->scale(2, 2);
|
parentOfGroup->setTransform(QTransform::fromScale(2, 2), true);
|
||||||
|
|
||||||
QGraphicsItemGroup *group = new QGraphicsItemGroup;
|
QGraphicsItemGroup *group = new QGraphicsItemGroup;
|
||||||
group->setPos(50, 50);
|
group->setPos(50, 50);
|
||||||
@ -4633,7 +4633,7 @@ void tst_QGraphicsItem::itemChange()
|
|||||||
|
|
||||||
// ItemTransformChange / ItemTransformHasChanged
|
// ItemTransformChange / ItemTransformHasChanged
|
||||||
tester.itemChangeReturnValue.setValue<QTransform>(QTransform().rotate(90));
|
tester.itemChangeReturnValue.setValue<QTransform>(QTransform().rotate(90));
|
||||||
tester.translate(50, 0);
|
tester.setTransform(QTransform::fromTranslate(50, 0), true);
|
||||||
++changeCount; // notification sent too
|
++changeCount; // notification sent too
|
||||||
++changeCount;
|
++changeCount;
|
||||||
QCOMPARE(tester.changes.size(), changeCount);
|
QCOMPARE(tester.changes.size(), changeCount);
|
||||||
@ -5362,7 +5362,7 @@ void tst_QGraphicsItem::deleteItemInEventHandlers()
|
|||||||
for (int i = 0; i < 17; ++i) {
|
for (int i = 0; i < 17; ++i) {
|
||||||
QGraphicsScene scene;
|
QGraphicsScene scene;
|
||||||
HarakiriItem *item = new HarakiriItem(i);
|
HarakiriItem *item = new HarakiriItem(i);
|
||||||
item->setAcceptsHoverEvents(true);
|
item->setAcceptHoverEvents(true);
|
||||||
item->setFlag(QGraphicsItem::ItemIsFocusable);
|
item->setFlag(QGraphicsItem::ItemIsFocusable);
|
||||||
|
|
||||||
scene.addItem(item);
|
scene.addItem(item);
|
||||||
@ -5514,16 +5514,16 @@ void tst_QGraphicsItem::itemClipsChildrenToShape2()
|
|||||||
QGraphicsScene scene;
|
QGraphicsScene scene;
|
||||||
scene.addItem(parent);
|
scene.addItem(parent);
|
||||||
|
|
||||||
QCOMPARE(scene.itemAt(5, 5), (QGraphicsItem *)parent);
|
QCOMPARE(scene.items(QPointF(5, 5)).value(0, Q_NULLPTR), (QGraphicsItem *)parent);
|
||||||
QCOMPARE(scene.itemAt(15, 5), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(15, 5)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(5, 15), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(5, 15)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(60, 60), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(60, 60)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(140, 60), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(140, 60)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(60, 140), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(60, 140)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(140, 140), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(140, 140)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(75, 75), (QGraphicsItem *)child2);
|
QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child2);
|
||||||
QCOMPARE(scene.itemAt(75, 100), (QGraphicsItem *)child1);
|
QCOMPARE(scene.items(QPointF(75, 100)).value(0, Q_NULLPTR), (QGraphicsItem *)child1);
|
||||||
QCOMPARE(scene.itemAt(100, 75), (QGraphicsItem *)child1);
|
QCOMPARE(scene.items(QPointF(100, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child1);
|
||||||
|
|
||||||
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
|
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
|
||||||
image.fill(0);
|
image.fill(0);
|
||||||
@ -5558,20 +5558,20 @@ void tst_QGraphicsItem::itemClipsChildrenToShape3()
|
|||||||
grandchild->setPos( 50, 50 );
|
grandchild->setPos( 50, 50 );
|
||||||
parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
|
parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
|
||||||
|
|
||||||
QCOMPARE(scene.itemAt(25,25), (QGraphicsItem *)parent);
|
QCOMPARE(scene.items(QPointF(25, 25)).value(0, Q_NULLPTR), (QGraphicsItem *)parent);
|
||||||
QCOMPARE(scene.itemAt(75,75), (QGraphicsItem *)child);
|
QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child);
|
||||||
QCOMPARE(scene.itemAt(125,125), (QGraphicsItem *)grandchild);
|
QCOMPARE(scene.items(QPointF(125, 125)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild);
|
||||||
QCOMPARE(scene.itemAt(175,175), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(175, 175)).isEmpty());
|
||||||
|
|
||||||
// Move child to fully overlap the parent. The grandchild should
|
// Move child to fully overlap the parent. The grandchild should
|
||||||
// now occupy two-thirds of the scene
|
// now occupy two-thirds of the scene
|
||||||
child->prepareGeometryChange();
|
child->prepareGeometryChange();
|
||||||
child->setPos( 0, 0 );
|
child->setPos( 0, 0 );
|
||||||
|
|
||||||
QCOMPARE(scene.itemAt(25,25), (QGraphicsItem *)child);
|
QCOMPARE(scene.items(QPointF(25, 25)).value(0, Q_NULLPTR), (QGraphicsItem *)child);
|
||||||
QCOMPARE(scene.itemAt(75,75), (QGraphicsItem *)grandchild);
|
QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild);
|
||||||
QCOMPARE(scene.itemAt(125,125), (QGraphicsItem *)grandchild);
|
QCOMPARE(scene.items(QPointF(125, 125)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild);
|
||||||
QCOMPARE(scene.itemAt(175,175), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(175, 175)).isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyProxyWidget : public QGraphicsProxyWidget
|
class MyProxyWidget : public QGraphicsProxyWidget
|
||||||
@ -5843,17 +5843,17 @@ void tst_QGraphicsItem::itemClippingDiscovery()
|
|||||||
rightRectItem->setParentItem(clipItem);
|
rightRectItem->setParentItem(clipItem);
|
||||||
|
|
||||||
// The rects item are both visible at these points.
|
// The rects item are both visible at these points.
|
||||||
QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)leftRectItem);
|
QCOMPARE(scene.items(QPointF(10, 10)).value(0, Q_NULLPTR), (QGraphicsItem *)leftRectItem);
|
||||||
QCOMPARE(scene.itemAt(90, 90), (QGraphicsItem *)rightRectItem);
|
QCOMPARE(scene.items(QPointF(90, 90)).value(0, Q_NULLPTR), (QGraphicsItem *)rightRectItem);
|
||||||
|
|
||||||
// The ellipse clips the rects now.
|
// The ellipse clips the rects now.
|
||||||
clipItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
|
clipItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
|
||||||
|
|
||||||
// The rect items are no longer visible at these points.
|
// The rect items are no longer visible at these points.
|
||||||
QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(10, 10)).isEmpty());
|
||||||
if (sizeof(qreal) != sizeof(double))
|
if (sizeof(qreal) != sizeof(double))
|
||||||
QSKIP("This fails due to internal rounding errors");
|
QSKIP("This fails due to internal rounding errors");
|
||||||
QCOMPARE(scene.itemAt(90, 90), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(90, 90)).isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
class ItemCountsBoundingRectCalls : public QGraphicsRectItem
|
class ItemCountsBoundingRectCalls : public QGraphicsRectItem
|
||||||
@ -5884,7 +5884,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
|
|||||||
int oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
|
int oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
|
||||||
|
|
||||||
// First test that both items are searched if no optimization flags are set
|
// First test that both items are searched if no optimization flags are set
|
||||||
QGraphicsItem* item = scene.itemAt(25,5);
|
QGraphicsItem* item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR);
|
||||||
|
|
||||||
QCOMPARE(item, childOutsideShape);
|
QCOMPARE(item, childOutsideShape);
|
||||||
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
|
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
|
||||||
@ -5895,7 +5895,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
|
|||||||
oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
|
oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
|
||||||
|
|
||||||
// Repeat the test to make sure that no caching/indexing is in effect
|
// Repeat the test to make sure that no caching/indexing is in effect
|
||||||
item = scene.itemAt(25,5);
|
item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR);
|
||||||
|
|
||||||
QCOMPARE(item, childOutsideShape);
|
QCOMPARE(item, childOutsideShape);
|
||||||
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
|
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
|
||||||
@ -5908,7 +5908,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
|
|||||||
// Set the optimization flag and make sure that the child is not returned
|
// Set the optimization flag and make sure that the child is not returned
|
||||||
// and that the child's boundingRect() method is never called.
|
// and that the child's boundingRect() method is never called.
|
||||||
parent->setFlag(QGraphicsItem::ItemContainsChildrenInShape);
|
parent->setFlag(QGraphicsItem::ItemContainsChildrenInShape);
|
||||||
item = scene.itemAt(25,5);
|
item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR);
|
||||||
|
|
||||||
QVERIFY(!(item));
|
QVERIFY(!(item));
|
||||||
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
|
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
|
||||||
@ -6216,12 +6216,12 @@ void tst_QGraphicsItem::untransformable()
|
|||||||
QGraphicsItem *item1 = new QGraphicsEllipseItem(QRectF(-50, -50, 100, 100));
|
QGraphicsItem *item1 = new QGraphicsEllipseItem(QRectF(-50, -50, 100, 100));
|
||||||
item1->setZValue(1);
|
item1->setZValue(1);
|
||||||
item1->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
item1->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||||
item1->rotate(45);
|
item1->setTransform(QTransform().rotate(45), true);
|
||||||
((QGraphicsEllipseItem *)item1)->setBrush(Qt::red);
|
((QGraphicsEllipseItem *)item1)->setBrush(Qt::red);
|
||||||
|
|
||||||
QGraphicsItem *item2 = new QGraphicsEllipseItem(QRectF(-50, -50, 100, 100));
|
QGraphicsItem *item2 = new QGraphicsEllipseItem(QRectF(-50, -50, 100, 100));
|
||||||
item2->setParentItem(item1);
|
item2->setParentItem(item1);
|
||||||
item2->rotate(45);
|
item2->setTransform(QTransform().rotate(45), true);
|
||||||
item2->setPos(100, 0);
|
item2->setPos(100, 0);
|
||||||
((QGraphicsEllipseItem *)item2)->setBrush(Qt::green);
|
((QGraphicsEllipseItem *)item2)->setBrush(Qt::green);
|
||||||
|
|
||||||
@ -6460,10 +6460,11 @@ void tst_QGraphicsItem::task177918_lineItemUndetected()
|
|||||||
QGraphicsLineItem *line = scene.addLine(10, 10, 10, 10);
|
QGraphicsLineItem *line = scene.addLine(10, 10, 10, 10);
|
||||||
QCOMPARE(line->boundingRect(), QRectF(10, 10, 0, 0));
|
QCOMPARE(line->boundingRect(), QRectF(10, 10, 0, 0));
|
||||||
|
|
||||||
QVERIFY(!scene.items(9, 9, 2, 2, Qt::IntersectsItemShape).isEmpty());
|
const QRectF rect(9, 9, 2, 2);
|
||||||
QVERIFY(!scene.items(9, 9, 2, 2, Qt::ContainsItemShape).isEmpty());
|
QVERIFY(!scene.items(rect, Qt::IntersectsItemShape).isEmpty());
|
||||||
QVERIFY(!scene.items(9, 9, 2, 2, Qt::IntersectsItemBoundingRect).isEmpty());
|
QVERIFY(!scene.items(rect, Qt::ContainsItemShape).isEmpty());
|
||||||
QVERIFY(!scene.items(9, 9, 2, 2, Qt::ContainsItemBoundingRect).isEmpty());
|
QVERIFY(!scene.items(rect, Qt::IntersectsItemBoundingRect).isEmpty());
|
||||||
|
QVERIFY(!scene.items(rect, Qt::ContainsItemBoundingRect).isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QGraphicsItem::task240400_clickOnTextItem_data()
|
void tst_QGraphicsItem::task240400_clickOnTextItem_data()
|
||||||
@ -6699,8 +6700,8 @@ void tst_QGraphicsItem::itemTransform_parentChild()
|
|||||||
QGraphicsItem *child = scene.addRect(0, 0, 100, 100);
|
QGraphicsItem *child = scene.addRect(0, 0, 100, 100);
|
||||||
child->setParentItem(parent);
|
child->setParentItem(parent);
|
||||||
child->setPos(10, 10);
|
child->setPos(10, 10);
|
||||||
child->scale(2, 2);
|
child->setTransform(QTransform::fromScale(2, 2), true);
|
||||||
child->rotate(90);
|
child->setTransform(QTransform().rotate(90), true);
|
||||||
|
|
||||||
QCOMPARE(child->itemTransform(parent).map(QPointF(10, 10)), QPointF(-10, 30));
|
QCOMPARE(child->itemTransform(parent).map(QPointF(10, 10)), QPointF(-10, 30));
|
||||||
QCOMPARE(parent->itemTransform(child).map(QPointF(-10, 30)), QPointF(10, 10));
|
QCOMPARE(parent->itemTransform(child).map(QPointF(-10, 30)), QPointF(10, 10));
|
||||||
@ -6712,19 +6713,19 @@ void tst_QGraphicsItem::itemTransform_siblings()
|
|||||||
QGraphicsItem *parent = scene.addRect(0, 0, 100, 100);
|
QGraphicsItem *parent = scene.addRect(0, 0, 100, 100);
|
||||||
QGraphicsItem *brother = scene.addRect(0, 0, 100, 100);
|
QGraphicsItem *brother = scene.addRect(0, 0, 100, 100);
|
||||||
QGraphicsItem *sister = scene.addRect(0, 0, 100, 100);
|
QGraphicsItem *sister = scene.addRect(0, 0, 100, 100);
|
||||||
parent->scale(10, 5);
|
parent->setTransform(QTransform::fromScale(10, 5), true);
|
||||||
parent->rotate(-180);
|
parent->setTransform(QTransform().rotate(-180), true);
|
||||||
parent->shear(2, 3);
|
parent->setTransform(QTransform().shear(2, 3), true);
|
||||||
|
|
||||||
brother->setParentItem(parent);
|
brother->setParentItem(parent);
|
||||||
sister->setParentItem(parent);
|
sister->setParentItem(parent);
|
||||||
|
|
||||||
brother->setPos(10, 10);
|
brother->setPos(10, 10);
|
||||||
brother->scale(2, 2);
|
brother->setTransform(QTransform::fromScale(2, 2), true);
|
||||||
brother->rotate(90);
|
brother->setTransform(QTransform().rotate(90), true);
|
||||||
sister->setPos(10, 10);
|
sister->setPos(10, 10);
|
||||||
sister->scale(2, 2);
|
sister->setTransform(QTransform::fromScale(2, 2), true);
|
||||||
sister->rotate(90);
|
sister->setTransform(QTransform().rotate(90), true);
|
||||||
|
|
||||||
QCOMPARE(brother->itemTransform(sister).map(QPointF(10, 10)), QPointF(10, 10));
|
QCOMPARE(brother->itemTransform(sister).map(QPointF(10, 10)), QPointF(10, 10));
|
||||||
QCOMPARE(sister->itemTransform(brother).map(QPointF(10, 10)), QPointF(10, 10));
|
QCOMPARE(sister->itemTransform(brother).map(QPointF(10, 10)), QPointF(10, 10));
|
||||||
@ -6736,11 +6737,11 @@ void tst_QGraphicsItem::itemTransform_unrelated()
|
|||||||
QGraphicsItem *stranger1 = scene.addRect(0, 0, 100, 100);
|
QGraphicsItem *stranger1 = scene.addRect(0, 0, 100, 100);
|
||||||
QGraphicsItem *stranger2 = scene.addRect(0, 0, 100, 100);
|
QGraphicsItem *stranger2 = scene.addRect(0, 0, 100, 100);
|
||||||
stranger1->setPos(10, 10);
|
stranger1->setPos(10, 10);
|
||||||
stranger1->scale(2, 2);
|
stranger1->setTransform(QTransform::fromScale(2, 2), true);
|
||||||
stranger1->rotate(90);
|
stranger1->setTransform(QTransform().rotate(90), true);
|
||||||
stranger2->setPos(10, 10);
|
stranger2->setPos(10, 10);
|
||||||
stranger2->scale(2, 2);
|
stranger2->setTransform(QTransform::fromScale(2, 2), true);
|
||||||
stranger2->rotate(90);
|
stranger2->setTransform(QTransform().rotate(90), true);
|
||||||
|
|
||||||
QCOMPARE(stranger1->itemTransform(stranger2).map(QPointF(10, 10)), QPointF(10, 10));
|
QCOMPARE(stranger1->itemTransform(stranger2).map(QPointF(10, 10)), QPointF(10, 10));
|
||||||
QCOMPARE(stranger2->itemTransform(stranger1).map(QPointF(10, 10)), QPointF(10, 10));
|
QCOMPARE(stranger2->itemTransform(stranger1).map(QPointF(10, 10)), QPointF(10, 10));
|
||||||
@ -7022,7 +7023,8 @@ void tst_QGraphicsItem::itemStacksBehindParent()
|
|||||||
paintedItems.clear();
|
paintedItems.clear();
|
||||||
view.viewport()->update();
|
view.viewport()->update();
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
QTRY_COMPARE(scene.items(0, 0, 100, 100), (QList<QGraphicsItem *>()
|
QRectF rect(0, 0, 100, 100);
|
||||||
|
QTRY_COMPARE(scene.items(rect), (QList<QGraphicsItem *>()
|
||||||
<< grandChild111 << child11
|
<< grandChild111 << child11
|
||||||
<< grandChild121 << child12 << parent1
|
<< grandChild121 << child12 << parent1
|
||||||
<< grandChild211 << child21
|
<< grandChild211 << child21
|
||||||
@ -7038,7 +7040,7 @@ void tst_QGraphicsItem::itemStacksBehindParent()
|
|||||||
paintedItems.clear();
|
paintedItems.clear();
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
|
|
||||||
QTRY_COMPARE(scene.items(0, 0, 100, 100), (QList<QGraphicsItem *>()
|
QTRY_COMPARE(scene.items(rect), (QList<QGraphicsItem *>()
|
||||||
<< grandChild121 << child12 << parent1
|
<< grandChild121 << child12 << parent1
|
||||||
<< grandChild111 << child11
|
<< grandChild111 << child11
|
||||||
<< grandChild211 << child21
|
<< grandChild211 << child21
|
||||||
@ -7054,7 +7056,7 @@ void tst_QGraphicsItem::itemStacksBehindParent()
|
|||||||
scene.update();
|
scene.update();
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
|
|
||||||
QTRY_COMPARE(scene.items(0, 0, 100, 100), (QList<QGraphicsItem *>()
|
QTRY_COMPARE(scene.items(rect), (QList<QGraphicsItem *>()
|
||||||
<< parent1 << grandChild111 << child11
|
<< parent1 << grandChild111 << child11
|
||||||
<< grandChild121 << child12
|
<< grandChild121 << child12
|
||||||
<< grandChild211 << child21
|
<< grandChild211 << child21
|
||||||
@ -7221,12 +7223,12 @@ void tst_QGraphicsItem::sceneTransformCache()
|
|||||||
QGraphicsRectItem *rect2 = scene.addRect(0, 0, 100, 100);
|
QGraphicsRectItem *rect2 = scene.addRect(0, 0, 100, 100);
|
||||||
rect2->setPen(QPen(Qt::black, 0));
|
rect2->setPen(QPen(Qt::black, 0));
|
||||||
rect2->setParentItem(rect);
|
rect2->setParentItem(rect);
|
||||||
rect2->rotate(90);
|
rect2->setTransform(QTransform().rotate(90), true);
|
||||||
rect->translate(0, 50);
|
rect->setTransform(QTransform::fromTranslate(0, 50), true);
|
||||||
QGraphicsView view(&scene);
|
QGraphicsView view(&scene);
|
||||||
view.show();
|
view.show();
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||||
rect->translate(0, 100);
|
rect->setTransform(QTransform::fromTranslate(0, 100), true);
|
||||||
QTransform x;
|
QTransform x;
|
||||||
x.translate(0, 150);
|
x.translate(0, 150);
|
||||||
x.rotate(90);
|
x.rotate(90);
|
||||||
@ -7390,14 +7392,14 @@ void tst_QGraphicsItem::cacheMode()
|
|||||||
QCOMPARE(testerChild2->repaints, 2);
|
QCOMPARE(testerChild2->repaints, 2);
|
||||||
|
|
||||||
// Translating does not result in a repaint.
|
// Translating does not result in a repaint.
|
||||||
tester->translate(10, 10);
|
tester->setTransform(QTransform::fromTranslate(10, 10), true);
|
||||||
QTest::qWait(25);
|
QTest::qWait(25);
|
||||||
QTRY_COMPARE(tester->repaints, 2);
|
QTRY_COMPARE(tester->repaints, 2);
|
||||||
QCOMPARE(testerChild->repaints, 2);
|
QCOMPARE(testerChild->repaints, 2);
|
||||||
QCOMPARE(testerChild2->repaints, 2);
|
QCOMPARE(testerChild2->repaints, 2);
|
||||||
|
|
||||||
// Rotating results in a repaint.
|
// Rotating results in a repaint.
|
||||||
tester->rotate(45);
|
tester->setTransform(QTransform().rotate(45), true);
|
||||||
QTest::qWait(25);
|
QTest::qWait(25);
|
||||||
QTRY_COMPARE(tester->repaints, 3);
|
QTRY_COMPARE(tester->repaints, 3);
|
||||||
QCOMPARE(testerChild->repaints, 3);
|
QCOMPARE(testerChild->repaints, 3);
|
||||||
@ -7413,9 +7415,9 @@ void tst_QGraphicsItem::cacheMode()
|
|||||||
QCOMPARE(testerChild2->repaints, 3);
|
QCOMPARE(testerChild2->repaints, 3);
|
||||||
|
|
||||||
// Rotating items with ItemCoordinateCache doesn't cause a repaint.
|
// Rotating items with ItemCoordinateCache doesn't cause a repaint.
|
||||||
tester->rotate(22);
|
tester->setTransform(QTransform().rotate(22), true);
|
||||||
testerChild->rotate(22);
|
testerChild->setTransform(QTransform().rotate(22), true);
|
||||||
testerChild2->rotate(22);
|
testerChild2->setTransform(QTransform().rotate(22), true);
|
||||||
QTest::qWait(25);
|
QTest::qWait(25);
|
||||||
QTRY_COMPARE(tester->repaints, 4);
|
QTRY_COMPARE(tester->repaints, 4);
|
||||||
QTRY_COMPARE(testerChild->repaints, 4);
|
QTRY_COMPARE(testerChild->repaints, 4);
|
||||||
@ -7728,9 +7730,9 @@ void tst_QGraphicsItem::deviceTransform()
|
|||||||
rect1->setPos(100, 100);
|
rect1->setPos(100, 100);
|
||||||
rect2->setPos(100, 100);
|
rect2->setPos(100, 100);
|
||||||
rect3->setPos(100, 100);
|
rect3->setPos(100, 100);
|
||||||
rect1->rotate(rotation1);
|
rect1->setTransform(QTransform().rotate(rotation1), true);
|
||||||
rect2->rotate(rotation2);
|
rect2->setTransform(QTransform().rotate(rotation2), true);
|
||||||
rect3->rotate(rotation3);
|
rect3->setTransform(QTransform().rotate(rotation3), true);
|
||||||
rect1->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable1);
|
rect1->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable1);
|
||||||
rect2->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable2);
|
rect2->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable2);
|
||||||
rect3->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable3);
|
rect3->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable3);
|
||||||
@ -7863,14 +7865,14 @@ void tst_QGraphicsItem::update()
|
|||||||
expectedRegion = itemDeviceBoundingRect.adjusted(-2, -2, 2, 2);
|
expectedRegion = itemDeviceBoundingRect.adjusted(-2, -2, 2, 2);
|
||||||
view.reset();
|
view.reset();
|
||||||
item->repaints = 0;
|
item->repaints = 0;
|
||||||
parent->translate(-400, 0);
|
parent->setTransform(QTransform::fromTranslate(-400, 0), true);
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
QCOMPARE(item->repaints, 0);
|
QCOMPARE(item->repaints, 0);
|
||||||
QCOMPARE(view.repaints, 1);
|
QCOMPARE(view.repaints, 1);
|
||||||
QCOMPARE(view.paintedRegion, expectedRegion);
|
QCOMPARE(view.paintedRegion, expectedRegion);
|
||||||
view.reset();
|
view.reset();
|
||||||
item->repaints = 0;
|
item->repaints = 0;
|
||||||
parent->translate(400, 0);
|
parent->setTransform(QTransform::fromTranslate(400, 0), true);
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
QCOMPARE(item->repaints, 1);
|
QCOMPARE(item->repaints, 1);
|
||||||
QCOMPARE(view.repaints, 1);
|
QCOMPARE(view.repaints, 1);
|
||||||
@ -8170,7 +8172,7 @@ void tst_QGraphicsItem::moveItem()
|
|||||||
|
|
||||||
RESET_COUNTERS
|
RESET_COUNTERS
|
||||||
|
|
||||||
parent->translate(20, 20);
|
parent->setTransform(QTransform::fromTranslate(20, 20), true);
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
QCOMPARE(parent->repaints, 1);
|
QCOMPARE(parent->repaints, 1);
|
||||||
QCOMPARE(child->repaints, 1);
|
QCOMPARE(child->repaints, 1);
|
||||||
@ -11641,12 +11643,12 @@ void tst_QGraphicsItem::QTBUG_21618_untransformable_sceneTransform()
|
|||||||
|
|
||||||
QGraphicsItem *item1 = scene.addRect(0, 0, 100, 100, QPen(), Qt::red);
|
QGraphicsItem *item1 = scene.addRect(0, 0, 100, 100, QPen(), Qt::red);
|
||||||
item1->setPos(50, 50);
|
item1->setPos(50, 50);
|
||||||
item1->translate(50, 50);
|
item1->setTransform(QTransform::fromTranslate(50, 50), true);
|
||||||
item1->rotate(90);
|
item1->setTransform(QTransform().rotate(90), true);
|
||||||
QGraphicsItem *item2 = scene.addRect(0, 0, 100, 100, QPen(), Qt::green);
|
QGraphicsItem *item2 = scene.addRect(0, 0, 100, 100, QPen(), Qt::green);
|
||||||
item2->setPos(50, 50);
|
item2->setPos(50, 50);
|
||||||
item2->translate(50, 50);
|
item2->setTransform(QTransform::fromTranslate(50, 50), true);
|
||||||
item2->rotate(90);
|
item2->setTransform(QTransform().rotate(90), true);
|
||||||
item2->setFlags(QGraphicsItem::ItemIgnoresTransformations);
|
item2->setFlags(QGraphicsItem::ItemIgnoresTransformations);
|
||||||
|
|
||||||
QGraphicsRectItem *item1_topleft = new QGraphicsRectItem(QRectF(-2, -2, 4, 4));
|
QGraphicsRectItem *item1_topleft = new QGraphicsRectItem(QRectF(-2, -2, 4, 4));
|
||||||
|
@ -6,4 +6,3 @@ QT += core-private gui-private
|
|||||||
|
|
||||||
SOURCES += tst_qgraphicsproxywidget.cpp
|
SOURCES += tst_qgraphicsproxywidget.cpp
|
||||||
|
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -491,7 +491,7 @@ void tst_QGraphicsProxyWidget::setWidget()
|
|||||||
QCOMPARE(proxy->rect().toRect(), widget->rect());
|
QCOMPARE(proxy->rect().toRect(), widget->rect());
|
||||||
QCOMPARE(proxy->focusPolicy(), Qt::WheelFocus);
|
QCOMPARE(proxy->focusPolicy(), Qt::WheelFocus);
|
||||||
QVERIFY(proxy->acceptDrops());
|
QVERIFY(proxy->acceptDrops());
|
||||||
QCOMPARE(proxy->acceptsHoverEvents(), true); // to get widget enter events
|
QCOMPARE(proxy->acceptHoverEvents(), true); // to get widget enter events
|
||||||
int left, top, right, bottom;
|
int left, top, right, bottom;
|
||||||
widget->getContentsMargins(&left, &top, &right, &bottom);
|
widget->getContentsMargins(&left, &top, &right, &bottom);
|
||||||
qreal rleft, rtop, rright, rbottom;
|
qreal rleft, rtop, rright, rbottom;
|
||||||
|
@ -17,4 +17,3 @@ wince* {
|
|||||||
DEPLOYMENT += rootFiles renderFiles
|
DEPLOYMENT += rootFiles renderFiles
|
||||||
DEFINES += SRCDIR=\\\".\\\"
|
DEFINES += SRCDIR=\\\".\\\"
|
||||||
}
|
}
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -108,7 +108,7 @@ class HoverItem : public QGraphicsRectItem
|
|||||||
public:
|
public:
|
||||||
HoverItem()
|
HoverItem()
|
||||||
: QGraphicsRectItem(QRectF(-10, -10, 20, 20)), isHovered(false)
|
: QGraphicsRectItem(QRectF(-10, -10, 20, 20)), isHovered(false)
|
||||||
{ setAcceptsHoverEvents(true); }
|
{ setAcceptHoverEvents(true); }
|
||||||
|
|
||||||
bool isHovered;
|
bool isHovered;
|
||||||
|
|
||||||
@ -301,11 +301,16 @@ void tst_QGraphicsScene::construction()
|
|||||||
QVERIFY(scene.items(QPainterPath()).isEmpty());
|
QVERIFY(scene.items(QPainterPath()).isEmpty());
|
||||||
QTest::ignoreMessage(QtWarningMsg, "QGraphicsScene::collidingItems: cannot find collisions for null item");
|
QTest::ignoreMessage(QtWarningMsg, "QGraphicsScene::collidingItems: cannot find collisions for null item");
|
||||||
QVERIFY(scene.collidingItems(0).isEmpty());
|
QVERIFY(scene.collidingItems(0).isEmpty());
|
||||||
QVERIFY(!scene.itemAt(QPointF()));
|
QVERIFY(scene.items(QPointF()).isEmpty());
|
||||||
QVERIFY(scene.selectedItems().isEmpty());
|
QVERIFY(scene.selectedItems().isEmpty());
|
||||||
QVERIFY(!scene.focusItem());
|
QVERIFY(!scene.focusItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline const QGraphicsItem *itemAt(const QGraphicsScene &scene, qreal x, qreal y)
|
||||||
|
{
|
||||||
|
return scene.items(QPointF(x, y)).value(0, Q_NULLPTR);
|
||||||
|
}
|
||||||
|
|
||||||
void tst_QGraphicsScene::sceneRect()
|
void tst_QGraphicsScene::sceneRect()
|
||||||
{
|
{
|
||||||
QGraphicsScene scene;
|
QGraphicsScene scene;
|
||||||
@ -318,8 +323,8 @@ void tst_QGraphicsScene::sceneRect()
|
|||||||
item->setPos(-5, -5);
|
item->setPos(-5, -5);
|
||||||
QCOMPARE(sceneRectChanged.count(), 0);
|
QCOMPARE(sceneRectChanged.count(), 0);
|
||||||
|
|
||||||
QCOMPARE(scene.itemAt(0, 0), item);
|
QCOMPARE(itemAt(scene, 0, 0), item);
|
||||||
QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(10, 10)).isEmpty());
|
||||||
QCOMPARE(sceneRectChanged.count(), 0);
|
QCOMPARE(sceneRectChanged.count(), 0);
|
||||||
QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 10, 10));
|
QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 10, 10));
|
||||||
QCOMPARE(sceneRectChanged.count(), 1);
|
QCOMPARE(sceneRectChanged.count(), 1);
|
||||||
@ -334,8 +339,8 @@ void tst_QGraphicsScene::sceneRect()
|
|||||||
QCOMPARE(sceneRectChanged.count(), 3);
|
QCOMPARE(sceneRectChanged.count(), 3);
|
||||||
QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect());
|
QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect());
|
||||||
|
|
||||||
QCOMPARE(scene.itemAt(0, 0), item);
|
QCOMPARE(itemAt(scene, 0, 0), item);
|
||||||
QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(10, 10)).isEmpty());
|
||||||
QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10));
|
QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10));
|
||||||
item->setPos(10, 10);
|
item->setPos(10, 10);
|
||||||
QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10));
|
QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10));
|
||||||
@ -344,8 +349,8 @@ void tst_QGraphicsScene::sceneRect()
|
|||||||
|
|
||||||
scene.setSceneRect(QRectF());
|
scene.setSceneRect(QRectF());
|
||||||
|
|
||||||
QCOMPARE(scene.itemAt(10, 10), item);
|
QCOMPARE(itemAt(scene, 10, 10), item);
|
||||||
QCOMPARE(scene.itemAt(20, 20), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(20, 20)).isEmpty());
|
||||||
QCOMPARE(sceneRectChanged.count(), 4);
|
QCOMPARE(sceneRectChanged.count(), 4);
|
||||||
QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 25, 25));
|
QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 25, 25));
|
||||||
QCOMPARE(sceneRectChanged.count(), 5);
|
QCOMPARE(sceneRectChanged.count(), 5);
|
||||||
@ -374,7 +379,7 @@ void tst_QGraphicsScene::itemIndexMethod()
|
|||||||
for (int x = minX; x < maxX; x += 100) {
|
for (int x = minX; x < maxX; x += 100) {
|
||||||
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10));
|
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10));
|
||||||
item->setPos(x, y);
|
item->setPos(x, y);
|
||||||
QCOMPARE(scene.itemAt(x, y), item);
|
QCOMPARE(itemAt(scene, x, y), item);
|
||||||
items << item;
|
items << item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -382,7 +387,7 @@ void tst_QGraphicsScene::itemIndexMethod()
|
|||||||
int n = 0;
|
int n = 0;
|
||||||
for (int y = minY; y < maxY; y += 100) {
|
for (int y = minY; y < maxY; y += 100) {
|
||||||
for (int x = minX; x < maxX; x += 100)
|
for (int x = minX; x < maxX; x += 100)
|
||||||
QCOMPARE(scene.itemAt(x, y), items.at(n++));
|
QCOMPARE(itemAt(scene, x, y), items.at(n++));
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.setItemIndexMethod(QGraphicsScene::NoIndex);
|
scene.setItemIndexMethod(QGraphicsScene::NoIndex);
|
||||||
@ -391,7 +396,7 @@ void tst_QGraphicsScene::itemIndexMethod()
|
|||||||
n = 0;
|
n = 0;
|
||||||
for (int y = minY; y < maxY; y += 100) {
|
for (int y = minY; y < maxY; y += 100) {
|
||||||
for (int x = minX; x < maxX; x += 100)
|
for (int x = minX; x < maxX; x += 100)
|
||||||
QCOMPARE(scene.itemAt(x, y), items.at(n++));
|
QCOMPARE(itemAt(scene, x, y), items.at(n++));
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.setItemIndexMethod(QGraphicsScene::BspTreeIndex);
|
scene.setItemIndexMethod(QGraphicsScene::BspTreeIndex);
|
||||||
@ -400,7 +405,7 @@ void tst_QGraphicsScene::itemIndexMethod()
|
|||||||
n = 0;
|
n = 0;
|
||||||
for (int y = minY; y < maxY; y += 100) {
|
for (int y = minY; y < maxY; y += 100) {
|
||||||
for (int x = minX; x < maxX; x += 100)
|
for (int x = minX; x < maxX; x += 100)
|
||||||
QCOMPARE(scene.itemAt(x, y), items.at(n++));
|
QCOMPARE(itemAt(scene, x, y), items.at(n++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,7 +444,7 @@ void tst_QGraphicsScene::items()
|
|||||||
items << scene.addRect(QRectF(0, 0, 10, 10));
|
items << scene.addRect(QRectF(0, 0, 10, 10));
|
||||||
}
|
}
|
||||||
QCOMPARE(scene.items().size(), items.size());
|
QCOMPARE(scene.items().size(), items.size());
|
||||||
scene.itemAt(0, 0); // trigger indexing
|
itemAt(scene, 0, 0); // trigger indexing
|
||||||
|
|
||||||
scene.removeItem(items.at(5));
|
scene.removeItem(items.at(5));
|
||||||
delete items.at(5);
|
delete items.at(5);
|
||||||
@ -458,8 +463,8 @@ void tst_QGraphicsScene::items()
|
|||||||
QList<QGraphicsItem *> items;
|
QList<QGraphicsItem *> items;
|
||||||
items<<l1<<l2;
|
items<<l1<<l2;
|
||||||
QCOMPARE(scene.items().size(), items.size());
|
QCOMPARE(scene.items().size(), items.size());
|
||||||
QVERIFY(scene.items(-1, -1, 2, 2).contains(l1));
|
QVERIFY(scene.items(QRectF(-1, -1, 2, 2)).contains(l1));
|
||||||
QVERIFY(scene.items(-1, -1, 2, 2).contains(l2));
|
QVERIFY(scene.items(QRectF(-1, -1, 2, 2)).contains(l2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -722,7 +727,7 @@ void tst_QGraphicsScene::items_QRectF_2()
|
|||||||
QGraphicsItem *item = scene.addEllipse(ellipseRect);
|
QGraphicsItem *item = scene.addEllipse(ellipseRect);
|
||||||
|
|
||||||
QCOMPARE(!scene.items(sceneRect, selectionMode).isEmpty(), contained);
|
QCOMPARE(!scene.items(sceneRect, selectionMode).isEmpty(), contained);
|
||||||
item->rotate(45);
|
item->setTransform(QTransform().rotate(45), true);
|
||||||
QCOMPARE(!scene.items(sceneRect, selectionMode).isEmpty(), containedRotated);
|
QCOMPARE(!scene.items(sceneRect, selectionMode).isEmpty(), containedRotated);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1085,19 +1090,19 @@ void tst_QGraphicsScene::addItem()
|
|||||||
QTRY_VERIFY(view.repaints > 0);
|
QTRY_VERIFY(view.repaints > 0);
|
||||||
view.repaints = 0;
|
view.repaints = 0;
|
||||||
|
|
||||||
QCOMPARE(scene.itemAt(0, 0), path);
|
QCOMPARE(itemAt(scene, 0, 0), path);
|
||||||
|
|
||||||
QGraphicsItem *path2 = new QGraphicsEllipseItem(QRectF(-10, -10, 20, 20));
|
QGraphicsItem *path2 = new QGraphicsEllipseItem(QRectF(-10, -10, 20, 20));
|
||||||
path2->setPos(100, 100);
|
path2->setPos(100, 100);
|
||||||
|
|
||||||
QCOMPARE(scene.itemAt(0, 0), path);
|
QCOMPARE(itemAt(scene, 0, 0), path);
|
||||||
QCOMPARE(scene.itemAt(100, 100), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(100, 100)).isEmpty());
|
||||||
scene.addItem(path2);
|
scene.addItem(path2);
|
||||||
|
|
||||||
// Adding an item should always issue a repaint.
|
// Adding an item should always issue a repaint.
|
||||||
QTRY_VERIFY(view.repaints > 0);
|
QTRY_VERIFY(view.repaints > 0);
|
||||||
|
|
||||||
QCOMPARE(scene.itemAt(100, 100), path2);
|
QCOMPARE(itemAt(scene, 100, 100), path2);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// 2) Create scene, then item, then add item
|
// 2) Create scene, then item, then add item
|
||||||
@ -1109,8 +1114,8 @@ void tst_QGraphicsScene::addItem()
|
|||||||
path2->setPos(100, 100);
|
path2->setPos(100, 100);
|
||||||
scene.addItem(path2);
|
scene.addItem(path2);
|
||||||
|
|
||||||
QCOMPARE(scene.itemAt(0, 0), path);
|
QCOMPARE(itemAt(scene, 0, 0), path);
|
||||||
QCOMPARE(scene.itemAt(100, 100), path2);
|
QCOMPARE(itemAt(scene, 100, 100), path2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1123,15 +1128,15 @@ void tst_QGraphicsScene::addEllipse()
|
|||||||
QCOMPARE(ellipse->pen(), QPen(Qt::red));
|
QCOMPARE(ellipse->pen(), QPen(Qt::red));
|
||||||
QCOMPARE(ellipse->brush(), QBrush(Qt::blue));
|
QCOMPARE(ellipse->brush(), QBrush(Qt::blue));
|
||||||
QCOMPARE(ellipse->rect(), QRectF(-10, -10, 20, 20));
|
QCOMPARE(ellipse->rect(), QRectF(-10, -10, 20, 20));
|
||||||
QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)ellipse);
|
QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)ellipse);
|
||||||
QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(-10, -10)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)ellipse);
|
QCOMPARE(itemAt(scene, -9.9, 0), (QGraphicsItem *)ellipse);
|
||||||
QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(-10, 10)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)ellipse);
|
QCOMPARE(itemAt(scene, 0, -9.9), (QGraphicsItem *)ellipse);
|
||||||
QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)ellipse);
|
QCOMPARE(itemAt(scene, 0, 9.9), (QGraphicsItem *)ellipse);
|
||||||
QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(10, -10)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)ellipse);
|
QCOMPARE(itemAt(scene, 9.9, 0), (QGraphicsItem *)ellipse);
|
||||||
QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(10, 10)).isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QGraphicsScene::addLine()
|
void tst_QGraphicsScene::addLine()
|
||||||
@ -1144,15 +1149,15 @@ void tst_QGraphicsScene::addLine()
|
|||||||
QCOMPARE(line->pos(), QPointF());
|
QCOMPARE(line->pos(), QPointF());
|
||||||
QCOMPARE(line->pen(), pen);
|
QCOMPARE(line->pen(), pen);
|
||||||
QCOMPARE(line->line(), QLineF(-10, -10, 20, 20));
|
QCOMPARE(line->line(), QLineF(-10, -10, 20, 20));
|
||||||
QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)line);
|
QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)line);
|
||||||
QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)line);
|
QCOMPARE(itemAt(scene, -10, -10), (QGraphicsItem *)line);
|
||||||
QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(-9.9, 0)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(-10, 10)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(0, -9.9)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(0, 9.9)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(10, -10)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(9.9, 0)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)line);
|
QCOMPARE(itemAt(scene, 10, 10), (QGraphicsItem *)line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QGraphicsScene::addPath()
|
void tst_QGraphicsScene::addPath()
|
||||||
@ -1170,27 +1175,27 @@ void tst_QGraphicsScene::addPath()
|
|||||||
|
|
||||||
path->setPen(QPen(Qt::red, 0));
|
path->setPen(QPen(Qt::red, 0));
|
||||||
|
|
||||||
QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)path);
|
QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)path);
|
||||||
QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)path);
|
QCOMPARE(itemAt(scene, -9.9, 0), (QGraphicsItem *)path);
|
||||||
QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)path);
|
QCOMPARE(itemAt(scene, 9.9, 0), (QGraphicsItem *)path);
|
||||||
QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)path);
|
QCOMPARE(itemAt(scene, 0, -9.9), (QGraphicsItem *)path);
|
||||||
QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)path);
|
QCOMPARE(itemAt(scene, 0, 9.9), (QGraphicsItem *)path);
|
||||||
QCOMPARE(scene.itemAt(0, 30), (QGraphicsItem *)path);
|
QCOMPARE(itemAt(scene, 0, 30), (QGraphicsItem *)path);
|
||||||
QCOMPARE(scene.itemAt(-9.9, 30), (QGraphicsItem *)path);
|
QCOMPARE(itemAt(scene, -9.9, 30), (QGraphicsItem *)path);
|
||||||
QCOMPARE(scene.itemAt(9.9, 30), (QGraphicsItem *)path);
|
QCOMPARE(itemAt(scene, 9.9, 30), (QGraphicsItem *)path);
|
||||||
QCOMPARE(scene.itemAt(0, 20.1), (QGraphicsItem *)path);
|
QCOMPARE(itemAt(scene, 0, 20.1), (QGraphicsItem *)path);
|
||||||
QCOMPARE(scene.itemAt(0, 39.9), (QGraphicsItem *)path);
|
QCOMPARE(itemAt(scene, 0, 39.9), (QGraphicsItem *)path);
|
||||||
QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(-10, -10)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(10, -10)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(-10, 10)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(10, 10)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(-10, 20), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(-10, 20)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(10, 20), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(10, 20)).isEmpty());
|
||||||
if (sizeof(qreal) != sizeof(double))
|
if (sizeof(qreal) != sizeof(double))
|
||||||
QWARN("Skipping test because of rounding errors when qreal != double");
|
QWARN("Skipping test because of rounding errors when qreal != double");
|
||||||
else
|
else
|
||||||
QCOMPARE(scene.itemAt(-10, 30), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(-10, 30)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(10.1, 30), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(10.1, 30)).isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QGraphicsScene::addPixmap()
|
void tst_QGraphicsScene::addPixmap()
|
||||||
@ -1201,16 +1206,17 @@ void tst_QGraphicsScene::addPixmap()
|
|||||||
|
|
||||||
QCOMPARE(pixmap->pos(), QPointF());
|
QCOMPARE(pixmap->pos(), QPointF());
|
||||||
QCOMPARE(pixmap->pixmap(), pix);
|
QCOMPARE(pixmap->pixmap(), pix);
|
||||||
QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)pixmap);
|
QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)pixmap);
|
||||||
QCOMPARE(scene.itemAt(pix.width() - 1, 0), (QGraphicsItem *)pixmap);
|
QCOMPARE(itemAt(scene, pix.width() - 1, 0), (QGraphicsItem *)pixmap);
|
||||||
QCOMPARE(scene.itemAt(0, pix.height() - 1), (QGraphicsItem *)pixmap);
|
QCOMPARE(itemAt(scene, 0, pix.height() - 1), (QGraphicsItem *)pixmap);
|
||||||
QCOMPARE(scene.itemAt(pix.width() - 1, pix.height() - 1), (QGraphicsItem *)pixmap);
|
QCOMPARE(itemAt(scene, pix.width() - 1, pix.height() - 1), (QGraphicsItem *)pixmap);
|
||||||
QCOMPARE(scene.itemAt(-1, -1), (QGraphicsItem *)0);
|
|
||||||
QCOMPARE(scene.itemAt(pix.width() - 1, -1), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(-1, -1)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(-1, pix.height() - 1), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(pix.width() - 1, -1)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(pix.width(), pix.height()), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(-1, pix.height() - 1)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(0, pix.height()), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(pix.width(), pix.height())).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(pix.width(), 0), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(0, pix.height())).isEmpty());
|
||||||
|
QVERIFY(scene.items(QPointF(pix.width(), 0)).isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QGraphicsScene::addRect()
|
void tst_QGraphicsScene::addRect()
|
||||||
@ -1225,15 +1231,15 @@ void tst_QGraphicsScene::addRect()
|
|||||||
|
|
||||||
rect->setPen(QPen(Qt::red, 0));
|
rect->setPen(QPen(Qt::red, 0));
|
||||||
|
|
||||||
QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)rect);
|
QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)rect);
|
||||||
QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)rect);
|
QCOMPARE(itemAt(scene, -10, -10), (QGraphicsItem *)rect);
|
||||||
QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)rect);
|
QCOMPARE(itemAt(scene, -9.9, 0), (QGraphicsItem *)rect);
|
||||||
QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(-10, 10)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)rect);
|
QCOMPARE(itemAt(scene, 0, -9.9), (QGraphicsItem *)rect);
|
||||||
QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)rect);
|
QCOMPARE(itemAt(scene, 0, 9.9), (QGraphicsItem *)rect);
|
||||||
QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(10, -10)).isEmpty());
|
||||||
QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)rect);
|
QCOMPARE(itemAt(scene, 9.9, 0), (QGraphicsItem *)rect);
|
||||||
QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(10, 10)).isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QGraphicsScene::addText()
|
void tst_QGraphicsScene::addText()
|
||||||
@ -1252,14 +1258,14 @@ void tst_QGraphicsScene::removeItem()
|
|||||||
#endif
|
#endif
|
||||||
QGraphicsScene scene;
|
QGraphicsScene scene;
|
||||||
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10));
|
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10));
|
||||||
QCOMPARE(scene.itemAt(0, 0), item); // forces indexing
|
QCOMPARE(itemAt(scene, 0, 0), item); // forces indexing
|
||||||
scene.removeItem(item);
|
scene.removeItem(item);
|
||||||
QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)0);
|
QVERIFY(scene.items(QPointF(0, 0)).isEmpty());
|
||||||
delete item;
|
delete item;
|
||||||
|
|
||||||
QGraphicsItem *item2 = scene.addRect(QRectF(0, 0, 10, 10));
|
QGraphicsItem *item2 = scene.addRect(QRectF(0, 0, 10, 10));
|
||||||
item2->setFlag(QGraphicsItem::ItemIsSelectable);
|
item2->setFlag(QGraphicsItem::ItemIsSelectable);
|
||||||
QCOMPARE(scene.itemAt(0, 0), item2);
|
QCOMPARE(itemAt(scene, 0, 0), item2);
|
||||||
|
|
||||||
// Removing a selected item
|
// Removing a selected item
|
||||||
QVERIFY(scene.selectedItems().isEmpty());
|
QVERIFY(scene.selectedItems().isEmpty());
|
||||||
@ -1289,7 +1295,7 @@ void tst_QGraphicsScene::removeItem()
|
|||||||
QTRY_VERIFY(hoverItem->isHovered);
|
QTRY_VERIFY(hoverItem->isHovered);
|
||||||
|
|
||||||
scene.removeItem(hoverItem);
|
scene.removeItem(hoverItem);
|
||||||
hoverItem->setAcceptsHoverEvents(false);
|
hoverItem->setAcceptHoverEvents(false);
|
||||||
scene.addItem(hoverItem);
|
scene.addItem(hoverItem);
|
||||||
QTRY_VERIFY(!hoverItem->isHovered);
|
QTRY_VERIFY(!hoverItem->isHovered);
|
||||||
}
|
}
|
||||||
@ -1801,7 +1807,7 @@ void tst_QGraphicsScene::createItemGroup()
|
|||||||
scene.destroyItemGroup(group);
|
scene.destroyItemGroup(group);
|
||||||
|
|
||||||
QGraphicsItemGroup *emptyGroup = scene.createItemGroup(QList<QGraphicsItem *>());
|
QGraphicsItemGroup *emptyGroup = scene.createItemGroup(QList<QGraphicsItem *>());
|
||||||
QCOMPARE(emptyGroup->children(), QList<QGraphicsItem *>());
|
QVERIFY(emptyGroup->childItems().isEmpty());
|
||||||
QVERIFY(!emptyGroup->parentItem());
|
QVERIFY(!emptyGroup->parentItem());
|
||||||
QCOMPARE(emptyGroup->scene(), &scene);
|
QCOMPARE(emptyGroup->scene(), &scene);
|
||||||
}
|
}
|
||||||
@ -2140,7 +2146,7 @@ void tst_QGraphicsScene::mouseEventPropagation_mouseMove()
|
|||||||
{
|
{
|
||||||
Scene scene;
|
Scene scene;
|
||||||
scene.addRect(QRectF(5, 0, 12, 12));
|
scene.addRect(QRectF(5, 0, 12, 12));
|
||||||
scene.addRect(QRectF(15, 0, 12, 12))->setAcceptsHoverEvents(true);
|
scene.addRect(QRectF(15, 0, 12, 12))->setAcceptHoverEvents(true);
|
||||||
for (int i = 0; i < 30; ++i) {
|
for (int i = 0; i < 30; ++i) {
|
||||||
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseMove);
|
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseMove);
|
||||||
event.setScenePos(QPointF(i, 5));
|
event.setScenePos(QPointF(i, 5));
|
||||||
@ -2800,7 +2806,7 @@ void tst_QGraphicsScene::update()
|
|||||||
rect->setPos(-100, -100);
|
rect->setPos(-100, -100);
|
||||||
|
|
||||||
// This function forces indexing
|
// This function forces indexing
|
||||||
scene.itemAt(0, 0);
|
itemAt(scene, 0, 0);
|
||||||
|
|
||||||
qRegisterMetaType<QList<QRectF> >("QList<QRectF>");
|
qRegisterMetaType<QList<QRectF> >("QList<QRectF>");
|
||||||
QSignalSpy spy(&scene, SIGNAL(changed(QList<QRectF>)));
|
QSignalSpy spy(&scene, SIGNAL(changed(QList<QRectF>)));
|
||||||
@ -2809,7 +2815,7 @@ void tst_QGraphicsScene::update()
|
|||||||
scene.update();
|
scene.update();
|
||||||
|
|
||||||
// This function forces a purge, which will post an update signal
|
// This function forces a purge, which will post an update signal
|
||||||
scene.itemAt(0, 0);
|
itemAt(scene, 0, 0);
|
||||||
|
|
||||||
// This will process the pending update
|
// This will process the pending update
|
||||||
QApplication::instance()->processEvents();
|
QApplication::instance()->processEvents();
|
||||||
@ -3257,10 +3263,11 @@ void tst_QGraphicsScene::tabFocus_sceneWithNestedFocusWidgets()
|
|||||||
FocusWidget *widget1_1 = new FocusWidget;
|
FocusWidget *widget1_1 = new FocusWidget;
|
||||||
FocusWidget *widget1_2 = new FocusWidget;
|
FocusWidget *widget1_2 = new FocusWidget;
|
||||||
widget1_1->setParentItem(widget1);
|
widget1_1->setParentItem(widget1);
|
||||||
widget1_1->scale(0.5, 0.5);
|
const QTransform scale(QTransform::fromScale(0.5, 0.5));
|
||||||
|
widget1_1->setTransform(scale, true);
|
||||||
widget1_1->setPos(0, widget1->boundingRect().height() / 2);
|
widget1_1->setPos(0, widget1->boundingRect().height() / 2);
|
||||||
widget1_2->setParentItem(widget1);
|
widget1_2->setParentItem(widget1);
|
||||||
widget1_2->scale(0.5, 0.5);
|
widget1_2->setTransform(scale, true);
|
||||||
widget1_2->setPos(widget1->boundingRect().width() / 2, widget1->boundingRect().height() / 2);
|
widget1_2->setPos(widget1->boundingRect().width() / 2, widget1->boundingRect().height() / 2);
|
||||||
|
|
||||||
FocusWidget *widget2 = new FocusWidget;
|
FocusWidget *widget2 = new FocusWidget;
|
||||||
@ -3520,7 +3527,7 @@ void tst_QGraphicsScene::task250680_childClip()
|
|||||||
QVERIFY(QPathCompare::comparePaths(rect->clipPath().simplified(), path));
|
QVERIFY(QPathCompare::comparePaths(rect->clipPath().simplified(), path));
|
||||||
|
|
||||||
QCOMPARE(scene.items(QRectF(320, 240, 5, 5)).size(), 2);
|
QCOMPARE(scene.items(QRectF(320, 240, 5, 5)).size(), 2);
|
||||||
rect->rotate(45);
|
rect->setTransform(QTransform().rotate(45), true);
|
||||||
QCOMPARE(scene.items(QRectF(320, 240, 5, 5)).size(), 2);
|
QCOMPARE(scene.items(QRectF(320, 240, 5, 5)).size(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3599,20 +3606,20 @@ void tst_QGraphicsScene::sorting()
|
|||||||
// view.show();
|
// view.show();
|
||||||
|
|
||||||
qDebug() << "items: {";
|
qDebug() << "items: {";
|
||||||
foreach (QGraphicsItem *item, scene.items(32, 31, 4, 55))
|
foreach (QGraphicsItem *item, scene.items(QRectF(32, 31, 4, 55)))
|
||||||
qDebug() << "\t" << item->data(0).toString();
|
qDebug() << "\t" << item->data(0).toString();
|
||||||
qDebug() << "}";
|
qDebug() << "}";
|
||||||
|
|
||||||
QCOMPARE(scene.items(32, 31, 4, 55),
|
QCOMPARE(scene.items(QRectF(32, 31, 4, 55)),
|
||||||
QList<QGraphicsItem *>()
|
QList<QGraphicsItem *>()
|
||||||
<< c_1_2 << c_1_1_1 << c_1 << t_1);
|
<< c_1_2 << c_1_1_1 << c_1 << t_1);
|
||||||
QCOMPARE(scene.items(-53, 47, 136, 3),
|
QCOMPARE(scene.items(QRectF(-53, 47, 136, 3)),
|
||||||
QList<QGraphicsItem *>()
|
QList<QGraphicsItem *>()
|
||||||
<< c_2_2 << c_2_1 << c_2 << c_1_2 << c_1_1 << c_1 << t_1);
|
<< c_2_2 << c_2_1 << c_2 << c_1_2 << c_1_1 << c_1 << t_1);
|
||||||
QCOMPARE(scene.items(-23, 79, 104, 3),
|
QCOMPARE(scene.items(QRectF(-23, 79, 104, 3)),
|
||||||
QList<QGraphicsItem *>()
|
QList<QGraphicsItem *>()
|
||||||
<< c_2_1_1 << c_1_1_1);
|
<< c_2_1_1 << c_1_1_1);
|
||||||
QCOMPARE(scene.items(-26, -3, 92, 79),
|
QCOMPARE(scene.items(QRectF(-26, -3, 92, 79)),
|
||||||
QList<QGraphicsItem *>()
|
QList<QGraphicsItem *>()
|
||||||
<< c_2_2 << c_2_1_1 << c_2_1 << c_2
|
<< c_2_2 << c_2_1_1 << c_2_1 << c_2
|
||||||
<< c_1_2 << c_1_1_1 << c_1_1 << c_1
|
<< c_1_2 << c_1_1_1 << c_1_1 << c_1
|
||||||
@ -4376,7 +4383,7 @@ void tst_QGraphicsScene::taskQT657_paintIntoCacheWithTransparentParts()
|
|||||||
|
|
||||||
QGraphicsProxyWidget *proxy = scene->addWidget(w);
|
QGraphicsProxyWidget *proxy = scene->addWidget(w);
|
||||||
proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||||
proxy->rotate(15);
|
proxy->setTransform(QTransform().rotate(15), true);
|
||||||
|
|
||||||
view->show();
|
view->show();
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(view));
|
QVERIFY(QTest::qWaitForWindowExposed(view));
|
||||||
@ -4422,7 +4429,7 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts()
|
|||||||
|
|
||||||
scene->addItem(backItem);
|
scene->addItem(backItem);
|
||||||
rectItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
rectItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||||
backItem->rotate(15);
|
backItem->setTransform(QTransform().rotate(15), true);
|
||||||
|
|
||||||
view->show();
|
view->show();
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(view));
|
QVERIFY(QTest::qWaitForWindowExposed(view));
|
||||||
@ -4464,7 +4471,7 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts()
|
|||||||
|
|
||||||
scene->addItem(rectItem);
|
scene->addItem(rectItem);
|
||||||
rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache);
|
rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache);
|
||||||
rectItem->rotate(15);
|
rectItem->setTransform(QTransform().rotate(15), true);
|
||||||
|
|
||||||
view->show();
|
view->show();
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(view));
|
QVERIFY(QTest::qWaitForWindowExposed(view));
|
||||||
@ -4505,7 +4512,7 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts()
|
|||||||
|
|
||||||
scene->addItem(rectItem);
|
scene->addItem(rectItem);
|
||||||
rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache);
|
rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache);
|
||||||
rectItem->rotate(15);
|
rectItem->setTransform(QTransform().rotate(15), true);
|
||||||
|
|
||||||
view->show();
|
view->show();
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(view));
|
QVERIFY(QTest::qWaitForWindowExposed(view));
|
||||||
@ -4609,41 +4616,41 @@ void tst_QGraphicsScene::focusItemChangedSignal()
|
|||||||
QCOMPARE(spy.count(), 1);
|
QCOMPARE(spy.count(), 1);
|
||||||
QList<QVariant> arguments = spy.takeFirst();
|
QList<QVariant> arguments = spy.takeFirst();
|
||||||
QCOMPARE(arguments.size(), 3);
|
QCOMPARE(arguments.size(), 3);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0);
|
||||||
QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason);
|
QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason);
|
||||||
QVERIFY(topLevelItem2->hasFocus());
|
QVERIFY(topLevelItem2->hasFocus());
|
||||||
|
|
||||||
scene.clearFocus();
|
scene.clearFocus();
|
||||||
QCOMPARE(spy.count(), 1);
|
QCOMPARE(spy.count(), 1);
|
||||||
arguments = spy.takeFirst();
|
arguments = spy.takeFirst();
|
||||||
QCOMPARE(arguments.size(), 3);
|
QCOMPARE(arguments.size(), 3);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)0);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)0);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
|
||||||
QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason);
|
QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason);
|
||||||
|
|
||||||
scene.setFocus(Qt::MenuBarFocusReason);
|
scene.setFocus(Qt::MenuBarFocusReason);
|
||||||
QCOMPARE(spy.count(), 1);
|
QCOMPARE(spy.count(), 1);
|
||||||
arguments = spy.takeFirst();
|
arguments = spy.takeFirst();
|
||||||
QCOMPARE(arguments.size(), 3);
|
QCOMPARE(arguments.size(), 3);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0);
|
||||||
QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::MenuBarFocusReason);
|
QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::MenuBarFocusReason);
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
topLevelItem1->setFocus(Qt::TabFocusReason);
|
topLevelItem1->setFocus(Qt::TabFocusReason);
|
||||||
arguments = spy.takeFirst();
|
arguments = spy.takeFirst();
|
||||||
QCOMPARE(arguments.size(), 3);
|
QCOMPARE(arguments.size(), 3);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem1);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem1);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
|
||||||
QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason);
|
QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason);
|
||||||
|
|
||||||
topLevelItem2->setFocus(Qt::TabFocusReason);
|
topLevelItem2->setFocus(Qt::TabFocusReason);
|
||||||
arguments = spy.takeFirst();
|
arguments = spy.takeFirst();
|
||||||
QCOMPARE(arguments.size(), 3);
|
QCOMPARE(arguments.size(), 3);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem1);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem1);
|
||||||
QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason);
|
QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following two are unexpected, but fixing this (i.e., losing and gaining focus
|
// The following two are unexpected, but fixing this (i.e., losing and gaining focus
|
||||||
@ -4664,9 +4671,9 @@ void tst_QGraphicsScene::focusItemChangedSignal()
|
|||||||
QCOMPARE(spy.count(), 1);
|
QCOMPARE(spy.count(), 1);
|
||||||
arguments = spy.takeFirst();
|
arguments = spy.takeFirst();
|
||||||
QCOMPARE(arguments.size(), 3);
|
QCOMPARE(arguments.size(), 3);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
|
||||||
QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason);
|
QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason);
|
||||||
|
|
||||||
QGraphicsRectItem *panel2 = new QGraphicsRectItem;
|
QGraphicsRectItem *panel2 = new QGraphicsRectItem;
|
||||||
panel2->setFlags(QGraphicsItem::ItemIsPanel | QGraphicsItem::ItemIsFocusable);
|
panel2->setFlags(QGraphicsItem::ItemIsPanel | QGraphicsItem::ItemIsFocusable);
|
||||||
@ -4678,17 +4685,17 @@ void tst_QGraphicsScene::focusItemChangedSignal()
|
|||||||
QCOMPARE(spy.count(), 1);
|
QCOMPARE(spy.count(), 1);
|
||||||
arguments = spy.takeFirst();
|
arguments = spy.takeFirst();
|
||||||
QCOMPARE(arguments.size(), 3);
|
QCOMPARE(arguments.size(), 3);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel2);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel2);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel1);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel1);
|
||||||
QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason);
|
QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason);
|
||||||
|
|
||||||
scene.setActivePanel(panel1);
|
scene.setActivePanel(panel1);
|
||||||
QCOMPARE(spy.count(), 1);
|
QCOMPARE(spy.count(), 1);
|
||||||
arguments = spy.takeFirst();
|
arguments = spy.takeFirst();
|
||||||
QCOMPARE(arguments.size(), 3);
|
QCOMPARE(arguments.size(), 3);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1);
|
||||||
QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel2);
|
QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel2);
|
||||||
QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason);
|
QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,4 +4,3 @@ requires(contains(QT_CONFIG,private_tests))
|
|||||||
QT += widgets widgets-private testlib
|
QT += widgets widgets-private testlib
|
||||||
QT += core-private gui-private
|
QT += core-private gui-private
|
||||||
SOURCES += tst_qgraphicssceneindex.cpp
|
SOURCES += tst_qgraphicssceneindex.cpp
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -327,7 +327,7 @@ void tst_QGraphicsSceneIndex::removeItems()
|
|||||||
delete widgetChild1;
|
delete widgetChild1;
|
||||||
|
|
||||||
//We move the parent
|
//We move the parent
|
||||||
scene.items(295, 295, 50, 50);
|
scene.items(QRectF(295, 295, 50, 50));
|
||||||
|
|
||||||
//This should not crash
|
//This should not crash
|
||||||
}
|
}
|
||||||
|
@ -9,4 +9,3 @@ SOURCES += tst_qgraphicsview.cpp tst_qgraphicsview_2.cpp
|
|||||||
HEADERS += tst_qgraphicsview.h
|
HEADERS += tst_qgraphicsview.h
|
||||||
DEFINES += QT_NO_CAST_TO_ASCII
|
DEFINES += QT_NO_CAST_TO_ASCII
|
||||||
|
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -1392,8 +1392,8 @@ void tst_QGraphicsView::fitInView()
|
|||||||
items[2]->setPos(-100, 100);
|
items[2]->setPos(-100, 100);
|
||||||
items[3]->setPos(100, 100);
|
items[3]->setPos(100, 100);
|
||||||
|
|
||||||
items[0]->rotate(30);
|
items[0]->setTransform(QTransform().rotate(30), true);
|
||||||
items[1]->rotate(-30);
|
items[1]->setTransform(QTransform().rotate(-30), true);
|
||||||
|
|
||||||
#if defined(Q_OS_WINCE)
|
#if defined(Q_OS_WINCE)
|
||||||
//Is the standard scrollbar size
|
//Is the standard scrollbar size
|
||||||
@ -3515,7 +3515,7 @@ void tst_QGraphicsView::embeddedViews()
|
|||||||
SpyItem *item = new SpyItem;
|
SpyItem *item = new SpyItem;
|
||||||
v2->scene()->addItem(item);
|
v2->scene()->addItem(item);
|
||||||
|
|
||||||
proxy->translate(5, 5);
|
proxy->setTransform(QTransform::fromTranslate(5, 5), true);
|
||||||
|
|
||||||
QImage actual(64, 64, QImage::Format_ARGB32_Premultiplied);
|
QImage actual(64, 64, QImage::Format_ARGB32_Premultiplied);
|
||||||
actual.fill(0);
|
actual.fill(0);
|
||||||
|
@ -6,4 +6,3 @@ QT += core-private gui-private
|
|||||||
|
|
||||||
SOURCES += tst_qgraphicswidget.cpp
|
SOURCES += tst_qgraphicswidget.cpp
|
||||||
|
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -1108,7 +1108,7 @@ void tst_QGraphicsWidget::initStyleOption()
|
|||||||
|
|
||||||
view.setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
view.setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||||
SubQGraphicsWidget *widget = new SubQGraphicsWidget;
|
SubQGraphicsWidget *widget = new SubQGraphicsWidget;
|
||||||
widget->setAcceptsHoverEvents(true);
|
widget->setAcceptHoverEvents(true);
|
||||||
QStyleOption option;
|
QStyleOption option;
|
||||||
scene.addItem(widget);
|
scene.addItem(widget);
|
||||||
|
|
||||||
@ -2090,12 +2090,12 @@ void tst_QGraphicsWidget::task236127_bspTreeIndexFails()
|
|||||||
view.show();
|
view.show();
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
QVERIFY(QTest::qWaitForWindowExposed(&view));
|
||||||
|
|
||||||
QTRY_VERIFY(!scene.itemAt(25, 25));
|
QTRY_VERIFY(scene.items(QPointF(25, 25)).isEmpty());
|
||||||
widget->setGeometry(0, 112, 360, 528);
|
widget->setGeometry(0, 112, 360, 528);
|
||||||
QTRY_COMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget);
|
QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, Q_NULLPTR), (QGraphicsItem *)widget);
|
||||||
widget2->setGeometry(0, 573, 360, 67);
|
widget2->setGeometry(0, 573, 360, 67);
|
||||||
QTRY_COMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget);
|
QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, Q_NULLPTR), (QGraphicsItem *)widget);
|
||||||
QTRY_COMPARE(scene.itemAt(50, 585), (QGraphicsItem *)widget2);
|
QTRY_COMPARE(scene.items(QPointF(50, 585)).value(0, Q_NULLPTR), (QGraphicsItem *)widget2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QGraphicsWidget::defaultSize()
|
void tst_QGraphicsWidget::defaultSize()
|
||||||
|
@ -68,4 +68,3 @@ SOURCES += main.cpp \
|
|||||||
TARGET = tst_GraphicsViewBenchmark
|
TARGET = tst_GraphicsViewBenchmark
|
||||||
RESOURCES += GraphicsViewBenchmark.qrc
|
RESOURCES += GraphicsViewBenchmark.qrc
|
||||||
INCLUDEPATH += widgets
|
INCLUDEPATH += widgets
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -5,4 +5,3 @@ TARGET = tst_bench_qgraphicsanchorlayout
|
|||||||
|
|
||||||
SOURCES += tst_qgraphicsanchorlayout.cpp
|
SOURCES += tst_qgraphicsanchorlayout.cpp
|
||||||
|
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -4,4 +4,3 @@ TEMPLATE = app
|
|||||||
TARGET = tst_bench_qgraphicsitem
|
TARGET = tst_bench_qgraphicsitem
|
||||||
|
|
||||||
SOURCES += tst_qgraphicsitem.cpp
|
SOURCES += tst_qgraphicsitem.cpp
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -114,7 +114,7 @@ void tst_QGraphicsItem::setParentItem_deep()
|
|||||||
childRect->setParentItem(lastRect);
|
childRect->setParentItem(lastRect);
|
||||||
lastRect = childRect;
|
lastRect = childRect;
|
||||||
}
|
}
|
||||||
QGraphicsItem *first = rect.children().first();
|
QGraphicsItem *first = rect.childItems().first();
|
||||||
first->setParentItem(0);
|
first->setParentItem(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,8 +194,9 @@ void tst_QGraphicsItem::rotate()
|
|||||||
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
|
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
|
||||||
processEvents();
|
processEvents();
|
||||||
|
|
||||||
|
const QTransform rotate(QTransform().rotate(45));
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
item->rotate(45);
|
item->setTransform(rotate, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,8 +206,9 @@ void tst_QGraphicsItem::scale()
|
|||||||
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
|
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
|
||||||
processEvents();
|
processEvents();
|
||||||
|
|
||||||
|
const QTransform scale(QTransform::fromScale(2, 2));
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
item->scale(2, 2);
|
item->setTransform(scale, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,8 +218,9 @@ void tst_QGraphicsItem::shear()
|
|||||||
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
|
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
|
||||||
processEvents();
|
processEvents();
|
||||||
|
|
||||||
|
const QTransform shear = QTransform().shear(1.5, 1.5);
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
item->shear(1.5, 1.5);
|
item->setTransform(shear, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,8 +230,9 @@ void tst_QGraphicsItem::translate()
|
|||||||
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
|
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100));
|
||||||
processEvents();
|
processEvents();
|
||||||
|
|
||||||
|
const QTransform translate = QTransform::fromTranslate(100, 100);
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
item->translate(100, 100);
|
item->setTransform(translate, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,4 +3,3 @@ TARGET = tst_bench_qgraphicslayout
|
|||||||
QT += testlib
|
QT += testlib
|
||||||
SOURCES += tst_qgraphicslayout.cpp
|
SOURCES += tst_qgraphicslayout.cpp
|
||||||
|
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -3,4 +3,3 @@ TARGET = tst_bench_qgraphicslinearlayout
|
|||||||
QT += testlib
|
QT += testlib
|
||||||
SOURCES += tst_qgraphicslinearlayout.cpp
|
SOURCES += tst_qgraphicslinearlayout.cpp
|
||||||
|
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -5,4 +5,3 @@ TARGET = tst_bench_qgraphicsscene
|
|||||||
|
|
||||||
SOURCES += tst_qgraphicsscene.cpp
|
SOURCES += tst_qgraphicsscene.cpp
|
||||||
|
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -165,7 +165,7 @@ void tst_QGraphicsScene::addItem()
|
|||||||
scene.addItem(item);
|
scene.addItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scene.itemAt(0, 0);
|
scene.items(QPointF(0, 0));
|
||||||
}
|
}
|
||||||
//let QGraphicsScene::_q_polishItems be called so ~QGraphicsItem doesn't spend all his time cleaning the unpolished list
|
//let QGraphicsScene::_q_polishItems be called so ~QGraphicsItem doesn't spend all his time cleaning the unpolished list
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
@ -217,12 +217,12 @@ void tst_QGraphicsScene::itemAt()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.itemAt(0, 0); // triggers indexing
|
scene.items(QPointF(0, 0)); // triggers indexing
|
||||||
processEvents();
|
processEvents();
|
||||||
|
|
||||||
QGraphicsItem *item = 0;
|
QGraphicsItem *item = 0;
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
item = scene.itemAt(0, 0);
|
item = scene.items(QPointF(0, 0)).value(0, Q_NULLPTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
//let QGraphicsScene::_q_polishItems be called so ~QGraphicsItem doesn't spend all his time cleaning the unpolished list
|
//let QGraphicsScene::_q_polishItems be called so ~QGraphicsItem doesn't spend all his time cleaning the unpolished list
|
||||||
@ -239,7 +239,7 @@ void tst_QGraphicsScene::initialShow()
|
|||||||
item->setPos((y/2) * item->rect().width(), (y/2) * item->rect().height());
|
item->setPos((y/2) * item->rect().width(), (y/2) * item->rect().height());
|
||||||
scene.addItem(item);
|
scene.addItem(item);
|
||||||
}
|
}
|
||||||
scene.itemAt(0, 0); // triggers indexing
|
scene.items(QPointF(0, 0)); // triggers indexing
|
||||||
//This call polish the items so we bench their processing too.
|
//This call polish the items so we bench their processing too.
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
}
|
}
|
||||||
|
@ -17,4 +17,3 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES *.png *.pro *.html *.doc images
|
|||||||
sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/chip
|
sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/chip
|
||||||
INSTALLS += target sources
|
INSTALLS += target sources
|
||||||
|
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -1,2 +1 @@
|
|||||||
SOURCES += main.cpp
|
SOURCES += main.cpp
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -1,2 +1 @@
|
|||||||
SOURCES += main.cpp
|
SOURCES += main.cpp
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -43,7 +43,7 @@ Chip::Chip(const QColor &color, int x, int y)
|
|||||||
setZValue((x + y) % 2);
|
setZValue((x + y) % 2);
|
||||||
|
|
||||||
setFlags(ItemIsSelectable | ItemIsMovable);
|
setFlags(ItemIsSelectable | ItemIsMovable);
|
||||||
setAcceptsHoverEvents(true);
|
setAcceptHoverEvents(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF Chip::boundingRect() const
|
QRectF Chip::boundingRect() const
|
||||||
|
@ -7,4 +7,3 @@ SOURCES += tst_qgraphicsview.cpp
|
|||||||
RESOURCES += qgraphicsview.qrc
|
RESOURCES += qgraphicsview.qrc
|
||||||
|
|
||||||
include(chiptester/chiptester.pri)
|
include(chiptester/chiptester.pri)
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -166,7 +166,7 @@ void tst_QGraphicsView::initTestCase()
|
|||||||
mView.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
mView.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
mView.tryResize(100, 100);
|
mView.tryResize(100, 100);
|
||||||
mView.show();
|
mView.show();
|
||||||
QTest::qWaitForWindowShown(&mView);
|
QTest::qWaitForWindowExposed(&mView);
|
||||||
QTest::qWait(300);
|
QTest::qWait(300);
|
||||||
processEvents();
|
processEvents();
|
||||||
}
|
}
|
||||||
@ -418,7 +418,7 @@ void tst_QGraphicsView::chipTester()
|
|||||||
tester.setOpenGL(opengl);
|
tester.setOpenGL(opengl);
|
||||||
tester.setOperation(ChipTester::Operation(operation));
|
tester.setOperation(ChipTester::Operation(operation));
|
||||||
tester.show();
|
tester.show();
|
||||||
QTest::qWaitForWindowShown(&tester);
|
QTest::qWaitForWindowExposed(&tester);
|
||||||
QTest::qWait(250);
|
QTest::qWait(250);
|
||||||
processEvents();
|
processEvents();
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ static void addChildHelper(QGraphicsItem *parent, int n, bool rotate)
|
|||||||
QGraphicsRectItem *item = new QGraphicsRectItem(QRectF(0, 0, 50, 50), parent);
|
QGraphicsRectItem *item = new QGraphicsRectItem(QRectF(0, 0, 50, 50), parent);
|
||||||
item->setPos(10, 10);
|
item->setPos(10, 10);
|
||||||
if (rotate)
|
if (rotate)
|
||||||
item->rotate(10);
|
item->setTransform(QTransform().rotate(10), true);
|
||||||
addChildHelper(item, n - 1, rotate);
|
addChildHelper(item, n - 1, rotate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,7 +464,8 @@ void tst_QGraphicsView::deepNesting()
|
|||||||
for (int y = 0; y < 15; ++y) {
|
for (int y = 0; y < 15; ++y) {
|
||||||
for (int x = 0; x < 15; ++x) {
|
for (int x = 0; x < 15; ++x) {
|
||||||
QGraphicsItem *item1 = scene.addRect(QRectF(0, 0, 50, 50));
|
QGraphicsItem *item1 = scene.addRect(QRectF(0, 0, 50, 50));
|
||||||
if (rotate) item1->rotate(10);
|
if (rotate)
|
||||||
|
item1->setTransform(QTransform().rotate(10), true);
|
||||||
item1->setPos(x * 25, y * 25);
|
item1->setPos(x * 25, y * 25);
|
||||||
addChildHelper(item1, 30, rotate);
|
addChildHelper(item1, 30, rotate);
|
||||||
}
|
}
|
||||||
@ -476,7 +477,7 @@ void tst_QGraphicsView::deepNesting()
|
|||||||
mView.setRenderHint(QPainter::Antialiasing);
|
mView.setRenderHint(QPainter::Antialiasing);
|
||||||
mView.setScene(&scene);
|
mView.setScene(&scene);
|
||||||
mView.tryResize(600, 600);
|
mView.tryResize(600, 600);
|
||||||
(void)scene.itemAt(0, 0);
|
(void)scene.items(QPointF(0, 0));
|
||||||
processEvents();
|
processEvents();
|
||||||
|
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
|
@ -4,4 +4,3 @@ TEMPLATE = app
|
|||||||
TARGET = tst_bench_qgraphicswidget
|
TARGET = tst_bench_qgraphicswidget
|
||||||
|
|
||||||
SOURCES += tst_qgraphicswidget.cpp
|
SOURCES += tst_qgraphicswidget.cpp
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -8,4 +8,3 @@ SOURCES += main.cpp \
|
|||||||
HEADERS += imageitem.h \
|
HEADERS += imageitem.h \
|
||||||
gestures.h \
|
gestures.h \
|
||||||
mousepangesturerecognizer.h
|
mousepangesturerecognizer.h
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
SOURCES = rubberbandtest.cpp
|
SOURCES = rubberbandtest.cpp
|
||||||
QT += gui widgets # core-private
|
QT += gui widgets # core-private
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user