Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

MouseMoveEvent ERROR!



  • mywidget.cpp:

    @void MyWidget::mouseMoveEvent(QMouseEvent *event)
    {

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

    }@

    mywidget.h:

    @void mouseMoveEvent(QMouseEvent *event);@

    ERROR:

    @:-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