refactored setTitle to just be a normal AutoConnection signal

This commit is contained in:
Joakim L. Gilje
2021-12-14 20:30:09 +01:00
parent 61ab0e60ca
commit dec90c7ae0
3 changed files with 5 additions and 19 deletions

View File

@@ -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);