When do I know a qpushbutton is on focus?
Unsolved
General and Desktop
-
I have a QDialogButtonBox and i want to know how I can get when the Qpushbutton is on focus, because a i need it to disccard and event.
You can use eventFilter for this.
//in the header file of YourClass bool eventFilter(QObject *, QEvent *);
//somewhere in the cpp file of YourClass bool YourClass::eventFilter(QObject* watched, QEvent* event) { if( event->type() == QEvent::FocusIn) { //do something when the watched object(s) gets focus } if( event->type() == QEvent::FocusOut) { //do something when the watched object(s) loses focus } return QWidget::eventFilter(watched, event); }
and after initializing the QDialogButtonBox and its buttons
button->installEventFilter(this);
to install the filter.
hope that helps
-
Hi,
If you don't want the possible interaction with a QPushButton, why not just disable it ?
-
Hi,
If you don't want the possible interaction with a QPushButton, why not just disable it ?
-
Can you give an example ?