@staticmethod
    def FormToPySideWidget(form, ctx = sys.modules['__main__']):
        """
        Use this method to convert a TForm* to a QWidget to be used by PySide

        @param ctx: Context. Reference to a module that already imported QtGui module
        """
        if form is None:
            return None
        if type(form).__name__ == "SwigPyObject":
            # Since 'form' is a SwigPyObject, we first need to convert it to a PyCObject.
            # However, there's no easy way of doing it, so we'll use a rather brutal approach:
            # converting the SwigPyObject to a 'long' (will go through 'SwigPyObject_long',
            # that will return the pointer's value as a long), and then convert that value
            # back to a pointer into a PyCObject.
            ptr_l = long(form)
            from ctypes import pythonapi, c_void_p, py_object
            pythonapi.PyCObject_FromVoidPtr.restype  = py_object
            pythonapi.PyCObject_AsVoidPtr.argtypes = [c_void_p, c_void_p]
            form = pythonapi.PyCObject_FromVoidPtr(ptr_l, 0)
        return ctx.QtGui.QWidget.FromCObject(form)
dataset/ETHPy150Open EiNSTeiN-/idapython/pywraps/py_plgform.py/PluginForm.FormToPySideWidget/original