RFC [patch] 3.5.X ochange event in file widget - bug 107455
David Faure
faure at kde.org
Wed Jan 10 09:27:05 GMT 2007
On Wednesday 10 January 2007 01:13, Konrad Rzepecki wrote:
>
> +bool KURLRequester::eventFilter( QObject *obj, QEvent *ev )
> +{
> +// if ( ( this == obj ) ||( d->edit == obj ) || ( d->combo == obj ) )
> +// {
> + if (( ev->type() == QEvent::FocusIn ) || ( ev->type() == QEvent::FocusOut ))
> + return false;
> +// }
> + return QObject::eventFilter( obj, ev );
> +}
My idea was along the lines of
bool KURLRequester::eventFilter( QObject *obj, QEvent *ev )
{
if ( obj == d->edit || obj == d->combo ) {
if ( ev->type() == QEvent::FocusIn || ev->type() == QEvent::FocusOut ) {
// Forward focusin/focusout events to the urlrequester; needed by file form element in khtml
qApp->sendEvent( this, ev );
}
}
return QWidget::eventFilter( obj, ev );
}
with widget->installEventFilter( this ) only, not installEventFilter(this).
Does this work?
BTW I just had a look at qcombobox (which uses a lineedit as its focusproxy),
and this is almost exactly what it does: event filter on the lineedit, and
} else if ( event->type() == QEvent::FocusIn ) {
focusInEvent( (QFocusEvent *)event );
} else if ( event->type() == QEvent::FocusOut ) {
focusOutEvent( (QFocusEvent *)event );
But I'm guessing that just calling focusInEvent/focusOutEvent isn't enough in our
case, we need event filters on the container widget (the urlrequester in our case)
to be triggered.
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kfm-devel
mailing list