PDA

View Full Version : How can i get QAction or QPushButton name



duduqq
29th July 2008, 04:45
I have a QDialog ,and I add three QWidget to the QDialog,
and I add some QPushButton and QAction to the QWidget,
now I want to get the name of QPushButton where the mouse curser is.
I used childeAt(event->pos()) at mouseMoveEvent(),But i just get the QWidget name ,i can't get the name of the QPushwButton.

aamer4yu
29th July 2008, 07:06
Cast the childAt widget into QPushButton and see if u get the proper name.
What are u trying to achieve by the way, and can u share some code of what u have tried ?

duduqq
29th July 2008, 13:56
Thank you !
I want to know the button name and set the button setChecked(true) whick is under the pos()

jpn
29th July 2008, 15:31
Doesn't the button handle press/release events out of the box? :) It toggles between checked and unchecked if you make it checkable... Why do you want the dialog to handle that?

duduqq
30th July 2008, 01:45
I want the button is setChecked(true) when the button under the mouse,
and setChecked(false) when the mouse out side the button.

aamer4yu
30th July 2008, 05:09
And what do u want to do when the button is checked ??
You may better look at QWidget::enterEvent and QWidget::leaveEvent