Ladybird: Add ak_string_from_qstring function

This will be used later when doing the conversion from the QString in
QSettings for the homepage URL.
This commit is contained in:
martinfalisse 2023-02-01 18:47:56 +01:00 committed by Linus Groh
parent 4be6ee85e0
commit 65cf562a71
Notes: sideshowbarker 2024-07-17 05:58:46 +09:00
2 changed files with 7 additions and 0 deletions

View File

@ -19,6 +19,11 @@ AK::DeprecatedString ak_deprecated_string_from_qstring(QString const& qstring)
return AK::DeprecatedString(qstring.toUtf8().data());
}
ErrorOr<String> ak_string_from_qstring(QString const& qstring)
{
return String::from_utf8(StringView(qstring.toUtf8().data(), qstring.size()));
}
QString qstring_from_ak_deprecated_string(AK::DeprecatedString const& ak_deprecated_string)
{
return QString::fromUtf8(ak_deprecated_string.characters(), ak_deprecated_string.length());

View File

@ -7,9 +7,11 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/String.h>
#include <QString>
AK::DeprecatedString ak_deprecated_string_from_qstring(QString const&);
ErrorOr<String> ak_string_from_qstring(QString const&);
QString qstring_from_ak_deprecated_string(AK::DeprecatedString const&);
void platform_init();