From 6e88c0062c5629ba1fd6ee97730418d34cc07424 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 17 Aug 2016 12:10:25 +0200 Subject: [PATCH] Use proper QPalette::NoRole enum value instead of our own --- src/frontends/qt4/ColorCache.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/frontends/qt4/ColorCache.cpp b/src/frontends/qt4/ColorCache.cpp index 9c5adb4f65..f5dd963ffe 100644 --- a/src/frontends/qt4/ColorCache.cpp +++ b/src/frontends/qt4/ColorCache.cpp @@ -18,8 +18,6 @@ namespace lyx { namespace{ -// FIXME (later): Qt >= 4.4 has a proper QPalette::NoRole value. -QPalette::ColorRole const NoRole = static_cast(-1); QPalette::ColorRole role(ColorCode col) { @@ -33,7 +31,7 @@ QPalette::ColorRole role(ColorCode col) case Color_mathcorners: return QPalette::Base; break; - + case Color_foreground: case Color_cursor: case Color_preview: @@ -41,7 +39,7 @@ QPalette::ColorRole role(ColorCode col) case Color_previewframe: return QPalette::Text; break; - + case Color_selection: return QPalette::Highlight; break; @@ -52,7 +50,7 @@ QPalette::ColorRole role(ColorCode col) case Color_urltext: return QPalette::Link; default: - return NoRole; + return QPalette::NoRole; } } @@ -83,7 +81,7 @@ QColor ColorCache::get(Color const & color, bool syscolors) const const_cast(this)->init(); if (color <= Color_ignore && color.mergeColor == Color_ignore) { QPalette::ColorRole const cr = role(color.baseColor); - if (syscolors && cr != NoRole) { + if (syscolors && cr != QPalette::NoRole) { static QColor const white = Qt::white; QColor const c = pal_.brush(QPalette::Active, cr).color(); if (cr == QPalette::Base && c == white) @@ -104,7 +102,7 @@ QColor ColorCache::get(Color const & color, bool syscolors) const (base_color.blue() + merge_color.blue()) / 2); } // used by branches - return QColor(lcolor.getX11Name(color.baseColor).c_str()); + return QColor(lcolor.getX11Name(color.baseColor).c_str()); } @@ -115,7 +113,7 @@ bool ColorCache::isSystem(ColorCode const color) const static QColor const white = Qt::white; return pal_.brush(QPalette::Active, cr).color() != white; } else - return cr != NoRole; + return cr != QPalette::NoRole; }