diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 8a8df2491..ad3e950f6 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -63,7 +63,9 @@ MainWindow::MainWindow(QWidget *parent) : connect(this, &MainWindow::showMessageForNonQtThread, this, &MainWindow::showMessage_, Qt::BlockingQueuedConnection); - connect(this, &MainWindow::setTitleForNonQtThread, this, &MainWindow::setTitle_, Qt::BlockingQueuedConnection); + connect(this, &MainWindow::setTitle, this, [this](const QString& title) { + setWindowTitle(title); + }); connect(this, &MainWindow::getTitleForNonQtThread, this, &MainWindow::getTitle_, Qt::BlockingQueuedConnection); connect(this, &MainWindow::updateMenuResizeOptions, [this]() { @@ -873,20 +875,6 @@ void MainWindow::on_actionFullscreen_triggered() { rc->onResize(widget->width(), widget->height()); } -void MainWindow::setTitle_(const wchar_t *title) -{ - this->setWindowTitle(QString::fromWCharArray(title)); -} - -void MainWindow::setTitle(const wchar_t *title) -{ - if (QThread::currentThread() == this->thread()) { - setTitle_(title); - } else { - emit setTitleForNonQtThread(title); - } -} - void MainWindow::getTitle_(wchar_t *title) { this->windowTitle().toWCharArray(title); diff --git a/src/qt/qt_mainwindow.hpp b/src/qt/qt_mainwindow.hpp index 01586df3e..a7d423f68 100644 --- a/src/qt/qt_mainwindow.hpp +++ b/src/qt/qt_mainwindow.hpp @@ -25,7 +25,6 @@ public: ~MainWindow(); void showMessage(const QString& header, const QString& message); - void setTitle(const wchar_t* title); void getTitle(wchar_t* title); void blitToWidget(int x, int y, int w, int h); QSize getRenderWidgetSize(); @@ -41,11 +40,11 @@ signals: void updateMenuResizeOptions(); void updateWindowRememberOption(); + void setTitle(const QString& title); void setFullscreen(bool state); void setMouseCapture(bool state); void showMessageForNonQtThread(const QString& header, const QString& message); - void setTitleForNonQtThread(const wchar_t* title); void getTitleForNonQtThread(wchar_t* title); private slots: void on_actionFullscreen_triggered(); @@ -94,7 +93,6 @@ private slots: void refreshMediaMenu(); void showMessage_(const QString& header, const QString& message); - void setTitle_(const wchar_t* title); void getTitle_(wchar_t* title); void on_actionTake_screenshot_triggered(); diff --git a/src/qt/qt_ui.cpp b/src/qt/qt_ui.cpp index d00e262e3..b18a1090b 100644 --- a/src/qt/qt_ui.cpp +++ b/src/qt/qt_ui.cpp @@ -28,7 +28,7 @@ wchar_t* ui_window_title(wchar_t* str) main_window->getTitle(title); str = title; } else { - main_window->setTitle(str); + emit main_window->setTitle(QString::fromWCharArray(str)); } return str; }