diff options
author | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2010-08-02 06:39:20 (GMT) |
---|---|---|
committer | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2010-09-02 12:36:55 (GMT) |
commit | 99fde91e08cd20410c8161e79295a029abbff53f (patch) | |
tree | f3e9a45cbea5b16d43a91ed9946c22d0e2c1308a /src/gui/kernel/qsizepolicy.h | |
parent | 3cfd5a69976bbd98c14cfbf51879356e46cd76a8 (diff) | |
download | Qt-99fde91e08cd20410c8161e79295a029abbff53f.zip Qt-99fde91e08cd20410c8161e79295a029abbff53f.tar.gz Qt-99fde91e08cd20410c8161e79295a029abbff53f.tar.bz2 |
Add hasWidthForHeight in order to support WFH in QGraphicsLayout.
Task-number: Consequence of QT-3570
Reviewed-by: Paul
Diffstat (limited to 'src/gui/kernel/qsizepolicy.h')
-rw-r--r-- | src/gui/kernel/qsizepolicy.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/gui/kernel/qsizepolicy.h b/src/gui/kernel/qsizepolicy.h index ff7b9ee..26cc1e1 100644 --- a/src/gui/kernel/qsizepolicy.h +++ b/src/gui/kernel/qsizepolicy.h @@ -62,12 +62,12 @@ private: HSize = 4, HMask = 0x0f, VMask = HMask << HSize, - CTShift = 9, - CTSize = 5, - WFHShift = CTShift + CTSize, - CTMask = ((0x1 << CTSize) - 1) << CTShift, - UnusedShift = CTShift + CTSize, - UnusedSize = 2 + CTShift = 9, + CTSize = 5, + CTMask = ((0x1 << CTSize) - 1) << CTShift, + WFHShift = CTShift + CTSize, + UnusedShift = WFHShift + 1, + UnusedSize = 1 }; public: @@ -134,6 +134,8 @@ public: void setHeightForWidth(bool b) { data = b ? (data | (1 << 2*HSize)) : (data & ~(1 << 2*HSize)); } bool hasHeightForWidth() const { return data & (1 << 2*HSize); } + void setWidthForHeight(bool b) { data = b ? (data | (1 << (WFHShift))) : (data & ~(1 << (WFHShift))); } + bool hasWidthForHeight() const { return data & (1 << (WFHShift)); } bool operator==(const QSizePolicy& s) const { return data == s.data; } bool operator!=(const QSizePolicy& s) const { return data != s.data; } @@ -200,15 +202,18 @@ private: QSizePolicy(int i) : data(i) { } quint32 data; -/* use bit flags instead, keep it here for improved readability for now +/* Qt5: Use bit flags instead, keep it here for improved readability for now. + We can maybe change it for Qt4, but we'd have to be careful, since the behaviour + is implementation defined. It usually varies between little- and big-endian compilers, but + it might also not vary. quint32 horzPolicy : 4; quint32 vertPolicy : 4; quint32 hfw : 1; quint32 ctype : 5; quint32 wfh : 1; quint32 padding : 1; // we cannot use the highest bit - quint32 horStretch : 8; quint32 verStretch : 8; + quint32 horStretch : 8; */ }; |