From e12197e2822a8cca0022d0843057548246930c16 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Sun, 21 Nov 2010 18:08:46 -0300 Subject: Fix generated property flags on metaobject. Fixes bug #478 Reviewer: Luciano Wolf Marcelo Lira --- libpyside/dynamicqmetaobject.cpp | 47 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'libpyside/dynamicqmetaobject.cpp') diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp index 14fbe864e..43aeae66d 100644 --- a/libpyside/dynamicqmetaobject.cpp +++ b/libpyside/dynamicqmetaobject.cpp @@ -132,7 +132,6 @@ static bool isQRealType(const char *type) } - /* * Avoid API break keep this on cpp */ @@ -164,25 +163,31 @@ uint PropertyData::flags() const if (PySide::Property::hasReset(m_data)) flags |= Resettable; - if (!PySide::Property::isDesignable(m_data)) - flags |= ResolveDesignable; - else + if (PySide::Property::isDesignable(m_data)) flags |= Designable; - - if (!PySide::Property::isScriptable(m_data)) - flags |= ResolveScriptable; else - flags |= Scriptable; + flags |= ResolveDesignable; - if (!PySide::Property::isStored(m_data)) - flags |= ResolveStored; + if (PySide::Property::isScriptable(m_data)) + flags |= Scriptable; else - flags |= Stored; + flags |= ResolveScriptable; - if (!PySide::Property::isUser(m_data)) - flags |= ResolveUser; + if (PySide::Property::isStored(m_data)) + flags |= Stored; else + flags |= ResolveStored; + + //EDITABLE + flags |= ResolveEditable; + + if (PySide::Property::isUser(m_data)) flags |= User; + else + flags |= ResolveUser; + + if (m_notifyId != -1) + flags |= Notify; if (PySide::Property::isConstant(m_data)) flags |= Constant; @@ -190,9 +195,6 @@ uint PropertyData::flags() const if (PySide::Property::isFinal(m_data)) flags |= Final; - if (m_notifyId) - flags |= Notify; - return flags; } @@ -247,7 +249,7 @@ PropertyData::PropertyData() { } -PropertyData::PropertyData(const char* name, uint notifyId, PySideProperty* data) +PropertyData::PropertyData(const char* name, int notifyId, PySideProperty* data) : m_name(name), m_notifyId(notifyId), m_data(data) { } @@ -268,7 +270,7 @@ QByteArray PropertyData::name() const return m_name; } -uint PropertyData::notifyId() const +int PropertyData::notifyId() const { return m_notifyId; } @@ -370,10 +372,10 @@ void DynamicQMetaObject::addProperty(const char* propertyName, PyObject* data) // retrieve notifyId PySideProperty* property = reinterpret_cast(data); const char* signalNotify = PySide::Property::getNotifyName(property); - uint notifyId = 0; + int notifyId = -1; if (signalNotify) { QByteArray signalSignature(signalNotify); - notifyId = m_d->m_signals.indexOf(signalNotify) + 1; + notifyId = m_d->m_signals.indexOf(signalNotify); } //search for a empty space @@ -553,9 +555,8 @@ void DynamicQMetaObject::DynamicQMetaObjectPrivate::updateMetaObject(QMetaObject } //write properties notify - foreach(PropertyData pp, m_properties) { - data[index++] = pp.notifyId(); //signal notify index - } + foreach(PropertyData pp, m_properties) + data[index++] = pp.notifyId() >= 0 ? pp.notifyId() : 0; //signal notify index data[index++] = 0; // the end -- cgit v1.2.3