This is my code
void MainWindow::doFunction1()
{
int x = 0;
int y = 0;
for (x= 0; x < image.width(); x++){
for (y = 0; y < image.height(); y++){
image.setPixel(x, y, QRgb(255,0,0));
}
}
scene
->addPixmap
(QPixmap::fromImage(image
));
graphicsViewVis->setScene(scene);
graphicsViewVis->show();
}
void MainWindow::doFunction1()
{
QImage image(QSize(100,100), QImage::Format_RGB32);
int x = 0;
int y = 0;
for (x= 0; x < image.width(); x++){
for (y = 0; y < image.height(); y++){
image.setPixel(x, y, QRgb(255,0,0));
}
}
QGraphicsScene *scene = new QGraphicsScene;
QGraphicsPixmapItem *item;
item->setShapeMode(QGraphicsPixmapItem::BoundingRectShape);
item->setFlag(QGraphicsItem::ItemIsMovable);
scene->addPixmap(QPixmap::fromImage(image));
graphicsViewVis->setScene(scene);
graphicsViewVis->show();
}
To copy to clipboard, switch view to plain text mode
on compilation, there are errors and warnings :
error: functional cast expression list treated as compound expression
warning: left-hand operand of comma has no effect
warning: right-hand operand of comma has no effect
it is noted that the line image.setPixel(x, y, QRgb(255,0,0)); is underlined in red. this is where the error is. Thanks in advance to those who can explain to me how to solve the error functional cast expression list treated as compound expression.
Bookmarks