summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsview.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Ooops. Compile :)Bjørn Erik Nilsen2009-06-091-1/+1
|
* Only call qgetenv("QGRAPHICSVIEW_DIRECT") once.Bjørn Erik Nilsen2009-06-091-3/+2
|
* get rid of the hasTransform flag in QGraphicsItemLars Knoll2009-06-091-1/+1
| | | | | | | | Since the transform is now a pointer in QGraphicsItemPrivate, we can use this pointer directly and there's no need for a separate bitflag anymore. Reviewed-by: Andreas
* Massive re-factoring of Graphics View's update mechanism.Bjørn Erik Nilsen2009-06-091-158/+36
| | | | | | | | | | | This is work-in-progress, so don't expect everything to work perfectly. Most of the auto-test pass and examples and demos seem to run fine. Unfortunately I'm too tired to write about the actual update mehanism now, but it's faster than the old approach (if that helps:)). There's more to optimize, but I'll come back to that later. I need some sleep now :) To be continued.
* Further optimizations, from the simple canvas rendering logics.Andreas Aardal Hanssen2009-06-091-1/+1
|
* Fix optimization flags and opacity.Andreas Aardal Hanssen2009-06-091-1/+2
|
* Add recursive drawing method to QGraphicsScene. For now it's opt-in, butAndreas Aardal Hanssen2009-06-091-14/+20
| | | | | | the important thing is by effectively implementing Simple Canvas' approach to drawing, we're in theory (and in practise measured on the desktop) as fast as Simple Canvas when rendering.
* Doc change; QGraphicsView::DontClipPainter is obsolete since Qt 4.5.Andreas Aardal Hanssen2009-05-281-10/+1
| | | | Reviewed-by: Lars
* Fixed 'crazy' warnings about using a string instead of a characterThierry Bastian2009-05-251-1/+1
| | | | | | | Wherever I found that we were using a string instead of a single char I fixed the code. Reviewed-by: olivier
* Graphics View Optimization: Use a simple style option by default.Bjoern Erik Nilsen2009-05-151-107/+13
| | | | | | | | | | | | | | | | | | | | | 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-11/+2
|\ | | | | | | | | Conflicts: tools/macdeployqt/shared/shared.cpp
| * 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
* | Merge branch '4.5'Thiago Macieira2009-05-131-0/+1
|\ \ | |/ | | | | | | Conflicts: tests/auto/qgraphicsview/tst_qgraphicsview.cpp
| * 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
* | Merge branch '4.5' of git@scm.dev.troll.no:qt/qtSimon Hausmann2009-05-061-1/+5
|\ \ | |/ | | | | | | | | Conflicts: src/gui/kernel/qcocoaview_mac_p.h src/gui/widgets/qmainwindow.cpp
| * 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
* | Partially revert 37c72476fc444d3089075473cb4e9aa42ed64694Bjoern Erik Nilsen2009-05-051-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was that mouse move events were not forwarded to the scene when mouse tracking was explicitly enabled on the view. Mouse tracking is disabled by default unless the scene contains an item that accepts hover events or has a cursor set. A mouse move event can only occur if: 1) a mouse button is pressed while moving the mouse 2) mouse tracking is enabled That means the part I've reverted was only hitting when mouse tracking was explicitly enabled, which is wrong. We always have to forward mouse move events to the scene if the view is getting them in the first place. Auto test included. Reviewed-by: Andreas
* | Remove the Direct3D engine.Gunnar Sletta2009-04-241-3/+1
| |
* | Fix QGraphicsView::mapToScene(QRect) to avoid extra adjustments.Andreas Aardal Hanssen2009-04-171-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QGraphicsView::mapToScene(QRect) function assumes that QRect and QRectF share semantics for ::bottomRight(). However, since QRect follows Qt 3 semantics (the rect is based on viewport pixels and (0,0,1,1) is equivalent to one pixel, topleft = bottomright), this function gives unexpected behavior: map(0,0,1,1) gives you an empty polygon! To work around this, users of the function need to adjust their rectangles with (0,0,1,1) to get the correct behavior, matching what QRectF does. QRectF(0,0,1,1).bottomRight() == QPointF(1,1) QRect(0,0,1,1).bottomRight() == QPoint(0,0) Reviewed-by: TrustMe
* | Merge commit 'origin/4.5'Olivier Goffart2009-04-151-20/+20
|\ \ | |/ | | | | | | Conflicts: src/gui/graphicsview/qgraphicsitem.cpp
| * 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
* | Disable mouse tracking in QGraphicsView if possible.Bjoern Erik Nilsen2009-04-071-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge commit 'origin/4.5'Bjoern Erik Nilsen2009-04-071-123/+113
|\ \ | |/ | | | | | | | | | | | | Conflicts: src/gui/graphicsview/qgraphicsitem.cpp src/gui/graphicsview/qgraphicsitem_p.h src/gui/graphicsview/qgraphicsscene.cpp src/gui/painting/qtransform.cpp
| * 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
|
* Long live Qt!Lars Knoll2009-03-231-0/+3871