Learn to understand what your compiler is telling you. This message means you have forgotten to #include the header file that defines QGraphicsSceneMouseEvent at the top of your cpp file.invalid use of incomplete type 'class QGraphicsSceneMouseEvent'
Because by changing the signature for mouseMoveEvent() you have defined a new method for your Square class that Qt's event system knows nothing about and will never call. You should also understand that in C++, the combination of method name, return value type, and argument types define a function, not just the method name. You can't just arbitrarily replace one argument type for another. Those are different functions as far as the compiler, linker, and runtime are concerned, and the new one does not substitute for the old one. The old one still exists in Square's base class, and that's the one being called.Application run properly but mouseMoveEvent handler will never be handled.
Bookmarks