summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/searchbar.cpp24
-rw-r--r--src/searchbar.h5
2 files changed, 25 insertions, 4 deletions
diff --git a/src/searchbar.cpp b/src/searchbar.cpp
index a48803b3..785fcce5 100644
--- a/src/searchbar.cpp
+++ b/src/searchbar.cpp
@@ -21,9 +21,9 @@
#include "searchbar.h"
#include "searchbar.moc"
-// Qt Includes
-#include <QVBoxLayout>
-#include <QPalette>
+#include "browserapplication.h"
+#include "browsermainwindow.h"
+
SearchBar::SearchBar(QWidget *parent) :
QWidget(parent),
@@ -50,6 +50,24 @@ SearchBar::~SearchBar()
}
+void SearchBar::resizeEvent( QResizeEvent * event )
+{
+ QRect rect = m_lineEdit->contentsRect();
+
+ int width = rect.width();
+
+ int lineEditWidth = BrowserApplication::instance()->mainWindow()->size().width() / 5 ; // FIXME ( OR not?)
+
+ m_lineEdit->setGeometry( rect.x() + ( width - lineEditWidth + 8 ),
+ rect.y() + 4,
+ lineEditWidth,
+ m_lineEdit->height()
+ );
+
+ QWidget::resizeEvent( event );
+}
+
+
void SearchBar::searchNow()
{
QString searchText = m_lineEdit->text();
diff --git a/src/searchbar.h b/src/searchbar.h
index 92f20f8e..96ae282a 100644
--- a/src/searchbar.h
+++ b/src/searchbar.h
@@ -26,7 +26,7 @@
#include <KUrl>
// Qt Includes
-#include <QWidget>
+#include <QtGui>
class SearchBar : public QWidget
{
@@ -41,6 +41,9 @@ public:
public slots:
void searchNow();
+protected:
+ void resizeEvent( QResizeEvent *);
+
private:
KLineEdit *m_lineEdit;