]> git.lyx.org Git - features.git/commitdiff
Fix colours of buttons in notification frame
authorGuillaume MM <gm@lyx.org>
Mon, 15 May 2017 00:01:58 +0000 (02:01 +0200)
committerGuillaume MM <gm@lyx.org>
Mon, 15 May 2017 00:28:48 +0000 (02:28 +0200)
src/frontends/qt4/GuiWorkArea.cpp
src/frontends/qt4/qt_helpers.cpp
src/frontends/qt4/qt_helpers.h

index d41b5b074ca454a3e7ddea3677ae2cb32969c99f..f50308f6d6498187e020ae2046ef7348490cabdd 100644 (file)
@@ -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();
 }
 
index dee6bd4bfed355a9a9a481110f9cfbbdd78c9bb0..f7ec99b13169432163956b37b3e4402031e27710 100644 (file)
@@ -35,6 +35,7 @@
 #include "support/PathChanger.h"
 #include "support/Systemcall.h"
 
+#include <QApplication>
 #include <QCheckBox>
 #include <QComboBox>
 #include <QLineEdit>
@@ -239,6 +240,18 @@ void focusAndHighlight(QAbstractItemView * w)
 }
 
 
+void setMessageColour(list<QWidget *> highlighted, list<QWidget *> 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) {
index f59b22ee76c28a46a9142d03ca5e19a8a0d2a374..8651889d1288cb529c9df2fd5979ff59655b7518 100644 (file)
@@ -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<QWidget *> highlighted,
+                      std::list<QWidget *> plain);
+
 /// Qt5 changed setSectionMode to setSectionResizeMode
 /// These wrappers work for Qt4 and Qt5
 void setSectionResizeMode(QHeaderView * view,