I currently have a program that draws lines and rectangles.
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
I use mouseMoveEvent to draw a temporary preview of the string, and when I release, I draw the actual string. I would like to know how I can make mouseMoveEvent work only when I have the left mouse button pressed. I tried the following, but then the whole function stops working.
void mouseMoveEvent(QMouseEvent *event)
{
if(event->button() == Qt::LeftButton)
{
}
}
but then the function does nothing. Any help would be greatly appreciated
source
share