You can create and install an event filter, and emit a signal in there, something like this
class FocusInSignal
: public QObject{
Q_OBJECT
...
signals:
void focusIn(void);
protected:
{
if (event
->type
() == QEvent::FocusIn) { emit focusIn();
return true;
} else {
// standard event processing
return QObject::eventFilter(obj, event
);
}
}
}
// in the main window
FocusInSignal* filter = new filter(this);
connect(filter, SIGNAL(focusIn()), this, SLOT(lineEditGotFucus()));
lineEdit->installFilter(filter);
void MainWindow::lineEditGotFucus(void)
{
// processes
}
class FocusInSignal: public QObject
{
Q_OBJECT
...
signals:
void focusIn(void);
protected:
bool FocusInSignal::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::FocusIn) {
emit focusIn();
return true;
} else {
// standard event processing
return QObject::eventFilter(obj, event);
}
}
}
// in the main window
FocusInSignal* filter = new filter(this);
connect(filter, SIGNAL(focusIn()), this, SLOT(lineEditGotFucus()));
lineEdit->installFilter(filter);
void MainWindow::lineEditGotFucus(void)
{
// processes
}
To copy to clipboard, switch view to plain text mode
Bookmarks