diff options
Diffstat (limited to 'generator.cpp')
-rw-r--r-- | generator.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/generator.cpp b/generator.cpp index 3c0b2ec15..0f56b450e 100644 --- a/generator.cpp +++ b/generator.cpp @@ -294,10 +294,16 @@ QString Generator::translateType(const AbstractMetaType *cType, s = cType->cppSignature(); } else { s = cType->cppSignature(); - if (cType->isConstant() && (options & Generator::ExcludeConst)) - s.replace("const", ""); - if (cType->isReference() && (options & Generator::ExcludeReference)) - s.replace("&", ""); + if (cType->isConstant() && (options & Generator::ExcludeConst)) { + // Remove just the first ‘const’, avoiding removal of template attr. + int pos = s.indexOf("const"); + s.remove(pos, 5); //remove strlen(const) + } + if (cType->isReference() && (options & Generator::ExcludeReference)) { + // Remove just the first ‘&’, avoiding removal of template references. + int pos = s.indexOf("&"); + s.remove(pos, 1); //remove strlen(const) + } } return s; |