add missing function 'qto-utf8' to correctly convert QStrings

This commit is contained in:
pls.153 2023-07-03 19:43:43 +02:00
parent f3c80bbce4
commit 99c059a70b
5 changed files with 20 additions and 1 deletions

View file

@ -43,6 +43,7 @@ void iniCLFunctions() {
DEFUN ("qfind-child", qfind_child, 2)
DEFUN ("%qfind-children", qfind_children2, 3)
DEFUN ("qfrom-utf8", qfrom_utf8, 1)
DEFUN ("qto-utf8", qto_utf8, 1)
DEFUN ("%qinvoke-method", qinvoke_method2, 3)
DEFUN ("%qload-c++", qload_cpp, 2)
DEFUN ("%qlog", qlog2, 1)
@ -335,6 +336,15 @@ cl_object qfrom_utf8(cl_object l_ba) {
ecl_return1(ecl_process_env(), l_ret);
}
cl_object qto_utf8(cl_object l_str) {
/// args: (string)
/// Returns the STRING converted to a vector of octets using
/// QString::toUtf8(). Use this function instead of CL BABEL to correctly
/// convert a QString (you got from Qt).
cl_object l_ret = from_qbytearray(toQString(l_str).toUtf8());
ecl_return1(ecl_process_env(), l_ret);
}
cl_object qescape(cl_object l_str) {
/// args: (string)
/// Calls QString::toHtmlEscaped().