Register std::map<Targets::TargetMemoryAddress, Widgets::ByteItem*> meta type

This commit is contained in:
Nav
2023-01-14 12:53:57 +00:00
parent 7e08da1122
commit c35565bcd0
3 changed files with 8 additions and 4 deletions

View File

@@ -1,5 +1,7 @@
#include "ConstructHexViewerByteItems.hpp" #include "ConstructHexViewerByteItems.hpp"
#include <QMetaType>
namespace Bloom namespace Bloom
{ {
ConstructHexViewerByteItems::ConstructHexViewerByteItems( ConstructHexViewerByteItems::ConstructHexViewerByteItems(
@@ -14,7 +16,9 @@ namespace Bloom
, hoveredByteItem(hoveredByteItem) , hoveredByteItem(hoveredByteItem)
, highlightedByteItems(highlightedByteItems) , highlightedByteItems(highlightedByteItems)
, settings(settings) , settings(settings)
{} {
qRegisterMetaType<std::map<Targets::TargetMemoryAddress, Widgets::ByteItem*>>();
}
void ConstructHexViewerByteItems::run(TargetController::TargetControllerConsole&) { void ConstructHexViewerByteItems::run(TargetController::TargetControllerConsole&) {
const auto memorySize = this->memoryDescriptor.size(); const auto memorySize = this->memoryDescriptor.size();
@@ -36,6 +40,6 @@ namespace Bloom
); );
} }
emit this->byteItems(this->byteItemsByAddress); emit this->byteItems(std::move(this->byteItemsByAddress));
} }
} }

View File

@@ -34,7 +34,7 @@ namespace Bloom
signals: signals:
void sceneCreated(Widgets::ByteItemGraphicsScene* scene); void sceneCreated(Widgets::ByteItemGraphicsScene* scene);
void byteItems(std::map<Targets::TargetMemoryAddress, Widgets::ByteItem*>& byteItemsByAddress); void byteItems(std::map<Targets::TargetMemoryAddress, Widgets::ByteItem*> byteItemsByAddress);
protected: protected:
void run(TargetController::TargetControllerConsole&) override; void run(TargetController::TargetControllerConsole&) override;

View File

@@ -128,7 +128,7 @@ namespace Bloom::Widgets
constructByteItemsTask, constructByteItemsTask,
&ConstructHexViewerByteItems::byteItems, &ConstructHexViewerByteItems::byteItems,
this, this,
[this] (std::map<Targets::TargetMemoryAddress, ByteItem*>& byteItemsByAddress) { [this] (std::map<Targets::TargetMemoryAddress, ByteItem*> byteItemsByAddress) {
this->byteItemsByAddress = std::move(byteItemsByAddress); this->byteItemsByAddress = std::move(byteItemsByAddress);
for (const auto& [address, byteItem] : this->byteItemsByAddress) { for (const auto& [address, byteItem] : this->byteItemsByAddress) {