diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.cpp index f5e78f3e..dffe1687 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.cpp @@ -376,6 +376,21 @@ namespace Bloom::Widgets this->clearSelectionRectItem(); } + void ByteItemGraphicsScene::keyPressEvent(QKeyEvent* keyEvent) { + const auto key = keyEvent->key(); + + if (key == Qt::Key_Escape) { + this->clearByteItemSelection(); + return; + } + + const auto modifiers = keyEvent->modifiers(); + if ((modifiers & Qt::ControlModifier) != 0 && key == Qt::Key_A) { + this->selectAllByteItems(); + return; + } + } + void ByteItemGraphicsScene::updateAnnotationValues(const Targets::TargetMemoryBuffer& buffer) { const auto memoryStartAddress = this->targetMemoryDescriptor.addressRange.startAddress; for (auto* valueAnnotationItem : this->valueAnnotationItems) { @@ -642,4 +657,9 @@ namespace Bloom::Widgets this->selectedByteItems.clear(); } + void ByteItemGraphicsScene::selectAllByteItems() { + for (auto& [address, byteItem] : this->byteItemsByAddress) { + this->selectByteItem(byteItem); + } + } } diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.hpp index 501ae1f5..3d3a1532 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/ByteItemGraphicsScene.hpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -68,6 +69,7 @@ namespace Bloom::Widgets void mousePressEvent(QGraphicsSceneMouseEvent* mouseEvent) override; void mouseMoveEvent(QGraphicsSceneMouseEvent* mouseEvent) override; void mouseReleaseEvent(QGraphicsSceneMouseEvent* mouseEvent) override; + void keyPressEvent(QKeyEvent* keyEvent) override; private: const Targets::TargetMemoryDescriptor& targetMemoryDescriptor; @@ -129,5 +131,6 @@ namespace Bloom::Widgets void deselectByteItem(ByteItem* byteItem); void toggleByteItemSelection(ByteItem* byteItem); void clearByteItemSelection(); + void selectAllByteItems(); }; }