Qt Example

This macro is an example of using Qt commands their connections, extraction and data assignment.

Are treated :


 * 1) icon for window : The icon displayed on main window
 * 2) horizontalSlider : horizontal slider its connection and data extraction / assignment
 * 3) progressBar horizontal : progress bar horizontal its connection and data extraction / assignment
 * 4) verticalSlider : vertical slider its connection and data extraction / assignment
 * 5) progressBar vertical : progress bar vertical its connection and data extraction / assignment
 * 6) lineEdit : line edit its connection and data extraction / assignment
 * 7) lineEdit : line edit its connection and data extraction / assignment
 * 8) doubleSpinBox : double spinbox its connection and data extraction / assignment
 * 9) doubleSpinBox :
 * 10) doubleSpinBox :
 * 11) button : button its connection
 * 12) button :
 * 13) radioButton : radio button with icons its connection and checked
 * 14) checkBox : checkbox with icon  its connection checked and unchecked
 * 15) textEdit : text edit its connection and data extraction / assignment
 * 16) graphicsView : graphic view with 2 graphs and method used for change image

The tools used are : python-2.7.8

PyQt4-4.11.4-gpl-Py2.7-Qt4.8.7-x32

For convert the file .ui in .py you must uses pyuic.py is located in "C:\Python27\Lib\site-packages\PyQt4\uic\pyuic.py" (for Windows)

you can create a convertuitopy.bat file to automate the process:

1: Create a new file in your Qt working directory and name it convertuitopy.bat

2: Edit the file and paste this line there

@"C:\Python27\python" "C:\Python27\Lib\site-packages\PyQt4\uic\pyuic.py" -x %1.ui > %1.py

3: then in a Dos console type convertuitopy myproject (Do not give extension the command automatically adds)

4: monprojet.py your file is created

The icons used




You must copy and paste the images in the same directory as the macro, here :

Linux : "home/user/.FreeCAD/Macro"

Windows : "C:\Users\UserName\AppData\Roaming\FreeCAD\Macro"

Script
The contents of the file Qt_Example.FCMacro are given below:

Enjoy