Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
#include <qgraphicsanchorlayout_p.h>
Classes | |
struct | GraphParts |
Public Types | |
enum | Interval { MinimumToMinPreferred = 0 , MinPreferredToPreferred , PreferredToMaxPreferred , MaxPreferredToMaximum } |
typedef Qt::Orientation | Orientation |
Public Types inherited from QGraphicsLayoutItemPrivate | |
enum | SizeComponent { Width , Height } |
Static Public Member Functions | |
static QGraphicsAnchorLayoutPrivate * | get (QGraphicsAnchorLayout *q) |
static Qt::AnchorPoint | oppositeEdge (Qt::AnchorPoint edge) |
static Qt::Orientation | edgeOrientation (Qt::AnchorPoint edge) noexcept |
static Qt::AnchorPoint | pickEdge (Qt::AnchorPoint edge, Qt::Orientation orientation) |
Static Public Member Functions inherited from QGraphicsLayoutItemPrivate | |
static QGraphicsLayoutItemPrivate * | get (QGraphicsLayoutItem *q) |
static const QGraphicsLayoutItemPrivate * | get (const QGraphicsLayoutItem *q) |
Static Public Attributes | |
static constexpr Qt::Orientation | Horizontal = Qt::Horizontal |
static constexpr Qt::Orientation | Vertical = Qt::Vertical |
Friends | |
class | QGraphicsAnchorPrivate |
QGraphicsAnchorLayout private methods and attributes.
Definition at line 346 of file qgraphicsanchorlayout_p.h.
Definition at line 363 of file qgraphicsanchorlayout_p.h.
Enumerator | |
---|---|
MinimumToMinPreferred | |
MinPreferredToPreferred | |
PreferredToMaxPreferred | |
MaxPreferredToMaximum |
Definition at line 356 of file qgraphicsanchorlayout_p.h.
QGraphicsAnchorLayoutPrivate::QGraphicsAnchorLayoutPrivate | ( | ) |
Definition at line 585 of file qgraphicsanchorlayout_p.cpp.
|
inline |
Definition at line 397 of file qgraphicsanchorlayout_p.h.
Referenced by addAnchor().
QGraphicsAnchor * QGraphicsAnchorLayoutPrivate::addAnchor | ( | QGraphicsLayoutItem * | firstItem, |
Qt::AnchorPoint | firstEdge, | ||
QGraphicsLayoutItem * | secondItem, | ||
Qt::AnchorPoint | secondEdge, | ||
qreal * | spacing = nullptr ) |
Implements the high level "addAnchor" feature. Called by the public API addAnchor method.
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 1579 of file qgraphicsanchorlayout_p.cpp.
References acquireGraphicsAnchor(), addAnchor_helper(), QGraphicsLayoutPrivate::addChildLayoutItem(), Qt::AnchorHorizontalCenter, QListSpecialMethodsBase< T >::contains(), correctEdgeDirection(), createCenterAnchors(), createItemEdges(), edgeOrientation(), Qt::Horizontal, items, oppositeEdge(), QGraphicsLayoutItem::parentLayoutItem(), pickEdge(), qWarning, QGraphicsAnchor::setSpacing(), spacing, and QGraphicsAnchor::unsetSpacing().
void QGraphicsAnchorLayoutPrivate::addAnchor_helper | ( | QGraphicsLayoutItem * | firstItem, |
Qt::AnchorPoint | firstEdge, | ||
QGraphicsLayoutItem * | secondItem, | ||
Qt::AnchorPoint | secondEdge, | ||
AnchorData * | data ) |
Definition at line 1673 of file qgraphicsanchorlayout_p.cpp.
References addInternalVertex(), edgeOrientation(), QString::fromLatin1(), graph, removeAnchor_helper(), v1, and Qt::Vertical.
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 625 of file qgraphicsanchorlayout_p.cpp.
References child, constraints, graph, Qt::Horizontal, i, QtGraphicsAnchorLayout::AnchorData::isCenterAnchor, QtGraphicsAnchorLayout::AnchorData::isVertical, itemCenterConstraints, j, and Qt::Vertical.
Referenced by replaceVertex(), and simplifyGraphIteration().
AnchorVertex * QGraphicsAnchorLayoutPrivate::addInternalVertex | ( | QGraphicsLayoutItem * | item, |
Qt::AnchorPoint | edge ) |
Definition at line 1835 of file qgraphicsanchorlayout_p.cpp.
References item, m_vertexList, and Q_ASSERT.
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 1997 of file qgraphicsanchorlayout_p.cpp.
References calculateGraphCacheDirty, calculateGraphs(), Qt::Horizontal, and Qt::Vertical.
Referenced by calculateGraphs(), and hasConflicts().
void QGraphicsAnchorLayoutPrivate::calculateGraphs | ( | Qt::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 querying 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 2042 of file qgraphicsanchorlayout_p.cpp.
References calculateNonTrunk(), calculateTrunk(), constraints, constraintsFromPaths(), findPaths(), getGraphParts(), getVariables(), graphHasConflicts, graphPaths, layoutLastVertex, Q_ASSERT, qDeleteAll(), qEnvironmentVariableIsEmpty(), qWarning, refreshAllSizeHints(), restoreSimplifiedGraph(), simplifyGraph(), and updateAnchorSizes().
bool QGraphicsAnchorLayoutPrivate::calculateNonTrunk | ( | const QList< QSimplexConstraint * > & | constraints, |
const QList< AnchorData * > & | variables ) |
Definition at line 2207 of file qgraphicsanchorlayout_p.cpp.
References constraints, g_offset, j, Q_ASSERT, shiftConstraints(), and solvePreferred().
Referenced by calculateGraphs().
bool QGraphicsAnchorLayoutPrivate::calculateTrunk | ( | Qt::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 2139 of file qgraphicsanchorlayout_p.cpp.
References constraints, constraintsFromSizeHints(), g_offset, Qt::Horizontal, Qt::MaximumSize, Qt::MinimumSize, Qt::PreferredSize, Q_ASSERT, qDebug, qDeleteAll(), shiftConstraints(), QtGraphicsAnchorLayout::AnchorData::sizeAtMinimum, sizeHints, solveMinMax(), and solvePreferred().
Referenced by calculateGraphs().
void QGraphicsAnchorLayoutPrivate::calculateVertexPositions | ( | Qt::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 2623 of file qgraphicsanchorlayout_p.cpp.
References QtGraphicsAnchorLayout::AnchorVertex::distance, graph, i, interpolateEdge(), layoutFirstVertex, qMakePair(), queue, and setupEdgesInterpolation().
|
inline |
Definition at line 488 of file qgraphicsanchorlayout_p.h.
Referenced by restoreVertices(), and simplifyVertices().
void QGraphicsAnchorLayoutPrivate::constraintsFromPaths | ( | Qt::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 2308 of file qgraphicsanchorlayout_p.cpp.
References constraints, graphPaths, and i.
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 2344 of file qgraphicsanchorlayout_p.cpp.
References anchors(), QSimplexConstraint::Equal, g_offset, graph, Qt::Horizontal, i, QHash< Key, T >::insert(), layoutCentralVertex, layoutFirstVertex, layoutLastVertex, QSimplexConstraint::LessOrEqual, QSimplexConstraint::MoreOrEqual, qBound(), qFuzzyCompare(), QWIDGETSIZE_MAX, QtGraphicsAnchorLayout::AnchorData::Slave, QSimplexConstraint::variables, and Qt::Vertical.
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 1933 of file qgraphicsanchorlayout_p.cpp.
References Qt::AnchorBottom, Qt::AnchorRight, and qSwap().
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 1388 of file qgraphicsanchorlayout_p.cpp.
References addAnchor_helper(), Qt::AnchorBottom, Qt::AnchorHorizontalCenter, Qt::AnchorLeft, Qt::AnchorRight, Qt::AnchorTop, Qt::AnchorVerticalCenter, Qt::Horizontal, internalVertex(), item, itemCenterConstraints, layoutCentralVertex, QtGraphicsAnchorLayout::AnchorData::Master, Q_ASSERT, removeAnchor_helper(), QtGraphicsAnchorLayout::AnchorData::Slave, and Qt::Vertical.
Referenced by addAnchor().
void QGraphicsAnchorLayoutPrivate::createItemEdges | ( | QGraphicsLayoutItem * | item | ) |
Definition at line 1362 of file qgraphicsanchorlayout_p.cpp.
References addAnchor_helper(), Qt::AnchorBottom, Qt::AnchorLeft, Qt::AnchorRight, Qt::AnchorTop, QList< T >::append(), item, and items.
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 1321 of file qgraphicsanchorlayout_p.cpp.
References addAnchor_helper(), Qt::AnchorBottom, Qt::AnchorLeft, Qt::AnchorRight, Qt::AnchorTop, Qt::Horizontal, internalVertex(), layout, layoutCentralVertex, layoutFirstVertex, layoutLastVertex, QWIDGETSIZE_MAX, and Qt::Vertical.
void QGraphicsAnchorLayoutPrivate::deleteLayoutEdges | ( | ) |
Definition at line 1349 of file qgraphicsanchorlayout_p.cpp.
References Qt::AnchorBottom, Qt::AnchorHorizontalCenter, Qt::AnchorLeft, Qt::AnchorRight, Qt::AnchorTop, Qt::AnchorVerticalCenter, internalVertex(), Q_ASSERT, and removeAnchor_helper().
|
staticnoexcept |
Definition at line 1307 of file qgraphicsanchorlayout_p.cpp.
References Qt::AnchorRight, Qt::Horizontal, and Qt::Vertical.
Referenced by addAnchor(), addAnchor_helper(), getAnchor(), QtGraphicsAnchorLayout::AnchorData::refreshSizeHints(), removeAnchor_helper(), and removeVertex().
void QGraphicsAnchorLayoutPrivate::findPaths | ( | Qt::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 2256 of file qgraphicsanchorlayout_p.cpp.
References QtGraphicsAnchorLayout::AnchorData::from, graph, graphPaths, identifyFloatItems(), layoutFirstVertex, QtGraphicsAnchorLayout::GraphPath::negatives, QtGraphicsAnchorLayout::GraphPath::positives, qMakePair(), and queue.
Referenced by calculateGraphs().
|
inlinestatic |
Definition at line 369 of file qgraphicsanchorlayout_p.h.
QGraphicsAnchor * QGraphicsAnchorLayoutPrivate::getAnchor | ( | QGraphicsLayoutItem * | firstItem, |
Qt::AnchorPoint | firstEdge, | ||
QGraphicsLayoutItem * | secondItem, | ||
Qt::AnchorPoint | secondEdge ) |
Definition at line 1713 of file qgraphicsanchorlayout_p.cpp.
References edgeOrientation(), graph, internalVertex(), and Q_ASSERT.
QGraphicsAnchorLayoutPrivate::GraphParts QGraphicsAnchorLayoutPrivate::getGraphParts | ( | Qt::Orientation | orientation | ) |
Definition at line 2439 of file qgraphicsanchorlayout_p.cpp.
References constraints, graph, itemCenterConstraints, layoutCentralVertex, layoutFirstVertex, layoutLastVertex, match(), and Q_ASSERT.
Referenced by calculateGraphs().
bool QGraphicsAnchorLayoutPrivate::hasConflicts | ( | ) | const |
Returns true
if there are no arrangement that satisfies all constraints. Otherwise returns false
.
Definition at line 2896 of file qgraphicsanchorlayout_p.cpp.
References calculateGraphs(), graphHasConflicts, Qt::Horizontal, m_floatItems, and Qt::Vertical.
void QGraphicsAnchorLayoutPrivate::identifyFloatItems | ( | const QSet< AnchorData * > & | visited, |
Qt::Orientation | orientation ) |
Use all visited Anchors on findPaths() so we can identify non-float Items.
Definition at line 2516 of file qgraphicsanchorlayout_p.cpp.
References identifyNonFloatItems_helper(), item, items, and m_floatItems.
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 2539 of file qgraphicsanchorlayout_p.cpp.
References d, identifyNonFloatItems_helper(), QtGraphicsAnchorLayout::AnchorData::Normal, QtGraphicsAnchorLayout::AnchorData::Parallel, and QtGraphicsAnchorLayout::AnchorData::Sequential.
Referenced by identifyFloatItems(), and identifyNonFloatItems_helper().
|
inline |
Definition at line 483 of file qgraphicsanchorlayout_p.h.
References item, and qMakePair().
|
inline |
Definition at line 478 of file qgraphicsanchorlayout_p.h.
Referenced by createCenterAnchors(), createLayoutEdges(), deleteLayoutEdges(), getAnchor(), removeCenterAnchors(), removeCenterConstraints(), removeVertex(), and setItemsGeometries().
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 2703 of file qgraphicsanchorlayout_p.cpp.
References base, QtGraphicsAnchorLayout::AnchorVertex::distance, QtGraphicsAnchorLayout::AnchorData::from, Qt::Horizontal, interpolate(), interpolationInterval, interpolationProgress, QtGraphicsAnchorLayout::AnchorData::isVertical, Q_ASSERT, QtGraphicsAnchorLayout::AnchorData::sizeAtMaximum, QtGraphicsAnchorLayout::AnchorData::sizeAtMinimum, QtGraphicsAnchorLayout::AnchorData::sizeAtPreferred, QtGraphicsAnchorLayout::AnchorData::to, and Qt::Vertical.
Referenced by calculateVertexPositions().
|
static |
Definition at line 590 of file qgraphicsanchorlayout_p.cpp.
References Qt::AnchorBottom, Qt::AnchorLeft, Qt::AnchorRight, and Qt::AnchorTop.
Referenced by addAnchor().
|
inlinestatic |
Definition at line 379 of file qgraphicsanchorlayout_p.h.
References Qt::Horizontal, and Qt::Vertical.
Referenced by addAnchor().
void QGraphicsAnchorLayoutPrivate::refreshAllSizeHints | ( | Qt::Orientation | orientation | ) |
Traverse the graph refreshing the size hints. Edges will query their associated item or graphicsAnchor for their size hints.
Definition at line 2234 of file qgraphicsanchorlayout_p.cpp.
References graph, i, QtGraphicsAnchorLayout::AnchorData::refreshSizeHints(), and styleInfo().
Referenced by calculateGraphs().
void QGraphicsAnchorLayoutPrivate::removeAnchor | ( | AnchorVertex * | firstVertex, |
AnchorVertex * | secondVertex ) |
Implements the high level "removeAnchor" feature. Called by the QAnchorData destructor.
Definition at line 1748 of file qgraphicsanchorlayout_p.cpp.
References Qt::AnchorBottom, Qt::AnchorHorizontalCenter, Qt::AnchorLeft, Qt::AnchorVerticalCenter, i, QListSpecialMethodsBase< T >::indexOf(), items, QtGraphicsAnchorLayout::AnchorVertex::m_item, m_vertexList, qMakePair(), and removeAnchor_helper().
Referenced by QGraphicsAnchorPrivate::~QGraphicsAnchorPrivate().
void QGraphicsAnchorLayoutPrivate::removeAnchor_helper | ( | AnchorVertex * | v1, |
AnchorVertex * | v2 ) |
Definition at line 1822 of file qgraphicsanchorlayout_p.cpp.
References edgeOrientation(), graph, o, Q_ASSERT, and removeInternalVertex().
Referenced by addAnchor_helper(), createCenterAnchors(), deleteLayoutEdges(), removeAnchor(), and removeCenterAnchors().
void QGraphicsAnchorLayoutPrivate::removeAnchors | ( | QGraphicsLayoutItem * | item | ) |
Definition at line 1897 of file qgraphicsanchorlayout_p.cpp.
References Qt::AnchorBottom, Qt::AnchorHorizontalCenter, Qt::AnchorLeft, Qt::AnchorRight, Qt::AnchorTop, Qt::AnchorVerticalCenter, item, removeCenterAnchors(), and removeVertex().
void QGraphicsAnchorLayoutPrivate::removeCenterAnchors | ( | QGraphicsLayoutItem * | item, |
Qt::AnchorPoint | centerEdge, | ||
bool | substitute = true ) |
Definition at line 1453 of file qgraphicsanchorlayout_p.cpp.
References addAnchor_helper(), Qt::AnchorBottom, Qt::AnchorHorizontalCenter, Qt::AnchorLeft, Qt::AnchorRight, Qt::AnchorTop, Qt::AnchorVerticalCenter, at, graph, Qt::Horizontal, i, internalVertex(), item, itemCenterConstraints, layoutCentralVertex, Q_ASSERT, removeAnchor_helper(), and Qt::Vertical.
Referenced by removeAnchors(), and removeInternalVertex().
void QGraphicsAnchorLayoutPrivate::removeCenterConstraints | ( | QGraphicsLayoutItem * | item, |
Qt::Orientation | orientation ) |
Definition at line 1536 of file qgraphicsanchorlayout_p.cpp.
References Qt::AnchorHorizontalCenter, Qt::AnchorLeft, Qt::AnchorTop, Qt::AnchorVerticalCenter, at, graph, Qt::Horizontal, i, internalVertex(), item, itemCenterConstraints, and Q_ASSERT.
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 1856 of file qgraphicsanchorlayout_p.cpp.
References Qt::AnchorHorizontalCenter, Qt::AnchorVerticalCenter, item, m_vertexList, qWarning, and removeCenterAnchors().
Referenced by removeAnchor_helper(), and removeVertex().
void QGraphicsAnchorLayoutPrivate::removeVertex | ( | QGraphicsLayoutItem * | item, |
Qt::AnchorPoint | edge ) |
Definition at line 1884 of file qgraphicsanchorlayout_p.cpp.
References edgeOrientation(), graph, internalVertex(), item, and removeInternalVertex().
Referenced by removeAnchors().
bool QGraphicsAnchorLayoutPrivate::replaceVertex | ( | Qt::Orientation | orientation, |
AnchorVertex * | oldV, | ||
AnchorVertex * | newV, | ||
const QList< AnchorData * > & | edges ) |
Definition at line 831 of file qgraphicsanchorlayout_p.cpp.
References addAnchorMaybeParallel(), anchorsFromSimplifiedVertices, QString::fromLatin1(), graph, i, and replaceVertex_helper().
Referenced by simplifyVertices().
void QGraphicsAnchorLayoutPrivate::restoreSimplifiedAnchor | ( | AnchorData * | edge | ) |
Definition at line 1134 of file qgraphicsanchorlayout_p.cpp.
References anchorsFromSimplifiedVertices, contains(), QtGraphicsAnchorLayout::AnchorData::from, graph, Qt::Horizontal, QtGraphicsAnchorLayout::AnchorData::isVertical, QtGraphicsAnchorLayout::AnchorData::Normal, QtGraphicsAnchorLayout::AnchorData::Parallel, Q_ASSERT, qDebug, restoreSimplifiedAnchor(), restoreSimplifiedConstraints(), QtGraphicsAnchorLayout::AnchorData::Sequential, QtGraphicsAnchorLayout::AnchorData::to, QtGraphicsAnchorLayout::AnchorData::type, and Qt::Vertical.
Referenced by restoreSimplifiedAnchor(), and restoreSimplifiedGraph().
void QGraphicsAnchorLayoutPrivate::restoreSimplifiedConstraints | ( | ParallelAnchorData * | parallel | ) |
Definition at line 1180 of file qgraphicsanchorlayout_p.cpp.
References i, QHash< Key, T >::remove(), and QSimplexConstraint::variables.
Referenced by restoreSimplifiedAnchor(), and restoreVertices().
void QGraphicsAnchorLayoutPrivate::restoreSimplifiedGraph | ( | Qt::Orientation | orientation | ) |
Definition at line 1206 of file qgraphicsanchorlayout_p.cpp.
References anchorsFromSimplifiedVertices, graph, Horizontal, i, QtGraphicsAnchorLayout::AnchorData::Parallel, qDebug, restoreSimplifiedAnchor(), restoreVertices(), QtGraphicsAnchorLayout::AnchorData::Sequential, and QtGraphicsAnchorLayout::AnchorData::type.
Referenced by calculateGraphs(), and simplifyGraph().
void QGraphicsAnchorLayoutPrivate::restoreVertices | ( | Qt::Orientation | orientation | ) |
Definition at line 1235 of file qgraphicsanchorlayout_p.cpp.
References anchorsFromSimplifiedVertices, changeLayoutVertex(), graph, i, j, QtGraphicsAnchorLayout::AnchorVertex::m_item, Q_ASSERT, qDeleteAll(), replaceVertex_helper(), restoreSimplifiedConstraints(), and simplifiedVertices.
Referenced by restoreSimplifiedGraph(), and simplifyGraph().
Use the current vertices distance to calculate and set the geometry of each item.
Definition at line 2565 of file qgraphicsanchorlayout_p.cpp.
References Qt::AnchorBottom, Qt::AnchorLeft, Qt::AnchorRight, Qt::AnchorTop, contains(), QGraphicsLayoutItemPrivate::geom, Qt::Horizontal, internalVertex(), item, items, QRectF::left(), QGraphicsLayoutPrivate::left, Qt::LeftToRight, m_floatItems, Qt::PreferredSize, qSwap(), QRectF::right(), QGraphicsLayoutPrivate::right, Qt::RightToLeft, QRectF::top(), QGraphicsLayoutPrivate::top, Qt::Vertical, and QGraphicsLayoutPrivate::visualDirection().
void QGraphicsAnchorLayoutPrivate::setupEdgesInterpolation | ( | Qt::Orientation | orientation | ) |
Calculate interpolation parameters based on current Layout Size. Must be called once before calling "interpolateEdgeSize()" for the edges.
Definition at line 2668 of file qgraphicsanchorlayout_p.cpp.
References getFactor(), Qt::Horizontal, interpolationInterval, interpolationProgress, Qt::MaximumSize, Qt::MinimumSize, Qt::PreferredSize, and sizeHints.
Referenced by calculateVertexPositions().
bool QGraphicsAnchorLayoutPrivate::simplifyGraph | ( | Qt::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 774 of file qgraphicsanchorlayout_p.cpp.
References arg, QString::fromLatin1(), Horizontal, QList< T >::isEmpty(), items, qDebug, restoreSimplifiedGraph(), restoreVertices(), simplifyGraphIteration(), and simplifyVertices().
Referenced by calculateGraphs().
bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration | ( | Qt::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 978 of file qgraphicsanchorlayout_p.cpp.
References addAnchorMaybeParallel(), createSequence(), graph, i, layoutFirstVertex, QtGraphicsAnchorLayout::AnchorVertex::m_item, next, Q_ASSERT, and qMakePair().
Referenced by simplifyGraph().
bool QGraphicsAnchorLayoutPrivate::simplifyVertices | ( | Qt::Orientation | orientation | ) |
Definition at line 865 of file qgraphicsanchorlayout_p.cpp.
References changeLayoutVertex(), graph, i, layoutFirstVertex, next, replaceVertex(), and simplifiedVertices.
Referenced by simplifyGraph().
bool QGraphicsAnchorLayoutPrivate::solveMinMax | ( | const QList< QSimplexConstraint * > & | constraints, |
const GraphPath & | path, | ||
qreal * | min, | ||
qreal * | max ) |
Definition at line 2723 of file qgraphicsanchorlayout_p.cpp.
References constraints, g_offset, getVariables(), i, QHash< Key, T >::insert(), iter, QSimplex::setConstraints(), QtGraphicsAnchorLayout::AnchorData::sizeAtMaximum, QtGraphicsAnchorLayout::AnchorData::sizeAtMinimum, and QSimplexConstraint::variables.
Referenced by calculateTrunk().
bool QGraphicsAnchorLayoutPrivate::solvePreferred | ( | const QList< QSimplexConstraint * > & | constraints, |
const QList< AnchorData * > & | variables ) |
Definition at line 2778 of file qgraphicsanchorlayout_p.cpp.
References QSimplexConstraint::constant, constraints, createSlack(), g_offset, Grower, i, QHash< Key, T >::insert(), qDeleteAll(), QSimplex::setConstraints(), Shrinker, and QSimplexConstraint::variables.
Referenced by calculateNonTrunk(), and calculateTrunk().
QLayoutStyleInfo & QGraphicsAnchorLayoutPrivate::styleInfo | ( | ) | const |
Definition at line 1962 of file qgraphicsanchorlayout_p.cpp.
References cachedStyleInfo, QGraphicsLayoutItem::graphicsItem(), Qt::Horizontal, QGraphicsLayoutItem::isLayout(), QGraphicsItem::isWidget(), QGraphicsLayoutItemPrivate::parent, QGraphicsLayoutItemPrivate::parentItem(), QGraphicsLayoutItem::parentLayoutItem(), QLayoutStyleInfo::setDefaultSpacing(), spacings, QApplication::style(), styleInfoDirty, and Qt::Vertical.
Referenced by refreshAllSizeHints().
void QGraphicsAnchorLayoutPrivate::updateAnchorSizes | ( | Qt::Orientation | orientation | ) |
Definition at line 2327 of file qgraphicsanchorlayout_p.cpp.
References graph, i, and QtGraphicsAnchorLayout::AnchorData::updateChildrenSizes().
Referenced by calculateGraphs().
|
friend |
Definition at line 565 of file qgraphicsanchorlayout_p.h.
QHVContainer<QList<AnchorData *> > QGraphicsAnchorLayoutPrivate::anchorsFromSimplifiedVertices |
Definition at line 542 of file qgraphicsanchorlayout_p.h.
Referenced by replaceVertex(), restoreSimplifiedAnchor(), restoreSimplifiedGraph(), and restoreVertices().
|
mutable |
Definition at line 563 of file qgraphicsanchorlayout_p.h.
Referenced by styleInfo().
uint QGraphicsAnchorLayoutPrivate::calculateGraphCacheDirty |
Definition at line 561 of file qgraphicsanchorlayout_p.h.
Referenced by calculateGraphs().
QHVContainer<QList<QSimplexConstraint *> > QGraphicsAnchorLayoutPrivate::constraints |
Definition at line 546 of file qgraphicsanchorlayout_p.h.
Referenced by addAnchorMaybeParallel(), calculateGraphs(), calculateNonTrunk(), calculateTrunk(), constraintsFromPaths(), getGraphParts(), solveMinMax(), and solvePreferred().
QHVContainer<Graph<AnchorVertex, AnchorData> > QGraphicsAnchorLayoutPrivate::graph |
Definition at line 534 of file qgraphicsanchorlayout_p.h.
Referenced by addAnchor_helper(), addAnchorMaybeParallel(), calculateVertexPositions(), constraintsFromSizeHints(), findPaths(), getAnchor(), getGraphParts(), refreshAllSizeHints(), removeAnchor_helper(), removeCenterAnchors(), removeCenterConstraints(), removeVertex(), replaceVertex(), restoreSimplifiedAnchor(), restoreSimplifiedGraph(), restoreVertices(), simplifyGraphIteration(), simplifyVertices(), and updateAnchorSizes().
QHVContainer<bool> QGraphicsAnchorLayoutPrivate::graphHasConflicts = {} |
Definition at line 554 of file qgraphicsanchorlayout_p.h.
Referenced by calculateGraphs(), and hasConflicts().
QHVContainer<QMultiHash<AnchorVertex *, GraphPath> > QGraphicsAnchorLayoutPrivate::graphPaths |
Definition at line 545 of file qgraphicsanchorlayout_p.h.
Referenced by calculateGraphs(), constraintsFromPaths(), and findPaths().
|
inlinestaticconstexpr |
Definition at line 364 of file qgraphicsanchorlayout_p.h.
Referenced by restoreSimplifiedGraph(), and simplifyGraph().
QHVContainer<Interval> QGraphicsAnchorLayoutPrivate::interpolationInterval |
Definition at line 551 of file qgraphicsanchorlayout_p.h.
Referenced by interpolateEdge(), and setupEdgesInterpolation().
QHVContainer<qreal> QGraphicsAnchorLayoutPrivate::interpolationProgress = {-1, -1} |
Definition at line 552 of file qgraphicsanchorlayout_p.h.
Referenced by interpolateEdge(), and setupEdgesInterpolation().
QHVContainer<QList<QSimplexConstraint *> > QGraphicsAnchorLayoutPrivate::itemCenterConstraints |
Definition at line 547 of file qgraphicsanchorlayout_p.h.
Referenced by addAnchorMaybeParallel(), createCenterAnchors(), getGraphParts(), removeCenterAnchors(), and removeCenterConstraints().
QList<QGraphicsLayoutItem *> QGraphicsAnchorLayoutPrivate::items |
Definition at line 526 of file qgraphicsanchorlayout_p.h.
Referenced by addAnchor(), createItemEdges(), identifyFloatItems(), removeAnchor(), setItemsGeometries(), and simplifyGraph().
QHVContainer<AnchorVertex *> QGraphicsAnchorLayoutPrivate::layoutCentralVertex = {} |
Definition at line 537 of file qgraphicsanchorlayout_p.h.
Referenced by constraintsFromSizeHints(), createCenterAnchors(), createLayoutEdges(), getGraphParts(), and removeCenterAnchors().
QHVContainer<AnchorVertex *> QGraphicsAnchorLayoutPrivate::layoutFirstVertex = {} |
Definition at line 536 of file qgraphicsanchorlayout_p.h.
Referenced by calculateVertexPositions(), constraintsFromSizeHints(), createLayoutEdges(), findPaths(), getGraphParts(), simplifyGraphIteration(), and simplifyVertices().
QHVContainer<AnchorVertex *> QGraphicsAnchorLayoutPrivate::layoutLastVertex = {} |
Definition at line 538 of file qgraphicsanchorlayout_p.h.
Referenced by calculateGraphs(), constraintsFromSizeHints(), createLayoutEdges(), and getGraphParts().
QHVContainer<QSet<QGraphicsLayoutItem *> > QGraphicsAnchorLayoutPrivate::m_floatItems |
Definition at line 555 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 531 of file qgraphicsanchorlayout_p.h.
Referenced by addInternalVertex(), removeAnchor(), and removeInternalVertex().
QHVContainer<QList<AnchorVertexPair *> > QGraphicsAnchorLayoutPrivate::simplifiedVertices |
Definition at line 541 of file qgraphicsanchorlayout_p.h.
Referenced by restoreVertices(), and simplifyVertices().
QHVContainer<std::array<qreal, 3> > QGraphicsAnchorLayoutPrivate::sizeHints = {{-1, -1, -1}, {-1, -1, -1}} |
Definition at line 523 of file qgraphicsanchorlayout_p.h.
Referenced by calculateTrunk(), and setupEdgesInterpolation().
QHVContainer<qreal> QGraphicsAnchorLayoutPrivate::spacings = {-1, -1} |
Definition at line 521 of file qgraphicsanchorlayout_p.h.
Referenced by styleInfo().
|
mutable |
Definition at line 562 of file qgraphicsanchorlayout_p.h.
Referenced by styleInfo().
|
inlinestaticconstexpr |
Definition at line 365 of file qgraphicsanchorlayout_p.h.