Important: Please read the Qt Code of Conduct -

MouseMoveEvent ERROR!

  • mywidget.cpp:

    @void MyWidget::mouseMoveEvent(QMouseEvent *event)

    qDebug() << event->pos();



    @void mouseMoveEvent(QMouseEvent *event);@


    @:-1: In member function 'virtual void MyWidget::mouseMoveEvent(QMouseEvent*)':
    error: invalid use of incomplete type 'struct QMouseEvent'
    error: forward declaration of 'struct QMouseEvent'@

  • You are missing include in your code

    #include <QMouseEvent>

  • #include <QMouseEvent>

  • Try by including the Header file #include <QMouseEvent>

    Note: Always don't forget to use the necessary Headers. Including all the Header files is a good sign of programming practice... :) All d best..

Log in to reply