113 QMap<int, bool> valueMap;
116 for (
int i = 0; i < metaEnum.keyCount(); i++)
118 int value = metaEnum.value(i);
120 if (!valueMap.contains(value))
122 valueMap[value] =
true;
123 values.append(value);
127 if (intValue >= values.count())
132 return values.at(intValue);
211 QMap<int, bool> valueMap;
214 for (
int i = 0; i < metaEnum.keyCount(); i++)
216 int value = metaEnum.value(i);
218 if (!valueMap.contains(value) &&
isPowerOf2(value))
220 valueMap[value] =
true;
221 values.append(value);
231 if (i >= values.count())
238 flagValue |= values.at(i);
268 for (
int idx = metaObject->propertyOffset(); idx < metaObject->propertyCount(); idx++)
270 QMetaProperty metaProperty = metaObject->property(idx);
272 if (metaProperty.isReadable())
279 if (metaProperty.isEnumType())
281 if (metaProperty.isFlagType())
284 metaProperty.read(
m_object).toInt()));
289 metaProperty.read(
m_object).toInt()));
315 QString className = QLatin1String(metaObject->className());
320 for (
int idx = metaObject->propertyOffset(); idx < metaObject->propertyCount(); idx++)
322 QMetaProperty metaProperty = metaObject->property(idx);
323 int type = metaProperty.userType();
326 if (!metaProperty.isReadable())
329 QLatin1String(metaProperty.name()));
330 subProperty->
setValue(QLatin1String(
"< Non Readable >"));
332 else if (metaProperty.isEnumType())
334 if (metaProperty.isFlagType())
337 QLatin1String(metaProperty.name()));
338 QMetaEnum metaEnum = metaProperty.enumerator();
339 QMap<int, bool> valueMap;
340 QStringList flagNames;
342 for (
int i = 0; i < metaEnum.keyCount(); i++)
344 int value = metaEnum.value(i);
346 if (!valueMap.contains(value) &&
isPowerOf2(value))
348 valueMap[value] =
true;
349 flagNames.append(QLatin1String(metaEnum.key(i)));
352 subProperty->
setAttribute(QLatin1String(
"flagNames"), flagNames);
360 QLatin1String(metaProperty.name()));
361 QMetaEnum metaEnum = metaProperty.enumerator();
364 QStringList enumNames;
366 for (
int i = 0; i < metaEnum.keyCount(); i++)
368 int value = metaEnum.value(i);
370 if (!valueMap.contains(value))
372 valueMap[value] =
true;
373 enumNames.append(QLatin1String(metaEnum.key(i)));
377 subProperty->
setAttribute(QLatin1String(
"enumNames"), enumNames);
381 else if (
m_manager->isPropertyTypeSupported(type))
383 if (!metaProperty.isWritable())
387 QLatin1String(metaProperty.name()) + QLatin1String(
" (Non Writable)"));
390 if (!metaProperty.isDesignable())
394 QLatin1String(metaProperty.name()) + QLatin1String(
" (Non Designable)"));
398 subProperty =
m_manager->addProperty(type, QLatin1String(metaProperty.name()));
406 QLatin1String(metaProperty.name()));
407 subProperty->
setValue(QLatin1String(
"< Unknown Type >"));
445 const QMetaObject* metaObject =
m_object->metaObject();
446 QMetaProperty metaProperty = metaObject->property(idx);
448 if (metaProperty.isEnumType())
450 if (metaProperty.isFlagType())
452 metaProperty.write(
m_object,
intToFlag(metaProperty.enumerator(), value.toInt()));
456 metaProperty.write(
m_object,
intToEnum(metaProperty.enumerator(), value.toInt()));
461 metaProperty.write(
m_object, value);
511 if (d_ptr->m_object ==
object)
518 d_ptr->saveExpandedState();
519 QListIterator<QtProperty*> it(d_ptr->m_topLevelProperties);
523 d_ptr->m_browser->removeProperty(it.next());
526 d_ptr->m_topLevelProperties.clear();
531 if (!d_ptr->m_object)
536 d_ptr->addClassProperties(d_ptr->m_object->metaObject());
538 d_ptr->restoreExpandedState();