diff options
Diffstat (limited to 'sigmodr/tree/CoinListModel.cpp')
-rw-r--r-- | sigmodr/tree/CoinListModel.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sigmodr/tree/CoinListModel.cpp b/sigmodr/tree/CoinListModel.cpp index a3062314..3b6172f2 100644 --- a/sigmodr/tree/CoinListModel.cpp +++ b/sigmodr/tree/CoinListModel.cpp @@ -32,10 +32,11 @@ // KDE includes #include <KMenu> +using namespace Sigmod; using namespace Sigmodr::Widgets; using namespace Sigmodr::Tree; -CoinListModel::CoinListModel(BaseModel* parent, Sigmod::CoinList* coinList) : +CoinListModel::CoinListModel(BaseModel* parent, CoinList* coinList) : GroupObjectModel(parent, coinList) { setupData(); @@ -49,7 +50,7 @@ CoinListModel::~CoinListModel() QVariant CoinListModel::data(int role) const { if (role == Qt::DisplayRole) - return qobject_cast<Sigmod::CoinList*>(m_object)->name(); + return qobject_cast<CoinList*>(m_object)->name(); else if (role == BaseModel::XmlRole) { QDomDocument xml(m_object->className()); @@ -58,7 +59,7 @@ QVariant CoinListModel::data(int role) const } else if (role == BaseModel::WidgetRole) { - QWidget* widget = new CoinListUI(qobject_cast<Sigmod::CoinList*>(m_object), NULL); + QWidget* widget = new CoinListUI(qobject_cast<CoinList*>(m_object), NULL); return QVariant::fromValue(widget); } else if (role == BaseModel::ContextMenuRole) @@ -91,7 +92,7 @@ bool CoinListModel::setData(const QVariant& value, int role) } else if (xml.doctype().name() == "CoinListItem") { - addObject(qobject_cast<Sigmod::CoinList*>(m_object)->newItem(xml.documentElement())); + addObject(qobject_cast<CoinList*>(m_object)->newItem(xml.documentElement())); return true; } } @@ -105,12 +106,12 @@ QString CoinListModel::types() const return type().append(QString(";CoinListItem")); } -void CoinListModel::addObject(Sigmod::Object* object) +void CoinListModel::addObject(Object* object) { if (!object) - object = qobject_cast<Sigmod::CoinList*>(m_object)->newItem(); + object = qobject_cast<CoinList*>(m_object)->newItem(); if (object->className() == "CoinListItem") - addChild(new CoinListItemModel(this, qobject_cast<Sigmod::CoinListItem*>(object))); + addChild(new CoinListItemModel(this, qobject_cast<CoinListItem*>(object))); } void CoinListModel::deleteObject(BaseModel* model) @@ -118,7 +119,7 @@ void CoinListModel::deleteObject(BaseModel* model) const int index = find(model); if (0 <= index) { - qobject_cast<Sigmod::CoinList*>(m_object)->deleteItem(index); + qobject_cast<CoinList*>(m_object)->deleteItem(index); m_objects[index]->deleteLater(); m_objects.removeAt(index); childRowChanged(index); @@ -132,7 +133,7 @@ void CoinListModel::deleteSelf() void CoinListModel::setupData() { - Sigmod::CoinList* coinList = qobject_cast<Sigmod::CoinList*>(m_object); + CoinList* coinList = qobject_cast<CoinList*>(m_object); for (int i = 0; i < coinList->itemCount(); ++i) addChild(new CoinListItemModel(this, coinList->item(i))); } |