|
Q_INVOKABLE | WidgetsPresenter (QObject *parent=nullptr) |
| Invokable constructor.
|
|
void | present (ViewModel *viewModel, const QVariantHash ¶ms, QPointer< ViewModel > parent) override |
| Called to present a viewmodel. More...
|
|
void | showDialog (const MessageConfig &config, MessageResult *result) override |
| Called to present a dialog via a message config. More...
|
|
InputWidgetFactory * | inputWidgetFactory () const |
| READ accessor for WidgetsPresenter::inputWidgetFactory.
|
|
virtual const QMetaObject * | metaObject () const const |
|
virtual void * | qt_metacast (const char *) |
|
virtual int | qt_metacall (QMetaObject::Call, int, void **) |
|
| QObject (QObject *parent) |
|
virtual bool | event (QEvent *e) |
|
virtual bool | eventFilter (QObject *watched, QEvent *event) |
|
QString | objectName () const const |
|
void | setObjectName (const QString &name) |
|
bool | isWidgetType () const const |
|
bool | isWindowType () const const |
|
bool | signalsBlocked () const const |
|
bool | blockSignals (bool block) |
|
QThread * | thread () const const |
|
void | moveToThread (QThread *targetThread) |
|
int | startTimer (int interval, Qt::TimerType timerType) |
|
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
|
void | killTimer (int id) |
|
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
|
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
|
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
|
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
|
const QObjectList & | children () const const |
|
void | setParent (QObject *parent) |
|
void | installEventFilter (QObject *filterObj) |
|
void | removeEventFilter (QObject *obj) |
|
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
|
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
|
bool | disconnect (const QObject *receiver, const char *method) const const |
|
void | dumpObjectTree () |
|
void | dumpObjectInfo () |
|
void | dumpObjectTree () const const |
|
void | dumpObjectInfo () const const |
|
bool | setProperty (const char *name, const QVariant &value) |
|
QVariant | property (const char *name) const const |
|
QList< QByteArray > | dynamicPropertyNames () const const |
|
void | destroyed (QObject *obj) |
|
void | objectNameChanged (const QString &objectName) |
|
QObject * | parent () const const |
|
bool | inherits (const char *className) const const |
|
void | deleteLater () |
|
|
template<typename TPresenter > |
static void | registerAsPresenter () |
| Register a subclass of the WidgetsPresenter as the active presenter for the CoreApp.
|
|
template<typename TView > |
static void | registerView () |
| Register a view to be found by the presenter. More...
|
|
static void | registerView (const QMetaObject *viewType) |
| Register a view to be found by the presenter. More...
|
|
template<typename TViewModel , typename TView > |
static void | registerViewExplicitly () |
| Register a view for a viewmodel to be found by the presenter. More...
|
|
static void | registerViewExplicitly (const QMetaObject *viewModelType, const QMetaObject *viewType) |
| Register a view for a viewmodel to be found by the presenter. More...
|
|
static InputWidgetFactory * | getInputWidgetFactory () |
| Returns the internally used input widget factory.
|
|
QString | tr (const char *sourceText, const char *disambiguation, int n) |
|
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
|
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
|
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
|
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
|
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
|
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
|
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
|
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
|
bool | disconnect (const QMetaObject::Connection &connection) |
|
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
|
The IPresenter implementation for the widgets module.
This presenter is automatically registered as the default presenter for the IPresenter interface with the ServiceRegistry, but as weak service, in order to make it possible to overwrite it.
The class handles all the logic required for presenting widget based views. You can extend this class and reimplement it's virtual methods if you need to adjust how certain views or dialogs are presented, or if you want to support custom stuff
Definition at line 19 of file widgetspresenter.h.
template<typename TView >
QtMvvm::WidgetsPresenter::registerView |
( |
| ) |
|
|
static |
Register a view to be found by the presenter.
- Template Parameters
-
TView | The widget type register within the presenter. Must extend QWidget |
The widget is registered with the current presenter. It is registered implicitly, which means that it's name will be used to find it when a viewmodel is presented for it. Thus, it must be named after the viewmodel. If the viewmodel is for example named MyViewModel
, then the view must start with My
too. For example it can be named MyWidget
, MyDialog
, MyWindow
, MyView
, ...
- Note
- Implicit detection of views for viewmodels can sometimes lead to ambiguities and thus a wrong view beeing found. In such cases, use registerViewExplicitly() instead.
- See also
- WidgetsPresenter::registerViewExplicitly
Definition at line 102 of file widgetspresenter.h.
QtMvvm::WidgetsPresenter::registerView |
( |
const QMetaObject * |
viewType | ) |
|
|
static |
Register a view to be found by the presenter.
- Parameters
-
viewType | The widget type register within the presenter. Must extend QWidget |
The widget is registered with the current presenter. It is registered implicitly, which means that it's name will be used to find it when a viewmodel is presented for it. Thus, it must be named after the viewmodel. If the viewmodel is for example named MyViewModel
, then the view must start with My
too. For example it can be named MyWidget
, MyDialog
, MyWindow
, MyView
, ...
- Note
- Implicit detection of views for viewmodels can sometimes lead to ambiguities and thus a wrong view beeing found. In such cases, use registerViewExplicitly() instead.
- See also
- WidgetsPresenter::registerViewExplicitly
template<typename TViewModel , typename TView >
QtMvvm::WidgetsPresenter::registerViewExplicitly |
( |
| ) |
|
|
static |
Register a view for a viewmodel to be found by the presenter.
- Template Parameters
-
TViewModel | The viewmodel to to register the view for |
TView | The widget type register within the presenter. Must extend QWidget |
The widget is registered with the current presenter. It is registered explicitly, which means that whenever the given viewmodel is beeing presented, this exact view will be used. Explicit registration have precedence over implicit ones.
- See also
- WidgetsPresenter::registerView
Definition at line 113 of file widgetspresenter.h.
Called to present a dialog via a message config.
- Parameters
-
config | The configuration for the dialog to be shown |
result | A reference to the object to report results to |
- Exceptions
-
This method should create a simple dialog based of the configuration passed to it. Read the MessageConfig for more details on the parameters. The MessageConfig::type and MessageConfig::subType properties are used to determine the kind of dialog to be shown. The other properties are used to configure the dialog.
The result is a reference to a result object to report the result value and the pressed button to. The result is owned by the caller, you must never delete it. Use the special "GUI methods" to report the result and configure a close target.
If this method returns it is assumed the presentation was successful. If you throw the exception, presenting has failed, and the app will automatically complete the message result with the MessageConfig::NoButton constant.
- Note
- If you need to present asynchronous, then you need to perform this step yourself in case the asynchronous presentation failed.
- See also
- IPresenter::present, MessageConfig, MessageResult, MessageResult::complete, MessageResult::setCloseTarget
Implements QtMvvm::IPresenter.