From 56bbf3c2d5b31142e5a1b872a0118479edcf874b Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Thu, 5 Sep 2013 14:36:04 +0200 Subject: QMetaMethod and QDBusMetaObject: Give public access to signal methods To be consistent with signals which are public since Qt5. Change-Id: I633077e37d0851b118c22da0681e8b8b1892ddbb Reviewed-by: Olivier Goffart --- src/corelib/kernel/qmetaobjectbuilder.cpp | 5 ++--- src/dbus/qdbusmetaobject.cpp | 2 +- src/tools/moc/moc.cpp | 2 +- .../corelib/kernel/qmetamethod/tst_qmetamethod.cpp | 24 +++++++++++----------- .../qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp | 4 ++-- tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 2 +- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/corelib/kernel/qmetaobjectbuilder.cpp b/src/corelib/kernel/qmetaobjectbuilder.cpp index 4c727f9d3d..ac57454169 100644 --- a/src/corelib/kernel/qmetaobjectbuilder.cpp +++ b/src/corelib/kernel/qmetaobjectbuilder.cpp @@ -510,7 +510,7 @@ QMetaMethodBuilder QMetaObjectBuilder::addSignal(const QByteArray& signature) { int index = d->methods.size(); d->methods.append(QMetaMethodBuilderPrivate - (QMetaMethod::Signal, signature, QByteArray("void"), QMetaMethod::Protected)); + (QMetaMethod::Signal, signature, QByteArray("void"), QMetaMethod::Public)); return QMetaMethodBuilder(this, index); } @@ -2005,8 +2005,7 @@ void QMetaMethodBuilder::setTag(const QByteArray& value) /*! Returns the access specification of this method (private, protected, or public). The default value is QMetaMethod::Public for methods, - slots, and constructors. The default value is QMetaMethod::Protected - for signals. + slots, signals and constructors. \sa setAccess() */ diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp index 127cf6658c..51c0b27668 100644 --- a/src/dbus/qdbusmetaobject.cpp +++ b/src/dbus/qdbusmetaobject.cpp @@ -348,7 +348,7 @@ void QDBusMetaObjectGenerator::parseSignals() prototype.append(')'); // meta method flags - mm.flags = AccessProtected | MethodSignal | MethodScriptable; + mm.flags = AccessPublic | MethodSignal | MethodScriptable; // add signals_.insert(QMetaObject::normalizedSignature(prototype), mm); diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index fd1d2155fc..648723ebc1 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -988,7 +988,7 @@ void Moc::parseSignals(ClassDef *def) prev(); } FunctionDef funcDef; - funcDef.access = FunctionDef::Protected; + funcDef.access = FunctionDef::Public; parseFunction(&funcDef); if (funcDef.isVirtual) warning("Signals cannot be declared virtual"); diff --git a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp index 98e90ed805..009b4fadda 100644 --- a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp +++ b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp @@ -205,7 +205,7 @@ void tst_QMetaMethod::method_data() << (QList()) << (QList()) << (QList()) - << QMetaMethod::Protected + << QMetaMethod::Public << QMetaMethod::Signal; QTest::newRow("voidInvokable") @@ -241,7 +241,7 @@ void tst_QMetaMethod::method_data() << QList() << QList() << QList() - << QMetaMethod::Protected + << QMetaMethod::Public << QMetaMethod::Signal; QTest::newRow("voidSignalInt") @@ -250,7 +250,7 @@ void tst_QMetaMethod::method_data() << (QList() << int(QMetaType::Int)) << (QList() << QByteArray("int")) << (QList() << QByteArray("voidSignalIntArg")) - << QMetaMethod::Protected + << QMetaMethod::Public << QMetaMethod::Signal; QTest::newRow("voidInvokableInt") @@ -286,7 +286,7 @@ void tst_QMetaMethod::method_data() << (QList() << qMetaTypeId()) << (QList() << QByteArray("qreal")) << (QList() << QByteArray("voidSignalQRealArg")) - << QMetaMethod::Protected + << QMetaMethod::Public << QMetaMethod::Signal; QTest::newRow("voidInvokableQReal") @@ -322,7 +322,7 @@ void tst_QMetaMethod::method_data() << (QList() << int(QMetaType::QString)) << (QList() << QByteArray("QString")) << (QList() << QByteArray("voidSignalQStringArg")) - << QMetaMethod::Protected + << QMetaMethod::Public << QMetaMethod::Signal; QTest::newRow("voidInvokableQString") @@ -358,7 +358,7 @@ void tst_QMetaMethod::method_data() << (QList() << qMetaTypeId()) << (QList() << QByteArray("CustomType")) << (QList() << QByteArray("voidSignalCustomTypeArg")) - << QMetaMethod::Protected + << QMetaMethod::Public << QMetaMethod::Signal; QTest::newRow("voidInvokableCustomType") @@ -394,7 +394,7 @@ void tst_QMetaMethod::method_data() << (QList() << 0) << (QList() << QByteArray("CustomUnregisteredType")) << (QList() << QByteArray("voidSignalCustomUnregisteredTypeArg")) - << QMetaMethod::Protected + << QMetaMethod::Public << QMetaMethod::Signal; QTest::newRow("voidInvokableCustomUnregisteredType") @@ -430,7 +430,7 @@ void tst_QMetaMethod::method_data() << (QList()) << (QList()) << (QList()) - << QMetaMethod::Protected + << QMetaMethod::Public << QMetaMethod::Signal; QTest::newRow("boolInvokable") @@ -457,7 +457,7 @@ void tst_QMetaMethod::method_data() << (QList()) << (QList()) << (QList()) - << QMetaMethod::Protected + << QMetaMethod::Public << QMetaMethod::Signal; QTest::newRow("qrealInvokable") @@ -484,7 +484,7 @@ void tst_QMetaMethod::method_data() << (QList()) << (QList()) << (QList()) - << QMetaMethod::Protected + << QMetaMethod::Public << QMetaMethod::Signal; QTest::newRow("qstringInvokable") @@ -529,7 +529,7 @@ void tst_QMetaMethod::method_data() "bool,int,uint,qlonglong,qulonglong,double,long,short,char,ulong,ushort,uchar,float)") << int(QMetaType::QVariant) << QByteArray("QVariant") << parameterTypes << parameterTypeNames << parameterNames - << QMetaMethod::Protected + << QMetaMethod::Public << QMetaMethod::Signal; QTest::newRow("qvariantInvokableBoolIntUIntLonglongULonglongDoubleLongShortCharUlongUshortUcharFloat") @@ -562,7 +562,7 @@ void tst_QMetaMethod::method_data() << (QList() << int(QMetaType::Bool) << int(QMetaType::Int)) << (QList() << QByteArray("bool") << QByteArray("int")) << (QList() << QByteArray("") << QByteArray("")) - << QMetaMethod::Protected + << QMetaMethod::Public << QMetaMethod::Signal; QTest::newRow("voidInvokableNoParameterNames") diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index 137ce56730..8f6bd50cca 100644 --- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -397,7 +397,7 @@ void tst_QMetaObjectBuilder::signal() QCOMPARE(method1.parameterTypes(), QList() << "QString" << "int"); QVERIFY(method1.parameterNames().isEmpty()); QVERIFY(method1.tag().isEmpty()); - QVERIFY(method1.access() == QMetaMethod::Protected); + QVERIFY(method1.access() == QMetaMethod::Public); QCOMPARE(method1.attributes(), 0); QCOMPARE(method1.index(), 0); QCOMPARE(builder.methodCount(), 1); @@ -410,7 +410,7 @@ void tst_QMetaObjectBuilder::signal() QCOMPARE(method2.parameterTypes(), QList() << "QString"); QVERIFY(method2.parameterNames().isEmpty()); QVERIFY(method2.tag().isEmpty()); - QVERIFY(method2.access() == QMetaMethod::Protected); + QVERIFY(method2.access() == QMetaMethod::Public); QCOMPARE(method2.attributes(), 0); QCOMPARE(method2.index(), 1); QCOMPARE(builder.methodCount(), 2); diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 8d1ea3b510..ff453d767b 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -2062,7 +2062,7 @@ void tst_QObject::metamethod() m = mobj->method(mobj->indexOfMethod("signal5()")); QVERIFY(m.methodSignature() == "signal5()"); QVERIFY(m.methodType() == QMetaMethod::Signal); - QVERIFY(m.access() == QMetaMethod::Protected); + QVERIFY(m.access() == QMetaMethod::Public); QVERIFY(!(m.attributes() & QMetaMethod::Scriptable)); QVERIFY((m.attributes() & QMetaMethod::Compatibility)); -- cgit v1.2.3