| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| | |
|
| | |
|
| |
| |
| |
| | |
Reviewed-by:TrustMe
|
|\ \
| |/
| |
| |
| | |
Conflicts:
examples/graphicsview/graphicsview.pro
|
| | |
|
| |\
| | |
| | |
| | |
| | |
| | |
| | | |
git@gitorious.org:+openbossa-developers/qt/openbossa-clone
Conflicts:
src/gui/graphicsview/graphicsview.pri
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Those are:
* setAnchorSpacing()
* anchorSpacing()
* unsetAnchorSpacing()
Autotests for the two last ones are missing though..
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | | |
Also, only include the "name" member to AnchorData if we are compiling
in debug mode.
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | | |
Functionality-wise it should be the same, its just a bit less code.
|
| | |
| | |
| | |
| | | |
Don't assume that m_item is always a QGraphicsWidget
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This commit implements what's described in the previous commit
QGraphicsAnchorLayout: fix expected values for parallel test
When filling the sizeAt* values (the three points used for interpolation
when setting geometry), now sequential anchors distribute the sizes
to the children in a fair way, i.e. proportionally in relation to the
existing min/pref/max hints.
Each value is defined in relation of the pref (either as a shrinkage in
pref or a grow in pref). In both cases the shrinking/growing factor is
the same for all children.
When we implement support for QSizePolicies, this distribution might be
changed by setting size policies for a certain item or anchor.
This makes two tests work -- so no more expected fail. Also fixed a typo
in one test's expected results.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When creating an anchor we might have to create the edges for an item
if the item is new. In this case both dimensions are affected. The
call is clearly missing since createItemEdges() declared this
dependency via Q_ASSERT.
Patch from Jan-Arve.
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
| | |
| | |
| | |
| | |
| | |
| | | |
For debugging purposes, if QT_ANCHORLAYOUT_NO_SIMPLIFICATION
environment variable is set, the layout won't use
simplification. Useful for some debuggings.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | | |
Need to work more on the overview.
|
| | |
| | |
| | |
| | | |
spacing.
|
| | |
| | |
| | |
| | | |
Hopefully we won't need it more...
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | | |
This was done to avoid any potential shadowing problems (we already use
the variable name 'spacing' several places)
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Bring back the refreshSizeHints() now that we have locally the
necessary information to get the size hints given an arbitrary anchor
data. We also created a bit to set whether the AnchorData is an anchor
of a layout (i.e. connects the layout with something else) or not.
This costs one pointer more in the AnchorData, but simplifies a good
deal of code and avoid traversing the graph to get this information
back, so I think it's worthwhile.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Make AnchorData aware of both vertices instead only one (the
origin). This information is useful for many functions when working in
simplified mode. Changed the name "origin" to "from", and add an "to" field.
Also change setAnchorSizeHintsFromItems() and its helpers to make use
of this information. In a later commit we will rollback to using
recursion for initializing the size hint information.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This commit makes setAnchorSizeHintsFromItems() support a simplified
graph. Instead of going recursively, since AnchorData doesn't have all
needed information, we make a list with all anchors/vertexpairs with
dependencies first. That way we are sure to fill all information, and
the group anchors can peek at its children anchors (dependencies) and
they'll have updated information.
This solutions doesn't require refreshSizeHints(). Alternative
solutions that we might consider are: complementing the AnchorData
information or making refreshSizeHints() take two AnchorVertex as
parameters and use the recursive approach.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Re-start the simplification procedure every time there's a change it
the adjacent count of a vertex -- which happens when a new parallel
anchor is created.
The original algorithm stopped some simplifications too early,
demanding the simplex unnecessarily.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Enable simplification by default. Allow disable during runtime by
using the environment variable QT_ANCHORLAYOUT_NO_SIMPLIFICATION=1 when
running the code.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
| | |
| | |
| | |
| | |
| | |
| | | |
Useful for verifying whether Simplex is being triggered or not.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The function setAnchorSizeHintsFromDefaults() is not necessary, since
a more updated version (ready or almost-ready for simplification) was
added: setAnchorSizeHintsFromItems().
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Instead of going through all anchors after the calculation of the graphs,
do it as early as possible for each part (trunk and nonTrunks) and
recursively updates the children in case of a simplified graph.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
|
| | |
| | |
| | |
| | | |
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In simplification, the preferred size of a parallel group should get the
maximum preferred size (and bound it to the maximum size). This follows
the principle that for an layout item: 'growing is better than
shrinking', and is consistent with what our linear program also do.
This patch also make sure that the sizeAt* are properly initialized to
the preferred size, the idea is if there's no restriction upon an
anchor, it'll keep it's preferred size no matter what.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
|
| | |
| | |
| | |
| | | |
Patch from Jan-Arve.
|
| | |
| | |
| | |
| | | |
Patch from Jan-Arve.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This reverts commit 9e701f76f7478ea078e58076c91fee0d2ec505b4 and also
add a comment explaining why is needed to delay the creation of the
nonTrunkVariables to a later moment.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | | |
ready.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The problem was that if an item had a center anchor and we removed the
left-center anchor before we called removeCenterAnchors().
Suppose the center vertex had 3 edges, (refcount was 3)
removeAnchor would then *first* remove the left-center edge, causing the
internalVertex refcount to go to 2. That would cause removeInternalVertex()
to try to "merge" the two center anchors by calling removeCenterAnchors().
Of course, calling removeCenterAnchors at that point did not work since
removeCenterAnchors() assumed that the only two edges connected to the center
vertex was its internal left-center and center-right anchors. This was not
the case, and the assertion
Q_ASSERT(first && center && last);
was triggered, since first (or last) was removed at that point.
Of course it was not enough to simply call removeCenterAnchors first,
because that function assumed that the only two anchors connected to the
center vertex was "internal center anchors".
removeAnchors is a bit special since we are not really interested in
first converting the "internal center anchors" to a single internal anchor
because the ultimate goal of that function is to remove *all* anchors.
The solution was the additional argument "substitute" to indicate
that we really just want to substitute with a simpler anchor (normal
behaviour). If not, we really just want to delete the center anchors (don't
even try to merge them into a simple internal anchor).
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This gives a list of all "edges" in the graph, but each edge is
specified as a pair of vertices, since you cannot easily know the
two AnchorVertex'es of an EdgeData.
Added some debug stuff.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This commit enables graph simplification in its simplest way, which is
to simplify the graph, run simplex and then restore it back.
It also adds code to handle cases where the simplification handles
the whole graph, and that therefore no simplex needs to be run.
Additionally, the updateChildrenSizes() method is called on every
root anchor in order to propagate the new sizes down the tree.
A know issue appeared after this commit, as the quote below explains:
=====
Q_ASSERT error in "Parallel" test
That's something that started happening in the Parallel test
(tests/auto/qgraphicsanchorlayout) after my commit of today, that enables
simplification. I haven't been able to investigate it deeply but that's what
I know about it:
- It's triggered when the layout is destroyed, more precisely, from within
"deleteLayoutEdges". What happens is that the layout structural anchors are
missing at that point.
- I suspect there's something to do with the simplifyGraph() and/or
restoreSimplifyGraph() code. I say that because I tried moving the
"restoreSimplifiedGraph" call from the end of the calculateGraph(s) method
to the line exactly below the "simplifyGraph()" and the error still happens.
That means that simplifying and then immediately restoring the graph might
not leave it to the point where it was before the simplification.
====
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
That's too important a method to remain without at least some doc ;)
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This method is meant to be called by the AnchorLayout after it has
set the sizes of all root anchors of a simplified graph.
The idea here it that these anchors will then propagate its new
sizes down the simplification tree.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Using same logic as for the items. We now create the center anchors
on demand and delete them when not needed anymore.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|