A header with injection related code. More...
#include "qtmvvmcore_global.h"
Go to the source code of this file.
Namespaces | |
QtMvvm | |
The primary namespace of the QtMvvm library. | |
Macros | |
#define | QTMVVM_INJECT(classType, name) |
Mark a property for injection. More... | |
#define | QTMVVM_INJECT_PROP(type, name, member) |
Create a for injection marked property based on a member. More... | |
Functions | |
template<typename TInterface > | |
void | QtMvvm::registerInterfaceConverter () |
Registers QVariant converters from QObject to an interface type registered with Q_DECLARE_INTERFACE. | |
A header with injection related code.
Definition in file injection.h.
#define QTMVVM_INJECT | ( | classType, | |
name | |||
) |
Mark a property for injection.
classType | The type of the property to be injected |
name | The name of the property to be injected |
This macro creates an additional property that is detected by the QtMvvm::ServiceRegistry and contains the information needed to inject the property automatically. For more details on the property injection, see QtMvvm::ServiceRegistry
Sample code for usage:
#define QTMVVM_INJECT_PROP | ( | type, | |
name, | |||
member | |||
) |
Create a for injection marked property based on a member.
type | The type of the property to be created |
name | The name of the property to be created |
member | The name of the member variable to use for the property |
This macro is a shortcut for QTMVVM_INJECT to create a property and mark it for injection in one step. The property is created by using a member variable. This means it will have no public member functions to access the property, only the property accessors itself.
Sample code for usage: