Improve keyboard events

- Closing with Escape now works when a listview widget has the focus.
- Starting typing while the focus is not on the search lineedit now automatically gives focus to the search lineedit.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
feat/minor-improvements
Mavridis Philippe 1 year ago
parent 29920b1323
commit f35238706e
No known key found for this signature in database
GPG Key ID: 93F66F98F906147D

@ -101,6 +101,7 @@ MenuHandler::MenuHandler( TQWidget *parent, Prefs *prefs, char *name, WFlags fl)
menu->searchLine->setContextMenuEnabled(false);
//event filters for keyboard navigation
menu->installEventFilter(this);
menu->clearButton->installEventFilter(this);
menu->searchLine->installEventFilter(this);
menu->menuModes->installEventFilter(this);
@ -304,10 +305,8 @@ bool MenuHandler::eventFilter( TQObject *o, TQEvent * e )
TQKeyEvent *keyEvent = (TQKeyEvent *)e;
TQFocusData *fData = focusData();
fData->home();
switch( keyEvent->key() )
{
case TQt::Key_Up:
if( dynamic_cast<TQComboBox *>(o) )
return false;
@ -381,7 +380,12 @@ bool MenuHandler::eventFilter( TQObject *o, TQEvent * e )
close();
default:
return false;
if (!keyEvent->text().isNull() && !menu->searchLine->hasFocus()) {
menu->searchLine->setText(keyEvent->text());
menu->searchLine->setFocus();
return true;
}
else return false;
}
return true;
}

@ -208,6 +208,7 @@ void TastyListView::keyPressEvent( TQKeyEvent * e )
break;
default:
e->ignore();
break;
}
}

Loading…
Cancel
Save