KTextAddons

textautogeneratecolorsandmessageviewstyle.cpp
1/*
2 SPDX-FileCopyrightText: 2022 Nicolas Fella <nicolas.fella@gmx.de>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "textautogeneratecolorsandmessageviewstyle.h"
8
9#include <QApplication>
10using namespace TextAutogenerateText;
11TextAutogenerateColorsAndMessageViewStyle::TextAutogenerateColorsAndMessageViewStyle()
12{
13 regenerateColorScheme();
14 qGuiApp->installEventFilter(this);
15}
16
17bool TextAutogenerateColorsAndMessageViewStyle::eventFilter(QObject *obj, QEvent *event)
18{
19 Q_UNUSED(obj);
21 regenerateColorScheme();
22 }
23 return false;
24}
25
26TextAutogenerateColorsAndMessageViewStyle &TextAutogenerateColorsAndMessageViewStyle::self()
27{
28 static TextAutogenerateColorsAndMessageViewStyle c;
29 return c;
30}
31
32KColorScheme TextAutogenerateColorsAndMessageViewStyle::schemeView() const
33{
34 return mSchemeView;
35}
36
37KColorScheme TextAutogenerateColorsAndMessageViewStyle::schemeWindow() const
38{
39 return mSchemeWindow;
40}
41
42void TextAutogenerateColorsAndMessageViewStyle::regenerateColorScheme()
43{
44 const KColorScheme colorScheme(QPalette::Active, KColorScheme::Window);
45 if (!(mSchemeWindow == colorScheme)) {
46 mSchemeView = KColorScheme();
47 mSchemeWindow = std::move(colorScheme);
48 Q_EMIT needToUpdateColors();
49 }
50}
51
52#include "moc_textautogeneratecolorsandmessageviewstyle.cpp"
ApplicationPaletteChange
Q_EMITQ_EMIT
virtual bool event(QEvent *e)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri May 2 2025 12:06:03 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.