From 94329b092dae7d139b299416f4fe4e2bbae75a1d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 14 May 2009 11:58:32 +0200 Subject: Fixed (hopefully) searchbar. Near its last release.. --- src/lineedit.cpp | 2 +- src/searchbar.cpp | 19 +++++++++---------- src/searchbar.h | 6 +++--- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/lineedit.cpp b/src/lineedit.cpp index 9ca963af..dd90ce5a 100644 --- a/src/lineedit.cpp +++ b/src/lineedit.cpp @@ -33,7 +33,7 @@ LineEdit::LineEdit(QWidget* parent) : KLineEdit(parent) { - setMinimumWidth(180); + setMinimumWidth(200); setFocusPolicy(Qt::WheelFocus); setHandleSignals(true); diff --git a/src/searchbar.cpp b/src/searchbar.cpp index 9f6b306d..48e9290a 100644 --- a/src/searchbar.cpp +++ b/src/searchbar.cpp @@ -28,6 +28,7 @@ // KDE Includes #include +#include // Qt Includes #include @@ -38,19 +39,16 @@ #include -SearchBar::SearchBar(QWidget *parent) : - KLineEdit(parent) - , m_networkAccessManager(new QNetworkAccessManager(this)) - , m_timer(new QTimer(this)) +SearchBar::SearchBar(QWidget *parent) + : LineEdit(parent) + , m_networkAccessManager(new QNetworkAccessManager(this)) + , m_timer(new QTimer(this)) { - setMinimumWidth(180); - setFocusPolicy(Qt::WheelFocus); setMouseTracking(true); setAcceptDrops(true); - QSizePolicy policy = sizePolicy(); - setSizePolicy(QSizePolicy::Preferred, policy.verticalPolicy()); + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); setClearButtonShown(true); @@ -80,6 +78,7 @@ void SearchBar::searchNow() { m_timer->stop(); QString searchText = text(); + completionBox()->hide(); KUrl url(QLatin1String("http://www.google.com/search")); url.addQueryItem(QLatin1String("q"), searchText); @@ -92,8 +91,8 @@ void SearchBar::searchNow() void SearchBar::focusInEvent(QFocusEvent *event) { - KLineEdit::focusInEvent(event); - clear(); + selectAll(); + LineEdit::focusInEvent(event); } diff --git a/src/searchbar.h b/src/searchbar.h index 29588c58..fe30c946 100644 --- a/src/searchbar.h +++ b/src/searchbar.h @@ -22,8 +22,8 @@ #ifndef SEARCHBAR_H #define SEARCHBAR_H -// KDE Includes -#include +// Local Includes +#include "lineedit.h" // Forward Declarations class KUrl; @@ -36,7 +36,7 @@ class QNetworkReply; * This class defines an internet search bar. * */ -class SearchBar : public KLineEdit +class SearchBar : public LineEdit { Q_OBJECT -- cgit v1.2.1