diff --git a/libs/widgets/qcodeedit.cpp b/libs/widgets/qcodeedit.cpp index cb73bd1..64d5035 100644 --- a/libs/widgets/qcodeedit.cpp +++ b/libs/widgets/qcodeedit.cpp @@ -548,6 +548,7 @@ bool QCodeEdit::eventFilter(QObject * o, QEvent * e) { void QCodeEdit::showEvent(QShowEvent *) { + detectTheme(); if (!_first) return; _first = false; completer->installEventFilter(this); @@ -584,7 +585,7 @@ void QCodeEdit::changeEvent(QEvent * e) { ui->retranslateUi(this); lbl_help[lhF1]->setText(tr("Press F1 for details")); break; - case QEvent::PaletteChange: is_dark_theme = palette().color(QPalette::Window).valueF() < 0.5; break; + case QEvent::PaletteChange: detectTheme(); break; default: break; } } @@ -1716,6 +1717,11 @@ QCodeEdit::ACEntry QCodeEdit::findEntryOnCursor(QTextCursor tc, int arg, ACClass } +void QCodeEdit::detectTheme() { + is_dark_theme = palette().color(QPalette::Window).valueF() < 0.5; +} + + void QCodeEdit::raiseHelp(QTextCursor tc, int arg) { ACClass acc; QPair scope; diff --git a/libs/widgets/qcodeedit.h b/libs/widgets/qcodeedit.h index 64ad940..7caa9aa 100644 --- a/libs/widgets/qcodeedit.h +++ b/libs/widgets/qcodeedit.h @@ -230,6 +230,7 @@ private: void createBlockSelection(); void cancelDragCursor(); ACEntry findEntryOnCursor(QTextCursor tc, int arg = -1, ACClass * acc = nullptr, QPair * scope = nullptr); + void detectTheme(); Ui::QCodeEdit * ui; QCodeEditCompleter * completer;