| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
Now sequential anchors account for the fact they may be composed of
anchors with different directions.
Both refreshSizeHints and updateChildrenSizes have been updated
to support this situation.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
|
|
|
|
|
|
|
| |
Since we now support anchors with size less then zero, we no longer
need to revert anchors with negative spacing.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit is groundwork for the support of negative-sized anchors
by the simplex solver.
The idea is to add to all variables an offset large enough to ensure
they are never negative. The implementation limits all variable
sizes in the range [-limit, limit] and feed them into the simplex
with an offset of "limit". Subtracting this offset later to find out
the real values.
"limit" is defined as QWIDGETSIZE_MAX for platforms where qreal is
double and as QWIDGETSIZE_MAX / 32 when it is float. This is to
avoid numerical errors in the simplex solver.
This commit also modifies the ASSERT clause inside QSimplex so it
becomes less prone to false positives due to numerical errors.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
|
|
|
|
|
|
| |
Former name did not reflect actual work done by the function.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixing QGraphicsAnchor memory leak and access to free'd region.
-- Leak:
User-created anchors have two representations in QGAL, one
visible externally (QGraphicsAnchor) and other internal (AnchorData).
When such anchors are removed externally (QGraphicsAnchor is deleted),
the former implementation ensured that the internal representation
would be deleted too. However the opposite was not true. In cases
where the anchors are deleted internally (in the layout destructor,
for instance, or when an item is removed through the removeAt API),
the public QGraphicsAnchor object would leak.
This commit ensures the deletion will happen in both directions
and adds protection to avoid a deletion loop.
-- Invalid read:
In QGAL::removeAnchor(vertex1, vertex2), we read vertex information
after calling removeAnchor_helper(vertex1, vertex2).
The problem is that in cases where the removed anchor is the last
anchor to connect to a center vertex, its removal will cause also
the removal of such vertex. Thus, accessing the vertices after
the removeAnchor_helper() call is unsafe.
To solve that we cache the information we need and then clear the
vertex pointers to avoid errors in the future.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Adding check to prevent the structural layout anchors as well as
those internal to items, from being exposed through the public API.
These checks also ensure no QGraphicsAnchor instances will be
created for those anchors.
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>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Problem was that pending updates were not dispatched properly on the
Mac, which is strongly required in order to get correct behavior wrt
QGraphicsItem::update().
Task-number: QTBUG-4160
Reviewed-by: bnilsen
|
| |\
| | |
| | |
| | | |
git://gitorious.org/~fleury/qt/fleury-openbossa-clone into fleury-fixes2
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
|\ \ \
| |/ / |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The problem was that the 'exposed rectangle' passed to the Item's paint() function was rounded to Int values, whereas the one passed to drawBackground and drawForeground was not.
Autotest included.
Task-number: QTBUG-5859
Reviewed-by: bnilsen
|
| |/
| |
| |
| | |
Task-number: QTBUG-5968
|
|/
|
|
| |
Reviewed-by: Trust Me
|
|
|
|
| |
Over src/ tools/ examples/ and demos/
|
|
|
|
|
|
|
|
|
|
| |
The execution flow would allow the widget the scene would be rendered on to be
null. However this very widget was being used when using DeviceCoordinateCache
to get the desktop size. We now skip this optimisation when no widget is
given. Auto-test included.
Reviewed-by: bnilsen
Task-number: QTBUG-5904
|
|\ |
|
| |\ |
|
| |\ \ |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Correctly set the ItemAcceptsInputMethod flag in setTextInteractionFlags.
Reviewed-by: Andreas
Reviewed-by: axis
Reviewed-by: Janne Koskinen
|
|\ \ \ \
| | |_|/
| |/| | |
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The problem was that the scene was not notified it lost the focus
when it was disconnected from the view (with setScene)
So when it got back the focus, nothing was updated because the
scene thought it still had the focus.
Reviewed-by: jasplin
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| | |
The problem was that hidden items never get added to "unpolishedItems" list and thus never get the polish event.
Autotest included.
Task-number: QTBUG-3939
Reviewed-by: bnilsen
|
| | |
|
|\ \
| | |
| | |
| | | |
git://gitorious.org/~fleury/qt/fleury-openbossa-clone into fleury-fixes
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The code for refreshing size hints of items / user-created anchors now
happens with a graph in full (not simplified). So we don't need to now how
to refresh size hints for complex anchors.
The code for refreshing complex anchors was used also to initialize
the complex anchors (the '_helper' functions). Those were changed to
calculateSizeHints() and refreshSizeHints() doesn't need to be virtual
anymore.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Now the interpolation doesn't need to know how to traverse complex
anchors, since when it runs, the graph is not simplified anymore.
This commit removes unnecessary code for dealing with that.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Eduardo M. Fleury <eduardo.fleury@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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When filling sizeAt* values for parallel anchors, we have to identify
the case when the second anchor in the parallel doesn't have the same
direction as the parallel itself. However, relying on the parallel group
vertices to identify this case is not safe, because after a parallel
group a new vertex simplification can happen.
So, the comparing the 'from' with the first edge is the correct way to
verify whether the second is backwards. Code was fixed to follow that.
Note that, without negative spacing the case "out-of-order" for parallels
is only the trivial case (size == 0).
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
|
| | |
| | |
| | |
| | |
| | | |
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
As part of the refactoring of the setSpacing logic, we are encoraging
the analogy between the references to QGraphicsLayoutItem and to
QGraphicsAnchor, from the AnchorData point of view.
It happens that leaf anchors (ie, those that were not created by the
simplification) either represent an item or an user-created anchor.
This means that they should fetch their size information either from
a QGraphicsLayoutItem (member AnchorData->item) or from a QGraphicsAnchor
(member AnchorData->graphicsAnchor).
Thus, I'm organizing the header to make it more consistent to
the new concept.
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
| |/
|/|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The problem is that we request an update() before we schedules a polish
event in QGraphicsScene::addItems, which means paint() is being called before
polishEvent(). We could try to swap the order in addItems, but that
doesn't give us any guarantee that polish is delivered before update
(since we have no control over what's happening from outside graphics
view). A better solution is to always make sure we don't have unpolished
items before we draw.
Auto-test included.
Task-number: QTBUG-4979
Reviewed-by: Andreas
|
|\ \
| |/
|/|
| |
| | |
Conflicts:
src/gui/painting/qbrush.cpp
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit 4bf7f90a27377f439e86d6175e5e3cdebd131be0.
The change is already reverted in kinetic-declarativeui.
Reviewed-by: Warwick Allison
Reviewed-by: bnilsen
|
| |
| |
| |
| |
| | |
Task-number: QTBUG-5418
Reviewed-by: Gabriel
|
| |
| |
| |
| | |
Reviewed-by: Trust Me
|
|/
|
|
|
|
|
|
|
|
|
|
| |
* Get rid of QGraphicsEffectSource from the public API, instead add
convenience functions in QGraphicsEffect. This way we commit to less
API, and are free to introduce a customizable QGraphicsEffectSource
in a future release.
* Move PixmapPadMode into QGraphicsEffect and tweak the names of the
enum values.
* Make QGraphicsBlurEffect::BlurHint into a bit flag, for extensibility.
Reviewed-by: Bjørn Erik Nilsen
|
| |
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
QRegion::numRects() is marked obsolete.
Removed all usage of the old function inside Qt and test-cases.
Reviewed-by: Andreas Aardal Hanssen
|
| |
| |
| |
| |
| |
| | |
Declarative tripped these (crashes).
Reviewed-by:Aaron Kennedy
|
| |
| |
| |
| |
| |
| | |
Using operator[] can cause a deep copy if the container is not const.
Some of the containers were const, but I changed all of them to use at() since
its more Qt-style.
|
|\ \ |
|
| |\ \
| | | |
| | | |
| | | | |
git://gitorious.org/~cmarcelo/qt/cmarcelos-clone into cmarcelo-vertexsimplification
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Not all of the interpolation functions needed the orientation information,
and the one that needs can look at the orientation of the anchor in the
parameter. This simplified a little bit the function calls.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Some vertices are connected by anchors with size 0, which means that
in practice, they represent the same point when positioning items,
i.e. their distance value is the same. In those cases, we can merge the two
anchors in one, that's what vertex simplification do.
The algorithm is walking in the graph, merging vertices in pairs (this could be enhanced to allow groups with arbitrary number of children vertices)
The vertex simplification stage happens before the anchor
simplification, so it'll make less passes. Also, in some situations of
redudant anchors it will allow more anchors to be simplified.
This commit creates a new type of AnchorVertex, add the algorithm
for vertex simplification and restoration, make sure that distribution also
works with simplified vertices.
Consequences:
- the assert after creating a sequence might not be true anymore, it
was a structural assumption that vertex simplification may destroy;
- we assumed that a center anchor could appear only in the beginning
or end of the candidates, because the "center vertex" always would
have 3 adjacents. A mix of parallel+center and vertex
simplification break that assumption.
The commit deal with those consequences.
We still have one limitation: vertex simplification needs to restore
the graph in every invalidation (which might be caused by some child's
updateGeometyry()), since a change in the sizeHint might cause a new
anchor to have size 0 or a 0-sized anchor to have a different size. In
the future we can track the 0 sized anchors and only
restore/re-simplify when the set changes.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Reviewed-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
|