diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2016-05-11 10:41:47 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-05-11 09:21:52 +0000 |
commit | 531d00c1909527cb1bc28f17197267ccde408b0c (patch) | |
tree | 6eda4da3888c669571c29e6098bb2029b4510404 /src | |
parent | c6c0d730b7a88fa22f40d597183e91b73d9d165d (diff) |
QML: Fix anchors on Windows.
When using an enum type for a bitfield (i.e. Anchors foo : 7), MSVC will
somehow store (or interpret) it as signed, while clang/gcc will do it
unsigned. This behavior can be made less exciting by specifying the
storage type of the enum.
However, as the exception that confirms the rule: gcc 4.8 on OpenSUSE 13
will complain that it can't store all Anchor values in a 7 bit bitfield,
but ONLY when a base type for an enum is specified.
Change-Id: I7514dd613017d321de55560affb9b355fa75fa2e
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquickanchors_p.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/quick/items/qquickanchors_p.h b/src/quick/items/qquickanchors_p.h index d3c8ed82be..2b054e4118 100644 --- a/src/quick/items/qquickanchors_p.h +++ b/src/quick/items/qquickanchors_p.h @@ -89,7 +89,13 @@ public: QQuickAnchors(QQuickItem *item, QObject *parent=0); virtual ~QQuickAnchors(); - enum Anchor { + enum Anchor +#if !(defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && (Q_CC_GNU < 500)) + // Not specifying the enum base type will have MSVC 'interpret' it as signed instead of an unsigned bit-field. + // However, specifying the enum base type breaks GCC 4.x on OpenSUSE 13.something, where it complains that it can't store all values in a 7 bit bitfield. + : uint +#endif + { InvalidAnchor = 0x0, LeftAnchor = 0x01, RightAnchor = 0x02, |