diff options
Diffstat (limited to 'sigmodr/tree/SigmodrTreeModel.cpp')
-rw-r--r-- | sigmodr/tree/SigmodrTreeModel.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/sigmodr/tree/SigmodrTreeModel.cpp b/sigmodr/tree/SigmodrTreeModel.cpp index 5e44952a..9f942f9c 100644 --- a/sigmodr/tree/SigmodrTreeModel.cpp +++ b/sigmodr/tree/SigmodrTreeModel.cpp @@ -49,8 +49,7 @@ QVariant SigmodrTreeModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) return QVariant(); - BaseModel* object = static_cast<BaseModel*>(index.internalPointer()); - return object->data(role); + return static_cast<BaseModel*>(index.internalPointer())->data(role); } QModelIndex SigmodrTreeModel::index(int row, int column, const QModelIndex& parent) const @@ -62,8 +61,7 @@ QModelIndex SigmodrTreeModel::index(int row, int column, const QModelIndex& pare BaseModel* model = getItem(parent); if ((model->rowCount() <= row) || (1 <= column)) return QModelIndex(); - BaseModel* object = model->childItem(row); - return createIndex(row, 0, object); + return createIndex(row, 0, model->childItem(row)); } QModelIndex SigmodrTreeModel::parent(const QModelIndex& index) const @@ -78,8 +76,7 @@ QModelIndex SigmodrTreeModel::parent(const QModelIndex& index) const int SigmodrTreeModel::rowCount(const QModelIndex& parent) const { - BaseModel* object = getItem(parent); - return object->rowCount(); + return getItem(parent)->rowCount(); } int SigmodrTreeModel::columnCount(const QModelIndex& parent) const @@ -100,9 +97,8 @@ bool SigmodrTreeModel::setData(const QModelIndex& index, const QVariant& value, { if (!index.isValid()) return false; - BaseModel* object = static_cast<BaseModel*>(index.internalPointer()); emit(layoutAboutToBeChanged()); - bool success = object->setData(value, role); + bool success = static_cast<BaseModel*>(index.internalPointer())->setData(value, role); emit(layoutChanged()); if (success) { @@ -115,11 +111,7 @@ bool SigmodrTreeModel::setData(const QModelIndex& index, const QVariant& value, BaseModel* SigmodrTreeModel::getItem(const QModelIndex& index) const { if (index.isValid()) - { - BaseModel* object = static_cast<BaseModel*>(index.internalPointer()); - if (object) - return object; - } + return static_cast<BaseModel*>(index.internalPointer()); return m_root; } |