| 32 | } |
| 33 | |
| 34 | static 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 | |
| 55 | QMetaEnum EnumUtil::metaEnum(const QVariant &value, const char *typeName, const QMetaObject *metaObject) |
| 56 | { |