fix: support editing instance names

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2022-10-03 16:01:51 +02:00
parent 7a5f49571d
commit 2bf8fa9cb4
No known key found for this signature in database
GPG Key ID: C10411294912A422
3 changed files with 12 additions and 7 deletions

View File

@ -1361,9 +1361,6 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *ev)
case Qt::Key_F5:
refreshInstances();
return true;
case Qt::Key_F2:
on_actionRenameInstance_triggered();
return true;
default:
break;
}
@ -1855,10 +1852,8 @@ void MainWindow::on_actionExportInstance_triggered()
void MainWindow::on_actionRenameInstance_triggered()
{
if (m_selectedInstance)
{
// FIXME
}
// NOTE: editSelected already checky if an instance is selected
view->editSelected();
}
void MainWindow::on_actionViewSelectedInstFolder_triggered()

View File

@ -58,6 +58,14 @@ void InstanceView::switchDisplayMode(InstanceView::DisplayMode mode)
}
}
void InstanceView::editSelected()
{
auto current = currentView()->selectionModel()->currentIndex();
if (current.isValid()) {
currentView()->edit(current);
}
}
void InstanceView::prepareModel()
{
m_tableProxy = new InstanceTableProxyModel(this);

View File

@ -52,6 +52,8 @@ class InstanceView : public QStackedWidget {
void setCatDisplayed(bool enabled);
void editSelected();
signals:
void instanceActivated(InstancePtr inst);
void currentInstanceChanged(InstancePtr current, InstancePtr previous);