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) {...
どんな助けでも大歓迎です。