aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/doc/tutorials/basictutorial/qml.rst
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-11-02 16:11:52 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-11-02 16:12:04 +0000
commit25180730194bec25f915f32ab846ea583fb1493f (patch)
tree9a73e0336ecf21e085d99d6a651c5547b9eb99f8 /sources/pyside2/doc/tutorials/basictutorial/qml.rst
parent6e3e7b9ca0548430aaa5e2555d6e02c64625fa3f (diff)
Rename PySide2 to PySide6
Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I845f7b006e9ad274fed5444ec4c1f9dbe176ff88 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/doc/tutorials/basictutorial/qml.rst')
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/qml.rst67
1 files changed, 0 insertions, 67 deletions
diff --git a/sources/pyside2/doc/tutorials/basictutorial/qml.rst b/sources/pyside2/doc/tutorials/basictutorial/qml.rst
deleted file mode 100644
index fb168410a..000000000
--- a/sources/pyside2/doc/tutorials/basictutorial/qml.rst
+++ /dev/null
@@ -1,67 +0,0 @@
-Your First Application Using PySide2 and QtQuick/QML
-*****************************************************
-
-QML is a declarative language that lets you develop applications
-faster than with traditional languages. It is ideal for designing the
-UI of your application because of its declarative nature. In QML, a
-user interface is specified as a tree of objects with properties. In
-this tutorial, we will show how to make a simple "Hello World"
-application with PySide2 and QML.
-
-A PySide2/QML application consists, at least, of two different files -
-a file with the QML description of the user interface, and a python file
-that loads the QML file. To make things easier, let's save both files in
-the same directory.
-
-Here is a simple QML file called `view.qml`:
-
-.. code-block:: javascript
-
- import QtQuick 2.0
-
- Rectangle {
- width: 200
- height: 200
- color: "green"
-
- Text {
- text: "Hello World"
- anchors.centerIn: parent
- }
- }
-
-We start by importing `QtQuick 2.0`, which is a QML module.
-
-The rest of the QML code is pretty straightforward for those who
-have previously used HTML or XML files. Basically, we are creating
-a green rectangle with the size `200*200`, and adding a Text element
-that reads "Hello World". The code `anchors.centerIn: parent` makes
-the text appear centered in relation to its immediate parent, which
-is the Rectangle in this case.
-
-Now, let's see how the code looks on the PySide2.
-Let's call it `main.py`:
-
-.. code-block:: python
-
- from PySide2.QtWidgets import QApplication
- from PySide2.QtQuick import QQuickView
- from PySide2.QtCore import QUrl
-
- app = QApplication([])
- view = QQuickView()
- url = QUrl("view.qml")
-
- view.setSource(url)
- view.show()
- app.exec_()
-
-If you are already familiar with PySide2 and have followed our
-tutorials, you have already seen much of this code.
-The only novelties are that you must `import QtQuick` and set the
-source of the `QQuickView` object to the URL of your QML file.
-Then, as any Qt widget, you call `QQuickView.show()`.
-
-.. note:: If you are programming for desktop, you should consider
- adding `view.setResizeMode(QQuickView.SizeRootObjectToView)`
- before showing the view.