Qt 4.8
|
QGraphicsAnchorLayout private methods and attributes. More...
#include <qgraphicsanchorlayout_p.h>
Public Types | |
enum | Interval { MinimumToMinPreferred = 0, MinPreferredToPreferred, PreferredToMaxPreferred, MaxPreferredToMaximum } |
enum | Orientation { Horizontal = 0, Vertical, NOrientations } |
Public Types inherited from QGraphicsLayoutItemPrivate | |
enum | SizeComponent { Width, Height } |
Public Functions | |
QGraphicsAnchor * | acquireGraphicsAnchor (AnchorData *data) |
QGraphicsAnchor * | addAnchor (QGraphicsLayoutItem *firstItem, Qt::AnchorPoint firstEdge, QGraphicsLayoutItem *secondItem, Qt::AnchorPoint secondEdge, qreal *spacing=0) |
void | addAnchor_helper (QGraphicsLayoutItem *firstItem, Qt::AnchorPoint firstEdge, QGraphicsLayoutItem *secondItem, Qt::AnchorPoint secondEdge, AnchorData *data) |
AnchorData * | addAnchorMaybeParallel (AnchorData *newAnchor, bool *feasible) |
Adds newAnchor to the graph. More... | |
AnchorVertex * | addInternalVertex (QGraphicsLayoutItem *item, Qt::AnchorPoint edge) |
void | calculateGraphs () |
Called on activation. More... | |
void | calculateGraphs (Orientation orientation) |
Calculate graphs is the method that puts together all the helper routines so that the AnchorLayout can calculate the sizes of each item. More... | |
bool | calculateNonTrunk (const QList< QSimplexConstraint *> &constraints, const QList< AnchorData *> &variables) |
bool | calculateTrunk (Orientation orientation, const GraphPath &trunkPath, const QList< QSimplexConstraint *> &constraints, const QList< AnchorData *> &variables) |
Calculate the sizes for all anchors which are part of the trunk. More... | |
void | calculateVertexPositions (Orientation orientation) |
Calculate the position of each vertex based on the paths to each of them as well as the current edges sizes. More... | |
void | changeLayoutVertex (Orientation orientation, AnchorVertex *oldV, AnchorVertex *newV) |
void | constraintsFromPaths (Orientation orientation) |
Each vertex on the graph that has more than one path to it represents a contra int to the sizes of the items in these paths. More... | |
QList< QSimplexConstraint * > | constraintsFromSizeHints (const QList< AnchorData *> &anchors) |
void | correctEdgeDirection (QGraphicsLayoutItem *&firstItem, Qt::AnchorPoint &firstEdge, QGraphicsLayoutItem *&secondItem, Qt::AnchorPoint &secondEdge) |
Use heuristics to determine the correct orientation of a given anchor. More... | |
void | createCenterAnchors (QGraphicsLayoutItem *item, Qt::AnchorPoint centerEdge) |
By default, each item in the layout is represented internally as a single anchor in each direction. More... | |
void | createItemEdges (QGraphicsLayoutItem *item) |
void | createLayoutEdges () |
Create internal anchors to connect the layout edges (Left to Right and Top to Bottom). More... | |
void | deleteLayoutEdges () |
void | dumpGraph (const QString &name=QString()) |
void | findPaths (Orientation orientation) |
This method walks the graph using a breadth-first search to find paths between the root vertex and each vertex on the graph. More... | |
QGraphicsAnchor * | getAnchor (QGraphicsLayoutItem *firstItem, Qt::AnchorPoint firstEdge, QGraphicsLayoutItem *secondItem, Qt::AnchorPoint secondEdge) |
QList< QList< QSimplexConstraint * > > | getGraphParts (Orientation orientation) |
bool | hasConflicts () const |
Returns true if there are no arrangement that satisfies all constraints. More... | |
void | identifyFloatItems (const QSet< AnchorData *> &visited, Orientation orientation) |
Use all visited Anchors on findPaths() so we can identify non-float Items. More... | |
void | identifyNonFloatItems_helper (const AnchorData *ad, QSet< QGraphicsLayoutItem *> *nonFloatingItemsIdentifiedSoFar) |
Given an anchor, if it is an internal anchor and Normal we must mark it's item as non-float. More... | |
AnchorVertex * | internalVertex (const QPair< QGraphicsLayoutItem *, Qt::AnchorPoint > &itemEdge) const |
AnchorVertex * | internalVertex (const QGraphicsLayoutItem *item, Qt::AnchorPoint edge) const |
void | interpolateEdge (AnchorVertex *base, AnchorData *edge) |
Calculate the current Edge size based on the current Layout size and the size the edge is supposed to have when the layout is at its: More... | |
QGraphicsAnchorLayoutPrivate () | |
void | refreshAllSizeHints (Orientation orientation) |
Traverse the graph refreshing the size hints. More... | |
void | removeAnchor (AnchorVertex *firstVertex, AnchorVertex *secondVertex) |
void | removeAnchor_helper (AnchorVertex *v1, AnchorVertex *v2) |
void | removeAnchors (QGraphicsLayoutItem *item) |
void | removeCenterAnchors (QGraphicsLayoutItem *item, Qt::AnchorPoint centerEdge, bool substitute=true) |
void | removeCenterConstraints (QGraphicsLayoutItem *item, Orientation orientation) |
void | removeInternalVertex (QGraphicsLayoutItem *item, Qt::AnchorPoint edge) |
void | removeVertex (QGraphicsLayoutItem *item, Qt::AnchorPoint edge) |
bool | replaceVertex (Orientation orientation, AnchorVertex *oldV, AnchorVertex *newV, const QList< AnchorData *> &edges) |
void | restoreSimplifiedAnchor (AnchorData *edge) |
void | restoreSimplifiedConstraints (ParallelAnchorData *parallel) |
void | restoreSimplifiedGraph (Orientation orientation) |
void | restoreVertices (Orientation orientation) |
void | setItemsGeometries (const QRectF &geom) |
Use the current vertices distance to calculate and set the geometry of each item. More... | |
void | setupEdgesInterpolation (Orientation orientation) |
Calculate interpolation parameters based on current Layout Size. More... | |
bool | simplifyGraph (Orientation orientation) |
The purpose of this function is to simplify the graph. More... | |
bool | simplifyGraphIteration (Orientation orientation, bool *feasible) |
One iteration of the simplification algorithm. More... | |
bool | simplifyVertices (Orientation orientation) |
bool | solveMinMax (const QList< QSimplexConstraint *> &constraints, GraphPath path, qreal *min, qreal *max) |
bool | solvePreferred (const QList< QSimplexConstraint *> &constraints, const QList< AnchorData *> &variables) |
QLayoutStyleInfo & | styleInfo () const |
void | updateAnchorSizes (Orientation orientation) |
Public Functions inherited from QGraphicsLayoutPrivate | |
void | activateRecursive (QGraphicsLayoutItem *item) |
void | addChildLayoutItem (QGraphicsLayoutItem *item) |
This function is called from subclasses to add a layout item layoutItem to a layout. More... | |
void | getMargin (qreal *result, qreal userMargin, QStyle::PixelMetric pm) const |
QGraphicsLayoutPrivate () | |
void | reparentChildItems (QGraphicsItem *newParent) |
Qt::LayoutDirection | visualDirection () const |
Public Functions inherited from QGraphicsLayoutItemPrivate | |
QSizeF * | effectiveSizeHints (const QSizeF &constraint) const |
void | ensureUserSizeHints () |
Ensures that userSizeHints is allocated. More... | |
bool | hasHeightForWidth () const |
bool | hasWidthForHeight () const |
void | init () |
QGraphicsItem * | parentItem () const |
Returns the parent item of this layout, or 0 if this layout is not installed on any widget. More... | |
QGraphicsLayoutItemPrivate (QGraphicsLayoutItem *parent, bool isLayout) | |
void | setSize (Qt::SizeHint which, const QSizeF &size) |
Sets the user size hint which to size. More... | |
void | setSizeComponent (Qt::SizeHint which, SizeComponent component, qreal value) |
Sets the width of the user size hint which to width. More... | |
virtual | ~QGraphicsLayoutItemPrivate () |
Static Public Functions | |
static Orientation | edgeOrientation (Qt::AnchorPoint edge) |
static QGraphicsAnchorLayoutPrivate * | get (QGraphicsAnchorLayout *q) |
static Qt::AnchorPoint | oppositeEdge (Qt::AnchorPoint edge) |
static Qt::AnchorPoint | pickEdge (Qt::AnchorPoint edge, Orientation orientation) |
Static Public Functions inherited from QGraphicsLayoutItemPrivate | |
static QGraphicsLayoutItemPrivate * | get (QGraphicsLayoutItem *q) |
static const QGraphicsLayoutItemPrivate * | get (const QGraphicsLayoutItem *q) |
Friends | |
class | QGraphicsAnchorPrivate |
QGraphicsAnchorLayout private methods and attributes.
Definition at line 376 of file qgraphicsanchorlayout_p.h.
Enumerator | |
---|---|
MinimumToMinPreferred | |
MinPreferredToPreferred | |
PreferredToMaxPreferred | |
MaxPreferredToMaximum |
Definition at line 386 of file qgraphicsanchorlayout_p.h.
Enumerator | |
---|---|
Horizontal | |
Vertical | |
NOrientations |
Definition at line 397 of file qgraphicsanchorlayout_p.h.
QGraphicsAnchorLayoutPrivate::QGraphicsAnchorLayoutPrivate | ( | ) |
Definition at line 623 of file qgraphicsanchorlayout_p.cpp.
|
inline |
Definition at line 433 of file qgraphicsanchorlayout_p.h.
Referenced by addAnchor().
QGraphicsAnchor * QGraphicsAnchorLayoutPrivate::addAnchor | ( | QGraphicsLayoutItem * | firstItem, |
Qt::AnchorPoint | firstEdge, | ||
QGraphicsLayoutItem * | secondItem, | ||
Qt::AnchorPoint | secondEdge, | ||
qreal * | spacing = 0 |
||
) |
The optional spacing argument defines the size of the anchor. If not provided, the anchor size is either 0 or not-set, depending on type of anchor created (see matrix below).
All anchors that remain with size not-set will assume the standard spacing, set either by the layout style or through the "setSpacing" layout API.
Definition at line 1662 of file qgraphicsanchorlayout_p.cpp.
void QGraphicsAnchorLayoutPrivate::addAnchor_helper | ( | QGraphicsLayoutItem * | firstItem, |
Qt::AnchorPoint | firstEdge, | ||
QGraphicsLayoutItem * | secondItem, | ||
Qt::AnchorPoint | secondEdge, | ||
AnchorData * | data | ||
) |
Definition at line 1756 of file qgraphicsanchorlayout_p.cpp.
Referenced by addAnchor(), createCenterAnchors(), createItemEdges(), createLayoutEdges(), and removeCenterAnchors().
AnchorData * QGraphicsAnchorLayoutPrivate::addAnchorMaybeParallel | ( | AnchorData * | newAnchor, |
bool * | feasible | ||
) |
Adds newAnchor to the graph.
Returns the newAnchor itself if it could be added without further changes to the graph. If a new parallel anchor had to be created, then returns the new parallel anchor. If a parallel anchor had to be created and it results in an unfeasible setup, feasible is set to false, otherwise true.
Note that in the case a new parallel anchor is created, it might also take over some constraints from its children anchors.
Definition at line 693 of file qgraphicsanchorlayout_p.cpp.
Referenced by replaceVertex(), and simplifyGraphIteration().
AnchorVertex * QGraphicsAnchorLayoutPrivate::addInternalVertex | ( | QGraphicsLayoutItem * | item, |
Qt::AnchorPoint | edge | ||
) |
Definition at line 1918 of file qgraphicsanchorlayout_p.cpp.
Referenced by addAnchor_helper().
void QGraphicsAnchorLayoutPrivate::calculateGraphs | ( | ) |
Called on activation.
Uses Linear Programming to define minimum, preferred and maximum sizes for the layout. Also calculates the sizes that each item should assume when the layout is in one of such situations.
Definition at line 2087 of file qgraphicsanchorlayout_p.cpp.
Referenced by hasConflicts().
void QGraphicsAnchorLayoutPrivate::calculateGraphs | ( | QGraphicsAnchorLayoutPrivate::Orientation | orientation | ) |
Calculate graphs is the method that puts together all the helper routines so that the AnchorLayout can calculate the sizes of each item.
In a nutshell it should do:
1) Refresh anchor nominal sizes, that is, the size that each anchor would have if no other restrictions applied. This is done by quering the layout style and the sizeHints of the items belonging to the layout.
2) Simplify the graph by grouping together parallel and sequential anchors into "group anchors". These have equivalent minimum, preferred and maximum sizeHints as the anchors they replace.
3) Check if we got to a trivial case. In some cases, the whole graph can be simplified into a single anchor. If so, use this information. If not, then call the Simplex solver to calculate the anchors sizes.
4) Once the root anchors had its sizes calculated, propagate that to the anchors they represent.
Definition at line 2136 of file qgraphicsanchorlayout_p.cpp.
bool QGraphicsAnchorLayoutPrivate::calculateNonTrunk | ( | const QList< QSimplexConstraint *> & | constraints, |
const QList< AnchorData *> & | variables | ||
) |
Definition at line 2319 of file qgraphicsanchorlayout_p.cpp.
Referenced by calculateGraphs().
bool QGraphicsAnchorLayoutPrivate::calculateTrunk | ( | Orientation | orientation, |
const GraphPath & | path, | ||
const QList< QSimplexConstraint *> & | constraints, | ||
const QList< AnchorData *> & | variables | ||
) |
Calculate the sizes for all anchors which are part of the trunk.
This works on top of a (possibly) simplified graph.
Definition at line 2249 of file qgraphicsanchorlayout_p.cpp.
Referenced by calculateGraphs().
void QGraphicsAnchorLayoutPrivate::calculateVertexPositions | ( | QGraphicsAnchorLayoutPrivate::Orientation | orientation | ) |
Calculate the position of each vertex based on the paths to each of them as well as the current edges sizes.
Definition at line 2769 of file qgraphicsanchorlayout_p.cpp.
|
inline |
Definition at line 520 of file qgraphicsanchorlayout_p.h.
Referenced by restoreVertices(), and simplifyVertices().
void QGraphicsAnchorLayoutPrivate::constraintsFromPaths | ( | Orientation | orientation | ) |
Each vertex on the graph that has more than one path to it represents a contra int to the sizes of the items in these paths.
This method walks the list of paths to each vertex, generate the constraints and store them in a list so they can be used later by the Simplex solver.
Definition at line 2430 of file qgraphicsanchorlayout_p.cpp.
Referenced by calculateGraphs().
QList< QSimplexConstraint * > QGraphicsAnchorLayoutPrivate::constraintsFromSizeHints | ( | const QList< AnchorData *> & | anchors | ) |
Create LP constraints for each anchor based on its minimum and maximum sizes, as specified in its size hints
Definition at line 2466 of file qgraphicsanchorlayout_p.cpp.
Referenced by calculateTrunk().
void QGraphicsAnchorLayoutPrivate::correctEdgeDirection | ( | QGraphicsLayoutItem *& | firstItem, |
Qt::AnchorPoint & | firstEdge, | ||
QGraphicsLayoutItem *& | secondItem, | ||
Qt::AnchorPoint & | secondEdge | ||
) |
Use heuristics to determine the correct orientation of a given anchor.
After API discussions, we decided we would like expressions like anchor(A, Left, B, Right) to mean the same as anchor(B, Right, A, Left). The problem with this is that anchors could become ambiguous, for instance, what does the anchor A, B of size X mean?
"pos(B) = pos(A) + X" or "pos(A) = pos(B) + X" ?
To keep the API user friendly and at the same time, keep our algorithm deterministic, we use an heuristic to determine a direction for each added anchor and then keep it. The heuristic is based on the fact that people usually avoid overlapping items, therefore:
"A, RIGHT to B, LEFT" means that B is to the LEFT of A. "B, LEFT to A, RIGHT" is corrected to the above anchor.
Special correction is also applied when one of the items is the layout. We handle Layout Left as if it was another items's Right and Layout Right as another item's Left.
Definition at line 2020 of file qgraphicsanchorlayout_p.cpp.
Referenced by addAnchor().
void QGraphicsAnchorLayoutPrivate::createCenterAnchors | ( | QGraphicsLayoutItem * | item, |
Qt::AnchorPoint | centerEdge | ||
) |
By default, each item in the layout is represented internally as a single anchor in each direction.
For instance, from Left to Right.
However, to support anchorage of items to the center of items, we must split this internal anchor into two half-anchors. From Left to Center and then from Center to Right, with the restriction that these anchors must have the same time at all times.
Definition at line 1471 of file qgraphicsanchorlayout_p.cpp.
Referenced by addAnchor().
void QGraphicsAnchorLayoutPrivate::createItemEdges | ( | QGraphicsLayoutItem * | item | ) |
Definition at line 1442 of file qgraphicsanchorlayout_p.cpp.
Referenced by addAnchor().
void QGraphicsAnchorLayoutPrivate::createLayoutEdges | ( | ) |
Create internal anchors to connect the layout edges (Left to Right and Top to Bottom).
These anchors doesn't have size restrictions, that will be enforced by other anchors and items in the layout.
Definition at line 1401 of file qgraphicsanchorlayout_p.cpp.
void QGraphicsAnchorLayoutPrivate::deleteLayoutEdges | ( | ) |
Definition at line 1429 of file qgraphicsanchorlayout_p.cpp.
Definition at line 3063 of file qgraphicsanchorlayout_p.cpp.
Referenced by simplifyGraph().
|
static |
Definition at line 1384 of file qgraphicsanchorlayout_p.cpp.
Referenced by addAnchor(), addAnchor_helper(), getAnchor(), AnchorData::refreshSizeHints(), removeAnchor_helper(), and removeVertex().
void QGraphicsAnchorLayoutPrivate::findPaths | ( | Orientation | orientation | ) |
This method walks the graph using a breadth-first search to find paths between the root vertex and each vertex on the graph.
The edges directions in each path are considered and they are stored as a positive edge (left-to-right) or negative edge (right-to-left).
The list of paths is used later to generate a list of constraints.
Definition at line 2374 of file qgraphicsanchorlayout_p.cpp.
Referenced by calculateGraphs().
|
inlinestatic |
Definition at line 405 of file qgraphicsanchorlayout_p.h.
QGraphicsAnchor * QGraphicsAnchorLayoutPrivate::getAnchor | ( | QGraphicsLayoutItem * | firstItem, |
Qt::AnchorPoint | firstEdge, | ||
QGraphicsLayoutItem * | secondItem, | ||
Qt::AnchorPoint | secondEdge | ||
) |
Definition at line 1796 of file qgraphicsanchorlayout_p.cpp.
QList< QList< QSimplexConstraint * > > QGraphicsAnchorLayoutPrivate::getGraphParts | ( | Orientation | orientation | ) |
Definition at line 2561 of file qgraphicsanchorlayout_p.cpp.
Referenced by calculateGraphs().
bool QGraphicsAnchorLayoutPrivate::hasConflicts | ( | ) | const |
Returns true if there are no arrangement that satisfies all constraints.
Otherwise returns false.
Definition at line 3052 of file qgraphicsanchorlayout_p.cpp.
void QGraphicsAnchorLayoutPrivate::identifyFloatItems | ( | const QSet< AnchorData *> & | visited, |
Orientation | orientation | ||
) |
Use all visited Anchors on findPaths() so we can identify non-float Items.
Definition at line 2655 of file qgraphicsanchorlayout_p.cpp.
Referenced by findPaths().
void QGraphicsAnchorLayoutPrivate::identifyNonFloatItems_helper | ( | const AnchorData * | ad, |
QSet< QGraphicsLayoutItem *> * | nonFloatingItemsIdentifiedSoFar | ||
) |
Given an anchor, if it is an internal anchor and Normal we must mark it's item as non-float.
If the anchor is Sequential or Parallel, we must iterate on its children recursively until we reach internal anchors (items).
Definition at line 2679 of file qgraphicsanchorlayout_p.cpp.
Referenced by identifyFloatItems().
|
inline |
Definition at line 510 of file qgraphicsanchorlayout_p.h.
Referenced by createCenterAnchors(), createLayoutEdges(), deleteLayoutEdges(), getAnchor(), removeCenterAnchors(), removeCenterConstraints(), removeVertex(), and setItemsGeometries().
|
inline |
Definition at line 515 of file qgraphicsanchorlayout_p.h.
void QGraphicsAnchorLayoutPrivate::interpolateEdge | ( | AnchorVertex * | base, |
AnchorData * | edge | ||
) |
Calculate the current Edge size based on the current Layout size and the size the edge is supposed to have when the layout is at its:
These three key values are calculated in advance using linear programming (more expensive) or the simplification algorithm, then subsequential resizes of the parent layout require a simple interpolation.
Definition at line 2856 of file qgraphicsanchorlayout_p.cpp.
Referenced by calculateVertexPositions().
|
static |
Definition at line 641 of file qgraphicsanchorlayout_p.cpp.
Referenced by addAnchor().
|
inlinestatic |
void QGraphicsAnchorLayoutPrivate::refreshAllSizeHints | ( | Orientation | orientation | ) |
Traverse the graph refreshing the size hints.
Edges will query their associated item or graphicsAnchor for their size hints.
Definition at line 2349 of file qgraphicsanchorlayout_p.cpp.
Referenced by calculateGraphs().
void QGraphicsAnchorLayoutPrivate::removeAnchor | ( | AnchorVertex * | firstVertex, |
AnchorVertex * | secondVertex | ||
) |
Implements the high level "removeAnchor" feature. Called by the QAnchorData destructor.
Definition at line 1831 of file qgraphicsanchorlayout_p.cpp.
Referenced by QGraphicsAnchorPrivate::~QGraphicsAnchorPrivate().
void QGraphicsAnchorLayoutPrivate::removeAnchor_helper | ( | AnchorVertex * | v1, |
AnchorVertex * | v2 | ||
) |
Definition at line 1905 of file qgraphicsanchorlayout_p.cpp.
Referenced by addAnchor_helper(), createCenterAnchors(), deleteLayoutEdges(), removeAnchor(), and removeCenterAnchors().
void QGraphicsAnchorLayoutPrivate::removeAnchors | ( | QGraphicsLayoutItem * | item | ) |
Definition at line 1981 of file qgraphicsanchorlayout_p.cpp.
void QGraphicsAnchorLayoutPrivate::removeCenterAnchors | ( | QGraphicsLayoutItem * | item, |
Qt::AnchorPoint | centerEdge, | ||
bool | substitute = true |
||
) |
Definition at line 1536 of file qgraphicsanchorlayout_p.cpp.
Referenced by removeAnchors(), and removeInternalVertex().
void QGraphicsAnchorLayoutPrivate::removeCenterConstraints | ( | QGraphicsLayoutItem * | item, |
Orientation | orientation | ||
) |
Definition at line 1619 of file qgraphicsanchorlayout_p.cpp.
void QGraphicsAnchorLayoutPrivate::removeInternalVertex | ( | QGraphicsLayoutItem * | item, |
Qt::AnchorPoint | edge | ||
) |
returns the AnchorVertex that was dereferenced, also when it was removed. returns 0 if it did not exist.
Definition at line 1939 of file qgraphicsanchorlayout_p.cpp.
Referenced by removeAnchor_helper(), and removeVertex().
void QGraphicsAnchorLayoutPrivate::removeVertex | ( | QGraphicsLayoutItem * | item, |
Qt::AnchorPoint | edge | ||
) |
Definition at line 1967 of file qgraphicsanchorlayout_p.cpp.
Referenced by removeAnchors().
bool QGraphicsAnchorLayoutPrivate::replaceVertex | ( | Orientation | orientation, |
AnchorVertex * | oldV, | ||
AnchorVertex * | newV, | ||
const QList< AnchorData *> & | edges | ||
) |
Definition at line 904 of file qgraphicsanchorlayout_p.cpp.
Referenced by simplifyVertices().
void QGraphicsAnchorLayoutPrivate::restoreSimplifiedAnchor | ( | AnchorData * | edge | ) |
Definition at line 1210 of file qgraphicsanchorlayout_p.cpp.
Referenced by restoreSimplifiedGraph().
void QGraphicsAnchorLayoutPrivate::restoreSimplifiedConstraints | ( | ParallelAnchorData * | parallel | ) |
Definition at line 1257 of file qgraphicsanchorlayout_p.cpp.
Referenced by restoreSimplifiedAnchor(), and restoreVertices().
void QGraphicsAnchorLayoutPrivate::restoreSimplifiedGraph | ( | Orientation | orientation | ) |
Definition at line 1283 of file qgraphicsanchorlayout_p.cpp.
Referenced by calculateGraphs(), and simplifyGraph().
void QGraphicsAnchorLayoutPrivate::restoreVertices | ( | Orientation | orientation | ) |
Definition at line 1312 of file qgraphicsanchorlayout_p.cpp.
Referenced by restoreSimplifiedGraph(), and simplifyGraph().
void QGraphicsAnchorLayoutPrivate::setItemsGeometries | ( | const QRectF & | geom | ) |
Use the current vertices distance to calculate and set the geometry of each item.
Definition at line 2708 of file qgraphicsanchorlayout_p.cpp.
void QGraphicsAnchorLayoutPrivate::setupEdgesInterpolation | ( | Orientation | orientation | ) |
Calculate interpolation parameters based on current Layout Size.
Must be called once before calling "interpolateEdgeSize()" for the edges.
Definition at line 2818 of file qgraphicsanchorlayout_p.cpp.
Referenced by calculateVertexPositions().
bool QGraphicsAnchorLayoutPrivate::simplifyGraph | ( | Orientation | orientation | ) |
The purpose of this function is to simplify the graph.
Simplification serves two purposes:
It is essential that it must be possible to restore simplified anchors back to their "original" form. This is done by restoreSimplifiedAnchor().
There are two types of simplification that can be done:
The process of simplification can be described as:
When creating the parallel anchors, the algorithm might identify unfeasible situations. In this case the simplification process stops and returns false. Otherwise returns true.
Definition at line 847 of file qgraphicsanchorlayout_p.cpp.
Referenced by calculateGraphs().
bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration | ( | QGraphicsAnchorLayoutPrivate::Orientation | orientation, |
bool * | feasible | ||
) |
One iteration of the simplification algorithm.
Returns true if another iteration is needed.
The algorithm walks the graph in depth-first order, and only collects vertices that has two edges connected to it. If the vertex does not have two edges or if it is a layout edge, it will take all the previously collected vertices and try to create a simplified sequential anchor representing all the previously collected vertices. Once the simplified anchor is inserted, the collected list is cleared in order to find the next sequence to simplify.
Note that there are some catches to this that are not covered by the above explanation, see the function comments for more details.
Definition at line 1054 of file qgraphicsanchorlayout_p.cpp.
Referenced by simplifyGraph().
bool QGraphicsAnchorLayoutPrivate::simplifyVertices | ( | Orientation | orientation | ) |
Definition at line 938 of file qgraphicsanchorlayout_p.cpp.
Referenced by simplifyGraph().
bool QGraphicsAnchorLayoutPrivate::solveMinMax | ( | const QList< QSimplexConstraint *> & | constraints, |
GraphPath | path, | ||
qreal * | min, | ||
qreal * | max | ||
) |
Definition at line 2876 of file qgraphicsanchorlayout_p.cpp.
Referenced by calculateTrunk().
bool QGraphicsAnchorLayoutPrivate::solvePreferred | ( | const QList< QSimplexConstraint *> & | constraints, |
const QList< AnchorData *> & | variables | ||
) |
Definition at line 2931 of file qgraphicsanchorlayout_p.cpp.
Referenced by calculateNonTrunk(), and calculateTrunk().
QLayoutStyleInfo & QGraphicsAnchorLayoutPrivate::styleInfo | ( | ) | const |
Definition at line 2049 of file qgraphicsanchorlayout_p.cpp.
Referenced by refreshAllSizeHints().
void QGraphicsAnchorLayoutPrivate::updateAnchorSizes | ( | Orientation | orientation | ) |
Definition at line 2449 of file qgraphicsanchorlayout_p.cpp.
Referenced by calculateGraphs().
|
friend |
Definition at line 597 of file qgraphicsanchorlayout_p.h.
QList<AnchorData *> QGraphicsAnchorLayoutPrivate::anchorsFromSimplifiedVertices[2] |
Definition at line 574 of file qgraphicsanchorlayout_p.h.
Referenced by replaceVertex(), restoreSimplifiedAnchor(), restoreSimplifiedGraph(), and restoreVertices().
|
mutable |
Definition at line 595 of file qgraphicsanchorlayout_p.h.
Referenced by styleInfo().
uint QGraphicsAnchorLayoutPrivate::calculateGraphCacheDirty |
Definition at line 593 of file qgraphicsanchorlayout_p.h.
Referenced by calculateGraphs().
QList<QSimplexConstraint *> QGraphicsAnchorLayoutPrivate::constraints[2] |
Definition at line 578 of file qgraphicsanchorlayout_p.h.
Referenced by addAnchorMaybeParallel(), calculateGraphs(), constraintsFromPaths(), and getGraphParts().
Graph<AnchorVertex, AnchorData> QGraphicsAnchorLayoutPrivate::graph[2] |
Definition at line 566 of file qgraphicsanchorlayout_p.h.
Referenced by addAnchor_helper(), addAnchorMaybeParallel(), calculateVertexPositions(), constraintsFromSizeHints(), dumpGraph(), findPaths(), getAnchor(), getGraphParts(), refreshAllSizeHints(), removeAnchor_helper(), removeCenterAnchors(), removeCenterConstraints(), removeVertex(), replaceVertex(), restoreSimplifiedAnchor(), restoreSimplifiedGraph(), restoreVertices(), simplifyGraphIteration(), simplifyVertices(), and updateAnchorSizes().
bool QGraphicsAnchorLayoutPrivate::graphHasConflicts[2] |
Definition at line 586 of file qgraphicsanchorlayout_p.h.
Referenced by calculateGraphs(), hasConflicts(), and QGraphicsAnchorLayoutPrivate().
QMultiHash<AnchorVertex *, GraphPath> QGraphicsAnchorLayoutPrivate::graphPaths[2] |
Definition at line 577 of file qgraphicsanchorlayout_p.h.
Referenced by calculateGraphs(), constraintsFromPaths(), and findPaths().
Interval QGraphicsAnchorLayoutPrivate::interpolationInterval[2] |
Definition at line 583 of file qgraphicsanchorlayout_p.h.
Referenced by interpolateEdge(), and setupEdgesInterpolation().
qreal QGraphicsAnchorLayoutPrivate::interpolationProgress[2] |
Definition at line 584 of file qgraphicsanchorlayout_p.h.
Referenced by interpolateEdge(), QGraphicsAnchorLayoutPrivate(), and setupEdgesInterpolation().
QList<QSimplexConstraint *> QGraphicsAnchorLayoutPrivate::itemCenterConstraints[2] |
Definition at line 579 of file qgraphicsanchorlayout_p.h.
Referenced by addAnchorMaybeParallel(), createCenterAnchors(), getGraphParts(), removeCenterAnchors(), and removeCenterConstraints().
QVector<QGraphicsLayoutItem *> QGraphicsAnchorLayoutPrivate::items |
Definition at line 558 of file qgraphicsanchorlayout_p.h.
Referenced by addAnchor(), createItemEdges(), identifyFloatItems(), removeAnchor(), setItemsGeometries(), and simplifyGraph().
bool QGraphicsAnchorLayoutPrivate::lastCalculationUsedSimplex[2] |
Definition at line 590 of file qgraphicsanchorlayout_p.h.
Referenced by calculateGraphs(), and calculateTrunk().
AnchorVertex* QGraphicsAnchorLayoutPrivate::layoutCentralVertex[2] |
Definition at line 569 of file qgraphicsanchorlayout_p.h.
Referenced by constraintsFromSizeHints(), createCenterAnchors(), createLayoutEdges(), getGraphParts(), QGraphicsAnchorLayoutPrivate(), and removeCenterAnchors().
AnchorVertex* QGraphicsAnchorLayoutPrivate::layoutFirstVertex[2] |
Definition at line 568 of file qgraphicsanchorlayout_p.h.
Referenced by calculateVertexPositions(), constraintsFromSizeHints(), createLayoutEdges(), findPaths(), getGraphParts(), QGraphicsAnchorLayoutPrivate(), simplifyGraphIteration(), and simplifyVertices().
AnchorVertex* QGraphicsAnchorLayoutPrivate::layoutLastVertex[2] |
Definition at line 570 of file qgraphicsanchorlayout_p.h.
Referenced by calculateGraphs(), constraintsFromSizeHints(), createLayoutEdges(), getGraphParts(), and QGraphicsAnchorLayoutPrivate().
QSet<QGraphicsLayoutItem *> QGraphicsAnchorLayoutPrivate::m_floatItems[2] |
Definition at line 587 of file qgraphicsanchorlayout_p.h.
Referenced by hasConflicts(), identifyFloatItems(), and setItemsGeometries().
QHash<QPair<QGraphicsLayoutItem*, Qt::AnchorPoint>, QPair<AnchorVertex *, int> > QGraphicsAnchorLayoutPrivate::m_vertexList |
Definition at line 563 of file qgraphicsanchorlayout_p.h.
Referenced by addInternalVertex(), removeAnchor(), and removeInternalVertex().
QList<AnchorVertexPair *> QGraphicsAnchorLayoutPrivate::simplifiedVertices[2] |
Definition at line 573 of file qgraphicsanchorlayout_p.h.
Referenced by restoreVertices(), and simplifyVertices().
qreal QGraphicsAnchorLayoutPrivate::sizeHints[2][3] |
Definition at line 555 of file qgraphicsanchorlayout_p.h.
Referenced by calculateTrunk(), QGraphicsAnchorLayoutPrivate(), and setupEdgesInterpolation().
qreal QGraphicsAnchorLayoutPrivate::spacings[NOrientations] |
Definition at line 553 of file qgraphicsanchorlayout_p.h.
Referenced by QGraphicsAnchorLayoutPrivate(), and styleInfo().
|
mutable |
Definition at line 594 of file qgraphicsanchorlayout_p.h.
Referenced by styleInfo().