If you want to draw a cross or a tick on top of the image, you will need to convert the image from indexedColor:
// Load GrayScale as 8-bit-IndexedColor
// Setup Color-Table
QVector<QRgb> colorTable(256);
for(int i=0;i<256;++i)
colorTable[i] = qRgb(i,i,i);
image.setColorTable(colorTable);
// Convert to RGB32 for painter
QImage image2
= image.
convertToFormat(QImage::Format_ARGB32_Premultiplied);
painter.drawLine(...)
..
ui->label
->setPixmap
(QPixmap::fromImage(image2
));
// Load GrayScale as 8-bit-IndexedColor
QImage image(buff,280,352,280,QImage::Format_Indexed8);
// Setup Color-Table
QVector<QRgb> colorTable(256);
for(int i=0;i<256;++i)
colorTable[i] = qRgb(i,i,i);
image.setColorTable(colorTable);
// Convert to RGB32 for painter
QImage image2 = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
QPainter painter(image2);
painter.drawLine(...)
..
ui->label->setPixmap(QPixmap::fromImage(image2));
To copy to clipboard, switch view to plain text mode
Does that do the trick?
Joh
Bookmarks