Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with mouseMoveEvent
Qt 6.11 is out! See what's new in the release blog

Problem with mouseMoveEvent

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 5.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Artemus
    wrote on last edited by
    #1

    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'

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cincirin
      wrote on last edited by
      #2

      @
      #include <QGraphicsSceneMouseEvent>
      @

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Artemus
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved