forked from gpospelov/qt-mvvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodeleditorwidget.h
55 lines (40 loc) · 1.4 KB
/
modeleditorwidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// ************************************************************************** //
//
// Model-view-view-model framework for large GUI applications
//
//! @license GNU General Public License v3 or higher (see COPYING)
//! @authors see AUTHORS
//
// ************************************************************************** //
#ifndef CELLEDITORSCORE_MODELEDITORWIDGET_H
#define CELLEDITORSCORE_MODELEDITORWIDGET_H
#include <QWidget>
#include <memory>
class QBoxLayout;
class QTreeView;
class QTableView;
namespace ModelView {
class ViewModel;
class ViewModelDelegate;
} // namespace ModelView
namespace CellEditors {
class SampleModel;
//! Shows content of the model as vertical tree, horizontal tree and table.
class ModelEditorWidget : public QWidget {
Q_OBJECT
public:
explicit ModelEditorWidget(SampleModel* model = nullptr, QWidget* parent = nullptr);
virtual ~ModelEditorWidget() override;
void setModel(SampleModel* model);
private:
QBoxLayout* createLeftLayout();
QBoxLayout* createRightLayout();
QTreeView* m_verticalTree{nullptr};
QTreeView* m_horizontalTree{nullptr};
QTableView* m_tableView{nullptr};
std::unique_ptr<ModelView::ViewModel> m_verticalViewModel;
std::unique_ptr<ModelView::ViewModel> m_horizontalViewModel;
std::unique_ptr<ModelView::ViewModelDelegate> m_delegate;
};
} // namespace CellEditors
#endif // CELLEDITORSCORE_MODELEDITORWIDGET_H