forked from qt-creator/qt-creator
QmlDesigner: Fix hardcoded Controls2 config file
Task-number: QDS-10545 Change-Id: I8e96ea5f4b409a8b378f94e45b413d6315ea8170 Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -83,10 +83,26 @@ bool PuppetEnvironmentBuilder::usesVirtualKeyboard() const
|
|||||||
QString PuppetEnvironmentBuilder::getStyleConfigFileName() const
|
QString PuppetEnvironmentBuilder::getStyleConfigFileName() const
|
||||||
{
|
{
|
||||||
if (m_target) {
|
if (m_target) {
|
||||||
for (const Utils::FilePath &fileName :
|
const auto *qmlBuild = qobject_cast<QmlProjectManager::QmlBuildSystem *>(
|
||||||
m_target->project()->files(ProjectExplorer::Project::SourceFiles)) {
|
m_target->buildSystem());
|
||||||
if (fileName.fileName() == "qtquickcontrols2.conf")
|
if (qmlBuild) {
|
||||||
return fileName.toString();
|
const auto &environment = qmlBuild->environment();
|
||||||
|
const auto &envVar = std::find_if(
|
||||||
|
std::begin(environment), std::end(environment), [](const auto &envVar) {
|
||||||
|
return (envVar.name == u"QT_QUICK_CONTROLS_CONF"
|
||||||
|
&& envVar.operation != Utils::EnvironmentItem::SetDisabled);
|
||||||
|
});
|
||||||
|
if (envVar != std::end(environment)) {
|
||||||
|
const auto &sourceFiles = m_target->project()->files(
|
||||||
|
ProjectExplorer::Project::SourceFiles);
|
||||||
|
const auto &foundFile = std::find_if(std::begin(sourceFiles),
|
||||||
|
std::end(sourceFiles),
|
||||||
|
[&](const auto &fileName) {
|
||||||
|
return fileName.fileName() == envVar->value;
|
||||||
|
});
|
||||||
|
if (foundFile != std::end(sourceFiles))
|
||||||
|
return foundFile->toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user