Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/140.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Qt:';在';之前应为主表达式';更改属性时使用令牌? 我用C++使用Qt。我在名为render的窗口中有一个QGraphicsView,我希望通过编程设置其场景。在window.cpp中: QGraphicsScene* scene = new QGraphicsScene(); ui->render->scene(scene*);_C++_Qt_Qt Creator - Fatal编程技术网

Qt:';在';之前应为主表达式';更改属性时使用令牌? 我用C++使用Qt。我在名为render的窗口中有一个QGraphicsView,我希望通过编程设置其场景。在window.cpp中: QGraphicsScene* scene = new QGraphicsScene(); ui->render->scene(scene*);

Qt:';在';之前应为主表达式';更改属性时使用令牌? 我用C++使用Qt。我在名为render的窗口中有一个QGraphicsView,我希望通过编程设置其场景。在window.cpp中: QGraphicsScene* scene = new QGraphicsScene(); ui->render->scene(scene*);,c++,qt,qt-creator,C++,Qt,Qt Creator,我已经包括了QtGui和QGraphicsView 当我试图编译程序时,我得到: error: expected primary-expression before ')' token 有人对这个问题有什么建议吗?QGraphicsView::scene()返回场景,使用setScene(qgraphicscene*scene)进行设置。您还将在场景后添加星号,当在对象后使用星号时,通常意味着将其相乘-这就是为什么它希望在“')之前再添加一个星号。谢谢,您的解决方案成功了!你建议在QGraph

我已经包括了
QtGui
QGraphicsView

当我试图编译程序时,我得到:

error: expected primary-expression before ')' token

有人对这个问题有什么建议吗?

QGraphicsView::scene()
返回场景,使用
setScene(qgraphicscene*scene)
进行设置。您还将在
场景
后添加星号,当在对象后使用星号时,通常意味着将其相乘-这就是为什么它希望在“')之前再添加一个星号。

谢谢,您的解决方案成功了!你建议在QGraphicsScene之后删除星号吗?我建议你读一本关于C++基础的书,它可以帮你节省很多的试验和错误。而
qgraphicscene*
是指向
qgraphicscene
的指针,它是
新qgraphicscene()
操作的返回类型-因此您需要它。