From b4d3fea0024001f899ace5e6f377d7232df21656 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Mon, 13 Mar 2023 17:30:31 -0400 Subject: Ladybird: Add a utility to create a QString from an AK::String --- Ladybird/Utilities.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Ladybird/Utilities.cpp') diff --git a/Ladybird/Utilities.cpp b/Ladybird/Utilities.cpp index 12a534a1a6..4f0fa2de5a 100644 --- a/Ladybird/Utilities.cpp +++ b/Ladybird/Utilities.cpp @@ -29,6 +29,12 @@ QString qstring_from_ak_deprecated_string(AK::DeprecatedString const& ak_depreca return QString::fromUtf8(ak_deprecated_string.characters(), ak_deprecated_string.length()); } +QString qstring_from_ak_string(String const& ak_string) +{ + auto view = ak_string.bytes_as_string_view(); + return QString::fromUtf8(view.characters_without_null_termination(), view.length()); +} + void platform_init() { #ifdef AK_OS_ANDROID -- cgit v1.2.3