ExtensionSystem: Use TestCreator in more places

Amends b59e632ac3

Change-Id: I11000c488c6a69b4c55b8ccb164fa6587abb8b5b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2023-02-10 11:40:27 +01:00
parent 133b78dafa
commit b9dca8f8fa
3 changed files with 4 additions and 3 deletions

View File

@@ -164,7 +164,7 @@ namespace Internal {
class IPluginPrivate class IPluginPrivate
{ {
public: public:
QList<std::function<QObject *()>> testCreators; QList<TestCreator> testCreators;
}; };
} // Internal } // Internal

View File

@@ -13,6 +13,8 @@ namespace ExtensionSystem {
namespace Internal { class IPluginPrivate; } namespace Internal { class IPluginPrivate; }
using TestCreator = std::function<QObject *()>;
class EXTENSIONSYSTEM_EXPORT IPlugin : public QObject class EXTENSIONSYSTEM_EXPORT IPlugin : public QObject
{ {
Q_OBJECT Q_OBJECT
@@ -41,7 +43,6 @@ public:
protected: protected:
virtual void initialize() {} virtual void initialize() {}
using TestCreator = std::function<QObject *()>;
template <typename Test, typename ...Args> template <typename Test, typename ...Args>
void addTest(Args && ...args) { addTestCreator([args...] { return new Test(args...); }); } void addTest(Args && ...args) { addTestCreator([args...] { return new Test(args...); }); }
void addTestCreator(const TestCreator &creator); void addTestCreator(const TestCreator &creator);

View File

@@ -78,7 +78,7 @@ public:
PluginSpec::PluginArgumentDescriptions argumentDescriptions; PluginSpec::PluginArgumentDescriptions argumentDescriptions;
IPlugin *plugin = nullptr; IPlugin *plugin = nullptr;
QList<std::function<QObject *()>> registeredPluginTests; QList<TestCreator> registeredPluginTests;
PluginSpec::State state = PluginSpec::Invalid; PluginSpec::State state = PluginSpec::Invalid;
bool hasError = false; bool hasError = false;