Skip to content

Commit e2d18f7

Browse files
author
florianlink
committed
fixed example for 2.0 API
git-svn-id: https://pythonqt.svn.sourceforge.net/svnroot/pythonqt/trunk@192 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
1 parent ee3a5fe commit e2d18f7

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

examples/PyDecoratorsExample/example.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
from PythonQt import *
1+
from PythonQt import QtCore, QtGui, example
22

33
# call our new constructor of QSize
4-
size = QSize(QPoint(1,2));
4+
size = QtCore.QSize(QtCore.QPoint(1,2));
55

66
# call our new QPushButton constructor
7-
button = QPushButton("sometext");
7+
button = QtGui.QPushButton("sometext");
88

99
# call the move slot (overload1)
10-
button.move(QPoint(0,0))
10+
button.move(QtCore.QPoint(0,0))
1111

1212
# call the move slot (overload2)
1313
button.move(0,0)
1414

1515
# call the static method
16-
print QWidget.mouseGrabber();
16+
print QtGui.QWidget.mouseGrabber();
1717

1818
# create a CPP object via constructor
19-
yourCpp = YourCPPObject(2,11.5)
19+
yourCpp = example.YourCPPObject(2,11.5)
2020

2121
# call the wrapped method on CPP object
2222
print yourCpp.doSomething(3);

examples/PyDecoratorsExample/main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ int main( int argc, char **argv )
5555
PythonQtScriptingConsole console(NULL, mainContext);
5656

5757
PythonQt::self()->addDecorators(new PyExampleDecorators());
58-
PythonQt::self()->registerClass(&QPushButton::staticMetaObject);
59-
PythonQt::self()->registerCPPClass("YourCPPObject");
58+
PythonQt::self()->registerClass(&QPushButton::staticMetaObject, "QtGui");
59+
PythonQt::self()->registerCPPClass("YourCPPObject","", "example");
6060

6161
mainContext.evalFile(":example.py");
6262

0 commit comments

Comments
 (0)