Use the actual selection for instance launch.

This commit is contained in:
Petr Mrázek 2013-03-16 03:01:51 +01:00
parent b14cd8d74a
commit b84dfddd1b

View File

@ -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());
}
}