Enter or return triggers the search now when the focus is at the searchEdit or at...
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Fri, 24 Jun 2011 17:47:33 +0000 (17:47 +0000)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Fri, 24 Jun 2011 17:47:33 +0000 (17:47 +0000)
src/gui/searchhead.cpp

index 55e1268..ee16ca9 100644 (file)
  */
 
 #include "searchhead.h"
+#include <QShortcut>
 
 SearchHead::SearchHead(QWidget *parent)
     : QWidget(parent)
 {
        setupUi(this);
+       QShortcut* shortcutEnter = new QShortcut(QKeySequence(Qt::Key_Enter), this, 0, 0, Qt::WidgetWithChildrenShortcut);
+       connect(shortcutEnter, SIGNAL(activated()), this, SLOT(searchButtonClicked()));
+       QShortcut* shortcutReturn = new QShortcut(QKeySequence(Qt::Key_Return), this, 0, 0, Qt::WidgetWithChildrenShortcut);
+       connect(shortcutReturn, SIGNAL(activated()), this, SLOT(searchButtonClicked()));
        connect( searchButton, SIGNAL(clicked()), SLOT(searchButtonClicked()));
 }
 
@@ -35,6 +40,6 @@ SearchHead::~SearchHead()
 
 void SearchHead::searchButtonClicked()
 {
-    qDebug() << "SearchHead::searchButtonClicked()";
+    // qDebug() << "SearchHead::searchButtonClicked()";
     emit( searchClicked() );
 }