From 9002b5d3c4f1677e5bc98b77956150a136f83b7f Mon Sep 17 00:00:00 2001 From: megabigbug Date: Sun, 6 Dec 2009 14:30:22 +0100 Subject: Hide findBar after one minute --- src/findbar.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/findbar.cpp') diff --git a/src/findbar.cpp b/src/findbar.cpp index 09cc46f1..bd1a5137 100644 --- a/src/findbar.cpp +++ b/src/findbar.cpp @@ -45,12 +45,14 @@ #include #include #include +#include FindBar::FindBar(KMainWindow *mainwindow) : QWidget(mainwindow) , m_lineEdit(new KLineEdit(this)) , m_matchCase(new QCheckBox(i18n("&Match case"), this)) + , m_hideTimer(new QTimer(this)) { QHBoxLayout *layout = new QHBoxLayout; @@ -65,6 +67,9 @@ FindBar::FindBar(KMainWindow *mainwindow) layout->addWidget(hideButton); layout->setAlignment(hideButton, Qt::AlignLeft | Qt::AlignTop); + // hide timer + connect(m_hideTimer, SIGNAL(timeout()), this, SLOT(hide())); + // label QLabel *label = new QLabel(i18n("Find:")); layout->addWidget(label); @@ -92,7 +97,7 @@ FindBar::FindBar(KMainWindow *mainwindow) layout->addStretch(); setLayout(layout); - + // we start off hidden hide(); } @@ -132,6 +137,7 @@ void FindBar::show() return; QWidget::show(); + m_hideTimer->start(60000); } @@ -140,6 +146,7 @@ void FindBar::keyPressEvent(QKeyEvent* event) if (event->key() == Qt::Key_Escape) { hide(); + m_hideTimer->stop(); return; } if (event->key() == Qt::Key_Return && !m_lineEdit->text().isEmpty()) @@ -171,6 +178,5 @@ void FindBar::notifyMatch(bool match) } } m_lineEdit->setPalette(p); + m_hideTimer->start(60000); } - - -- cgit v1.2.1