You could also see underMouse(). mouseTracking should be true, obviously. But yes, as Marcel said, reimplementing mouseEnterEvent and mouseLeaveEvent in your buttons would be neat!
You could also see underMouse(). mouseTracking should be true, obviously. But yes, as Marcel said, reimplementing mouseEnterEvent and mouseLeaveEvent in your buttons would be neat!
underMouse() would involve additional polling in the main window.
Actually the events I was talking about are called enterEvent and leaveEvent ( my bad).
Regards
Thanx Marcel
I tried enter event and leave event It works for the main window,Can you explain me it for the QPushButtons with example![]()
Always Believe in Urself![]()
Merry
Qt Code:
{ Q_OBJECT public: ~MyButton(); protected: public signals: } { emit enter( text() ); } { emit leave( text() ); }To copy to clipboard, switch view to plain text mode
This is a minimal example of what you can do.
When a button is hovered, it emits the enter signal, with the button name as parameter. You can use the name to display it in your label.
Also, when the mouse leaves the button, the leave signal is emitted.
Regards
You can achieve a simmilar effect without any hacks. Main windows have a status bar and you can make it that it displays the text you want when a widget is hovered. It's enough to fill the statusTip property for the buttons or their actions. An alternative of course is to use a tooltip.
Nothing Works , Please tell me Is there any other way to do this.
Always Believe in Urself![]()
Merry
Maybe you'd like to tell us some more details about this "nothing"?
Yaa , Actuallly I implemented that what Marcel had told me
Qt Code:
{ Q_OBJECT public: ~MyButton(); protected: public signals: } { emit enter( text() ); } { emit leave( text() ); }To copy to clipboard, switch view to plain text mode
and also what u toldBut it wont works ,because what i want is this ,I am having 6 Push buttons on my main window,and each works differently ,When mouse cursor is over any button it displays the detail of that button in the label that i used., that Main windows have a status bar and you can make it that it
displays the text you want when a widget is hovered.
Last edited by wysota; 16th May 2007 at 10:54. Reason: Incorrect tags
Always Believe in Urself![]()
Merry
Have you used MyButton instead of QPushButton?
Also have you used the two signals properly?
It is impossible not to
work, therefore you have done something wrong.
I got this to work without any subclassing, just using a status tip.
merry (16th May 2007)
Thanx Wysota it works and also thanx to Marcel for helping me so much
Always Believe in Urself![]()
Merry
Bookmarks