Problem with mouseMoveEvent



  • i have some trouble working with the "QGraphicsSceneMouseEvent" that is passed to the mouseMoveEvent of my class.

    here is the code:
    @#include "Definitions.h"
    #include <QGraphicsScene>

    class QGraphicsSceneGrid : public QGraphicsScene
    {
    public:
    QGraphicsSceneGrid(QObject parent);
    EN_EDIT_MODES
    pen_current_mode;

    protected:
    void drawBackground(QPainter * painter, const QRectF & rect );
    virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);

    };@

    @#include "ModClasses.h"
    #include <QPainter>
    #include "Definitions.h"

    QGraphicsSceneGrid::QGraphicsSceneGrid(QObject *parent ) : QGraphicsScene(parent)
    {}

    void QGraphicsSceneGrid::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
    {
    if( *pen_current_mode == mode_add_line )
    {
    QPointF pos1;
    pos1 = event->scenePos();
    }
    }
    @

    the line "pos1 = event->scenePos();" gives me this errors:

    In member function 'virtual void QGraphicsSceneGrid::mouseMoveEvent(QGraphicsSceneMouseEvent*)':
    error: invalid use of incomplete type 'struct QGraphicsSceneMouseEvent'
    error: forward declaration of 'struct QGraphicsSceneMouseEvent'



  • @
    #include <QGraphicsSceneMouseEvent>
    @



  • thanks.
    (I thought ever QGraphicsSceneXXXX stuff is included in the QGraphicsScene header.)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.