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
This commit is contained in:
Jean-Marc Lasgouttes 2010-08-05 22:41:34 +00:00
parent 63e26fa778
commit e1fa4c9eb3

View 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()));