forked from qt-creator/qt-creator
TaskTree: Derive Sync from GroupItem instead of from Group
Change-Id: I6fd9ce48d3105f95f566ccb3328875872fd4af2b Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -274,15 +274,15 @@ public:
|
||||
};
|
||||
|
||||
// Synchronous invocation. Similarly to Group - isn't counted as a task inside taskCount()
|
||||
class TASKING_EXPORT Sync final : public Group
|
||||
class TASKING_EXPORT Sync final : public GroupItem
|
||||
{
|
||||
public:
|
||||
template<typename Function>
|
||||
Sync(Function &&function) : Group(init(std::forward<Function>(function))) {}
|
||||
Sync(Function &&function) { addChildren({init(std::forward<Function>(function))}); }
|
||||
|
||||
private:
|
||||
template<typename Function>
|
||||
static QList<GroupItem> init(Function &&function) {
|
||||
static GroupItem init(Function &&function) {
|
||||
constexpr bool isInvocable = std::is_invocable_v<std::decay_t<Function>>;
|
||||
static_assert(isInvocable,
|
||||
"Sync element: The synchronous function can't take any arguments.");
|
||||
@@ -291,10 +291,10 @@ private:
|
||||
static_assert(isBool || isVoid,
|
||||
"Sync element: The synchronous function has to return void or bool.");
|
||||
if constexpr (isBool) {
|
||||
return {onGroupSetup([function] { return function() ? SetupResult::StopWithDone
|
||||
: SetupResult::StopWithError; })};
|
||||
return onGroupSetup([function] { return function() ? SetupResult::StopWithDone
|
||||
: SetupResult::StopWithError; });
|
||||
}
|
||||
return {onGroupSetup([function] { function(); return SetupResult::StopWithDone; })};
|
||||
return onGroupSetup([function] { function(); return SetupResult::StopWithDone; });
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user