How can I follow the mouse?
Hi all,
I have a QLabel and I want that, that QLabel follow the mouse movement of the user.
Currently I have the following Code:
Code:
{
int x = currentPos.x();
int y = currentPos.y();
label->setText("testje");
label->setGeometry(x,y, 50, 50);
label->show();
}
Problem
This works fine but the problem is that the movement is too slow!
The text halts everytime.
Does anyone know how to solve this?
How do I get a mouse movement with text beneath that follows directly the cursor?
Thanx!
Re: How can I follow the mouse?
You could also try for QToolTip::showText.
Also what class are you using ? you could also think of drawing the message in your class. It could result in faster display.
For eg say on mouse move u generate the message variable m_message;
And in paint event, you check if m_message is empty or not. If not empty,draw the message. Oh yea, you would need to store current mouse pos too, isnt it :)
Re: How can I follow the mouse?
Thank you for your quick replay.. It seems that the movement is now quick enough.
I have changed the drawing to the paintEvent like you said.
Thanks a lot!