| 85 | } |
| 86 | |
| 87 | bool QuickFindWidget::eventFilter(QObject *obj, QEvent *event) |
| 88 | { |
| 89 | if (event->type() == QEvent::KeyPress) { |
| 90 | QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); |
| 91 | |
| 92 | // Use escape key to close the quick find widget |
| 93 | if (keyEvent->key() == Qt::Key_Escape) { |
| 94 | clearHighlights(); |
| 95 | clearCachedMatches(); |
| 96 | hide(); |
| 97 | editor->grabFocus(); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | return QObject::eventFilter(obj, event); |
| 102 | } |
| 103 | |
| 104 | void QuickFindWidget::setSearchContextColorBad() |
| 105 | { |