summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsview.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix the hand scrolling in QGraphicsView that will stop unexpectedly.Alexis Menard2009-07-201-1/+1
| | | | | | | | | | If you start a hand scrolling and during moving, you press another button of the mouse than the left one, the scrolling suddently stop working. In mouseReleaseEvent we just stop the hand scrolling if the button is left. Task:258356 Reviewed-by:janarve
* Update license headers as requested by the marketing department.Jason McDonald2009-06-161-2/+2
| | | | Reviewed-by: Trust Me
* Fix QGraphicsItem::deviceTransform() to also work with normal items.Andreas Aardal Hanssen2009-05-141-11/+2
| | | | | | | | | | | | | | | QGraphicsItem::deviceTransform() returns the item-to-device transform, provided with the device-to-scene transform, and combining it with the item's scene transform. This function is meant to handle items that enable ItemIgnoresTransformations, but it happened to not work properly for items that _don't_ enable that flag. Unfortunately this bug is hard to work around for users from the outside, as it requires you to check if the item or any ancestor enables ItemIgnoresTransformations. The fix also removes unnecessary branchs inside QGV so that we use the same function for all items. Reviewed-by: bnilsen
* Reset the 'connectedToScene' flag when changing the scene of a viewLeonardo Sobral Cunha2009-05-131-0/+1
| | | | | | | | | | In QGraphicsScene::_q_emitUpdated() the slot QGrpahicsView::updateScene(QList<QRectF>) gets connected and a boolean (connectedToScene) is set to prevent double connections. The problem is that this boolean was not reset when the view gets a new scene. Task-number: 253415 Reviewed-by: andreas
* QGraphicsItem::setOpacity(0.0) does not trigger an update.Bjoern Erik Nilsen2009-05-061-1/+5
| | | | | | | | | | | | | | | | The problem was that we discarded update requests for fully transparent items, which is correct, but we even did that when the update was issued from QGraphicsItem::setOpacity. We don't have to, and shouldn't, consider the opacity in that case. Whenever we reach the fullUpdateHelper call in setOpacity it means we have to do an update regardless of the current opacity (oldOpacity was not 0.0 if the currentOpacity is 0.0). Auto-test included. Task-number: 252913 Reviewed-by: Andreas
* QGraphicsView: Rubber Band drag mode not updated correctly when scrolling ↵Alexis Menard2009-04-141-20/+20
| | | | | | | | | | | [regression] The problem was that we didn't update the new region when we paint the rubber band and we scroll at the same time BT:yes Task-number: 245766 Reviewed-by: bnilsen Reviewed-by: andreas
* Fixup update rect regression by adjusting expose rectangles.Andreas Aardal Hanssen2009-04-061-8/+34
| | | | | | | | | | | | | | | | | | | | | | | This change shows a limitation in Graphics View caused by QPen's default width being 0 (cosmetic), while Graphics View actually does not support cosmetic pens at all. Because items are at risk of drawing lines that poke 1 pixel outside their bounding rect, QGraphicsView must look for items that are up to one pixel larger than their bounding rect mapped to viewport coordinates. Furthermore, mapToScene(QRect) forces us to adjust the input rectangle by (0, 0, 1, 1), because it uses QRect::bottomRight() (etc) when mapping the rectangle to a polygon (which is _wrong_). Since this behavior has been there since 4.2, we don't want to fix it in a 4.5 patch release... The only _proper_ fix to this problem is for the view to know the item's "adjust" in device coordinates, allowing items to use cosmetic pens freely. Fex, we could introduce QGraphicsItem::viewportMargins() or so. Added an autotest to ensure this doesn't break again. Reviewed-by: bnilsen
* Fixes: We have to adjust the item's bounding rect.Bjoern Erik Nilsen2009-04-061-2/+16
| | | | | | | | RevBy: Andreas AutoTest: Still pass Details: QRectF::intersects does not work with flat rectangles, so we cannot intersect the bounding rect without adjusting it first.
* Fixes: Partially revert 9b0af2395c84a6895a5ce6368f151d4ec00c8755Bjoern Erik Nilsen2009-04-061-2/+2
| | | | | | | | | | RevBy: Andreas AutoTest: tst_QGraphicsView::itemAt2 pass again Details: A QPoint in the view has to be mapped to a pixel in the scene, otherwise it won't be possible to e.g. click on items that are smaller than a pixel. So...we have to optimize the hit-testing code in another way
* Optimise QGraphicsScene/View::items(const QPointF &pos)Lars Knoll2009-04-061-2/+2
| | | | | Implement specialized (and more efficient versions) of item_helper() and child_helper() that test for QPointF in the scene.
* Fixes: Simplify the cut-offs and be more agressive :-)Bjoern Erik Nilsen2009-04-061-1/+4
| | | | | AutoTest: Still pass. Details: It's easier to read and understand the code now.
* Fixes: Optimize QGraphicsViewPrivate::itemUpdated.Bjoern Erik Nilsen2009-04-061-21/+19
| | | | | | | AutoTest: Still pass Details: Get rid of QTransform::inverted()/operator*= and do nothing if the item clips all its children and the update rect is outside the bounding rect.
* Fixes: Discard update requests if possible.Bjoern Erik Nilsen2009-04-061-0/+2
| | | | | | | | AutoTest: Still pass. Details: Update requests can be discarded if the item itself is clipped away and the item clips all its children to shape. This cut-off is extremely effective (and aggressive:))
* Add a cut-off for simple rectangle lookups.Andreas Aardal Hanssen2009-04-061-0/+5
| | | | | | | | Make sure we use the rect-variation of QGraphicsScene's item lookup functions if the view has a simple transform and a simple expose region. Reviewed-by: Bjoern Erik Nilsen <bjorn.nilsen@nokia.com>
* Fixes: Cleanup/Optimize QGraphicsView::findItems.Bjoern Erik Nilsen2009-04-061-92/+30
| | | | | | | | | | | | | | RevBy: Alexis AutoTest: Still pass Details: findItems() does almost exactly the same as QGraphicsView::items, the only difference is that it checks whether we are about to redraw all items. Next step is to optimize the items_helper functions. The patch does also include a fix for ::items/childItems_helper(const QPainterPath ...); it didn't take Qt::Intersects/ContainsItemBoundingRect into account (in the same fashion as we do in the other helper functions).
* Fixes: Use QRect::isEmpty() rather than isNull() if possible.Bjoern Erik Nilsen2009-04-061-5/+5
| | | | | | RevBy: Andreas Details: Note that isNull() implies isEmpty(), but it only catches the cases where width and height is 0.
* Fixes: Cleanup calls to QGraphicsViewPrivate::updateRect()/updateRegion()Bjoern Erik Nilsen2009-04-061-14/+5
| | | | | | Details: Checking for QRect::isNull() was wrong in the first place, and checking for isEmpty()/isNull() is overhead after 4a491a84aeba68279927597a261522dcc23bb3ff.
* Fixes: Optimize QGraphicsViewPrivate::updateRect()/updateRegion().Bjoern Erik Nilsen2009-04-061-0/+6
| | | | | | | | Details: Those cut-offs are extremely important. After few seconds interaction with the iphone demo, updateRect() was called approx. 3000 times with an empty rect. Then imagine what happens when having e.g. FullViewportUpdate. We do q->viewport()->update() JUST FOR FUN!
* Fixes: Optimize QGraphicsView::itemUpdated.Bjoern Erik Nilsen2009-04-061-3/+10
| | | | | | | | Task: - RevBy: Andreas AutoTest: - Details: Accumulate the parentToItem transform as we iterate instead of creating it from bottom-up each time.
* Long live Qt 4.5!Lars Knoll2009-03-231-0/+3887