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(); + auto rows = smodel->selectedRows(); + mindex = rows.at(0); + } + + if(mindex.isValid()) + { + Instance * inst = (Instance *) mindex.data(InstanceModel::InstancePointerRole).value(); doLogin(inst->id()); } }