From 700225c26fe1cda4e47cecc6a36d72b772032807 Mon Sep 17 00:00:00 2001 From: Guillaume MM Date: Mon, 15 May 2017 02:01:58 +0200 Subject: [PATCH] Fix colours of buttons in notification frame --- src/frontends/qt4/GuiWorkArea.cpp | 5 +---- src/frontends/qt4/qt_helpers.cpp | 13 +++++++++++++ src/frontends/qt4/qt_helpers.h | 5 +++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index d41b5b074c..f50308f6d6 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -2220,10 +2220,7 @@ GuiWorkAreaContainer::GuiWorkAreaContainer(GuiWorkArea * wa, QWidget * parent) this, SLOT(updateDisplay())); connect(reloadPB, SIGNAL(clicked()), this, SLOT(reload())); connect(ignorePB, SIGNAL(clicked()), this, SLOT(ignore())); - QPalette const & pal = notificationFrame->palette(); - QPalette newpal(pal.color(QPalette::Active, QPalette::HighlightedText), - pal.color(QPalette::Active, QPalette::Highlight)); - notificationFrame->setPalette(newpal); + setMessageColour({notificationFrame}, {reloadPB, ignorePB}); updateDisplay(); } diff --git a/src/frontends/qt4/qt_helpers.cpp b/src/frontends/qt4/qt_helpers.cpp index dee6bd4bfe..f7ec99b131 100644 --- a/src/frontends/qt4/qt_helpers.cpp +++ b/src/frontends/qt4/qt_helpers.cpp @@ -35,6 +35,7 @@ #include "support/PathChanger.h" #include "support/Systemcall.h" +#include #include #include #include @@ -239,6 +240,18 @@ void focusAndHighlight(QAbstractItemView * w) } +void setMessageColour(list highlighted, list plain) +{ + QPalette pal = QApplication::palette(); + QPalette newpal(pal.color(QPalette::Active, QPalette::HighlightedText), + pal.color(QPalette::Active, QPalette::Highlight)); + for (QWidget * w : highlighted) + w->setPalette(newpal); + for (QWidget * w : plain) + w->setPalette(pal); +} + + /// wrapper to hide the change of method name to setSectionResizeMode void setSectionResizeMode(QHeaderView * view, int logicalIndex, QHeaderView::ResizeMode mode) { diff --git a/src/frontends/qt4/qt_helpers.h b/src/frontends/qt4/qt_helpers.h index f59b22ee76..8651889d12 100644 --- a/src/frontends/qt4/qt_helpers.h +++ b/src/frontends/qt4/qt_helpers.h @@ -83,6 +83,11 @@ void setValid(QWidget * widget, bool valid); // set focus and highlight the current item if there is no selection already void focusAndHighlight(QAbstractItemView * w); +// Sets all widget in highlighted in highlighted colour, and their children in +// plain in standard colours. +void setMessageColour(std::list highlighted, + std::list plain); + /// Qt5 changed setSectionMode to setSectionResizeMode /// These wrappers work for Qt4 and Qt5 void setSectionResizeMode(QHeaderView * view,