ProjectExplorer: Move user path conversion closer to the edge

And replace some foreach().

Change-Id: I788e112c0e314f5514af22dabd111f9cdb64dca5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-09-27 17:04:37 +02:00
parent ceae67022c
commit b115de563c

View File

@@ -303,7 +303,7 @@ void CustomWizardFieldPage::initializePage()
{
QWizardPage::initializePage();
clearError();
foreach (const LineEditData &led, m_lineEdits) {
for (const LineEditData &led : qAsConst(m_lineEdits)) {
if (!led.userChange.isNull()) {
led.lineEdit->setText(led.userChange);
} else if (!led.defaultText.isEmpty()) {
@@ -314,7 +314,7 @@ void CustomWizardFieldPage::initializePage()
if (!led.placeholderText.isEmpty())
led.lineEdit->setPlaceholderText(led.placeholderText);
}
foreach (const TextEditData &ted, m_textEdits) {
for (const TextEditData &ted : qAsConst(m_textEdits)) {
if (!ted.userChange.isNull()) {
ted.textEdit->setText(ted.userChange);
} else if (!ted.defaultText.isEmpty()) {
@@ -323,13 +323,13 @@ void CustomWizardFieldPage::initializePage()
ted.textEdit->setText(defaultText);
}
}
foreach (const PathChooserData &ped, m_pathChoosers) {
for (const PathChooserData &ped : qAsConst(m_pathChoosers)) {
if (!ped.userChange.isNull()) {
ped.pathChooser->setPath(ped.userChange);
ped.pathChooser->setFilePath(FilePath::fromUserInput(ped.userChange));
} else if (!ped.defaultText.isEmpty()) {
QString defaultText = ped.defaultText;
CustomWizardContext::replaceFields(m_context->baseReplacements, &defaultText);
ped.pathChooser->setPath(defaultText);
ped.pathChooser->setFilePath(FilePath::fromUserInput(defaultText));
}
}
}