MemoryViewWidget: Use QStringView with ConvertTextToBytes

Allows for avoiding string copies. While we're at it, we can also mark
ConvertTextToBytes as const.
This commit is contained in:
Lioncash 2023-06-08 12:01:56 -04:00
parent cfd25f1d7c
commit 2b0a9477d0
2 changed files with 2 additions and 2 deletions

View File

@ -609,7 +609,7 @@ AddressSpace::Type MemoryViewWidget::GetAddressSpace() const
return m_address_space; return m_address_space;
} }
std::vector<u8> MemoryViewWidget::ConvertTextToBytes(Type type, QString input_text) std::vector<u8> MemoryViewWidget::ConvertTextToBytes(Type type, QStringView input_text) const
{ {
if (type == Type::Null) if (type == Type::Null)
return {}; return {};

View File

@ -60,7 +60,7 @@ public:
void UpdateFont(); void UpdateFont();
void ToggleBreakpoint(u32 addr, bool row); void ToggleBreakpoint(u32 addr, bool row);
std::vector<u8> ConvertTextToBytes(Type type, QString input_text); std::vector<u8> ConvertTextToBytes(Type type, QStringView input_text) const;
void SetAddressSpace(AddressSpace::Type address_space); void SetAddressSpace(AddressSpace::Type address_space);
AddressSpace::Type GetAddressSpace() const; AddressSpace::Type GetAddressSpace() const;
void SetDisplay(Type type, int bytes_per_row, int alignment, bool dual_view); void SetDisplay(Type type, int bytes_per_row, int alignment, bool dual_view);