diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-08-26 09:02:33 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-08-26 14:18:45 (GMT) |
commit | da5033d8b48b24580e3b6faf7b4e2a8fe2cec254 (patch) | |
tree | 5870b468e418a29a8269bd462e93e54bb0ee5b7b /tests/auto/qgraphicsview | |
parent | 7e30c92186878beb300a13093c3668ae8a10f2be (diff) | |
download | Qt-da5033d8b48b24580e3b6faf7b4e2a8fe2cec254.zip Qt-da5033d8b48b24580e3b6faf7b4e2a8fe2cec254.tar.gz Qt-da5033d8b48b24580e3b6faf7b4e2a8fe2cec254.tar.bz2 |
Introduce QGraphicsItem::ItemIsPanel, light-weight window.
ItemIsPanel allows items that act like windows. They can be
activated and deactivated just like windows and focus is handled
just like with windows. The main difference is that panels are
more light-weight. There's less built-in functionality (e.g.,
clicking a panel doesn't automatically activate nor raise it).
This patch also introduces QGraphicsItem::panel(),
QGraphicsItem::isPanel(), and QGraphicsItem::isActive(),
as well as QGraphicsScene::activePanel(),
QGraphicsScene::setActivePanel(). and QGraphicsScene::isActive().
Regular windows (QGraphicsWidgets with Qt::Window set) are
also panels, with added functionality. The ItemIsPanel flag is
set automatically for windows.
Reviewed-by: brad
Diffstat (limited to 'tests/auto/qgraphicsview')
-rw-r--r-- | tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 505f9a4..524b756 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -376,7 +376,7 @@ void tst_QGraphicsView::interactive() view.show(); QTestEventLoop::instance().enterLoop(1); - QCOMPARE(item->events.size(), 0); + QCOMPARE(item->events.size(), 1); // activate QPoint itemPoint = view.mapFromScene(item->scenePos()); @@ -384,16 +384,16 @@ void tst_QGraphicsView::interactive() for (int i = 0; i < 100; ++i) { sendMousePress(view.viewport(), itemPoint); - QCOMPARE(item->events.size(), i * 5 + 2); + QCOMPARE(item->events.size(), i * 5 + 3); QCOMPARE(item->events.at(item->events.size() - 2), QEvent::GrabMouse); QCOMPARE(item->events.at(item->events.size() - 1), QEvent::GraphicsSceneMousePress); sendMouseRelease(view.viewport(), itemPoint); - QCOMPARE(item->events.size(), i * 5 + 4); + QCOMPARE(item->events.size(), i * 5 + 5); QCOMPARE(item->events.at(item->events.size() - 2), QEvent::GraphicsSceneMouseRelease); QCOMPARE(item->events.at(item->events.size() - 1), QEvent::UngrabMouse); QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, itemPoint, view.mapToGlobal(itemPoint)); QApplication::sendEvent(view.viewport(), &contextEvent); - QCOMPARE(item->events.size(), i * 5 + 5); + QCOMPARE(item->events.size(), i * 5 + 6); QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu); } @@ -401,14 +401,14 @@ void tst_QGraphicsView::interactive() for (int i = 0; i < 100; ++i) { sendMousePress(view.viewport(), itemPoint); - QCOMPARE(item->events.size(), 500); + QCOMPARE(item->events.size(), 501); QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu); sendMouseRelease(view.viewport(), itemPoint); - QCOMPARE(item->events.size(), 500); + QCOMPARE(item->events.size(), 501); QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu); QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, itemPoint, view.mapToGlobal(itemPoint)); QApplication::sendEvent(view.viewport(), &contextEvent); - QCOMPARE(item->events.size(), 500); + QCOMPARE(item->events.size(), 501); QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu); } } @@ -1872,32 +1872,32 @@ void tst_QGraphicsView::sendEvent() item->setFocus(); QCOMPARE(scene.focusItem(), (QGraphicsItem *)item); - QCOMPARE(item->events.size(), 1); + QCOMPARE(item->events.size(), 2); QCOMPARE(item->events.last(), QEvent::FocusIn); QPoint itemPoint = view.mapFromScene(item->scenePos()); sendMousePress(view.viewport(), itemPoint); - QCOMPARE(item->events.size(), 3); + QCOMPARE(item->events.size(), 4); QCOMPARE(item->events.at(item->events.size() - 2), QEvent::GrabMouse); QCOMPARE(item->events.at(item->events.size() - 1), QEvent::GraphicsSceneMousePress); QMouseEvent mouseMoveEvent(QEvent::MouseMove, itemPoint, view.viewport()->mapToGlobal(itemPoint), Qt::LeftButton, Qt::LeftButton, 0); QApplication::sendEvent(view.viewport(), &mouseMoveEvent); - QCOMPARE(item->events.size(), 4); + QCOMPARE(item->events.size(), 5); QCOMPARE(item->events.last(), QEvent::GraphicsSceneMouseMove); QMouseEvent mouseReleaseEvent(QEvent::MouseButtonRelease, itemPoint, view.viewport()->mapToGlobal(itemPoint), Qt::LeftButton, 0, 0); QApplication::sendEvent(view.viewport(), &mouseReleaseEvent); - QCOMPARE(item->events.size(), 6); + QCOMPARE(item->events.size(), 7); QCOMPARE(item->events.at(item->events.size() - 2), QEvent::GraphicsSceneMouseRelease); QCOMPARE(item->events.at(item->events.size() - 1), QEvent::UngrabMouse); QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_Space, 0); QApplication::sendEvent(view.viewport(), &keyPress); - QCOMPARE(item->events.size(), 8); + QCOMPARE(item->events.size(), 9); QCOMPARE(item->events.at(item->events.size() - 2), QEvent::ShortcutOverride); QCOMPARE(item->events.last(), QEvent::KeyPress); } |