ui.hideButton->setIcon(BarIcon("dialog-close"));
ui.searchUpButton->setIcon(SmallIcon("go-up"));
ui.searchDownButton->setIcon(SmallIcon("go-down"));
+ _searchDelayTimer.setSingleShot(true);
layout()->setContentsMargins(0, 0, 0, 0);
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) {
// a resize event which can lead to strange side effects.
ui.searchEditLine->clear();
QWidget::setVisible(visible);
- if(visible) ui.searchEditLine->setFocus();
+ if(visible)
+ ui.searchEditLine->setFocus();
+ else
+ emit hidden();
}
+void ChatViewSearchBar::delaySearch() {
+ _searchDelayTimer.start(300);
+}
+
+void ChatViewSearchBar::search() {
+ emit searchChanged(ui.searchEditLine->text());
+}