From 11103c1525b9c4b449d3270cd2bca729d5066444 Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Fri, 26 May 2017 03:17:14 +0200 Subject: [PATCH] Fix font color in button selection view --- src/config/buttonlistview.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/config/buttonlistview.cpp b/src/config/buttonlistview.cpp index 490e9d61..cba593ef 100644 --- a/src/config/buttonlistview.cpp +++ b/src/config/buttonlistview.cpp @@ -40,13 +40,15 @@ void ButtonListView::initButtonList() { QListWidgetItem *buttonItem = new QListWidgetItem(this); bool iconsAreWhite = false; - QString bgColor = this->palette().color(QWidget::backgroundRole()).name(); + QColor bgColor = this->palette().color(QWidget::backgroundRole()); // when the background is lighter than gray, it uses the white icons - if (bgColor < QColor(Qt::gray).name()) { + if (bgColor.valueF() < 0.6) { iconsAreWhite = true; } buttonItem->setIcon(Button::getIcon(t, iconsAreWhite)); buttonItem->setFlags(Qt::ItemIsUserCheckable); + QColor foregroundColor = this->palette().color(QWidget::foregroundRole()); + buttonItem->setTextColor(foregroundColor); buttonItem->setText(Button::getTypeName(t)); buttonItem->setToolTip(Button::getTypeTooltip(t));