From b07be04a3c9ea38c425d9e3df15fe52feaa67995 Mon Sep 17 00:00:00 2001 From: Nav Date: Thu, 24 Aug 2023 00:39:57 +0100 Subject: [PATCH] Clear highlighted bytes on ESC press, in snpashot diff window --- .../SnapshotManager/SnapshotDiff/SnapshotDiff.cpp | 11 +++++++++++ .../SnapshotManager/SnapshotDiff/SnapshotDiff.hpp | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotDiff/SnapshotDiff.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotDiff/SnapshotDiff.cpp index 43a22fc5..db958fd4 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotDiff/SnapshotDiff.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotDiff/SnapshotDiff.cpp @@ -138,6 +138,17 @@ namespace Widgets QWidget::resizeEvent(event); } + void SnapshotDiff::keyPressEvent(QKeyEvent* keyEvent) { + const auto key = keyEvent->key(); + + if (key == Qt::Key_Escape) { + this->hexViewerWidgetA->clearHighlighting(); + this->hexViewerWidgetB->clearHighlighting(); + } + + QWidget::keyPressEvent(keyEvent); + } + void SnapshotDiff::init() { this->setWindowFlag(Qt::Window); this->setObjectName("snapshot-diff"); diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotDiff/SnapshotDiff.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotDiff/SnapshotDiff.hpp index 67ea97c1..f48624d7 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotDiff/SnapshotDiff.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotDiff/SnapshotDiff.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -55,6 +56,7 @@ namespace Widgets protected: void showEvent(QShowEvent* event) override; void resizeEvent(QResizeEvent* event) override; + void keyPressEvent(QKeyEvent* keyEvent) override; private: SnapshotDiffSettings settings;