QtSupport: Split QtVersionFactory::create()

... into a 'canCreate()' and the actual creation, which can be
done by the already registered m_creator.

Simpler interface, with the (temporary) regression that the
EmbeddedLinuxQtVersion get constructed twice, once only to
determine that it should be alive afterwards. Will be fixed later.

Change-Id: I5da2cafe473b25a0207bbd628632c9a259780361
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-02-14 11:02:28 +01:00
parent ec6b38dea0
commit 3007105d86
14 changed files with 45 additions and 56 deletions

View File

@@ -40,14 +40,14 @@ AndroidQtVersionFactory::AndroidQtVersionFactory()
setPriority(90);
}
QtSupport::BaseQtVersion *AndroidQtVersionFactory::create(ProFileEvaluator *evaluator)
bool AndroidQtVersionFactory::canCreate(ProFileEvaluator *evaluator) const
{
if (!evaluator->values(QLatin1String("CONFIG")).contains(QLatin1String("android"))
&& evaluator->value(QLatin1String("QMAKE_PLATFORM")) != QLatin1String("android"))
return nullptr;
if (evaluator->values(QLatin1String("CONFIG")).contains(QLatin1String("android-no-sdk")))
return nullptr;
return new AndroidQtVersion;
if (!evaluator->values("CONFIG").contains("android")
&& evaluator->value("QMAKE_PLATFORM") != "android")
return false;
if (evaluator->values("CONFIG").contains("android-no-sdk"))
return false;
return true;
}
} // Internal

View File

@@ -35,7 +35,7 @@ class AndroidQtVersionFactory : public QtSupport::QtVersionFactory
public:
AndroidQtVersionFactory();
QtSupport::BaseQtVersion *create(ProFileEvaluator *evaluator) override;
bool canCreate(ProFileEvaluator *evaluator) const override;
};
} // namespace Internal