forked from gpospelov/qt-mvvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Populate group property example with the content
- Loading branch information
Showing
6 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,6 @@ target_sources(${library_name} PRIVATE | |
mainwindow.h | ||
items.cpp | ||
items.h | ||
widget.cpp | ||
widget.h | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// ************************************************************************** // | ||
// | ||
// Model-view-view-model framework for large GUI applications | ||
// | ||
//! @license GNU General Public License v3 or higher (see COPYING) | ||
//! @authors see AUTHORS | ||
// | ||
// ************************************************************************** // | ||
|
||
#include "widget.h" | ||
#include "mvvm/widgets/allitemstreeview.h" | ||
#include "mvvm/widgets/propertytreeview.h" | ||
#include <QHBoxLayout> | ||
|
||
namespace GroupProperty { | ||
|
||
Widget::Widget(QWidget* parent) | ||
: QWidget(parent) | ||
, m_treeView(new ModelView::AllItemsTreeView(&m_model)) | ||
, m_propertyEditor(new ModelView::PropertyTreeView) | ||
{ | ||
auto layout = new QHBoxLayout(this); | ||
layout->addWidget(m_treeView); | ||
layout->addWidget(m_propertyEditor); | ||
|
||
// populate the model with single ParticleItem | ||
auto particleItem = m_model.insertItem<ParticleItem>(); | ||
|
||
// and make property editor displaying this item | ||
m_propertyEditor->setItem(particleItem); | ||
} | ||
|
||
} // namespace GroupProperty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// ************************************************************************** // | ||
// | ||
// Model-view-view-model framework for large GUI applications | ||
// | ||
//! @license GNU General Public License v3 or higher (see COPYING) | ||
//! @authors see AUTHORS | ||
// | ||
// ************************************************************************** // | ||
|
||
#ifndef GROUPPROPERTYCORE_WIDGET_H | ||
#define GROUPPROPERTYCORE_WIDGET_H | ||
|
||
#include "items.h" | ||
#include <QWidget> | ||
|
||
namespace ModelView { | ||
class AllItemsTreeView; | ||
class PropertyTreeView; | ||
} // namespace ModelView | ||
|
||
namespace GroupProperty { | ||
|
||
class Model; | ||
|
||
//! The widget contains a tree view displaying the model content on the left, | ||
//! and property editor showing the content of a single ParticleItem on the right. | ||
|
||
class Widget : public QWidget { | ||
Q_OBJECT | ||
|
||
public: | ||
Widget(QWidget* parent = nullptr); | ||
|
||
private: | ||
Model m_model; | ||
ModelView::AllItemsTreeView* m_treeView{nullptr}; | ||
ModelView::PropertyTreeView* m_propertyEditor{nullptr}; | ||
}; | ||
|
||
} // namespace GroupProperty | ||
|
||
#endif // GROUPPROPERTYCORE_WIDGET_H |