Changeset View
Changeset View
Standalone View
Standalone View
lib/qml/qmlplugins.cpp
Show All 19 Lines | |||||
20 | * | 20 | * | ||
21 | */ | 21 | */ | ||
22 | 22 | | |||
23 | #include "qmlplugins.h" | 23 | #include "qmlplugins.h" | ||
24 | 24 | | |||
25 | #include "sourcesmodel.h" | 25 | #include "sourcesmodel.h" | ||
26 | #include "preview.h" | 26 | #include "preview.h" | ||
27 | #include "draghelper.h" | 27 | #include "draghelper.h" | ||
28 | #include "mousehelper.h" | ||||
28 | 29 | | |||
29 | #include <QtQml/qqml.h> | 30 | #include <QtQml/qqml.h> | ||
30 | 31 | | |||
31 | void QmlPlugins::initializeEngine(QQmlEngine *, const char *) | 32 | void QmlPlugins::initializeEngine(QQmlEngine *, const char *) | ||
32 | { | 33 | { | ||
33 | } | 34 | } | ||
34 | 35 | | |||
35 | void QmlPlugins::registerTypes(const char *uri) | 36 | void QmlPlugins::registerTypes(const char *uri) | ||
36 | { | 37 | { | ||
37 | qmlRegisterType<Milou::SourcesModel> (uri, 0, 1, "SourcesModel"); | 38 | qmlRegisterType<Milou::SourcesModel> (uri, 0, 1, "SourcesModel"); | ||
38 | qmlRegisterType<Milou::Preview> (uri, 0, 1, "Preview"); | 39 | qmlRegisterType<Milou::Preview> (uri, 0, 1, "Preview"); | ||
39 | qmlRegisterType<Milou::DragHelper> (uri, 0, 2, "DragHelper"); | 40 | qmlRegisterType<Milou::DragHelper> (uri, 0, 2, "DragHelper"); | ||
41 | qmlRegisterSingletonType<Milou::MouseHelper> (uri, 0, 1, "MouseHelper", | ||||
davidedmundson: May as well register a singleton, it doesn't have a state.
Instead of having one object… | |||||
42 | [](QQmlEngine*, QJSEngine*) -> QObject* { | ||||
43 | return new Milou::MouseHelper(); | ||||
44 | }); | ||||
40 | } | 45 | } | ||
41 | 46 | |
May as well register a singleton, it doesn't have a state.
Instead of having one object created per delegate, we just one have object.