GH-2219 fix crash and bad view scaling in Java VersionSelectDialog

This commit is contained in:
Petr Mrázek 2018-04-02 22:58:02 +02:00
parent c9832d0d86
commit 3406335cd8
3 changed files with 7 additions and 2 deletions

View File

@ -101,13 +101,17 @@ void VersionSelectDialog::setEmptyErrorString(QString emptyErrorString)
void VersionSelectDialog::setResizeOn(int column) void VersionSelectDialog::setResizeOn(int column)
{ {
m_versionWidget->setResizeOn(column); resizeOnColumn = column;
} }
int VersionSelectDialog::exec() int VersionSelectDialog::exec()
{ {
QDialog::open(); QDialog::open();
m_versionWidget->initialize(m_vlist); m_versionWidget->initialize(m_vlist);
if(resizeOnColumn != -1)
{
m_versionWidget->setResizeOn(resizeOnColumn);
}
return QDialog::exec(); return QDialog::exec();
} }

View File

@ -72,7 +72,7 @@ private:
VersionProxyModel *m_proxyModel = nullptr; VersionProxyModel *m_proxyModel = nullptr;
int resizeOnColumn = 0; int resizeOnColumn = -1;
Task * loadTask = nullptr; Task * loadTask = nullptr;
}; };

View File

@ -104,6 +104,7 @@ void JavaPage::on_javaDetectBtn_clicked()
JavaInstallPtr java; JavaInstallPtr java;
VersionSelectDialog vselect(MMC->javalist().get(), tr("Select a Java version"), this, true); VersionSelectDialog vselect(MMC->javalist().get(), tr("Select a Java version"), this, true);
vselect.setResizeOn(2);
vselect.exec(); vselect.exec();
if (vselect.result() == QDialog::Accepted && vselect.selectedVersion()) if (vselect.result() == QDialog::Accepted && vselect.selectedVersion())