Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qgraphicsanchorlayout_p.cpp File Reference
#include "qgraphicsanchorlayout_p.h"
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qapplication.h>
#include <QtCore/qstack.h>
#include <numeric>
+ Include dependency graph for qgraphicsanchorlayout_p.cpp:

Go to the source code of this file.

Enumerations

enum  slackType { Grower = -1 , Shrinker = 1 }
 

Functions

static void applySizePolicy (QSizePolicy::Policy policy, qreal minSizeHint, qreal prefSizeHint, qreal maxSizeHint, qreal *minSize, qreal *prefSize, qreal *maxSize)
 
static QPair< QGraphicsAnchorLayoutPrivate::Interval, qrealgetFactor (qreal value, qreal min, qreal minPref, qreal pref, qreal maxPref, qreal max)
 
static qreal interpolate (const QPair< QGraphicsAnchorLayoutPrivate::Interval, qreal > &factor, qreal min, qreal minPref, qreal pref, qreal maxPref, qreal max)
 
static AnchorDatacreateSequence (Graph< AnchorVertex, AnchorData > *graph, AnchorVertex *before, const QList< AnchorVertex * > &vertices, AnchorVertex *after)
 
static AnchorVertexreplaceVertex_helper (AnchorData *data, AnchorVertex *oldV, AnchorVertex *newV)
 
QList< AnchorData * > getVariables (const QList< QSimplexConstraint * > &constraints)
 
static void shiftConstraints (const QList< QSimplexConstraint * > &constraints, qreal amount)
 
static QPair< QSimplexVariable *, QSimplexConstraint * > createSlack (QSimplexConstraint *sizeConstraint, qreal interval, slackType type)
 

Variables

const qreal g_offset = (sizeof(qreal) == sizeof(double)) ? QWIDGETSIZE_MAX : QWIDGETSIZE_MAX / 32
 

Enumeration Type Documentation

◆ slackType

enum slackType
Enumerator
Grower 
Shrinker 

Definition at line 2771 of file qgraphicsanchorlayout_p.cpp.

Function Documentation

◆ applySizePolicy()

static void applySizePolicy ( QSizePolicy::Policy  policy,
qreal  minSizeHint,
qreal  prefSizeHint,
qreal  maxSizeHint,
qreal minSize,
qreal prefSize,
qreal maxSize 
)
static

Definition at line 95 of file qgraphicsanchorlayout_p.cpp.

References QSizePolicy::GrowFlag, QSizePolicy::IgnoreFlag, policy, and QSizePolicy::ShrinkFlag.

Referenced by QtGraphicsAnchorLayout::AnchorData::refreshSizeHints().

+ Here is the caller graph for this function:

◆ createSequence()

static AnchorData * createSequence ( Graph< AnchorVertex, AnchorData > *  graph,
AnchorVertex before,
const QList< AnchorVertex * > &  vertices,
AnchorVertex after 
)
static

Takes the sequence of vertices described by (before, vertices, after) and removes all anchors connected to the vertices in vertices, returning one simplified anchor between before and after.

Note that this function doesn't add the created anchor to the graph. This should be done by the caller.

Definition at line 701 of file qgraphicsanchorlayout_p.cpp.

References QList< T >::append(), QString::arg(), QList< T >::at(), QtGraphicsAnchorLayout::SequentialAnchorData::calculateSizeHints(), QList< T >::count(), QtGraphicsAnchorLayout::AnchorData::from, QString::fromLatin1(), i, QList< T >::last(), next, Q_ASSERT, qDebug, qPrintable, QList< T >::reserve(), QList< T >::size(), Graph< Vertex, EdgeData >::takeEdge(), and QtGraphicsAnchorLayout::AnchorData::to.

Referenced by QV4::ExecutionEngine::fromData(), and QGraphicsAnchorLayoutPrivate::simplifyGraphIteration().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createSlack()

static QPair< QSimplexVariable *, QSimplexConstraint * > createSlack ( QSimplexConstraint sizeConstraint,
qreal  interval,
slackType  type 
)
static

Definition at line 2772 of file qgraphicsanchorlayout_p.cpp.

References QHash< Key, T >::insert(), QSimplexConstraint::LessOrEqual, qMakePair(), and QSimplexConstraint::variables.

Referenced by QGraphicsAnchorLayoutPrivate::solvePreferred().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFactor()

static QPair< QGraphicsAnchorLayoutPrivate::Interval, qreal > getFactor ( qreal  value,
qreal  min,
qreal  minPref,
qreal  pref,
qreal  maxPref,
qreal  max 
)
static

returns the factor in the interval [-1, 1]. -1 is at Minimum 0 is at Preferred 1 is at Maximum

Definition at line 381 of file qgraphicsanchorlayout_p.cpp.

References QGraphicsAnchorLayoutPrivate::MaxPreferredToMaximum, QGraphicsAnchorLayoutPrivate::MinimumToMinPreferred, QGraphicsAnchorLayoutPrivate::MinPreferredToPreferred, QGraphicsAnchorLayoutPrivate::PreferredToMaxPreferred, and qMakePair().

Referenced by QGraphicsAnchorLayoutPrivate::setupEdgesInterpolation(), and QtGraphicsAnchorLayout::SequentialAnchorData::updateChildrenSizes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getVariables()

QList< AnchorData * > getVariables ( const QList< QSimplexConstraint * > &  constraints)

Definition at line 2016 of file qgraphicsanchorlayout_p.cpp.

References QList< T >::at(), QSet< T >::cbegin(), i, QSet< T >::insert(), it, QList< T >::size(), and QSet< T >::values().

Referenced by QGraphicsAnchorLayoutPrivate::calculateGraphs(), and QGraphicsAnchorLayoutPrivate::solveMinMax().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ interpolate()

static qreal interpolate ( const QPair< QGraphicsAnchorLayoutPrivate::Interval, qreal > &  factor,
qreal  min,
qreal  minPref,
qreal  pref,
qreal  maxPref,
qreal  max 
)
static

◆ replaceVertex_helper()

static AnchorVertex * replaceVertex_helper ( AnchorData data,
AnchorVertex oldV,
AnchorVertex newV 
)
static

Definition at line 824 of file qgraphicsanchorlayout_p.cpp.

References other().

Referenced by QGraphicsAnchorLayoutPrivate::replaceVertex(), and QGraphicsAnchorLayoutPrivate::restoreVertices().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shiftConstraints()

static void shiftConstraints ( const QList< QSimplexConstraint * > &  constraints,
qreal  amount 
)
static

Shift all the constraints by a certain amount. This allows us to deal with negative values in the linear program if they are bounded by a certain limit. Functions should be careful to call it again with a negative amount, to shift the constraints back.

Definition at line 2132 of file qgraphicsanchorlayout_p.cpp.

References QList< T >::at(), i, and QList< T >::size().

Referenced by QGraphicsAnchorLayoutPrivate::calculateNonTrunk(), and QGraphicsAnchorLayoutPrivate::calculateTrunk().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ g_offset