Skip to content

Commit

Permalink
Add more info about qApp pointer (#505)
Browse files Browse the repository at this point in the history
Add more info in the documentation about how to get the qApp pointer
when using the qtbot fixture
  • Loading branch information
hakonhagland committed Jul 16, 2023
1 parent 4c2d1f5 commit f1a6ac5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,18 @@ To test this widget's basic functionality, create a test function:
tmp_path.joinpath("video2.srt").touch()
Here the first parameter indicates that we will be using a ``qtbot`` fixture to control our widget.

.. note::

It is not necessary to create a QApplication instance, since the ``qtbot`` fixture will
do this for you. The ``QApplication`` object is accessible through the
``QApplication.instance()``_ function that returns a pointer equivalent to the global
``qApp`` pointer.

The other parameter is pytest's standard tmpdir_ that we use to create some files that will be
used during our test.

.. _QApplication.instance(): https://doc.qt.io/qtforpython-6/PySide6/QtWidgets/QApplication.html
.. _tmpdir: http://pytest.org/latest/tmpdir.html

Now we create the widget to test and register it:
Expand Down

0 comments on commit f1a6ac5

Please sign in to comment.