Behold the code:
QImage *qi = new QImage(fullCharArray, imwidth, imheight, QImage::Format_Indexed8);
ui->viewLabel->setPixmap(QPixmap::fromImage(qi,Qt::AutoColor));
Why does this give me an error? What is it trying to get me to change the qi argument to in the call to fromImage? I am relatively new to C++ and it seems like I am setting this up correctly. It works if I change the line to
QImage *qi = new QImage(fullCharArray, imwidth, imheight, QImage::Format_Indexed8);
ui->viewLabel->setPixmap(QPixmap::fromImage(qi[0],Qt::AutoColor));
But is that the correct way to do this?
It’s because QPixmap::fromImage expects a reference to an image, not a pointer to one.
However, change your qi[0] to *qi, that makes the intention cleaner. (or just refrain from using a pointer and start with
QImage qi(fullCharArray ...).