summaryrefslogtreecommitdiff
path: root/src/gui/graphicsview/qgraphicsanchorlayout.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Change to release licenses for 4.6.3.Jason McDonald2010-05-301-13/+13
| | | | Reviewed-by: Trust Me
* Update copyright year to 2010Jason McDonald2010-01-071-1/+1
| | | | Reviewed-by: Trust Me
* Add a simple check for a common wrong usage to avoid infinite recursionJan-Arve Sæther2009-12-111-10/+13
| | | | Reviewed-by: Alexis
* Some doc fixesJan-Arve Sæther2009-12-031-2/+2
| | | | | | - Remove a lie. - When referring to the size of an anchor, refer to it consistently as 'spacing' instead of magnitude.
* QGAL: default spacing can be unset using a negative valueEduardo M. Fleury2009-11-251-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>
* QGAL: remove the caching of simplified graphCaio Marcelo de Oliveira Filho2009-11-121-3/+0
| | | | | | | | | | | | | | | | | | | 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>
* docs: Add a section about known issues for the anchor layout.Jan-Arve Sæther2009-11-061-4/+17
|
* Merge commit 'origin/4.6' into featureJørgen Lind2009-11-021-3/+4
|\
| * Merge branch 'fixes' of ↵Jan-Arve Sæther2009-10-281-51/+71
| |\ | | | | | | | | | | | | | | | | | | | | | git://gitorious.org/~fleury/qt/fleury-openbossa-clone into openbossa-fleury-fixes3 Conflicts: src/gui/graphicsview/qgraphicsanchorlayout_p.cpp src/gui/graphicsview/qgraphicsanchorlayout_p.h
| * | Respect the per-item layoutSpacing() if the style uses that feature.Jan-Arve Sæther2009-10-271-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We move the QLayoutStyleInfo class out of the gridlayout engine to a common header file so that anchor layout also can utilize it. Due to that we now can have a per-item spacing we have to change the 'effectiveSpacing' argument of refreshSizeHints to just take a QLayoutStyleInfo pointer that we will later query for the actual spacing used.
* | | Fix SCROLLAREA by fixing missing QT_NO_GRAPHICSVIEW dependenciesJørgen Lind2009-10-291-1/+2
| |/ |/| | | | | Reviewed-by: tom
* | Doc: Reviewed and revised QGraphicsAnchorLayout documentation.David Boddie2009-10-231-51/+71
|/ | | | Reviewed-by: Trust Me
* Merge branch 'qgal-api' into 4.6Jan-Arve Sæther2009-10-211-6/+16
|\
| * Group the spacing functions together, and add a sizePolicy property.Jan-Arve Sæther2009-10-211-6/+16
| | | | | | | | Improve the documentation for size policy.
* | Add some docs that explicitly mentions how we handle cycles in the treeJan-Arve Sæther2009-10-201-0/+3
|/ | | | | | | | This was reported for QGraphicsAnchorLayout, but affects all QGraphicsLayout subclasses. However, since it is not even handled properly in QGraphicsItem::setParentItem() it should be fine that we don't try to deal with this issue. Thus, the layouts are "consistent" with graphics items when it comes to detection of cycles in the tree.
* API addition: Make it possible to set the size policy of an anchor.Jan-Arve Sæther2009-10-161-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | After this commit, when you modify the spacing of an anchor you are effectively modifying the preferred size of the anchor, since all anchors (except internal ones) have their minimumSizeHint to 0 and maximumSizeHint to QWIDGETSIZE_MAX. I also changed the sizeHintsFromItem to be more generic so that I could use it for anchors. (Thus, it was renamed to "internalSizeHints"). It now only takes care of setting the min/pref/exp/maxSize of AnchorData based on the anchor/item size hint and their size policies. As a consequence of all of this, setFixedSize changed behaviour and became setPreferredSize (since setSpacing is basically setPreferredSize). The implementation of that now only sets the prefSize. The patch also has an unrelated fix for IgnoreFlag, where it will (again) return the minimumSize for sizeHint(Qt::PreferredSize) instead of the maximumSize. This was to be more consistent with qgridlayoutengine.cpp. The docs are not very clear on this behaviour unfortunately. This API change has been discussed. Reviewed-by: alexis
* QGraphicsAnchorLayout: Ensure spacing is not negativeEduardo M. Fleury2009-10-091-0/+26
| | | | | | | | | | | Currently we do not support negative-sized anchors in the graph, instead we invert such anchors and make their value positive. We consider changing this sometime in the future but until then, spacing must be non-negative at all times. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
* Doc: silence more qdoc warnings.Volker Hilsheimer2009-10-031-13/+6
| | | | | Mark QGraphicsAnchor::unsetSpacing as reset function of the spacing property.
* After some discussion we decided to remove hasConflicts() from the API.Jan-Arve Sæther2009-09-291-12/+0
| | | | | | | | hasConflicts() does only make sense for a tool/editor of the layout, and how this function would help the tool is only guesswork at the moment. We keep the private API though, in order to let the autotests we inherited from Orbit pass.
* Add missing docs for QGraphicsAnchorJan-Arve Sæther2009-09-291-0/+18
|
* Fix some docs to follow the Qt style. (remove asterisks, proper indenting)Jan-Arve Sæther2009-09-291-44/+44
| | | | Note that this does *not* change the content of the docs.
* QGraphicsAnchorLayout: Initial support for Size PolicyAnselmo Lacerda S. de Melo2009-09-181-1/+0
| | | | | | | | | | | | | In this commit we introduce initial support for Size Policy. The size policies supported now are: * QSizePolicy::Fixed * QSizePolicy::Minimum * QSizePolicy::Maximum * QSizePolicy::Preferred * QSizePolicy::Ignored Signed-off-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org>
* Implement hasConflicts().Jan-Arve Sæther2009-09-171-0/+12
|
* QGraphicsAnchorLayout: Removing methods names inconsistencies on private classJesus Sanchez-Palencia2009-09-171-3/+3
| | | | | | | | | QGraphicsAnchorLayoutPrivate now has addAnchor() replacing anchor() and addAnchor_helper() replacing addAnchor(). With this changes we are respecting the API behavior, where anchor() is a "getter" instead of a "setter". Signed-off-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
* doc: Fixed some qdoc errors.Martin Smith2009-09-151-42/+3
|
* API change. This will get rid of the ugly setAnchorSpacing() method.Jan-Arve Sæther2009-09-141-86/+99
| | | | | | | | | | | | | | | | | | | | Say hello to QGraphicsAnchor, move the spacing (and removeAnchor) functionality over to that class. This also opens up for a cleaner API when we add support for size policies or min/pref/max sizes for anchors. Also remove - addLeftAndRightAnchors() - addTopAndBottomAnchors() - addAllAnchors() in favor of - addAnchors(itemA, itemB, Qt::Orientations) API change discussed with Caio and Andreas. Reviewed-by: Alexis
* Respect the layoutDirection property of the parent widget.Jan-Arve Sæther2009-09-111-1/+1
| | | | | | | Add a layoutDirection autotest, and sprinkle some of the tests with checkReverseDirection() Reviewed-by: Eduardo M. Fleury
* Update license headers again.Jason McDonald2009-09-091-4/+4
| | | | Reviewed-by: Trust Me
* Update tech preview license header for files that are new in 4.6.Jason McDonald2009-08-311-13/+13
| | | | Reviewed-by: Trust Me
* Doc fixes.Jan-Arve Sæther2009-08-271-9/+30
|
* Fixes typo in doc and missing return in anchor layoutLeonardo Sobral Cunha2009-08-261-2/+4
| | | | Reviewed-by: janarve
* Fix obsolete license headers.Jason McDonald2009-08-221-2/+2
| | | | Reviewed-by: Trust Me
* Doc fixes to anchor layout.Jan-Arve Sæther2009-08-211-6/+6
|
* Doc fixes.Jan-Arve Sæther2009-08-211-1/+2
|
* make the new anchor layout code compile with namespaceshjk2009-08-211-0/+4
|
* Implement the functions we added in the API review:Jan-Arve Sæther2009-08-191-15/+38
| | | | | | | | | Those are: * setAnchorSpacing() * anchorSpacing() * unsetAnchorSpacing() Autotests for the two last ones are missing though..
* update API to what was agreed on the API review meeting yesterday:Jan-Arve Sæther2009-08-191-92/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | The changes are: * Move enums in QGraphicsAnchorLayout::Edge to Qt::AnchorPoint. Prefix them with Anchor since they are not edges in general. * Rename anchor() to addAnchor() * Rename anchorCorner() -> addCornerAnchors() * Rename anchorWidth() -> addLeftAndRightAnchors() * Rename anchorHeight() -> addTopAndBottomAnchors() * Rename anchorGeometry() -> addAllAnchors() * remove the overloads that take a spacing argument, and add setAnchorSpacing() to accommodate for that. * Added anchorSpacing() (implementation missing) * Added unsetAnchorSpacing(). (implementation missing) * made sizeHint() protected. Updated all examples and autotest to reflect this API change.
* QGraphicsAnchorLayout: calculate vertex positions with simplified graphCaio Marcelo de Oliveira Filho2009-08-171-5/+0
| | | | | | | | | | | | | | | | When traversing the graph looking for calculating the distances, also enter inside the complex edges to find (and calculate) the distances for the vertices that were simplified. This require a little tweak in the traversal, now we can't always skip an edge when both vertices are already visited, because complex anchors can hide vertices inside (a sequential anchor in practice remove vertices from the full graph). As a bonus we now pass on the 'example' test (as expected) and the example now works fine. Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
* Fill in some missing pieces in the documentation.Jan-Arve Sæther2009-08-171-1/+121
| | | | Need to work more on the overview.
* Add missing call to invalidate() in all functions that modify theJan-Arve Sæther2009-08-171-0/+3
| | | | spacing.
* Clean up public API: move dumpGraph() to private API.Jan-Arve Sæther2009-08-171-18/+0
| | | | Hopefully we won't need it more...
* Small change in the "spacing API".Jan-Arve Sæther2009-08-171-7/+57
| | | | | | | | | | | | | | | | In order to be consistent with QGraphicsGridLayout(QGGL), we remove the void setSpacing(Qt::Orientations ); qreal spacing(Qt::Orientations ); in favor to void setHorizontalSpacing(qreal spacing); void setVerticalSpacing(qreal spacing); void setSpacing(qreal spacing); qreal horizontalSpacing() const; qreal verticalSpacing() const; The API for setting and retrieving spacings should now be the same as in QGGL.
* Change the member QGALPrivate::spacing to QGALPrivate::spacings.Jan-Arve Sæther2009-08-171-2/+2
| | | | | This was done to avoid any potential shadowing problems (we already use the variable name 'spacing' several places)
* QGraphicsAnchorLayout: prepare ground for doing less simplificationsCaio Marcelo de Oliveira Filho2009-08-131-0/+10
| | | | | | | | | | | | | | | | | | Add variables to track whether the graph is simplified or not, as well as make the functions that need it simplified/restored call the corresponding functions. The functions look at the state variables, so it's safe to just call them. Also added Q_ASSERT() through the code paths that SHOULD have the full graph (not simplified), for making easy to track bugs in future refactorings. Ironically this commit cause more calls to simplify/restore right now, but the state will be better when we fix some functions to be simplification compatible ;-) Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
* Update Anchor Layout APIArtur Duque de Souza2009-08-121-8/+8
| | | | | | | | More user friendly API for anchor layouts. Changed method names and also provided more methods to receive spacing. Signed-off-by: Artur Duque de Souza <artur.souza@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
* QGraphicsAnchorLayout: Fix center anchor deletion logicEduardo M. Fleury2009-08-061-3/+0
| | | | | | | | | | | | | | | We were missing a call to "removeCenterAnchors" in the "removeAnchors" method. To solve that, and also reduce the number of useless calls to that method, this commit: 1) Calls it only from "removeInternalVertex" 2) Does some preliminary testing before calling it 3) Replace the former test inside "removeCenterAnchors" by a Q_ASSERT It also adds other Q_ASSERTs to protect us from regression bugs. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
* QGraphicsAnchorLayout: Remove center anchors when not neededEduardo M. Fleury2009-07-221-0/+2
| | | | | | | | | Continuing the effort to enforcing center anchors to exist only when needed, this commit removes the central anchors when they are no longer used. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org>
* Add QGraphicsLayout::anchor() overloads and query the default spacing.Jan-Arve Sæther2009-07-221-45/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes several related issues: 1. QGAL::anchor() had a spacing argument that defaulted to 0. That made it impossible to know if the user meant that the spacing should be 0 or if the spacing should be picked from the style. Instead we have to overload anchor, so now we have one function that does not take spacing as an argument. That one will create an anchor where the spacing is queried from the style. The other overload allows the user to explicitly set the spacing, thus the default spacing is ignored. 2. Make sure we pick up the spacing correctly from the style if needed. setAnchorSizeHintsFromDefaults() will set the correct spacing on anchors that was created without specifying a spacing value. 3. Add QGAL::anchor(Qt::Corner, ...) convenience function with an overload (for the same reason as explained in 1.) 4. Added QGraphicsAnchorLayoutPrivate::anchor() as a helper function that is called from all the 4 public API anchor() functions so that we don't need to have duplicate code for argument checking etc. 5. Fix autotests. They assumed that anchor() without a spacing argument created a spacing of 0.
* QGraphicsAnchorLayout: Fix QGraphicsItem reparent codeEduardo M. Fleury2009-07-221-2/+2
| | | | | | | Using QGraphicsLayoutPrivate methods for proper reparenting of items. This makes it work in cases where nested layouts are used. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
* Some cleanup - improve dot dumper.Jan-Arve Sæther2009-07-221-3/+3
| | | | | | | | | | | | | | | | | The previous dumper relied on traversal of the graph, which meant that it would not output the nodes that were not connected to the "main" graph. Due to this, we cannot rely on traversal, so instead we must iterate through all the vertices of the graph. As an added bonus the code gets simpler :-) There was also a problem with the previous dumper, since it dumped two "digraph" elements into one file. Graphwiz (win32) did not handle that. Instead just dump all the nodes and all the connections, both horizontal and vertical ones. The horizontal and vertical connections are never connected anyway, so the result will be two separate graphs when it is rendered by graphwiz. Also renamed firstVertex to rootVertex and simplified it.