mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
refs #526, added removeIf/replaceOrAdd to viewbase
This commit is contained in:
@@ -393,6 +393,27 @@ namespace BlackGui
|
||||
//! Remove selected rows
|
||||
int removeSelectedRows();
|
||||
|
||||
//! \copydoc BlackMisc::CContainerBase::removeIf
|
||||
template <class K0, class V0, class... KeysValues>
|
||||
int removeIf(K0 k0, V0 v0, KeysValues... keysValues)
|
||||
{
|
||||
if (this->rowCount() < 1) { return 0; }
|
||||
ContainerType copy(container());
|
||||
int r = copy.removeIf(k0, v0, keysValues...);
|
||||
if (r < 1) { return 0; }
|
||||
this->updateContainerMaybeAsync(copy);
|
||||
return r;
|
||||
}
|
||||
|
||||
//! \copydoc BlackMisc::CSequence::replaceOrAdd
|
||||
template <class K1, class V1>
|
||||
void replaceOrAdd(K1 key1, V1 value1, const ObjectType &replacement)
|
||||
{
|
||||
ContainerType copy(container());
|
||||
copy.replaceOrAdd(key1, value1, replacement);
|
||||
this->updateContainerMaybeAsync(copy);
|
||||
}
|
||||
|
||||
//! Row count
|
||||
int rowCount() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user