aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorCristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2022-06-22 20:42:42 +0200
committerCristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2022-06-22 22:21:15 +0200
commit99d76b5e4e2397fcb4ddf45de91748ab1861f755 (patch)
treee0c27f7a68f30ae7c138d3f527123bb66d6cf14f /sources
parentafb43a34d2360116f8e00506c58fa11ffd124179 (diff)
docs: adapt snippets to new license rows
The license headers are now a couple of lines compared to the previous 40 lines, so the snippets that select 'from which line' the code must be included needed some adaptation. Change-Id: Id8bb87d708cc7c9edadb1b8265cecf81bf0bf5ae Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside6/doc/tutorials/basictutorial/widgetstyling.rst2
-rw-r--r--sources/pyside6/doc/tutorials/datavisualize/add_chart.rst4
-rw-r--r--sources/pyside6/doc/tutorials/datavisualize/add_mainwindow.rst2
-rw-r--r--sources/pyside6/doc/tutorials/datavisualize/add_tableview.rst8
-rw-r--r--sources/pyside6/doc/tutorials/datavisualize/filter_data.rst2
-rw-r--r--sources/pyside6/doc/tutorials/datavisualize/plot_datapoints.rst2
-rw-r--r--sources/pyside6/doc/tutorials/datavisualize/read_data.rst2
-rw-r--r--sources/pyside6/doc/tutorials/expenses/expenses.rst36
-rw-r--r--sources/pyside6/doc/tutorials/portingguide/chapter1/chapter1.rst12
-rw-r--r--sources/pyside6/doc/tutorials/portingguide/chapter2/chapter2.rst12
-rw-r--r--sources/pyside6/doc/tutorials/portingguide/chapter3/chapter3.rst12
-rw-r--r--sources/pyside6/doc/tutorials/portingguide/index.rst2
-rw-r--r--sources/pyside6/doc/tutorials/qmlapp/qmlapplication.rst10
-rw-r--r--sources/pyside6/doc/tutorials/qmlintegration/qmlintegration.rst12
-rw-r--r--sources/pyside6/doc/tutorials/qmlsqlintegration/qmlsqlintegration.rst32
15 files changed, 75 insertions, 75 deletions
diff --git a/sources/pyside6/doc/tutorials/basictutorial/widgetstyling.rst b/sources/pyside6/doc/tutorials/basictutorial/widgetstyling.rst
index a4e937a2e..e1af8b8a9 100644
--- a/sources/pyside6/doc/tutorials/basictutorial/widgetstyling.rst
+++ b/sources/pyside6/doc/tutorials/basictutorial/widgetstyling.rst
@@ -140,7 +140,7 @@ Look at this new example, with more widgets components:
.. literalinclude:: widgetstyling.py
:linenos:
- :lines: 59-81
+ :lines: 22-44
This displays a two column widget, with a `QListWidget` on the left and a
`QLabel` and a `QPushButton` on the right. It looks like this when you run the
diff --git a/sources/pyside6/doc/tutorials/datavisualize/add_chart.rst b/sources/pyside6/doc/tutorials/datavisualize/add_chart.rst
index 95b2092b3..59a9d9ee0 100644
--- a/sources/pyside6/doc/tutorials/datavisualize/add_chart.rst
+++ b/sources/pyside6/doc/tutorials/datavisualize/add_chart.rst
@@ -14,7 +14,7 @@ previous chapter to add a QChartView:
.. literalinclude:: datavisualize5/main_widget.py
:linenos:
- :lines: 40-
- :emphasize-lines: 2-3,6,22-36,48-50
+ :lines: 3-
+ :emphasize-lines: 2-3,6,22-36,47-49
diff --git a/sources/pyside6/doc/tutorials/datavisualize/add_mainwindow.rst b/sources/pyside6/doc/tutorials/datavisualize/add_mainwindow.rst
index a9ff38a30..623372a07 100644
--- a/sources/pyside6/doc/tutorials/datavisualize/add_mainwindow.rst
+++ b/sources/pyside6/doc/tutorials/datavisualize/add_mainwindow.rst
@@ -27,6 +27,6 @@ window size is defined based on available screen width (80%) and height (70%).
.. literalinclude:: datavisualize3/main_window.py
:language: python
:linenos:
- :lines: 40-
+ :lines: 4-
Try running the script to see what output you get with it.
diff --git a/sources/pyside6/doc/tutorials/datavisualize/add_tableview.rst b/sources/pyside6/doc/tutorials/datavisualize/add_tableview.rst
index faab02cc0..f658640bf 100644
--- a/sources/pyside6/doc/tutorials/datavisualize/add_tableview.rst
+++ b/sources/pyside6/doc/tutorials/datavisualize/add_tableview.rst
@@ -39,7 +39,7 @@ Here is a script that implements the CustomTableModel:
.. literalinclude:: datavisualize4/table_model.py
:language: python
:linenos:
- :lines: 40-
+ :lines: 3-
Now, create a QWidget that has a QTableView, and connect it to your
CustomTableModel.
@@ -48,7 +48,7 @@ CustomTableModel.
:language: python
:linenos:
:emphasize-lines: 12-17
- :lines: 40-
+ :lines: 3-
You also need minor changes to the :code:`main_window.py` and
:code:`main.py` from chapter 3 to include the Widget inside the
@@ -59,12 +59,12 @@ In the following snippets you'll see those changes highlighted:
.. literalinclude:: datavisualize4/main_window.py
:language: python
:linenos:
- :lines: 40-
+ :lines: 3-
:emphasize-lines: 8,11
.. literalinclude:: datavisualize4/main.py
:language: python
:linenos:
- :lines: 40-
+ :lines: 3-
:emphasize-lines: 46-47
diff --git a/sources/pyside6/doc/tutorials/datavisualize/filter_data.rst b/sources/pyside6/doc/tutorials/datavisualize/filter_data.rst
index b06b2fa15..edfac3862 100644
--- a/sources/pyside6/doc/tutorials/datavisualize/filter_data.rst
+++ b/sources/pyside6/doc/tutorials/datavisualize/filter_data.rst
@@ -23,7 +23,7 @@ The following script filters and formats the CSV data as described earlier:
.. literalinclude:: datavisualize2/main.py
:language: python
:linenos:
- :lines: 40-
+ :lines: 3-
Now that you have a tuple of QDateTime and float data, try improving the
output further. That's what you'll learn in the following chapters.
diff --git a/sources/pyside6/doc/tutorials/datavisualize/plot_datapoints.rst b/sources/pyside6/doc/tutorials/datavisualize/plot_datapoints.rst
index ee286ac16..f71fca4c8 100644
--- a/sources/pyside6/doc/tutorials/datavisualize/plot_datapoints.rst
+++ b/sources/pyside6/doc/tutorials/datavisualize/plot_datapoints.rst
@@ -13,7 +13,7 @@ function to plot data using a QLineSeries:
.. literalinclude:: datavisualize6/main_widget.py
:language: python
:linenos:
- :lines: 40-
+ :lines: 3-
:emphasize-lines: 33,56-91
Now, run the application to visualize the earthquake magnitudes
diff --git a/sources/pyside6/doc/tutorials/datavisualize/read_data.rst b/sources/pyside6/doc/tutorials/datavisualize/read_data.rst
index f7bf9337a..53b0d1cb0 100644
--- a/sources/pyside6/doc/tutorials/datavisualize/read_data.rst
+++ b/sources/pyside6/doc/tutorials/datavisualize/read_data.rst
@@ -18,7 +18,7 @@ The following python script, :code:`main.py`, demonstrates how to do it:
.. literalinclude:: datavisualize1/main.py
:language: python
:linenos:
- :lines: 40-
+ :lines: 3-
The Python script uses the :code:`argparse` module to accept and parse input
from the command line. It then uses the input, which in this case is the filename,
diff --git a/sources/pyside6/doc/tutorials/expenses/expenses.rst b/sources/pyside6/doc/tutorials/expenses/expenses.rst
index 6c7e99f79..c8ae5c034 100644
--- a/sources/pyside6/doc/tutorials/expenses/expenses.rst
+++ b/sources/pyside6/doc/tutorials/expenses/expenses.rst
@@ -43,14 +43,14 @@ You could do that by defining a class that inherits from `QMainWindow`.
.. literalinclude:: steps/01-expenses.py
:linenos:
- :lines: 45-59
+ :lines: 8-22
:emphasize-lines: 1-4
Now that our class is defined, create an instance of it and call `show()`.
.. literalinclude:: steps/01-expenses.py
:linenos:
- :lines: 45-59
+ :lines: 8-22
:emphasize-lines: 10-12
Menu bar
@@ -61,7 +61,7 @@ to call the method `menuBar()` and populate it inside the `MainWindow` class.
.. literalinclude:: steps/02-expenses.py
:linenos:
- :lines: 46-58
+ :lines: 9-21
:emphasize-lines: 6
Notice that the code snippet adds a *File* menu with the *Exit* option only.
@@ -89,7 +89,7 @@ in the case of a `QAction`, the signal `triggered` can be used:
.. literalinclude:: steps/03-expenses.py
:linenos:
- :lines: 56-65
+ :lines: 19-28
:emphasize-lines: 4, 8-10
Notice that the decorator `@Slot()` is required for each slot you declare to properly
@@ -107,13 +107,13 @@ Additionally, you will define example data to visualize later.
.. literalinclude:: steps/04-expenses.py
:linenos:
- :lines: 46-53
+ :lines: 9-16
With the `Widget` class in place, modify `MainWindow`'s initialization code
.. literalinclude:: steps/04-expenses.py
:linenos:
- :lines: 80-84
+ :lines: 43-47
Window layout
-------------
@@ -130,7 +130,7 @@ will add this procedure to the `Widget` constructor.
.. literalinclude:: steps/05-expenses.py
:linenos:
- :lines: 48-73
+ :lines: 11-36
As you can see, the code also includes a `QHBoxLayout` that provides the container to place widgets
horizontally.
@@ -143,7 +143,7 @@ displayed below.
.. literalinclude:: steps/05-expenses.py
:linenos:
- :lines: 75-81
+ :lines: 38-44
Having this process on a separate method is a good practice to leave the constructor more readable,
and to split the main functions of the class in independent processes.
@@ -161,7 +161,7 @@ elements vertically inside a layout.
.. literalinclude:: steps/06-expenses.py
:linenos:
- :lines: 64-80
+ :lines: 27-43
Leaving the table on the left side and these newly included widgets to the right side
will be just a matter to add a layout to our main `QHBoxLayout` as you saw in the previous
@@ -169,7 +169,7 @@ example:
.. literalinclude:: steps/06-expenses.py
:linenos:
- :lines: 42-47
+ :lines: 5-10
The next step will be connecting those new buttons to slots.
@@ -183,7 +183,7 @@ documentation <https://doc.qt.io/qtforpython/PySide6/QtWidgets/QAbstractButton.h
.. literalinclude:: steps/07-expenses.py
:linenos:
- :lines: 92-95
+ :lines: 55-58
As you can see on the previous lines, we are connecting each *clicked* signal to different slots.
In this example slots are normal class methods in charge of perform a determined task associated
@@ -192,7 +192,7 @@ that way PySide6 knows internally how to register them into Qt.
.. literalinclude:: steps/07-expenses.py
:linenos:
- :lines: 100-129
+ :lines: 63-92
:emphasize-lines: 2,16,28
Since these slots are methods, we can access the class variables, like our `QTableWidget` to
@@ -227,13 +227,13 @@ for your current application:
.. literalinclude:: steps/08-expenses.py
:linenos:
- :lines: 99-100
+ :lines: 62-63
The content of the *check_disable* slot will be really simple:
.. literalinclude:: steps/08-expenses.py
:linenos:
- :lines: 119-124
+ :lines: 82-87
You have two options, write a verification based on the current value
of the string you retrieve, or manually get the whole content of both
@@ -255,14 +255,14 @@ side of your application.
.. literalinclude:: steps/09-expenses.py
:linenos:
- :lines: 66-68
+ :lines: 29-31
Additionally the order of how you include widgets to the right
`QVBoxLayout` will also change.
.. literalinclude:: steps/09-expenses.py
:linenos:
- :lines: 81-91
+ :lines: 44-54
:emphasize-lines: 9
Notice that before we had a line with `self.right.addStretch()`
@@ -279,7 +279,7 @@ to a slot that creates a chart and includes it into your `QChartView`.
.. literalinclude:: steps/10-expenses.py
:linenos:
- :lines: 103-109
+ :lines: 66-72
:emphasize-lines: 6
That is nothing new, since you already did it for the other buttons,
@@ -288,7 +288,7 @@ your `QChartView`.
.. literalinclude:: steps/10-expenses.py
:linenos:
- :lines: 139-151
+ :lines: 102-114
The following steps show how to fill a `QPieSeries`:
diff --git a/sources/pyside6/doc/tutorials/portingguide/chapter1/chapter1.rst b/sources/pyside6/doc/tutorials/portingguide/chapter1/chapter1.rst
index 20b11065a..97fcd2200 100644
--- a/sources/pyside6/doc/tutorials/portingguide/chapter1/chapter1.rst
+++ b/sources/pyside6/doc/tutorials/portingguide/chapter1/chapter1.rst
@@ -17,7 +17,7 @@ the beginning of ``createdb.py``:
.. literalinclude:: createdb.py
:language: python
:linenos:
- :lines: 40-44
+ :lines: 3-7
The ``initDb`` function does most of the work needed to
set up the database, but it depends on the ``addAuthor``,
@@ -31,7 +31,7 @@ C++ version
.. literalinclude:: initdb.h
:language: c++
:linenos:
- :lines: 55-81
+ :lines: 18-44
Python version
---------------
@@ -39,7 +39,7 @@ Python version
.. literalinclude:: createdb.py
:language: python
:linenos:
- :lines: 44-65
+ :lines: 7-28
Now that the helper functions are in place, port ``initDb``.
Here is how the C++ and Python versions of this function
@@ -51,7 +51,7 @@ C++ version
.. literalinclude:: initdb.h
:language: c++
:linenos:
- :lines: 81-159
+ :lines: 44-122
Python version
---------------
@@ -59,7 +59,7 @@ Python version
.. literalinclude:: createdb.py
:language: python
:linenos:
- :lines: 65-
+ :lines: 28-
.. note:: The Python version uses the ``check`` function to
execute the SQL statements instead of the ``if...else``
@@ -73,7 +73,7 @@ test it, add the following code to ``main.py`` and run it:
.. literalinclude:: main.py
:language: python
:linenos:
- :lines: 40-
+ :lines: 3-
Use the following command from the prompt to run:
diff --git a/sources/pyside6/doc/tutorials/portingguide/chapter2/chapter2.rst b/sources/pyside6/doc/tutorials/portingguide/chapter2/chapter2.rst
index a574218fd..fa6ef1116 100644
--- a/sources/pyside6/doc/tutorials/portingguide/chapter2/chapter2.rst
+++ b/sources/pyside6/doc/tutorials/portingguide/chapter2/chapter2.rst
@@ -12,7 +12,7 @@ editor for foreign key fields. To begin with, create
.. literalinclude:: bookdelegate.py
:language: python
:linenos:
- :lines: 40-47
+ :lines: 3-10
After the necessary ``import`` statements, port the
constructor code for the ``BookDelegate`` class. Both
@@ -26,7 +26,7 @@ C++ version
.. literalinclude:: bookdelegate.cpp
:language: c++
:linenos:
- :lines: 54-59
+ :lines: 17-22
Python version
---------------
@@ -34,7 +34,7 @@ Python version
.. literalinclude:: bookdelegate.py
:language: python
:linenos:
- :lines: 47-54
+ :lines: 10-17
.. note:: The Python version loads the ``QPixmap`` using
the absolute path of ``star.png`` in the local
@@ -53,7 +53,7 @@ C++ version
.. literalinclude:: bookdelegate.cpp
:language: c++
:linenos:
- :lines: 59-
+ :lines: 22-
Python version
---------------
@@ -61,7 +61,7 @@ Python version
.. literalinclude:: bookdelegate.py
:language: python
:linenos:
- :lines: 55-
+ :lines: 18-
Now that the delegate is in place, run the following
``main.py`` to see how the data is presented:
@@ -69,7 +69,7 @@ Now that the delegate is in place, run the following
.. literalinclude:: main.py
:language: python
:linenos:
- :lines: 40-
+ :lines: 3-
Here is how the application will look when you run it:
diff --git a/sources/pyside6/doc/tutorials/portingguide/chapter3/chapter3.rst b/sources/pyside6/doc/tutorials/portingguide/chapter3/chapter3.rst
index b2e06b144..1d48d4ea3 100644
--- a/sources/pyside6/doc/tutorials/portingguide/chapter3/chapter3.rst
+++ b/sources/pyside6/doc/tutorials/portingguide/chapter3/chapter3.rst
@@ -11,7 +11,7 @@ and add the following imports to it:
.. literalinclude:: bookwindow.py
:language: python
:linenos:
- :lines: 40-53
+ :lines: 3-16
.. note:: The imports include the ``BookDelegate`` you
ported earlier and the ``Ui_BookWindow``. The pyside-uic
@@ -34,7 +34,7 @@ C++ version
.. literalinclude:: bookwindow.cpp
:language: c++
:linenos:
- :lines: 57-140
+ :lines: 20-103
Python version
---------------
@@ -42,7 +42,7 @@ Python version
.. literalinclude:: bookwindow.py
:language: python
:linenos:
- :lines: 53-116
+ :lines: 16-79
.. note:: The Python version of the ``BookWindow`` class
definition inherits from both ``QMainWindow`` and
@@ -57,7 +57,7 @@ C++ version
.. literalinclude:: bookwindow.cpp
:language: c++
:linenos:
- :lines: 115-
+ :lines: 78-
Python version
---------------
@@ -65,7 +65,7 @@ Python version
.. literalinclude:: bookwindow.py
:language: python
:linenos:
- :lines: 117-
+ :lines: 80-
Now that all the necessary pieces are in place, try to put
them together in ``main.py``.
@@ -73,7 +73,7 @@ them together in ``main.py``.
.. literalinclude:: main.py
:language: python
:linenos:
- :lines: 40-
+ :lines: 3-
Try running this to see if you get the following output:
diff --git a/sources/pyside6/doc/tutorials/portingguide/index.rst b/sources/pyside6/doc/tutorials/portingguide/index.rst
index bc7e6dee5..ed1a7a4f6 100644
--- a/sources/pyside6/doc/tutorials/portingguide/index.rst
+++ b/sources/pyside6/doc/tutorials/portingguide/index.rst
@@ -153,7 +153,7 @@ demonstrating some of these differences:
.. literalinclude:: hello_world_ex.py
:linenos:
- :lines: 40-
+ :lines: 3-
.. note:: The ``if`` block is just a good practice when
developing a Python application. It lets the Python file
diff --git a/sources/pyside6/doc/tutorials/qmlapp/qmlapplication.rst b/sources/pyside6/doc/tutorials/qmlapp/qmlapplication.rst
index 8c02efbb6..b68a3686e 100644
--- a/sources/pyside6/doc/tutorials/qmlapp/qmlapplication.rst
+++ b/sources/pyside6/doc/tutorials/qmlapp/qmlapplication.rst
@@ -61,7 +61,7 @@ development process using Qt Creator:
.. literalinclude:: main.py
:linenos:
- :lines: 40-60
+ :lines: 3-23
:emphasize-lines: 7-9,14-17
#. Now, set up the application window using
@@ -70,7 +70,7 @@ development process using Qt Creator:
.. literalinclude:: main.py
:linenos:
- :lines: 40-65
+ :lines: 3-28
:emphasize-lines: 23-25
.. note:: Setting the resize policy is important if you want the
@@ -83,7 +83,7 @@ development process using Qt Creator:
.. literalinclude:: main.py
:linenos:
- :lines: 40-70
+ :lines: 3-33
:emphasize-lines: 28-31
#. Load the ``view.qml`` to the ``QQuickView`` and call ``show()`` to
@@ -91,14 +91,14 @@ development process using Qt Creator:
.. literalinclude:: main.py
:linenos:
- :lines: 40-79
+ :lines: 3-42
:emphasize-lines: 33-40
#. Finally, execute the application to start the event loop and clean up.
.. literalinclude:: main.py
:linenos:
- :lines: 40-
+ :lines: 3-
:emphasize-lines: 42-44
#. Your application is ready to be run now. Select **Projects** mode to
diff --git a/sources/pyside6/doc/tutorials/qmlintegration/qmlintegration.rst b/sources/pyside6/doc/tutorials/qmlintegration/qmlintegration.rst
index 0b33a746e..d9de42ee2 100644
--- a/sources/pyside6/doc/tutorials/qmlintegration/qmlintegration.rst
+++ b/sources/pyside6/doc/tutorials/qmlintegration/qmlintegration.rst
@@ -29,7 +29,7 @@ application and PySide6 integration:
.. literalinclude:: main.py
:linenos:
- :lines: 100-113
+ :lines: 63-76
:emphasize-lines: 4,9
Notice that we only need a :code:`QQmlApplicationEngine` to
@@ -40,7 +40,7 @@ application and PySide6 integration:
.. literalinclude:: main.py
:linenos:
- :lines: 51-91
+ :lines: 14-54
:emphasize-lines: 3,4,7
Notice that the registration happens thanks to the :code:`QmlElement`
@@ -63,7 +63,7 @@ application and PySide6 integration:
.. literalinclude:: view.qml
:linenos:
- :lines: 82-92
+ :lines: 45-55
:emphasize-lines: 6-8
The properties *Italic*, *Bold*, and *Underline* are mutually
@@ -80,7 +80,7 @@ application and PySide6 integration:
.. literalinclude:: main.py
:linenos:
- :lines: 79-84
+ :lines: 42-47
:emphasize-lines: 4,6
Returning *True* or *False* allows you to activate and deactivate
@@ -91,7 +91,7 @@ application and PySide6 integration:
.. literalinclude:: main.py
:linenos:
- :lines: 71-76
+ :lines: 34-39
#. Now, for changing the look of our application, you have two options:
@@ -114,7 +114,7 @@ application and PySide6 integration:
.. literalinclude:: main.py
:linenos:
- :lines: 41-49
+ :lines: 4-12
:emphasize-lines: 9
You can read more about this configuration file
diff --git a/sources/pyside6/doc/tutorials/qmlsqlintegration/qmlsqlintegration.rst b/sources/pyside6/doc/tutorials/qmlsqlintegration/qmlsqlintegration.rst
index 053d0316e..4c0131f32 100644
--- a/sources/pyside6/doc/tutorials/qmlsqlintegration/qmlsqlintegration.rst
+++ b/sources/pyside6/doc/tutorials/qmlsqlintegration/qmlsqlintegration.rst
@@ -16,7 +16,7 @@ The database contains a single line to mock the beginning of a conversation.
.. literalinclude:: sqlDialog.py
:linenos:
- :lines: 40-79
+ :lines: 3-42
The ``SqlConversationModel`` class offers the read-only data model required for the non-editable
contacts list. It derives from the :ref:`QSqlQueryModel` class, which is the logical choice for
@@ -28,14 +28,14 @@ of a chat application.
.. literalinclude:: sqlDialog.py
:linenos:
- :lines: 83-95
+ :lines: 46-58
In ``setRecipient()``, you set a filter over the returned results from the database, and
emit a signal every time the recipient of the message changes.
.. literalinclude:: sqlDialog.py
:linenos:
- :lines: 97-106
+ :lines: 60-69
The ``data()`` function falls back to ``QSqlTableModel``'s implementation if the role is not a
custom user role.
@@ -44,7 +44,7 @@ that field, and then use that index to find the value to be returned.
.. literalinclude:: sqlDialog.py
:linenos:
- :lines: 108-115
+ :lines: 71-78
In ``roleNames()``, we return a Python dictionary with our custom role and role names as key-values
@@ -55,7 +55,7 @@ and that's why we're using the ``hash`` function.
.. literalinclude:: sqlDialog.py
:linenos:
- :lines: 117-131
+ :lines: 80-94
The ``send_message()`` function uses the given recipient and message to insert a new record into
the database.
@@ -64,7 +64,7 @@ since all the changes will be cached in the model until you do so.
.. literalinclude:: sqlDialog.py
:linenos:
- :lines: 133-152
+ :lines: 96-115
chat.qml
--------
@@ -73,7 +73,7 @@ Let's look at the ``chat.qml`` file.
.. literalinclude:: chat.qml
:linenos:
- :lines: 40-42
+ :lines: 3-5
First, import the Qt Quick module.
This gives us access to graphical primitives such as Item, Rectangle, Text, and so on.
@@ -88,7 +88,7 @@ Let's step through the ``chat.qml`` file.
.. literalinclude:: chat.qml
:linenos:
- :lines: 45-50
+ :lines: 8-13
``ApplicationWindow`` is a Window with some added convenience for creating a header and a footer.
It also provides the foundation for popups and supports some basic styling, such as the background
@@ -103,7 +103,7 @@ declare a component to access it:
.. literalinclude:: chat.qml
:linenos:
- :lines: 52-54
+ :lines: 15-17
There are two ways of laying out items in QML: `Item Positioners`_ and `Qt Quick Layouts`_.
@@ -115,11 +115,11 @@ There are two ways of laying out items in QML: `Item Positioners`_ and `Qt Quick
.. literalinclude:: chat.qml
:linenos:
- :lines: 56-59
+ :lines: 19-22
.. literalinclude:: chat.qml
:linenos:
- :lines: 108-110
+ :lines: 71-73
Pane is basically a rectangle whose color comes from the application's style.
It's similar to `Frame`_, but it has no stroke around its border.
@@ -151,7 +151,7 @@ Let's look at the ``Listview`` in detail:
.. literalinclude:: chat.qml
:linenos:
- :lines: 59-106
+ :lines: 22-69
After filling the ``width`` and ``height`` of its parent, we also set some margins on the view.
@@ -181,7 +181,7 @@ We use Pane to cover the area under these two items:
.. literalinclude:: chat.qml
:linenos:
- :lines: 108-132
+ :lines: 71-95
The `TextArea`_ should fill the available width of the screen.
We assign some placeholder text to provide a visual cue to the contact as to where they should begin
@@ -205,14 +205,14 @@ messages levels that our application will generate (errors, warnings, and inform
.. literalinclude:: main.py
:linenos:
- :lines: 40-52
+ :lines: 3-15
``connectToDatabase()`` creates a connection with the SQLite database, creating the actual file
if it doesn't already exist.
.. literalinclude:: main.py
:linenos:
- :lines: 55-75
+ :lines: 18-38
A few interesting things happen in the ``main`` function:
@@ -229,6 +229,6 @@ Finally, the Qt application runs, and your program starts.
.. literalinclude:: main.py
:linenos:
- :lines: 78-88
+ :lines: 41-51
.. image:: example_list_view.png