summaryrefslogtreecommitdiffstats
path: root/src/widgets/doc/snippets
Commit message (Collapse)AuthorAgeFilesLines
* Widgets snippets: Use the header file instead of a new class each timeOleksii Zbykovskyi17 hours4-81/+4
| | | | | | | | In several snippets, the TableModel class is created and used. I included a header file to avoid code repetition. Change-Id: Ie6318606cc89a2f5f1c137a36195fe290b6c1be6 Reviewed-by: Volker Hilsheimer <[email protected]>
* Widget snippets: Fix indentation in qtreewidget-using exampleOleksii Zbykovskyi40 hours1-16/+17
| | | | | | | | | | | | | Made minor adjustments to the indentation in the qtreewidget-using example to ensure clarity and consistency in the code snippets. At the same time, combine snippets 10 and 11 because they are only used together. Updated related documentation to reflect these changes. Amends 1cf7d9f34f1bc3ddc5fa97ff57a95dd8083f9ae8 Change-Id: I7446341cf4e498004199c1ec9d08e31df9ae5b7f Reviewed-by: Volker Hilsheimer <[email protected]>
* Create a header file for MainWindow classOleksii Zbykovskyi40 hours22-259/+122
| | | | | | | | | MainWindow class was created and used all around widgets snippets. I made a seperated header file for all of these cases to avoid repetitive code. Change-Id: Ic403fc7d5278f77e62d8b5265c4184a154fef1b6 Reviewed-by: Volker Hilsheimer <[email protected]>
* Fix indentation issues in the widgets snippets folderOleksii Zbykovskyi2025-08-0633-333/+399
| | | | | | | | Most of the snippets in widgets have indentation problems. So I refactored them to have a consistent indentation. Change-Id: I94422c222aa7a72cb2352f8cfb41ffe207c74904 Reviewed-by: Volker Hilsheimer <[email protected]>
* Combine two snippets blocks in oneOleksii Zbykovskyi2025-08-061-4/+2
| | | | | | | Snippets 0 and 1 are used only together and may be combined. Change-Id: Ib138d321116b9eaf4152690dbfbe3a9b20217203 Reviewed-by: Volker Hilsheimer <[email protected]>
* Combine senselessly divided snippets in customstyleOleksii Zbykovskyi2025-08-061-6/+4
| | | | | | | | | | Customstyle has two functions, and each of them contains two snippet blocks. These blocks are not used separately, so I combined each of them into one and fixed the related documentation. Task-number: QTBUG-137566 Change-Id: I539940c85970a8dfdb63daf531335ae4bf9d754b Reviewed-by: Volker Hilsheimer <[email protected]>
* Relocate files from separate CMake files to the main oneOleksii Zbykovskyi2025-08-0611-94/+52
| | | | | | | | | Removed useless CMakefiles and move their contents to the main CMakeLists file. Task-number: QTBUG-137566 Change-Id: Ibeb162ce43243d9af7732f39935325cbb52ecdec Reviewed-by: Volker Hilsheimer <[email protected]>
* Make snippets in widget folder compilable and add to the build systemOleksii Zbykovskyi2025-08-0528-57/+335
| | | | | | | | | | Created a CMakeLists.txt file in the widgets folder and added snippets to it. Fixed related issues with missing includes and compilation errors. Task-number: QTBUG-137566 Change-Id: Ief61c3675d8b4d5935bbb0cb951d3a9e82f437f7 Reviewed-by: Volker Hilsheimer <[email protected]>
* Doc: Update QDialog and QMessageBoxDheerendra Purohit2025-07-111-3/+3
| | | | | | | | | Improve the documentation for QDialog and QMessageBox. Clarifies example usage and the optional nature of the parent parameter without implying a required guideline. Fixes: QTBUG-123902 Change-Id: I30749a0c13de55f41ce9c944542cf3c6356fd6bd Reviewed-by: Volker Hilsheimer <[email protected]>
* Widgets: pass dpr to QIcon::pixmap()Christian Ehrlicher2024-12-291-1/+3
| | | | | | | | | Change the remaining calls to QIcon::pixmap() to pass a valid devicePixelRatio parameter. Pick-to: 6.9 Change-Id: I0e71e20c8109e296446e9e13cddba31d53c05df9 Reviewed-by: Volker Hilsheimer <[email protected]>
* Doc: Use qt_add_ui instead of qt6_add_uiOrkun Tokdemir2024-08-052-26/+26
| | | | | | | Pick-to: 6.8 Task-number: QTBUG-126463 Change-Id: Ib5d207e72c0de436b4daec29efd8baec8a998103 Reviewed-by: Alexandru Croitor <[email protected]>
* Use QModelIndex::data()Albert Astals Cid2024-06-211-1/+1
| | | | | | | | | | idx.data(role) is much nicer to read than idx.model()->data(idx, role) As a drive-by, mark some QVariants const. Pick-to: 6.8 Change-Id: I00c0a5ac311a03095050b2542a5c396a6c1c2c6a Reviewed-by: Marc Mutz <[email protected]>
* CMake: Add `qt_add_ui` APIOrkun Tokdemir2024-05-072-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces a new `qt_add_ui` CMake API to be used instead of AUTOUIC, due to several hard-to-fix bugs it has. * Resolves the issue where Ninja required two passes to correctly build `.ui` files. * Avoids build folder leakage, in contrast to `AUTOUIC` * Prevents unnecessary recompilation of unchanged source files when a `.ui` file is modified with Ninja. * Since `qt_add_ui` does not scan source files, it provides a faster build than `AUTOUIC`. These changes aim to streamline the build process and improve efficiency when working with `.ui` files. This addresses the following issues: https://gitlab.kitware.com/cmake/cmake/-/issues/16776 https://gitlab.kitware.com/cmake/cmake/-/issues/25436 https://gitlab.kitware.com/cmake/cmake/-/issues/25195 Task-number: QTBUG-110369 Fixes: QTBUG-114563 Change-Id: I34cd3df70542becf6e08502f0cbcd1c11eeeadd6 Reviewed-by: Alexandru Croitor <[email protected]>
* Convert "Color Editor Factory" Example to snippetsMohammadHossein Qanbari2024-04-191-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 <[email protected]>
* Convert Group Box Example to snippets and screenshotsMohammadHossein Qanbari2024-04-181-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 <[email protected]>
* Doc: don't use deprecated function in QMenu snippetsChristian Ehrlicher2024-04-171-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 <[email protected]> Reviewed-by: Safiyyah Moosa <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]> Reviewed-by: Andreas Eliasson <[email protected]>
* 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 <[email protected]>
* doc: fix QScrollBar stylesheet code exampleSamuel Gaist2023-11-131-2/+2
| | | | | | | The horizontal parts were missing colons. Change-Id: Ibc3657d87d38af76d0736f9880eb711f52723de1 Reviewed-by: Paul Wicking <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* Add QRhiWidgetLaszlo Agocs2023-08-143-0/+134
| | | | | | Task-number: QTBUG-113331 Change-Id: I8baa697b4997b05f52acdee0e08d3c368fde5bc2 Reviewed-by: Andy Nichols <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]> Reviewed-by: Christian Ehrlicher <[email protected]> Reviewed-by: Qt CI Bot <[email protected]>
* 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 <[email protected]> Reviewed-by: Richard Moe Gustavsen <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]> Reviewed-by: Jörg Bornemann <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* CustomStyle doc: fix code indentationLaszlo Papp2022-07-141-1/+1
| | | | | Change-Id: I8ef0ff5a499f796ebf76447caab27ff6b2556570 Reviewed-by: Tor Arne Vestbø <[email protected]>
* 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 <[email protected]> Reviewed-by: Lars Knoll <[email protected]> Reviewed-by: Jörg Bornemann <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* Partially modified to use C++11 standard nullptrchenbin2021-09-061-1/+1
| | | | | Change-Id: I0542c47d1979235206005bf603822b6ea415f2da Reviewed-by: Thiago Macieira <[email protected]>
* 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 <[email protected]>
* Fix signature of canDropMimeData used in code snippetAlbert Astals Cid2021-03-042-2/+2
| | | | | Change-Id: I9026e11630651e740282466551ad78883a0421ec Reviewed-by: Fabian Kosmale <[email protected]>
* CMake: Port the snippet project setup to CMakeVenugopal Shivashankar2021-02-108-2/+61
| | | | | | | | Change-Id: I411e58e94752f3b2d0a3e8aac0ab7c4c2272db89 Fixes: QTBUG-89826 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Paul Wicking <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>