Projects/Usability/HIG/UI Files: Difference between revisions

From KDE TechBase
< Projects‎ | Usability‎ | HIG
(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 ...')
 
(HIG moved to community)
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==UI Files==
{{ Moved To Community | KDE_Visual_Design_Group/HIG/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):
<code>
$ sudo apt-get install python2.6
</code>
 
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:
<code>
$ sudo apt-get install pyqt4-dev-tools
</code>
 
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:
<code>
$ pyuic4 -x -o output.py input.ui
</code>
 
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:
<code>
$ python2.6 output.py
</code>
 
 
==Example==
 
Let's compile '''''Tabs and Pages in Dialogs/Tabs_pages3.ui''''' from [[File:HIG-UI-Files.tar.gz|this tarball]]. Decompress the tarball and run:
<code>
$ cd path/to/the/extracted/tarball
$ pyuic4 -x -o Tabs_pages3.py 'Tabs and Pages in Dialogs/Tabs_pages3.ui'
</code>
 
Now run it through Python:
<code>
$ python2.6 Tabs_pages3.py
</code>
 
I have made a screenshot too:
 
[[File:UI-Package-Example.png]]

Latest revision as of 12:09, 4 August 2016

This page is now on the community wiki.