diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-02-15 15:38:36 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-02-15 15:38:36 +0100 |
commit | 93562769c23827a1a6ddec63816ac7edbdeb98f6 (patch) | |
tree | 15d226ee3dae2da99eef768461e4e239d874be1b /src/findbar.cpp | |
parent | BrowserApplication --> Application (diff) | |
parent | Preliminary flash support (diff) | |
download | rekonq-93562769c23827a1a6ddec63816ac7edbdeb98f6.tar.xz |
Merge branch 'master' into mainwindow
Diffstat (limited to 'src/findbar.cpp')
-rw-r--r-- | src/findbar.cpp | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/src/findbar.cpp b/src/findbar.cpp index 6ba310ca..df5b5bc7 100644 --- a/src/findbar.cpp +++ b/src/findbar.cpp @@ -33,33 +33,46 @@ #include <QtGui> -FindBar::FindBar(KXmlGuiWindow *parent) - : KToolBar( "findBar" , parent, Qt::BottomToolBarArea, true, false, false) +FindBar::FindBar(KXmlGuiWindow *mainwindow) + : QWidget() , m_lineEdit(0) { - KAction *close = new KAction(KIcon("dialog-close") , "close" , this); - connect( close , SIGNAL( triggered() ), this, SLOT( hide() ) ); - addAction( close ); + QHBoxLayout *layout = new QHBoxLayout; - QLabel *label = new QLabel("Find: "); - addWidget( label ); + // cosmetic + layout->setMargin(2); + + // hide button + QToolButton *hideButton = new QToolButton(this); + hideButton->setAutoRaise(true); + hideButton->setIcon(KIcon("dialog-close")); + connect(hideButton, SIGNAL(clicked()), this, SLOT(hide())); + layout->addWidget(hideButton); + layout->setAlignment( hideButton, Qt::AlignLeft|Qt::AlignTop ); - m_lineEdit = new KLineEdit(); - m_lineEdit->setMaximumWidth( 200 ); + // label + QLabel *label = new QLabel("Find: "); + layout->addWidget(label); - connect( m_lineEdit, SIGNAL( returnPressed() ), parent, SLOT( slotFindNext() ) ); - connect( m_lineEdit, SIGNAL( textEdited(const QString &) ), parent, SLOT( slotFindNext() ) ); - addWidget( m_lineEdit ); + // lineEdit, focusProxy + m_lineEdit = new KLineEdit(this); + setFocusProxy(m_lineEdit); + m_lineEdit->setMaximumWidth( 250 ); + connect( m_lineEdit, SIGNAL( textChanged(const QString &) ), mainwindow, SLOT( slotFind(const QString &) ) ); + layout->addWidget( m_lineEdit ); + // buttons KPushButton *findNext = new KPushButton( KIcon("go-down"), "&Next", this ); KPushButton *findPrev = new KPushButton( KIcon("go-up"), "&Previous", this ); - // perhaps we don't need working on style.. -// findNext->setStyle(); -// findPrev->setStyle(); - connect( findNext, SIGNAL( clicked() ), parent, SLOT( slotFindNext() ) ); - connect( findPrev, SIGNAL( clicked() ), parent, SLOT( slotFindPrevious() ) ); - addWidget( findNext ); - addWidget( findPrev ); + connect( findNext, SIGNAL( clicked() ), mainwindow, SLOT( slotFindNext() ) ); + connect( findPrev, SIGNAL( clicked() ), mainwindow, SLOT( slotFindPrevious() ) ); + layout->addWidget( findNext ); + layout->addWidget( findPrev ); + + // stretching widget on the left + layout->addStretch(); + + setLayout(layout); // we start off hidden hide(); @@ -102,7 +115,7 @@ void FindBar::keyPressEvent(QKeyEvent* event) hide(); return; } - if(event->key() == Qt::Key_Return && ! ( m_lineEdit->text().isEmpty() ) ) + if(event->key() == Qt::Key_Return && !m_lineEdit->text().isEmpty() ) { emit searchString( m_lineEdit->text() ); return; |