Switch to QVector instead of QList. Insertions aren't really needed.
This commit is contained in:
parent
cfbfef9651
commit
1886dbf53c
3 changed files with 7 additions and 6 deletions
|
@ -40,18 +40,19 @@ namespace Danbooru {
|
|||
DanbooruTableModel::~DanbooruTableModel()
|
||||
{
|
||||
qDeleteAll(m_posts);
|
||||
m_posts.clear();
|
||||
}
|
||||
|
||||
int DanbooruTableModel::rowCount(const QModelIndex& parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
return m_posts.length();
|
||||
return m_posts.size();
|
||||
}
|
||||
|
||||
void DanbooruTableModel::addPost(Danbooru::DanbooruPost* post)
|
||||
{
|
||||
|
||||
beginInsertRows(QModelIndex(), m_posts.length(), m_posts.length() + 1);
|
||||
beginInsertRows(QModelIndex(), m_posts.size(), m_posts.size() + 1);
|
||||
m_posts.append(post);
|
||||
endInsertRows();
|
||||
}
|
||||
|
@ -60,11 +61,10 @@ namespace Danbooru {
|
|||
{
|
||||
|
||||
if (!index.isValid()) {
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
if (index.row() >= m_posts.length() || index.row() < 0) {
|
||||
if (index.row() >= m_posts.size() || index.row() < 0) {
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue