Difference between revisions of "KDE Visual Design Group/HIG/UI Files"

Jump to: navigation, search
(Created page with '==UI Files== UI files are used by '''Qt Designer''' and '''Qt Creator''' for designing ''User Interfaces''. ==How to use UI files== In order to use your interfaces, you have ...')
 
(Example)
Line 48: Line 48:
 
</code>
 
</code>
  
I have made a screenshot too:
+
Here a screenshot:
  
 
[[File:UI-Package-Example.png]]
 
[[File:UI-Package-Example.png]]

Revision as of 11:53, 3 January 2011

UI Files

UI files are used by Qt Designer and Qt Creator for designing User Interfaces.


How to use UI files

In order to use your interfaces, you have to compile these files into a Python or C++ application. For this tutorial I have chosen Python.

Obviously, you need Python. On KUbuntu, it can be installed with this command (in your terminal): $ sudo apt-get install python2.6

You have to compile your .ui files with the pyuic4 tool. Make sure you have the pyqt4-dev-tools package installed. On KUbuntu, just open the terminal and type: $ sudo apt-get install pyqt4-dev-tools

This will check if the package is installed. If not it will installed automatically.

Now you can compile the .ui file into a Python file! Simply run the following command: $ pyuic4 -x -o output.py input.ui

Notes:

  • -x tells pyuic4 to generate extra code to directly test and display the GUI
  • -o sets the output file

To display the GUI, you only have to run Python: $ python2.6 output.py


Example

Let's compile Tabs and Pages in Dialogs/Tabs_pages3.ui from File:HIG-UI-Files.tar.gz. Decompress the tarball and run: $ cd path/to/the/extracted/tarball $ pyuic4 -x -o Tabs_pages3.py 'Tabs and Pages in Dialogs/Tabs_pages3.ui'

Now run it through Python: $ python2.6 Tabs_pages3.py

Here a screenshot:

UI-Package-Example.png


Content is available under Creative Commons License SA 4.0 unless otherwise noted.