summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
Commit message (Collapse)AuthorAgeFilesLines
* added properties for x,y and z. Removed the notify for the pos property,Lars Knoll2009-06-113-12/+49
| | | | | | | | | | | | add auto tests for QGraphicsObject FX items are better off with property notifications on each component rather than on the position. Added some basic testing for QGraphicsObject and fixed the failures exposed. Reviewed-by: Andreas
* Add some meat to QGraphicsObjectLars Knoll2009-06-114-107/+166
| | | | | | | | Added a toGraphicsObject() method to QGraphicsItem to allow upcasting. Expose some of QGraphicsItems setter/getter pairs as real properties in QGraphicsObject, including NOTIFY signals. Reviewed-by: Andreas
* move some properties from QGraphicsWidget to QGraphicsObjectLars Knoll2009-06-112-4/+4
| | | | | | These are properties of QGraphicsItem. QGraphicsObject should expose these. Reviewed-by: Andreas
* add a QGraphicsObject class and change QGraphicsWidget and QGraphicsTextItem ↵Lars Knoll2009-06-115-49/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | to inherit from it This changes the inheritance hierarchy of QGraphicsWidget from multiply inheriting from QObject, QGraphicsItem and QGraphicsLayoutItem to inherit from QGraphicsObject and QGraphicsLayoutItem. QGraphicsObject then simply inherits from QObject and QGraphicsItem. This change is binary compatible as it will leave the vtable layout unchanged and as the parent class doesn't appear in the C++ name mangling on any of our platforms. It's also source compatible as it isn't noticable by existing code. The restriction we have on QGraphicsObject is that we can not add any new virtual methods to it, or add data members to the class. We can however implement a QGraphicsObjectprivate inheriting from QGraphicsItemPrivate if there is a need to add data members to the class. This change will allow us to now have one single base for all QGraphicsItems that inherit from QObject: QGraphicsTextItem, QGraphicsWidget and in the future QFxItem. Having that single base class will significantly simplify our work in the qml engine. Reviewed-by: Andreas
* Partially revert "Add (back) properties to QGraphicsItem to change theBjørn Erik Nilsen2009-06-111-1/+3
| | | | | | | | | | | | | | | transformations component" This partially reverts commit 56f23d4c, which changed the logic in updateCachedClipPathFromSetPosHelper. We cannot compute the item's transform relative to the parent by using transformToParent() because the new position is not yet set on the item, that's why the new position is passed into the function. However, I'll look into how we can get rid of the entire function, but keep it as is for now. Reviewed-by: Olivier
* We don't have to combine the world matrix anymore.Bjørn Erik Nilsen2009-06-101-5/+3
| | | | | | See also: 32f32ee3e752a6cc03505ddaa48d2849eaedc2a6 Reviewed-by: Andreas
* removed superflous indirection (ie. using q->..) instead of using theThierry Bastian2009-06-102-36/+29
| | | | private class member.
* Fix sorting bug when using BSP tree index + add autotest.Andreas Aardal Hanssen2009-06-092-18/+36
| | | | | | | | | | | | | | | We use stable sorting to keep insertion order. This works fine as long as we sort a complete list of siblings in one go, and this list already has items in insertion order. But if we shuffle such a list, the only way to get proper sort order again (with insertion order intact), is if each item has a sibling index. We used to have this, but we don't have it anymore (as it's not needed for NoIndex mode). So until we separate the BSP index into a separate class and add this index there, we add this workaround which uses the toplevelitems list to ensure the items have the correct order. Reviewed-by: bnilsen
* Remove duplicated code for removing an item from the scene.Bjørn Erik Nilsen2009-06-095-140/+101
| | | | | | | | | Before we had almost two identical functions for removing an item from the scene. There was only minor differences depending on whether the item was removed from QGraphicsScene::removeItem or from the item's destructor. Now we have one function that handles both cases just fine. Reviewed-by: Andreas
* Remove one unnecessary argument from the recursive draw function.Andreas Aardal Hanssen2009-06-093-11/+7
| | | | | We don't have to pass optimization flags; we already have a member variable we can test for painter state protection.
* Fix moving regression for ItemIgnoresTransformations items.Andreas Aardal Hanssen2009-06-091-1/+9
| | | | | | Removes a piece of code in 775ec8e96c9219981ff220ca5f3d24f0501d17b5 that was submitted by accident. The code in mouseMoveEvent is now identical to that in master.
* Fix QGraphicsView::render() regression, ensure the right device is passed.Andreas Aardal Hanssen2009-06-091-2/+4
| | | | | | | | If we pass the viewport widget as the widget pointer when rendering to an arbitrary painter (e.g., onto a pixmap), we confuse the rendering functions to thinking that it's the viewport's region we should render into. So instead, when drawItems() is passed a painter that's different from the view, we pass 0 for the widget.
* Revert 7aee2a7054d1ca280f6dfc9c46b3fe2ce403ccb3, fix render bugs.Andreas Aardal Hanssen2009-06-092-8/+8
| | | | | | | | | | This change introduced an unexpected interdependency for scenes with items that enable ItemStacksBehindParent, and that contain children that are transformed. There's a manual test for this, called clippingAndTransformations, which shows this problem. The bug has been fixed and this change also includes an autotest that covers exactly this problem.
* Add ItemSendsGeometryChanges, replacing itemChangeEnabled().Andreas Aardal Hanssen2009-06-095-72/+102
| | | | | | | | | | | | | This flag toggles whether we should send notifications for setPos, setMatrix, and setTransform. It's off by default. Docs have been updated. All autotests pass. This change also cleans up a bit so that we both have readable code, and keeping the optimized path for when we need to send the notifications. By enabling this flag by default we are going to trigger regressions in end-user code. Reviewed-by: bnilsen
* Auto-test to ensure moved items don't leave traces.Bjørn Erik Nilsen2009-06-091-1/+2
| | | | See also: 1c9032f29d4500b33622d7510b6361c99d9af296
* Revert "Add QGraphicsItem::itemChangeEnabled()."Andreas Aardal Hanssen2009-06-094-198/+81
| | | | | | | | | This reverts commit 0fc58ca3220083b9e10f88aab2e39824c2764db3. Conflicts: src/gui/graphicsview/qgraphicsitem.cpp src/gui/graphicsview/qgraphicsitem_p.h
* Fix two regressions in Plasma. The painter state proctection was notAlexis Menard2009-06-092-5/+3
| | | | | | | | | | properly pass to drawItemHelper. The second is a double conversion to deviceTransform in createStyleOption of QGraphicsItem. Since the recursive drawing already give a transform in device mode we don't need to convert it two times. Reviewed-by:andreas
* Add (back) properties to QGraphicsItem to change the transformations componentOlivier Goffart2009-06-096-109/+517
| | | | | | | | | | | | This reapply commit 8ad5020940f10d4ecc5c5e8b3b9656531cb84ef3 and its dependent change that has been reverted while rebasing the recursivepaint branch. With the new properties it is possible to easily animate transformations Reviewed-by: Andreas Documentation still need to be reviewed.
* A partial QGraphicsItem update causes a full update to be discarded.Bjørn Erik Nilsen2009-06-091-2/+2
| | | | | | | | | | | | | | E.g. item->update(QRectF(0, 0, 5, 5)); item->update(); The problem was that we discarded all update requests whenever the item was already marked as dirty. The dirty bit only means it has pending updates (which might be a full update). However, we have a separate bit for full updates (fullUpdatePending) so we have to check against that bit instead. Makes tst_QGraphicsProxyWidget::paintEvent happy. Another auto-test included.
* QGraphicsItem discard updates when it shouldn't.Bjørn Erik Nilsen2009-06-092-6/+8
| | | | | | | | | | | | | Once a _q_processDirtyItems call is queued, it means we at least have one item that is marked as dirty and we must reset it when the _q_processDirtyItems slot is called. The problem however, was that we didn't reset the item's dirty state if a full scene update occurred in between, i.e. item->update(); scene.update(); We don't have to calculate the item's dirty rect if a full scene update occurs in between, but we still have to reset its state. Auto-test included.
* Child items leave traces when moving an ancestor item.Bjørn Erik Nilsen2009-06-091-1/+6
| | | | | The problem was that we only marked the painted view bounding rect of the moved item as dirty. We also have to mark its children.
* Fix warning.Alexis Menard2009-06-091-2/+2
|
* Fix interaction with QGraphicsWidgets that are a window.Andreas Aardal Hanssen2009-06-091-1/+1
| | | | Use itemCollidesWithPath, the helper function.
* Fix tst_QGraphicsScene::items_QRectF_2(), an intersection bug.Andreas Aardal Hanssen2009-06-091-1/+1
| | | | | The recursive items function didn't contain the special case check for when the source and target rectangle are identical.
* Fix tst_QGraphicsScene::itemIndexMethod(), typo in estimateItemsInRect()Andreas Aardal Hanssen2009-06-091-1/+1
| | | | Don't skip all indexed items that aren't transparent ;-).
* Fix tst_QGraphicsView::cursor2() - sorting bug when using BSP tree.Andreas Aardal Hanssen2009-06-091-2/+2
| | | | | | Make sure we don't claim that we have sorted all toplevel items when we are using the BSP tree, as when painting we have only actually sorted a subset of the elements.
* Removes odd artifact in the chip demo.Bjørn Erik Nilsen2009-06-092-3/+12
| | | | | | | | | | | Calling repaint() instead of update() is bad when having multiple views (which GV perfectly supports). The result is that e.g. when moving a chip in the chip demo, there's a visible lag between each view. It can also be a performance killer on QWS, where the surface is locked for each repaint(). Instead of calling repaint() we call update() as before, but we also make sure the updates are processed immediately.
* Make sure the dirty state of an item is reset when removed from the scene.Bjørn Erik Nilsen2009-06-091-0/+2
| | | | Makes tst_QGraphicsItem::paint happy.
* Discard updates outside the bounding rect.Bjørn Erik Nilsen2009-06-092-1/+4
| | | | Makes tst_QGraphicsItem::cacheMode happy.
* Compatibility fix for QGraphicsScene::changed signal.Bjørn Erik Nilsen2009-06-092-3/+22
| | | | | Makes tst_QGraphicsScene::changedSignal and tst_QGraphicsItem::setMatrix happy.
* Make sure we reset the updateAll variable correctly.Bjørn Erik Nilsen2009-06-091-0/+1
| | | | Makes tst_QGraphicsScene::update happy.
* Compatibility fix for QGraphicsScene::sceneRectChanged()/sceneRect().Bjørn Erik Nilsen2009-06-094-11/+32
| | | | | | | | | | | | | We have to keep the growingItemsBoundingRect up-to-date if there's no scene rect. The only difference now is that sceneRectChanged will not be emitted before entering the event-loop, but the documentation only states it'll be emitted when the scene rect changes, so we consider it harmless. Makes tst_QGraphicsView::sceneRect_growing and tst_QGrahicsScene::sceneRect happy. Reviewed-by: Andreas
* Avoid falling in the else case when there are no views.Bjørn Erik Nilsen2009-06-091-1/+1
| | | | Partially fixes tst_QGraphicsScene::update failure.
* Ensure we pass the intersect mode when checking item collisions.Andreas Aardal Hanssen2009-06-091-1/+1
| | | | | This fixes one of two failures in tst_QGraphicsScene::items_QRectF_2. The other seems unrelated.
* Fix stacking order bug, ensure the dirty sort bits are set correctly.Andreas Aardal Hanssen2009-06-091-1/+12
| | | | | | | | | The code marked the item's own stacking order as dirty when changing its own Z value, the right thing is however to set the _parent's_ bit. Also added missing code for when the ItemStacksBehindParent flag was toggled. Reviewed-by: bnilsen
* Fix rendering of items that ignore parent opacity.Andreas Aardal Hanssen2009-06-091-3/+11
| | | | | | | | | Test if the children ignore the parent's opacity if the current item's opacity is 0.0. If any of the children do ignore the parent then we must continue. Further optimizations are possible: if the item itself is transparent, then don't visit children that don't ignore parent opacity. Reviewed-by: bnilsen
* Fix bug in QGraphicsItem::effectiveOpacity() caused by typo.Andreas Aardal Hanssen2009-06-091-2/+3
| | | | | | | See change 72842b2d, the patch misplaces 'p' and 'parent'. This fixes the tst_QGraphicsItem::opacity autotests. Reviewed-by: bnilsen
* Ensure we can find and draw items whose size is (0x0).Andreas Aardal Hanssen2009-06-091-34/+27
| | | | | | | | | This removes a microoptimization we did to avoid processing items whose size was (0x0). Turns out an autotest started failing if we did this - we have to find and draw such items because they are commonly used to draw points (e.g., plot graphs). Reviewed-by: bnilsen
* Fix clipping bug, move code to avoid unintentional shadowing.Andreas Aardal Hanssen2009-06-091-14/+14
| | | | | | | The children variable tested for clipping was the wrong variable. This broke when the code was moved down as part of a previous cleanup change. Reviewed-by: bnilsen
* Add BSP tree support to the recursive drawing algorithm.Andreas Aardal Hanssen2009-06-091-7/+34
| | | | | The code looks ugly and needs to be refactored, but at least this reintroduces the BSP so the chip demo works fine again.
* Add QGraphicsItem::itemChangeEnabled().Andreas Aardal Hanssen2009-06-094-88/+202
| | | | | | | | | | | | This function allows the user to disable notifications for item changes. In QSimpleCanvasItem, all notifications are disabled by default, and you can enable them one at a time. QGraphicsItem's behavior is to by default enable all notifications. A side effect of this change is that I've removed one optimization in favor of another: by not constructing a QVariant at all when there's no notification we get maximum performance, at the expense of constructing it twice if there is a notification.
* Compatibility fix: Updates made on the scene must be processed with a queued ↵Bjørn Erik Nilsen2009-06-091-1/+5
| | | | | | | | | | connection This connection was queued in the views before, but we don't do that anymore, instead we re-use the _q_emitUpdated slot and process pending updates on the views there. Makes tst_QGraphicsView::viewportUpdateMode happy again.
* Speed up processing of dirty items when ancestor clips children.Bjørn Erik Nilsen2009-06-092-7/+28
| | | | | | This patch also contains a bug fix where a child item didn't update due to a bit not being properly set. No more rendering artifacts :)
* Correct minor mistake after re-refactoring.Bjørn Erik Nilsen2009-06-091-1/+1
| | | | We don't want to re-calculate the dirty rect for each view.
* Avoid constructing empty temporary QTransforms.Andreas Aardal Hanssen2009-06-092-10/+10
| | | | This is a microoptimization.
* Add QGraphicsView::isTransformed(), and use it to avoid view transforms.Andreas Aardal Hanssen2009-06-093-4/+19
| | | | | Ensure that we don't ask for or multiply with the view transform if the view is not transformed.
* Remove leftover code from merge conflict.Andreas Aardal Hanssen2009-06-091-66/+0
|
* Cache QGrahicsItem's scene transform.Bjørn Erik Nilsen2009-06-095-39/+109
| | | | | | | | | | | | | | | | Invalidating the scene transform is just a matter of setting a bit on the item. Then, when we ask for the item's scene transform, we traverse its ancestors recursively and find the top-most dirty item. The algorithm then backtracks to that item and start calculating the scene transform for the item itself and all its children in the call stack. If the item itself and all its ancestors are "clean", nothing is calculated, only traversed. We use this approach when processing dirty items / drawing items as well. That way we ensure the scene transform is only calculated once when absolutely needed. G'night :)
* Generalize QGrahicsScenePrivate::processDirtyItemsRecursive.Bjørn Erik Nilsen2009-06-092-47/+58
| | | | | | | Add back compatibility support and make it independent of the views. Also store the sceneTransform instead of the deviceTransform. This will later be the item's cached scene transform (coming in another commit).
* optimise isFullyTransparent()Lars Knoll2009-06-091-7/+19
| | | | | This cuts down quite some intructions in some use cases, making esp. discardUpdateRequest() a bit cheaper.