mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:17:44 +00:00
GModelSelection: Add size() and a const overload of for_each_index()
This commit is contained in:
parent
566eb58170
commit
1cb661ae69
1 changed files with 8 additions and 0 deletions
|
@ -12,6 +12,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int size() const { return m_indexes.size(); }
|
||||||
bool is_empty() const { return m_indexes.is_empty(); }
|
bool is_empty() const { return m_indexes.is_empty(); }
|
||||||
bool contains(const GModelIndex& index) const { return m_indexes.contains(index); }
|
bool contains(const GModelIndex& index) const { return m_indexes.contains(index); }
|
||||||
bool contains_row(int row) const
|
bool contains_row(int row) const
|
||||||
|
@ -36,6 +37,13 @@ public:
|
||||||
callback(index);
|
callback(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename Callback>
|
||||||
|
void for_each_index(Callback callback) const
|
||||||
|
{
|
||||||
|
for (auto& index : m_indexes)
|
||||||
|
callback(index);
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: This doesn't guarantee that what you get is the lowest or "first" index selected..
|
// FIXME: This doesn't guarantee that what you get is the lowest or "first" index selected..
|
||||||
GModelIndex first() const
|
GModelIndex first() const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue