Am Donnerstag, dem 04.03.2021 um 08:24 +0100 schrieb Jürgen Spitzmüller: > Ah, that's this issue. We discussed this already. I remember you > mentioned some signal that is emitted on the Mac when the switch > happens and that you intended to investigate how dark mode in LyX can > be connected to this signal.
Stephan, can you try (and, if needed, play a bit) with the attached attempt? This draws on your observations here: https://marc.info/?l=lyx-devel&m=160786312519532&w=2 Jürgen
diff --git a/src/frontends/qt/GuiToolbar.cpp b/src/frontends/qt/GuiToolbar.cpp index 5600f4a74f..8057d84a70 100644 --- a/src/frontends/qt/GuiToolbar.cpp +++ b/src/frontends/qt/GuiToolbar.cpp @@ -116,6 +116,14 @@ void GuiToolbar::fill() } +void GuiToolbar::refill() +{ + filled_ = false; + clear(); + fill(); +} + + void GuiToolbar::showEvent(QShowEvent * ev) { fill(); diff --git a/src/frontends/qt/GuiToolbar.h b/src/frontends/qt/GuiToolbar.h index 262b09ef07..d658f3f51b 100644 --- a/src/frontends/qt/GuiToolbar.h +++ b/src/frontends/qt/GuiToolbar.h @@ -152,6 +152,9 @@ public: /// void toggle(); + /// + void refill(); + /// toggles movability void movable(bool silent = false); diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp index a48540d28c..389e46eb21 100644 --- a/src/frontends/qt/GuiView.cpp +++ b/src/frontends/qt/GuiView.cpp @@ -1470,6 +1470,11 @@ bool GuiView::event(QEvent * e) return QMainWindow::event(e); } + case QEvent::ApplicationPaletteChange: { + refillToolbars(); + return QMainWindow::event(e); + } + default: return QMainWindow::event(e); } @@ -1739,6 +1744,13 @@ void GuiView::updateToolbars() } +void GuiView::refillToolbars() +{ + for (auto const & tb_p : d.toolbars_) + tb_p.second->refill(); +} + + void GuiView::setBuffer(Buffer * newBuffer, bool switch_to) { LYXERR(Debug::DEBUG, "Setting buffer: " << newBuffer << endl); diff --git a/src/frontends/qt/GuiView.h b/src/frontends/qt/GuiView.h index 4c610e0ef9..f5024e5ef4 100644 --- a/src/frontends/qt/GuiView.h +++ b/src/frontends/qt/GuiView.h @@ -149,6 +149,8 @@ public: /// updates the possible layouts selectable void updateLayoutList(); void updateToolbars(); + /// refill the toolbars (dark mode switch) + void refillToolbars(); /// LayoutBox * getLayoutDialog() const;
signature.asc
Description: This is a digitally signed message part
-- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel