Accepted C++ / Qt constructs

typedef

struct

class

  • Class definition can not be nested.
  • A class must not have private abstract functions.
  • Constructor must be in the public, private or protected sections.
  • Function must be in the public, private, protected, slot or signal sections.
  • Class variables must be in the public section.
  • Class enums must be in the public or protected sections.

Member functions

Static functions must be public and cannot be virtual.

The syntax of class method declarations is as follows:

name ([arg]..) [const] [=0] [/optflag[,optflag]../] ; [member_code]

Option flags can be given in a comma separated list of optflags enclosed in slashes. optflags can be boolean or take a value. The following flags are recognized:

Table 4-2. Flags in member function declaration

PyName=py_nameUse py_name instead of the C++ function name
ReleaseLockRelease the python interpreter lock
PreHook=hook_functionDefine hook_function to be called prior to the memberfunc
PostHook=hook_functionDefine hook_function to be called after the memberfunc
TransferOwnership is transferred
TransferThisOwnership of this is transferred
TransferBackOwnership is transferred back

public

protected

If the function is protected then call the public wrapper. Otherwise explicitly call the real function and not any version in the wrapper class in case it is virtual. This will prevent virtual loops. Don't need to worry about indirected objects for protected functions.

private

signals

  • Arguments must be simple. Otherwise you have to supply your own C++ code.
  • Virtual signals aren't supported.
slots

  • Arguments must be simple. Otherwise you have to supply your own C++ code.
virtual

  • Static functions cannot be virtual.
  • Virtual signals aren't supported.
  • Arguments must be simple. Otherwise you have to supply your own C++ code.
const

  • Accepted for const function arguments and const functions.
static

  • %VariableCode cannot be specified for non-static class variables.
  • Cannot mix static and non-static member functions with the same Python name.
  • Static functions must be public and cannot be virtual.
void

bool

char

short

unsigned

int

long

float

double

enum