forked from qt-creator/qt-creator
TaskTree: Add static assert ensuring the right Adapter type
Change-Id: I87e995151ec21963c5514dfdb1863cfd2bc457b9 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:
@@ -318,6 +318,9 @@ class CustomTask : public GroupItem
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Task = typename Adapter::Type;
|
using Task = typename Adapter::Type;
|
||||||
|
static_assert(std::is_base_of_v<TaskAdapter<Task>, Adapter>,
|
||||||
|
"The Adapter type for the CustomTask<Adapter> needs to be derived from "
|
||||||
|
"TaskAdapter<Task>.");
|
||||||
using EndHandler = std::function<void(const Task &)>;
|
using EndHandler = std::function<void(const Task &)>;
|
||||||
static Adapter *createAdapter() { return new Adapter; }
|
static Adapter *createAdapter() { return new Adapter; }
|
||||||
CustomTask() : GroupItem({&createAdapter}) {}
|
CustomTask() : GroupItem({&createAdapter}) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user