나는 QGraphicsView
을 통합하는 클래스 View
을 가지고 있지만 문제를 상속 받고 있습니다. View
에서Qt 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
상속 : 난 그냥 빠른 cout
game
에서와 paintEvent
을 구현 한
#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);
};
다음과 같이 내 코드입니다. 내가 컴파일 할 때, 모든 것이 괜찮아 컴파일하지만 난 실행할 때, 나는 순수 가상 함수가 호출라는 메시지가 점점 계속 :
libc++abi.dylib: pure virtual method called
Abort trap: 6
내 View
생성자는 다음과 같습니다를 :
View::View(QGraphicsScene * _scene) : QGraphicsView(_scene) {...
어떤 도움이 것 대단히 감사하겠습니다.
기본 클래스에서'paintEvent'의 순수 가상 (= 0)을 제거해보십시오. QT 내에서 호출되기 때문에 이것이 문제가 될 것입니다. – AquilaRapax
순수 가상 전화를받을 때 통화 스택을 표시 할 수 있습니까? – Paul
필자는 기본 클래스의 paint 이벤트에 대해 빈 함수를 구현해야했습니다. 빨리 고쳐 주셔서 감사합니다 – JonMorehouse