summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2023-10-29 18:38:46 +0200
committerMavridis Philippe <mavridisf@gmail.com>2023-10-29 18:38:46 +0200
commitf35238706e90adef55450e93b4abdeea9c9aa3bb (patch)
treeec537818ca41d408535b5cdac5cd417696072a5e /src
parent29920b1323955c55bbe66d833f10779a36ce12fe (diff)
downloadtastymenu-f35238706e90adef55450e93b4abdeea9c9aa3bb.tar.gz
tastymenu-f35238706e90adef55450e93b4abdeea9c9aa3bb.zip
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>
Diffstat (limited to 'src')
-rw-r--r--src/menuhandler.cpp10
-rw-r--r--src/tastylistview.cpp1
2 files changed, 8 insertions, 3 deletions
diff --git a/src/menuhandler.cpp b/src/menuhandler.cpp
index f461e7c..05ea617 100644
--- a/src/menuhandler.cpp
+++ b/src/menuhandler.cpp
@@ -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;
}
diff --git a/src/tastylistview.cpp b/src/tastylistview.cpp
index f958bfc..4448528 100644
--- a/src/tastylistview.cpp
+++ b/src/tastylistview.cpp
@@ -208,6 +208,7 @@ void TastyListView::keyPressEvent( TQKeyEvent * e )
break;
default:
+ e->ignore();
break;
}
}