...struct strct{QLabel * a;QPushButton * b;};strct * one; bool eventFilter(QObject *object, QEvent *event);...
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ ui->setupUi(this);one = new strct;one->a = new QLabel;one->b = new QPushButton;one->b->setVisible(false); installEventFilter(this);}bool MainWindow::eventFilter(QObject *object, QEvent *event){if(object == one->a) if (event->type() == QEvent::FocusIn){ one->a->setVisible(false); one->b->setVisible(true);} return false;}
bool MainWindow::eventFilter(QObject *object, QEvent *event){ if(object == usersList[i].bb) if (event->type() == QEvent::Enter){ usersList[i].cc->setVisible(true); usersList[i].bb->setVisible(false);} if(object == usersList[i].cc) if(event->type() == QEvent::Leave){ usersList[i].cc->setVisible(false); usersList[i].bb->setVisible(true);} return false;}