From ea7cee9d13d26af3622823da74fd91a96e827cf6 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 13 Feb 2017 16:31:06 +0000 Subject: [PATCH] Make the find behaviour in event browser to be a bit more 'sticky' * Clicking away from the find box doesn't lose your highlight/search, and if you open find again it has the previous search text there. --- qrenderdoc/Windows/EventBrowser.cpp | 27 +++++++++++++++++++-------- qrenderdoc/Windows/EventBrowser.h | 1 + 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/qrenderdoc/Windows/EventBrowser.cpp b/qrenderdoc/Windows/EventBrowser.cpp index f18618258..42329fdd4 100644 --- a/qrenderdoc/Windows/EventBrowser.cpp +++ b/qrenderdoc/Windows/EventBrowser.cpp @@ -76,8 +76,6 @@ EventBrowser::EventBrowser(CaptureContext &ctx, QWidget *parent) QObject::connect(ui->closeFind, &QToolButton::clicked, this, &EventBrowser::on_HideFindJump); QObject::connect(ui->closeJump, &QToolButton::clicked, this, &EventBrowser::on_HideFindJump); - QObject::connect(ui->jumpToEID, &RDLineEdit::leave, this, &EventBrowser::on_HideFindJump); - QObject::connect(ui->findEvent, &RDLineEdit::leave, this, &EventBrowser::on_HideFindJump); QObject::connect(ui->events, &RDTreeWidget::keyPress, this, &EventBrowser::events_keyPress); ui->jumpStrip->hide(); ui->findStrip->hide(); @@ -301,7 +299,6 @@ void EventBrowser::on_HideFindJump() ui->jumpToEID->setText(""); ClearFindIcons(); - ui->findEvent->setText(""); ui->findEvent->setStyleSheet(""); } @@ -344,16 +341,30 @@ void EventBrowser::on_findEvent_textEdited(const QString &arg1) void EventBrowser::on_findEvent_returnPressed() { + // stop the timer, we'll manually fire it instantly if(m_FindHighlight->isActive()) - { - // manually fire it instantly m_FindHighlight->stop(); - findHighlight_timeout(); - } if(!ui->findEvent->text().isEmpty()) - { Find(true); + + findHighlight_timeout(); +} + +void EventBrowser::on_findEvent_keyPress(QKeyEvent *event) +{ + if(event->key() == Qt::Key_F3) + { + // stop the timer, we'll manually fire it instantly + if(m_FindHighlight->isActive()) + m_FindHighlight->stop(); + + if(!ui->findEvent->text().isEmpty()) + Find(event->modifiers() & Qt::ShiftModifier ? false : true); + + findHighlight_timeout(); + + event->accept(); } } diff --git a/qrenderdoc/Windows/EventBrowser.h b/qrenderdoc/Windows/EventBrowser.h index bd56a7a1a..31e8d5d90 100644 --- a/qrenderdoc/Windows/EventBrowser.h +++ b/qrenderdoc/Windows/EventBrowser.h @@ -63,6 +63,7 @@ private slots: void on_HideFindJump(); void on_jumpToEID_returnPressed(); void on_findEvent_returnPressed(); + void on_findEvent_keyPress(QKeyEvent *event); void on_findEvent_textEdited(const QString &arg1); void on_events_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); void on_findNext_clicked();