changeset 93:cb6320fd77cc

run the query database when we press Enter on the keyboard
author lbajardsilogic
date Thu, 05 Jul 2007 13:53:44 +0000
parents dd06af61a4ff
children e9bc2730a7b5
files widgets/SearchWidget.cpp widgets/SearchWidget.h
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/SearchWidget.cpp	Fri Jun 29 10:04:07 2007 +0000
+++ b/widgets/SearchWidget.cpp	Thu Jul 05 13:53:44 2007 +0000
@@ -20,6 +20,7 @@
 #include <QSpinBox>
 #include <QPushButton>
 #include <QScrollArea>
+#include <QKeyEvent>
 
 #include <iostream>
 
@@ -46,6 +47,9 @@
 
 	QHBoxLayout *searchButtonLayout = new QHBoxLayout;
 	m_searchButton = new QPushButton(tr("Search"));
+	QPalette palette;
+	palette.setColor(QPalette::Button,palette.color(QPalette::Highlight));
+	m_searchButton->setPalette(palette);
 	searchButtonLayout->addStretch(1);
 	searchButtonLayout->addWidget(m_searchButton);
 
@@ -299,3 +303,12 @@
 
 	return "";
 }
+
+void SearchWidget::keyPressEvent( QKeyEvent * e )
+{
+	int key = e->key();
+	if ((key == Qt::Key_Enter) || (key == Qt::Key_Return))
+	{
+		m_searchButton->click();
+	}
+}
\ No newline at end of file
--- a/widgets/SearchWidget.h	Fri Jun 29 10:04:07 2007 +0000
+++ b/widgets/SearchWidget.h	Thu Jul 05 13:53:44 2007 +0000
@@ -53,6 +53,8 @@
 
 	void reset();
 
+	virtual void keyPressEvent( QKeyEvent * e);
+
 public slots:
 	void activeTheme();