Help on QT4 UI file and integration (newbie)


I am not newbie programmer (senior Flex, senior Delphi), but I am newbie on linux, QT, python… well, ok, I know some python, but never made any graphical application.

I have opened Qt4 Designer and made my form.
I tried to use this tutorial: PyQT Tutorial but it’s for older version of Qt designer, and this which I have, could not discover how to make function code. Also, pyuic didn’t created any code from ui file…

Then, I opened KDdevelop, and selected new python project, but it included some sample form and made bunch of functions…

What I want is to somehow link my form (ui file) with python and add functions.
Can be C++ also…

What I want to make is batch image resizer, similar to BIRT but simpler with just the things I need.

If you wish to see UI file its here:

Any help appreciated.

Qt 4.3: How to Learn Qt

Qt 4.3: Qt Tutorial

QT Designer Tutorial

The Independent Qt Tutorial - TOC

Thanks. I will look into it.
Also, if anyone wishes to tutor me and work on the application (eh, would have 30 lines of code, eheheh), is welcome

I been through tutorials, but no light casted.

  1. all tutorials are for C++ or old version of Qt. Seems that new Qt4 designer doesn’t support code for signals. I can’t find where to input code for, for example, click() on a button. Old version could do that.

  2. because of (1), pyuic doesn’t generate any code (except import)

  3. uic gives bunch of C++ code which I do not know how to import in KDevelop

  4. KDevelop (multilanguage - want for python) always makes template, and I can’t find the way how to import UI that was made in Qt Designer.

I am lost…

Basically what you have to do is take the file you created with designer and run uic against it like so:

uic -o ui_filename.h filename.ui

This will create a .h file, include this header in the code file that will be creating the Ui. call Ui::setupUI to set up the user interface like so:


Once the UI is setup you can connect signals and slots like so.

connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));

Or you can just have a method with the same name as a slot and it will auto-connect, for example say you had a line edit widget, and wanted to capture the on_lineEdit_textChanged() signal then you would simply create a method
void on_lineEdit_textChanged() and it will be connected.

Ok, let me see if I understood:

I do uic so now I have .h file. I edit file, add:

void btnBrowse::click()

? is that so?
I seen in one tutorial that I can put some python code inside {}, will it work, or I have to do another pyuic?


Seems that I am stupid for this. Tried in QDevelop (seems simpler than KDevelop), changed UI file, changed #include but it is a mess. Can’t seem to understand how it works.

Can anyone just create for me an empty project, using my UI, without any functionality? Just to see it compile and then, I will try to add some functions. Please? Anyone?

UI file: