QtMvvm  1.0.0
A mvvm oriented library for Qt, to create Projects for Widgets and Quick in parallel
injection.h
Go to the documentation of this file.
1 #ifndef QTMVVM_INJECTION_H
2 #define QTMVVM_INJECTION_H
3 
4 #include "qtmvvmcore_global.h"
5 
7 namespace QtMvvm {
8 
10 template <typename TInterface>
12  QMetaType::registerConverter<QObject*, TInterface*>([](QObject *o) {
13  return qobject_cast<TInterface*>(o);
14  });
15 }
16 
17 }
18 
20 #define QTMVVM_INJECT(classType, name) \
21  static inline QByteArray __qtmvvm_inject_##name() { \
22  return QtMvvm::__helpertypes::inject_iid<classType>(); \
23  } \
24  Q_PROPERTY(QByteArray __qtmvvm_inject_##name READ __qtmvvm_inject_##name STORED false SCRIPTABLE false DESIGNABLE false CONSTANT FINAL)
25 
27 #define QTMVVM_INJECT_PROP(type, name, member) \
28  Q_PROPERTY(type name MEMBER member) \
29  QTMVVM_INJECT(type, name)
30 
32 #endif // INJECTION_H
void registerInterfaceConverter()
Registers QVariant converters from QObject to an interface type registered with Q_DECLARE_INTERFACE.
Definition: injection.h:11
The primary namespace of the QtMvvm library.
Definition: binding.h:10