bool eventFilter(QObject* object,QEvent* event) { if(event->type() == QEvent::ToolTip) { QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event); return true; } else { return QObject::eventFilter(object,event); } };
bool eventFilter(QObject* object,QEvent* event) { if(event->type() == QEvent::ToolTip) { //QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event); QString sToolTip; sToolTip=QToolTip::text(); qDebug(sToolTip.toAscii().data()); QObject::eventFilter(object,event); sToolTip=QToolTip::text(); qDebug(sToolTip.toAscii().data()); return true; } else { return QObject::eventFilter(object,event); } };
C++ (Qt)bool Tracker::eventFilter(QObject* object,QEvent* event){ if(event->type() == QEvent::ToolTip) { bool ret = QObject::eventFilter(object,event); QMetaObject::invokeMethod( this, "checkToolTip", Qt::QueuedConnection ); retrun ret; } return QObject::eventFilter(object,event);} void Tracker::checkToolTip(){ qDebug() << QToolTip::text();}