aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertycache_p.h
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2016-07-22 10:08:17 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2016-08-04 12:11:05 +0000
commit1534dd6d97c49f5c7e0392df9c95198311b5b817 (patch)
treedad42c0c12c0ef3005b26645df6cc21832f54315 /src/qml/qml/qqmlpropertycache_p.h
parentfdc3dcd43f8944eb33e778627c43ab9487a26960 (diff)
QML: Introduce QQmlPropertyIndex
This helps in making it clear when an index is a plain old number and when it consists of an encoded value type index. Change-Id: Ic50d95caf244ed0ee2d62bdba53910a371cfee04 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertycache_p.h')
-rw-r--r--src/qml/qml/qqmlpropertycache_p.h14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h
index 750537e707..52e0fdc3bd 100644
--- a/src/qml/qml/qqmlpropertycache_p.h
+++ b/src/qml/qml/qqmlpropertycache_p.h
@@ -55,6 +55,7 @@
#include <private/qflagpointer_p.h>
#include "qqmlcleanup_p.h"
#include "qqmlnotifier_p.h"
+#include <private/qqmlpropertyindex_p.h>
#include <private/qhashedstring_p.h>
#include <QtCore/qvarlengtharray.h>
@@ -174,13 +175,7 @@ public:
// Returns the "encoded" index for use with bindings. Encoding is:
// coreIndex | ((valueTypeCoreIndex + 1) << 16)
- inline int encodedIndex() const;
- static int encodeValueTypePropertyIndex(int coreIndex, int valueTypeCoreIndex)
- { return coreIndex | ((valueTypeCoreIndex + 1) << 16); }
- static int decodeValueTypePropertyIndex(int index, int *coreIndex = 0) {
- if (coreIndex) *coreIndex = index & 0xffff;
- return (index >> 16) - 1;
- }
+ inline QQmlPropertyIndex encodedIndex() const;
union {
int propType; // When !NotFullyResolved
@@ -557,9 +552,10 @@ int QQmlPropertyRawData::getValueTypeCoreIndex() const
return isValueTypeVirtual()?valueTypeCoreIndex:-1;
}
-int QQmlPropertyRawData::encodedIndex() const
+QQmlPropertyIndex QQmlPropertyRawData::encodedIndex() const
{
- return isValueTypeVirtual()?QQmlPropertyData::encodeValueTypePropertyIndex(coreIndex, valueTypeCoreIndex):coreIndex;
+ return isValueTypeVirtual() ? QQmlPropertyIndex(coreIndex, valueTypeCoreIndex)
+ : QQmlPropertyIndex(coreIndex);
}
inline QQmlPropertyData *QQmlPropertyCache::ensureResolved(QQmlPropertyData *p) const