On Mittwoch, 1. Mai 2013 13:55:00 CEST, Sreepriya Chalakkal wrote:

That link doesnt work. This is the new link to the new function https://github.com/spchal/trojita/blob/master/src/Gui/ComposeWidget.cpp#L560

Jan, i saw the same in FindBar.cpp - doesn't fix it's wrong ;-)


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)


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)

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.


Cheers,
Thomas

Reply via email to