1 #ifndef QTMVVM_QUICKPRESENTER_H 2 #define QTMVVM_QUICKPRESENTER_H 4 #include <QtCore/qobject.h> 5 #include <QtCore/qscopedpointer.h> 6 #include <QtCore/qurl.h> 7 #include <QtCore/qmetaobject.h> 9 #include <QtMvvmCore/ipresenter.h> 10 #include <QtMvvmCore/serviceregistry.h> 12 #include "QtMvvmQuick/qtmvvmquick_global.h" 13 #include "QtMvvmQuick/inputviewfactory.h" 17 class QuickPresenterPrivate;
25 Q_PROPERTY(
InputViewFactory* inputViewFactory READ inputViewFactory WRITE setInputViewFactory NOTIFY inputViewFactoryChanged)
34 template <typename TPresenter>
35 static
void registerAsPresenter();
38 static
void addViewSearchDir(const
QString &dirPath);
40 template <typename TViewModel>
41 static
void registerViewExplicitly(const
QUrl &viewUrl);
43 static
void registerViewExplicitly(const
QMetaObject *viewModelType, const
QUrl &viewUrl);
52 virtual
bool presentToQml(
QObject *qmlPresenter,
QObject *viewObject);
63 void inputViewFactoryChanged(
InputViewFactory* inputViewFactory, QPrivateSignal);
69 virtual
int presentMethodIndex(const
QMetaObject *presenterMetaObject,
QObject *viewObject);
72 bool nameOrClassContains(const
QObject *obj, const
QString &contained,
Qt::CaseSensitivity caseSensitive =
Qt::CaseInsensitive) const;
75 friend class
QtMvvm::QuickPresenterPrivate;
79 template<typename TPresenter>
82 static_assert(std::is_base_of<QuickPresenter, TPresenter>::value,
"TPresenter must inherit QtMvvm::QuickPresenter!");
86 template<
typename TViewModel>
89 static_assert(std::is_base_of<ViewModel, TViewModel>::value,
"TViewModel must inherit ViewModel!");
90 registerViewExplicitly(&TViewModel::staticMetaObject, viewUrl);
96 #endif // QTMVVM_QUICKPRESENTER_H
A configuration for a simple dialog to be shown from the core code.
static void registerViewExplicitly(const QUrl &viewUrl)
Register a view for a viewmodel to be found by the presenter.
The interface for a GUI view presenter.
#define QTMVVM_INJECT(classType, name)
Mark a property for injection.
The base class for all viewmodels.
The IPresenter implementation for the quick module.
A result watcher to get the result once a dialog has finished.
The primary namespace of the QtMvvm library.
void registerInterface(DestructionScope scope=DestroyOnAppDestroy, bool weak=false)
Register a service for its interface via the type.
static ServiceRegistry * instance()
Returns the ServiceRegistry singleton instance.