diff options
Diffstat (limited to 'src/findbar.cpp')
-rw-r--r-- | src/findbar.cpp | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/src/findbar.cpp b/src/findbar.cpp index ae64b7f6..45de4246 100644 --- a/src/findbar.cpp +++ b/src/findbar.cpp @@ -26,57 +26,48 @@ #include <KToolBar> #include <KStandardAction> -#include <QHBoxLayout> -#include <QLabel> -#include <QEvent> -#include <QPixmap> -#include <QShortcut> -#include <QResizeEvent> +#include <QtGui> FindBar::FindBar(QWidget *parent) - : QWidget(parent) + : KToolBar(parent) , m_lineEdit(0) { initializeFindWidget(); // we start off hidden - setMaximumHeight(0); -// m_widget->setGeometry(0, -1 * m_widget->height(), m_widget->width(), m_widget->height()); hide(); - - new QShortcut(QKeySequence(Qt::Key_Escape), this, SLOT(hide())); } + FindBar::~FindBar() { delete m_lineEdit; } -void FindBar::initializeFindWidget() +KLineEdit *FindBar::lineEdit() { - QHBoxLayout *layout = new QHBoxLayout(); + return m_lineEdit; +} - KToolBar *bar1 = new KToolBar(this); - bar1->addAction( KStandardAction::close(this, SLOT( hide() ) , this ) ); - layout->addWidget( bar1 ); + +void FindBar::initializeFindWidget() +{ + addAction( KIcon("dialog-close") , "close" , this, SLOT( hide() ) ); QLabel *label = new QLabel("Find: "); - layout->addWidget( label ); + addWidget( label ); m_lineEdit = new KLineEdit(); connect( m_lineEdit, SIGNAL( returnPressed() ), this, SLOT( slotFindNext() ) ); connect( m_lineEdit, SIGNAL( textEdited(const QString &) ), this, SLOT( slotFindNext() ) ); - layout->addWidget( m_lineEdit ); - - KToolBar *bar2 = new KToolBar(this); - bar2->addAction( KStandardAction::findNext(this, SLOT( slotFindNext() ) , this ) ); - bar2->addAction( KStandardAction::findPrev(this, SLOT( slotFindPrevious() ) , this ) ); - layout->addWidget( bar2 ); + addWidget( m_lineEdit ); - layout->addStretch(); + addAction( KStandardAction::findNext(this, SLOT( slotFindNext() ) , this ) ); + addAction( KStandardAction::findPrev(this, SLOT( slotFindPrevious() ) , this ) ); - setLayout(layout); + QLabel *spaceLabel = new QLabel(" "); // FIXME + addWidget( spaceLabel ); } @@ -98,13 +89,6 @@ void FindBar::showFind() } -void FindBar::resizeEvent(QResizeEvent *event) -{ -/* if (event->size().width() != m_widget->width()) - m_widget->resize(event->size().width(), m_widget->height()); - QWidget::resizeEvent(event);*/ -} - void FindBar::frameChanged(int frame) { |