summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-12-26 21:14:53 +0100
committerMarc Mutz <marc.mutz@kdab.com>2017-02-22 07:12:25 +0000
commit7de8745eaae6777819824cffd40a842fa0dd377b (patch)
tree6226cded0dfbdc850183cab13213690c4ed0e371 /src/widgets/kernel
parente0a9a0e2179a5f44b98eff9fec607a01dedf07b0 (diff)
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>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qsizepolicy.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h
index 3ab672a8e8..eceb08259e 100644
--- a/src/widgets/kernel/qsizepolicy.h
+++ b/src/widgets/kernel/qsizepolicy.h
@@ -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