Skip to content
This repository was archived by the owner on Mar 4, 2023. It is now read-only.

Commit a60dfd4

Browse files
committed
extend service registry with inject and construct
also completed registry doc
1 parent dd9c495 commit a60dfd4

File tree

13 files changed

+628
-72
lines changed

13 files changed

+628
-72
lines changed

doc/Doxyfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,9 @@ EXCLUDE_PATTERNS = moc_* \
925925
# Note that the wildcards are matched against the file with absolute path, so to
926926
# exclude all test directories use the pattern */test/*
927927

928-
EXCLUDE_SYMBOLS = QAbstractAspect \
928+
EXCLUDE_SYMBOLS = QtMvvm::__helpertypes \
929+
\
930+
QAbstractAspect \
929931
QBasicAtomicInteger \
930932
QBasicAtomicPointer \
931933
QBasicMutex \
@@ -1352,7 +1354,7 @@ GENERATE_HTMLHELP = NO
13521354
# written to the html output directory.
13531355
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
13541356

1355-
CHM_FILE =
1357+
CHM_FILE =
13561358

13571359
# The HHC_LOCATION tag can be used to specify the location (absolute path
13581360
# including file name) of the HTML help compiler (hhc.exe). If non-empty,

doc/injection.dox

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*!
2+
@def QTMVVM_INJECT
3+
4+
@param classType The type of the property to be injected
5+
@param name The name of the property to be injected
6+
7+
This macro creates an additional property that is detected by the QtMvvm::ServiceRegistry and
8+
contains the information needed to inject the property automatically. For more details on
9+
the property injection, see QtMvvm::ServiceRegistry
10+
11+
Sample code for usage:
12+
@code{.cpp}
13+
class MyClass : public QObject
14+
{
15+
Q_OBJECT
16+
17+
Q_PROPERTY(IService* service READ service WRITE setService)
18+
QTMVVM_INJECT(IService*, service)
19+
20+
public:
21+
//...
22+
}
23+
@endcode
24+
25+
@note All properties that make use of interfaces must register the interfaces via
26+
QtMvvm::registerInterfaceConverter
27+
28+
@sa #QTMVVM_INJECT_PROP, QtMvvm::registerInterfaceConverter, QtMvvm::ServiceRegistry
29+
*/
30+
31+
/*!
32+
@def QTMVVM_INJECT_PROP
33+
34+
@param type The type of the property to be created
35+
@param name The name of the property to be created
36+
@param member The name of the member variable to use for the property
37+
38+
This macro is a shortcut for #QTMVVM_INJECT to create a property and mark it for injection in
39+
one step. The property is created by using a member variable. This means it will have no public
40+
member functions to access the property, only the property accessors itself.
41+
42+
Sample code for usage:
43+
@code{.cpp}
44+
class MyClass : public QObject
45+
{
46+
Q_OBJECT
47+
48+
QTMVVM_INJECT_PROP(IService*, service, _service)
49+
50+
public:
51+
//...
52+
53+
private:
54+
IService* _service;
55+
}
56+
@endcode
57+
58+
@note All properties that make use of interfaces must register the interfaces via
59+
QtMvvm::registerInterfaceConverter
60+
61+
@sa #QTMVVM_INJECT, QtMvvm::registerInterfaceConverter, QtMvvm::ServiceRegistry
62+
*/

0 commit comments

Comments
 (0)