I’m using Qt with C++ using Qt Creator. I have a QGraphicsView in my window named render and I wish to set its scene programatically. In window.cpp:
QGraphicsScene* scene = new QGraphicsScene();
ui->render->scene(scene*);
I have included QtGui and QGraphicsView.
When I attempt to compile the program I get:
error: expected primary-expression before ')' token
Does anybody have any advice with regards to this issue?
QGraphicsView::scene()returns the scene, usesetScene(QGraphicsScene* scene)to set it. You are also adding an asterisk afterscene, which when used after an object usually means to multiply it – that’s why it’s expecting another something before ‘)’.