Seite 1 von 1

MouseEvents in GraphicsScene überladen.

Verfasst: 14. Februar 2008 10:13
von slash-ex
Ich habe eine QGraphicsScene und wollte die virtuellen MouseEvents überladen, aber kurioserweise funktioniert das nicht wegen der unteren Fehlermeldung.
die frage ist, warum ich vordeklarieren muss? Warum ist in der Def keine ‘GraphicsSceneMouseEvent’ drinne?

Code: Alles auswählen

class GraphicsScene : public QGraphicsScene
{
private:
...
public:
	GraphicsScene(QObject *parent = 0) : QGraphicsScene(parent)
	{}
	GraphicsScene ( const QRectF & sceneRect, QObject * parent = 0 ) : QGraphicsScene(parent) {
		this->setSceneRect(sceneRect);
	}
	GraphicsScene ( qreal x, qreal y, qreal width, qreal height, QObject * parent = 0 ) : QGraphicsScene(parent) {
		this->setSceneRect(x, y, width, height);
	}
	~GraphicsScene() {
...
	}
...

protected:
...
	//Maus
	void mouseMoveEvent(GraphicsSceneMouseEvent *event);

	void mousePressEvent(GraphicsSceneMouseEvent *event);
	void mouseReleaseEvent(GraphicsSceneMouseEvent *event);
	void mouseDoubleClickEvent(GraphicsSceneMouseEvent *event);
...
};

Code: Alles auswählen

./battlefield/scene.h:45: error: ‘GraphicsSceneMouseEvent’ has not been declared
./battlefield/scene.h:47: error: ‘GraphicsSceneMouseEvent’ has not been declared
./battlefield/scene.h:48: error: ‘GraphicsSceneMouseEvent’ has not been declared
./battlefield/scene.h:49: error: ‘GraphicsSceneMouseEvent’ has not been declared

Re: MouseEvents in GraphicsScene überladen.

Verfasst: 14. Februar 2008 10:25
von franzf
slash-ex hat geschrieben: die frage ist, warum ich vordeklarieren muss? Warum ist in der Def keine ‘GraphicsSceneMouseEvent’ drinne?
Weil das QGraphicsSceneMouseEvent heißt...