MCPcopy Create free account
hub / github.com/KDAB/GammaRay / flagsFromEnumIndex

Function flagsFromEnumIndex

core/enumutil.cpp:34–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34static QMetaEnum flagsFromEnumIndex(int enumIndex, const QByteArray &enumName, const QMetaObject *const mo)
35{
36 Q_ASSERT(mo);
37 // usually it should be just enumIndex + 1
38 const auto count = mo->enumeratorCount();
39 if (enumIndex + 1 < count) {
40 const QMetaEnum me = mo->enumerator(enumIndex + 1);
41 if (me.isFlag() && enumName == me.enumName()) {
42 return me;
43 }
44 }
45
46 for (int i = mo->enumeratorOffset(); i < count; ++i) {
47 const QMetaEnum me = mo->enumerator(i);
48 if (me.isFlag() && enumName == me.enumName()) {
49 return me;
50 }
51 }
52 return mo->enumerator(enumIndex);
53}
54
55QMetaEnum EnumUtil::metaEnum(const QVariant &value, const char *typeName, const QMetaObject *metaObject)
56{

Callers 1

metaEnumMethod · 0.85

Calls 1

isFlagMethod · 0.80

Tested by

no test coverage detected