QSizePolicy: add C++14-style constexpr where possible
This is straight-forward, since, unlike with transposed(), we can assume that every compiler that supports C++14 constexpr also supports C++11 uniform initialization. For Clang and GCC, this is clear. For MSVC, we might need to reconsider this, as, according to qcompilerdetection.h, 2015 still does not support uniform initialization (but not C++14 constexpr, either), and we don't know what 2017 will support. Change-Id: Idac7aa929d275645478a926896dca0dff166e114 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
e0a9a0e217
commit
7de8745eaa
|
|
@ -129,8 +129,8 @@ public:
|
|||
QT_SIZEPOLICY_CONSTEXPR Policy verticalPolicy() const { return static_cast<Policy>(bits.verPolicy); }
|
||||
ControlType controlType() const;
|
||||
|
||||
void setHorizontalPolicy(Policy d) { bits.horPolicy = d; }
|
||||
void setVerticalPolicy(Policy d) { bits.verPolicy = d; }
|
||||
Q_DECL_RELAXED_CONSTEXPR void setHorizontalPolicy(Policy d) { bits.horPolicy = d; }
|
||||
Q_DECL_RELAXED_CONSTEXPR void setVerticalPolicy(Policy d) { bits.verPolicy = d; }
|
||||
void setControlType(ControlType type);
|
||||
|
||||
QT_SIZEPOLICY_CONSTEXPR Qt::Orientations expandingDirections() const {
|
||||
|
|
@ -138,9 +138,9 @@ public:
|
|||
| ( (horizontalPolicy() & ExpandFlag) ? Qt::Horizontal : Qt::Orientations() ) ;
|
||||
}
|
||||
|
||||
void setHeightForWidth(bool b) { bits.hfw = b; }
|
||||
Q_DECL_RELAXED_CONSTEXPR void setHeightForWidth(bool b) { bits.hfw = b; }
|
||||
QT_SIZEPOLICY_CONSTEXPR bool hasHeightForWidth() const { return bits.hfw; }
|
||||
void setWidthForHeight(bool b) { bits.wfh = b; }
|
||||
Q_DECL_RELAXED_CONSTEXPR void setWidthForHeight(bool b) { bits.wfh = b; }
|
||||
QT_SIZEPOLICY_CONSTEXPR bool hasWidthForHeight() const { return bits.wfh; }
|
||||
|
||||
QT_SIZEPOLICY_CONSTEXPR bool operator==(const QSizePolicy& s) const { return data == s.data; }
|
||||
|
|
@ -152,13 +152,13 @@ public:
|
|||
|
||||
QT_SIZEPOLICY_CONSTEXPR int horizontalStretch() const { return static_cast<int>(bits.horStretch); }
|
||||
QT_SIZEPOLICY_CONSTEXPR int verticalStretch() const { return static_cast<int>(bits.verStretch); }
|
||||
void setHorizontalStretch(int stretchFactor) { bits.horStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); }
|
||||
void setVerticalStretch(int stretchFactor) { bits.verStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); }
|
||||
Q_DECL_RELAXED_CONSTEXPR void setHorizontalStretch(int stretchFactor) { bits.horStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); }
|
||||
Q_DECL_RELAXED_CONSTEXPR void setVerticalStretch(int stretchFactor) { bits.verStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); }
|
||||
|
||||
QT_SIZEPOLICY_CONSTEXPR bool retainSizeWhenHidden() const { return bits.retainSizeWhenHidden; }
|
||||
void setRetainSizeWhenHidden(bool retainSize) { bits.retainSizeWhenHidden = retainSize; }
|
||||
Q_DECL_RELAXED_CONSTEXPR void setRetainSizeWhenHidden(bool retainSize) { bits.retainSizeWhenHidden = retainSize; }
|
||||
|
||||
void transpose() { *this = transposed(); }
|
||||
Q_DECL_RELAXED_CONSTEXPR void transpose() { *this = transposed(); }
|
||||
#ifndef Q_QDOC
|
||||
QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue