QtMvvm  1.1.0
A mvvm oriented library for Qt, to create Projects for Widgets and Quick in parallel
ipresenter.h
Go to the documentation of this file.
1 #ifndef QTMVVM_IPRESENTER_H
2 #define QTMVVM_IPRESENTER_H
3 
4 #include <QtCore/qexception.h>
5 
6 #include "QtMvvmCore/qtmvvmcore_global.h"
7 #include "QtMvvmCore/viewmodel.h"
8 #include "QtMvvmCore/message.h"
9 
10 namespace QtMvvm {
11 
13 class Q_MVVMCORE_EXPORT PresenterException : public QException
14 {
15 public:
17  PresenterException(const QByteArray &what);
18 
20  const char *what() const noexcept override;
21 
23  void raise() const override;
25  QException *clone() const override;
26 
27 protected:
29  PresenterException(const PresenterException * const other);
30 
32  const QByteArray _what;
33 };
34 
36 class Q_MVVMCORE_EXPORT IPresenter
37 {
38  Q_DISABLE_COPY(IPresenter)
39 public:
40  inline IPresenter() = default;
41  inline virtual ~IPresenter() = default;
42 
44  virtual void present(ViewModel *viewModel, const QVariantHash &params, QPointer<ViewModel> parent = nullptr) = 0;
46  virtual void showDialog(const MessageConfig &config, MessageResult *result) = 0;
47 };
48 
49 }
50 
52 #define QtMvvm_IPresenterIid "de.skycoder42.qtmvvm.core.IPresenter"
53 Q_DECLARE_INTERFACE(QtMvvm::IPresenter, QtMvvm_IPresenterIid)
54 Q_DECLARE_METATYPE(QtMvvm::IPresenter*)
55 
56 #endif // QTMVVM_IPRESENTER_H
#define QtMvvm_IPresenterIid
The IID of the QtMvvm::IPresenter class.
Definition: ipresenter.h:52
A configuration for a simple dialog to be shown from the core code.
Definition: message.h:20
The interface for a GUI view presenter.
Definition: ipresenter.h:36
The base class for all viewmodels.
Definition: viewmodel.h:21
A result watcher to get the result once a dialog has finished.
Definition: message.h:204
The primary namespace of the QtMvvm library.
An exception to be thrown from the presenter if presenting fails.
Definition: ipresenter.h:13