diff options
author | Leena Miettinen <riitta-leena.miettinen@qt.io> | 2019-07-03 13:25:59 +0200 |
---|---|---|
committer | Leena Miettinen <riitta-leena.miettinen@qt.io> | 2019-07-08 10:51:16 +0000 |
commit | 89fb3d25a05a2d4bd739079cb98525b68f133648 (patch) | |
tree | 4dc36d18598f002f5721c9a3905be6affd622238 /doc | |
parent | 6d60c7c1a94dc2d847e53e66e7f35ca40617c862 (diff) |
Doc: Update info on Qt for Python app wizards
Move the section higher up in "Creating projects" and add a
screenshot of the wizard.
Change-Id: Ifc48026162ff58d58ef22673d3113cb185d1c887
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/images/qtcreator-python-wizard-app-window.png | bin | 0 -> 16652 bytes | |||
-rw-r--r-- | doc/src/projects/creator-only/creator-projects-creating.qdoc | 4 | ||||
-rw-r--r-- | doc/src/python/creator-python-project.qdocinc | 27 |
3 files changed, 18 insertions, 13 deletions
diff --git a/doc/images/qtcreator-python-wizard-app-window.png b/doc/images/qtcreator-python-wizard-app-window.png Binary files differnew file mode 100644 index 0000000000..30e5230645 --- /dev/null +++ b/doc/images/qtcreator-python-wizard-app-window.png diff --git a/doc/src/projects/creator-only/creator-projects-creating.qdoc b/doc/src/projects/creator-only/creator-projects-creating.qdoc index 37b3224cd6..ab35b3dd6a 100644 --- a/doc/src/projects/creator-only/creator-projects-creating.qdoc +++ b/doc/src/projects/creator-only/creator-projects-creating.qdoc @@ -256,6 +256,8 @@ For more information about creating Qt Quick projects, see \l {Creating Qt Quick Projects}. + \include creator-python-project.qdocinc python project wizards + \section1 Adding Files to Projects You can use wizards also to add individual files to your projects. @@ -408,8 +410,6 @@ The above functions are also available in the context menu in the \uicontrol Projects view. - \include creator-python-project.qdocinc python project wizards - \section2 Creating OpenGL Fragment and Vertex Shaders Qt provides support for integration with OpenGL implementations on all diff --git a/doc/src/python/creator-python-project.qdocinc b/doc/src/python/creator-python-project.qdocinc index fdb58155a6..c74af5359d 100644 --- a/doc/src/python/creator-python-project.qdocinc +++ b/doc/src/python/creator-python-project.qdocinc @@ -42,22 +42,28 @@ use \c {.pyqtc} files, but we recommend that you choose \c{.pyproject} files for new projects. - The Window wizard adds the following imports to the \c {main.py} - file to provide access to the QApplication and QMainWindow classes - in the Qt Widgets module: + The \uicontrol {Qt for Python - Window} wizard enables you to create a + Python source file for a new class that you can add to a Python project. + Specify the class name, base class, and and source file for the class. + + \image qtcreator-python-wizard-app-window.png + + The Window wizard adds the imports to the source file to provide + access to the QApplication and the base class you selected in the Qt + Widgets module: \badcode import sys - from PySide2.QtWidgets import QApplication, QMainWindow + from PySide2.QtWidgets import QApplication, QWidget \endcode - The Window wizard also adds a \c MainWindow class that inherits from - QMainWindow: + The Window wizard also adds a main class with the specified name that + inherits from the specified base class: \badcode - class MainWindow(QMainWindow): + class MyWidget(QWidget): def __init__(self): - QMainWindow.__init__(self) + QWidget.__init__(self) \endcode Next, the Window wizard adds a main function, where it creates a @@ -68,13 +74,12 @@ \badcode if __name__ == "__main__": app = QApplication([]) - ... \endcode Next, the Window wizard instantiates the \c MainWindow class and shows it: \badcode - window = MainWindow() + window = MyWidget() window.show() ... \endcode @@ -86,7 +91,7 @@ sys.exit(app.exec_()) \endcode - The Empty wizard adds similar code to the \c {main.py} file, but it does + The Empty wizard adds similar code to the source file, but it does not add any classes, so you need to add and instantiate them yourself. For examples of creating Qt for Python applications, see |