summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsanchorlayout.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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-211-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.
* QGraphicsAnchorLayout: Delete center constraints on item removalEduardo M. Fleury2009-07-221-11/+13
| | | | | | | | | | Each time an item is added to the layout, center constraits are created to ensure its internal anchors keep their size equal. To avoid memory leaks, we must delete them when the item is removed. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
* QGraphicsAnchorLayout: Removing delete d_ptrAnselmo Lacerda S. de Melo2009-07-221-3/+0
| | | | | | Removed an obsolete delete d_ptr, since it is not needed anymore. Signed-off-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org>
* QGraphicsAnchorLayout: Bugfix in spacing() methodEduardo M. Fleury2009-07-221-1/+2
| | | | | | | | In the public Qt::Orientation enum, Horizontal and Vertical mean 0x1 and 0x2 respectivelly, this was causing the internal data structure to be accessed in positions 0 and 2 instead of 0 and 1. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
* QGraphicsAnchorLayout: Apply Jan-Arve's patchEduardo M. Fleury2009-07-221-0/+16
| | | | | | Applying the patch sent by email. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
* QGraphicsAnchorLayout: Temporary destructor to avoid memory leaksEduardo M. Fleury2009-07-221-0/+12
| | | | | | | | | | | | Currently the itemCenterConstraints that are created when an item is added to the layout are never being deleted. Ideally this should be done by the time the item is removed from the layout, this requires some changes in the data structures used though. As a temporary solution we keep all of them until the layout is destroyed. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
* QGraphicsAnchorLayout: Delete internal layout edges in destructorEduardo M. Fleury2009-07-221-0/+2
| | | | | | | The internal layout anchors were leaking, now we delete them when destroying the layout. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
* QGraphicsAnchorLayout: Making private class inherit from QGraphicsLayoutPrivateJesus Sanchez-Palencia2009-07-221-5/+3
| | | | Signed-off-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
* QGraphicsAnchorLayout: Adding QGraphicsAnchorLayout public and private classesJesus Sanchez-Palencia2009-07-221-0/+235
This is a total re-written implementation of QGraphicsAnchorLayout using a numerical approach. We use QGraph and QSimplex in order to achieve this. This first commit gives us a just ready-to-use qgraphicslayout, but the private class still need to inherit from qgraphicslayoutprivate. Optimizations and documentation are all work in progress. Signed-off-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org> Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Signed-off-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>