Qt Can';t型铸造硅灰石

Qt Can';t型铸造硅灰石,qt,casting,qgraphicsview,qgraphicsitem,Qt,Casting,Qgraphicsview,Qgraphicsitem,好的,我想错误可能很明显,但现在我找不到 我有: class GraphViewCustom : public QGraphicsView { ... protected: void wheelEvent(QWheelEvent *event); } 和类似的类GraphSceneCustom(派生自qgraphicscene)和GraphPixmapItemCustom(派生自QGraphicsPixmapItem)。在上面的wheelEvent()中,我有这样一行: qgraphics

好的,我想错误可能很明显,但现在我找不到

我有:

class GraphViewCustom : public QGraphicsView
{
...
protected:
  void wheelEvent(QWheelEvent *event);
}
和类似的类GraphSceneCustom(派生自qgraphicscene)和GraphPixmapItemCustom(派生自QGraphicsPixmapItem)。在上面的wheelEvent()中,我有这样一行:

qgraphicsitem_cast(items().first());
为了便于阅读和减少复杂性,我删除了替换的左侧。在这条线上我得到了

调用“qgraphicsitem_cast(qgraphicsitem*&)”时没有匹配的函数

我做错了什么?我想这个错误是显而易见的(我最常见的错误是什么?我很少犯严重的错误。但当我犯了这些错误时,它们确实很严重)


是的,我添加了QGraphicsItem类的标题。

QGraphicsItem的cast定义在
\35; include
中。您是否已将此包含在相关文件中?

无所谓,这是一个明显的错误。没有任何条款。因此,使用qgraphicsItem_cast(items().first())就可以了。我仍然不能回答我自己的问题,所以我在这里写作。为什么在我发帖后就有了答案:(哦,当然。别难过,我也错过了。我在对这个问题的评论中回答了自己。我知道这很简单:(