2026-05-30 10:53:44 +03:00
|
|
|
#include "linuxtraytheme.h"
|
|
|
|
|
|
|
|
|
|
#include "platforms/linux/linuxutils.h"
|
2026-05-30 12:55:27 +03:00
|
|
|
#include "ui/utils/trayThemeChangeFilter.h"
|
2026-05-30 10:53:44 +03:00
|
|
|
|
2026-05-30 12:55:27 +03:00
|
|
|
#include <QApplication>
|
2026-05-30 10:53:44 +03:00
|
|
|
#include <QGuiApplication>
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QStyleHints>
|
|
|
|
|
|
|
|
|
|
void LinuxTrayTheme::installThemeObserver(const std::function<void()> &onThemeChanged, QObject *parent)
|
|
|
|
|
{
|
|
|
|
|
if (!onThemeChanged || !parent) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (QStyleHints *styleHints = QGuiApplication::styleHints()) {
|
|
|
|
|
QObject::connect(styleHints, &QStyleHints::colorSchemeChanged, parent, [onThemeChanged]() { onThemeChanged(); });
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-30 12:55:27 +03:00
|
|
|
qApp->installEventFilter(new TrayThemeChangeFilter(onThemeChanged, parent));
|
|
|
|
|
|
2026-05-30 10:53:44 +03:00
|
|
|
LinuxUtils::installThemeChangeObserver(onThemeChanged);
|
|
|
|
|
}
|