diff --git a/autotests/kconfig_compiler/test8a.h.ref b/autotests/kconfig_compiler/test8a.h.ref --- a/autotests/kconfig_compiler/test8a.h.ref +++ b/autotests/kconfig_compiler/test8a.h.ref @@ -12,7 +12,7 @@ { public: - Test8a( KSharedConfig::Ptr config = KSharedConfig::openConfig(), QObject *parent = nullptr ); + Test8a( const KSharedConfig::Ptr &config = KSharedConfig::openConfig(), QObject *parent = nullptr ); ~Test8a(); /** diff --git a/autotests/kconfig_compiler/test8a.cpp.ref b/autotests/kconfig_compiler/test8a.cpp.ref --- a/autotests/kconfig_compiler/test8a.cpp.ref +++ b/autotests/kconfig_compiler/test8a.cpp.ref @@ -3,7 +3,7 @@ #include "test8a.h" -Test8a::Test8a( KSharedConfig::Ptr config, QObject *parent ) +Test8a::Test8a( const KSharedConfig::Ptr &config, QObject *parent ) : KConfigSkeleton( config ) { setParent(parent); diff --git a/autotests/kconfig_compiler/test8c.h.ref b/autotests/kconfig_compiler/test8c.h.ref --- a/autotests/kconfig_compiler/test8c.h.ref +++ b/autotests/kconfig_compiler/test8c.h.ref @@ -13,7 +13,7 @@ static Test8c *self(); static void instance(const QString& cfgfilename); - static void instance(KSharedConfig::Ptr config); + static void instance(const KSharedConfig::Ptr &config); ~Test8c(); /** @@ -55,7 +55,7 @@ } protected: - Test8c(KSharedConfig::Ptr config, QObject *parent = nullptr); + Test8c(const KSharedConfig::Ptr &config, QObject *parent = nullptr); friend class Test8cHelper; diff --git a/autotests/kconfig_compiler/test8c.cpp.ref b/autotests/kconfig_compiler/test8c.cpp.ref --- a/autotests/kconfig_compiler/test8c.cpp.ref +++ b/autotests/kconfig_compiler/test8c.cpp.ref @@ -35,7 +35,7 @@ s_globalTest8c()->q->read(); } -void Test8c::instance(KSharedConfig::Ptr config) +void Test8c::instance(const KSharedConfig::Ptr & config) { if (s_globalTest8c()->q) { qDebug() << "Test8c::instance called after the first use - ignoring"; @@ -45,7 +45,7 @@ s_globalTest8c()->q->read(); } -Test8c::Test8c( KSharedConfig::Ptr config, QObject *parent ) +Test8c::Test8c( const KSharedConfig::Ptr &config, QObject *parent ) : KConfigSkeleton( config ) { setParent(parent); diff --git a/src/kconfig_compiler/kconfig_compiler.cpp b/src/kconfig_compiler/kconfig_compiler.cpp --- a/src/kconfig_compiler/kconfig_compiler.cpp +++ b/src/kconfig_compiler/kconfig_compiler.cpp @@ -1887,7 +1887,7 @@ h << " const QString &cfgfilename" << (parameters.isEmpty() ? " = QString()" : ", "); else - h << " KSharedConfig::Ptr config" + h << " const KSharedConfig::Ptr &config" << (parameters.isEmpty() ? " = KSharedConfig::openConfig()" : ", "); } for (QList::ConstIterator it = parameters.constBegin(); @@ -1908,7 +1908,7 @@ h << " static " << cfg.className << " *self();" << endl; if (cfgFileNameArg) { h << " static void instance(const QString& cfgfilename);" << endl; - h << " static void instance(KSharedConfig::Ptr config);" << endl; + h << " static void instance(const KSharedConfig::Ptr &config);" << endl; } } @@ -2131,7 +2131,7 @@ if (cfg.singleton) { h << " " << cfg.className << "("; if (cfgFileNameArg) { - h << "KSharedConfig::Ptr config"; + h << "const KSharedConfig::Ptr &config"; } if (cfg.parentInConstructor) { if (cfgFileNameArg) { @@ -2362,7 +2362,7 @@ cpp << "}" << endl << endl; }; instance(QStringLiteral("const QString&"), QStringLiteral("cfgfilename"), true); - instance(QStringLiteral("KSharedConfig::Ptr"), QStringLiteral("config"), false); + instance(QStringLiteral("const KSharedConfig::Ptr &"), QStringLiteral("config"), false); } } @@ -2374,7 +2374,7 @@ cpp << cfg.className << "::" << cfg.className << "("; if (cfgFileNameArg) { if (! cfg.forceStringFilename) { - cpp << " KSharedConfig::Ptr config"; + cpp << " const KSharedConfig::Ptr &config"; } else { cpp << " const QString& config"; }