Fix colours of buttons in notification frame

This commit is contained in:
Guillaume MM 2017-05-15 02:01:58 +02:00
parent 752a0a1e48
commit 700225c26f
3 changed files with 19 additions and 4 deletions

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

View 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) {

View 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,