4.32. Using Qt Designer

Qt Designer is the Qt tool for designing and building graphical user interfaces. Qt Designer uses XML .ui files to store designs.

Qt Designer .ui files can be used in PyDADL for describing the client main window and/or dialogs instead of PyDADL own declarations.

Let's assume you have a file named myapp_main.ui which is the UI design of the main window created with Qt Designer. The content of the application XML file would look like the following :

<application name='myapp'>

    <data_server type='mysql' host='127.0.0.1' port='3306' user='root' passwd='' db='myapp_data'>
    </data_server>

    <user login='user' passwd='pass'>
    </user>

    <ui>myapp_main.ui</ui>

<callback name='quitAction'>
Quit()
</callback>

<callback name='someAction'>
...PYTHON CODE...
</callback>

</application>

The callback tags will be connected to QAction objects that have the same name used in the name attribute. Unlike the callbacks connected to PyDADL items, there is no global variable name available in the Python code namespace, only checked is defined. Also, the objects created with Qt Designer are available in the global namespace.

Qt Designer .ui files can also be used to describe the UI of PyDADL dialogs. A dialog XML file would look like the following :

<dialog application='myapp' name='dialog_1'>
    <ui>dialog_1.ui</ui>
</dialog>

In this case, you must create a Dialog form in Qt Designer.

The following Qt widgets will be automatically replaced by the PyDADL equivalent widget : QPushButton (replaced by Button), QCheckBox(Check), QComboBox(Combo), QWidget(Dummy), QGroupBox(Group), QLabel(Label), QLineEdit(Line), QListView(List), QProgressBar(Progress), QRadioButton(Radio), QScrollArea(Scroll), QSlider(Slider), QDoubleSpinBox(Spin), QSpinBox(Spin), QSplitter(Split), QStackedWidget(Stack), QTableView(Table), QTabWidget(Tabs), QTextEdit(Text), QTreeView(Tree).