| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Task-number: QTBUG-8590
|
|
|
|
| |
Disable them if sizeof(qreal)==4
|
|
|
|
| |
Reviewed-by: Trust Me
|
|
|
|
| |
Reviewed-by: Alexis
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
Some tests and the example were leaking memory what made it
harder to investigate leaks on the layout itself.
Those were simple errors like not deleting the layout at the
end of the test and were corrected.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
|
|
|
|
|
|
|
|
|
| |
This test ensures that internal anchors are not exposed through the
QGAL::anchor() API and also that the QGraphicsAnchors are deleted
when the associated anchors are deleted internally.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
Currently the user-defined spacing is saved inside "AnchorData->prefSize".
However this value may be modified if spacing is negative or if the
anchor's policy is "QSizePolicy::Ignored".
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
|
|
|
|
|
|
|
|
| |
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)
|