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.
This commit is contained in:
parent
e781341ee0
commit
32fce1e668
@ -74,7 +74,7 @@ void CoreBindingsPlugin::registerTypes(const char *uri)
|
||||
Q_ASSERT(uri == QByteArray("org.kde.plasma.core"));
|
||||
|
||||
qmlRegisterUncreatableType<Plasma::Types>(uri, 2, 0, "Types", {});
|
||||
qmlRegisterSingletonType<Units>(uri, 2, 0, "Units", [=](QQmlEngine*, QJSEngine*) -> QObject* { return &Units::instance(); });
|
||||
qmlRegisterSingletonType<Units>(uri, 2, 0, "Units", [](QQmlEngine*, QJSEngine*) -> QObject* { return &Units::instance(); });
|
||||
|
||||
qmlRegisterType<Plasma::Svg>(uri, 2, 0, "Svg");
|
||||
qmlRegisterType<Plasma::FrameSvg>(uri, 2, 0, "FrameSvg");
|
||||
@ -82,7 +82,7 @@ void CoreBindingsPlugin::registerTypes(const char *uri)
|
||||
qmlRegisterType<Plasma::FrameSvgItem>(uri, 2, 0, "FrameSvgItem");
|
||||
|
||||
//qmlRegisterType<ThemeProxy>(uri, 2, 0, "Theme");
|
||||
qmlRegisterSingletonType<Plasma::QuickTheme>(uri, 2, 0, "Theme", [=](QQmlEngine* engine, QJSEngine*) -> QObject* { return new Plasma::QuickTheme(engine); });
|
||||
qmlRegisterSingletonType<Plasma::QuickTheme>(uri, 2, 0, "Theme", [](QQmlEngine* engine, QJSEngine*) -> QObject* { return new Plasma::QuickTheme(engine); });
|
||||
qmlRegisterType<ColorScope>(uri, 2, 0, "ColorScope");
|
||||
|
||||
qmlRegisterType<Plasma::DataSource>(uri, 2, 0, "DataSource");
|
||||
|
Loading…
Reference in New Issue
Block a user