summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qobjectdefs.h3
-rw-r--r--src/tools/moc/generator.cpp37
-rw-r--r--src/tools/moc/moc.cpp4
-rw-r--r--src/tools/moc/moc.h3
4 files changed, 38 insertions, 9 deletions
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index e840706021..ba348b5245 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -154,7 +154,8 @@ public: \
QT_TR_FUNCTIONS \
virtual int qt_metacall(QMetaObject::Call, int, void **); \
private: \
- Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);
+ Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \
+ struct QPrivateSignal {};
/* qmake ignore Q_OBJECT */
#define Q_OBJECT_FAKE Q_OBJECT
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index bcf70cbe91..09a4603753 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -540,7 +540,8 @@ void Generator::registerFunctionStrings(const QList<FunctionDef>& list)
strreg(f.normalizedType);
strreg(f.tag);
- for (int j = 0; j < f.arguments.count(); ++j) {
+ int argsCount = f.arguments.count() - (f.isPrivateSignal ? 1 : 0);
+ for (int j = 0; j < argsCount; ++j) {
const ArgumentDef &a = f.arguments.at(j);
if (!isBuiltinType(a.normalizedType))
strreg(a.normalizedType);
@@ -580,7 +581,7 @@ void Generator::generateFunctions(const QList<FunctionDef>& list, const char *fu
if (f.revision > 0)
flags |= MethodRevisioned;
- int argc = f.arguments.count();
+ int argc = f.arguments.count() - (f.isPrivateSignal ? 1 : 0);
fprintf(out, " %4d, %4d, %4d, %4d, 0x%02x,\n",
stridx(f.name), argc, paramsIndex, stridx(f.tag), flags);
@@ -608,7 +609,8 @@ void Generator::generateFunctionParameters(const QList<FunctionDef>& list, const
fprintf(out, " ");
// Types
- for (int j = -1; j < f.arguments.count(); ++j) {
+ int argsCount = f.arguments.count() - (f.isPrivateSignal ? 1 : 0);
+ for (int j = -1; j < argsCount; ++j) {
if (j > -1)
fputc(' ', out);
const QByteArray &typeName = (j < 0) ? f.normalizedType : f.arguments.at(j).normalizedType;
@@ -617,7 +619,7 @@ void Generator::generateFunctionParameters(const QList<FunctionDef>& list, const
}
// Parameter names
- for (int j = 0; j < f.arguments.count(); ++j) {
+ for (int j = 0; j < argsCount; ++j) {
const ArgumentDef &arg = f.arguments.at(j);
fprintf(out, " %4d,", stridx(arg.name));
}
@@ -1056,12 +1058,19 @@ void Generator::generateStaticMetacall()
cdef->classname.constData(), cdef->classname.constData());
const FunctionDef &f = cdef->constructorList.at(ctorindex);
int offset = 1;
- for (int j = 0; j < f.arguments.count(); ++j) {
+
+ int argsCount = f.arguments.count() - (f.isPrivateSignal ? 1 : 0);
+ for (int j = 0; j < argsCount; ++j) {
const ArgumentDef &a = f.arguments.at(j);
if (j)
fprintf(out, ",");
fprintf(out, "(*reinterpret_cast< %s>(_a[%d]))", a.typeNameForCast.constData(), offset++);
}
+ if (f.isPrivateSignal) {
+ if (argsCount > 0)
+ fprintf(out, ", ");
+ fprintf(out, "%s", QByteArray(f.arguments.last().normalizedType + "()").constData());
+ }
fprintf(out, ");\n");
fprintf(out, " if (_a[0]) *reinterpret_cast<QObject**>(_a[0]) = _r; } break;\n");
}
@@ -1098,13 +1107,20 @@ void Generator::generateStaticMetacall()
fprintf(out, "%s->", f.inPrivateClass.constData());
fprintf(out, "%s(", f.name.constData());
int offset = 1;
- for (int j = 0; j < f.arguments.count(); ++j) {
+
+ int argsCount = f.arguments.count() - (f.isPrivateSignal ? 1 : 0);
+ for (int j = 0; j < argsCount; ++j) {
const ArgumentDef &a = f.arguments.at(j);
if (j)
fprintf(out, ",");
fprintf(out, "(*reinterpret_cast< %s>(_a[%d]))",a.typeNameForCast.constData(), offset++);
isUsed_a = true;
}
+ if (f.isPrivateSignal) {
+ if (argsCount > 0)
+ fprintf(out, ", ");
+ fprintf(out, "%s", QByteArray(f.arguments.last().normalizedType + "()").constData());
+ }
fprintf(out, ");");
if (f.normalizedType != "void") {
fprintf(out, "\n if (_a[0]) *reinterpret_cast< %s*>(_a[0]) = _r; } ",
@@ -1131,12 +1147,19 @@ void Generator::generateStaticMetacall()
anythingUsed = true;
fprintf(out, " {\n");
fprintf(out, " typedef %s (%s::*_t)(",f.type.rawName.constData() , cdef->classname.constData());
- for (int j = 0; j < f.arguments.count(); ++j) {
+
+ int argsCount = f.arguments.count() - (f.isPrivateSignal ? 1 : 0);
+ for (int j = 0; j < argsCount; ++j) {
const ArgumentDef &a = f.arguments.at(j);
if (j)
fprintf(out, ", ");
fprintf(out, "%s", QByteArray(a.type.name + ' ' + a.rightType).constData());
}
+ if (f.isPrivateSignal) {
+ if (argsCount > 0)
+ fprintf(out, ", ");
+ fprintf(out, "%s", f.arguments.last().normalizedType.constData());
+ }
if (f.isConst)
fprintf(out, ") const;\n");
else
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index c35f27deaf..0caa124e79 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -309,6 +309,10 @@ void Moc::parseFunctionArguments(FunctionDef *def)
if (!until(COMMA))
break;
}
+
+ if (!def->arguments.isEmpty()
+ && def->arguments.last().normalizedType == "QPrivateSignal")
+ def->isPrivateSignal = true;
}
bool Moc::testFunctionAttribute(FunctionDef *def)
diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h
index e20e29acb8..66cc942a9f 100644
--- a/src/tools/moc/moc.h
+++ b/src/tools/moc/moc.h
@@ -92,7 +92,7 @@ struct FunctionDef
{
FunctionDef(): returnTypeIsVolatile(false), access(Private), isConst(false), isVirtual(false), isStatic(false),
inlineCode(false), wasCloned(false), isCompat(false), isInvokable(false),
- isScriptable(false), isSlot(false), isSignal(false),
+ isScriptable(false), isSlot(false), isSignal(false), isPrivateSignal(false),
isConstructor(false), isDestructor(false), isAbstract(false), revision(0) {}
Type type;
QByteArray normalizedType;
@@ -116,6 +116,7 @@ struct FunctionDef
bool isScriptable;
bool isSlot;
bool isSignal;
+ bool isPrivateSignal;
bool isConstructor;
bool isDestructor;
bool isAbstract;