summaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* 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-023-12/+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-30238-273/+273
| | | | | | | 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>
* Doc: Fix typo and mismatch between code and descriptionAndreas Eliasson2022-11-302-2/+2
| | | | | | | Fixes: QTBUG-107675 Pick-to: 6.4 6.2 Change-Id: I38140617a2b0525db417137aa41a52a389b3bea3 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Add support for stereoscopic content in QOpenGLWidgetKristoffer Skau2022-11-2812-1/+503
| | | | | | | | | | | | | | | | | Need to add the plumbing necessary to support two textures in QOpenGLWidget and use these in the backing store. The changes required on the RHI level is already done in an earlier patch. Then paintGL() needs to be called twice, once for each buffer. Also add overloads for the other functions of QOopenGLWidget where it makes sense to query for left or right buffer. Then finally create an example. [ChangeLog][Widgets][QOpenGLWidget] Added support for stereoscopic rendering. Fixes: QTBUG-64587 Change-Id: I5a5c53506dcf8a56442097290dceb7eb730d50ce Reviewed-by: Laszlo Agocs <laszlo.agocs@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-17239-503/+476
| | | | | Change-Id: I0ceab08108b7e58e4e2ed25db9e3c289f5c0ddac Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Use Qt6:: to qualify Qt CMake packagesKai Köhne2022-11-17262-849/+849
| | | | | | | 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-152-3/+54
| | | | | | | | 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>
* sharedmemory example: Show error string when failing to create shared memoryTor Arne Vestbø2022-11-151-1/+2
| | | | | Change-Id: I27edc27aec742e1e34c060e48810c4cfba096ee8 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>
* Add permissions feature example and manual test to the buildAssam Boudjelthia2022-11-103-2/+9
| | | | | | | | | | And add license headers and some minor fixes for warnings in the example and test. Task-number: QTBUG-90498 Change-Id: I34592f7f2844c92c25a6a676c8ac1ffca9e03c6d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Plumb public permission APIs to Android backendTor Arne Vestbø2022-11-092-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | The lock and unlock of the Android deadlock mutex is now part of the internal implementation instead of limited to the enum based permission API. It is unclear why 8bca441b6f65 added the guard only to this API and not to the string based API as well. The check for isBackgroundLocationApi29 has been removed, as the logic seemingly resulted in accepting every single permission type except location permissions if used via the enum-based API. Since Android's platform permission API doesn't have an Undetermined status, we keep a hash of the status for each permission type, and by default checkPermission() would return Undetermined, until a requestPermission() call is done which updates the internal hash, and after that checkPermission() would return properly Granted/Denied. Task-number: QTBUG-100413 Change-Id: Ia95c76af754481a281bc90198e349966c9c2da52 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@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>
* Add permission API backend for macOS and iOSTimur Pocheptsov2022-11-032-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When submitting applications to the iOS and macOS AppStore the application goes through static analysis, which will trigger on uses of various privacy protected APIs, unless the application has a corresponding usage description for the permission in the Info.plist file. This applies even if the application never requests the given permission, but just links to a Qt library that has the offending symbols or library dependencies. To ensure that the application does not have to add usage descriptions to their Info.plist for permissions they never plan to use we split up the various permission implementations into small static libraries that register with the Qt plugin mechanism as permission backends. We can then inspect the application's Info.plist at configure time and only add the relevant static permission libraries. Furthermore, since some permissions can be checked without any usage description, we allow the implementation to be split up into two separate translation units. By putting the request in its own translation unit we can selectively include it during linking by telling the linker to look for a special symbol. This is useful for libraries such as Qt Multimedia who would like to check the current permission status, but without needing to request any permission of its own. Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Change-Id: Ic2a43e1a0c45a91df6101020639f473ffd9454cc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Long live QPermissions!Tor Arne Vestbø2022-11-012-0/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many features of today's devices and operating systems can have significant privacy, security, and performance implications if misused. It's therefore increasingly common for platforms to require explicit consent from the user before accessing these features. The Qt permission APIs allow the application to check or request permission for such features in a cross platform manner. The check is always synchronous, and can be used in both library and application code, from any thread. The request is asynchronous, and should be initiated from application code on the main thread. The result of the request can be delivered to lambdas, standalone functions, or regular member functions such as slots, with an optional context parameter to manage the lifetime of the request. Individual permissions are distinct types, not enum values, and can be added and extended at a later point. Task-number: QTBUG-90498 Done-with: Timur Pocheptsov <timur.pocheptsov@qt.io> Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io> Done-with: Mårten Nordheim <marten.nordheim@qt.io> Change-Id: I821380bbe56bbc0178cb43e6cabbc99fdbd1235e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Move i18n example to qttoolsKai Köhne2022-11-0139-1240/+0
| | | | | | | | Move i18n example out of qtbase. In qttools, it can use lrelease, avoiding the need to store .qm files in the repository. Change-Id: I8ba36a1372c2a743b809e3f7ea95a67825558f41 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* examples: fix configuring with -no-feature-widgetsJohannes Kauffmann2022-10-291-1/+3
| | | | | | | | | | It also fails for -no-feature-gui, but since the example depends on QtWidgets, which implies depending on QtGui, we only check for QtWidgets here. Pick-to: 6.2 6.4 Change-Id: I777e540e6c2101ce8f08a5f80ba01b37ff858373 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add a shortcut editor exampleLaszlo Papp2022-10-2516-0/+997
| | | | | | | | | | | | | | | Many applications offer shortcuts for quick interaction with the application. It is also common in such applications to offer a shortcut editor in the preferences or separately in a dialog. However, even though this is a fairly common use case for applications with more than a couple of shortcuts, there is no good and comprehensive official Qt example how this could be achieved. This change is an attempt to bridge the gap. Change-Id: Ic01a404e6157bda1b0a75a0b792cbfe5d910d48f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix typo in examples/i18nYAMAMOTO Atsushi2022-10-251-7/+7
| | | | | | | | The name of the variable that handles the qm file is qmlFile. Change-Id: I873c73cd8f96ff821fe3d2e633e84fef8c687875 Reviewed-by: Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-1131-67/+67
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Replace qExchange with std::exchangeMarc Mutz2022-10-071-1/+1
| | | | | | | | | | | | | None of these users require C++20 constexpr or C++23 noexcept, the only remaining difference between std::exchange and qExchange. This leaves a single qExchange() user, in QScopedValueRollback, that requires the constexpr version, only available from C++20, and thus remains unported. Task-number: QTBUG-99313 Change-Id: Iea46f6ed61d6bd8a5b2fd9d9ec4d70c980b443a2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Style sheets: add placeholder text color property for edit widgetsEirik Aavitsland2022-09-292-0/+6
| | | | | | | | | The placeholder text was given its own QPalette color role in Qt 5.12, but there has been no way to specify it from a Qt style sheet. Fixes: QTBUG-93009 Change-Id: If58ca844c19c65b7eee14c6d5730a4ba27640c33 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* examples: port dbus examples to new connection styleSamuel Gaist2022-09-271-7/+12
| | | | | | Task-number: QTBUG-106893 Change-Id: Ic857f694b836fba30e41ef0a40107917bd05b64c Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Brush up the drop site exampleFriedemann Kleint2022-09-214-24/+33
| | | | | | | | | | | | - Use qsizetype - Use new string literals instead of deprecated QLatin1String() - Streamline some code - Remove unused member variable - Remove module include Pick-to: 6.4 Change-Id: Ia96424a23f3ae10e57db942de49949ce3aef8876 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Pass a parent pointer to the Animation instance to avoid memory leakJan Arve Sæther2022-09-152-3/+3
| | | | | | | | | The leak is just on termination, but we should show good practices in our examples Pick-to: 6.4 6.3 6.2 Change-Id: I39abb7545d3c68a1a537b865ba3fcb5e60c22fbf Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Use popup() instead of exec() in examplesMikolaj Boc2022-09-072-2/+2
| | | | | | | | | | | popup() is generally better but it has a certain advantage that it does not require a run loop to work, therefore platforms (like WASM) can use it without resorting to extra measures (like asyncify). Task-id: QTBUG-106389 Backport-to: 6.4 6.4.0 Change-Id: I87bde677f84048af82cc9aadd982284bdba41e69 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Document shell-friendly data tags as best practiceEdward Welbourne2022-09-073-8/+7
| | | | | | | | | Also follow this best practice in testlib's own documentation and examples. Pick-to: 6.4 Change-Id: I8b57dfa8f88835adae8fceeb122a16635708e338 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add CBOR documentationØystein Heskestad2022-09-017-5/+145
| | | | | | | | | | Add documentation of usage of CBOR in convert and cbordump examples, add a CBOR overview, and add links to them other places in the documentation. Task-number: QTBUG-85912 Change-Id: I518792db63647bf9ddd4507d8d4b7ef056192f82 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-23284-284/+284
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QDomDocument: deprecate old setContent() overloads in favor of new onesSona Kurazyan2022-08-171-9/+6
| | | | | | | | | | | | And use the new overloads in examples and tests. [ChangeLog][QtXml][QDomDocument] Deprecated the old setContent() overloads in favor of the new ones that take ParseOptions and ParseError. Task-number: QTBUG-104507 Change-Id: I61b37eba2fe3002c03bddc90f6877676d539f7ec Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Sliders: Add function that changes widgets position on layoutElias Hautala2022-08-152-5/+40
| | | | | | | | | | | | | Changes the layout to QGridLayout and adds function to change widgets position on the layout depending on the windows aspect ratio. Before this the widgets wouldn't fit on screen when using the example on Android in portrait. Fixes: QTCREATORBUG-27685 Pick-to: 6.2 6.3 6.4 Change-Id: I00009cb6c8c250a8333ac3dfa635f70da4576d5e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Jani Korteniemi <jani.korteniemi@qt.io>
* Polish the model/view tutorial examplesFriedemann Kleint2022-08-0911-51/+55
| | | | | | | | | | | | | - Reorder the class declarations, moving private sections last - Make constructors explicit - Add space to the comments - Introduce auto - Replace slot MainWindow::showWindowTitle() by a direct connection to slot QWidget::setWindowTitle(). Pick-to: 6.4 6.3 Change-Id: Ic229162434dfef5f2767d0b4e186759ca0f821f3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Basiclayouts: Add scrolling to exampleElias Hautala2022-08-081-2/+17
| | | | | | | | | | | Adds scrolling to basic layouts example because the user interface in the example doesn't fit properly on smaller screen sizes. Fixes: QTCREATORBUG-27634 Pick-to: 6.2 6.3 6.4 Change-Id: I61e6eac2b28e5b3ff0f984894fe38167b3f46a9c Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Markku Nokkala <markku.nokkala@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-03284-0/+852
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Make sure qtbase examples are installed into the correct pathAlexandru Croitor2022-07-273-6/+6
| | | | | | | | | | The find_package calls need to happen after we set INSTALL_EXAMPLEDIR to ensure that INSTALL_EXAMPLEDIR is overridden if necessary. Pick-to: 6.2 6.3 6.4 Task-number: QTBUG-102879 Change-Id: I3c2e6c5a68a8c6ff9b98b79dbd6c83445d8da052 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Examples: Use signals, slots instead of Q_SIGNALS, Q_SLOTSKai Köhne2022-07-212-3/+3
| | | | | | Pick-to: 6.4 Change-Id: I79a352d1bac11edf2d2b0443d2f1bb202fb4e254 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Support pinch zoom gesture in the Mandelbrot exampleNicholas Bennett2022-07-214-15/+59
| | | | | | | | | | | | | | | | | | Used QGesture for this as per the gesture example. Moved the help and info text to separate lines. Enabled word wrap to prevent text going off screen. As a drive-by, the code to center the window at a size that's a fraction of the screen is replaced with a simple sizeHint() override. The user should have control over placement, particularly now that it should be placed manually onto a touchscreen if the user has one. Done-with: Shawn Rutledge Fixes: QTBUG-96702 Pick-to: 6.4 Change-Id: I8dba8b09bed474f585341e9a7a8c71fb60293eee Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Addressbook example: port to QLatin1StringViewIvan Solovev2022-07-151-3/+5
| | | | | | | | | | | | This allows to fix the warning: qtbase/examples/widgets/itemviews/addressbook/addresswidget.cpp:115: warning: loop variable ‘str’ of type ‘const QString&’ binds to a temporary constructed from type ‘const char* const’ [-Wrange-loop-construct] Pick-to: 6.4 Change-Id: Ibbfa7f9e85fe9ef79291f9da3d161667286b282e Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* GroupBox example: port away from using deprecated QAction::setMenu()Ivan Solovev2022-07-141-3/+1
| | | | | | | | | | We can achieve the same UI by using QMenu::addMenu() directly Task-number: QTBUG-104857 Pick-to: 6.4 6.3 6.2 Change-Id: I627f21bc93646943cf6dfbd3b388352b84f73f0f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CMake: Let qt6_add_plugin accept sourcesJoerg Bornemann2022-06-294-12/+0
| | | | | | | | | | | The commands qt6_add_executable and qt6_add_library both accept a list of sources that get automatically added to the created target. Extend qt6_add_plugin to also accept sources for consistency. Fixes: QTBUG-104189 Change-Id: Iad5d8c5b31551663be155d068d55e770e1a91b27 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix typos in docs and commentsKai Köhne2022-06-1522-29/+29
| | | | | | | | | Found by codespell Pick-to: 6.4 Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove unnecessary dependency to OpenGLJoni Poikelin2022-05-301-1/+1
| | | | | | | | The example does not use OpenGL in Qt6 anymore so the dependency is not necessary. Change-Id: I6189a93eb65bd283ea7e85664582ab0b12a41639 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161195-54327/+2404
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* examples: add WindowStaysOnBottomHint into preview textLiang Qi2022-05-011-0/+2
| | | | | | Pick-to: 6.3 6.2 5.15 Change-Id: I1e4e390990fcb6e30b2ff7bb59168e4ffc01a936 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Replace uses of _qs with _s in sources and examplesSona Kurazyan2022-04-191-1/+3
| | | | | | Task-number: QTBUG-101408 Change-Id: I48360ba3b23965cd3d90ac243c100a0656a4cde8 Reviewed-by: Marc Mutz <marc.mutz@qt.io>