Readme file for layout test
---------------------------------

This tar file contains source code for a simple layout test using python and qt.

It is based heavily on the excellent (French) guide by kib2, called "Utiliser PyQt4 avec QtDesigner",
which is available in pdf format at http://doc.qtfr.org/public/2007/pyqt4-designer.pdf .  There's also
a html version at http://kib2.free.fr/pyqt4/pyqt4.html but this is dark and difficult to read.
In any case, great thanks to kib2 for this starting point.

The aim
----------

The aim of this test is to use python, Qt and QtDesigner to make a simple gui.  The steps are as follows:
1) Use QtDesigner to draw the gui using drag-and-drop, menus, dialogs and other useful helpers.
2) Save this file as a .ui file
3) Use the command pyuic4 to convert the .ui file into a .py file
4) Write an additional python file to act as the main program and reference the generated python file

The example
----------------

In this example we just want to create a simple gui to get the idea of creating layouts and using
QtDesigner together with python.

The first step is to create a new "MainWindow" object in QtDesigner and populate it using horizontal
and vertical layouts, a "Line Edit" object, a "List Widget" object and a couple of "Push Button" objects.
Don't forget to use the Form->Preview command to check how the gui looks.
The result is saved as the file "testlayout.ui" which is xml format.

Using the command "pyuic4 -o testlayout.py testlayout.ui" we then generate a python file called testlayout.py
which contains our gui definitions.  Because we didn't use the option "-x", this only contains the class definition
and so running "python testlayout.py" doesn't do anything.  But that's ok, we're going to create another class for that.
We don't edit the generated testlayout.py file, because as the comment says, it will be regenerated
automatically so any hand-made changes in this file would be lost.

Next we create the file test.py which extends our testlayout.class and also adds the signal/slot connections.
Now we can call "python test.py" and see our finished application.  The "Add" button adds the text from the
edit box into the list widget, and the "Clear" button clears the list.  And that's it.

Separation
--------------
The advantage of this is that the code is at least partly separated from the gui functionality.
So we can go back into QtDesigner, change the gui, rerun pyuic4 and the changes should then be visible.
Of course if you change the names of objects in the gui then the main test.py class will also have to be edited,
but visual changes are independent of the functionality.
