QmlDesigner: Cleanup QmlTimelineKeyframeGroup

Many checks are not anymore need so we can just remove the code and make
it clean what we want. Use the filtered algorithm to remove some loops.
We add Utils::filteredCast to algorithm.h to return a different result
container and let it be cast in std::copy_if.

Change-Id: I114c17cd2d5a69c9ebbfbd804805c4d2fa0599e1
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Marco Bubke
2022-09-07 12:13:53 +02:00
parent 8e0c09a35e
commit 016fb66c96
3 changed files with 33 additions and 28 deletions

View File

@@ -890,6 +890,17 @@ C filtered(const C &container, R (S::*predicate)() const)
return out;
}
//////////////////
// filteredCast
/////////////////
template<typename R, typename C, typename F>
Q_REQUIRED_RESULT R filteredCast(const C &container, F predicate)
{
R out;
std::copy_if(std::begin(container), std::end(container), inserter(out), predicate);
return out;
}
//////////////////
// partition
/////////////////