On Wednesday, 1 May 2013 14:23:08 CEST, Thomas Lübking wrote:
Ok, whenever you want to set p.setColor(QPalette::Base,
palette().color(QPalette::Base)); just setPalette(QPalette());
instead (resets the palette to inherit the parent)
OK, makes sense, thanks for that.
Next, this: "p.setColor(QPalette::Base, QColor(247, 230,
230));" is twofold wrong.
1. don't set some hardcoded color, if you want to tint the
basecolor with red, do so
QColor c(p.color(QPalette::Base));
c = QColor((14*c.red()+255)/15, 14*c.green()/15, 14*c.blue()/15, c.alpha());
(the factor 14/15 should not be hardcoded either but depend on
the color value, ie. the brightest channel and distribute to
about 4/5 for the 0 value ie. black case)
Looks like KDE does this in some colorspace-aware fashion; that's way more than I want to
know here :). I've shamelessly stolen the "Qt.tint"'s implementation from the
QML engine and Trojita is now using just that.
2. If you want to set a fixed colored background (like
Qt::red), you *must* set the foreground color as there's
absolutely no guarantee that p.color(QPalette::Text) is somehow
black.
It's now using the tinting code for the background. The text color is not changed. I've
tried all of the themes which shipped with my KDE and it looks usable. I've also fixed
the webkit interaction and now it looks like most of the colors are "right"
even on crazy themes.
Thanks for letting me know!
Sreepriya, please do something similar to d53b3e6 in your patch. You'll need to
rebase on top of a3c58a1 to be able to use that function.
Cheers,
Jan
--
Trojitá, a fast Qt IMAP e-mail client -- http://trojita.flaska.net/