| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
Adds a simple test to check whether redundant anchors avoid
simplification to happen. In this case, the use of addCornerAnchors
generate redundant anchors.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
|
|
|
|
|
|
|
|
|
| |
We were not handling the case where a parallel anchor is created
to simplify a central anchor. Unfortunately no tests had shown
that case yet.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
|
|
|
|
|
|
| |
After the removal of the expanding size hint support.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
|
|
|
|
|
|
| |
Prevent failures when the test is run with QT_ANCHORLAYOUT_NO_SIMPLIFICATION
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
|
|
|
|
|
|
|
|
|
| |
The infiniteSizes test is supposed to work w/o simplification,
to ensure that I'm adding a central anchor. With this anchor
we force the problem to go to the simplex solver and expect
it to solve things fine anyway.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit improves the way QGAL handles setups where most anchors
or items do not have explicit maximum sizes.
By default the internal layout anchors and others, have maximum size
of QWIDGETSIZE_MAX. It happens though that this value is rather arbitrary
but yet, can restrict the size of other paths in the layout.
For instance, in the setup below, where the maximum sizes of A and B is
not set:
________ ________
| | item A | | item B | |
o---o--------o---o--------o---o
| |________| |________| |
| |
| (layout structural anchor) |
o-----------------------------o
| |
the bottom path, of maximum size QWIDGETSIZE_MAX, restricts the lenght
of the path at the top, of maximum size of 2 x QWIDGETSIZE_MAX.
This introduces the need of fair distribution in the path A-B. While
that's not an issue when the path is simplified to a single anchor,
it may lead to unbalanced distributions if such simplification is
not possible. As this case may arise when we have center anchors
in the top path, it may appear in real-world cases.
To work around that, we do not limit the maximum width of the layout
anchor or parallel anchors that may have taken its place. The practical
result in the example above is that the sizeAtMaximum will be set at
2 x QWIDGETSIZE_MAX, with a good distribution of A and B.
On the other hand, this oversized layout is not a problem because the
effectiveSizeHint code enforces the respect of QWIDGETSIZE_MAX. That
means the layout will interpolate only between zero and QWIDGETSIZE_MAX
even though its internal maximum size is twice that value.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
|
|
|
|
|
|
| |
Those are useful when dumping the graph in dot format for debugging.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
|
|\
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The current simplification code does not handle sequences with anchors
pointed to different directions could not be simplified together into
a sequential anchor.
A (10 / 20 / 50 ) B (20 / 20 / 20)
Ex: o-----------------> <----------------o
The reason we don't support it yet is shown in the example above. The
resulting anchor would be either:
Result_1 (-10 / 0 / 30)
o------------------------------------>
(or)
Result_2 (-30 / 0 / 10)
<------------------------------------o
But the current implementation assumes no anchors can have negative
sizes.
Hopefully, the next commits will add support for it and then enable
such simplification. :-)
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The calculate graphs now can return early due to unfeasible anchor
setups found out during simplification. This allows finding out
problems in parallel anchors, when one anchor has maximum size smaller
than the minimum size of the other anchor.
The order for simplification and refreshing size hints also has been swaped:
- First, refresh size hints for all anchors in the graph. If the graph is
simplified, the refreshSizeHints() call will reach the children anchors.
- Then, if the simplificated graph is invalid, rebuild it. During this
rebuild, refreshSizeHints_helper() will be called for all levels.
So in both situations we can identify an unfeasible setup. Note that
this test alone is not enough to classify the graph as feasible, depending
on the graph, it will still need to go through the Simplex.
A test case was added and the function that traverse the graph
refreshing now is called refreshAllSizeHints(). The old name was not
so clear since the function will not fill only the anchors that have
items associated.
Last but not least, the lastCalculationUsedSimplex variable is cleared
when starting calculateGraphs(), since we now can leave the function
earlier, without reaching calculateTrunk(), which is the function that
sets it.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
|
|/
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|\
| |
| |
| |
| |
| |
| |
| |
| | |
git://gitorious.org/~fleury/qt/fleury-openbossa-clone into 4.6
Conflicts:
src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
src/gui/graphicsview/qgraphicsanchorlayout_p.h
tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Some tests are expected to fail when run without simplification, ie. by
setting the environment var QT_ANCHORLAYOUT_NO_SIMPLIFICATION.
This commit adds QEXPECT_FAIL before those tests. In some cases
the failures are random therefore we must disable the test instead.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is one good way to track whether simplification is doing all its
job or not. However it can only track cases where the graph simplify
to only one anchor. For more complex cases the graph dumps are the way
to go.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
With four items anchored side by side, each of them being allowed
to grow to QWIDGETSIZE_MAX, we have a situation of fair distribution
because the layout itself can grow only to QWIDGETSIZE_MAX (and not
four times this amount).
This test identified an error on the expanding distribution logic.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is one good way to track whether simplification is doing all its
job or not. However it can only track cases where the graph simplify
to only one anchor. For more complex cases the graph dumps are the way
to go.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
|
|/
|
|
|
|
|
|
|
|
|
|
| |
With four items anchored side by side, each of them being allowed
to grow to QWIDGETSIZE_MAX, we have a situation of fair distribution
because the layout itself can grow only to QWIDGETSIZE_MAX (and not
four times this amount).
This test identified an error on the expanding distribution logic.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
| |
|
|
|
|
|
|
|
|
| |
Now we don't support floating items and so we should consider
that the layout has a conflict when handling this situation.
Signed-off-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since the AnchorData cleanup commit (c974aca8) all anchor initialization
is being done by refreshSizeHints. However that method was not able
to properly initialize the internal layout anchors.
This commit refactors that method both to add the functionality and
improve readability.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
|
|
|
|
|
|
|
| |
Removing QEXPECT_FAIL and making minor corrections on expected
values.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
|
|
|
|
|
|
|
|
|
| |
Add autotests that use the ExpandFlag via QSizePolicy::Expanding
policy. Those tests cover the simple cases and behaviours with
sequential and parallel anchor setups.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
This test would trigger random Q_ASSERT failures but should
work fine after the previous commit.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
|
|
|
|
|
| |
Signed-off-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
|
|
|
|
|
| |
Signed-off-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
|
|
|
|
| |
Currently this fails, so we have to use QEXPECT_FAIL.
|
|
|
|
|
|
|
|
|
|
| |
Added an auto test for the currently supported size policies set.
This is a simple test containing a single item anchored to the layout
vertical and horizontally. The size policies are set, then the
item's minimum, preferred and maximum sizes are compared to the
expected ones, according to each policy.
Signed-off-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org>
|
| |
|
|
|
|
| |
Pointed out by Caio.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
Add a layoutDirection autotest, and sprinkle some of the tests
with checkReverseDirection()
Reviewed-by: Eduardo M. Fleury
|
|
|
|
| |
Reviewed-by: Trust Me
|
| |
|
|
|
|
| |
Reviewed-by: Trust Me
|
|
|
|
| |
Reviewed-by: Trust Me
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
This failed on Alexis' Mac Mini (Leopard)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Having the items named helps when using debugging functions to
identify the anchors. Cause no harm to add them to the tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We changed the parallel example because the expected values for
preferred size are wrong. Before we had a parallel anchor ("d|e") that
should have the maximum preferred of the both children, so this end up
being 170. This parallel is in a sequence with another item ("b") with
a preferred of 150 ending up with 320.
This group is in parallel with "c" that has a maximum of 300. So in
the preferred size of the layout, the group was constraint to 300,
which would be proportionally distributed between "b" and "d|e", and
50%/50% as the test expected.
The proportional distribution is a feature and we changed the test to
illustrate that more. We gave a bump in "c" maximum to 350 and "b"
maximum to 300, so the preferred is 100% for both "b" and "d|e", and
the proportional feature shows up in the maximum allocation, which is
not 100% for the group (b and d|e).
In the group, the maximum possible is 500 but the layout only allows
350, so the sizes need to be proportionally, but in relation not to
zero, but to the preferred which is 320 (this is the same logic used
for setGeometry()). So the growth is 30 / (500 - 320) = 30 / 180 = 1/6.
This 1/6 should be the factor given to the children (b and d|e),
taking their preferred sizes as starting points.
Note that the test still fails, but serve as a milestone to see when
the feature is correct implemented.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
|
|
|
|
|
|
|
|
|
|
| |
This test (which fails right now) check whether a sequential anchor is
distributing proportionally the size between its parts. This should pass
when we make calculateVertexPositions() work together with the simplified
graph.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adding tests that were helpful during debugging simplification
- example: a replica of the anchorlayout example, which has a few interesting
cases.
- parallel2: a small pararell test case, subset of example.
- snakeOppositeDirections: snake but with connections in the opposite
directions (this will end up with anchors with opposite directions).
- fairDistributionOppositeDirections: same as before, but in the end,
this should be taken care by our API which makes internally the same as
fairDistribution.
Some work on adding QCOMPARE() statements may still be needed for this
examples.
Note that is interesting to notice (maybe we can make this available
for the test checking automatically) whether the simplex is being used
or not when simplification is active.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
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>
|