forked from qt-creator/qt-creator
Wizards: Fix updating path chooser
Do not update the path chooser from the same slot where the path chooser gets validated or we end up inside a soft assert of the path chooser's (locked) guard. Currently no harm as the project chooser is not used actively and no page is declared as a sub project on this page yet. Change-Id: I641bb7da55de5919c772b1fa29693f4fa75d4a7c Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -136,7 +136,7 @@ ProjectIntroPage::ProjectIntroPage(QWidget *parent) :
|
||||
connect(d->m_nameLineEdit, &FancyLineEdit::validReturnPressed,
|
||||
this, &ProjectIntroPage::slotActivated);
|
||||
connect(d->m_projectComboBox, &QComboBox::currentIndexChanged,
|
||||
this, &ProjectIntroPage::slotChanged);
|
||||
this, &ProjectIntroPage::onCurrentProjectIndexChanged);
|
||||
|
||||
setProperty(SHORT_TITLE_PROPERTY, Tr::tr("Location"));
|
||||
registerFieldWithName(QLatin1String("Path"), d->m_pathChooser, "path", SIGNAL(textChanged(QString)));
|
||||
@@ -193,12 +193,6 @@ bool ProjectIntroPage::isComplete() const
|
||||
|
||||
bool ProjectIntroPage::validate()
|
||||
{
|
||||
if (d->m_forceSubProject) {
|
||||
int index = d->m_projectComboBox->currentIndex();
|
||||
if (index == 0)
|
||||
return false;
|
||||
d->m_pathChooser->setFilePath(d->m_projectDirectories.at(index));
|
||||
}
|
||||
// Validate and display status
|
||||
if (!d->m_pathChooser->isValid()) {
|
||||
if (const QString msg = d->m_pathChooser->errorMessage(); !msg.isEmpty())
|
||||
@@ -261,6 +255,25 @@ void ProjectIntroPage::slotActivated()
|
||||
emit activated();
|
||||
}
|
||||
|
||||
void ProjectIntroPage::onCurrentProjectIndexChanged(int index)
|
||||
{
|
||||
if (d->m_forceSubProject) {
|
||||
const int available = d->m_projectDirectories.size();
|
||||
if (available == 0)
|
||||
return;
|
||||
QTC_ASSERT(index < available, return);
|
||||
if (index < 0)
|
||||
return;
|
||||
|
||||
const FilePath current = d->m_projectDirectories.at(index);
|
||||
const FilePath visible = d->m_pathChooser->filePath();
|
||||
if (visible != current && !visible.isChildOf(current))
|
||||
d->m_pathChooser->setFilePath(current);
|
||||
|
||||
fieldsUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
bool ProjectIntroPage::forceSubProject() const
|
||||
{
|
||||
return d->m_forceSubProject;
|
||||
|
@@ -58,6 +58,7 @@ public slots:
|
||||
private:
|
||||
void slotChanged();
|
||||
void slotActivated();
|
||||
void onCurrentProjectIndexChanged(int index);
|
||||
|
||||
bool validate();
|
||||
void displayStatusMessage(InfoLabel::InfoType t, const QString &);
|
||||
|
Reference in New Issue
Block a user