Implement title bar statistics

This commit is contained in:
Cacodemon345
2021-12-01 15:55:41 +06:00
parent ac52b32adb
commit 88452f7957
4 changed files with 48 additions and 3 deletions

View File

@@ -48,6 +48,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::getTitleForNonQtThread, this, &MainWindow::getTitle_, Qt::BlockingQueuedConnection);
connect(this, &MainWindow::pollMouse, ui->glesWidget, &GLESWidget::qt_mouse_poll);
connect(this, &MainWindow::setMouseCapture, this, [this](bool state) {
@@ -641,6 +644,34 @@ void MainWindow::on_actionFullscreen_triggered() {
}
}
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);
}
void MainWindow::getTitle(wchar_t *title)
{
if (QThread::currentThread() == this->thread()) {
getTitle_(title);
} else {
emit getTitleForNonQtThread(title);
}
}
void MainWindow::showMessage(const QString& header, const QString& message) {
if (QThread::currentThread() == this->thread()) {
showMessage_(header, message);