From 48d4f614b1a3b49477366230a8e5dbf06fd4b791 Mon Sep 17 00:00:00 2001 From: dockes Date: Mon, 26 Oct 2009 10:00:31 +0000 Subject: [PATCH] arrange to send pageup/down and shift-home to the reslist --- src/qtgui/rclmain_w.cpp | 24 ++++++++++++++++++++++++ src/qtgui/rclmain_w.h | 1 + 2 files changed, 25 insertions(+) diff --git a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp index b7a15780..05c0661d 100644 --- a/src/qtgui/rclmain_w.cpp +++ b/src/qtgui/rclmain_w.cpp @@ -200,6 +200,12 @@ void RclMain::init() // Connections connect(sSearch, SIGNAL(startSearch(RefCntr)), this, SLOT(startSearch(RefCntr))); +#if QT_VERSION >= 0x040000 + sSearch->queryText->installEventFilter(this); +#else + sSearch->queryText->lineEdit()->installEventFilter(this); +#endif + connect(preferencesMenu, SIGNAL(activated(int)), this, SLOT(setStemLang(int))); connect(preferencesMenu, SIGNAL(aboutToShow()), @@ -1156,3 +1162,21 @@ void RclMain::catgFilter(int id) resList->setDocSource(); } +bool RclMain::eventFilter(QObject *, QEvent *event) +{ + if (event->type() == QEvent::KeyPress) { + LOGDEB2(("RclMain::eventFilter: keypress\n")); + QKeyEvent *ke = (QKeyEvent *)event; + if (ke->key() == Qt::Key_PageDown || ke->key() == Qt::Key_PageUp ) { + // Page up down are sent to the resList where they make sense + QApplication::sendEvent(resList, event); + return true; + } else if (ke->key() == Qt::Key_Home && + (ke->state() & Qt::ShiftButton)) { + // Shift-Home -> first page of results + resList->resultPageFirst(); + return true; + } + } + return false; +} diff --git a/src/qtgui/rclmain_w.h b/src/qtgui/rclmain_w.h index 2792727c..04587c9e 100644 --- a/src/qtgui/rclmain_w.h +++ b/src/qtgui/rclmain_w.h @@ -70,6 +70,7 @@ public: init(); } ~RclMain() {} + virtual bool eventFilter(QObject *target, QEvent *event); public slots: virtual bool close();