CMakeProjectManager: expand variables for Batch Edit

The Batch Edit dialog is offering the ability to use expanded
variables, but these variables were not expanded upon acceptance.

For the CMake command line they were expanded, but there was a
conflict between what the settings dialog as value had and what
CMake returned via file-api.

Change-Id: Ia4a64e99676c43f7b182e059f9051393aa184c19
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Cristian Adam
2021-03-01 20:18:08 +01:00
parent f7d729f0b5
commit 99dd3a0260

View File

@@ -463,8 +463,14 @@ void CMakeBuildSettingsWidget::batchEditConfiguration()
connect(buttons, &QDialogButtonBox::accepted, dialog, &QDialog::accept); connect(buttons, &QDialogButtonBox::accepted, dialog, &QDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, dialog, &QDialog::reject); connect(buttons, &QDialogButtonBox::rejected, dialog, &QDialog::reject);
connect(dialog, &QDialog::accepted, this, [=]{ connect(dialog, &QDialog::accepted, this, [=]{
const CMakeConfig config = CMakeConfigItem::itemsFromArguments( const auto expander = m_buildConfiguration->macroExpander();
editor->toPlainText().split('\n', Qt::SkipEmptyParts));
const QStringList lines = editor->toPlainText().split('\n', Qt::SkipEmptyParts);
const QStringList expandedLines = Utils::transform(lines,
[expander](const QString &s) {
return expander->expand(s);
});
const CMakeConfig config = CMakeConfigItem::itemsFromArguments(expandedLines);
m_configModel->setBatchEditConfiguration(config); m_configModel->setBatchEditConfiguration(config);
}); });