void ObjectControllerPrivate::updateClassProperties(const QMetaObject *metaObject, bool recursive)
{
    if (!metaObject)
        return;

    if (recursive)
        updateClassProperties(metaObject->superClass(), recursive);

    QtProperty *classProperty = m_classToProperty.value(metaObject);
    if (!classProperty)
        return;

    for (int idx = metaObject->propertyOffset(); idx < metaObject->propertyCount(); idx++) {
        QMetaProperty metaProperty = metaObject->property(idx);
        if (metaProperty.isReadable()) {
            if (m_classToIndexToProperty.contains(metaObject) && m_classToIndexToProperty[metaObject].contains(idx)) {
                QtVariantProperty *subProperty = m_classToIndexToProperty[metaObject][idx];
                if (metaProperty.isEnumType()) {
                    if (metaProperty.isFlagType())
                        subProperty->setValue(flagToInt(metaProperty.enumerator(), metaProperty.read(m_object).toInt()));
                    else
                        subProperty->setValue(enumToInt(metaProperty.enumerator(), metaProperty.read(m_object).toInt()));
                } else {
                    subProperty->setValue(metaProperty.read(m_object));
                }
            }
        }
    }
}
void QJnextMainLoop::get(QObject *object, QVariantList& args,
		QByteArray* retval) {
	QByteArray property = args.takeFirst().toByteArray();

	const QMetaObject * meta = object->metaObject();
	int propertyIndex = meta->indexOfProperty(property);
	if (propertyIndex < 0) {
		retval->append("No such property " + property);
		return;
	}

	QMetaProperty metaprop = meta->property(propertyIndex);
	if (!metaprop.isReadable()) {
		retval->append("Property " + property + " is not readable");
		return;
	}

	QVariant value = metaprop.read(object);
	if (value.isNull()) {
		qWarning() << "[QJnextMainLoop]\tNULL value ignored" << object->property(property);
	}
#ifdef DEBUG_QJnextMainLoop
	qDebug() << "[QJnextMainLoop]\tVALUE" << value << object->property(property) << metaprop.isEnumType();
#endif

    if (metaprop.isEnumType()) {
        bool ok;
        int enumValue = value.toInt(&ok);
        if (!ok) {
            int status = -1;
            void *argv[] = { 0, &value, &status };
            QMetaObject::metacall(const_cast<QObject*>(object), QMetaObject::ReadProperty,
                    propertyIndex + meta->propertyOffset(), argv);
            const int * enumRaw = static_cast<const int *>(argv[0]);

            if (status == -1 && enumRaw != 0) {
                const QMetaEnum & iEnum = metaprop.enumerator();
                if (iEnum.isFlag())
                    value = iEnum.valueToKeys(*enumRaw);
                else
                    value = iEnum.valueToKey(*enumRaw);
            } else {
                // someone is evil and didn't register enumerations properly
                qDebug() << "[QJnextMainLoop]\t" << "!!!!!!!" << argv[0] << value;
            }
        } else if (metaprop.enumerator().isFlag()) {
            *retval = metaprop.enumerator().valueToKeys(enumValue);
            return;
        } else {
            *retval = metaprop.enumerator().valueToKey(enumValue);
            return;
        }
    }
	*retval = value.toByteArray();
}
QMetaEnum EventHub::createKeyMetaEnum()
{
    const QMetaObject &mo = EventHub::staticMetaObject;
    int prop_index = mo.indexOfProperty( "_qtKeyEnum" );
    QMetaProperty metaProperty = mo.property( prop_index );
    return metaProperty.enumerator();
}
void QJnextMainLoop::set(QObject *object, QVariantList& args,
		QByteArray* retval) {
	QByteArray property = args.takeFirst().toByteArray();

	const QMetaObject * meta = object->metaObject();
	int propertyIndex = meta->indexOfProperty(property);
	if (propertyIndex < 0) {
		retval->append("No such property " + property);
		return;
	}

	QMetaProperty metaprop = meta->property(propertyIndex);
	if (!metaprop.isWritable()) {
		retval->append("Property " + property + " is not writable");
		return;
	}
	QVariant vValue = args.takeFirst();

	/* handle enum inputs as text */
	if (metaprop.isEnumType()) {
		int id;
		const QMetaEnum &enumerator = metaprop.enumerator();
		QByteArray keys;
		for (int i = 0; i < enumerator.keyCount(); ++i)
			keys += enumerator.key(i) + QByteArray(" ");
#ifdef DEBUG_QJnextMainLoop
		qDebug() << "[QJnextMainLoop]\tEnumerator" << enumerator.isFlag() << enumerator.scope() << enumerator.name() <<
		keys;
#endif

		if (enumerator.isFlag())
			id = enumerator.keyToValue(vValue.toByteArray().constData());
		else
			id = enumerator.keysToValue(vValue.toByteArray().constData());

		if (id != -1)
			vValue = QVariant(id);
	}
#ifdef DEBUG_QJnextMainLoop
	qDebug() << "[QJnextMainLoop]\tSET" << meta->className() << property << vValue
	<< vValue.canConvert(metaprop.type());
#endif

	if (!vValue.convert(metaprop.type())) {
		retval->append(
				"Unable to convert \"" + vValue.toByteArray() + "\" to "
						+ metaprop.typeName());
		return;
	}

	if (!metaprop.write(object, vValue))
		retval->append(
				QByteArray("Unable to set property ") + meta->className() + "."
						+ property + " to " + vValue.toByteArray());
	else
		*retval = QByteArray();
}
void ObjectControllerPrivate::slotValueChanged(QtProperty *property, const QVariant &value)
{
    if (!m_propertyToIndex.contains(property))
        return;

    int idx = m_propertyToIndex.value(property);

    const QMetaObject *metaObject = m_object->metaObject();
    QMetaProperty metaProperty = metaObject->property(idx);
    if (metaProperty.isEnumType()) {
        if (metaProperty.isFlagType())
            metaProperty.write(m_object, intToFlag(metaProperty.enumerator(), value.toInt()));
        else
            metaProperty.write(m_object, intToEnum(metaProperty.enumerator(), value.toInt()));
    } else {
        metaProperty.write(m_object, value);
    }

    updateClassProperties(metaObject, true);
}
PaletteModel::PaletteModel(QObject *parent)  : 
    QAbstractTableModel(parent),
    m_compute(true)
{
    const QMetaObject *meta = metaObject();
    const int index = meta->indexOfProperty("colorRole");
    const QMetaProperty p = meta->property(index);
    const QMetaEnum e = p.enumerator();
    for (int r = QPalette::WindowText; r < QPalette::NColorRoles; r++) {
        m_roleNames[static_cast<QPalette::ColorRole>(r)] = QLatin1String(e.key(r));
    }
}
Exemple #7
0
void MetaInfoPrivate::parseProperties(NodeMetaInfo &nodeMetaInfo, const QMetaObject *qMetaObject) const
{
    Q_ASSERT_X(qMetaObject, Q_FUNC_INFO, "invalid QMetaObject");
    Q_ASSERT_X(nodeMetaInfo.isValid(), Q_FUNC_INFO, "invalid NodeMetaInfo");

    for (int i = qMetaObject->propertyOffset(); i < qMetaObject->propertyCount(); ++i) {
        QMetaProperty qProperty = qMetaObject->property(i);

        PropertyMetaInfo propertyInfo;

        propertyInfo.setName(QLatin1String(qProperty.name()));

        QString typeName(qProperty.typeName());
        QString noStar = typeName;
        bool star = false;
        while (noStar.contains('*')) {//strip star
            noStar.chop(1);
            star = true;
        }
        if (m_QtTypesToQmlTypes.contains(noStar)) {
            typeName = star ? m_QtTypesToQmlTypes.value(noStar) + '*' : m_QtTypesToQmlTypes.value(noStar);
            //### versions
        }
        propertyInfo.setType(typeName);
        propertyInfo.setValid(true);
        propertyInfo.setReadable(qProperty.isReadable());
        propertyInfo.setWritable(qProperty.isWritable());
        propertyInfo.setResettable(qProperty.isResettable());
        propertyInfo.setEnumType(qProperty.isEnumType());
        propertyInfo.setFlagType(qProperty.isFlagType());

        if (propertyInfo.isEnumType()) {
            EnumeratorMetaInfo enumerator;

            QMetaEnum qEnumerator = qProperty.enumerator();
            enumerator.setValid(qEnumerator.isValid());
            enumerator.setIsFlagType(qEnumerator.isFlag());
            enumerator.setScope(qEnumerator.scope());
            enumerator.setName(qEnumerator.name());
            for (int i = 0 ;i < qEnumerator.keyCount(); i++)
            {
                enumerator.addElement(qEnumerator.valueToKey(i), i);
            }

            propertyInfo.setEnumerator(enumerator);
        }

        nodeMetaInfo.addProperty(propertyInfo);
    }
}
void SaxsviewProperty::setValue(QObject *obj) {
  if (!mProperty) {
    //
    // Find the meta-property information; the passed object must
    // provide the Q_PROPERTY name passed to the constructor.
    //
    int indexOfProperty = obj->metaObject()->indexOfProperty(qPrintable(mPropertyName));
    QMetaProperty metaProperty = obj->metaObject()->property(indexOfProperty);

    if (metaProperty.isValid()) {
      //
      // Create an editor factory if and only if the property is writeable.
      //
      if (metaProperty.isWritable()) {
        mBrowser->setFactoryForManager(mManager, new QtVariantEditorFactory(this));
        connect(mManager, SIGNAL(valueChanged(QtProperty*, const QVariant&)),
                this, SLOT(valueChanged(QtProperty*, const QVariant&)));
      }

      if (!mManager->isPropertyTypeSupported(metaProperty.type()))
        qFatal("internal error: property '%s', property type not supported: '%s'",
               metaProperty.name(), metaProperty.typeName());

      //
      // Check if this is an enum and handle it specially if yes.
      //
      if (metaProperty.isEnumType()) {
        QStringList enumNames;
        QMetaEnum metaEnum = metaProperty.enumerator();

        //
        // WARNING: This only builds a  list of names in the order
        //          as defined. The combobox to display these names
        //          provides the selected index, not the actual enum
        //          value.
        //
        for (int i = 0; i < metaEnum.keyCount(); ++i)
          enumNames << metaEnum.key(i);

        setEnumNames(enumNames);
      }

      if (mAttributes.contains("enumNames"))
        mProperty = mManager->addProperty(mManager->enumTypeId(), mPropertyLabel);
      else
        mProperty = mManager->addProperty(metaProperty.type(), mPropertyLabel);

    } else if (obj->dynamicPropertyNames().contains(qPrintable(mPropertyName))) {
QVariant ObjectNodeInstance::convertEnumToValue(const QVariant &value, const PropertyName &name)
{
    Q_ASSERT(value.canConvert<Enumeration>());
    int propertyIndex = object()->metaObject()->indexOfProperty(name);
    QMetaProperty metaProperty = object()->metaObject()->property(propertyIndex);

    QVariant adjustedValue;
    Enumeration enumeration = value.value<Enumeration>();
    if (metaProperty.isValid() && metaProperty.isEnumType()) {
        adjustedValue = metaProperty.enumerator().keyToValue(enumeration.name());
    } else {
        QQmlExpression expression(context(), object(), enumeration.toString());
        adjustedValue =  expression.evaluate();
        if (expression.hasError())
            qDebug() << "Enumeration can not be evaluated:" << object() << name << enumeration;
    }
    return adjustedValue;
}
Exemple #10
0
QString QObjectWriter::
toString(const QVariant& val, const QMetaProperty& mprop) const {
    QString result;
    QVariant::Type t = mprop.type();
    if (t == QVariant::Time) {
        QTime t = qVariantValue<QTime>(val);
        if (t.hour() > 0) {
            return t.toString("hh:mm:ss");
        }
        else {
            return t.toString("m:ss");
        }
    }
    if (mprop.isEnumType()) {
        int value = val.toInt();
        QMetaEnum menum = mprop.enumerator();
        if (mprop.isFlagType()) {
            QStringList selectedFlags;
            int kc = menum.keyCount();
            for (int j=0; j<kc; ++j) {
                if (menum.value(j) == 0) continue;
                if ((value & menum.value(j)) == menum.value(j)) {
                    selectedFlags << menum.key(j);
                }
            }
            result = selectedFlags.join("|") + QString(" (%1)").arg(val.toInt());
        }
        else result = QString("%1 (%2)").arg(menum.valueToKey(value)).arg(val.toInt());
        return result;
    }
    if (m_map.contains(t)) {
        VariantWriter* vw = m_map[t];
        result = vw->toString(val, mprop);
    }
    else if (m_vwriter != 0 && result == QString())
        result = m_vwriter->toString(val, mprop);
    if (result == QString())
        result = Qt::escape(val.toString());
    else
        result = Qt::escape(result);
    return result;
}
/* Method for setting enum values from Strings. */
void Customer::setType(QString newType) {           /* Overloaded version
    that accepts a string as an argument.
    Sets value to -1 if unknown. */

    static const QMetaObject* meta = metaObject();  /* Because
       they are static locals, the initializations happen
       only once. */
    static int propindex = meta->indexOfProperty("type");
    static const QMetaProperty mp = meta->property(propindex);

    QMetaEnum menum = mp.enumerator();              /* This code gets
           executed each time. */
    const char* ntyp = newType.toLatin1().data();
    CustomerType theType =
                   static_cast<CustomerType>(menum.keyToValue(ntyp));
    
    if (theType != m_type) {                        /* Always check if valueChanged signal is needed. */
        CustomerType oldType = m_type;
        m_type = theType;
        emit valueChanged("type", theType, oldType);
    }
}
Exemple #12
0
//writeEnumProperty MIRRORS the relelvant bit of QMetaProperty::write AND MUST BE KEPT IN SYNC!
bool QDeclarativePropertyPrivate::writeEnumProperty(const QMetaProperty &prop, int idx, QObject *object, const QVariant &value, int flags)
{
    if (!object || !prop.isWritable())
        return false;

    QVariant v = value;
    if (prop.isEnumType()) {
        QMetaEnum menum = prop.enumerator();
        if (v.userType() == QVariant::String
#ifdef QT3_SUPPORT
            || v.userType() == QVariant::CString
#endif
            ) {
            if (prop.isFlagType())
                v = QVariant(menum.keysToValue(value.toByteArray()));
            else
                v = QVariant(menum.keyToValue(value.toByteArray()));
        } else if (v.userType() != QVariant::Int && v.userType() != QVariant::UInt) {
            int enumMetaTypeId = QMetaType::type(QByteArray(menum.scope()) + "::" + menum.name());
            if ((enumMetaTypeId == 0) || (v.userType() != enumMetaTypeId) || !v.constData())
                return false;
            v = QVariant(*reinterpret_cast<const int *>(v.constData()));
        }
        v.convert(QVariant::Int);
    }

    // the status variable is changed by qt_metacall to indicate what it did
    // this feature is currently only used by QtDBus and should not be depended
    // upon. Don't change it without looking into QDBusAbstractInterface first
    // -1 (unchanged): normal qt_metacall, result stored in argv[0]
    // changed: result stored directly in value, return the value of status
    int status = -1;
    void *argv[] = { v.data(), &v, &status, &flags };
    QMetaObject::metacall(object, QMetaObject::WriteProperty, idx, argv);
    return status;
}
Exemple #13
0
bool EnumTypeResolver::tryQualifiedEnumAssignment(const QmlIR::Object *obj, const QQmlPropertyCache *propertyCache, const QQmlPropertyData *prop, QmlIR::Binding *binding)
{
    bool isIntProp = (prop->propType == QMetaType::Int) && !prop->isEnum();
    if (!prop->isEnum() && !isIntProp)
        return true;

    if (!prop->isWritable() && !(binding->flags & QV4::CompiledData::Binding::InitializerForReadOnlyDeclaration)) {
        compiler->recordError(binding->location, tr("Invalid property assignment: \"%1\" is a read-only property").arg(compiler->stringAt(binding->propertyNameIndex)));
        return false;
    }

    Q_ASSERT(binding->type = QV4::CompiledData::Binding::Type_Script);
    const QString string = compiler->bindingAsString(obj, binding->value.compiledScriptIndex);
    if (!string.constData()->isUpper())
        return true;

    int dot = string.indexOf(QLatin1Char('.'));
    if (dot == -1 || dot == string.length()-1)
        return true;

    if (string.indexOf(QLatin1Char('.'), dot+1) != -1)
        return true;

    QHashedStringRef typeName(string.constData(), dot);
    QString enumValue = string.mid(dot+1);

    if (isIntProp) {
        // Allow enum assignment to ints.
        bool ok;
        int enumval = evaluateEnum(typeName.toString(), enumValue.toUtf8(), &ok);
        if (ok) {
            binding->type = QV4::CompiledData::Binding::Type_Number;
            binding->value.d = (double)enumval;
            binding->flags |= QV4::CompiledData::Binding::IsResolvedEnum;
        }
        return true;
    }
    QQmlType *type = 0;
    imports->resolveType(typeName, &type, 0, 0, 0);

    if (!type && typeName != QLatin1String("Qt"))
        return true;
    if (type && type->isComposite()) //No enums on composite (or composite singleton) types
        return true;

    int value = 0;
    bool ok = false;

    QQmlCompiledData::TypeReference *tr = resolvedTypes->value(obj->inheritedTypeNameIndex);
    if (type && tr && tr->type == type) {
        QMetaProperty mprop = propertyCache->firstCppMetaObject()->property(prop->coreIndex);

        // When these two match, we can short cut the search
        if (mprop.isFlagType()) {
            value = mprop.enumerator().keysToValue(enumValue.toUtf8().constData(), &ok);
        } else {
            value = mprop.enumerator().keyToValue(enumValue.toUtf8().constData(), &ok);
        }
    } else {
        // Otherwise we have to search the whole type
        if (type) {
            value = type->enumValue(QHashedStringRef(enumValue), &ok);
        } else {
            QByteArray enumName = enumValue.toUtf8();
            const QMetaObject *metaObject = StaticQtMetaObject::get();
            for (int ii = metaObject->enumeratorCount() - 1; !ok && ii >= 0; --ii) {
                QMetaEnum e = metaObject->enumerator(ii);
                value = e.keyToValue(enumName.constData(), &ok);
            }
        }
    }

    if (!ok)
        return true;

    binding->type = QV4::CompiledData::Binding::Type_Number;
    binding->value.d = (double)value;
    binding->flags |= QV4::CompiledData::Binding::IsResolvedEnum;
    return true;
}
Exemple #14
0
QString Country::toString() const {
    const QMetaProperty mp(metaProperty("val"));
    QMetaEnum qmen = mp.enumerator();
    return qmen.valueToKey(m_Val);
}
Exemple #15
0
Country::Country(const QString& string) {
    const QMetaProperty mp(metaProperty("val"));
    QMetaEnum qmen = mp.enumerator();
    m_Val = static_cast<CountryType>(qmen.keyToValue(string.toAscii()));
}
Exemple #16
0
void ObjectControllerPrivate::addClassProperties(const QMetaObject *metaObject)
{
    if (!metaObject)
        return;

    addClassProperties(metaObject->superClass());

    QtProperty *classProperty = m_classToProperty.value(metaObject);
    if (!classProperty) {
        QString className = QLatin1String(metaObject->className());
        classProperty = m_manager->addProperty(QtVariantPropertyManager::groupTypeId(), className);
        m_classToProperty[metaObject] = classProperty;
        m_propertyToClass[classProperty] = metaObject;

        for (int idx = metaObject->propertyOffset(); idx < metaObject->propertyCount(); idx++) {
            QMetaProperty metaProperty = metaObject->property(idx);
            int type = metaProperty.userType();
            QtVariantProperty *subProperty = 0;
            if (!metaProperty.isReadable()) {
                subProperty = m_readOnlyManager->addProperty(QVariant::String, QLatin1String(metaProperty.name()));
                subProperty->setValue(QLatin1String("< Non Readable >"));
            } else if (metaProperty.isEnumType()) {
                if (metaProperty.isFlagType()) {
                    subProperty = m_manager->addProperty(QtVariantPropertyManager::flagTypeId(), QLatin1String(metaProperty.name()));
                    QMetaEnum metaEnum = metaProperty.enumerator();
                    QMap<int, bool> valueMap;
                    QStringList flagNames;
                    for (int i = 0; i < metaEnum.keyCount(); i++) {
                        int value = metaEnum.value(i);
                        if (!valueMap.contains(value) && isPowerOf2(value)) {
                            valueMap[value] = true;
                            flagNames.append(QLatin1String(metaEnum.key(i)));
                        }
                    subProperty->setAttribute(QLatin1String("flagNames"), flagNames);
                    subProperty->setValue(flagToInt(metaEnum, metaProperty.read(m_object).toInt()));
                    }
                } else {
                    subProperty = m_manager->addProperty(QtVariantPropertyManager::enumTypeId(), QLatin1String(metaProperty.name()));
                    QMetaEnum metaEnum = metaProperty.enumerator();
                    QMap<int, bool> valueMap; // dont show multiple enum values which have the same values
                    QStringList enumNames;
                    for (int i = 0; i < metaEnum.keyCount(); i++) {
                        int value = metaEnum.value(i);
                        if (!valueMap.contains(value)) {
                            valueMap[value] = true;
                            enumNames.append(QLatin1String(metaEnum.key(i)));
                        }
                    }
                    subProperty->setAttribute(QLatin1String("enumNames"), enumNames);
                    subProperty->setValue(enumToInt(metaEnum, metaProperty.read(m_object).toInt()));
                }
            } else if (m_manager->isPropertyTypeSupported(type)) {
                if (!metaProperty.isWritable())
                    subProperty = m_readOnlyManager->addProperty(type, QLatin1String(metaProperty.name()) + QLatin1String(" (Non Writable)"));
                if (!metaProperty.isDesignable())
                    subProperty = m_readOnlyManager->addProperty(type, QLatin1String(metaProperty.name()) + QLatin1String(" (Non Designable)"));
                else
                    subProperty = m_manager->addProperty(type, QLatin1String(metaProperty.name()));
                subProperty->setValue(metaProperty.read(m_object));
            } else {
                subProperty = m_readOnlyManager->addProperty(QVariant::String, QLatin1String(metaProperty.name()));
                subProperty->setValue(QLatin1String("< Unknown Type >"));
                subProperty->setEnabled(false);
            }
            classProperty->addSubProperty(subProperty);
            m_propertyToIndex[subProperty] = idx;
            m_classToIndexToProperty[metaObject][idx] = subProperty;
        }
    } else {
        updateClassProperties(metaObject, false);
    }

    m_topLevelProperties.append(classProperty);
    m_browser->addProperty(classProperty);
}
void ObjectControllerPrivate::addClassProperties(const QMetaObject *inmetaObject, bool subGroup)
{
    if (!inmetaObject)
        return;
    
    // Collect a list of all sub classes in the object
    QList< const QMetaObject *> metaObjectsList;
    metaObjectsList.clear();

    metaObjectsList << inmetaObject;

    const QMetaObject *tmpObj = inmetaObject->superClass();
    metaObjectsList << tmpObj;
    while (tmpObj)
    {
        tmpObj = tmpObj->superClass();
        if (tmpObj)
            metaObjectsList << tmpObj;
    }
    
    const QMetaObject *metaObject;

    for (int i = 0; i < metaObjectsList.count(); i++)
    {
        metaObject = metaObjectsList[i];
        
        QtProperty *classProperty = m_classToProperty.value(metaObject);
        if (!classProperty) {
            QString className = QLatin1String(metaObject->className());

            // Note: Skip class QObject from the property views
            if (className == QLatin1String("QObject")) return;

            // Process Class name into a user friendly view
            // Strip prefix C_ and process all _ to spaces
            
            QString prefix("C_"); // String to replace.
            QString replaceprefix(""); // Replacement string.
            className.replace(className.indexOf(prefix), prefix.size(), replaceprefix);
            className.replace(QString("_"), QString(" "));
            classProperty = m_manager->addProperty(QtVariantPropertyManager::groupTypeId(), className);
            m_classToProperty[metaObject] = classProperty;
            m_propertyToClass[classProperty] = metaObject;

            for (int idx = metaObject->propertyOffset(); idx < metaObject->propertyCount(); idx++) {

                QMetaProperty metaProperty = metaObject->property(idx);
                int type = metaProperty.userType();
                QtVariantProperty *subProperty = 0;

                // Note:  Get the var member name and check if we want it to be writable (Enabled)
                QString memberVarName = QLatin1String(metaProperty.name());
                bool b_SetEnabled = true;

                // Special case for enabling or disabling editing
                QString ememberVarName = "e" + QLatin1String(metaProperty.name());
                QByteArray array = ememberVarName.toLocal8Bit();
                char* buffer = array.data();
                QVariant set = m_object->property(buffer);
                if (set.type() == QVariant::Bool)
                {
                    b_SetEnabled = (bool &)set;
                }

                // qDebug() << "Member Name :" << memberVarName;

                // Note: process the first char if it contains _ then the var is read only and remove the _ char
                if (memberVarName.at(0) == "_") {
                    b_SetEnabled = false;
                    memberVarName.remove(0, 1);
                }

                // after that replace all occurance of _ with space char for display 
                memberVarName.replace(QString("_"), QString(" "));

                if (!metaProperty.isReadable()) {
                    subProperty = m_readOnlyManager->addProperty(QVariant::String, memberVarName);
                    subProperty->setValue(QLatin1String("< Non Readable >"));
                }
                else if (metaProperty.isEnumType()) {
                    if (metaProperty.isFlagType()) {
                        subProperty = m_manager->addProperty(QtVariantPropertyManager::flagTypeId(), memberVarName);
                        QMetaEnum metaEnum = metaProperty.enumerator();
                        QMap<int, bool> valueMap;
                        QStringList flagNames;
                        for (int i = 0; i < metaEnum.keyCount(); i++) {
                            int value = metaEnum.value(i);
                            if (!valueMap.contains(value) && isPowerOf2(value)) {
                                valueMap[value] = true;
                                flagNames.append(QLatin1String(metaEnum.key(i)));
                            }
                            subProperty->setAttribute(QLatin1String("flagNames"), flagNames);
                            subProperty->setValue(flagToInt(metaEnum, metaProperty.read(m_object).toInt()));
                        }
                    }
                    else {
                        subProperty = m_manager->addProperty(QtVariantPropertyManager::enumTypeId(), memberVarName);
                        QMetaEnum metaEnum = metaProperty.enumerator();
                        QMap<int, bool> valueMap; // dont show multiple enum values which have the same values
                        QStringList enumNames;
                        for (int i = 0; i < metaEnum.keyCount(); i++) {
                            int value = metaEnum.value(i);
                            if (!valueMap.contains(value)) {
                                valueMap[value] = true;
                                enumNames.append(QLatin1String(metaEnum.key(i)));
                            }
                        }
                        subProperty->setAttribute(QLatin1String("enumNames"), enumNames);
                        subProperty->setValue(enumToInt(metaEnum, metaProperty.read(m_object).toInt()));
                    }
                }
                else if (m_manager->isPropertyTypeSupported(type)) {
                    if (!metaProperty.isWritable())
                        subProperty = m_readOnlyManager->addProperty(type, memberVarName + QLatin1String(" (Non Writable)"));
                    if (!metaProperty.isDesignable())
                        subProperty = m_readOnlyManager->addProperty(type, memberVarName + QLatin1String(" (Non Designable)"));
                    else
                        subProperty = m_manager->addProperty(type, memberVarName);
                    subProperty->setValue(metaProperty.read(m_object));
                }
                else {
                    subProperty = m_readOnlyManager->addProperty(QVariant::String, memberVarName);
                    subProperty->setValue(QLatin1String("< Unknown Type >"));
                    b_SetEnabled = false;
                }


                // Notes: QtVariantProperty *priority = variantManager->addProperty(QVariant::Int, "Priority");	

                if (subProperty)
                    subProperty->setEnabled(b_SetEnabled);

                m_propertyToIndex[subProperty] = idx;
                m_classToIndexToProperty[metaObject][idx] = subProperty;
                if (subGroup)
                    classProperty->addSubProperty(subProperty);
                else
                    m_browser->addProperty(subProperty);
            }
        }
        else {
            updateClassProperties(metaObject, false);
        }

        m_topLevelProperties.append(classProperty);
        if (subGroup)
            m_browser->addProperty(classProperty);
    } // Loop i
}