Add support for passing QWidget * to/from PySide in qrenderdoc bindings

This commit is contained in:
baldurk
2017-04-18 14:57:43 +01:00
parent a77fecf44d
commit 6f52ef5c68
3 changed files with 47 additions and 24 deletions
+14 -2
View File
@@ -64,10 +64,22 @@ public:
template <typename QtObjectType>
void setQtGlobal(const char *varName, QtObjectType *object)
{
const char *typeName = typeid(*const_cast<QtObjectType *>(object)).name();
// forward non-template part on
setQtGlobal_internal(varName, typeid(*const_cast<QtObjectType *>(object)).name(), object);
PyObject *obj = QtObjectToPython(typeName, object);
if(obj)
setPyGlobal(varName, obj);
else
emit exception("RuntimeError",
QString("Failed to set variable '%1' of type '%2'").arg(varName).arg(typeName),
{});
}
static PyObject *QWidgetToPy(QWidget *widget) { return QtObjectToPython("QWidget", widget); }
static QWidget *QWidgetFromPy(PyObject *widget);
QString currentFile() { return location.file; }
int currentLine() { return location.line; }
signals:
@@ -103,7 +115,7 @@ private:
int line = 0;
} location;
void setQtGlobal_internal(const char *varName, const char *typeName, QObject *object);
static PyObject *QtObjectToPython(const char *typeName, QObject *object);
// Python callbacks
static void outstream_del(PyObject *self);