aboutsummaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* Examples: Fix some space-related flake warningsFriedemann Kleint2021-04-2971-106/+217
| | | | | | Task-number: PYSIDE-1112 Change-Id: Ib8991199e4822673d6a25cba0023dbe3b03f5938 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Examples: Use new form of super()Friedemann Kleint2021-04-28104-157/+156
| | | | | | Task-number: PYSIDE-1112 Change-Id: Ifcb4da974bdcad7af536404fffdbffc585d3d167 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix the text object exampleFriedemann Kleint2021-04-231-35/+48
| | | | | | | | | | | | The example apparently has never worked. Fix it by using QPyTextObject as a base class and using a different character (as done in qabstracttextdocumentlayout_test.py). Modernize the code and use per-class imports. Task-number: PYSIDE-1112 Change-Id: Iceb6868afe752761820715c1ce68abc77b0a8011 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Remaining QGraphicsView examples: Use per-class importsFriedemann Kleint2021-04-233-308/+340
| | | | | | | | | As a drive by, fix breakages caused by removed APIs and oversights of the snake case change and wrap some long lines. Task-number: PYSIDE-1112 Change-Id: I09acdc7bb6f356964c859111ffd4643a97f5bdf6 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Remaining examples: Use per-class importsFriedemann Kleint2021-04-2319-718/+783
| | | | | | Task-number: PYSIDE-1112 Change-Id: I8534e911959d6eed2ed6d3f7741e99929ff0125e Reviewed-by: Christian Tismer <tismer@stackless.com>
* classwizard example: Use and generate super() without parametersFriedemann Kleint2021-04-231-8/+8
| | | | | | | | | | As a drive-by, add a missing comma. Amends 9a9f9fd2528c03df4b0e9dde48026a2181e8a410. Task-number: PYSIDE-1112 Change-Id: I5e7205609b460f56324a8ec193948250e6e38d6b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Brush up the dragdroprobot exampleFriedemann Kleint2021-04-221-64/+70
| | | | | | | | | - Use per class imports - Streamline code Task-number: PYSIDE-1112 Change-Id: I77f00a893b397d1cf73d85bb41038c7c4a73405c Reviewed-by: Christian Tismer <tismer@stackless.com>
* classwizard example: Update documentation and screenshotFriedemann Kleint2021-04-222-1/+1
| | | | | | | | Complements 9a9f9fd2528c03df4b0e9dde48026a2181e8a410. Task-number: PYSIDE-1112 Change-Id: If239fea81f5db505aaaf1fff2cd6d0b8ad7c98f9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Rewrite the fetchmore exampleFriedemann Kleint2021-04-221-48/+77
| | | | | | | | | | | | | | | - Use per class imports - Start in root folder so that large directories (/bin/, Windows) are easily reachable - Remove the line edit and navigate by doubleclicking instead since this is more on line with expectations - Use a QPlainTextEdit for logging - Make the log message more informative - Add icons Task-number: PYSIDE-1112 Change-Id: I09663c40331df149cc15735f36f2553236759573 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Cannon tutorial: Brush up codeFriedemann Kleint2021-04-2214-630/+642
| | | | | | | | | | | | - Use per class imports - Remove string-based connections, fixing some errors introduced by the snake case renaming - Add some spacing and indent main - Use math.pi Task-number: PYSIDE-1112 Change-Id: I2171fc9eb27f9926f32648a289df404d390ace43 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Tetrix example: Use per class importsFriedemann Kleint2021-04-211-45/+45
| | | | | | Task-number: PYSIDE-1112 Change-Id: Ib60a1b5ac4cecd6b4152c8264e23a0258047a736 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Brush up the mandelbrot exampleFriedemann Kleint2021-04-151-8/+47
| | | | | | | | | | | | | | | | | | | | | | Port qtbase/0e69349f6f8e9445877ea5b2105973115ad79cf7: The example refines the image by running a number of passes with increasing number of iterations, which is not really visible to the user. Set an informational text string on the generated image which provides this information along with the elapsed time. The idea is to do the same to the corresponding Qt for Python example to have some sort of speed comparison for number crunching. Add a command line option for the number of passes. Make the window a bit larger to accommodate the information. Task-number: PYSIDE-1112 Change-Id: I9313f860947386123166f794b80b541bc057be2c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add new matplotlib example and rearrange dirsSacha Schutz2021-04-156-0/+122
| | | | | | | | | I add a widget showing a 2D gaussian with 2 inputs to adjust mu and sigma Pick-to: 6.0 Task-number: PYSIDE-841 Change-Id: I602b07943ebeb007332bc77c4372ef5a1db20422 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add an editable Json Model exampleSacha Schutz2021-04-153-0/+389
| | | | | | | | | | | This is an adaptation of my code available on https://github.com/dridk/QJsonModel. Due to its success, it may be good to add it into the official documentation. Pick-to: 6.0 Task-number: PYSIDE-841 Change-Id: I5b9acddb684ba27233efa53e6b0e04291aaba46a Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add a Paintbrush like exampleSacha Schutz2021-04-152-0/+241
| | | | | | | | | | | | A widget where user can draw on a canvas with different color. It is possible to save and load the canvas into a PNG file. This example teaches the user how to use QPainter outside the paintEvent using a QPixmap. Pick-to: 6.0 Task-number: PYSIDE-841 Change-Id: I8bbab68193894f4f5a6e101fa23fc65e6cb30864 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add downloader example with QNetworkAccessManagerSacha Schutz2021-04-152-0/+218
| | | | | | | | | | | | This widget allows to download a file and show a progress bar. Unlike other example on the internet, bytes are read from the readyRead() method and not from finished(). This makes possible to download large file without consuming memory. Pick-to: 6.0 Task-number: PYSIDE-841 Change-Id: Ic314ef1fbc299be6c3636fcb502b3c532d713cfd Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* classwizard example: Update iconsFriedemann Kleint2021-04-129-3611/+2031
| | | | | | | | | Recreate the watermarks with Python code. Use the standard Qt for Python logo and remove the C++ logos. Task-number: PYSIDE-1112 Change-Id: I29679f7f6f4e245d7d29099648fea9678e6706f8 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Rewrite the classwizard exampleFriedemann Kleint2021-04-123-276/+501
| | | | | | | | | | | | | | The classwizard created some outdated C++ header and source which is not useful for Qt for Python. Rewrite it to generate a Python class and add a special page allowing for specifying properties and signals of QObjects. Add an overwrite check and a 'Launch' checkbox to the conclusion page. Use QFormLayout instead QGridLayout for the pages. Task-number: PYSIDE-1112 Change-Id: Ice158553571e30ea069ceda8873bf165dc704afc Reviewed-by: Christian Tismer <tismer@stackless.com>
* wheel_tester: Enable it again for Qt >= 6 with NuitkaChristian Tismer2021-04-073-7/+12
| | | | | | | | | | | | With the usage of nuitka, we have a working compiled test, again. Only the scriptableapplication fails, and only for CMake. This will be fixed in another check-in. The PyInstaller test remains in the code for being re-enabled. Task-number: PYSIDE-1523 Change-Id: Ic831fa5b110bbff4150a01cb8a7344ae050aae02 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Brush up the syntax highlighter exampleFriedemann Kleint2021-04-074-175/+19
| | | | | | | | | | | Change it to a simple highlighter for Python instead of the outdated qmake syntax. Remove the resource file. Task-number: PYSIDE-1112 Change-Id: I49157eccd8dbd26fca85910afb404648d7cc97a3 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Port QWidget examples to snake caseFriedemann Kleint2021-04-0637-1922/+1922
| | | | | | Task-number: PYSIDE-1112 Change-Id: Ia42e395a3c650f4c11f05cfe5c6f67d309c4a3d3 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Brush up the collidingmice exampleFriedemann Kleint2021-03-291-77/+77
| | | | | | | | | | | | | | - Port to snake case. - Use per-class imports. - Replace call to obsolete qrand() function. - Fix the random movement (angle) by using setRotation() as does the C++ example. - Use QGraphicsScene.advance() instead of per-mouse timers to advance the scene as does the C++ example. Task-number: PYSIDE-1112 Change-Id: Ibb5b4bde51021d890acb4cc6c2f41a3e0d0207af Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Brush up the standarddialogs exampleFriedemann Kleint2021-03-291-210/+327
| | | | | | | | | | | | | | - Sync it up with the C++ example: * Add a widget for the dialog options * Add QInputDialog.getMultiLineText() - Port to snake case - Use per-class imports - Fix a crash in the font dialog code by using QFont.fromString() Task-number: PYSIDE-1112 Change-Id: I27df02ce0448fbd8dad529500652d58d23b0379c Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Brush up the easing exampleFriedemann Kleint2021-03-296-497/+140
| | | | | | | | | | | | | - Remove the resource file with the outdated Qt logo and use the builtin PySide logo instead. - Use enum for the line type. - Make line type radio box exclusive. - Use snake case. - Use class imports. Task-number: PYSIDE-1112 Change-Id: Ie3e690ab56f619ec95b36b9101b06fa1e4704e5e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Port non-QWidget examples to snake caseFriedemann Kleint2021-03-2920-506/+507
| | | | | | Task-number: PYSIDE-1112 Change-Id: I0be4d2124663bbf8973432b066a0a49facab18b3 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Brush up the hellogl2 exampleFriedemann Kleint2021-03-251-127/+137
| | | | | | | | | | | - Use snake case - Use Argument parser - Fix the transparent option to work - Port away from string-based signal/slot connections Task-number: PYSIDE-1112 Change-Id: I104363b35db59fc9e4626d85ebae886c73abfd8a Reviewed-by: Christian Tismer <tismer@stackless.com>
* Brush up the main window examplesFriedemann Kleint2021-03-253-263/+290
| | | | | | | | | | | | | | | | | | | - Use snake case in dockwidgets and application. - Fix imports in application to be consistent with others. - Fix the code saving/restoring geometries in mdi/application to use QWidget.save/restoreGeometry() instead of saving pos/size since that handles multiscreen setups correctly. Use 'QtProject' as settings category. - Use theme icons in application as in mdi. - Configure QFileDialog for saving HTML in dockwidgets. - Replace QSignalMapper by partial functions in mdi. - Fix one oversight of 4f2f9e2dc511ddcf802e342361e89edbf03a4a88 in mdi. - Add command line arguments Task-number: PYSIDE-1112 Change-Id: I7eca08a675876c74c6e754b946a2e63df4da3684 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Port the widget tutorials to snake caseFriedemann Kleint2021-03-2415-1327/+1327
| | | | | | Task-number: PYSIDE-1112 Change-Id: I60056e1cf0bac1279b7ff780fba908643339847e Reviewed-by: Christian Tismer <tismer@stackless.com>
* Use pathlib in examplesFriedemann Kleint2021-03-2314-30/+45
| | | | | | Task-number: PYSIDE-1112 Change-Id: Ib99dbfb2c3889495d062b50dc9dbea04f1f78c79 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Update the examples project fileFriedemann Kleint2021-03-231-60/+115
| | | | | | | | It is convenient for mass editing. Task-number: PYSIDE-1112 Change-Id: I894ed3c910cf0b10afaef6a6bd9d5f063a593221 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Remove the regexp exampleFriedemann Kleint2021-03-232-197/+0
| | | | | | | | It is based on the removed class QRegExp. Task-number: PYSIDE-1112 Change-Id: Icfc35cc2e0d4c0870407eadc4bf31c063155e387 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Replace .format() in examples by f-stringsFriedemann Kleint2021-03-2311-108/+130
| | | | | | | | As a drive by, fix the chartthemes example to work. Task-number: PYSIDE-1112 Change-Id: I35deeba69f2db2c8c0848cce7316fb621b1b5818 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Replace % formatting in examples by f-stringsFriedemann Kleint2021-03-2230-104/+124
| | | | | | | | As drive-by, Fix fortune server, addressbook and dombookmarks examples to work. Task-number: PYSIDE-1112 Change-Id: I8ef7759ed56aeb7157cf2222bee9b6481973112a Reviewed-by: Christian Tismer <tismer@stackless.com>
* mandelbrot example: Rename to snake_case and brush upFriedemann Kleint2021-03-221-103/+104
| | | | | | Task-number: PYSIDE-1122 Change-Id: I76e5a6d996bef0bef7f9fee3060dd1fda99a0b27 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Tetrix example: Rename to snake_case and brush upFriedemann Kleint2021-03-221-216/+225
| | | | | | Task-number: PYSIDE-1122 Change-Id: I162d96609e63239ecafd30fc15c795320e4c95f5 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* mdi example: Rename to snake_case and brush upFriedemann Kleint2021-03-221-185/+195
| | | | | | Task-number: PYSIDE-1122 Change-Id: I6e4b58b0288956e625c85bc32e73de2f8a54259b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Port examples away from deprecated QMouseEvent::pos()Friedemann Kleint2021-03-196-29/+32
| | | | | | | | | | As a drive by, fix the left-over QtCharts callout example to work after 227020b118fa38ada1d8bd579593dae61f6e3881. Pick-to: 6.0 Task-number: PYSIDE-1122 Change-Id: I945b57950014e882d4efd3cb0cab47262ad108b6 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* doc: migrate qdoc approach to document examplesCristian Maureira-Fredes2021-03-176-0/+79
| | | | | | | | | | | | | | | | | There were two previous documented examples using the approach based on qdoc: stardelegate, and classwizard. This patch moves them into the 'doc/' directory for each example, and partially revert the changes from 308157f01260c640e21f6972619d3b380c007acb Additionally, an unrelated screenshot was moved to a new general 'images/' directory. Task-number: PYSIDE-1112 Pick-to: 6.0 Change-Id: I239a24fa4e4f970540857ba8b33b9b13c18142b1 Reviewed-by: Christian Tismer <tismer@stackless.com>
* doc: use 'doc' directory for examples galleryCristian Maureira-Fredes2021-03-173-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The initial patch that generates a gallery based on the examples in the respository, was limited to only showing the content of the files in each '.pyproject' file. That approach didn't allow to describe each example, nor add complementary images, like screenshots to each example page. This patch introduces the option to consider everything inside a 'doc/' directory on the example directory. The files that are copied over are not directory, but only files, for images to be the main focus. For example, currently the Tetrix case contained the following files: $ ls examples/widgets/tetrix/ tetrix.py tetrix.pyproject On this patch you can see that now there is a doc directory with the following content: $ ls examples/widgets/tetrix/doc tetrix-screenshot.png tetrix.rst The example page that will be generated for this case will contain the content of the 'doc/tetrix.rst' file, plus the content of all the project files at the end. The 'doc/tetrix.rst' file contains a reference to the 'tetrix-screenshot.png' image, so that file will be copied over too. Task-number: PYSIDE-1112 Pick-to: 6.0 Change-Id: I2d11833c461d8073d2d2888576d876d3f834103a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Port the imageviewer exampleFriedemann Kleint2021-03-023-0/+380
| | | | | | Task-number: PYSIDE-841 Change-Id: Icb833db3bf18e6943b0579a3a3a064024d57e084 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Port the Qt bindings examples to the <QtModule/QtClass> conventionFriedemann Kleint2021-02-244-14/+8
| | | | | | | | | This simplifies the shiboken call; the global Qt include directory can be passed instead of each single QtCore/QtGui/QtWidgets directory. Pick-to: 6.0 Change-Id: I55a59ad12b0a9596a2c8d9dc7f0b9c041c38665c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Update and unify README.md of our binding examplesFriedemann Kleint2021-02-233-44/+45
| | | | | | | | ninja is the only working generator for Qt 6. Pick-to: 6.0 Change-Id: I9640f646ffea7b21659966680df52a21ead7119d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Port the Qt Designer taskmenuextension exampleFriedemann Kleint2021-02-166-0/+520
| | | | | | | | | | Show how to use QDesignerTaskMenuExtension for a custom widget. Task-number: PYSIDE-1455 Change-Id: Ia3a1a65890747a0d960702c25dfe20e75084a2b2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PySide6: Add a Designer pluginFriedemann Kleint2021-02-161-0/+78
| | | | | | | | | | | | | | Add a convencience class QPyDesignerCustomWidgetCollection to the Qt Designer module, which provides functions for registering widget types or adding QDesignerCustomWidgetInterface instances. A static instance of it is stored as a dynamic property on QCoreApplication, which is retrieved by a Qt Designer plugin, which provides the collection of widgets registered in Python. Task-number: PYSIDE-1455 Change-Id: If4055e6c9db6a03b32016b013a1130051bbd472a Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add model example with Pandas DataFrameSacha Schutz2021-02-164-0/+274
| | | | | | | | | | | | Create a PandasModel working with a QTableView to show DataFrame from Pandas library patch : add missing pyproject Pick-to: 6.0 Change-Id: I16e2580f3fceba34a2491354394b3c78dd981a98 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6: Add the logo as a resource to libpysideFriedemann Kleint2021-02-102-1/+6
| | | | | | | | Use it in prominent examples. Pick-to: 6.0 Change-Id: Ifee67802194931bbd56fbe6e6bfa4f3c18fda781 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Port QML examples to new property decoratorsFriedemann Kleint2021-02-105-55/+70
| | | | | | Task-number: PYSIDE-1019 Change-Id: I322c1d4d0f785b889d0676f7b9f292becd25e82f Reviewed-by: Christian Tismer <tismer@stackless.com>
* example: add qtquickcontrols2 galleryCristian Maureira-Fredes2021-02-1064-0/+11059
| | | | | | | | | This example was ported from the qt/qtquickcontrols2 repository. Task-number: PYSIDE-1112 Pick-to: 6.0 Change-Id: Idd6ad0d0cdf5c7dfaf6d8f3af878607c273aebd8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* examples: directory structureCristian Maureira-Fredes2021-02-09147-253/+144
| | | | | | | | | | | | | | | | | | | | | | | | When generating the gallery automatically, the structure of the examples was not the same for all the modules. This reorganization was made under the following assumption: An example requires: - its own directory, - a '.pyproject' file, - one or more '.py' files, - extra files (likes images, .rc, .ui, etc) Even for cases when subdirectories are made to depict categories, like 'widgets/state-machine/...', one directory is required per example. There should not be '.pyproject' files for categories, except for the general 'examples.pyproject' to open all of them. Task-number: PYSIDE-1490 Pick-to: 6.0 Change-Id: Ie690773c816a248016dbebaad90fbb1d1c2aeea5 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix the AxContainer example to workFriedemann Kleint2021-02-011-1/+1
| | | | | | | | Replace deprecated API QApplication::desktop(). Task-number: PYSIDE-1482 Change-Id: Ib2503f5acc9f67eab853326e03d368735d209971 Reviewed-by: Christian Tismer <tismer@stackless.com>