From 32fce1e668c6b16a8429b4d72a6533c895d84f72 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Tue, 28 Jul 2020 08:58:41 +0200 Subject: [PATCH] Do not unnecessary specify a default capture for singleton registration lambdas A lambda can only be converted to a function pointer if it does not capture anything. Just specifying a default capture even if it does not capture anything, prevents this. In newer Qt this actually ended up calling the std::function (which is much heavier than function pointers) overload which was introduced only after Qt 5.12. --- src/declarativeimports/core/corebindingsplugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarativeimports/core/corebindingsplugin.cpp b/src/declarativeimports/core/corebindingsplugin.cpp index 60da1c60b..c03b08ebb 100644 --- a/src/declarativeimports/core/corebindingsplugin.cpp +++ b/src/declarativeimports/core/corebindingsplugin.cpp @@ -74,7 +74,7 @@ void CoreBindingsPlugin::registerTypes(const char *uri) Q_ASSERT(uri == QByteArray("org.kde.plasma.core")); qmlRegisterUncreatableType(uri, 2, 0, "Types", {}); - qmlRegisterSingletonType(uri, 2, 0, "Units", [=](QQmlEngine*, QJSEngine*) -> QObject* { return &Units::instance(); }); + qmlRegisterSingletonType(uri, 2, 0, "Units", [](QQmlEngine*, QJSEngine*) -> QObject* { return &Units::instance(); }); qmlRegisterType(uri, 2, 0, "Svg"); qmlRegisterType(uri, 2, 0, "FrameSvg"); @@ -82,7 +82,7 @@ void CoreBindingsPlugin::registerTypes(const char *uri) qmlRegisterType(uri, 2, 0, "FrameSvgItem"); //qmlRegisterType(uri, 2, 0, "Theme"); - qmlRegisterSingletonType(uri, 2, 0, "Theme", [=](QQmlEngine* engine, QJSEngine*) -> QObject* { return new Plasma::QuickTheme(engine); }); + qmlRegisterSingletonType(uri, 2, 0, "Theme", [](QQmlEngine* engine, QJSEngine*) -> QObject* { return new Plasma::QuickTheme(engine); }); qmlRegisterType(uri, 2, 0, "ColorScope"); qmlRegisterType(uri, 2, 0, "DataSource");