summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
Commit message (Collapse)AuthorAgeFilesLines
* QGAL: Enable out-of-order sequential simplificationEduardo M. Fleury2009-11-271-46/+23
| | | | | | | | | | | | | | Modify the simplification code to allow the creation of out-of-order sequential anchors. Basically the "changedDirection" end-of-sequence condition was removed, also note that createSequence no longer bothers to revert the direction of anchors if the order it receives is not standard. Removing expect-fail clause from test since now we pass :-) Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
* QGAL: Support for out-of-order sequential anchorsEduardo M. Fleury2009-11-271-6/+34
| | | | | | | | | | | Now sequential anchors account for the fact they may be composed of anchors with different directions. Both refreshSizeHints and updateChildrenSizes have been updated to support this situation. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
* QGAL: Do not revert negative anchorsJesus Sanchez-Palencia2009-11-272-23/+4
| | | | | | | | Since we now support anchors with size less then zero, we no longer need to revert anchors with negative spacing. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
* QGAL: Limit absolute size of anchors and add offset to calculationEduardo M. Fleury2009-11-272-12/+57
| | | | | | | | | | | | | | | | | | | | | This commit is groundwork for the support of negative-sized anchors by the simplex solver. The idea is to add to all variables an offset large enough to ensure they are never negative. The implementation limits all variable sizes in the range [-limit, limit] and feed them into the simplex with an offset of "limit". Subtracting this offset later to find out the real values. "limit" is defined as QWIDGETSIZE_MAX for platforms where qreal is double and as QWIDGETSIZE_MAX / 32 when it is float. This is to avoid numerical errors in the simplex solver. This commit also modifies the ASSERT clause inside QSimplex so it becomes less prone to false positives due to numerical errors. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
* QGAL: Rename internalSizeHints to applySizePolicyEduardo M. Fleury2009-11-271-10/+15
| | | | | | | Former name did not reflect actual work done by the function. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
* QGAL: Fix memory management issues (leak + invalid read)Eduardo M. Fleury2009-11-272-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixing QGraphicsAnchor memory leak and access to free'd region. -- Leak: User-created anchors have two representations in QGAL, one visible externally (QGraphicsAnchor) and other internal (AnchorData). When such anchors are removed externally (QGraphicsAnchor is deleted), the former implementation ensured that the internal representation would be deleted too. However the opposite was not true. In cases where the anchors are deleted internally (in the layout destructor, for instance, or when an item is removed through the removeAt API), the public QGraphicsAnchor object would leak. This commit ensures the deletion will happen in both directions and adds protection to avoid a deletion loop. -- Invalid read: In QGAL::removeAnchor(vertex1, vertex2), we read vertex information after calling removeAnchor_helper(vertex1, vertex2). The problem is that in cases where the removed anchor is the last anchor to connect to a center vertex, its removal will cause also the removal of such vertex. Thus, accessing the vertices after the removeAnchor_helper() call is unsafe. To solve that we cache the information we need and then clear the vertex pointers to avoid errors in the future. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
* QGAL: Prevent internal anchors from being exposed by QGAL::anchor()Eduardo M. Fleury2009-11-271-2/+14
| | | | | | | | | | | Adding check to prevent the structural layout anchors as well as those internal to items, from being exposed through the public API. These checks also ensure no QGraphicsAnchor instances will be created for those anchors. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
* QGAL: default spacing can be unset using a negative valueEduardo M. Fleury2009-11-271-21/+2
| | | | | | | | | | | After a default spacing is set through QGAL::setSpacing() family of methods, the user must be able to unset it. To avoid adding another public method, we enabled this feature by allowing a negative value to be passed to those methods. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org>
* Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6David Boddie2009-11-253-12/+25
|\
| * Mac: Fixes painting artifacts in Graphics ViewBjørn Erik Nilsen2009-11-241-0/+7
| | | | | | | | | | | | | | | | | | Problem was that pending updates were not dispatched properly on the Mac, which is strongly required in order to get correct behavior wrt QGraphicsItem::update(). Task-number: QTBUG-4160 Reviewed-by: bnilsen
| * Merge branch 'fixes' of ↵Jan-Arve Sæther2009-11-232-12/+18
| |\ | | | | | | | | | git://gitorious.org/~fleury/qt/fleury-openbossa-clone into fleury-fixes2
| | * QGAL: sizeHint constraints needed by anchors parallel with the layoutEduardo M. Fleury2009-11-201-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The method "constraintsFromSizeHints" does not create constraints for anchors between the layout vertices _only if_ these anchors have infinite maximum sizes. However, this test was not being done for half-anchors, ie. those created when the layout center anchorage point is used. That was OK when there was no chance that the center anchors had been simplified by a parallel anchor. Nowadays there's a chance that happens, so the test was extended. Commit also adds a test to avoid regressions. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
| | * QGAL: deal correctly with anchors in parallel with the layoutCaio Marcelo de Oliveira Filho2009-11-202-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the preferred size calculation, we should not add 'layout anchors' (either one or the two halves) into the objective function, since the layout doesn't impose or prefer any size at all. This already worked for cases when the layout anchor is one, but not when we have two halves. The mechanism was a 'skipInPreferred' flag that were not being set. The flag is pretty much redundant right now, since we can get this information from the 'isLayoutAnchor' flag. So, the flag was removed and a test was added for both a parallel case with the entire layout and other with half of the layout (which wasn't passing before). Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
* | | Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6David Boddie2009-11-242-1/+2
|\ \ \ | |/ /
| * | Fixes painting issues when scaling a QGraphicsView.Yoann Lopes2009-11-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was that the 'exposed rectangle' passed to the Item's paint() function was rounded to Int values, whereas the one passed to drawBackground and drawForeground was not. Autotest included. Task-number: QTBUG-5859 Reviewed-by: bnilsen
| * | Mark QGraphicsItemAnimation as deprecatedThierry Bastian2009-11-191-0/+1
| |/ | | | | | | Task-number: QTBUG-5968
* | Doc: Fixes to markup.David Boddie2009-11-241-3/+3
|/ | | | Reviewed-by: Trust Me
* Ran the script utils/normalizeOlivier Goffart2009-11-181-2/+2
| | | | Over src/ tools/ examples/ and demos/
* Crash when rendering a scene using DeviceCoordinateCacheGabriel de Dietrich2009-11-181-3/+6
| | | | | | | | | | The execution flow would allow the widget the scene would be rendered on to be null. However this very widget was being used when using DeviceCoordinateCache to get the desktop size. We now skip this optimisation when no widget is given. Auto-test included. Reviewed-by: bnilsen Task-number: QTBUG-5904
* Merge upstream/4.6 into oslo-staging-2Olivier Goffart2009-11-171-2/+3
|\
| * Merge oslo-staging-2/4.6 into upstream/4.6Olivier Goffart2009-11-171-0/+2
| |\
| * \ Merge remote branch 'staging/4.6' into 4.6Simon Hausmann2009-11-171-2/+3
| |\ \
| | * | Fix S60 input method not showing up in editable QGraphicsTextItemsSimon Hausmann2009-11-131-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Correctly set the ItemAcceptsInputMethod flag in setTextInteractionFlags. Reviewed-by: Andreas Reviewed-by: axis Reviewed-by: Janne Koskinen
* | | | Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6Yoann Lopes2009-11-171-0/+2
|\ \ \ \ | | |_|/ | |/| |
| * | | Fix tst_QGraphicsView::inputMethodSensitivity autotestOlivier Goffart2009-11-171-0/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | The problem was that the scene was not notified it lost the focus when it was disconnected from the view (with setScene) So when it got back the focus, nothing was updated because the scene thought it still had the focus. Reviewed-by: jasplin
* | | Fixes polish events for explicitly hidden GraphicsWidgetItems.Yoann Lopes2009-11-171-5/+3
|/ / | | | | | | | | | | | | | | | | The problem was that hidden items never get added to "unpolishedItems" list and thus never get the polish event. Autotest included. Task-number: QTBUG-3939 Reviewed-by: bnilsen
* | Remove warning. (Forgot to commit this together with my previous commits)Jan-Arve Sæther2009-11-131-1/+1
| |
* | Merge branch 'fixes' of ↵Jan-Arve Sæther2009-11-134-368/+182
|\ \ | | | | | | | | | git://gitorious.org/~fleury/qt/fleury-openbossa-clone into fleury-fixes
| * | QGAL: clean up size hint refresh codeCaio Marcelo de Oliveira Filho2009-11-122-65/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code for refreshing size hints of items / user-created anchors now happens with a graph in full (not simplified). So we don't need to now how to refresh size hints for complex anchors. The code for refreshing complex anchors was used also to initialize the complex anchors (the '_helper' functions). Those were changed to calculateSizeHints() and refreshSizeHints() doesn't need to be virtual anymore. Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
| * | QGAL: clean up interpolation codeCaio Marcelo de Oliveira Filho2009-11-122-95/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | Now the interpolation doesn't need to know how to traverse complex anchors, since when it runs, the graph is not simplified anymore. This commit removes unnecessary code for dealing with that. Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
| * | QGAL: remove the caching of simplified graphCaio Marcelo de Oliveira Filho2009-11-123-72/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After discussion with Jan-Arve, we decided to remove for good the caching of simplified graph. This avoided recalculating the simplification (but not the simplex) in some situations. Since vertex simplification, this was temporarily disabled already. To know whether if we could the cached version or not, we needed to track individual anchors to see whether they reached size 0 or they were 0 and changed the size. This is because the vertex simplification depend on that fact. Now the simplified version of the graph exists only during the execution of calculateGraphs() function. This and next commits clear up the code to take advantage of that fact. Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
| * | QGAL: fix update size hints logic in parallel anchorsCaio Marcelo de Oliveira Filho2009-11-121-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When filling sizeAt* values for parallel anchors, we have to identify the case when the second anchor in the parallel doesn't have the same direction as the parallel itself. However, relying on the parallel group vertices to identify this case is not safe, because after a parallel group a new vertex simplification can happen. So, the comparing the 'from' with the first edge is the correct way to verify whether the second is backwards. Code was fixed to follow that. Note that, without negative spacing the case "out-of-order" for parallels is only the trivial case (size == 0). Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
| * | QGAL: Update code documentationEduardo M. Fleury2009-11-121-13/+26
| | | | | | | | | | | | | | | Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
| * | QGAL: Move size information from AnchorData to QGraphicsAnchorPrivateEduardo M. Fleury2009-11-123-108/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To solve the spacing persistency bug, this commit saves the preferredSize (spacing) information inside QGraphicsAnchorPrivate. The problem started when we could not rely on "AnchorData->prefSize" to keep the spacing information for user-defined anchors. This happens because that member can be overriden if the spacing is negative (anchor is inverted) or its sizePolicy is of type "Ignored" (it is overriden by minSize). Then, to decide where to store it, we aimed to make something similar to what happens with item-internal anchors. Those can rely on their items to get fresh information regarding their size, so we decided that user-anchors (that don't have items, but do have QGraphicsAnchors) could read such information from there. This refactory also reduced the deep indirection that existed in the "QGraphicsAnchor->setSpacing" call. Previously it would call internal layout methods to do some black magic, that's now gone. As the spacing information is now stored in the anchor itself, it can do pretty much all the work and, after that, just invalidate the layout. Also, moved information like "AnchorData->hasSize" to QGAnchor as its pretty much related to the preferredSize information itself. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
| * | QGAL: Update header documentation in QGALPrivateEduardo M. Fleury2009-11-121-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As part of the refactoring of the setSpacing logic, we are encoraging the analogy between the references to QGraphicsLayoutItem and to QGraphicsAnchor, from the AnchorData point of view. It happens that leaf anchors (ie, those that were not created by the simplification) either represent an item or an user-created anchor. This means that they should fetch their size information either from a QGraphicsLayoutItem (member AnchorData->item) or from a QGraphicsAnchor (member AnchorData->graphicsAnchor). Thus, I'm organizing the header to make it more consistent to the new concept. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
* | | Fixes QGraphicsWidget: paint() being called before polish().Bjørn Erik Nilsen2009-11-131-0/+8
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is that we request an update() before we schedules a polish event in QGraphicsScene::addItems, which means paint() is being called before polishEvent(). We could try to swap the order in addItems, but that doesn't give us any guarantee that polish is delivered before update (since we have no control over what's happening from outside graphics view). A better solution is to always make sure we don't have unpolished items before we draw. Auto-test included. Task-number: QTBUG-4979 Reviewed-by: Andreas
* | Merge commit 'widget/4.6' into oslo-staging-2/4.6Olivier Goffart2009-11-113-4/+2
|\ \ | |/ |/| | | | | Conflicts: src/gui/painting/qbrush.cpp
| * Revert "Always set a clip on the painter in QGraphicsView."Andreas Aardal Hanssen2009-11-111-3/+0
| | | | | | | | | | | | | | | | | | This reverts commit 4bf7f90a27377f439e86d6175e5e3cdebd131be0. The change is already reverted in kinetic-declarativeui. Reviewed-by: Warwick Allison Reviewed-by: bnilsen
| * QGraphicsTextItem: update when changing the color.Olivier Goffart2009-11-091-0/+1
| | | | | | | | | | Task-number: QTBUG-5418 Reviewed-by: Gabriel
| * Fix warningsThierry Bastian2009-11-091-1/+1
| | | | | | | | Reviewed-by: Trust Me
* | Improvements to graphics effects API after review round.Samuel Rødal2009-11-103-5/+5
|/ | | | | | | | | | | | * Get rid of QGraphicsEffectSource from the public API, instead add convenience functions in QGraphicsEffect. This way we commit to less API, and are free to introduce a customizable QGraphicsEffectSource in a future release. * Move PixmapPadMode into QGraphicsEffect and tweak the names of the enum values. * Make QGraphicsBlurEffect::BlurHint into a bit flag, for extensibility. Reviewed-by: Bjørn Erik Nilsen
* Compile in 64bit with debugOlivier Goffart2009-11-091-1/+1
|
* Merge branch '4.6-api-review' into 4.6Marius Storm-Olsen2009-11-092-2/+2
|\
| * API review: Rename numRects() -> rectCount()Marius Storm-Olsen2009-11-092-2/+2
| | | | | | | | | | | | | | QRegion::numRects() is marked obsolete. Removed all usage of the old function inside Qt and test-cases. Reviewed-by: Andreas Aardal Hanssen
* | More inDestructor checks.Warwick Allison2009-11-091-0/+9
| | | | | | | | | | | | Declarative tripped these (crashes). Reviewed-by:Aaron Kennedy
* | Use at() instead of operator[] for vectors and lists.Jan-Arve Sæther2009-11-071-24/+24
| | | | | | | | | | | | Using operator[] can cause a deep copy if the container is not const. Some of the containers were const, but I changed all of them to use at() since its more Qt-style.
* | Merge branch 'cmarcelo-vertexsimplification' into 4.6Jan-Arve Sæther2009-11-072-171/+559
|\ \
| * \ Merge branch 'anchor-vertex-simplification' of ↵Jan-Arve Sæther2009-11-072-171/+559
| |\ \ | | | | | | | | | | | | git://gitorious.org/~cmarcelo/qt/cmarcelos-clone into cmarcelo-vertexsimplification
| | * | QGAL: avoid passing Orientation for interpolation functionsCaio Marcelo de Oliveira Filho2009-11-062-23/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not all of the interpolation functions needed the orientation information, and the one that needs can look at the orientation of the anchor in the parameter. This simplified a little bit the function calls. Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
| | * | QGAL: vertex simplificationCaio Marcelo de Oliveira Filho2009-11-062-73/+379
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some vertices are connected by anchors with size 0, which means that in practice, they represent the same point when positioning items, i.e. their distance value is the same. In those cases, we can merge the two anchors in one, that's what vertex simplification do. The algorithm is walking in the graph, merging vertices in pairs (this could be enhanced to allow groups with arbitrary number of children vertices) The vertex simplification stage happens before the anchor simplification, so it'll make less passes. Also, in some situations of redudant anchors it will allow more anchors to be simplified. This commit creates a new type of AnchorVertex, add the algorithm for vertex simplification and restoration, make sure that distribution also works with simplified vertices. Consequences: - the assert after creating a sequence might not be true anymore, it was a structural assumption that vertex simplification may destroy; - we assumed that a center anchor could appear only in the beginning or end of the candidates, because the "center vertex" always would have 3 adjacents. A mix of parallel+center and vertex simplification break that assumption. The commit deal with those consequences. We still have one limitation: vertex simplification needs to restore the graph in every invalidation (which might be caused by some child's updateGeometyry()), since a change in the sizeHint might cause a new anchor to have size 0 or a 0-sized anchor to have a different size. In the future we can track the 0 sized anchors and only restore/re-simplify when the set changes. Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>