summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
Commit message (Collapse)AuthorAgeFilesLines
* BT: Revert "Fixes: Don't fill the pixmap because we will copy the cache ↵Andreas Aardal Hanssen2009-04-211-1/+3
| | | | | | | | | | | | | | | into it." This reverts commit 0985805ab3c7de5b15c115a98afb15944b6d93b9. The Elastic Nodes example shows a black background for the cache pixmap if the call to fill isn't there. Alexis and I both agree that it makes no sense that we fill the pixmap with transparent pixels instead of just drawing with QPainter::CompositionMode_Source, but since this regression was introduced after 4.5.0 was released we must revert before we investigate further. Reviewed-by: Alexis
* BT: Fix update regression for cached QGraphicsItem (Elastic Nodes stuck)Andreas Aardal Hanssen2009-04-211-1/+13
| | | | | | | | | | | | | | | | | | | This fixes a bug in 4.5.0 where cached items that call update() after they have been moved or transformed failed to get a call to paint(), so the last cache image was used to draw. The easiest way to reproduce this bug is in the Elastic Nodes example. If you press, wait, then release, the nodes will consistently move to sunken state, then back to normal state. But if you click quickly while moving the mouse, the nodes will stay sunken. The bug was that the item was marked as dirty as a result of being moved, and when the mouse button was released, the node item's call to update() was discarded, as the item was "already dirty". The fix is to allow invalidation of the cache even if the item is marked as dirty. Reviewed-by: bnilsen
* We don't need to call two times itemChange when an item is deleted.Alexis Menard2009-04-211-6/+0
| | | | | | | | | Previously we were calling two times itemChange on the parent to give QGraphicsItem::ItemChildAddedChange. We don't need that. One is enough. BT : yes Task-number: BT Reviewed-by: Andreas
* Update the item if the text has changed but the boundingRect is theAlexis Menard2009-04-151-0/+1
| | | | | | | | | | | | same. updateBoudingRect update the item only if the boundingRect change but if we have 123 as an initial text and then we set 321 as the new text, then nothing happen because the rect is the same. In case the boundingRect change then we call update 2 times but the item is already dirty so the second call will just return. BT:yes Reviewed-by: Andreas
* BT: Fix a regression to 4.4 in Graphics View's handling of child clippersAndreas Aardal Hanssen2009-04-151-14/+16
| | | | | | | | | | | | | | | | | | | | Regression caused by optimizations in QGraphicsItem and QGraphicsScene. The changes in QGraphicsItem fix bugs in QGraphicsItem::mapToParent functions, which did the translation before applying the transformation, instead of the other way (transform, then translate). This bug caused almost all mapToParent and mapRectToParent functions to behave wrongly. Unfortunately the new helper functions in QGraphicsScene for discovering items made use of these functions, which introduced a regression. Fixing these functions also fixes item discovery. The other part of this change fixes a regression caused by c1909321, which luckily happened after 4.5.0 and never saw the light of day. The fix is to also invalidate the cached clip path even if there is no scene, which is necessary if you build your scene graph outside the scene, and finish off by adding the root item to the scene. Task-number: 250680 Reviewed-by: Alexis
* QGraphicsItem: When an item is deleted and eventfilters installedAlexis Menard2009-04-141-0/+19
| | | | | | | | | | | | The problem here is that we are filling the sceneEventFilters map when we install evenfilter but we never remove the references of an item if it has been removed from the scene or deleted. The deletion can keep stale pointers into the map and a crash can happen. BT:yes Task-number:250272 Reviewed-by: bnilsen 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
* BT: compilefix for Qt in namespaceThomas Hartmann2009-04-071-3/+3
| | | | | | RevBy: mauricek Details: using prefix qt_ instead of ::global namespace
* Adds a few \warnings to the docs on do-not-use-for-performance-reasonsGunnar Sletta2009-04-071-2/+6
| | | | Reviewed-by: Trond
* 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: Wrong adjustment of rect added in ↵Bjoern Erik Nilsen2009-04-061-3/+2
| | | | | | | | | | 0aa2ef27249dc8e782c2942340776bb19de80a0d RevBy: TrustMe AutoTest: tst_QGraphicsItem::boundingRegion() pass again Details: The original code adjusted the QRect version of a mapped bounding rect, wheras my patch adjusted a mapped bounding rect (QRectF) and then converted it to a QRect.
* 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: Optimize the way we adjust rectangles.Bjoern Erik Nilsen2009-04-062-47/+68
| | | | | RevBy: Olivier AutoTest: Still pass
* 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
* Fixes: Minimize QVariant overhead related to QGraphicsItem::itemChange.Bjoern Erik Nilsen2009-04-062-43/+51
| | | | | RevBy: Andreas AutoTest: included
* Optimise QGraphicsScene/View::items(const QPointF &pos)Lars Knoll2009-04-063-14/+88
| | | | | 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-063-42/+68
| | | | | AutoTest: Still pass. Details: It's easier to read and understand the code now.
* Fixes: Discard update requests if possible.Bjoern Erik Nilsen2009-04-062-10/+35
| | | | | | | | 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:))
* Fixes: Don't bother updating hidden items.Bjoern Erik Nilsen2009-04-062-1/+4
| | | | AutoTest: Still pass
* Fixes: Do not update children if not required.Bjoern Erik Nilsen2009-04-061-1/+2
| | | | AutoTest: Still pass
* Fixes: Don't check the force boolean.Bjoern Erik Nilsen2009-04-061-1/+1
| | | | Details: It's clipped away regardless.
* Fixes: Minimize QVariant constr/destr in setPosHelper.Bjoern Erik Nilsen2009-04-061-2/+3
| | | | RevBy: TrustMe
* 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-063-21/+44
| | | | | | | | 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:))
* Fixes: Don't bother processing items that are clipped away.Bjoern Erik Nilsen2009-04-062-52/+67
| | | | RevBy: Andreas
* Fixes: Optimization: Clip path is empty if the bounding rect is empty.Bjoern Erik Nilsen2009-04-061-1/+10
| | | | RevBy: TrustMe
* Fixes: Clever invalidating of the cached clip path.Bjoern Erik Nilsen2009-04-062-13/+129
| | | | | | | | RevBy: Andreas AutoTest: still pass Details: Adds emptyClipPath bit, a cut-off to test if the item has an empty clip path (i.e., is clipped away). Also adds code for invalidating the cache from inside setPos().
* Fixes: Compile on funky scratchbox ARM compiler.Bjoern Erik Nilsen2009-04-061-1/+1
|
* Fixes: Get rid of lots of calls to qFuzzyCompare.Bjoern Erik Nilsen2009-04-062-3/+9
| | | | | | | RevBy: Olivier AutoTest: Still pass. Details: Items usually don't have effective opacity, i.e. it is 1.0, so don't bother doing fuzzy compare if that's the case.
* Fixes: Only use the parent's cached clip path if it is clipped.Bjoern Erik Nilsen2009-04-061-2/+3
| | | | | RevBy: TrustMe Details: ...otherwise it'll be empty and too much will be clipped away.
* 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-063-115/+94
| | | | | | | | | | | | | | 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: Optimization: Cache QGraphicsItem::clipPath().Bjoern Erik Nilsen2009-04-062-7/+53
| | | | | | RevBy: Alexis AutoTest: Still pass Details: No-brainer.
* Fixes: Don't fill the pixmap because we will copy the cache into it.Alexis Menard2009-04-061-3/+1
| | | | | RevBy: bnilsen AutoTest: All pass + plasma ok
* Fixes: Be a bit more smarter when calling setGeometry from itemChangeAlexis Menard2009-04-064-29/+39
| | | | | | | | RevBy: bnilsen AutoTest: Bench Details : if we come from setPosHelper (so itemChange) we don't need to do all the stuff regarding the size in setGeometry because the size doesn't change. I remove two calls to fullUpdateHelper and update() because prepareGeometryChange already call updateHelper and setPosHelper call fullUpdaterHelper too so we don't need to call them inside setGeometry. We can only call prepareGeometryChange only if we don't come from setPos.
* Fixes: Small optimization in QGraphicsItem::clipPath().Bjoern Erik Nilsen2009-04-061-7/+6
| | | | | | RevBy: Andreas Details: Use QPainterPath::addRect() rather than addPolygon() and closeSubPath().
* Fixes: Optimize: QGraphicsItem::clipPath.Bjoern Erik Nilsen2009-04-061-31/+15
| | | | | RevBy: Andreas AutoTest: Still pass
* Fixes: Speed up QGrahicsItemPrivate::effectiveOpacity().Bjoern Erik Nilsen2009-04-062-1/+13
| | | | | RevBy: Andreas AutoTest: tst_QGraphicsItem::opacity still passes
* Fixes: Get rid of a gazillion calls to QTransform::operator*=.Bjoern Erik Nilsen2009-04-062-16/+27
| | | | Details: Be a little bit smarter before doing *= :)
* Fixes: Use QRect::isEmpty() rather than isNull() if possible.Bjoern Erik Nilsen2009-04-063-7/+7
| | | | | | 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.
* Fix slowdown regression in QGraphicsItem::ItemCoordinateCacheAndreas Aardal Hanssen2009-04-021-4/+7
| | | | | | | | | | | | | | | Right before Qt 4.5.0 was released, Alexis and I submitted change 7e9b000ee418ef2d9c8fadb2c6b8870e0335bd5e, which accidentally introduced a rounding error causing items whose bounding rect contains fractional numbers (e.g., QRectF(-0.5, -0.5, 11, 11)), to always be drawn with a one-pixel strech even if otherwise untransformed. This caused a significant slowdown for pixmap items and any shape item that uses almost any pen width != 0, if they enable ItemCoordinateCache. The fix is to consistently use the aligned rectangle both when generating the cache pixmap and when drawing it. Reviewed-by: Alexis
* Squashed commit of the following:David Boddie2009-03-261-0/+2
| | | | | | | | | | commit b1220858d9c15b661b7825e733be448ea9962895 Author: David Boddie <dboddie@trolltech.com> Date: Thu Mar 26 18:37:47 2009 +0100 Doc: Added information about the default value of QGraphicsTextItem::tabChangesFocus(). Reviewed-by: TrustMe
* Improve documentation of QGraphicsLayoutItem::setGeometry()Jan-Arve Sæther2009-03-251-22/+23
| | | | | | | | Removed a lie, and made it more clear that you must reimplement this function in order for a layout to arrange the item. Task-number: 245550 Reviewed-by: alexis
* Do not cache the sizeHint() while we're in QGraphicsWidget's constructor.Jan-Arve Sæther2009-03-243-0/+6
| | | | | | | | | Do not send a QFontChange event before the item has been polished. This is because we cannot call a virtual function while we're in the ctor. This is basically the same as how we do it in QWidget. Task-number: 246215 Reviewed-by: alexis
* Long live Qt 4.5!Lars Knoll2009-03-2336-0/+34262