How to use mouseMoveEvent on paintEvent on Qt 5?
问题 I'm new on Qt and c++, so I'm having some difficulties. I'm trying to create a widget that can get the mouseMoveEvent position and draw an ellipse on my pixmap on mouse position. Below you can see the code: #include "myimage.h" #include <QPainter> #include <QPen> #include <QColor> #include <QMouseEvent> #include <QDebug> Myimage::Myimage(QWidget *parent) : QWidget(parent) { setMouseTracking(true); // E.g. set in your constructor of your widget. } // Implement in your widget void Myimage: