qmlplugindump: Don't dump implicit signals.
Every property automatically has a xyzChanged signal anyway. Change-Id: I470875a94792c0fc5a6378c8be1e0eddc24a1d5a Reviewed-on: http://codereview.qt-project.org/6144 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
parent
121c32b54a
commit
a6393f953e
|
@ -306,11 +306,15 @@ public:
|
||||||
for (int index = meta->enumeratorOffset(); index < meta->enumeratorCount(); ++index)
|
for (int index = meta->enumeratorOffset(); index < meta->enumeratorCount(); ++index)
|
||||||
dump(meta->enumerator(index));
|
dump(meta->enumerator(index));
|
||||||
|
|
||||||
for (int index = meta->propertyOffset(); index < meta->propertyCount(); ++index)
|
QSet<QString> implicitSignals;
|
||||||
dump(meta->property(index));
|
for (int index = meta->propertyOffset(); index < meta->propertyCount(); ++index) {
|
||||||
|
const QMetaProperty &property = meta->property(index);
|
||||||
|
dump(property);
|
||||||
|
implicitSignals.insert(QString("%1Changed").arg(QString::fromUtf8(property.name())));
|
||||||
|
}
|
||||||
|
|
||||||
for (int index = meta->methodOffset(); index < meta->methodCount(); ++index)
|
for (int index = meta->methodOffset(); index < meta->methodCount(); ++index)
|
||||||
dump(meta->method(index));
|
dump(meta->method(index), implicitSignals);
|
||||||
|
|
||||||
qml->writeEndObject();
|
qml->writeEndObject();
|
||||||
}
|
}
|
||||||
|
@ -378,7 +382,7 @@ private:
|
||||||
qml->writeEndObject();
|
qml->writeEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump(const QMetaMethod &meth)
|
void dump(const QMetaMethod &meth, const QSet<QString> &implicitSignals)
|
||||||
{
|
{
|
||||||
if (meth.methodType() == QMetaMethod::Signal) {
|
if (meth.methodType() == QMetaMethod::Signal) {
|
||||||
if (meth.access() != QMetaMethod::Protected)
|
if (meth.access() != QMetaMethod::Protected)
|
||||||
|
@ -393,6 +397,16 @@ private:
|
||||||
return; // invalid signature
|
return; // invalid signature
|
||||||
}
|
}
|
||||||
name = name.left(lparenIndex);
|
name = name.left(lparenIndex);
|
||||||
|
const QString typeName = convertToId(meth.typeName());
|
||||||
|
|
||||||
|
if (implicitSignals.contains(name)
|
||||||
|
&& !meth.revision()
|
||||||
|
&& meth.methodType() == QMetaMethod::Signal
|
||||||
|
&& meth.parameterNames().isEmpty()
|
||||||
|
&& typeName.isEmpty()) {
|
||||||
|
// don't mention implicit signals
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (meth.methodType() == QMetaMethod::Signal)
|
if (meth.methodType() == QMetaMethod::Signal)
|
||||||
qml->writeStartObject(QLatin1String("Signal"));
|
qml->writeStartObject(QLatin1String("Signal"));
|
||||||
|
@ -406,7 +420,6 @@ private:
|
||||||
qml->writeScriptBinding(QLatin1String("revision"), QString::number(revision));
|
qml->writeScriptBinding(QLatin1String("revision"), QString::number(revision));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const QString typeName = convertToId(meth.typeName());
|
|
||||||
if (! typeName.isEmpty())
|
if (! typeName.isEmpty())
|
||||||
qml->writeScriptBinding(QLatin1String("type"), enquote(typeName));
|
qml->writeScriptBinding(QLatin1String("type"), enquote(typeName));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue