1 #ifndef QTMVVM_COREAPP_H 2 #define QTMVVM_COREAPP_H 6 #include <QtCore/qobject.h> 7 #include <QtCore/qscopedpointer.h> 8 #include <QtCore/qcoreapplication.h> 11 #include "QtMvvmCore/qtmvvmcore_global.h" 12 #include "QtMvvmCore/viewmodel.h" 13 #include "QtMvvmCore/ipresenter.h" 14 #include "QtMvvmCore/message.h" 32 static void disableAutoBoot();
38 template <
typename TViewModel>
39 static inline void show(
const QVariantHash ¶ms = {});
41 static void show(
const char *viewModelName,
const QVariantHash ¶ms = {});
43 static void show(
const QMetaObject *viewModelMetaObject,
const QVariantHash ¶ms = {});
54 void appStarted(QPrivateSignal);
58 virtual void performRegistrations();
60 virtual int startApp(
const QStringList &arguments) = 0;
62 virtual void closeApp();
68 friend class QtMvvm::CoreAppPrivate;
71 static void showImp(
const QMetaObject *metaObject,
const QVariantHash ¶ms);
74 template<
typename TViewModel>
77 static_assert(std::is_base_of<ViewModel, TViewModel>::value,
"TViewModel must extend QtMvvm::ViewModel");
78 ViewModel::showImp(&TViewModel::staticMetaObject, params,
nullptr);
84 #define QTMVVM_REGISTER_CORE_APP(T) \ 85 static void _setup_ ## T ## _hook() { \ 86 static_assert(std::is_base_of<QtMvvm::CoreApp, T>::value, "QTMVVM_REGISTER_CORE_APP must be used with a class that extends QtMvvm::CoreApp"); \ 87 auto app = new T(nullptr); \ 90 Q_COREAPP_STARTUP_FUNCTION(_setup_ ## T ## _hook) 93 #define coreApp QtMvvm::CoreApp::instance() 96 #endif // QTMVVM_COREAPP_H
static void show(const QVariantHash ¶ms={})
Show a new ViewModel by its type.
A configuration for a simple dialog to be shown from the core code.
A logicaly application object to drive the mvvm application from the core part.
A result watcher to get the result once a dialog has finished.
The primary namespace of the QtMvvm library.