diff options
Diffstat (limited to 'sigmodr/tree/GroupModel.cpp')
-rw-r--r-- | sigmodr/tree/GroupModel.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sigmodr/tree/GroupModel.cpp b/sigmodr/tree/GroupModel.cpp index 186c5e86..043336b2 100644 --- a/sigmodr/tree/GroupModel.cpp +++ b/sigmodr/tree/GroupModel.cpp @@ -21,52 +21,54 @@ // Sigmodr tree includes #include "BaseObjectModel.h" -Sigmodr::Tree::GroupModel::GroupModel(BaseModel* parent, Sigmod::Object* object, const QString& name) : +using namespace Sigmodr::Tree; + +GroupModel::GroupModel(BaseModel* parent, Sigmod::Object* object, const QString& name) : BaseModel(parent, object, name), Grouping() { } -Sigmodr::Tree::GroupModel::~GroupModel() +GroupModel::~GroupModel() { clearData(); } -QVariant Sigmodr::Tree::GroupModel::data(int role) const +QVariant GroupModel::data(int role) const { if (role == Qt::DisplayRole) return m_name; return BaseModel::data(role); } -int Sigmodr::Tree::GroupModel::rowCount() const +int GroupModel::rowCount() const { return m_objects.size(); } -Qt::ItemFlags Sigmodr::Tree::GroupModel::flags() const +Qt::ItemFlags GroupModel::flags() const { return Qt::ItemIsDropEnabled | Qt::ItemIsEnabled; } -Sigmodr::Tree::BaseModel* Sigmodr::Tree::GroupModel::childItem(const int row) +BaseModel* GroupModel::childItem(const int row) { if (row < m_objects.size()) return m_objects[row]; return NULL; } -Qt::DropActions Sigmodr::Tree::GroupModel::supportedDragActions() const +Qt::DropActions GroupModel::supportedDragActions() const { return 0; } -Qt::DropActions Sigmodr::Tree::GroupModel::supportedDropActions() const +Qt::DropActions GroupModel::supportedDropActions() const { return Qt::CopyAction | Qt::MoveAction; } -void Sigmodr::Tree::GroupModel::addChild(BaseModel* model) +void GroupModel::addChild(BaseModel* model) { connect(model, SIGNAL(rowChanged(int)), this, SLOT(childRowChanged(int))); connect(model, SIGNAL(rowsChanged(QList<int>)), this, SLOT(childRowsChanged(QList<int>))); @@ -74,7 +76,7 @@ void Sigmodr::Tree::GroupModel::addChild(BaseModel* model) emit(rowChanged(m_objects.size() - 1)); } -int Sigmodr::Tree::GroupModel::findChild(BaseModel* model) const +int GroupModel::findChild(BaseModel* model) const { return find(model); } |