Add a poolAt() convenience function to the model

This will allow retrieving pools from the UI.
This commit is contained in:
Luca Beltrame 2015-02-15 00:58:31 +01:00
parent 9b47e26bcb
commit 5a4d2afa84
2 changed files with 6 additions and 1 deletions

View file

@ -44,7 +44,6 @@ DanbooruPoolModel::~DanbooruPoolModel()
void DanbooruPoolModel::addPool(DanbooruPool *pool)
{
beginInsertRows(QModelIndex(), m_items.size(), m_items.size());
qDebug() << "POOL NAME" << pool->name();
m_items.append(pool);
endInsertRows();
}
@ -117,6 +116,11 @@ void DanbooruPoolModel::clear()
reset();
}
DanbooruPool* DanbooruPoolModel::poolAt(int index) const
{
return m_items.at(index);
}
} // namespace Danbooru

View file

@ -40,6 +40,7 @@ public:
QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE;
void clear();
DanbooruPool* poolAt(int index) const;
private:
QVector<DanbooruPool *> m_items;