]> git.lyx.org Git - features.git/commitdiff
Initialize some LyX colors from Qt. Currently what is done is plain text and selectio...
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 5 Aug 2010 22:41:34 +0000 (22:41 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 5 Aug 2010 22:41:34 +0000 (22:41 +0000)
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

index 0bc02fa7a7828f8ce2d9caa240442f4cd4284ee1..81a4e65d993663a303fe4d951a6113ec2747aa06 100644 (file)
@@ -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()));