Update Qt validity in options when changing Android device settings

When changing the Android device settings and pressing "Apply", the
information in the "Qt Versions" tab is no longer correct.

The Abi information is parsed from the mkspec, and that depends on the
NDK setting in the environment.
When the NDK in the device settings changes, it updates the toolchains,
and that triggers a re-validation of the Qt info in
QtOptionsPageWidget::validInformation, but since the Android Qt version
already has tried parsing the mkspec, and got (possibly empty) Abi
information, it never is parsed and updated again.

We need a way to force BaseQtVersion to update these things again.

Fixes: QTCREATORBUG-23095
Change-Id: I9cb55ad1a73db942804637344e4c856c7e95afd3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2019-11-18 16:57:44 +01:00
parent 20f050303a
commit 15b2765dff
6 changed files with 15 additions and 0 deletions

View File

@@ -870,6 +870,7 @@ FilePath AndroidConfig::qtLiveApkPath() const
///////////////////////////////////
void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs)
{
emit m_instance->aboutToUpdate();
m_instance->m_config = devConfigs;
m_instance->save();

View File

@@ -209,6 +209,7 @@ public:
static QProcessEnvironment toolsEnvironment(const AndroidConfig &config);
signals:
void aboutToUpdate();
void updated();
private:

View File

@@ -49,7 +49,12 @@ namespace Internal {
AndroidQtVersion::AndroidQtVersion()
: QtSupport::BaseQtVersion()
, m_guard(std::make_unique<QObject>())
{
QObject::connect(AndroidConfigurations::instance(),
&AndroidConfigurations::aboutToUpdate,
m_guard.get(),
[this] { resetCache(); });
}
bool AndroidQtVersion::isValid() const

View File

@@ -58,6 +58,7 @@ public:
protected:
void parseMkSpec(ProFileEvaluator *) const override;
private:
std::unique_ptr<QObject> m_guard;
mutable QStringList m_androidAbis;
mutable int m_minNdk = -1;
};

View File

@@ -2169,6 +2169,11 @@ Abis BaseQtVersion::qtAbisFromLibrary(const FilePathList &coreLibraries)
return res;
}
void BaseQtVersion::resetCache() const
{
d->m_hasQtAbis = false;
d->m_mkspecReadUpToDate = false;
}
// QtVersionFactory

View File

@@ -245,6 +245,8 @@ protected:
// helper function for desktop and simulator to figure out the supported abis based on the libraries
static ProjectExplorer::Abis qtAbisFromLibrary(const Utils::FilePathList &coreLibraries);
void resetCache() const;
void ensureMkSpecParsed() const;
virtual void parseMkSpec(ProFileEvaluator *) const;