Implemented select all (Ctrl+A) and deselect (Esc) shortcuts in hex viewer byte item selection
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <QString>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QGraphicsSceneWheelEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <optional>
|
||||
#include <QGraphicsRectItem>
|
||||
#include <QPointF>
|
||||
@@ -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();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user