VersionSelectDialog is for SELECTING versions.

Not blinking in and out of existence. That is not the job of a version SELECTION dialog.
This commit is contained in:
Petr Mrázek 2014-11-16 01:56:07 +01:00
parent 940f160091
commit 1d5c09051c
2 changed files with 1 additions and 18 deletions

View File

@ -89,7 +89,7 @@ protected:
VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent, VersionSelectDialog::VersionSelectDialog(BaseVersionList *vlist, QString title, QWidget *parent,
bool cancelable) bool cancelable)
: QDialog(parent), ui(new Ui::VersionSelectDialog), m_useLatest(false) : QDialog(parent), ui(new Ui::VersionSelectDialog)
{ {
MultiMCPlatform::fixWM_CLASS(this); MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this); ui->setupUi(this);
@ -128,11 +128,6 @@ void VersionSelectDialog::setResizeOn(int column)
ui->listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::Stretch); ui->listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::Stretch);
} }
void VersionSelectDialog::setUseLatest(const bool useLatest)
{
m_useLatest = useLatest;
}
int VersionSelectDialog::exec() int VersionSelectDialog::exec()
{ {
QDialog::open(); QDialog::open();
@ -141,17 +136,6 @@ int VersionSelectDialog::exec()
loadList(); loadList();
} }
m_proxyModel->invalidate(); m_proxyModel->invalidate();
if (m_proxyModel->rowCount() == 0)
{
QLOG_DEBUG() << "No rows in version list";
return QDialog::Rejected;
}
if (m_proxyModel->rowCount() == 1 || m_useLatest)
{
ui->listView->selectionModel()->setCurrentIndex(m_proxyModel->index(0, 0),
QItemSelectionModel::ClearAndSelect);
return QDialog::Accepted;
}
return QDialog::exec(); return QDialog::exec();
} }

View File

@ -63,5 +63,4 @@ private:
VersionSelectProxyModel *m_proxyModel; VersionSelectProxyModel *m_proxyModel;
int resizeOnColumn = 0; int resizeOnColumn = 0;
bool m_useLatest;
}; };