1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Fix drawing text with correct color in item delegates on Windows

This commit is contained in:
David Rosca 2017-02-07 15:47:41 +01:00
parent 1c1c35522b
commit 85f8cf881e
5 changed files with 39 additions and 8 deletions

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
* QupZilla - Qt web browser
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -72,6 +72,12 @@ void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewI
if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active)) {
cg = QPalette::Inactive;
}
#ifdef Q_OS_WIN
opt.palette.setColor(QPalette::All, QPalette::HighlightedText, opt.palette.color(QPalette::Active, QPalette::Text));
opt.palette.setColor(QPalette::All, QPalette::Highlight, opt.palette.base().color().darker(108));
#endif
QPalette textPalette = opt.palette;
textPalette.setCurrentColorGroup(cg);

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
* QupZilla - Qt web browser
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -52,6 +52,12 @@ void PluginListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op
if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active)) {
cg = QPalette::Inactive;
}
#ifdef Q_OS_WIN
opt.palette.setColor(QPalette::All, QPalette::HighlightedText, opt.palette.color(QPalette::Active, QPalette::Text));
opt.palette.setColor(QPalette::All, QPalette::Highlight, opt.palette.base().color().darker(108));
#endif
QPalette textPalette = opt.palette;
textPalette.setCurrentColorGroup(cg);

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
* QupZilla - Qt web browser
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -63,6 +63,12 @@ void ListItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem &opti
if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active)) {
cg = QPalette::Inactive;
}
#ifdef Q_OS_WIN
opt.palette.setColor(QPalette::All, QPalette::HighlightedText, opt.palette.color(QPalette::Active, QPalette::Text));
opt.palette.setColor(QPalette::All, QPalette::Highlight, opt.palette.base().color().darker(108));
#endif
QPalette textPalette = opt.palette;
textPalette.setCurrentColorGroup(cg);

View File

@ -67,6 +67,12 @@ void GM_SettingsListDelegate::paint(QPainter* painter, const QStyleOptionViewIte
if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active)) {
cg = QPalette::Inactive;
}
#ifdef Q_OS_WIN
opt.palette.setColor(QPalette::All, QPalette::HighlightedText, opt.palette.color(QPalette::Active, QPalette::Text));
opt.palette.setColor(QPalette::All, QPalette::Highlight, opt.palette.base().color().darker(108));
#endif
QPalette textPalette = opt.palette;
textPalette.setCurrentColorGroup(cg);

View File

@ -1,6 +1,7 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2016 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
* QupZilla - Qt web browser
* Copyright (C) 2016 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
* Copyright (C) 2017 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -42,6 +43,12 @@ void TabFilterDelegate::paint(QPainter* painter, const QStyleOptionViewItem &opt
if (cg == QPalette::Normal && !(opt.state & QStyle::State_Active)) {
cg = QPalette::Inactive;
}
#ifdef Q_OS_WIN
opt.palette.setColor(QPalette::All, QPalette::HighlightedText, opt.palette.color(QPalette::Active, QPalette::Text));
opt.palette.setColor(QPalette::All, QPalette::Highlight, opt.palette.base().color().darker(108));
#endif
QPalette textPalette = opt.palette;
textPalette.setCurrentColorGroup(cg);