bool tabview::eventFilter(QObject *obj, QEvent *event){if (event->type() == QEvent::FocusIn){ if (obj==ui->textEdit1) lastFocus = 1; if (obj==ui->textEdit2) lastFocus = 2; if (obj==ui->textEdit3) lastFocus = 3; if (obj==ui->textEdit4) lastFocus = 4;}return QObject::eventFilter(obj, event);}
#include <QEvent>
void tabview::on_buttonHelp_clicked(){ if (lastFocus = 1) QMessageBox::warning(this,tr("Check"),tr("You choose first textEdit"),QMessageBox::Ok); if (lastFocus = 2) QMessageBox::warning(this,tr("Check"),tr("You choose second textEdit"),QMessageBox::Ok); if (lastFocus = 3) QMessageBox::warning(this,tr("Check"),tr("You choose third textEdit"),QMessageBox::Ok); if (lastFocus = 4) QMessageBox::warning(this,tr("Check"),tr("You choose fourth textEdit"),QMessageBox::Ok);}
monitoredObj->installEventFilter(filterObj);
void installEventFilter(QObject*)