fix bug with buton not updating corectly for java dialog
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
7d9e47ac18
commit
0b05c7cb07
@ -259,14 +259,14 @@ InstallDialog::InstallDialog(const QString& uid, BaseInstance* instance, QWidget
|
||||
|
||||
auto cast = pageCast(page);
|
||||
cast->setRecomend(true);
|
||||
connect(cast, &InstallJavaPage::selectionChanged, this, [this] { validate(); });
|
||||
connect(cast, &InstallJavaPage::selectionChanged, this, [this, cast] { validate(cast); });
|
||||
if (!recommendedJavas.isEmpty()) {
|
||||
cast->setRecommendedMajors(recommendedJavas);
|
||||
}
|
||||
}
|
||||
connect(container, &PageContainer::selectedPageChanged, this, [this] { validate(); });
|
||||
connect(container, &PageContainer::selectedPageChanged, this, [this](BasePage* previous, BasePage* selected) { validate(selected); });
|
||||
pageCast(container->selectedPage())->selectSearch();
|
||||
validate();
|
||||
validate(container->selectedPage());
|
||||
}
|
||||
|
||||
QList<BasePage*> InstallDialog::getPages()
|
||||
@ -286,10 +286,9 @@ QString InstallDialog::dialogTitle()
|
||||
return tr("Install Java");
|
||||
}
|
||||
|
||||
void InstallDialog::validate()
|
||||
void InstallDialog::validate(BasePage* selected)
|
||||
{
|
||||
buttons->button(QDialogButtonBox::Ok)
|
||||
->setEnabled(!!std::dynamic_pointer_cast<Java::Metadata>(pageCast(container->selectedPage())->selectedVersion()));
|
||||
buttons->button(QDialogButtonBox::Ok)->setEnabled(!!std::dynamic_pointer_cast<Java::Metadata>(pageCast(selected)->selectedVersion()));
|
||||
}
|
||||
|
||||
void InstallDialog::done(int result)
|
||||
|
@ -37,7 +37,7 @@ class InstallDialog final : public QDialog, private BasePageProvider {
|
||||
QList<BasePage*> getPages() override;
|
||||
QString dialogTitle() override;
|
||||
|
||||
void validate();
|
||||
void validate(BasePage* selected);
|
||||
void done(int result) override;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user