desktop: allow update of tab widget colors at run time

Adding a new virtual function to all of these classes may seem like overkill,
but of course the idea is that likely we'd allow similar changes to all of
them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-11-02 12:10:33 -08:00
parent 00dd98163f
commit 7d18a525f1
7 changed files with 42 additions and 23 deletions

View file

@ -34,6 +34,7 @@
#include "TabDiveStatistics.h"
#include "TabDiveSite.h"
#include "TabDiveComputer.h"
#include "core/settings/qPrefDisplay.h"
#include <QCompleter>
#include <QScrollBar>
@ -89,7 +90,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
// Alas, this is not the case. When the user switches to system-format, the preferences sends the according
// signal. However, the correct date and time format is set by the preferences dialog later. This should be fixed.
connect(PreferencesDialog::instance(), &PreferencesDialog::settingsChanged, this, &MainTab::updateDateTimeFields);
connect(qPrefDisplay::instance(), &qPrefDisplay::headerstyle_colorChanged, this, &MainTab::colorsChanged);
QAction *action = new QAction(tr("Apply changes"), this);
connect(action, SIGNAL(triggered(bool)), this, SLOT(acceptChanges()));
ui.diveNotesMessage->addAction(action);
@ -699,3 +700,9 @@ void MainTab::clearTabs()
for (auto widget: extraWidgets)
widget->clear();
}
void MainTab::colorsChanged()
{
for (TabBase *widget: extraWidgets)
widget->updateUi();
}