From 92b06193ed916ee81c6aedc9cae47d7879f4977d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 25 Jun 2021 11:29:10 +0200 Subject: PySide6: Update documentation on Qt Designer and resource files Link from typesoffiles.rst to the tutorials and flesh them out a bit. Task-number: PYSIDE-1112 Change-Id: I67fccb29d880bd2ba5af8e5dd77a4f6406ea55ad Reviewed-by: Christian Tismer (cherry picked from commit 020ada12c366e579b92803fd8a82010b8d93d87d) Reviewed-by: Qt Cherry-pick Bot --- .../doc/tutorials/basictutorial/qrcfiles.rst | 4 +++ .../doc/tutorials/basictutorial/uifiles.rst | 29 +++++++++++++--------- .../doc/tutorials/pretutorial/typesoffiles.rst | 9 ++++--- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/sources/pyside6/doc/tutorials/basictutorial/qrcfiles.rst b/sources/pyside6/doc/tutorials/basictutorial/qrcfiles.rst index 5ac560a8f..3e998abfc 100644 --- a/sources/pyside6/doc/tutorials/basictutorial/qrcfiles.rst +++ b/sources/pyside6/doc/tutorials/basictutorial/qrcfiles.rst @@ -4,6 +4,10 @@ Using `.qrc` Files (`pyside6-rcc`) The `Qt Resource System`_ is a mechanism for storing binary files in an application. +The files will be embedded into the application and be acessible for the +``QFile`` class and the constructors of the ``QIcon`` and ``QPixmap`` +classes taking a file name by using a special file name starting with ``:/``. + The most common uses are for custom images, icons, fonts, among others. In this tutorial you will learn how to load custom images as button icons. diff --git a/sources/pyside6/doc/tutorials/basictutorial/uifiles.rst b/sources/pyside6/doc/tutorials/basictutorial/uifiles.rst index 579fc5ebb..c1234f23e 100644 --- a/sources/pyside6/doc/tutorials/basictutorial/uifiles.rst +++ b/sources/pyside6/doc/tutorials/basictutorial/uifiles.rst @@ -1,17 +1,22 @@ Using `.ui` files from Designer or QtCreator with `QUiLoader` and `pyside6-uic` ******************************************************************************* -This page describes the use of Qt Creator to create graphical -interfaces for your Qt for Python project. -You will need **Qt Creator** to design and modify your interface (UI file). - -If you don't know how to use Qt Creator, refer to the -`Using Qt Designer `_ -documentation page. - -At Qt Creator, create a new Qt Design Form, choose "Main Window" for template. -And save as `mainwindow.ui`. -Add a `QPushButton` to the center of the centralwidget. +This page describes the use of +`Qt Designer `_ to create +graphical interfaces based on Qt Widgets for your Qt for Python project. +**Qt Designer** is a graphical UI design tool which is available as a +standalone binary (``pyside6-designer``) or embedded into the +`Qt Creator IDE `_. Its use within **Qt Creator** +is described at +`Using Qt Designer `_. + +The designs are stored in `.ui` files, which is an XML-based format. It will +be converted to Python or C++ code populating a widget instance at project build +time by the `pyside6-uic `_ tool. + +To create a new Qt Design Form in **Qt Creator**, choose +`File/New File Or Project` and "Main Window" for template. Save it as +`mainwindow.ui`. Add a `QPushButton` to the center of the centralwidget. Your file ``mainwindow.ui`` should look something like this: @@ -77,7 +82,7 @@ Now we are ready to decide how to use the **UI file** from Python. Option A: Generating a Python class =================================== -Another option to interact with a **UI file** is to generate a Python +The standard way to interact with a **UI file** is to generate a Python class from it. This is possible thanks to the `pyside6-uic` tool. To use this tool, you need to run the following command on a console:: diff --git a/sources/pyside6/doc/tutorials/pretutorial/typesoffiles.rst b/sources/pyside6/doc/tutorials/pretutorial/typesoffiles.rst index f606c2784..71d38f809 100644 --- a/sources/pyside6/doc/tutorials/pretutorial/typesoffiles.rst +++ b/sources/pyside6/doc/tutorials/pretutorial/typesoffiles.rst @@ -36,9 +36,9 @@ functionality to your applications. User Interface Definition File ``.ui`` -------------------------------------- -When using Qt Designer, you can create interfaces with the WYSIWYG -form editor, this interface is represented as a widget tree using XML. -Here is an extract of the beginning of a ``.ui`` file: +When using Qt Designer, you can create user interfaces using Qt Widgets with +the WYSIWYG form editor, this interface is represented as a widget tree using +XML. Here is an extract of the beginning of a ``.ui`` file: .. code-block:: xml @@ -64,6 +64,8 @@ The `pyside6-uic` tool generates Python code from these `.ui` files, which you can import from your main files, so it is not necessary for you to include the `.ui` files in your deployed application. +For more details, see :ref:`using_ui_files`. + Resource Collection Files ``.qrc`` ---------------------------------- @@ -84,6 +86,7 @@ The `pyside6-rcc` tool generates Python code from these `.qrc` files, so you are not required to include the listed files in your deployed application. +For more details, see :ref:`using_qrc_files`. Qt Modeling Language File ``.qml`` ---------------------------------- -- cgit v1.2.3