summaryrefslogtreecommitdiffstats
path: root/examples/widgets
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Use the \examplecategory macro to tag examplesTopi Reinio2023-04-111-1/+1
| | | | | | | | | | | | | | | | The '\meta category' command was used for tagging examples with a specific category, used in Qt Creators Welcome mode. As we want to also generate lists of examples belonging to a category elsewhere in the documentation, replace the command with a macro that expands to the original \meta command and also adds the example to a group using the \ingroup command. This way, the category names can be used as arguments to the \generatelist or \annotatedlist commands. Pick-to: 6.5 Task-number: QTBUG-112731 Change-Id: I46762dabc5f718fecc09a3533235eaa911dda5a0 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Remove unused variable/codeAmir Masoud Abdol2023-04-072-7/+0
| | | | | | | Pick-to: 6.5 Change-Id: I8d28db64c1ae2c57c95b2f9f22303d74172226e9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Fix CMakeLists.txt of echo plugin exampleAxel Spoerl2023-04-061-1/+5
| | | | | | | | | | | | This patch adds a missing dependency to the echo plugin for shared builds. Since it fixes the last remaining example, it closes the Jira ticket. Fixes: QTBUG-112300 Pick-to: 6.5 Change-Id: Ib1da2d7d5f5d54d7224f1c65a995f3752037e5be Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix pointer mismatch after QList::move() in tooltip exampleAxel Spoerl2023-03-283-24/+36
| | | | | | | | | | | | | | | | | | | | | | | | The tooltip example moves shape items within a QWidget. Shape items are stored in a QList of objects. When an item is moved, its pointer is taken from the QList and stored in a member variable. To have the moved item on the bottom of the list, QList::move() is called. This operation re-arranges the list objects, and the member variable starts pointing at a wrong object. This patch changes the list from a list of objects, to a list of pointers. Shape items are therefore allocated on the heap. A destructor is added to free the heap with qDeleteAll. The example's documentation is adapted accordingly and a snippet for the destructor is added. As a drive-by, int is replaced by qsizetype where it was used as an index of a QList. Fixes: QTBUG-104781 Pick-to: 6.5 6.2 Change-Id: I9be26fa7954be5f85729d24f166d66980af71801 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* CMake: build the shared plugin when building the plugandpaint targetJoerg Bornemann2023-03-281-1/+5
| | | | | | | | | | | | People expect that building the "main target" of an example builds all necessary subtargets as well. Add a dependency from plugandpaint to pnp_extrafilters. Pick-to: 6.5 Task-number: QTBUG-112300 Change-Id: I036beb961fe474ff060f93c98f5e2bda58e66f71 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* mainwindow example: Fix implicit conversion from qsizetype warningsTor Arne Vestbø2023-03-232-3/+3
| | | | | | Pick-to: 6.5 Change-Id: Ifaeeb620420f43529bb9e3d533b4e1a2e20c68ca Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Fix wording in the Simple Style Plugin documentationJoerg Bornemann2023-03-211-5/+5
| | | | | | | | | | | When talking about QMake project files we now refer to ".pro files" instead of "profiles". Pick-to: 6.5 Change-Id: Ia8d20a6a03b9076e97f45da272bb3f883febc796 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Doc: Remove broken link to Anchor Layout ExampleAndreas Eliasson2023-03-131-2/+0
| | | | | | | | | This example was moved to manual tests in 6.5, which broke the link. Now that it's in manual tests, I guess we can stop promoting it. Pick-to: 6.5 6.5.0 Change-Id: I1aa4a7de5123e96bf9ff56eeae49104acdce9645 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Move anchor layout example to manual testsJan Arve Sæther2023-03-027-193/+0
| | | | | | Pick-to: 6.5 6.5.0 Change-Id: I9c9a9dbcdaf705a31208b80b71e978938a492142 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Remove the 'sdi' exampleVolker Hilsheimer2023-03-0216-644/+3
| | | | | | | | | | | It is essentially the same as the other mainwindow examples, showing how to create a text editor. The only special code here is the tiling of the different main windows, which - without any documentation or explanation - is neither very helpful, nor relevant in 2023. Pick-to: 6.5 Change-Id: I48b92b1cf057f586e0d2842d1c0a3312154e9a13 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Move Weather Anchor Layout example to manual testsJan Arve Sæther2023-03-0214-327/+1
| | | | | | Pick-to: 6.5 Change-Id: I8782a83b5c12b4f57bf9ef9063818cb124bddd56 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Doc: move snippet for implicit translation contextVolker Hilsheimer2023-03-012-2/+2
| | | | | | | | | The 'sdi' example is a candidate for removal, so point at the spreadsheet example instead, which is not. Pick-to: 6.5 Change-Id: I4405f2421db8be79898a38ca4f3fa1ea5fe0280b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Doc: Remove duplicate wordsAndreas Eliasson2023-02-283-3/+3
| | | | | | Change-Id: Ia7a38a1035bd34d00f20351a0adc3927e473b2e7 Pick-to: 6.5 6.4 6.2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* examples: port widget examples to new connection styleSamuel Gaist2023-02-257-34/+41
| | | | | | Task-number: QTBUG-106893 Change-Id: Ib10fd516fdbeda0087b1c8550ce340acd3973e6b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix qtbase build when all deprecated code are disabledYuhang Zhao2023-02-225-8/+8
| | | | | | | | | Adjust the callers to use the non-deprecated APIs. Pick-to: 6.5 Change-Id: I8e96f25684a2d613bc400a8626dc9e3af2bb8dcf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* examples: Connect Quit action to QCoreApplication::quit, not QWidget::closeTor Arne Vestbø2023-02-204-4/+4
| | | | | | Pick-to: 6.5 Change-Id: I44ca7b61a4a261a7d3aad0dfeb870eb927ee768d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* mainwindow example: Don't assume toolbar parent is main windowTor Arne Vestbø2023-02-202-12/+6
| | | | | | | | | Adding the toolbar to the main window leaves it up to the main window how to handle ownership and placement of the toolbar. Pick-to: 6.5 Change-Id: Id429cbad9d5973931a86fcb899684e3651694fbb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Examples: move widgets/codeeditor into manual testsVolker Hilsheimer2023-02-099-446/+0
| | | | | | | | | | | | | It's not a very well written example, using (largely unneed) hacks to implement what it does. It's also misleading - the syntaxhighlighter example is a better showcase for building a useful code editor. Move it to manual tests. Fixes: QTBUG-111025 Pick-to: 6.5 Change-Id: I405d41688235bf3e9a08373e716769f26d02fec6 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Move findfiles example into manual testsVolker Hilsheimer2023-02-098-646/+0
| | | | | | | | | | | | | | | | | | | | The example follows bad and outdated practices: - running time consuming and I/O heavy workload in the GUI thread - calling processEvents to keep the UI responsive - showing results only at the end of a search rather than continuously Perhaps this example can be rewritten at some point to apply modern practices (at least use a thread and emit signals), but it seems to have low overall educational value. Moving it to be a manual test for now. Fixes: QTBUG-111002 Pick-to: 6.5 Change-Id: Id630fd4599096448ea4f96bcbf977b11a039796f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Turn elidedlabel example into a code snippetVolker Hilsheimer2023-02-0910-474/+0
| | | | | | | | | | | | The example is 90% boiler plate for subclassing QFrame and providing a bit of GUI to change the size of the label using sliders. The interesting bit is a block of 25 lines of code, so turn those into a snippet and add that to the QTextLayout overview documentation. Fixes: QTBUG-111011 Pick-to: 6.5 Change-Id: I6e97b2ea47b553c8d998ad185cfac006721ef7ee Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Remove "Analog Clock Window Example"Jan Arve Sæther2023-02-071-3/+3
| | | | | | | | | | | | This is almost exactly the same as the "Analog Clock" (widget) example. "Analog Clock Window Example" demonstrates: * How to render to a QWindow (covered by RasterWindow example) * QPainter and transformations (covered by Analog Clock example) * How to use QTimer (covered by Analog Clock example) Pick-to: 6.5 Change-Id: I7f20a29798830ed6345eca250e4139cb314cab84 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Fix analog clock example to adhere to guidelinesJan Arve Sæther2023-02-022-3/+6
| | | | | | | | Guidelines: https://wiki.qt.io/Qt6/Example-Guideline Pick-to: 6.5 Change-Id: I12c65ae11e7906fd2e9dfb449072199560488aed Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Examples: Fix CMake Unity (Jumbo) buildsFriedemann Kleint2023-02-011-0/+2
| | | | | | | | | | Disambiguate variables and add some exclusions. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Ie72b3caab9fd571c3fb6f7d8606584885bc09e66 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
* Examples: Add missing include guardsFriedemann Kleint2023-02-014-0/+20
| | | | | | | | Pick-to: 6.5 6.4 6.2 Task-number: QTBUG-109394 Change-Id: I09a1b522d0faeb2346e1e075141f1e810c8155f7 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove wiggly exampleJan Arve Sæther2023-01-3110-357/+0
| | | | | | | | | It demonstrates timerEvent() and some QFontMetrics There are other examples that demonstrates this Pick-to: 6.5 Change-Id: I4ad6f30c8ef93c995f980545ed88ab13b9aa9c7d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Merge "undo" and "undoframework" examplesVolker Hilsheimer2023-01-3137-1688/+82
| | | | | | | | | | | | | | | | | | The "undo" example didn't show anything that the "undoframework" example doesn't, and the latter is more comprehensive and properly documented. "undoframework" also uses QGraphicsView instead of inventing its own diagram widget. However, the "undo" example created a nicer UI with toolbuttons, icons, and the undo view in a dock widget, so reuse those elements in the "undoframework" example instead. Update the documentation quoting tags accordingly, and clean up a bit. Pick-to: 6.5 Change-Id: I3c91feecbd5fe3e5900838b0b51f9fe7bd190280 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Adhere to https://wiki.qt.io/Qt6/Example-GuidelineJan Arve Sæther2023-01-261-2/+2
| | | | | | | | * Remove "Example" suffix in title Pick-to: 6.5 Change-Id: I5da311850ab8f725da363969d7a8d8a1a85f8d70 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Fix CMakeLists.txt of Style Plugin Example (broken on macOS)Axel Spoerl2023-01-191-1/+1
| | | | | | | | | Add TARGET instruction in property setter, used in debug mode on macOS. Task-number: QTBUG-107842 Task-number: QTBUG-109227 Change-Id: I8704b7009c36ea8ddbf8773abfaf2b5f34f728ac Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix Style Plugin Example, and add some CMake DocsAmir Masoud Abdol2023-01-187-19/+77
| | | | | | | | | | | | | | | | | | | | A few things: - Improved the documentation by adding a CMake section, briefly describing the process of adding the plugin, and placing it where it should be. - Write a note about the case where the style may be overwritten at launch, and how to set the a new style using a CLI - Improved the CMake build such that it creates the App Bundle correctly, and also works without an App Bundle as well. - Changed the example, and plugin such that now instead of a QPushButton we have a QTextEdit, and change the text color. - Replaced the application screenshot Fixes: QTBUG-107842 Fixes: QTBUG-109227 Change-Id: I161a91b27df016ff6230fac3871b79d2dfbdf18a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Painting examples: Don't mix const_iterator and non-const iteratorsJan Arve Sæther2023-01-171-1/+1
| | | | | | | | Reported by Clazy Pick-to: 6.5 Change-Id: I80fce912b1e5390f0056b1fa9ae0d3cfcf39d045 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Compile easing curve example with -WeverythingJan Arve Sæther2023-01-171-8/+8
| | | | | | | | | | | As a consequence, also had to add some suppressions: -Wno-padded (this warning should almost never be responded to) -Wno-c++98-compat (we want to use c++17 features) -Wno-weak-vtables (IMO not worth fixing for an example) Pick-to: 6.5 Change-Id: I28ae4456c0221ad2370879a691f6343affff138b Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Remove mousebuttons examplesVolker Hilsheimer2023-01-179-374/+0
| | | | | | | | | The example didn't show anything useful, and seemed more like a manual test case. Pick-to: 6.5 Change-Id: Ia71f39b26943aab04b6895e63b6eed50dd084bfd Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Don't use file dialog in the address book exampleJan Arve Sæther2023-01-134-19/+17
| | | | | | | | | | | | | | | On small screen devices such as iPhone targets, the save file dialog is using a non-native dialog, and it doesn't fit the screen real estate to the extent that the [Ok] button is clipped away. In addition, the open file dialog and the save file dialog doesn't cooperate very well on platforms such as iOS without more plumbing. Since using the file dialog is out of the scope for this example we remove all usages of it. Pick-to: 6.5 Change-Id: Ie165355ed0b671d93e44d2d55791156367b0ea5c Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix unused variable compiler warning in slider exampleAxel Spoerl2023-01-051-0/+1
| | | | | | | | | | | The example overrides QWidget::resizeEvent() without using the QResizeEvent * argument. This results in a compiler warning. This patch marks the argument unused. Pick-to: 6.5 Change-Id: I647d0eda7d895e70ed6f232960aec992f5e37b6c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* wiggly example: add support for emojis etc. (utf16 surrogate pairs)Eirik Aavitsland2022-12-123-11/+15
| | | | | | | | | | | The venerable wiggly example was created before unicode support was added to Qt. Hence, when extracting the individual characters from the string for painting, the code was not prepared to handle that some characters, like emojis, are composed of two QChar elements. Fixes: QTBUG-28853 Change-Id: I9804415f92775e2b78fa9fcaf7a2d112153cdce0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* CMake: Clean up usage of the examples/widgets/painting/shared libJoerg Bornemann2022-12-055-95/+0
| | | | | | | | | | Remove conversion artifacts. Also, remove setting the include path. The library's interface takes care of that. Change-Id: Ib5043f15ede2171ab876ccbe603ed0b84de1bce4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Fix examples/widgets/painting/shared libraryJoerg Bornemann2022-12-051-3/+3
| | | | | | | | | | | | This library deliberately links PUBLICly against Qt6::Widgets and Qt6::OpenGL. Same for the target_include_directories call. This partially reverts a5de12f0d7dfef64453b7b29c33dc760b3cacec4. This fixes the builds of examples using this library. Change-Id: I2b5791044afc82e71df4a3bbfc26e5b1ab9afa76 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Avoid continuous texture alloc in Composition Modes exampleLaszlo Agocs2022-12-024-8/+22
| | | | | | | | | | There seems to be some confusion from back when the example were mass-ported to the QOpenGL stuff in Qt 5 times. Pick-to: 6.4 6.2 Fixes: QTBUG-109119 Change-Id: Ic4bcd010df3fcf82e16385ce241b379f0c351788 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Remove Android High-DPI workarounds in examplesTor Arne Vestbø2022-12-023-9/+1
| | | | | | | These should no longer be needed for Qt 6. Change-Id: Ica7214cbf4fc3ddae960309fe89681ec690d28d0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove showMaximized() workaround for Android in examplesTor Arne Vestbø2022-12-022-8/+0
| | | | | | | Android implements QPlatformIntegration::ShowIsMaximized nowadays. Change-Id: I451a9a8edc8ec407946d44f3e6921c78ac1d11aa Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QErrorMessage: Improve standard dialogs exampleTor Arne Vestbø2022-11-302-9/+7
| | | | | Change-Id: Ia5a2251662fe56809fc66cdadd117259d6bfd977 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Examples: Use PRIVATE CMake linkageKai Köhne2022-11-30143-176/+176
| | | | | | | We (almost) only build apps, for which PRIVATE linkage makes more sense. Change-Id: I09a509c3fb33a00cdfdede687b3f95d638f42091 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Remove duplicated Qt6::PrintSupport link informationKai Köhne2022-11-3011-57/+11
| | | | | | | | Some CMakeLists.txt files did link to Qt6::PrintSupport twice. Also unify formatting and order of the linker step. Change-Id: I4af935c5dc3de6c243aad8511b0803ceaa872589 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add missing qt_standard_project_setup to richtext/textedit exampleJoerg Bornemann2022-11-281-0/+2
| | | | | | | This amends commit f562711c642cba7bed6c96d452437ffc9b25edc4. Change-Id: Iedfb744aa827c7b246aa05eaadd6bc45639d7b61 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Modernize QMessageBox documentation and exampleTor Arne Vestbø2022-11-181-24/+18
| | | | | | Change-Id: Iebcdf53646f1a42c327414edf21ac93a7d1c0a56 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Examples: Use qt_standard_project_setup()Kai Köhne2022-11-17142-293/+282
| | | | | Change-Id: I0ceab08108b7e58e4e2ed25db9e3c289f5c0ddac Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Use Qt6:: to qualify Qt CMake packagesKai Köhne2022-11-17152-487/+487
| | | | | | | This is what we promote also in the documentation. Change-Id: If91aebafe861b0c934acbb2c69afd182abc3345d Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* sharedmemory example: Handle QSharedMemory::AlreadyExists by attachingTor Arne Vestbø2022-11-151-0/+47
| | | | | | | | Not all platforms clean up the shared memory entries on exit, so the example needs to handle that case, by attaching instead, as documented. Change-Id: Ifbcf92d0fad429caf30710bd8a344831cb0d859c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMessageBox: Don't add details button to native dialog helperTor Arne Vestbø2022-11-111-2/+2
| | | | | | | | | | | | | | | The "Show Details..." button is not plumbed in any way to the native dialog, so when added to a native dialog it will just result in the dialog being dismissed, instead of revealing any extra content in the native dialog. Both the iOS and Android native message dialog implementations add the details text directly to the dialog, without any action to explicitly reveal it. Task-number: QTBUG-108153 Change-Id: I92e00c59b7836f633be44caebd534a47ac58be00 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Exercise QMessageBox::setInformativeText() in standard dialogs exampleTor Arne Vestbø2022-11-031-13/+22
| | | | | Change-Id: Id54a6d93e22fcb6622b434e3766baedb581d6b79 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>