PDA

View Full Version : bug with QColor(QString& name)



Radagast
31st July 2008, 10:51
Qt 4.4.0, MS VS 2005
consider this piece of code:

QStringList names = QColor::colorNames();
QList<QPair<QColor,QString> > colorlist;
foreach(QString name, names)
{
colorlist.append(qMakePair(QColor(name),name));
QColor c1(name);
if (!c1.isValid() || c1.alpha()>255 || name=="transparent")
{
qDebug("haha");
QMessageBox::warning(0,"1",QString::number(c1.alpha()));
}
}
colorNames returned list of 148 colors "Qt knows about" (ORLY?..), but when I construct QColor("transparent") it behaves wrong.
1. The MS VS debugger shows that its alpha equals 65535, but the alpha() returns 255. Well that isn't very important BUT
2. WTF it returns 255, when "transparent" means (0,0,0,0)? btw if I create QColor c(Qt::transparent) it's correct.
Well, should I report this to Trolltech's bug tracker :confused:

Radagast
31st July 2008, 14:24
damn..someone else has reported this bug in January, but Trolltech didn't fix it till 4.4.0 grr, only in 4.4.1
http://trolltech.com/developer/task-tracker/index_html?method=entry&id=193671