PySide Binding Generation Tutorial: Module 4 The Global Header

From Qt Wiki
Revision as of 15:11, 4 March 2015 by AutoSpider (talk | contribs) (Convert ExpressionEngine links)
Jump to navigation Jump to search
This article may require cleanup to meet the Qt Wiki's quality standards. Reason: Auto-imported from ExpressionEngine.
Please improve this article if you can. Remove the {{cleanup}} tag and add this page to Updated pages list after it's clean.

[toc align_right="yes" depth="3"]

English French

The Global Header

In addition to the information provided by the type system, the generator needs to gather more data from the library headers containing the classes to be exported to Python. If there is a header that includes all the others (or just one, as is the case of libfoo) this could be passed directly to the generator.

If such a file is not available, or only a subset of the library is desired, or if some flags must be set through

#define

statements before parsing the library headers, then a

global.h

file must be provided. For example, if NULL is not defined and it is used as a default parameter for some constructor or method, the parser will not recognize it.

global.h

#undef QT_NO_STL
#undef QT_NO_STL_WCHAR

#ifndef NULL
#define NULL 0
#endif

#include "pyside_global.h"
#include <foo.h>
pyside_global.h

contains includes and definitions needed to generate the PySide bindings. It was copied from the resulting file after processing of

pyside/PySide/global.pc.in

. At the moment the file is included in this tutorial's source code tarball, but the desirable situation is to have it provided by PySide itself. For the time being just copy it to your PySide based binding projects.