summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsscene.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add an API to know the indexed rect of the index.Alexis Menard2009-05-291-1/+1
| | | | | Usefull for the POV of the scene and let the BSP update its internal structure before the next event loop reentrancy.
* First bunch of changes after an very first API reviewAlexis Menard2009-05-291-530/+88
| | | | | | This basically move some logic from the scene to the index base class. Lot of work need to be done in order to benefits from the device transform. The sorting needs to be move in the BSP tree.
* Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into ↵Alexis Menard2009-05-291-62/+26
|\ | | | | | | qt-main/qgraphicssceneindex
| * Avoid deep copies of pixmaps when using cache in QGraphicsView.Alexis Menard2009-05-271-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | When we have already a pixmap of an item in the cache, we should remove the entry from the cache otherwise when we will repaint/modify the copy of the pixmap (the copy of the cache) then we will trigger a deep copy ; this is because both entries in the cache and our copy share the same data and if you modify one of them a copy is triggered. I have added a benchmark as well to test that. Reviewed-by:bnilsen Reviewed-by:andreas
| * Fix a leak because of an old legacy of QPixmapCache string APIAlexis Menard2009-05-221-4/+1
| | | | | | | | | | | | | | | | We have to replace the pixmap in the cache if it was previously there, we don't need to insert a new pixmap if a full update has been triggered. Reviewed-by:mbm
| * Add an extension to QPixmapCache to get rid of strings.Alexis Menard2009-05-181-12/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit add a new API to add/find/remove pixmaps into QPixmapCache. This new extension is based on a key that the cache give you during the insertion. This key is internally a int which makes all operations in the cache much more faster that the string approach. Auto-tests has been extended as well and a benchmark has been added to compare both approach. I also depecrate the find method for the string API to have a method pointer based and not reference based like the Qt policy says. Reviewed-by: bnilsen Reviewed-by: andreas Followed-deeply-by: trond
| * Graphics View Optimization: Use a simple style option by default.Bjoern Erik Nilsen2009-05-151-32/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QStyleOptionGraphicsItem extends QStyleOption with three values: 1) matrix, 2) levelOfDetail, 3) exposedRect, and they all involve expensive QTranform operations when calculated. We pass style option(s) to drawItems() and paint(), but the extended values are usually not in use. We can therefore gain quite some nice speedup by making them opt-in with the QGraphicsItem::ItemUsesExtendedStyleOption flag. Additionally, QStyleOptionGraphicsItem::levelOfDetail has been obsoleted, and a new function QStyleOptionGraphicsItem:: levelOfDetailFromTransform(const QTransform &) has been added. Me and Andreas don't consider this change to be too controversial even though it changes the behavior. Auto tests still pass. Reviewed-by: Andreas
| * Merge branch '4.5'Thiago Macieira2009-05-141-17/+4
| |\ | | | | | | | | | | | | Conflicts: tools/macdeployqt/shared/shared.cpp
| | * Fix QGraphicsItem::deviceTransform() to also work with normal items.Andreas Aardal Hanssen2009-05-141-17/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Fix sending of double-click events after explicit grab-ungrab.Andreas Aardal Hanssen2009-05-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug report came from the Declarative UI project as part of Kinetic. In FxFlickable the mouse is explicitly grabbed inside the mouse press event handler, and it's (explicitly) released in the release handler. When doing this, lastMouseGrabber is 0, and the double-click is delivered as a press. The fix is to not convert the double-click to a press if the receiver is the first and only mouse grabber (i.e., lastMouseGrabber is 0). The fix isn't entirely correct, as it can in theory allow an item to receive a double-click event as the first received event. This seems to only be possible in the case of using explicit mouse grabbing in combinations with the press and release event handlers so it's quite a corner case. Reviewed-by: Alexis
* | | Fix deletion of indexed items, and fix comments.Alexis Menard2009-05-051-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | It was not a good idea to delete all items in the middle of the loop when clearing the scene since we change the content of indexedItems by deleting one of them. We need to store first all top level items in a temporary list and then delete them in one shot (that will delete their children as well).
* | | Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into ↵Alexis Menard2009-05-051-6/+34
|\ \ \ | |/ / | | | | | | | | | | | | | | | qt-main/qgraphicssceneindex Conflicts: src/gui/graphicsview/qgraphicsitem.cpp
| * | Merge branch '4.5'Rhys Weatherley2009-04-211-1/+3
| |\ \ | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/graphicsview/qgraphicsitem.cpp tools/qdoc3/test/assistant.qdocconf tools/qdoc3/test/designer.qdocconf tools/qdoc3/test/linguist.qdocconf tools/qdoc3/test/qmake.qdocconf tools/qdoc3/test/qt-build-docs.qdocconf tools/qdoc3/test/qt.qdocconf
| | * 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
| | * 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
| * | Fix two bugs in Graphics View's mouse grab logics + add autotests.Andreas Aardal Hanssen2009-04-171-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change fd4d94df4eb16e9e54f61dd8ee45914e24832ae9 introduced mouse grab and keyboard grab support to Graphics View (this was as part of 4.4). The change was missing a large set of autotests that I wrote to test the behavior of these features. As part of task 245317, which involves investigating modality in Graphics View, I figured it would be a good idea to start off but reconstructing these autotests. So this change is mainly about adding autotests for mouse grabbing. And of course, as it always is, I found two bugs while writing these tests. 1) Calling QGraphicsItem::grabMouse() while the item is holding the implicit mouse grab will now upgrade the implicit grab to an explicit grab. 2) Adding a popup to the scene will automatically grab the mouse. Before, the popup would get the grab on show(), but if it was already visible when added to the scene it would not gain the grab. Task-number: 245317 Reviewed-by: jasplin
| * | Merge commit 'origin/4.5'Olivier Goffart2009-04-151-0/+19
| |\ \ | | |/ | | | | | | | | | Conflicts: src/gui/graphicsview/qgraphicsitem.cpp
| | * 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
| * | Rename qIsFuzzyNull to qFuzzyIsNullBjoern Erik Nilsen2009-04-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function was added in fde7f3d03782c801901f511131458d6fcb1021a5 and we believe qFuzzyIsNull is a better naming and more in line with qFuzzyCompare. Reviewed-by: Lars Knoll Reviewed-by: nrc Reviewed-by: Samuel
* | | Remove the indexing (BSP) logic from the sceneAlexis Menard2009-04-071-360/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We basically add a new index that implement the old BSP logic but in a separate class instead of living into the QGraphicsScene. It will be much more easier to add a new index method or for people to use their own Conflicts: src/gui/graphicsview/qgraphicsitem.cpp src/gui/graphicsview/qgraphicssceneindex.h
* | | Fixes: First step to remove the indexing logic inside the scene. This ↵Alexis Menard2009-04-071-61/+56
| | | | | | | | | | | | | | | | | | commit basically remove the list of unindexingItems and use the linear index instead. Details: We now must be able to get rid of the timer which is the BSP role.
* | | Fixes: Move the bsp depth variable to the BSP tree class.Ariya Hidayat2009-04-071-4/+12
| | |
* | | Fixes: Recreate the index properly when switching the index method.Ariya Hidayat2009-04-071-3/+28
| | |
* | | Fixes: Recreate the BSP tree properly.Ariya Hidayat2009-04-071-5/+3
| | |
* | | Fixes: Own our internal scene index so we do not need to explicitly ↵Ariya Hidayat2009-04-071-4/+3
| | | | | | | | | | | | delete it.
* | | Fixes: 'delete' always works even with null pointer.Ariya Hidayat2009-04-071-2/+1
| | |
* | | Fixes: The bsp and customs index share the same pointerAlexis Menard2009-04-071-29/+37
| | |
* | | Fixes: Remove from the custom index too (this will change anyway)Alexis Menard2009-04-071-2/+7
| | |
* | | Fixes: Make the bsp tree inherits from the new APIAlexis Menard2009-04-071-3/+3
| | |
* | | Fixes: Some API adjusmentsAlexis Menard2009-04-071-3/+3
| | |
* | | Fixes: Some modifications after a talk with AriyaAlexis Menard2009-04-071-3/+4
| | |
* | | Fixes: Initial work on an API to allow a custom/indexing on the ↵Alexis Menard2009-04-071-6/+45
|/ / | | | | | | QGraphicsScene
* | Disable mouse tracking in QGraphicsView if possible.Bjoern Erik Nilsen2009-04-071-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need mouse tracking unless there are items in the scene that either accept hover events or have a cursor set. This cut-off is extremely efficient in the common case since all items ignore hover events and use the standard cursor by default. We no longer dig for items and do lots of intersection and calculating just for fun :-) We even get rid of the overhead of 2 x QCoreApplication::sendEvent! The next step is to optimize the items(*) functions to simply check for hasCursor()/acceptsHoverEvents() before we do complex checks like intersects/collidesWithPath() etc. Auto test included. Reviewed-by: Andreas
* | Use qIsFuzzyNull rather than qFuzzyCompareBjoern Erik Nilsen2009-04-071-2/+2
| | | | | | | | | | qIsFuzzyNull is much cheaper than qFuzzyCompare, and in this case qIsFuzzyNull will do the trick.
* | Merge commit 'origin/4.5'Bjoern Erik Nilsen2009-04-071-106/+255
|\ \ | |/ | | | | | | | | | | | | Conflicts: src/gui/graphicsview/qgraphicsitem.cpp src/gui/graphicsview/qgraphicsitem_p.h src/gui/graphicsview/qgraphicsscene.cpp src/gui/painting/qtransform.cpp
| * Fixes: Optimize the way we adjust rectangles.Bjoern Erik Nilsen2009-04-061-28/+48
| | | | | | | | | | RevBy: Olivier AutoTest: Still pass
| * Fixes: Minimize QVariant overhead related to QGraphicsItem::itemChange.Bjoern Erik Nilsen2009-04-061-11/+13
| | | | | | | | | | RevBy: Andreas AutoTest: included
| * Optimise QGraphicsScene/View::items(const QPointF &pos)Lars Knoll2009-04-061-12/+82
| | | | | | | | | | Implement specialized (and more efficient versions) of item_helper() and child_helper() that test for QPointF in the scene.
| * Fixes: Don't bother updating hidden items.Bjoern Erik Nilsen2009-04-061-0/+3
| | | | | | | | AutoTest: Still pass
| * Fixes: Don't bother processing items that are clipped away.Bjoern Erik Nilsen2009-04-061-52/+64
| | | | | | | | RevBy: Andreas
| * Fixes: Get rid of lots of calls to qFuzzyCompare.Bjoern Erik Nilsen2009-04-061-3/+3
| | | | | | | | | | | | | | 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: Cleanup/Optimize QGraphicsView::findItems.Bjoern Erik Nilsen2009-04-061-19/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: 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: Get rid of a gazillion calls to QTransform::operator*=.Bjoern Erik Nilsen2009-04-061-2/+3
| | | | | | | | Details: Be a little bit smarter before doing *= :)
| * Fixes: Use QRect::isEmpty() rather than isNull() if possible.Bjoern Erik Nilsen2009-04-061-1/+1
| | | | | | | | | | | | RevBy: Andreas Details: Note that isNull() implies isEmpty(), but it only catches the cases where width and height is 0.
* | Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qtSimon Hausmann2009-04-021-4/+7
|\ \ | |/ | | | | | | Conflicts: tools/linguist/shared/profileevaluator.cpp
| * 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
| * Long live Qt 4.5!Lars Knoll2009-03-231-0/+5360
|
* Long live Qt!Lars Knoll2009-03-231-0/+5377