From c16b4341089173f73cb912d4b77feec197fab6dc 2010-05-29 18:30:45 From: florianlink Date: 2010-05-29 18:30:45 Subject: [PATCH] fixed example for 2.0 API git-svn-id: svn://svn.code.sf.net/p/pythonqt/code/trunk@192 ea8d5007-eb21-0410-b261-ccb3ea6e24a9 --- diff --git a/examples/PyDecoratorsExample/example.py b/examples/PyDecoratorsExample/example.py index 3648d0d..e9d25f0 100644 --- a/examples/PyDecoratorsExample/example.py +++ b/examples/PyDecoratorsExample/example.py @@ -1,22 +1,22 @@ -from PythonQt import * +from PythonQt import QtCore, QtGui, example # call our new constructor of QSize -size = QSize(QPoint(1,2)); +size = QtCore.QSize(QtCore.QPoint(1,2)); # call our new QPushButton constructor -button = QPushButton("sometext"); +button = QtGui.QPushButton("sometext"); # call the move slot (overload1) -button.move(QPoint(0,0)) +button.move(QtCore.QPoint(0,0)) # call the move slot (overload2) button.move(0,0) # call the static method -print QWidget.mouseGrabber(); +print QtGui.QWidget.mouseGrabber(); # create a CPP object via constructor -yourCpp = YourCPPObject(2,11.5) +yourCpp = example.YourCPPObject(2,11.5) # call the wrapped method on CPP object print yourCpp.doSomething(3); diff --git a/examples/PyDecoratorsExample/main.cpp b/examples/PyDecoratorsExample/main.cpp index 8157044..3fe5d6d 100644 --- a/examples/PyDecoratorsExample/main.cpp +++ b/examples/PyDecoratorsExample/main.cpp @@ -55,8 +55,8 @@ int main( int argc, char **argv ) PythonQtScriptingConsole console(NULL, mainContext); PythonQt::self()->addDecorators(new PyExampleDecorators()); - PythonQt::self()->registerClass(&QPushButton::staticMetaObject); - PythonQt::self()->registerCPPClass("YourCPPObject"); + PythonQt::self()->registerClass(&QPushButton::staticMetaObject, "QtGui"); + PythonQt::self()->registerCPPClass("YourCPPObject","", "example"); mainContext.evalFile(":example.py");