Skip to content

Commit b2bff4d

Browse files
florianlinkmsmolens
florianlink
authored andcommitted
removed generating wrappers for virtual functions that are already declared in a base class
git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@403 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
1 parent 1e8ea80 commit b2bff4d

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

generator/shellgenerator.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,18 @@ bool ShellGenerator::functionHasNonConstReferences(const AbstractMetaFunction* f
297297
return false;
298298
}
299299

300+
bool ShellGenerator::functionNeedsNormalWrapperSlot(const AbstractMetaFunction* func, const AbstractMetaClass* currentClass)
301+
{
302+
if (func->isSlot()) {
303+
return false;
304+
}
305+
else if (func->isVirtual()) {
306+
return func->declaringClass() == currentClass;
307+
} else {
308+
return true;
309+
}
310+
}
311+
300312
AbstractMetaFunctionList ShellGenerator::getFunctionsToWrap(const AbstractMetaClass* meta_class)
301313
{
302314
AbstractMetaFunctionList functions = meta_class->queryFunctions(

generator/shellgenerator.h

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ class ShellGenerator : public Generator
7777

7878
bool functionHasNonConstReferences(const AbstractMetaFunction* func);
7979

80+
bool functionNeedsNormalWrapperSlot(const AbstractMetaFunction* func, const AbstractMetaClass* currentClass);
81+
8082
static QString shellClassName(const AbstractMetaClass *meta_class) {
8183
return "PythonQtShell_" + meta_class->name();
8284
}

generator/shellheadergenerator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ void ShellHeaderGenerator::write(QTextStream &s, const AbstractMetaClass *meta_c
352352
AbstractMetaFunctionList functions = getFunctionsToWrap(meta_class);
353353

354354
foreach (const AbstractMetaFunction *function, functions) {
355-
if (!function->isSlot()) {
355+
if (functionNeedsNormalWrapperSlot(function, meta_class)) {
356356
// for debugging:
357357
//functionHasNonConstReferences(function);
358358
s << " ";

generator/shellimplgenerator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ void ShellImplGenerator::write(QTextStream &s, const AbstractMetaClass *meta_cla
248248
// write member functions
249249
for (int i = 0; i < functions.size(); ++i) {
250250
AbstractMetaFunction *fun = functions.at(i);
251-
bool needsWrapping = !fun->isSlot();
251+
bool needsWrapping = functionNeedsNormalWrapperSlot(fun, meta_class);
252252
if (!needsWrapping) {
253253
continue;
254254
}

0 commit comments

Comments
 (0)