QSizePolicy: simplify implementation

Even though we revoke its Q_COMPILER_UNIFORM_INIT for certain bugs
that affect existing usage in Qt, it turns out that MSVC 2013 supports
enough of braced initialization to make the macro magic in
Bits::transformed() moot.

Change-Id: I824d7fa298a2b95b4ad45c9e259e91c5ececfc0c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Marc Mutz 2017-02-25 20:11:32 +01:00
parent 2b2fefb336
commit bc641ad9f8

View File

@ -51,10 +51,6 @@ QT_BEGIN_NAMESPACE
# define QT_SIZEPOLICY_CONSTEXPR Q_DECL_CONSTEXPR # define QT_SIZEPOLICY_CONSTEXPR Q_DECL_CONSTEXPR
# if defined(Q_COMPILER_UNIFORM_INIT) # if defined(Q_COMPILER_UNIFORM_INIT)
# define QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT Q_DECL_CONSTEXPR # define QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT Q_DECL_CONSTEXPR
# if defined(Q_COMPILER_CONSTEXPR)
# define QT_SIZEPOLICY_RETURN_BITS(E1, E2, E3, E4, E5, E6, E7, E8) \
return Bits{ E1, E2, E3, E4, E5, E6, E7, E8 }
# endif // constexpr && uniform-init
# endif // uniform-init # endif // uniform-init
#endif #endif
@ -64,10 +60,6 @@ QT_BEGIN_NAMESPACE
#ifndef QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT #ifndef QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
# define QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT # define QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
#endif #endif
#ifndef QT_SIZEPOLICY_RETURN_BITS
# define QT_SIZEPOLICY_RETURN_BITS(E1, E2, E3, E4, E5, E6, E7, E8) \
const Bits result = { E1, E2, E3, E4, E5, E6, E7, E8 }; return result
#endif
class QVariant; class QVariant;
class QSizePolicy; class QSizePolicy;
@ -198,14 +190,14 @@ private:
QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
Bits transposed() const Q_DECL_NOTHROW Bits transposed() const Q_DECL_NOTHROW
{ {
QT_SIZEPOLICY_RETURN_BITS(verStretch, // \ swap return {verStretch, // \ swap
horStretch, // / horStretch, // /
verPolicy, // \ swap verPolicy, // \ swap
horPolicy, // / horPolicy, // /
ctype, ctype,
hfw, // \ don't swap (historic behavior) hfw, // \ don't swap (historic behavior)
wfh, // / wfh, // /
retainSizeWhenHidden); retainSizeWhenHidden};
} }
}; };
union { union {
@ -234,7 +226,6 @@ Q_WIDGETS_EXPORT QDebug operator<<(QDebug dbg, const QSizePolicy &);
#undef QT_SIZEPOLICY_CONSTEXPR #undef QT_SIZEPOLICY_CONSTEXPR
#undef QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT #undef QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
#undef QT_SIZEPOLICY_RETURN_BITS
QT_END_NAMESPACE QT_END_NAMESPACE