Commit 564ae1fa authored by snooxx's avatar snooxx Committed by Tomaz Canabrava
Browse files

Fix changing non-Breeze scrollbar colors at runtime

72d604c6 refactored terminal color handling. This breaks changing
scrollbar colors at runtime for non-Breeze widget styles, since the
relevant `QEvents` will only be handled by `QWidget`-based classes, but
not by the `QObject`-based class the code was moved to.

Moving the event handling back will fix the issue.

Test Plan:
- start Konsole with Fusion widget style
- change application color scheme from dark to light: scrollbar color
  should match widget colors, without having to restart Konsole
parent 8d2582b0
Pipeline #101081 skipped
......@@ -100,20 +100,6 @@ void TerminalColor::setForegroundColor(const QColor &color)
onColorsChanged();
}
bool TerminalColor::event(QEvent *event)
{
switch (event->type()) {
case QEvent::PaletteChange:
case QEvent::ApplicationPaletteChange:
onColorsChanged();
break;
default:
break;
}
return QObject::event(event);
}
void TerminalColor::onColorsChanged()
{
QPalette palette = QApplication::palette();
......
......@@ -36,6 +36,8 @@ public:
void setColorTable(const QColor *table);
const QColor *colorTable() const;
void onColorsChanged();
void setOpacity(qreal opacity);
void visualBell();
......@@ -60,10 +62,6 @@ public Q_SLOTS:
Q_SIGNALS:
void onPalette(const QPalette &);
protected:
bool event(QEvent *event) override;
void onColorsChanged();
private Q_SLOTS:
void swapFGBGColors();
......
......@@ -2538,6 +2538,12 @@ bool TerminalDisplay::event(QEvent *event)
case QEvent::ShortcutOverride:
eventHandled = handleShortcutOverrideEvent(static_cast<QKeyEvent *>(event));
break;
case QEvent::PaletteChange:
case QEvent::ApplicationPaletteChange:
if (_terminalColor) {
_terminalColor->onColorsChanged();
}
break;
case QEvent::FocusOut:
case QEvent::FocusIn:
if (_screenWindow != nullptr) {
......
Supports Markdown
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