PDA

View Full Version : Mouse Move Event



merry
31st May 2007, 11:29
Hi all

I m working on Qt4.2,

Problem:

having a main window with some QPushButtons , The problem is this , When mouse move over the button ,then all the details of that button should be shown in the "Text Label" . and when mouse leaves that button then all the details of that button that are shown in the TextLabel should be hide.

for this I had also set status tip of the buttons , but it displays all the details of the button on the window itself not on the "Text Label" and I want that all the details should be displayed on the TextLabel

Thanx:)

wysota
31st May 2007, 11:53
But what is the problem? Do you have any code that doesn't work or...?

merry
31st May 2007, 11:56
No I dont have any code for this , Could you tell me how can I do this and Which events should I use .

high_flyer
31st May 2007, 11:59
QObject::installEventFilter (http://doc.trolltech.com/4.2/qobject.html#installEventFilter), QMouseEvent,QWidget::mouseMoveEvent (http://doc.trolltech.com/4.2/qwidget.html#mouseMoveEvent)

wysota
31st May 2007, 12:32
And enable mouse tracking. You can also try enterEvent and leaveEvent. Or you can use the statusTip property and attach to the status bar if you use a main window.

aamer4yu
3rd June 2007, 07:26
Displaying the button information as a tooltip or some widget would be better.
What I understood from ur post is u wan tto change the text of the button to button informatin when the mouse is over it. You can use setText() function for the same. But displaying long information on a small button wont be advisable. Use tooltip or some widget to display the information.
Rest follow the above answers by wysota and others.