Hi all !
Can you help me?
I would like get Signal (or Event ) when mouse Over QAction. QAction doesn't is QWidget and doesn't have method mouseMoveEvent ( QMouseEvent * ),...
I use Qt4.0 (on MacOS X and Windows ).
Hi all !
Can you help me?
I would like get Signal (or Event ) when mouse Over QAction. QAction doesn't is QWidget and doesn't have method mouseMoveEvent ( QMouseEvent * ),...
I use Qt4.0 (on MacOS X and Windows ).
Hi,
you can try to derive your class to QAction and QWidget, for example:
class myClass : public QAction, public QWidget {
// some code
}
Bye
This works at least for menu items (not for toolbar buttons as I recall):
QAction::hovered() [signal]
Mouse move events occur only if a mouse button is pressed (unless mouse tracking is on).
So I guess you're interested of enter and leave events..
For toolbar buttons, you could install an event filter and catch all enter and leave events.
Yes, it is my problem. I would like Signal MouseOver on QAction when QAction on QToolBar.
Can you help me !
Could you example code for me because I don't understand that( installEventFilter )Originally Posted by jpn
Do you use Qt3 or Qt4, and did you add the action to the toolbar in designer or in code?
I used Qt4.0 and I add the action in code.Originally Posted by jpn
QToolBar,QAction,... I rebuilded my class in my App.
You could install an even filter for all widgets in the toolbar like this:
(eg. in the constructor of your main window, after adding actions to the toolbar)
Qt Code:
QList<QWidget*> widgets = toolbar->findChildren<QWidget*>(); widget->installEventFilter(this);To copy to clipboard, switch view to plain text mode
And here's a skeleton for the event filter:
Qt Code:
{ { // a widget in the toolbar was entered // you may cast obj to a widget and do sth with it here } { // a widget in the toolbar was left } }To copy to clipboard, switch view to plain text mode
PS. it could have been useful information to know, what are you exactly trying to do when mouse is over an toolbar action?![]()
Example I change Icon of Action when Mouse Over Action, and i can dosomthing it, or I can emit Signal for other Dev use, ect,..Originally Posted by jpn
thank you very much !![]()
PS: my English is very bad ?
For the changing icon, you can construct a QIcon with separate pixmaps for normal, disabled and active modes, and then just set the icon for the action.Originally Posted by manhds
Thanks, this is very good with Change Icon, but I would like other process when Mousever !Originally Posted by jpn
Hi jpn !
I used installEventFilter but I don't get event mouseover with QAction on QToolbar. Maybe I wrong it
thanks and see you again tomorrow.
Now, I must go out the Office.
How did you install the event filter?Originally Posted by manhds
- You must install the event filter for the button in the toolbar, not for the action..
Which event type are you catching? What is "event mouseover"?
- As I mentioned earlier, mouse move events occur only if a mouse button is pressed (unless mouse tracking is on). So use enter and leave events.
Yes, I do it Success !Originally Posted by jpn
Because Yesterday I doesn't install the event filter for the button in the toolbar.
Thanks jpn !![]()
Bookmarks