@@ -1,22 +1,22 | |||||
1 |
from PythonQt import |
|
1 | from PythonQt import QtCore, QtGui, example | |
2 |
|
2 | |||
3 | # call our new constructor of QSize |
|
3 | # call our new constructor of QSize | |
4 | size = QSize(QPoint(1,2)); |
|
4 | size = QtCore.QSize(QtCore.QPoint(1,2)); | |
5 |
|
5 | |||
6 | # call our new QPushButton constructor |
|
6 | # call our new QPushButton constructor | |
7 | button = QPushButton("sometext"); |
|
7 | button = QtGui.QPushButton("sometext"); | |
8 |
|
8 | |||
9 | # call the move slot (overload1) |
|
9 | # call the move slot (overload1) | |
10 | button.move(QPoint(0,0)) |
|
10 | button.move(QtCore.QPoint(0,0)) | |
11 |
|
11 | |||
12 | # call the move slot (overload2) |
|
12 | # call the move slot (overload2) | |
13 | button.move(0,0) |
|
13 | button.move(0,0) | |
14 |
|
14 | |||
15 | # call the static method |
|
15 | # call the static method | |
16 | print QWidget.mouseGrabber(); |
|
16 | print QtGui.QWidget.mouseGrabber(); | |
17 |
|
17 | |||
18 | # create a CPP object via constructor |
|
18 | # create a CPP object via constructor | |
19 | yourCpp = YourCPPObject(2,11.5) |
|
19 | yourCpp = example.YourCPPObject(2,11.5) | |
20 |
|
20 | |||
21 | # call the wrapped method on CPP object |
|
21 | # call the wrapped method on CPP object | |
22 | print yourCpp.doSomething(3); |
|
22 | print yourCpp.doSomething(3); |
@@ -55,8 +55,8 int main( int argc, char **argv ) | |||||
55 | PythonQtScriptingConsole console(NULL, mainContext); |
|
55 | PythonQtScriptingConsole console(NULL, mainContext); | |
56 |
|
56 | |||
57 | PythonQt::self()->addDecorators(new PyExampleDecorators()); |
|
57 | PythonQt::self()->addDecorators(new PyExampleDecorators()); | |
58 | PythonQt::self()->registerClass(&QPushButton::staticMetaObject); |
|
58 | PythonQt::self()->registerClass(&QPushButton::staticMetaObject, "QtGui"); | |
59 | PythonQt::self()->registerCPPClass("YourCPPObject"); |
|
59 | PythonQt::self()->registerCPPClass("YourCPPObject","", "example"); | |
60 |
|
60 | |||
61 | mainContext.evalFile(":example.py"); |
|
61 | mainContext.evalFile(":example.py"); | |
62 |
|
62 |
General Comments 0
You need to be logged in to leave comments.
Login now