diff --git a/src/mainwindow.h b/src/mainwindow.h --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -68,7 +68,6 @@ QTabWidget *m_instances = nullptr; bool askToClose(); bool askToSave(const QVector &fileList); - void atCoreInstanceNameChange(const QString &name); QString getTheme(); void initWidgets(); void loadFile(const QUrl &fileName); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -196,7 +196,9 @@ } }); - connect(newInstanceWidget, &AtCoreInstanceWidget::connectionChanged, this, &MainWindow::atCoreInstanceNameChange); + connect(newInstanceWidget, &AtCoreInstanceWidget::connectionChanged, this, [this, newInstanceWidget](const QString & newName) { + m_instances->setTabText(m_instances->indexOf(newInstanceWidget), newName); + }); if (m_instances->count() > 1) { m_instances->setTabsClosable(true); @@ -353,11 +355,6 @@ } } -void MainWindow::atCoreInstanceNameChange(const QString &name) -{ - m_instances->setTabText(sender()->objectName().toInt(), name); -} - QString MainWindow::getTheme() { return palette().text().color().value() >= QColor(Qt::lightGray).value() ? \