- connect(ui.hideButton, SIGNAL(clicked()), toggleSearchBar, SLOT(toggle()));
+ Action *hideSearchBar = coll->add<Action>("HideSearchBar", toggleSearchBar, SLOT(setChecked(bool)));
+ hideSearchBar->setShortcutConfigurable(false);
+ hideSearchBar->setShortcut(Qt::Key_Escape);
+
+ connect(ui.hideButton, SIGNAL(clicked()), toggleSearchBar, SLOT(toggle()));
+ connect(ui.searchEditLine, SIGNAL(textChanged(const QString &)), this, SLOT(delaySearch()));
+ connect(&_searchDelayTimer, SIGNAL(timeout()), this, SLOT(search()));
+}
+
+
+void ChatViewSearchBar::setVisible(bool visible)
+{
+ // clearing the search field also removes the highlight items from the scene
+ // this should be done before the SearchBar is hidden, as the hiding triggers
+ // a resize event which can lead to strange side effects.
+ ui.searchEditLine->clear();
+ QWidget::setVisible(visible);
+ if (visible)
+ ui.searchEditLine->setFocus();
+ else
+ emit hidden();