Use the actual selection for instance launch.
This commit is contained in:
parent
b14cd8d74a
commit
b84dfddd1b
@ -198,10 +198,18 @@ void MainWindow::on_instanceView_customContextMenuRequested ( const QPoint &pos
|
|||||||
|
|
||||||
void MainWindow::on_actionLaunchInstance_triggered()
|
void MainWindow::on_actionLaunchInstance_triggered()
|
||||||
{
|
{
|
||||||
QModelIndex index = view->currentIndex();
|
QAbstractItemView * iv = view;
|
||||||
if(index.isValid())
|
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());
|
doLogin(inst->id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user