Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qgraphicsanchorlayout_p.cpp File Reference

(c0e526f70f58c9b70fea1b9426d14b18f1f0066c)

#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 , Grower = -1 , Shrinker = 1 }
enum  slackType { Grower = -1 , Shrinker = 1 , Grower = -1 , Shrinker = 1 }

Functions

static void applySizePolicy (QSizePolicy::Policy policy, qreal minSizeHint, qreal prefSizeHint, qreal maxSizeHint, qreal *minSize, qreal *prefSize, qreal *maxSize)
static std::pair< QGraphicsAnchorLayoutPrivate::Interval, qrealgetFactor (qreal value, qreal min, qreal minPref, qreal pref, qreal maxPref, qreal max)
static qreal interpolate (const std::pair< 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 auto 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 [1/2]

enum slackType
Enumerator
Grower 
Shrinker 
Grower 
Shrinker 

Definition at line 2764 of file qgraphicsanchorlayout_p.cpp.

◆ slackType [2/2]

enum slackType
Enumerator
Grower 
Shrinker 
Grower 
Shrinker 

Definition at line 2764 of file qgraphicsanchorlayout_p.cpp.

Function Documentation

◆ applySizePolicy()

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

Definition at line 96 of file qgraphicsanchorlayout_p.cpp.

◆ createSequence()

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 696 of file qgraphicsanchorlayout_p.cpp.

References QtGraphicsAnchorLayout::SequentialAnchorData::calculateSizeHints(), QtGraphicsAnchorLayout::AnchorData::from, and QtGraphicsAnchorLayout::AnchorData::to.

Here is the call graph for this function:

◆ createSlack()

auto createSlack ( QSimplexConstraint * sizeConstraint,
qreal interval,
slackType type )
static

Definition at line 2765 of file qgraphicsanchorlayout_p.cpp.

◆ getFactor()

std::pair< 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 382 of file qgraphicsanchorlayout_p.cpp.

◆ getVariables()

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

Definition at line 2009 of file qgraphicsanchorlayout_p.cpp.

◆ interpolate()

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

Definition at line 418 of file qgraphicsanchorlayout_p.cpp.

◆ replaceVertex_helper()

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

◆ shiftConstraints()

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 2125 of file qgraphicsanchorlayout_p.cpp.

Variable Documentation

◆ g_offset

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

Definition at line 27 of file qgraphicsanchorlayout_p.cpp.