void MyStyle::polish( QWidget * widget ){ QPushButton * button = qobject_cast<QPushButton*>( widget ); if ( button ) button->installEventFilter( this );}bool MyStyle::eventFilter( QObject * o, QEvent * e ){ QPushButton * button = qobject_cast<QPushButton*>( o ); if ( button && e->type() == QEvent::Hover ) { // popup tip }}
QPushButton * button = new QPushButton( tr( "name" ), this );button->setToolTip( tr( "Your text" ) );button->installEventFilter( this );
eventFilter( QObject * object, QEvent * event ){ QWidget * widget = dynamic_cast < QWidget * > ( object ); if ( widget && event->type() == QEvent::ToolTip ) { QString tip = widget->toolTip(); }}