This commit is contained in:
Nav
2023-03-01 22:12:22 +00:00
parent 6ecb52ad49
commit 3ce1d7df43
2 changed files with 8 additions and 16 deletions

View File

@@ -44,6 +44,7 @@ namespace Bloom::Widgets
this->displayAbsoluteAddressAction->setCheckable(true);
this->setAddressType(this->state.settings.addressLabelType);
this->setItemIndexMethod(QGraphicsScene::NoIndex);
QObject::connect(
InsightSignals::instance(),
@@ -133,7 +134,6 @@ namespace Bloom::Widgets
this->addItem(this->hoverRectX);
this->addItem(this->hoverRectY);
this->setItemIndexMethod(QGraphicsScene::NoIndex);
}
void ItemGraphicsScene::init() {
@@ -152,9 +152,6 @@ namespace Bloom::Widgets
);
InsightWorker::queueTask(constructHexViewerTopLevelGroupItem);
auto* vScrollBar = this->views().first()->verticalScrollBar();
vScrollBar->setSingleStep((ByteItem::HEIGHT + (ByteItem::BOTTOM_MARGIN / 2)));
}
void ItemGraphicsScene::updateStackPointer(std::uint32_t stackPointer) {
@@ -282,13 +279,9 @@ namespace Bloom::Widgets
auto allocatableGraphicsItemsCount = allocatableGraphicsItems.size();
const auto allocateRangeStartItemIt = this->gridPoints[gridPointIndex];
const auto allocateRangeEndItemIt = allocateRangeStartItemIt + std::min(
std::distance(allocateRangeStartItemIt, this->flattenedItems.end() - 1),
static_cast<long>(allocatableGraphicsItemsCount)
);
const auto allocateRangeEndItemIt = this->flattenedItems.end();
const auto& firstItem = *allocateRangeStartItemIt;
const auto& lastItem = *allocateRangeEndItemIt;
/*
* Ensure that a graphics item for each parent, grandparent, etc. is allocated for the first item in the

View File

@@ -1,5 +1,7 @@
#include "ItemGraphicsView.hpp"
#include "ByteItem.hpp"
namespace Bloom::Widgets
{
using Bloom::Targets::TargetMemoryDescriptor;
@@ -37,6 +39,7 @@ namespace Bloom::Widgets
);
this->setScene(this->scene);
this->verticalScrollBar()->setSingleStep((ByteItem::HEIGHT + (ByteItem::BOTTOM_MARGIN / 2)));
}
void ItemGraphicsView::initScene() {
@@ -54,14 +57,12 @@ namespace Bloom::Widgets
}
void ItemGraphicsView::scrollToByteItemAtAddress(Targets::TargetMemoryAddress address) {
if (this->scene != nullptr) {
this->centerOn(this->scene->getByteItemPositionByAddress(address));
}
this->centerOn(this->scene->getByteItemPositionByAddress(address));
}
bool ItemGraphicsView::event(QEvent* event) {
const auto eventType = event->type();
if (eventType == QEvent::Type::EnabledChange && this->scene != nullptr) {
if (eventType == QEvent::Type::EnabledChange) {
this->scene->setEnabled(this->isEnabled());
}
@@ -71,9 +72,7 @@ namespace Bloom::Widgets
void ItemGraphicsView::resizeEvent(QResizeEvent* event) {
QGraphicsView::resizeEvent(event);
if (this->scene != nullptr) {
this->scene->adjustSize();
}
this->scene->adjustSize();
}
void ItemGraphicsView::scrollContentsBy(int dx, int dy) {