From e1fa4c9eb3733f0853ddcf699f140b3459be7f1a Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 5 Aug 2010 22:41:34 +0000 Subject: [PATCH] Initialize some LyX colors from Qt. Currently what is done is plain text and selection (both font and background). I am not sure that there is something else that we can get from QPalette. Maybe cursor color, if someone tells me how to get it. Only tested on mac. I can revert if this causes problems on linux or windows. I have to check too that it still works in non-gui mode. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35060 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiApplication.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 0bc02fa7a7..81a4e65d99 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -759,6 +759,13 @@ GuiApplication::~GuiApplication() } +namespace { +void setColor(ColorCode code, QPalette const & pal, QPalette::ColorRole cr) +{ + lcolor.setColor(code, fromqstr(pal.brush(QPalette::Active, cr).color().name())); +} +} + GuiApplication::GuiApplication(int & argc, char ** argv) : QApplication(argc, argv), current_view_(0), d(new GuiApplication::Private) @@ -820,6 +827,12 @@ GuiApplication::GuiApplication(int & argc, char ** argv) if (lyxrc.typewriter_font_name.empty()) lyxrc.typewriter_font_name = fromqstr(typewriterFontName()); + // initialize colors + setColor(Color_background, palette(), QPalette::Window); + setColor(Color_foreground, palette(), QPalette::WindowText); + setColor(Color_selection, palette(), QPalette::Highlight); + setColor(Color_selectiontext, palette(), QPalette::HighlightedText); + d->general_timer_.setInterval(500); connect(&d->general_timer_, SIGNAL(timeout()), this, SLOT(handleRegularEvents()));