refactored setTitle to just be a normal AutoConnection signal
This commit is contained in:
@@ -63,7 +63,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
connect(this, &MainWindow::showMessageForNonQtThread, this, &MainWindow::showMessage_, Qt::BlockingQueuedConnection);
|
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::getTitleForNonQtThread, this, &MainWindow::getTitle_, Qt::BlockingQueuedConnection);
|
||||||
|
|
||||||
connect(this, &MainWindow::updateMenuResizeOptions, [this]() {
|
connect(this, &MainWindow::updateMenuResizeOptions, [this]() {
|
||||||
@@ -873,20 +875,6 @@ void MainWindow::on_actionFullscreen_triggered() {
|
|||||||
rc->onResize(widget->width(), widget->height());
|
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)
|
void MainWindow::getTitle_(wchar_t *title)
|
||||||
{
|
{
|
||||||
this->windowTitle().toWCharArray(title);
|
this->windowTitle().toWCharArray(title);
|
||||||
|
@@ -25,7 +25,6 @@ public:
|
|||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
void showMessage(const QString& header, const QString& message);
|
void showMessage(const QString& header, const QString& message);
|
||||||
void setTitle(const wchar_t* title);
|
|
||||||
void getTitle(wchar_t* title);
|
void getTitle(wchar_t* title);
|
||||||
void blitToWidget(int x, int y, int w, int h);
|
void blitToWidget(int x, int y, int w, int h);
|
||||||
QSize getRenderWidgetSize();
|
QSize getRenderWidgetSize();
|
||||||
@@ -41,11 +40,11 @@ signals:
|
|||||||
void updateMenuResizeOptions();
|
void updateMenuResizeOptions();
|
||||||
void updateWindowRememberOption();
|
void updateWindowRememberOption();
|
||||||
|
|
||||||
|
void setTitle(const QString& title);
|
||||||
void setFullscreen(bool state);
|
void setFullscreen(bool state);
|
||||||
void setMouseCapture(bool state);
|
void setMouseCapture(bool state);
|
||||||
|
|
||||||
void showMessageForNonQtThread(const QString& header, const QString& message);
|
void showMessageForNonQtThread(const QString& header, const QString& message);
|
||||||
void setTitleForNonQtThread(const wchar_t* title);
|
|
||||||
void getTitleForNonQtThread(wchar_t* title);
|
void getTitleForNonQtThread(wchar_t* title);
|
||||||
private slots:
|
private slots:
|
||||||
void on_actionFullscreen_triggered();
|
void on_actionFullscreen_triggered();
|
||||||
@@ -94,7 +93,6 @@ private slots:
|
|||||||
|
|
||||||
void refreshMediaMenu();
|
void refreshMediaMenu();
|
||||||
void showMessage_(const QString& header, const QString& message);
|
void showMessage_(const QString& header, const QString& message);
|
||||||
void setTitle_(const wchar_t* title);
|
|
||||||
void getTitle_(wchar_t* title);
|
void getTitle_(wchar_t* title);
|
||||||
void on_actionTake_screenshot_triggered();
|
void on_actionTake_screenshot_triggered();
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ wchar_t* ui_window_title(wchar_t* str)
|
|||||||
main_window->getTitle(title);
|
main_window->getTitle(title);
|
||||||
str = title;
|
str = title;
|
||||||
} else {
|
} else {
|
||||||
main_window->setTitle(str);
|
emit main_window->setTitle(QString::fromWCharArray(str));
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user