[PyKDE] Problems with a port of C++/Qt book to Python
Eron Lloyd
eronlloyd at gmail.com
Mon Jul 18 19:07:39 BST 2005
On Monday 18 July 2005 11:01 am, Douglas Soares de Andrade wrote:
> Hi !
>
> Im trying to make a port of the book C++ GUI programming with Qt to Python.
> I alrealdy did the first chapter, but i tried to port the example in the
> section Subclassing Qt, but i have no success.
>
> Some part of the cpp code is a little complicated to me, as this example:
>
> FindDialog::FindDialog(QWidget *parent, const char *name) : QDialog(parent,
> name)
>
> As i understood, it is a implementation of the constructor, but i cant get
> the idea in how to port it to python.
>
> Can someone here can help me or translate this example to python, so i will
> do the rest, since it is most equal in the rest of the book.
>
> The code is here:
>
> http://www.unilestemg.br/find.tar.gz
>
> Thank you all so much for any help.
Hi Douglas,
Quite an ambitious project! What you see there is a typical class constructor.
In PyQt, you would want something along the lines of:
class FindDialog(QDialog):
def __init__(self, parent, name):
QDialog.__init__(self, parent, name)
What it is doing is defining the FindDialog constructor, accepting the
arguments parent and name, initializing its superclass QDialog, and passing
it the two arguments.
There is quite a bit of complicated C++ in the later chapters. Are you going
to be able to handle it? What would be nice is a detailed translation guide
for Qt/C++ to PyQt/Python. I started something along those lines, building on
the work done in the appendix of the PyQt book. On that thought, it probably
would be a better idea to update the PyQt book, and perhaps begin reshaping
it for (Py)Qt4!
Eron
More information about the PyQt
mailing list