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.
- Loading branch information
Showing
4 changed files
with
121 additions
and
3 deletions.
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
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,54 @@ | ||
// ************************************************************************** // | ||
// | ||
// Model-view-view-model framework for large GUI applications | ||
// | ||
//! @license GNU General Public License v3 or higher (see COPYING) | ||
//! @authors see AUTHORS | ||
// | ||
// ************************************************************************** // | ||
|
||
#include "items.h" | ||
#include "mvvm/standarditems/vectoritem.h" | ||
#include <QColor> | ||
|
||
namespace GroupProperty { | ||
|
||
UndefinedShapeItem::UndefinedShapeItem() : ModelView::CompoundItem("Undefined") | ||
{ | ||
// no properties | ||
} | ||
|
||
SphereItem::SphereItem() : ModelView::CompoundItem("Sphere") | ||
{ | ||
addProperty("Radius", 5.0); | ||
} | ||
|
||
CylinderItem::CylinderItem() : ModelView::CompoundItem("Cylinder") | ||
{ | ||
addProperty("Radius", 8.0); | ||
addProperty("Height", 10.0); | ||
} | ||
|
||
BoxItem::BoxItem() : ModelView::CompoundItem("Box") | ||
{ | ||
addProperty("Length", 12.0); | ||
addProperty("Width", 6.0); | ||
addProperty("Height", 3.0); | ||
} | ||
|
||
ShapeGroupItem::ShapeGroupItem() : ModelView::GroupItem("Shape") | ||
{ | ||
addToGroup<UndefinedShapeItem>("xxx"); | ||
addToGroup<SphereItem>("xxx"); | ||
addToGroup<CylinderItem>("xxx"); | ||
addToGroup<BoxItem>("xxx"); | ||
} | ||
|
||
ParticleItem::ParticleItem() : ModelView::CompoundItem("Particle") | ||
{ | ||
addProperty("Color", QColor(Qt::green)); | ||
addProperty<ModelView::VectorItem>("Position"); | ||
addProperty<ShapeGroupItem>("Shape"); | ||
} | ||
|
||
} // 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,62 @@ | ||
// ************************************************************************** // | ||
// | ||
// Model-view-view-model framework for large GUI applications | ||
// | ||
//! @license GNU General Public License v3 or higher (see COPYING) | ||
//! @authors see AUTHORS | ||
// | ||
// ************************************************************************** // | ||
|
||
#ifndef GROUPPROPERTYCORE_ITEMS_H | ||
#define GROUPPROPERTYCORE_ITEMS_H | ||
|
||
#include "mvvm/model/compounditem.h" | ||
#include "mvvm/model/groupitem.h" | ||
|
||
namespace GroupProperty { | ||
|
||
//! Represents undefined shape. | ||
|
||
class UndefinedShapeItem : public ModelView::CompoundItem { | ||
public: | ||
UndefinedShapeItem(); | ||
}; | ||
|
||
//! Represents a shpere. | ||
|
||
class SphereItem : public ModelView::CompoundItem { | ||
public: | ||
SphereItem(); | ||
}; | ||
|
||
//! Represents a cylindrical shape. | ||
|
||
class CylinderItem : public ModelView::CompoundItem { | ||
public: | ||
CylinderItem(); | ||
}; | ||
|
||
//! Represents a box. | ||
|
||
class BoxItem : public ModelView::CompoundItem { | ||
public: | ||
BoxItem(); | ||
}; | ||
|
||
//! Represents a group of possible shapes. | ||
|
||
class ShapeGroupItem : public ModelView::GroupItem { | ||
public: | ||
ShapeGroupItem(); | ||
}; | ||
|
||
//! Represents a particle. Particle has a color, position, and a selection of possible shapes. | ||
|
||
class ParticleItem : public ModelView::CompoundItem { | ||
public: | ||
ParticleItem(); | ||
}; | ||
|
||
} // namespace GroupProperty | ||
|
||
#endif // GROUPPROPERTYCORE_ITEMS_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