GH-2592 Autoselect newly created instances
This commit is contained in:
parent
ce12f1a734
commit
306b98edac
@ -819,6 +819,7 @@ bool InstanceList::commitStagedInstance(const QString& path, const QString& inst
|
|||||||
instanceSet.insert(instID);
|
instanceSet.insert(instID);
|
||||||
m_groups.insert(groupName);
|
m_groups.insert(groupName);
|
||||||
emit instancesChanged();
|
emit instancesChanged();
|
||||||
|
emit instanceAdded(instID);
|
||||||
}
|
}
|
||||||
saveGroupList();
|
saveGroupList();
|
||||||
return true;
|
return true;
|
||||||
|
@ -129,6 +129,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void dataIsInvalid();
|
void dataIsInvalid();
|
||||||
void instancesChanged();
|
void instancesChanged();
|
||||||
|
void instanceAdded(QString instanceId);
|
||||||
void groupsChanged(QSet<QString> groups);
|
void groupsChanged(QSet<QString> groups);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -702,6 +702,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
|
|||||||
// model reset -> selection is invalid. All the instance pointers are wrong.
|
// model reset -> selection is invalid. All the instance pointers are wrong.
|
||||||
connect(MMC->instances().get(), &InstanceList::dataIsInvalid, this, &MainWindow::selectionBad);
|
connect(MMC->instances().get(), &InstanceList::dataIsInvalid, this, &MainWindow::selectionBad);
|
||||||
|
|
||||||
|
// handle newly added instances
|
||||||
|
connect(MMC->instances().get(), &InstanceList::instanceAdded, this, &MainWindow::instanceAdded);
|
||||||
|
|
||||||
// When the global settings page closes, we want to know about it and update our state
|
// When the global settings page closes, we want to know about it and update our state
|
||||||
connect(MMC, &MultiMC::globalSettingsClosed, this, &MainWindow::globalSettingsClosed);
|
connect(MMC, &MultiMC::globalSettingsClosed, this, &MainWindow::globalSettingsClosed);
|
||||||
|
|
||||||
@ -1836,6 +1839,11 @@ void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::instanceAdded(QString id)
|
||||||
|
{
|
||||||
|
setSelectedInstanceById(id);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::instanceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
void MainWindow::instanceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
||||||
{
|
{
|
||||||
auto current = view->selectionModel()->currentIndex();
|
auto current = view->selectionModel()->currentIndex();
|
||||||
|
@ -152,6 +152,8 @@ private slots:
|
|||||||
|
|
||||||
void instanceChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
void instanceChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||||
|
|
||||||
|
void instanceAdded(QString id);
|
||||||
|
|
||||||
void instanceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
void instanceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||||
|
|
||||||
void selectionBad();
|
void selectionBad();
|
||||||
|
Loading…
Reference in New Issue
Block a user