Hugo Parente Lima wrote:
On Wednesday 31 March 2010 17:56:03 Josh wrote:
I'm trying to make a binding for a trivial test class:

    #include <QGLWidget>

    class Math : public QGLWidget
    {
        Q_OBJECT
    public:
        Math() {}
        virtual ~Math() {}
        int squared(int x);

    signals:
        void aSignal(QPoint, QSize);
    };

I have a typesystem file for the binding:

    <?xml version="1.0"?>
    <typesystem package="foo">
        <load-typesystem name="typesystem_core.xml" generate="no"/>
        <load-typesystem name="typesystem_opengl.xml" generate="no"/>
        <object-type name="Math"/>
    </typesystem>


When I run this through shiboken I get the following

    WARNING :: signal 'aSignal' in non-QObject class 'Math'
    WARNING :: unknown baseclass for 'Math': 'QGLWidget'
    WARNING :: type 'QFontDialog' is specified in typesystem, but not
    defined. This could potentially lead to compilation errors.
    .... lots more of the last warning...

Does someone have a working example of a trivial binding using shiboken
I could look at?

Check if the header that you used with the generator (global.h) have the includes for QtCore, QtGui and QtOpenGL modules, and if the include paths are correct.

These problems are due the parser did not find the class declarations of QObject, QWidget and QGLWidget.
Right. That got me a little further. It still fails, but is down to a hand full of warnings:

   WARNING :: enum 'QGLContext::BindOption' does not have a type entry
   or is not an enum
   WARNING :: enum 'QtValidLicenseForDeclarativeModule' does not have a
   type entry or is not an enum
   WARNING :: enum 'QPixmap::ShareMode' is specified in typesystem, but
   not declared
   WARNING :: type 'QGLShaderProgram' is specified in typesystem, but
   not defined. This could potentially lead to compilation errors.
   WARNING :: type 'QGLFramebufferObject' is specified in typesystem,
   but not defined. This could potentially lead to compilation errors.
   WARNING :: type 'QAccessibleEvent' is specified in typesystem, but
   not defined. This could potentially lead to compilation errors.
   WARNING :: type 'QMetaObject' is specified in typesystem, but not
   defined. This could potentially lead to compilation errors.
   WARNING :: type 'QGenericReturnArgument' is specified in typesystem,
   but not defined. This could potentially lead to compilation errors.
   WARNING :: type 'QGLPixelBuffer' is specified in typesystem, but not
   defined. This could potentially lead to compilation errors.
   WARNING :: type 'QGenericArgument' is specified in typesystem, but
   not defined. This could potentially lead to compilation errors.
   WARNING :: unhandled enum value: ~0u in Qt::GestureType
   WARNING :: unmatched enum ~0u
   WARNING :: signature 'handle()const' for function modification in
   'QSessionManager' not found. Possible candidates:
   WARNING :: signature 'source()const' for function modification in
   'QDragMoveEvent' not found. Possible candidates: source()const in
   QDropEvent
   WARNING :: signature 'encodedData(const char*)const' for function
   modification in 'QDragMoveEvent' not found. Possible candidates:
   encodedData(const char*)const in QDropEvent
   WARNING :: signature 'format(int)const' for function modification in
   'QDragMoveEvent' not found. Possible candidates: format(int)const in
   QDropEvent
   WARNING :: signature 'provides(const char*)const' for function
   modification in 'QDragMoveEvent' not found. Possible candidates:
   provides(const char*)const in QDropEvent
   WARNING :: signature 'tryVisual(QGLFormat,int)' for function
   modification in 'QGLContext' not found. Possible candidates:
   WARNING :: signature 'chooseVisual()' for function modification in
   'QGLContext' not found. Possible candidates:
   WARNING :: signature 'metaObject()const' for function modification
   in 'QObject' not found. Possible candidates:
   make: *** No rule to make target VideoWidget_globals_wrapper.cpp',
   needed by `compile'.  Stop.




My typesystem_VideoWidget.xml is now:

   <?xml version="1.0"?>
   <typesystem package="VideoWidget">
       <load-typesystem name="typesystem_core.xml" generate="no"/>
       <load-typesystem name="typesystem_opengl.xml" generate="no"/>
       <load-typesystem name="typesystem_gui.xml" generate="no"/>

       <object-type name="VideoPlayerWidget"/>
   </typesystem>


And my global.h is:

   #undef QT_NO_STL
   #undef QT_NO_STL_WCHAR

   #ifndef NULL
   #define NULL    0
   #endif

   #include <QtCore/QtCore>
   #include <QtGui/QtGui>
   #include <QtOpenGL/QGLWidget>
   #include "../../VideoPlayerWidget.hpp"



Do I need to include more headers?

I also noticed that if <typesystem package="VideoWidget"> and <object-type name="VideoWidget"/> have the same value then shiboken complains about a duplicate class definition. Is that correct behavior?

Thanks for the help so far.

Josh
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to