Skip to content

Commit

Permalink
moc: move the qt_static_metacall below the staticMetaObject
Browse files Browse the repository at this point in the history
Just so we have data structures and functions grouped together.

Pick-to: 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16fa171f6e1caf2b
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Friedemann Kleint <[email protected]>
  • Loading branch information
thiagomacieira committed Jun 28, 2022
1 parent 3335b54 commit 9af5983
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/tools/moc/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ void Generator::generateCode()
registerPropertyStrings();
registerEnumStrings();

const bool hasStaticMetaCall =
(cdef->hasQObject || !cdef->methodList.isEmpty()
|| !cdef->propertyList.isEmpty() || !cdef->constructorList.isEmpty());

QByteArray qualifiedClassNameIdentifier = cdef->qualified;
qualifiedClassNameIdentifier.replace(':', '_');

Expand Down Expand Up @@ -409,15 +413,6 @@ void Generator::generateCode()
//
fprintf(out, "\n 0 // eod\n};\n\n");

//
// Generate internal qt_static_metacall() function
//
const bool hasStaticMetaCall =
(cdef->hasQObject || !cdef->methodList.isEmpty()
|| !cdef->propertyList.isEmpty() || !cdef->constructorList.isEmpty());
if (hasStaticMetaCall)
generateStaticMetacall();

//
// Build extra array
//
Expand Down Expand Up @@ -578,6 +573,12 @@ void Generator::generateCode()

fprintf(out, " nullptr\n} };\n\n");

//
// Generate internal qt_static_metacall() function
//
if (hasStaticMetaCall)
generateStaticMetacall();

if (!cdef->hasQObject)
return;

Expand Down Expand Up @@ -1403,7 +1404,7 @@ void Generator::generateStaticMetacall()
if (!isUsed_a)
fprintf(out, " (void)_a;\n");

fprintf(out, "}\n\n");
fprintf(out, "}\n");
}

void Generator::generateSignal(FunctionDef *def,int index)
Expand Down

0 comments on commit 9af5983

Please sign in to comment.