diff options
author | janrupf <werbung.janrupf@t-online.de> | 2019-06-17 16:13:52 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2019-06-21 22:38:26 +0200 |
commit | 306b98edacab8d1ad819d1b66fa54789b3e0bdea (patch) | |
tree | 54a78d6634f1ed2f3713bad31b8816bfc25ab75b /application | |
parent | ce12f1a734e08f1653aa482279a4dc6b6f3667eb (diff) | |
download | MultiMC-306b98edacab8d1ad819d1b66fa54789b3e0bdea.tar MultiMC-306b98edacab8d1ad819d1b66fa54789b3e0bdea.tar.gz MultiMC-306b98edacab8d1ad819d1b66fa54789b3e0bdea.tar.lz MultiMC-306b98edacab8d1ad819d1b66fa54789b3e0bdea.tar.xz MultiMC-306b98edacab8d1ad819d1b66fa54789b3e0bdea.zip |
GH-2592 Autoselect newly created instances
Diffstat (limited to 'application')
-rw-r--r-- | application/MainWindow.cpp | 8 | ||||
-rw-r--r-- | application/MainWindow.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index bec57c0d..ca98130e 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -702,6 +702,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow // model reset -> selection is invalid. All the instance pointers are wrong. 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 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) { auto current = view->selectionModel()->currentIndex(); diff --git a/application/MainWindow.h b/application/MainWindow.h index 7691d50e..ea5b9847 100644 --- a/application/MainWindow.h +++ b/application/MainWindow.h @@ -152,6 +152,8 @@ private slots: void instanceChanged(const QModelIndex ¤t, const QModelIndex &previous); + void instanceAdded(QString id); + void instanceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); void selectionBad(); |