qt: Add status text and icons to toolbar

This commit is contained in:
ts-korhonen
2022-01-13 08:33:29 +02:00
parent 6fbfe98b3c
commit 2bed0de162
4 changed files with 44 additions and 9 deletions

View File

@@ -69,14 +69,24 @@ MainWindow::MainWindow(QWidget *parent) :
statusBar()->setStyleSheet("QStatusBar::item {border: None; } QStatusBar QLabel { margin-right: 2px; margin-bottom: 1px; }");
ui->toolBar->setVisible(!hide_tool_bar);
auto toolbar_spacer = new QWidget();
toolbar_spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
ui->toolBar->addWidget(toolbar_spacer);
auto toolbar_label = new QLabel();
ui->toolBar->addWidget(toolbar_label);
this->setWindowIcon(QIcon(":/settings/win/icons/86Box-yellow.ico"));
this->setWindowFlag(Qt::MSWindowsFixedSizeDialogHint, vid_resize != 1);
this->setWindowFlag(Qt::WindowMaximizeButtonHint, vid_resize == 1);
this->setWindowTitle(QString("%1 - %2 %3").arg(vm_name, EMU_NAME_W, EMU_VERSION_FULL_W));
connect(this, &MainWindow::showMessageForNonQtThread, this, &MainWindow::showMessage_, Qt::BlockingQueuedConnection);
connect(this, &MainWindow::setTitle, this, [this](const QString& title) {
setWindowTitle(title);
connect(this, &MainWindow::setTitle, this, [this,toolbar_label](const QString& title) {
if (!hide_tool_bar)
toolbar_label->setText(title);
});
connect(this, &MainWindow::getTitleForNonQtThread, this, &MainWindow::getTitle_, Qt::BlockingQueuedConnection);