What is the simplest way to go from:

QList<QColor> pallette 
{Qt::black,Qt::red,Qt::darkRed,Qt::green,Qt::darkGreen,Qt::blue,Qt::darkBlue,Qt::cyan,Qt::darkCyan,Qt::magenta,Qt::darkMagenta,Qt::yellow,Qt::darkYellow};

To a pixel QRgb?

image.setPixel(x,y, pallette[5]);

The .toRgb() of QColor does not actually return a QRgb, instead it converts the 
color to RGB representation internally.

I've hacked this:
uint toRgb(const QColor &c) {
        return qRgb(c.red(), c.blue(), c.green());
}

image.setPixel(x,y, toRgb(pallette[5]));

but it seems so obtuse.
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to