Originally Posted by
mclark
Thanks jpn, that solves the design problem, now, does anyone know why the selectAll() does not select anything in my QLineEdit object?
....
If using the eventFilter, no selection occurs
.
Did you ever figure out how to make this work?
I just set up an eventFilter, but selectAll() doesn't work... clear() does, as does changing the color... so I know I'm catching the event and object... but selectAll() doesn't do anything.
// qDebug() << "Track::eventFilter: Received event '" << e->type() << "' from object '" << obj->name() << "'.";
if (obj
== m_pView
->m_pLineEditSearch
&& e
->type
()==QEvent::FocusIn) { qDebug("QEvent::FocusIn event intercepted");
// ((QLineEdit *)obj)->clear();
return false;
} else if (obj
== m_pView
->m_pLineEditSearch
&& e
->type
()==QEvent::FocusOut) { qDebug("QEvent::FocusOut event intercepted");
return false;
}
// else {
// standard event processing
// return QObject::eventFilter(obj, event);
// }
return false;
}
bool Track::eventFilter(QObject *obj, QEvent *e) {
// qDebug() << "Track::eventFilter: Received event '" << e->type() << "' from object '" << obj->name() << "'.";
if (obj == m_pView->m_pLineEditSearch && e->type()==QEvent::FocusIn) {
qDebug("QEvent::FocusIn event intercepted");
((QLineEdit *)obj)->selectAll();
// ((QLineEdit *)obj)->clear();
return false;
} else if (obj == m_pView->m_pLineEditSearch && e->type()==QEvent::FocusOut) {
qDebug("QEvent::FocusOut event intercepted");
return false;
}
// else {
// standard event processing
// return QObject::eventFilter(obj, event);
// }
return false;
}
To copy to clipboard, switch view to plain text mode
Bookmarks