<QtMinMax>

Funktionen zur Begrenzung eines Wertes auf eine untere und/oder obere Grenze. Mehr...

Header: #include <QtMinMax>

Funktionen

const T &qBound(const T &min, const T &val, const T &max)
const T &qMax(const T &a, const T &b)
const T &qMin(const T &a, const T &b)

Ausführliche Beschreibung

Funktionsdokumentation

[constexpr] template <typename T> const T &qBound(const T &min, const T &val, const T &max)

Gibt die „ val “ zurück, die durch „ min “ und „ max “ begrenzt sind.

Beispiel:

int myValue = 10;
int minValue = 2;
int maxValue = 6;

int boundedValue = qBound(minValue, myValue, maxValue);
// boundedValue == 6

Siehe auch qMin() und qMax().

[constexpr] template <typename T> const T &qMax(const T &a, const T &b)

Gibt den Maximalwert aus a und b zurück.

Beispiel:

int myValue = 6;
int yourValue = 4;

int maxValue = qMax(myValue, yourValue);
// maxValue == myValue

Siehe auch qMin() und qBound().

[constexpr] template <typename T> const T &qMin(const T &a, const T &b)

Gibt den kleinsten Wert aus a und b zurück.

Beispiel:

int myValue = 6;
int yourValue = 4;

int minValue = qMin(myValue, yourValue);
// minValue == yourValue

Siehe auch qMax() und qBound().

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.