Posted by Administrator

QtDesigner is part of QtCreator. To use QtDesigner:

  • Launch QtCreator, and from the menu bar (outside QtCreator), click on: File>New File or Project

  • You will be presented with a New File or Project dialog window. In the Files And Classes section, select Qt. In the middle pane, select QtDesigner Form. Then click on the Choose button in the lower right corner.

  • You will be presented with a QtDesigner Form dialog window. Then you can select Main Window or Dialog with Buttons Bottom, etc. Then click on the Continue button in the lower right corner.

  • In the Location dialog window, use a name like mainwindow1.ui, and for the path you might want to step aside and create a directory called forms, e.g. $ mkdir /Users/7stud/qt_projects/forms, then enter that as the path.

  • Enter any other details and click on Done. That will land you in QtCreator with the Design button selected (which I guess means you are in QtDesigner), and you will be able to drag and drop widgets onto your window.

  • To convert the .ui file to a .py file that you can import into your python program:

    $ pyuic5 mainwindow.ui -o mainwindow.py

    -o => output file (default is stdout)

    That command converts the .ui file mainwindow1.ui to a .py file named mainwindow1.py.

To re-open the file: File>Open File or Project. If you select a file with a .ui extension, it will be opened with QtCreator's Design button pre-selected, i.e. you will be inside QtDesigner.