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);
49 virtual
bool presentToQml(
QObject *qmlPresenter,
QObject *viewObject);
60 void inputViewFactoryChanged(
InputViewFactory* inputViewFactory, QPrivateSignal);
66 virtual
int presentMethodIndex(const
QMetaObject *presenterMetaObject,
QObject *viewObject);
69 bool nameOrClassContains(const
QObject *obj, const
QString &contained,
Qt::CaseSensitivity caseSensitive =
Qt::CaseInsensitive) const;
72 friend class
QtMvvm::QuickPresenterPrivate;
76 template<typename TPresenter>
79 static_assert(std::is_base_of<QuickPresenter, TPresenter>::value,
"TPresenter must inherit QtMvvm::QuickPresenter!");
83 template<
typename TViewModel>
86 static_assert(std::is_base_of<ViewModel, TViewModel>::value,
"TViewModel must inherit ViewModel!");
87 registerViewExplicitly(&TViewModel::staticMetaObject, viewUrl);
93 #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(bool weak=false)
Register a service for its interface via the type.
static ServiceRegistry * instance()
Returns the ServiceRegistry singleton instance.