Viewer: dark theme, switchable live from the View menu
View > Theme offers Follow system / Light / Dark, stored in the settings. Follow system uses the desktop's colour scheme where Qt reports it (6.5+) and is light otherwise. The dark theme is a deep indigo (#1A1D3A panels, #12142B entry fields and charts). The palettes live in the new ViewerTheme module. A switch applies at once: the application stylesheet is set again after the palette so every widget is re-polished (with a stylesheet active, polished widgets otherwise keep their old palette); widgets that bake colours into stylesheets use SetThemedStyleSheet, which re-applies them on ThemeNotifier::changed; toolbar icons draw their glyph at paint time through an icon engine, so the ink follows the theme (and stays sharp at any size); charts re-theme and rebuild. Hard-coded white backgrounds on entry fields and tables are removed in favour of the palette's base colour. The idle detector-status badge in the status bar is now transparent instead of an empty default-styled progress bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f1a8c1d868
commit
0be8eb2bca
23 files changed
+311
-83
No files matched your search
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "JFJochViewerMenu.h"
|
||||
#include "RemoteDisplayMode.h"
|
||||
#include "ViewerTheme.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QApplication>
|
||||
@@ -90,6 +91,22 @@ JFJochViewerMenu::JFJochViewerMenu(QWidget *parent) : QMenuBar(parent) {
|
||||
remoteMode->setChecked(RemoteDisplayMode());
|
||||
connect(remoteMode, &QAction::toggled, this, [](bool on) { SetRemoteDisplayMode(on); });
|
||||
|
||||
viewMenu->addSeparator();
|
||||
QMenu *themeMenu = viewMenu->addMenu("Theme");
|
||||
auto *themeGroup = new QActionGroup(this);
|
||||
const ThemeChoice currentTheme = LoadThemeChoice();
|
||||
const std::pair<ThemeChoice, QString> themes[] = {{ThemeChoice::System, "Follow system"},
|
||||
{ThemeChoice::Light, "Light"},
|
||||
{ThemeChoice::Dark, "Dark"}};
|
||||
for (const auto &theme: themes) {
|
||||
const ThemeChoice choice = theme.first;
|
||||
QAction *action = themeMenu->addAction(theme.second);
|
||||
action->setCheckable(true);
|
||||
action->setChecked(choice == currentTheme);
|
||||
themeGroup->addAction(action);
|
||||
connect(action, &QAction::triggered, this, [choice] { SetThemeChoice(choice); });
|
||||
}
|
||||
|
||||
viewMenu->addSeparator();
|
||||
// The desktop's own text scaling stays the primary mechanism, but few users know where it lives,
|
||||
// so the viewer carries a zoom of its own. It multiplies the font the desktop handed us, so it
|
||||
|
||||
Reference in new issue
Block a user