ich will von meiner QGraphicsScene Infos (zb Mausposition) an mein mainwindow weitersenden und hab dafür in meiner QGraphicsScene ein custom Signal implementiert, das von mousePressEvent() emittiert wird.
beim Kompilieren bekomm ich aber dann einen linker-error, an dem ich jetzt schon eine Zeit lang tüftle...
Code: Alles auswählen
Error 1 error LNK2019: unresolved external symbol "protected: void __thiscall GraphicsScene::mousePos(class QPointF const &)" (?mousePos@GraphicsScene@@IAEXABVQPointF@@@Z) referenced in function "protected: virtual void __thiscall GraphicsScene::mousePressEvent(class QGraphicsSceneMouseEvent *)" (?mousePressEvent@GraphicsScene@@MAEXPAVQGraphicsSceneMouseEvent@@@Z) GraphicsScene.objCode: Alles auswählen
#ifndef GRAPHICSSCENE_H
#define GRAPHICSSCENE_H
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
using namespace std;
class GraphicsScene : public QGraphicsScene
{
public:
GraphicsScene( QObject *parent = 0);
protected:
void mousePressEvent ( QGraphicsSceneMouseEvent * mouseEvent );
signals:
void mousePos( const QPointF& );
};
#endif // GRAPHICSSCENE_HCode: Alles auswählen
#include "GraphicsScene.h"
GraphicsScene::GraphicsScene( QObject *parent ) : QGraphicsScene( parent )
{
}
void GraphicsScene::mousePressEvent( QGraphicsSceneMouseEvent * mouseEvent )
{
emit mousePos(mouseEvent->scenePos());
}