Qt-interest Archive, August 2007
QRadialGradient using alpha-ed colors
Message 1 in thread
Hi,
I wanted to overlay a gradient where over an existing background where from
one corner I'd get a solid color that gets fainter towards the other
corners. So, I figured I'd just do the following:
QColor col_2 = QColor("#FFCF4C");
QColor col_2a=col_2;
col_2a.setAlpha(255);
QRadialGradient grad(QPointF(0,width()),width()*1.5);
grad.setColorAt(0,col_2);
grad.setColorAt(1,col_2a);
p.setBrush(grad);
p.drawRect(0,0,width(), height());
However, this does not seem to work, the result I get is that there is no
gradient at all as col_2 and col_2a are treated as the same color. In the
documentation, I do not find a reference that QGradient can't handle alpha
values in colors. Does anyone know what's going on here? Any idea how to
solve this?
Regards,
André
--
[ signature omitted ]
Message 2 in thread
André Somers wrote:
> I wanted to overlay a gradient where over an existing background where
> from one corner I'd get a solid color that gets fainter towards the other
> corners. So, I figured I'd just do the following:
>
> QColor col_2 = QColor("#FFCF4C");
> QColor col_2a=col_2;
> col_2a.setAlpha(255);
I really shouldn't be working on this while tired... Transparent is alpha 0,
not 255. *sigh*
Sorry for the noise.
André
--
[ signature omitted ]