-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyqbind.h
55 lines (45 loc) · 1.49 KB
/
pyqbind.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef PYQBIND_MAIN_H
#define PYQBIND_MAIN_H
class QObject;
/**
* Fully static class for automagical exposure of QObject to Python runtime.
*/
class PyQBind{
public:
/**
* Initialize the PyQBind system; called once before Python is initialized.
*/
static void pre_init();
/**
* Initialize the PyQBind system; called once after Python is initialized.
*/
static void post_init();
/**
* Export the properties and public slots of the given object. The object will
* be added to the pyqbind._all_objects list in Python; use addToGlobalNamespace
* or addToParent to expose the object in a more useful way.
*/
static void exportObject( QObject* q );
/**
* Add the given object, which must have been previously passed to exportObject,
* to python's __main__ namespace with the given name.
*/
static void addToGlobalNamespace( QObject* q, const std::string& name );
/**
* Set the child object as a python attribute of the parent object. Both the
* objects must have previously been exported to python with exportObject.
*/
static void addToParent( QObject* parent, QObject* child, const std::string& attrname );
/** General pyqbind error type */
class error : public std::runtime_error{
public:
error(): std::runtime_error("unknown pyqbind error"){}
error(const std::string& err): std::runtime_error(err){}
};
private:
// unimplemented; PyQBind is fully static
PyQBind();
PyQBind(const PyQBind&);
const PyQBind& operator=(const PyQBind&);
};
#endif /* PYQBIND_MAIN_H */