summaryrefslogtreecommitdiffstats
path: root/gui/mainwindow.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-03-16 03:01:51 +0100
committerPetr Mrázek <peterix@gmail.com>2013-03-16 03:01:51 +0100
commitb84dfddd1b24e82dccb5a20d9c30570d26846e76 (patch)
treece5c9d0cf5427f10efb34ef52b978a8bb3bfc0a2 /gui/mainwindow.cpp
parentb14cd8d74a7fe2046bf0c208987536c175592f2b (diff)
downloadMultiMC-b84dfddd1b24e82dccb5a20d9c30570d26846e76.tar
MultiMC-b84dfddd1b24e82dccb5a20d9c30570d26846e76.tar.gz
MultiMC-b84dfddd1b24e82dccb5a20d9c30570d26846e76.tar.lz
MultiMC-b84dfddd1b24e82dccb5a20d9c30570d26846e76.tar.xz
MultiMC-b84dfddd1b24e82dccb5a20d9c30570d26846e76.zip
Use the actual selection for instance launch.
Diffstat (limited to 'gui/mainwindow.cpp')
-rw-r--r--gui/mainwindow.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index e691c8c4..676ec45e 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -198,10 +198,18 @@ void MainWindow::on_instanceView_customContextMenuRequested ( const QPoint &pos
void MainWindow::on_actionLaunchInstance_triggered()
{
- QModelIndex index = view->currentIndex();
- if(index.isValid())
+ QAbstractItemView * iv = view;
+ auto smodel = iv->selectionModel();
+ QModelIndex mindex;
+ if(smodel->hasSelection())
{
- Instance * inst = (Instance *) index.data(InstanceModel::InstancePointerRole).value<void *>();
+ auto rows = smodel->selectedRows();
+ mindex = rows.at(0);
+ }
+
+ if(mindex.isValid())
+ {
+ Instance * inst = (Instance *) mindex.data(InstanceModel::InstancePointerRole).value<void *>();
doLogin(inst->id());
}
}