summaryrefslogtreecommitdiff
path: root/src/findbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/findbar.cpp')
-rw-r--r--src/findbar.cpp38
1 files changed, 15 insertions, 23 deletions
diff --git a/src/findbar.cpp b/src/findbar.cpp
index b3b80fac..18a4f168 100644
--- a/src/findbar.cpp
+++ b/src/findbar.cpp
@@ -138,25 +138,27 @@ bool FindBar::highlightAllState() const
return m_highlightAll->isChecked();
}
-
-void FindBar::show()
+void FindBar::setVisible(bool visible)
{
- // show findbar if not visible
- if (isHidden())
- {
- emit visibilityChanged(true);
- QWidget::show();
+ QWidget::setVisible(visible);
+
+ if (visible != isVisible())
+ emit visibilityChanged(visible);
+
+ if (visible) {
+ // show findbar if not visible
emit searchString(m_lineEdit->text());
- }
- m_hideTimer->start(60000);
+ m_hideTimer->start(60000);
- // set focus to findbar if user select showFindBar shortcut
- m_lineEdit->setFocus();
- m_lineEdit->selectAll();
+ // set focus to findbar if user select showFindBar shortcut
+ m_lineEdit->setFocus();
+ m_lineEdit->selectAll();
+ } else {
+ m_hideTimer->stop();
+ }
}
-
void FindBar::notifyMatch(bool match)
{
QPalette p = m_lineEdit->palette();
@@ -180,16 +182,6 @@ void FindBar::notifyMatch(bool match)
m_hideTimer->start(60000);
}
-
-void FindBar::hide()
-{
- m_hideTimer->stop();
- emit visibilityChanged(false);
- QWidget::hide();
- emit(searchString(m_lineEdit->text()));
-}
-
-
void FindBar::toggleVisibility()
{
isVisible() ? hide() : show();