Passing return parameters from python to Qt object methods, like QVariant.toInt(bool* ok)
-
Many of the object methods in Qt take pointer arguments that are meant to return data. I am trying to get runtime data out of QVariant that has either a list or an int stored in it for a Squish test using python. To me this seemed like a basic programming thing that would have been documented, but I can't find anything on it. I tried using the ctypes that is part of python,
import ctypes # more code ok = ctypes.c_bool() count = object_qvariant_type.toInt(ctypes.byref(ok)) if(ok) # do something with the int else # do something with the list
but something in the ctypes byref() is returning a ctypes object that doesn't mess with the squish changes.
I also tried this, assuming squish may have worked out some things under the covers:
ok = false count = object_qvariant_type.toInt(ok)
count returns fine, but ok doesn't get set by toInt() and appears the squish version of bool is not mutable like the python one.
Can you get parameters in methods from Qt classes to return data using Squish?