Made row and column highlighting on hover optional via tool button
This commit is contained in:
@@ -54,8 +54,11 @@ void ByteItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
|
||||
|
||||
const auto hoveredByteItem = this->hoveredByteItem.value_or(nullptr);
|
||||
if (hoveredByteItem != nullptr && (
|
||||
hoveredByteItem->currentColumnIndex == this->currentColumnIndex
|
||||
|| hoveredByteItem->currentRowIndex == this->currentRowIndex
|
||||
hoveredByteItem == this || (this->settings.highlightHoveredRowAndCol && (
|
||||
hoveredByteItem->currentColumnIndex == this->currentColumnIndex
|
||||
|| hoveredByteItem->currentRowIndex == this->currentRowIndex
|
||||
)
|
||||
)
|
||||
)
|
||||
) {
|
||||
painter->setBrush(QColor(0x8E, 0x8B, 0x83, hoveredByteItem == this ? 70 : 30));
|
||||
|
||||
@@ -22,6 +22,7 @@ ByteItemGraphicsScene::ByteItemGraphicsScene(
|
||||
): QGraphicsScene(parent),
|
||||
targetMemoryDescriptor(targetMemoryDescriptor),
|
||||
insightWorker(insightWorker),
|
||||
settings(settings),
|
||||
hoveredAddressLabel(hoveredAddressLabel),
|
||||
parent(parent) {
|
||||
this->setObjectName("byte-widget-container");
|
||||
@@ -158,7 +159,7 @@ void ByteItemGraphicsScene::onByteWidgetEnter(ByteItem* widget) {
|
||||
"Relative Address (Absolute Address): " + widget->relativeAddressHex + " (" + widget->addressHex + ")"
|
||||
);
|
||||
|
||||
if (!this->byteItemsByRowIndex.empty()) {
|
||||
if (this->settings.highlightHoveredRowAndCol && !this->byteItemsByRowIndex.empty()) {
|
||||
for (auto& byteWidget : this->byteItemsByColumnIndex.at(widget->currentColumnIndex)) {
|
||||
byteWidget->update();
|
||||
}
|
||||
@@ -166,6 +167,9 @@ void ByteItemGraphicsScene::onByteWidgetEnter(ByteItem* widget) {
|
||||
for (auto& byteWidget : this->byteItemsByRowIndex.at(widget->currentRowIndex)) {
|
||||
byteWidget->update();
|
||||
}
|
||||
|
||||
} else {
|
||||
widget->update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +179,7 @@ void ByteItemGraphicsScene::onByteWidgetLeave() {
|
||||
|
||||
this->hoveredAddressLabel->setText("Relative Address (Absolute Address):");
|
||||
|
||||
if (!this->byteItemsByRowIndex.empty()) {
|
||||
if (this->settings.highlightHoveredRowAndCol && !this->byteItemsByRowIndex.empty()) {
|
||||
for (auto& byteWidget : this->byteItemsByColumnIndex.at(byteItem->currentColumnIndex)) {
|
||||
byteWidget->update();
|
||||
}
|
||||
@@ -183,6 +187,9 @@ void ByteItemGraphicsScene::onByteWidgetLeave() {
|
||||
for (auto& byteWidget : this->byteItemsByRowIndex.at(byteItem->currentRowIndex)) {
|
||||
byteWidget->update();
|
||||
}
|
||||
|
||||
} else {
|
||||
byteItem->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,8 @@ namespace Bloom::Widgets
|
||||
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
||||
InsightWorker& insightWorker;
|
||||
|
||||
const HexViewerWidgetSettings& settings;
|
||||
|
||||
QWidget* parent = nullptr;
|
||||
QLabel* hoveredAddressLabel = nullptr;
|
||||
|
||||
|
||||
@@ -44,9 +44,14 @@ HexViewerWidget::HexViewerWidget(
|
||||
this->toolBar = this->container->findChild<QWidget*>("tool-bar");
|
||||
this->bottomBar = this->container->findChild<QWidget*>("bottom-bar");
|
||||
|
||||
this->refreshButton = this->container->findChild<QToolButton*>("refresh-memory-btn");
|
||||
this->highlightStackMemoryButton = this->container->findChild<SvgToolButton*>("highlight-stack-memory-btn");
|
||||
this->highlightFocusedMemoryButton = this->container->findChild<SvgToolButton*>("highlight-focused-memory-btn");
|
||||
this->refreshButton = this->toolBar->findChild<QToolButton*>("refresh-memory-btn");
|
||||
this->highlightStackMemoryButton = this->toolBar->findChild<SvgToolButton*>("highlight-stack-memory-btn");
|
||||
this->highlightHoveredRowAndColumnButton = this->toolBar->findChild<SvgToolButton*>(
|
||||
"highlight-hovered-rows-columns-btn"
|
||||
);
|
||||
this->highlightFocusedMemoryButton = this->container->findChild<SvgToolButton*>(
|
||||
"highlight-focused-memory-btn"
|
||||
);
|
||||
|
||||
this->toolBar->setContentsMargins(0, 0, 0, 0);
|
||||
this->toolBar->layout()->setContentsMargins(5, 0, 5, 1);
|
||||
@@ -70,18 +75,35 @@ HexViewerWidget::HexViewerWidget(
|
||||
this->byteItemGraphicsScene = this->byteItemGraphicsView->getScene();
|
||||
byteItemGraphicsViewLayout->insertWidget(0, this->byteItemGraphicsView);
|
||||
|
||||
this->setStackMemoryHighlightingEnabled(true);
|
||||
this->setHoveredRowAndColumnHighlightingEnabled(true);
|
||||
this->setFocusedMemoryHighlightingEnabled(true);
|
||||
|
||||
QObject::connect(
|
||||
this->highlightStackMemoryButton,
|
||||
&QToolButton::clicked,
|
||||
this,
|
||||
&HexViewerWidget::toggleStackMemoryHighlighting
|
||||
[this] {
|
||||
this->setStackMemoryHighlightingEnabled(!this->settings.highlightStackMemory);
|
||||
}
|
||||
);
|
||||
|
||||
QObject::connect(
|
||||
this->highlightHoveredRowAndColumnButton,
|
||||
&QToolButton::clicked,
|
||||
this,
|
||||
[this] {
|
||||
this->setHoveredRowAndColumnHighlightingEnabled(!this->settings.highlightHoveredRowAndCol);
|
||||
}
|
||||
);
|
||||
|
||||
QObject::connect(
|
||||
this->highlightFocusedMemoryButton,
|
||||
&QToolButton::clicked,
|
||||
this,
|
||||
&HexViewerWidget::toggleFocusedMemoryHighlighting
|
||||
[this] {
|
||||
this->setFocusedMemoryHighlightingEnabled(!this->settings.highlightFocusedMemory);
|
||||
}
|
||||
);
|
||||
|
||||
QObject::connect(
|
||||
@@ -150,20 +172,23 @@ void HexViewerWidget::onByteWidgetsAdjusted() {
|
||||
// }
|
||||
}
|
||||
|
||||
void HexViewerWidget::toggleStackMemoryHighlighting() {
|
||||
auto enable = !this->settings.highlightStackMemory;
|
||||
|
||||
this->highlightStackMemoryButton->setChecked(enable);
|
||||
this->settings.highlightStackMemory = enable;
|
||||
void HexViewerWidget::setStackMemoryHighlightingEnabled(bool enabled) {
|
||||
this->highlightStackMemoryButton->setChecked(enabled);
|
||||
this->settings.highlightStackMemory = enabled;
|
||||
|
||||
this->byteItemGraphicsScene->update();
|
||||
}
|
||||
|
||||
void HexViewerWidget::toggleFocusedMemoryHighlighting() {
|
||||
auto enable = !this->settings.highlightFocusedMemory;
|
||||
|
||||
this->highlightFocusedMemoryButton->setChecked(enable);
|
||||
this->settings.highlightFocusedMemory = enable;
|
||||
void HexViewerWidget::setHoveredRowAndColumnHighlightingEnabled(bool enabled) {
|
||||
this->highlightHoveredRowAndColumnButton->setChecked(enabled);
|
||||
this->settings.highlightHoveredRowAndCol = enabled;
|
||||
|
||||
this->byteItemGraphicsScene->update();
|
||||
}
|
||||
|
||||
void HexViewerWidget::setFocusedMemoryHighlightingEnabled(bool enabled) {
|
||||
this->highlightFocusedMemoryButton->setChecked(enabled);
|
||||
this->settings.highlightFocusedMemory = enabled;
|
||||
|
||||
this->byteItemGraphicsScene->update();
|
||||
}
|
||||
|
||||
@@ -59,13 +59,15 @@ namespace Bloom::Widgets
|
||||
|
||||
SvgToolButton* highlightStackMemoryButton = nullptr;
|
||||
SvgToolButton* highlightFocusedMemoryButton = nullptr;
|
||||
SvgToolButton* highlightHoveredRowAndColumnButton = nullptr;
|
||||
|
||||
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
||||
|
||||
private slots:
|
||||
void onTargetStateChanged(Targets::TargetState newState);
|
||||
void onByteWidgetsAdjusted();
|
||||
void toggleStackMemoryHighlighting();
|
||||
void toggleFocusedMemoryHighlighting();
|
||||
void setStackMemoryHighlightingEnabled(bool enabled);
|
||||
void setHoveredRowAndColumnHighlightingEnabled(bool enabled);
|
||||
void setFocusedMemoryHighlightingEnabled(bool enabled);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Bloom::Widgets
|
||||
bool highlightStackMemory = false;
|
||||
std::optional<std::uint32_t> stackPointerAddress;
|
||||
|
||||
bool highlightHoveredRowAndCol = false;
|
||||
bool highlightFocusedMemory = false;
|
||||
bool displayAsciiValues = false;
|
||||
};
|
||||
|
||||
@@ -89,6 +89,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="SvgToolButton" name="highlight-hovered-rows-columns-btn">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="svgFilePath">
|
||||
<string>:/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/highlight-hovered-rows-columns.svg</string>
|
||||
</property>
|
||||
<property name="disabledSvgFilePath">
|
||||
<string>:/compiled/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/Images/highlight-hovered-rows-columns-disabled.svg</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Highlight Row And Column On Hover</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="separator"/>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user