به صورت زیر عمل کنید.
bool Form::eventFilter(QObject *object, QEvent *event)
{
if (event->type() == QEvent::FocusIn)
{
if (object == ui.edit1)
{
//...
}
else if (object == ui.edit2)
{
//...
}
return false;
}
Form::Form(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
ui.edit1->installEventFilter(this);
ui.edit2->installEventFilter(this);
}