Ah, that looks simple enough, thank you.

This make me think about two new issues which I need to understand before
making a first experiment:

1. Can PySide use the QApplication object from the C++ application? I assume
that the object must be registered with PySide in some way such that PySide
understands that a QApplication object is available?

I assume that I should expect problems when using a QWidget from another
QApplication (with a different QPaintDevice) in different QApplication.
The reason I ask is that when creating a QWidget without a QApplication the
error message "QWidget: Must construct a QApplication before a QPaintDevice"
is obtained...

2. Have you experienced any best practices when it comes to destroying
widgets which are embedded in this way?  If a C++ parent widget with a
PySide child is destroyed in the C++ application, would the PySide widget be
destroyed in a proper way or should I pay special attention to such embedded
PySide widgets?

2010/10/1 Renato Araujo Oliveira Filho <[email protected]>

> Hi Stefan,
>
> you can use the header generated by pyside for QtGui module found in
> "$PREFIX/include/PySide/QtGui/pyside_qtgui_python.h", then use these
> functions:
>
>
> Retrieve the C++ pointer from a Python object:
>      cppObj* = Shiboken::Converter< [c++ type] >::toCpp(PythonObject*)
>
> Retrieve the Python object from a  c++ object:
>      PyObject* = Shiboken::Converter< [c++ type] >::toPython(c++Obj*)
>
>
> BR
>
> On Fri, Oct 1, 2010 at 8:37 AM, Stefan Larsson <[email protected]> wrote:
> > Hello,
> > I am writing a C++ application using Qt4 and I am using Python embedded
> in
> > the application as a scripting backend for simple plugin development.
> > My question is if it is possible to acquire a QWidget* pointer from
> Pyside
> > such that custom widgets written using Pyside can be embedded directly
> > within the C++ application?  If not, would it be difficult to implement
> such
> > a feature?
> > I have also looked at PythonQt, but it seems as if Pyside has better
> > potential.
> > Best Regards,
> > Stefan Larsson
> >
> > _______________________________________________
> > PySide mailing list
> > [email protected]
> > http://lists.openbossa.org/listinfo/pyside
> >
> >
>
>
>
> --
> Renato Araujo Oliveira Filho
> Instituto Nokia de Tecnologia - INdT
> Mobile: +55 (81) 8704-2144
>
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to