MCPcopy Create free account
hub / github.com/baldurk/renderdoc / ToQStr

Function ToQStr

qrenderdoc/Code/pyrenderdoc/PythonContext.cpp:90–111  ·  view source on GitHub ↗

little utility function to convert a PyObject * that we know is a string to a QString

Source from the content-addressed store, hash-verified

88
89// little utility function to convert a PyObject * that we know is a string to a QString
90static inline QString ToQStr(PyObject *value)
91{
92 if(value)
93 {
94 PyObject *repr = PyObject_Str(value);
95 if(repr == NULL)
96 return QString();
97
98 PyObject *decoded = PyUnicode_AsUTF8String(repr);
99 if(decoded == NULL)
100 return QString();
101
102 QString ret = QString::fromUtf8(PyBytes_AsString(decoded));
103
104 Py_DecRef(decoded);
105 Py_DecRef(repr);
106
107 return ret;
108 }
109
110 return QString();
111}
112
113static wchar_t program_name[] = L"qrenderdoc";
114static wchar_t python_home[1024] = {0};

Callers 9

FetchExceptionFunction · 0.70
CheckInterfacesMethod · 0.70
LoadExtensionMethod · 0.70
completionOptionsMethod · 0.70
outstream_writeMethod · 0.70
HandleExceptionFunction · 0.70
EnvModToVariantFunction · 0.50
EnvModFromVariantFunction · 0.50
LoadMethod · 0.50

Calls 2

QStringFunction · 0.50
fromUtf8Function · 0.50

Tested by

no test coverage detected