Reset cache graphic scene size on cache graphic invalidation
MODIFY
src/cachesim/cachegraphic.cpp
src/cachesim/cachegraphic.cpp
@@ -451,6 +451,11 @@ void CacheGraphic::cacheInvalidated() {
updateLineReplFields(lineIdx);
}
}
+
+ if (auto* _scene = scene()) {
+ // Invalidate the scene rect to resize it to the current dimensions of the CacheGraphic
+ _scene->setSceneRect({});
+ }
}
void CacheGraphic::updateAddressing(bool valid, const CacheSim::CacheTransaction& transaction) {

MODIFY
src/cachesim/cachegraphic.h
src/cachesim/cachegraphic.h
@@ -15,7 +15,7 @@ class CacheGraphic : public QGraphicsObject {
public:
CacheGraphic(CacheSim& cache);
- QRectF boundingRect() const override { return QRectF(); };
+ QRectF boundingRect() const override { return childrenBoundingRect(); };
void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget* = nullptr) override {}

Reset cache graphic scene size on cache graphic invalidation