From af38103c0d99535b549d01bac14c2ac38c97fb71 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Mon, 21 Jul 2025 00:03:26 +0800 Subject: [PATCH] UI: only show chapter button when chapter info available --- mainwindow.cpp | 11 ++++++++--- mainwindow.ui | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index b6abe4a..3a8eb00 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -61,6 +61,7 @@ MainWindow::MainWindow(QWidget *parent) m_mediaPlayer->setLoops(QMediaPlayer::Infinite); ui->playlistView->setModel(m_playlistManager->model()); + ui->chapterNameBtn->setVisible(false); ui->chapterlistView->setModel(ui->playbackProgressIndicator->chapterModel()); ui->chapterlistView->setRootIsDecorated(false); @@ -527,9 +528,13 @@ void MainWindow::initConnections() ui->chapterNameBtn->setText(currentChapterName); lastChapterName = currentChapterName; } - } else if (!lastChapterName.isEmpty()) { - ui->chapterNameBtn->setText(""); - lastChapterName.clear(); + ui->chapterNameBtn->setVisible(true); + } else { + if (!lastChapterName.isEmpty()) { + ui->chapterNameBtn->setText(""); + lastChapterName.clear(); + } + ui->chapterNameBtn->setVisible(false); } }); diff --git a/mainwindow.ui b/mainwindow.ui index e212e2a..94e1785 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -714,7 +714,7 @@ QHeaderView { About - F1 + F1 QAction::AboutRole @@ -728,7 +728,7 @@ QHeaderView { Open - Ctrl+O + Ctrl+O QAction::NoRole