Unsolved mouseMoveEvent works only if mouse is clicking
-
Hi,
i'm trying to use mouseMoveEvent function in order to tracking the position of the mouse. But it works only if i hold the mouse button. I need it works always.
Thank youMainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{ui->setupUi(this); setMouseTracking(true);
}
MainWindow::~MainWindow()
{
delete ui;
}void MainWindow::mouseMoveEvent(QMouseEvent *event){
QPoint pos=mapFromGlobal(QCursor::pos()); qDebug() << pos << endl; if(QWidget::childAt(pos.x(),pos.y())) ui->INFO->setText(QWidget::childAt(pos.x(),pos.y() )->whatsThis()); else ui->INFO->clear();
}
-
Hi,
You are not calling the base class implementation nor are you handling the event itself so it gets lost.