7#include <QtCore/qnamespace.h>
8#include <QtCore/qhashfunctions.h>
9#include <QtCore/qmargins.h>
11#include <QtCore/q20type_traits.h>
12#include <QtCore/q23utility.h>
14#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
27 constexpr QSize()
noexcept;
28 constexpr QSize(
int w,
int h)
noexcept;
30 constexpr inline bool isNull()
const noexcept;
31 constexpr inline bool isEmpty()
const noexcept;
32 constexpr inline bool isValid()
const noexcept;
34 constexpr inline int width()
const noexcept;
35 constexpr inline int height()
const noexcept;
36 constexpr inline void setWidth(
int w)
noexcept;
37 constexpr inline void setHeight(
int h)
noexcept;
39 [[nodiscard]]
constexpr inline QSize transposed()
const noexcept;
46 [[nodiscard]]
constexpr inline QSize expandedTo(
const QSize &)
const noexcept;
47 [[nodiscard]]
constexpr inline QSize boundedTo(
const QSize &)
const noexcept;
50 {
return {
width() +
m.left() +
m.right(),
height() +
m.top() +
m.bottom()}; }
52 {
return {
width() -
m.left() -
m.right(),
height() -
m.top() -
m.bottom()}; }
54 constexpr inline int &
rwidth() noexcept;
55 constexpr inline
int &
rheight() noexcept;
57 constexpr inline
QSize &operator+=(const
QSize &) noexcept;
58 constexpr inline
QSize &operator-=(const
QSize &) noexcept;
59 constexpr inline
QSize &operator*=(
qreal c) noexcept;
62 friend inline constexpr
bool operator==(const
QSize &
s1, const
QSize &
s2) noexcept
63 {
return s1.wd ==
s2.wd &&
s1.ht ==
s2.ht; }
65 {
return s1.wd !=
s2.wd ||
s1.ht !=
s2.ht; }
76 friend inline constexpr size_t qHash(
const QSize &,
size_t)
noexcept;
78#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
79 [[nodiscard]] CGSize toCGSize() const noexcept;
82 [[nodiscard]]
inline constexpr QSizeF toSizeF() const noexcept;
88 template <
std::
size_t I,
90 std::enable_if_t<(I < 2),
bool> = true,
91 std::enable_if_t<
std::is_same_v<
q20::remove_cvref_t<S>,
QSize>,
bool> = true>
92 friend constexpr decltype(auto)
get(S &&
s) noexcept
95 return q23::forward_like<S>(
s.wd);
96 else if constexpr (I == 1)
97 return q23::forward_like<S>(
s.ht);
106#ifndef QT_NO_DATASTREAM
121{
return wd == 0 && ht == 0; }
124{
return wd < 1 || ht < 1; }
127{
return wd >= 0 && ht >= 0; }
142{
return QSize(ht, wd); }
201#ifndef QT_NO_DEBUG_STREAM
209 constexpr QSizeF()
noexcept;
213 inline bool isNull()
const noexcept;
214 constexpr inline bool isEmpty()
const noexcept;
215 constexpr inline bool isValid()
const noexcept;
217 constexpr inline qreal width()
const noexcept;
219 constexpr inline void setWidth(
qreal w)
noexcept;
220 constexpr inline void setHeight(
qreal h)
noexcept;
222 [[nodiscard]]
constexpr inline QSizeF transposed()
const noexcept;
229 [[nodiscard]]
constexpr inline QSizeF expandedTo(
const QSizeF &)
const noexcept;
230 [[nodiscard]]
constexpr inline QSizeF boundedTo(
const QSizeF &)
const noexcept;
233 {
return {
width() +
m.left() +
m.right(),
height() +
m.top() +
m.bottom()}; }
235 {
return {
width() -
m.left() -
m.right(),
height() -
m.top() -
m.bottom()}; }
240 constexpr inline
QSizeF &operator+=(const
QSizeF &) noexcept;
241 constexpr inline
QSizeF &operator-=(const
QSizeF &) noexcept;
254 {
return !(
s1 ==
s2); }
266 constexpr inline QSize toSize() const noexcept;
268#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
269 [[nodiscard]]
static QSizeF fromCGSize(CGSize
size)
noexcept;
270 [[nodiscard]] CGSize toCGSize() const noexcept;
277 template <std::size_t I,
279 std::enable_if_t<(I < 2), bool> =
true,
280 std::enable_if_t<std::is_same_v<q20::remove_cvref_t<S>,
QSizeF>,
bool> =
true>
281 friend constexpr decltype(
auto)
get(S &&
s)
noexcept
283 if constexpr (I == 0)
284 return q23::forward_like<S>(
s.wd);
285 else if constexpr (I == 1)
286 return q23::forward_like<S>(
s.ht);
296#ifndef QT_NO_DATASTREAM
316{
return wd <= 0. || ht <= 0.; }
319{
return wd >= 0. && ht >= 0.; }
397#ifndef QT_NO_DEBUG_STREAM
\inmodule QtCore\reentrant
constexpr QSizeF & operator*=(qreal c) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr QSizeF() noexcept
Constructs an invalid size.
QT_WARNING_POP friend constexpr bool operator!=(const QSizeF &s1, const QSizeF &s2)
Returns true if s1 and s2 are sufficiently different; otherwise returns false.
constexpr qreal & rwidth() noexcept
Returns a reference to the width.
friend constexpr QSizeF operator*(const QSizeF &s, qreal c) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend constexpr QSizeF operator*(qreal c, const QSizeF &s) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
void scale(qreal w, qreal h, Qt::AspectRatioMode mode) noexcept
Scales the size to a rectangle with the given width and height, according to the specified mode.
constexpr QSizeF shrunkBy(QMarginsF m) const noexcept
constexpr QSizeF grownBy(QMarginsF m) const noexcept
constexpr bool isValid() const noexcept
Returns true if both the width and height are equal to or greater than 0; otherwise returns false.
friend constexpr QSizeF operator-(const QSizeF &s1, const QSizeF &s2) noexcept
Returns s2 subtracted from s1; each component is subtracted separately.
bool isNull() const noexcept
Returns true if both the width and height are 0.0 (ignoring the sign); otherwise returns false.
constexpr void setHeight(qreal h) noexcept
Sets the height to the given finite height.
QSizeF & operator/=(qreal c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr QSize toSize() const noexcept
Returns an integer based copy of this size.
constexpr qreal & rheight() noexcept
Returns a reference to the height.
constexpr void setWidth(qreal w) noexcept
Sets the width to the given finite width.
constexpr qreal width() const noexcept
Returns the width.
friend constexpr decltype(auto) get(S &&s) noexcept
friend constexpr QSizeF operator+(const QSizeF &s1, const QSizeF &s2) noexcept
Returns the sum of s1 and s2; each component is added separately.
constexpr QSizeF & operator-=(const QSizeF &) noexcept
Subtracts the given size from this size and returns a reference to this size.
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
QSizeF scaled(qreal w, qreal h, Qt::AspectRatioMode mode) const noexcept
friend QSizeF operator/(const QSizeF &s, qreal c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr QSizeF & operator+=(const QSizeF &) noexcept
Adds the given size to this size and returns a reference to this size.
constexpr QSizeF transposed() const noexcept
constexpr QSizeF expandedTo(const QSizeF &) const noexcept
Returns a size holding the maximum width and height of this size and the given otherSize.
constexpr QSizeF boundedTo(const QSizeF &) const noexcept
Returns a size holding the minimum width and height of this size and the given otherSize.
constexpr qreal height() const noexcept
Returns the height.
constexpr QSize boundedTo(const QSize &) const noexcept
Returns a size holding the minimum width and height of this size and the given otherSize.
constexpr int height() const noexcept
Returns the height.
constexpr QSize grownBy(QMargins m) const noexcept
constexpr QSize shrunkBy(QMargins m) const noexcept
constexpr int width() const noexcept
Returns the width.
constexpr int & rheight() noexcept
Returns a reference to the height.
constexpr QSize & operator-=(const QSize &) noexcept
Subtracts the given size from this size, and returns a reference to this size.
friend constexpr QSize operator-(const QSize &s1, const QSize &s2) noexcept
Returns s2 subtracted from s1; each component is subtracted separately.
constexpr QSize expandedTo(const QSize &) const noexcept
Returns a size holding the maximum width and height of this size and the given otherSize.
friend constexpr bool operator!=(const QSize &s1, const QSize &s2) noexcept
Returns true if s1 and s2 are different; otherwise returns false.
constexpr QSize & operator+=(const QSize &) noexcept
Adds the given size to this size, and returns a reference to this size.
constexpr void setWidth(int w) noexcept
Sets the width to the given width.
friend constexpr QSize operator*(const QSize &s, qreal c) noexcept
Multiplies the given size by the given factor, and returns the result rounded to the nearest integer.
constexpr QSize & operator*=(qreal c) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
QSize scaled(int w, int h, Qt::AspectRatioMode mode) const noexcept
void scale(int w, int h, Qt::AspectRatioMode mode) noexcept
Scales the size to a rectangle with the given width and height, according to the specified mode:
constexpr QSize transposed() const noexcept
constexpr int & rwidth() noexcept
Returns a reference to the width.
constexpr bool isNull() const noexcept
Returns true if both the width and height is 0; otherwise returns false.
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
friend constexpr QSize operator*(qreal c, const QSize &s) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr QSize() noexcept
Constructs a size with an invalid width and height (i.e., isValid() returns false).
friend QSize operator/(const QSize &s, qreal c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr void setHeight(int h) noexcept
Sets the height to the given height.
constexpr bool isValid() const noexcept
Returns true if both the width and height is equal to or greater than 0; otherwise returns false.
friend constexpr QSize operator+(const QSize &s1, const QSize &s2) noexcept
Returns the sum of s1 and s2; each component is added separately.
constexpr QSizeF toSizeF() const noexcept
QSize & operator/=(qreal c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QT_PREPEND_NAMESPACE(qreal) type
QT_PREPEND_NAMESPACE(qreal) type
Combined button and popup list for selecting options.
#define QT_WARNING_DISABLE_FLOAT_COMPARE
static QDBusError::ErrorType get(const char *name)
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
bool qIsFinite(qfloat16 f) noexcept
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
bool qFuzzyIsNull(qfloat16 f) noexcept
bool qIsNull(qfloat16 f) noexcept
int qRound(qfloat16 d) noexcept
constexpr QtPrivate::QHashMultiReturnType< T... > qHashMulti(size_t seed, const T &... args) noexcept(std::conjunction_v< QtPrivate::QNothrowHashable< T >... >)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
GLint GLsizei GLboolean transpose
GLfloat GLfloat GLfloat GLfloat h
GLenum GLenum GLenum GLenum GLenum scale
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
constexpr size_t qHash(const QSize &s, size_t seed=0) noexcept
Q_CORE_EXPORT QDataStream & operator>>(QDataStream &, QSize &)
Q_CORE_EXPORT QDataStream & operator<<(QDataStream &, const QSize &)
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
QT_END_NAMESPACE typedef QT_PREPEND_NAMESPACE(quintptr) WId
QImage scaled(const QImage &image)
[0]