| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To solve the spacing persistency bug, this commit saves the
preferredSize (spacing) information inside QGraphicsAnchorPrivate.
The problem started when we could not rely on "AnchorData->prefSize"
to keep the spacing information for user-defined anchors. This happens
because that member can be overriden if the spacing is negative
(anchor is inverted) or its sizePolicy is of type "Ignored" (it is
overriden by minSize).
Then, to decide where to store it, we aimed to make something similar
to what happens with item-internal anchors. Those can rely on their
items to get fresh information regarding their size, so we decided
that user-anchors (that don't have items, but do have QGraphicsAnchors)
could read such information from there.
This refactory also reduced the deep indirection that existed
in the "QGraphicsAnchor->setSpacing" call. Previously it would
call internal layout methods to do some black magic, that's now gone.
As the spacing information is now stored in the anchor itself, it
can do pretty much all the work and, after that, just invalidate the
layout.
Also, moved information like "AnchorData->hasSize" to QGAnchor as
its pretty much related to the preferredSize information itself.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
|
|
|
| |
Improve the documentation for size policy.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Reviewed-by: Trust Me
|
|
|
|
| |
Reviewed-by: Trust Me
|
|
|
|
| |
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.
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adding "fillWidth()", "fillHeight()" and "fill()". These convenience
methods simplify the creation of anchor setups where some items
are meant to use the full width and/or height of the layout.
For instance, instead of creating four anchors (bottom, top, left, right)
between an item and the layout, to make it use the full layout area, the
user can call layout->fill(item).
It is also possible to make an item assume the same width or height of
another item, calling layout->fill(firstItem, secondItem).
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
Applying the patch sent by email.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
|
|
|
|
| |
Signed-off-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
|
|
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>
|