Add a poolAt() convenience function to the model
This will allow retrieving pools from the UI.
This commit is contained in:
		
					parent
					
						
							
								9b47e26bcb
							
						
					
				
			
			
				commit
				
					
						5a4d2afa84
					
				
			
		
					 2 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
					@ -44,7 +44,6 @@ DanbooruPoolModel::~DanbooruPoolModel()
 | 
				
			||||||
void DanbooruPoolModel::addPool(DanbooruPool *pool)
 | 
					void DanbooruPoolModel::addPool(DanbooruPool *pool)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    beginInsertRows(QModelIndex(), m_items.size(), m_items.size());
 | 
					    beginInsertRows(QModelIndex(), m_items.size(), m_items.size());
 | 
				
			||||||
    qDebug() << "POOL NAME" << pool->name();
 | 
					 | 
				
			||||||
    m_items.append(pool);
 | 
					    m_items.append(pool);
 | 
				
			||||||
    endInsertRows();
 | 
					    endInsertRows();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -117,6 +116,11 @@ void DanbooruPoolModel::clear()
 | 
				
			||||||
    reset();
 | 
					    reset();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DanbooruPool* DanbooruPoolModel::poolAt(int index) const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return m_items.at(index);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} // namespace Danbooru
 | 
					} // namespace Danbooru
 | 
				
			||||||
| 
						 | 
					@ -40,6 +40,7 @@ public:
 | 
				
			||||||
    QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
 | 
					    QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
 | 
				
			||||||
    QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE;
 | 
					    QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE;
 | 
				
			||||||
    void clear();
 | 
					    void clear();
 | 
				
			||||||
 | 
					    DanbooruPool* poolAt(int index) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    QVector<DanbooruPool *> m_items;
 | 
					    QVector<DanbooruPool *> m_items;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue