Fixed bug with FocusedRegionGroupItem not correctly updating the contained byte items
This commit is contained in:
@@ -28,6 +28,27 @@ namespace Bloom::Widgets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FocusedRegionGroupItem::~FocusedRegionGroupItem() {
|
||||||
|
const auto updateChildItems = [] (const decltype(this->items)& items, const auto& updateChildItems) -> void {
|
||||||
|
for (auto& item : items) {
|
||||||
|
auto* byteItem = dynamic_cast<ByteItem*>(item);
|
||||||
|
|
||||||
|
if (byteItem != nullptr) {
|
||||||
|
byteItem->grouped = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto* groupItem = dynamic_cast<GroupItem*>(item);
|
||||||
|
|
||||||
|
if (groupItem != nullptr) {
|
||||||
|
updateChildItems(groupItem->items, updateChildItems);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
updateChildItems(this->items, updateChildItems);
|
||||||
|
}
|
||||||
|
|
||||||
void FocusedRegionGroupItem::refreshValue(const HexViewerSharedState& hexViewerState) {
|
void FocusedRegionGroupItem::refreshValue(const HexViewerSharedState& hexViewerState) {
|
||||||
if (!hexViewerState.data.has_value()) {
|
if (!hexViewerState.data.has_value()) {
|
||||||
this->valueLabel = std::nullopt;
|
this->valueLabel = std::nullopt;
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ namespace Bloom::Widgets
|
|||||||
HexViewerItem* parent
|
HexViewerItem* parent
|
||||||
);
|
);
|
||||||
|
|
||||||
|
~FocusedRegionGroupItem();
|
||||||
|
|
||||||
void refreshValue(const HexViewerSharedState& hexViewerState);
|
void refreshValue(const HexViewerSharedState& hexViewerState);
|
||||||
|
|
||||||
void paint(
|
void paint(
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ namespace Bloom::Widgets
|
|||||||
class GroupItem: public HexViewerItem
|
class GroupItem: public HexViewerItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
std::vector<HexViewerItem*> items;
|
||||||
|
|
||||||
~GroupItem();
|
~GroupItem();
|
||||||
|
|
||||||
QSize size() const override {
|
QSize size() const override {
|
||||||
@@ -35,7 +37,6 @@ namespace Bloom::Widgets
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<HexViewerItem*> items;
|
|
||||||
QSize groupSize = {};
|
QSize groupSize = {};
|
||||||
bool multiLine = false;
|
bool multiLine = false;
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ namespace Bloom::Widgets
|
|||||||
}
|
}
|
||||||
|
|
||||||
byteItem.parent = this;
|
byteItem.parent = this;
|
||||||
byteItem.grouped = false;
|
|
||||||
this->items.push_back(&byteItem);
|
this->items.push_back(&byteItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user