Fix font color in button selection view

This commit is contained in:
lupoDharkael
2017-05-26 03:17:14 +02:00
parent 4bf24a4598
commit 11103c1525

View File

@@ -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));