我有一个View
包含我的类,QGraphicsView
但我无法从它继承。我的代码如下:
class View: public QGraphicsView {//inherits qwidget -- so we can make it full screen there
Q_OBJECT
public:
View(QGraphicsScene * _scene);//this is responsible for setting up the screen and instantiating several elements
~View();
protected:
virtual void paintEvent(QPaintEvent * event) = 0;
并Game
继承自View
:
#include "view.h" //this includes all of the functionality of the different elements
using namespace std;
class Game : public View {//inherit everything above and down into private functions
public:
Game(QGraphicsScene * _scene);
~Game();
protected:
void paintEvent(QPaintEvent * event);
};
我已经paintEvent
快速实现cout
了game
. 当我编译时,一切都编译好了,但是当我运行时,我不断收到一条消息,说调用了一个纯虚函数:
libc++abi.dylib: pure virtual method called
Abort trap: 6
我的View
构造函数如下所示:
View::View(QGraphicsScene * _scene) : QGraphicsView(_scene) {...
任何帮助将不胜感激。