summaryrefslogtreecommitdiffstats
path: root/src/widgets/doc/snippets
Commit message (Collapse)AuthorAgeFilesLines
* Convert "Color Editor Factory" Example to snippetsMohammadHossein Qanbari4 days1-0/+4
| | | | | | | | | | The color editor factory example is removed and part of the codes are used as snippets. Fixes: QTBUG-119985 Pick-to: 6.7 6.6 Change-Id: I421e473e7db09a5af7543b80b87a338d8ff2ab7e Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Convert Group Box Example to snippets and screenshotsMohammadHossein Qanbari5 days1-0/+17
| | | | | | | | | | | | | Remove the Group Box Example from the repository, eliminating the associated example codes, screenshot, and documentation file. The only relevant portion used in the QGroupBox class has been relocated to the existing snippet file. Additionally, all references to this example across other files have been removed. Fixes: QTBUG-119980 Pick-to: 6.7 6.6 Change-Id: I66f9dd9dab1fe64f2d20424af3acd135201827d2 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Doc: don't use deprecated function in QMenu snippetsChristian Ehrlicher6 days1-2/+2
| | | | | | | | | | | QMouseEvent::globalPos() is deprecated - replace it with QMouseEvent::globalPosition().toPoint() Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-124343 Change-Id: I6f862a9a640da11d756dae58ffae8c6d7fc24e02 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
* Correct doc snippet licenseLucie Gérard2024-02-289-9/+9
| | | | | | | | | | | | | | All file under doc/snippet should be license as Documentation snippets and according to QUIP-18 [1] this is LicenseRef-Qt-Commercial OR BSD-3-Clause [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I76eedfb6b15c4091f726a5652e3530001d7cdaf7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Change doc snippet licenseLucie Gérard2024-02-023-3/+3
| | | | | | | | | | | | According to QUIP-18 [1], all doc snippet files should be LicenseRef-Qt-Commercial OR BSD-3-Clause [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I6e5bc9d05a5d510cc07a15abafe2257034562510 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Change license of .qdoc filesLucie Gérard2024-02-011-1/+1
| | | | | | | | | | | According to QUIP-18 [1], all .qdoc files should be LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Change-Id: I4559af21fc9069efa9bf0cbd29c5e86cfdac9082 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Doc: complete the snippet for a dialog with extensionVolker Hilsheimer2024-01-111-0/+2
| | | | | | | | | | | | | | Add the setting of the layout's size constraint to 'fixed' back to the snippet, so that the dialog automatically resizes when the extension gets hidden. The user won't be able to resize the dialog, but allowing the user to resize the dialog and to show and hide the extension anyway leads to unpredictable results for the user. Amends 11da92ba94570e5eec01597fe09f0a9a48acc677. Pick-to: 6.7 6.6 Change-Id: Ie74ca36eaa1a8e9567e0d5826f91f8633e5cbc05 Reviewed-by: David Faure <david.faure@kdab.com>
* Turn SpinBox Delegate example into snippetsVolker Hilsheimer2023-12-202-0/+91
| | | | | | | | | | | | The essence of the example was already fully quoted in the model/view documentation. Move the code into a snippet source, and update the screenshot. Fixes: QTBUG-119976 Pick-to: 6.7 6.6 Change-Id: Id2f10bb26a650419969bbfa9b76cb74babd3319e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
* Doc: Modify unreadable tablesInkamari Harjula2023-11-281-17/+33
| | | | | | | | | | | | Added breaks in List of Stylable Widgets table. Changed List of Properties table into sections. Added list of Qt-specific properties in beg of List of Properties chapter. Moved snippet comments to different rows. Task-number: QTBUG-118446 Pick-to: 6.6 Change-Id: I494401058c7982c0a0ada18c8c94429beabba348 Reviewed-by: Mats Honkamaa <mats.honkamaa@qt.io>
* doc: fix QScrollBar stylesheet code exampleSamuel Gaist2023-11-131-2/+2
| | | | | | | The horizontal parts were missing colons. Change-Id: Ibc3657d87d38af76d0736f9880eb711f52723de1 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Convert tooltips example to snippetsVolker Hilsheimer2023-10-271-0/+74
| | | | | | | | | The important bits from the example are ~10 lines of code, no need for building a poor-man's version of a graphics or item view. Pick-to: 6.6 Change-Id: I7874c66765c5b46230c92846ee3de1ee83f47e45 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Include what you need: <QPointer>Marc Mutz2023-10-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | All these TUs relied on transitive includes of qpointer.h, maybe to a large extent via qevent.h, though, given that qevent.h is more or less the only public QtBase header that includes qpointer.h, something else seems to be at play here. Said qevent.h actually needs QPointer in-name-only, so a forward declaration would suffice. Prepare for qevent.h dropping the include. The algorithm I used was: If the TU mentions 'passiveGrabbers', the name of the QEvent function that returns QPointers, and the TU doesn't have qpointer.h included explicitly, include it. That may produce False Positives, but better safe than sorry. Otherwise, in src/, add an include to all source and header files which mention QPointer. Exception: if foo.h of a foo.cpp already includes it, don't include again. Task-number: QTBUG-117670 Change-Id: I3321cccdb41ce0ba6d8a709cea92427aba398254 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add QRhiWidgetLaszlo Agocs2023-08-143-0/+134
| | | | | | Task-number: QTBUG-113331 Change-Id: I8baa697b4997b05f52acdee0e08d3c368fde5bc2 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Move icons example to manual testTor Arne Vestbø2023-06-281-0/+20
| | | | | | Pick-to: 6.5 6.6 Change-Id: I08f44448f96a61f780c21d628954879c7b28dce3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix qdoc link warnings after moving a few examples to manual testsTor Arne Vestbø2023-06-271-0/+8
| | | | | | Pick-to: 6.5 6.6 Change-Id: I81a6e9d52e858c3f733d4c527c70408772813b56 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Convert "extension" dialog example into snippetsVolker Hilsheimer2023-05-161-0/+27
| | | | | | | Pick-to: 6.5 Task-number: QTBUG-108751 Change-Id: I8ca4e058b832674dc0c8b84024cb70a667ee8db4 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Doc: Use qt_add_executable() not add_executable() in snippetsLeena Miettinen2023-04-261-1/+1
| | | | | | | | | Changes code snippets that are visible in the docs. Task-number: QTBUG-113116 Pick-to: 6.5 Change-Id: If743234bfe6947acf02307bf1144daad4fba5d73 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove unused documentation code snippetsFriedemann Kleint2023-04-178-247/+0
| | | | | | | | | | | | | | | | | | | Modules: - Core - Gui - Widgets - Open(Widgets) - PrintSupport - Sql - Network - Concurrent - Testlib Pick-to: 6.5 Change-Id: I63e58c01bec4bd162486020f0085227fdaa83b18 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QWidget: add overload to set tab order as a list of widgetsVolker Hilsheimer2023-04-111-0/+5
| | | | | | | | | | | | | The "two widgets at a time" API to set the tab order is awkward and easily misused (as the documentation explicitly explains). Add an inline overload that takes an initializer_list, and call the existing function for each consecutive pair of widgets in the list. Add documentation with snippet, and a test. Change-Id: I8e6f14a242866e3ee7cfb8ecade4697d6bdfb4d4 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Doc: Fix member name in code snippetAndreas Eliasson2023-02-151-1/+1
| | | | | | | | | QstyleOption has no init() member, only initFrom(). Fixes: QTBUG-107770 Pick-to: 6.5 6.4 6.2 5.15 Change-Id: I00ff0b980fbfac813f113a7052bd3df32c7912b6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtWidgets: Fix CMake Unity (Jumbo) buildsFriedemann Kleint2023-02-011-0/+2
| | | | | | | | | | Remove clashing enumeration value ColumnCount and exclude file in snippets. Task-number: QTBUG-109394 Pick-to: 6.5 Change-Id: Ibd8a72d9d87e3dcbbb221c364d6b4c4f59b315df Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Layouts docs: pass parent widget in the ctorAhmad Samir2022-10-215-18/+13
| | | | | | | | | This is a follow up from commit 1e904ab342c1aaa; changing more documentation to pass a widget * in the ctor of a layout, rather than creating a parent-less layout then calling setLayout(). Change-Id: I4fc59c6cfa46ccd279a153acd67335a6daf22ff9 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-113-4/+4
| | | | | | | | | | | | | | | | 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>
* Style sheets: add placeholder text color property for edit widgetsEirik Aavitsland2022-09-291-0/+3
| | | | | | | | | 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>
* Update the snippet for QFileDialog::saveFileContentMikolaj Boc2022-08-261-1/+3
| | | | | | | | | The snippet for QFileDialog::saveFileContent is wrong - the parameters used are in wrong order. Pick-to: 6.4 6.2 5.15 Change-Id: I022e8ed2ef5aeea5a44e9b10ac211893a3e24c0f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-238-8/+8
| | | | | | | 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>
* Documentation: Fix "Using Model Indexes" in Model View Programming guide to workFriedemann Kleint2022-08-091-25/+31
| | | | | | | | | | | | | The code introduced by 54d5ca0c2766e915c960fa437cee6c20a324c1a7 did not work since the variables parentIndex/numRows were local to the lambda and the outer code would not wait. Move the widgets population into the lambda to fix this. Modernize the remaining code a bit. Pick-to: 6.4 6.3 6.2 Change-Id: I2a09878987df9edb9ff04f0ac4ad82af1a8b52c8 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-038-0/+24
| | | | | | | | | | | | 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>
* CustomStyle doc: fix code indentationLaszlo Papp2022-07-141-1/+1
| | | | | Change-Id: I8ef0ff5a499f796ebf76447caab27ff6b2556570 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-16125-6092/+250
| | | | | | | | | | | | | 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>
* QtWidgets: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-05-021-8/+10
| | | | | | Task-number: QTBUG-98434 Change-Id: I310ea8f19d73a79d985ebfb8bfbff7a02c424360 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtWidgets: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-262-3/+3
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: I133b80334b66e0a5ab9546dd8e1ff0631e79601e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiomKai Köhne2021-12-091-1/+1
| | | | | | | | | | Using REQUIRED as a prefix instead of suffix works better with OPTIONAL_COMPONENTS, and is also the order in the CMake manual. Task-number: QTBUG-98867 Pick-to: 6.2 Change-Id: I1ab68408b95d8edf06272a3b9fceccd8d8e597fc Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Partially modified to use C++11 standard nullptrchenbin2021-09-061-1/+1
| | | | | Change-Id: I0542c47d1979235206005bf603822b6ea415f2da Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Fix qdoc warnings on snippet filesNico Vertriest2021-03-221-0/+3
| | | | | | | | | qtwidgets-index.qdoc:123: (qdoc) warning: Cannot find file to quote from: 'snippets/snippets.pro' qtwidgets-index.qdoc:123: (qdoc) warning: Unexpected '\snippet (//! [qmake_use])' Task-number: QTBUG-90662 Change-Id: I702b685e7cd9c34b5a07480ecb99e913ce250d70 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix signature of canDropMimeData used in code snippetAlbert Astals Cid2021-03-042-2/+2
| | | | | Change-Id: I9026e11630651e740282466551ad78883a0421ec Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Port the snippet project setup to CMakeVenugopal Shivashankar2021-02-108-2/+61
| | | | | | | | Change-Id: I411e58e94752f3b2d0a3e8aac0ab7c4c2272db89 Fixes: QTBUG-89826 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QStyle: add name() to return the name of the styleChristian Ehrlicher2021-01-141-16/+8
| | | | | | | | | | | | Currently there is no way to get the name of the current style to e.g. create a QProxyStyle for a specific widget only. Therefore add QStyle::name() so QProxyStyle(const QString &) can be called without hard-coding the style name. Remove an unused doc snippet as drive-by. Fixes: QTBUG-8004 Change-Id: I466c5e870a5392b238365bdc930f6a2ecee50cdb Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-0718-99/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Doc: Use explicit linkage with target_link_librariesKai Koehne2020-11-301-1/+1
| | | | | | | | | | | | | | The Professional CMake book suggests always using explicit linkage with target_link_libraries, so let's use that. Whether to use PUBLIC or PRIVATE depends on the context. But let's be conservative and advise on using PRIVATE by default. Task-number: QTBUG-88935 Pick-to: 6.0 Change-Id: I12b80ee85be9f6916f1e4dea6b1c9cb29e03c20f Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Doc: Update CMake functions in Qt Widgets for Qt 6Kai Koehne2020-11-231-6/+0
| | | | | | Pick-to: 6.0 6.0.0 Change-Id: I4110e8695c75c40cec6f94bb94879b07282b29d3 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Adjust code format, add space after 'if'Zhang Sheng2020-11-161-1/+1
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Doc: Prefer versioned CMake library targetsv6.0.0-beta3Kai Koehne2020-11-011-1/+1
| | | | | | | | The non-versioned one's do miss some properties. It's therefore best to not advocate using them. Change-Id: I53645e65ed4de4e0100e59905c024cdfe40be0c5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Organize QtOpenGLWidgets documentationVolker Hilsheimer2020-10-291-209/+0
| | | | | | | | | | | Move snippets to the right place, and give the widgets class a place to live. QtOpenGLWidgets is just a library, not a separate module, but we need a module page that the class can refer to for correct build instructions. Change-Id: I6d955ad3c4cd1003a828cc1f256deb6e7fb50ec4 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QLayout docs: explain better what the QWidget ctor arg doesAhmad Samir2020-10-271-8/+4
| | | | | | | | | | Make it clear in the docs that an alternative to calling QWidget::setLayout() is to pass the parent widget to the Q*BoxLayout constructor. This basically just copies the relevant bits from the the docs of QWidget and Q*Layout. Change-Id: Id196dcdf9a876d9141aa145f23a83c45f8cda5f8 Pick-to: 5.15 5.12 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Deprecate QVariant::TypeLars Knoll2020-10-231-1/+1
| | | | | | | | | It's been obsolete for a long time already. Make sure the compiler now warns about it and remove all remaining uses in qtbase. Change-Id: I0ff80311184dba52d2ba5f4e2fabe0d47fdc59d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-0710-10/+10
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Doc: Make widgets snippets a subdirs/lib projectPaul Wicking2020-09-2310-41/+62
| | | | | | | Task-number: QTBUG-86497 Pick-to: 5.15 Change-Id: Ia43f9eb3bf8a3d2f6e76a1932179aaa94266540b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Doc: Clean up widget snippets projectPaul Wicking2020-09-108-13/+13
| | | | | | | | | | The main snippets project must be a subdirs project. Move some files and update the affected documentation. Task-number: QTBUG-86497 Pick-to: 5.15 Change-Id: I60073d1b8bd53aa09600eeccf06ba8457ac7c708 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Deliver Quit event when calling QCoreApplication::quit()Tor Arne Vestbø2020-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of QCoreApplication::quit() directly calling exit(0), which would leave QGuiApplication and client code out of the loop, we now send the Quit event, and let it pass through event delivery, before finally ending up in QCoreApplication::event(), where we call exit(0). This has the advantage that QGuiApplication can ensure all windows are closed before quitting, and if any of those windows ignore the close event the quit will be aborted. This aligns the behavior of synthetic quits via QCoreApplication::quit() with spontaneous quits from the platform via QGuiApplicationPrivate::processApplicationTermination. Clients who wish to exit the application without any event delivery or potential user interaction can call the lower level exit() function directly. [ChangeLog][QtGui] Application termination via qApp->quit() will now deliver Quit events to the application, which in turn will result in application windows being closed as part of the application quit, with an option to cancel the application quit by ignoring the close event. Clients who explicitly want to exit the application without any user interaction should call QCoreApplication::exit() explicitly. Task-number: QTBUG-45262 Task-number: QTBUG-33235 Task-number: QTBUG-72013 Task-number: QTBUG-59782 Change-Id: Id4b3907e329b9ecfd936fe9a5f8a70cb66b76bb7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>