| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Reviewed-by: Alexis
|
|
|
|
|
|
| |
- Remove a lie.
- When referring to the size of an anchor, refer to it consistently as
'spacing' instead of magnitude.
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|\ |
|
| |\
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| |/
|/|
| |
| | |
Reviewed-by: tom
|
|/
|
|
| |
Reviewed-by: Trust Me
|
|\ |
|
| |
| |
| |
| | |
Improve the documentation for size policy.
|
|/
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Mark QGraphicsAnchor::unsetSpacing as reset function of the spacing
property.
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Note that this does *not* change the content of the docs.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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: janarve
|
|
|
|
| |
Reviewed-by: Trust Me
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
Removed an obsolete delete d_ptr, since it is not needed anymore.
Signed-off-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org>
|