QtMvvm  1.0.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 public:
39  inline virtual ~IPresenter() = default;
40 
42  virtual void present(ViewModel *viewModel, const QVariantHash &params, QPointer<ViewModel> parent = nullptr) = 0;
44  virtual void showDialog(const MessageConfig &config, MessageResult *result) = 0;
45 };
46 
47 }
48 
50 #define QtMvvm_IPresenterIid "de.skycoder42.qtmvvm.core.IPresenter"
51 Q_DECLARE_INTERFACE(QtMvvm::IPresenter, QtMvvm_IPresenterIid)
52 Q_DECLARE_METATYPE(QtMvvm::IPresenter*)
53 
54 #endif // QTMVVM_IPRESENTER_H
#define QtMvvm_IPresenterIid
The IID of the QtMvvm::IPresenter class.
Definition: ipresenter.h:50
A configuration for a simple dialog to be shown from the core code.
Definition: message.h:18
The interface for a GUI view presenter.
Definition: ipresenter.h:36
The base class for all viewmodels.
Definition: viewmodel.h:20
A result watcher to get the result once a dialog has finished.
Definition: message.h:172
The primary namespace of the QtMvvm library.
Definition: binding.h:10
An exception to be thrown from the presenter if presenting fails.
Definition: ipresenter.h:13