Commit af3bb5f9 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Update color when theme changed

parent 7dc393ef
Pipeline #160291 failed with stage
in 15 minutes and 48 seconds
......@@ -14,6 +14,7 @@
#include <KColorScheme>
#include <QAction>
#include <QApplication>
#include <QMenu>
#include <QPainter>
#include <QTextBlock>
......@@ -24,6 +25,9 @@ GrammarResultTextEdit::GrammarResultTextEdit(QWidget *parent)
{
setReadOnly(true);
setAcceptRichText(false);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
connect(qApp, &QApplication::paletteChanged, this, &GrammarResultTextEdit::generalPaletteChanged);
#endif
generalPaletteChanged();
}
......@@ -51,6 +55,16 @@ void GrammarResultTextEdit::paintEvent(QPaintEvent *event)
}
}
bool GrammarResultTextEdit::event(QEvent *ev)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (ev->type() == QEvent::ApplicationPaletteChange) {
regenerateColorScheme();
}
#endif
return QTextEdit::event(ev);
}
void GrammarResultTextEdit::generalPaletteChanged()
{
const QPalette palette = viewport()->palette();
......
......@@ -27,6 +27,7 @@ protected:
void paintEvent(QPaintEvent *event) override;
bool event(QEvent *ev) override;
Q_SIGNALS:
void replaceText(const MessageComposer::PluginGrammarAction &act);
void checkAgain();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment