summaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* Add missing qquaternion.h includesMarc Mutz3 days1-0/+2
| | | | | | | | | | | | | | | | | | | The qquaternion.h include will vanish from qmatrix4x4.h soon, but some TUs depended on on the transitive include. This patch includes qquaternion.h into all TUs that use QQuaternion, but didn't include its header. I didn't check all the individual TU's history to make a detailed "amends", so I'll just pick this all the way back, knowing there may have been more users in older branches, or some TUs don't exist there, but it since we're not picking the removal of qquaternion.h from qmatrix4x4.h further than 6.10, I don't need to do detailed checking. CI will tell me when something's wrong. Pick-to: 6.10 6.9 6.8 6.5 Change-Id: Icf0db8ba4f12421fd46f9d1041f235bf4cc2c12b Reviewed-by: Volker Hilsheimer <[email protected]>
* Make the windowflags example use "normal" windowsMorten Sørvig8 days2-2/+2
| | | | | | | | | | This example uses two windows and requires both to be visible at the same time. Call showNormal() instead of show() to prevent the first window from becoming fullscreen on platforms where show() uses fullscreen mode by default. Change-Id: Iab8bcfeba0ec14a8ea87256e0c843db279749d61 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Doc: Fix broken links in Qt WidgetsKai Köhne2025-06-032-2/+2
| | | | | | | | | The iQRhiWidget API got changed in commits acebb97b5880, acebb97b58807d1d591. Pick-to: 6.8 6.9 6.10 Change-Id: I7791b1a61d94f33ba01cfe22e63ecfdc7b81022b Reviewed-by: Laszlo Agocs <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* Doc: Fix auto-links to deprecated functionsDavid Boddie2025-05-311-1/+1
| | | | | Change-Id: Id4456eef3440734add2d804d186966e253335b7c Reviewed-by: Richard Moe Gustavsen <[email protected]>
* Compile androidnotifier only if widgets are availableJuha Vuolle2025-05-021-1/+1
| | | | | | | | | | The example links against widgets => add proper build-time guard. Task-number: QTBUG-136101 Pick-to: 6.9 6.8 Change-Id: I9e279791de5adf4e8bc86a09cb11e96022f9e1ce Reviewed-by: Assam Boudjelthia <[email protected]>
* Doc: Add alt-text for Qt Network examplesSafiyyah Moosa2025-04-2913-13/+13
| | | | | | | | | | | | | QDoc generates warnings for images that do not have an alternate-text associated with it. Alt-text is required for to increase accessibilty options. This patch adds alt-text to images in the Qt Network Fixes: QTBUG-135122 Pick-to: 6.9 6.8 Change-Id: I690f1d381ef5a9052e189dd1f3906243df557da0 Reviewed-by: Topi Reiniö <[email protected]>
* Compile calendarbackendplugin only if widgets are enabledJuha Vuolle2025-04-292-2/+4
| | | | | | | | | | | The example links against widgets unconditionally => add proper build-time guard Task-number: QTBUG-136101 Pick-to: 6.9 Change-Id: I62ea42a04f7ff421753a0fc7a30cd969cfaff6e2 Reviewed-by: Magdalena Stojek <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>
* Examples: fix a couple of nodiscard warnings from QFile::openGiuseppe D'Angelo2025-04-242-4/+11
| | | | | | | | | | In one case, the code simply checked for isOpen afterwards; refactor it to use QFile::open's result. In another case, a file was opened from the resource system, so add a check. Pick-to: 6.9 6.8 Change-Id: I5f4c22dd5ce678f15c9c1609c4228d50a2b32a1d Reviewed-by: Thiago Macieira <[email protected]>
* Doc: Qt D-Bus: Add image alt textsTopi Reinio2025-04-092-2/+4
| | | | | | | | | | | To increase accessibility for the documentation, provide altenative descriptions for the images. Pick-to: 6.9 6.8 Fixes: QTBUG-135116 Change-Id: Id2d97251af9af0d4222f0dc15aa5b8e266ca36f4 Reviewed-by: Safiyyah Moosa <[email protected]> Reviewed-by: Andreas Eliasson <[email protected]>
* Doc: Add Alt-text to the Qt SQL examplesSafiyyah Moosa2025-04-099-12/+12
| | | | | | | | | | | | | | QDoc generates warnings for images that do not have alt-text associated with them. Alt-text is used to add context to images for users who use screen-readers. This patch applies alt-text to images in the Qt SQL module that do not have any alt-text associated with them. Fixes: QTBUG-135114 Pick-to: 6.9 6.8 Change-Id: Iead375852d30219db7dfed12bb1f383eb55713e6 Reviewed-by: Topi Reiniö <[email protected]>
* Examples: port from QCheckBox::stateChanged to checkStateChangedGiuseppe D'Angelo2025-03-261-4/+4
| | | | | | | | The former is deprecated. Pick-to: 6.9 Change-Id: I94de7a6c6bbea61cd75820389e8039cb92c7ee6a Reviewed-by: Laszlo Agocs <[email protected]>
* Examples: include what you use (QElapsedTimer)Giuseppe D'Angelo2025-03-261-0/+1
| | | | | | Pick-to: 6.9 6.8 Change-Id: Icb2ae16d8d6b9083c1118ef2489fa2a1d7db9bdf Reviewed-by: Edward Welbourne <[email protected]>
* Examples: fix UB calls into QElapsedTimerGiuseppe D'Angelo2025-03-262-2/+2
| | | | | | | | | Calling restart() without start() is illegal, so don't do that; use start() instead. Pick-to: 6.9 6.8 6.5 Change-Id: I2ff5151f588cb926ccecc3d9997615e63f36ee24 Reviewed-by: Thiago Macieira <[email protected]>
* DropSite example: handle application/x-colorShawn Rutledge2025-03-171-1/+9
| | | | | | | | | | | | | Show the color that is dragged in, both graphically and textually. Revert to default palette for other data types. Prioritize colors over text: if an application (such as kolourpaint) offers both x-color and text, the color is probably the intention, and the text may be just a hex string for placing into a color text field. Pick-to: 6.8 6.9 Fixes: QTBUG-134313 Change-Id: I6c19f1220712881d2057bc9758bbc8cbd9247c81 Reviewed-by: Liang Qi <[email protected]>
* Docs: Create \Q4A macro for "Qt for Android" and replace instancesNicholas Bennett2025-02-281-2/+2
| | | | | | | | | | | | | | "Android" is trademarked and needs to be referenced in a certain way. The following steps were taken: -Created qdoc macro. -Updated "Qt Android" and "Qt for Android" to use \Q4A in qdoc files. The macro will need to be adopted in all documentation projects. Task-number: QAA-2836 Pick-to: 6.9 6.8 6.5 Change-Id: I4b52247a4ed52047242a06404e6d3aa19de9c16c Reviewed-by: Assam Boudjelthia <[email protected]>
* Correct childNumber() reference in editable tree model exampleAxel Spoerl2025-02-181-1/+1
| | | | | | | | | | childNumber() has been renamed to row() in the code, but not in the documentation. Correct it. Pick-to: 6.9 6.8 6.5 Change-Id: Ibe6f1f27c0dd1982ff663dc680738babf2db87d7 Reviewed-by: Paul Wicking <[email protected]>
* Do not lie about keyboard shortcut to macOS usersJan Arve Sæther2025-02-031-2/+4
| | | | | | | | QKeySequence::HelpContents maps to 'F1' on all platforms except macOS, where it maps to '⌘ + ?' Change-Id: Ic9b0acdbd686591792fcac1195f03ba334bde3fa Reviewed-by: Richard Moe Gustavsen <[email protected]>
* Notepad example: Use theme iconsFriedemann Kleint2025-01-281-16/+16
| | | | | | Pick-to: 6.9 6.8 Change-Id: Id915ecbf218d419b972ff97637673827facf84a2 Reviewed-by: Axel Spoerl <[email protected]>
* CMake: Fix examples built as external projectsJoerg Bornemann2025-01-275-5/+5
| | | | | | | | | Usage of a private module needs a respective find_package call now. Pick-to: 6.9 Task-number: QTBUG-87776 Change-Id: I3a00a241c5e8637d28606c1f45a843b491c0a8bc Reviewed-by: Alexandru Croitor <[email protected]>
* examples: check return value of QFile::open() callsAhmad Samir2025-01-222-3/+14
| | | | | | | QFile::open() is marked [[nodiscard]]. Change-Id: I0fa884b329a47c4ad59f40d66b5fbc38f3a5648e Reviewed-by: Friedemann Kleint <[email protected]>
* QSortFilterProxyModel: add endFilterChange, deprecate invalidateFilterVolker Hilsheimer2025-01-221-2/+2
| | | | | | | | | | | | | | | | | | | | This adds the typical end*() call to match the beginFilterChange() call introduced by 00ce45efe16ff440651746a94c62e0d5c1f6e435. Pairing those calls is necessary to make sure that the model can keep track of changes between the old to the new filtering and emit the correct signals. By deprecating the invalidateFilter() functions, we also make it clear that existing code needs to be ported to the new API calls to avoid the potentially incorrect or missing signal emissions. Introduce a new FilterDirection enum with flag type FilterDirections to indicate whether a row- or column-filter (or a filter impacting both directions) changed. Replace the internal Directions enum with that, it's no longer necessary. Task-number: QTBUG-115717 Change-Id: I31c43ba846d665ef26c8a013d064421484f006cb Reviewed-by: David Faure <[email protected]>
* Standard dialogs example: Fix compilation with QT_NO_CAST_FROM_ASCIIFriedemann Kleint2025-01-211-7/+9
| | | | | | | | Add missing tr(), use literals. Pick-to: 6.9 6.8 Change-Id: I35387e29ce1b08f9df0ade5ee743b33561639f7a Reviewed-by: Oliver Eftevaag <[email protected]>
* Standard dialogs example: Fix some clang-tidy warningsFriedemann Kleint2025-01-212-45/+50
| | | | | | | | | | | | - Use auto * when initializing with new - Initialize variables - Fix static invocations - Use per-class includes - Minor cleanups Pick-to: 6.9 6.8 Change-Id: I137bc7dfad63bc55a1b1bbc3f42d758bbfdb86ba Reviewed-by: Oliver Eftevaag <[email protected]>
* CMake: Use a unique resource identifier in simpletreemodel exampleAlexandru Croitor2025-01-201-1/+1
| | | | | | | | | | | | | | | | | To avoid the following error: The custom command generating .rcc/qrc_editabletreemodel.cpp is attached to multiple targets: editabletreemodel editabletreemodel_tester but none of these is a common dependency of the other(s). This is not allowed by the Xcode "new build system". Pick-to: 6.8 6.9 Fixes: QTBUG-131631 Change-Id: I1c5d0702596a4f8f723d9080bc5304d6ad06853b Reviewed-by: Alexey Edelev <[email protected]>
* Replace qdebug.h includes in public headers with forward-declarationsAhmad Samir2025-01-156-0/+7
| | | | | | | | | | | | | | | | | | | qdebug.h includes many Qt and STL headers, so if you include a Qt header you get all those transitive includes, which may affect build time. - Where appropriate use the printf-like syntax of qDebug() and co., these don't need the QDebug streaming operators - qfloat16 is used in an inline member function, so include it explicitly [ChangeLog][Potentially Source Incompatible Changes] Various Qt public headers don't include QDebug any more; if you need QDebug's streaming you'll have to include it in your code. Task-number: QTBUG-132439 Pick-to: 6.9 Change-Id: I750587e17a3b38fa226cd3af8eaccc8da580f436 Reviewed-by: Thiago Macieira <[email protected]>
* Mime type browser example: Add translator loader codeFriedemann Kleint2025-01-061-0/+16
| | | | | | | | | Enable testing translations. Task-number: QTBUG-127004 Pick-to: 6.9 6.8 Change-Id: Ie83092b4db5bcf516834cf0b5b564a67d7ab6227 Reviewed-by: Joerg Bornemann <[email protected]>
* sqlbrowser example: use = default on empty dtorsMarc Mutz2025-01-021-3/+1
| | | | | | | | | | | Idiomatic C++11 code. Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however, inherited the issue from older code. Pick-to: 6.9 6.8 Change-Id: Iba1fb9874bd93b4a560c33e3ecf62ecaa96d8bda Reviewed-by: Volker Hilsheimer <[email protected]>
* sqlbrowser example: fix ugly margin around ConnectionWidgetMarc Mutz2025-01-021-0/+1
| | | | | | | | | | | | | | | | When a layout is used to arrange the children of a non-top-level custom widget, the layout's contentsMargins need to be manually set to zero to avoid extra empty space around the widgets, misaligning it w.r.t. its siblings. Add the necessary call. Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however, inherited the missing margin adjustment from older code. Pick-to: 6.9 6.8 Change-Id: Icd1945a4f2b1635f031e50758ec2f1ec9313ae27 Reviewed-by: Volker Hilsheimer <[email protected]>
* sqlbrowser example: use explicit / overrideMarc Mutz2025-01-023-6/+6
| | | | | | | | | | | | | Examples should show idiomatic use of Qt and C++, so mark the custom widget constructors in this example as explicit and their destructors are override. Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however, inherited the missing explicit from older code. Pick-to: 6.9 6.8 Change-Id: I5b5b49f69330c6f139345bed7264c85a36c36e9b Reviewed-by: Volker Hilsheimer <[email protected]>
* sqlbrowser example: use unique_ptr to hold m_uiMarc Mutz2025-01-024-10/+10
| | | | | | | | | | | | | | | | The old code used manual memory mangement (raw new/delete) to (de)allocate the Ui struct. This is so 80s. Use an owning smart pointer to manage the memory. Ordinarily, this would have been QScopedPointer, but seeing as that doesn't have a create() method to hide the raw new, use std::unique_ptr and std::make_unique() instead. Amends 2690822428deec4f0c08f4d118d69a7c6036369e. Pick-to: 6.9 6.8 Change-Id: Icabb9154eb38630855e14094b958af0214516f6b Reviewed-by: Volker Hilsheimer <[email protected]>
* sqlbrowser example: use idiomatic Qt [3/3]: use form-layoutMarc Mutz2025-01-021-7/+1
| | | | | | | | | | | | | | The old code used a grid layout inside the QGroupBox, but the design with labels in the first and edit-widgets in the second column lends itself to a QFormLayout, which adapts the alignment of the widgets to the platform style, so use that. Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however, inherited all of the above from even older code. Pick-to: 6.9 6.8 Change-Id: I528f0ce9d8cb7a997fbfabcdca887c059f571b38 Reviewed-by: Volker Hilsheimer <[email protected]>
* sqlbrowser example: use idiomatic Qt [2/3]: use button-box / override accept()Marc Mutz2025-01-023-51/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The old code used two QPushButtons in a QHBoxLayout to provide Ok/Cancel buttons. This hard-codes the positions and text (and icons) of these buttons, instead of adapting to the platform style. The new code simply uses QDialogButtonBox, which is designed for this purpose. - Also, the old code connected the Ok button's clicked() signal to a custom slot that then called QDialog::accept(). This means that the code in the custom slot is not executed when the dialog is accepted by other means (e.g. return press in one of the line edits ("auto-default"), though I'm not sure here). The new code uses the idiomatic Qt way of overriding QDialog::accept() instead, and connects the button-box's accepted() signal to it. This is done in the .ui file, so it already works in Designer preview. - Finally, the old code made a manual connection from the Cancel button to QDialog::reject(). The new code uses the Qt idiom of connecting in the .ui file directly, using QDialogButtonBox::rejected() as the signal. Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however, inherited all of the above from even older code. Pick-to: 6.9 6.8 Change-Id: I83afd6156a0811e0c0f99f2480625ea6b69ff78b Reviewed-by: Volker Hilsheimer <[email protected]>
* sqlbrowser example: use idiomatic Qt [1/3]: disabling group-boxMarc Mutz2025-01-023-9/+18
| | | | | | | | | | | | | | | | | | | The old code connected to the wrong signal and therefore had to write a custom slot to perform the disabling of the group-box. The new code simply connects the QCheckBox::toggled(bool) signal to the directly-compatible QWidget::setDisabled(bool) slot, removing the need for a custom slot. Also move the connection into the .ui file, so it works already when checking the form in QtDesigner. Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however, only inherited the issues from older code. Pick-to: 6.9 6.8 Change-Id: Ia834f92de270bb7b18981273188f6e5b6cd457a2 Reviewed-by: Volker Hilsheimer <[email protected]>
* Use QPainterStateGuard in examplesFriedemann Kleint2024-12-178-55/+61
| | | | | | | | Complements 9ecf47a8a8d11227ecf192246d7df7c2c4dc9105. Pick-to: 6.9 Change-Id: I65456f8fd34bf9d316b72c4286e1b15789309f7c Reviewed-by: Christian Ehrlicher <[email protected]>
* Improve drag-and-drop visual handling in DragWidgetPatryk Stachniak2024-12-061-9/+4
| | | | | | | | | | | | | | | | | | | Modified the mousePressEvent in DragWidget to temporarily detach the dragged QLabel from its parent using setParent(nullptr). This ensures the dragged widget remains visible and above other widgets during the drag operation. Re-parenting logic was added to restore the QLabel to its o riginal container if the drag action is not a MoveAction. This change addresses visual issues where dragged items could disappear behind overlapping widgets, enhancing user experience and maintaining consistent behavior. Task-number: QTBUG-123777 Pick-to: 6.6.2 Change-Id: I3edce9c96815e32eb8f00b61f7eda1709de04b4d Reviewed-by: Richard Moe Gustavsen <[email protected]>
* Removal of generic stylesheet rule for dropdownPatryk Stachniak2024-12-021-1/+0
| | | | | | | | | | | | | | | The generic stylesheet rule (* { border: none; }) was overriding specific styles for the menu-indicator, causing the dropdown arrow to appear larger than intended. This rule was removed to restore default or explicitly set styles for the arrow, ensuring consistent visual appearance Task-number: QTBUG-120604 Pick-to: 6.8 6.5 Change-Id: If93de1e1595a2155e9a76644a3c615bd432bf53f Reviewed-by: Richard Moe Gustavsen <[email protected]>
* Add Qt::Orientations based flip and flipped functionsAllan Sandfeld Jensen2024-11-294-4/+4
| | | | | | | | Is easier to read and more bool-trap safe. Old form header deprecated from 6.10 Fixes: QTBUG-129575 Change-Id: Id785b9ce159007ce745c04120b2112c8bb9b0802 Reviewed-by: Volker Hilsheimer <[email protected]>
* Examples: Disable QtC junction points for examples using 'shared' directoryKai Köhne2024-11-2610-0/+210
| | | | | | | | | | | | | | | To work around path length limiations, Qt Creator optionally uses junction points to shorten the build directories. This however breaks examples that require sources outside their 'root' directory. QUIP 13 states that examples should be self-contained. Anyhow, fixing this is a larger effort, so for now just disable junction points in Qt Creator for these examples. Task-number: QTBUG-128914 Pick-to: 6.8 Change-Id: Ifb5e6944d936c82b1dba9fe3b81bebc1c8320168 Reviewed-by: Cristian Adam <[email protected]>
* Doc: Move Easing Curve example into Graphics categoryPaul Wicking2024-11-121-1/+1
| | | | | | | | | | This example is for the animation framework (graphics), it isn't about multimedia. Use the correct category. Pick-to: 6.8 Change-Id: I32f0ce13a5496c8fbc871d8f2454575c25684eba Reviewed-by: Kai Köhne <[email protected]> Reviewed-by: Alessandro Portale <[email protected]>
* Show Custom Completer example as part of UI Components categoryKai Köhne2024-10-311-0/+2
| | | | | | Pick-to: 6.7 6.8 Change-Id: I6f91d5b684bcc16eb145d5c504ccc8dbe9149c8a Reviewed-by: Mats Honkamaa <[email protected]>
* Use delegate to draw ComboBox LabelMagdalena Stojek2024-10-294-51/+28
| | | | | | | | | | Allows customization and dynamic rendering of items in the labels. Task-number: QTBUG-126696 Change-Id: I6261131808aa303660f991e2f19248e547b14566 Reviewed-by: Richard Moe Gustavsen <[email protected]> Reviewed-by: Matthias Rauter <[email protected]>
* Organize the tutorials in Qt Widgets so they are visible and reachableAlexei Cazacov2024-10-231-1/+2
| | | | | | | | | | This commit makes visible in the TOC: - both of the tutorials - a set of examples for completer, undo framework, and regex'es Fixes: QTBUG-129818 Change-Id: Id6636782789c4e5b11349af3c4fb33f75035f1a0 Reviewed-by: Paul Wicking <[email protected]>
* Docs: Update images for Widgets and remove unused imagesAlexei Cazacov2024-10-175-0/+0
| | | | | | | | | | This commit updates the images used to illustrate Qt Widgets. The commit also removes old unused images. Task-number: QTBUG-69988 Pick-to: 6.8 Change-Id: I89e363c6c854c36bb0d763532d4cb359bdc85a38 Reviewed-by: Paul Wicking <[email protected]>
* wasm: disable network examplesMorten Sørvig2024-10-151-11/+13
| | | | | | | | | http and rsslisting compile and can work, the rest are don't build and are probably too low level. Pick-to: 6.8 Change-Id: I031494178d0cace10951c3eb5495fbbf0f73d717 Reviewed-by: Piotr Wierciński <[email protected]>
* Docs: Update the screenshots for the Qt Widgets examplesAlexei Cazacov2024-10-1128-1/+3
| | | | | | | | | | This commit updates the screenshots for the Qt Widget examples. It also removes several unused screenshots and adds several minor edits. Task-number: QTBUG-69988 Pick-to: 6.8 Change-Id: I23b90fd6c8b798169d158854609c09ef3f1c1a20 Reviewed-by: Paul Wicking <[email protected]>
* CompositionWidget example: use QBasicTimer instead of raw timer IDsAhmad Samir2024-10-032-12/+13
| | | | | Change-Id: I011645d915193c9ab1e3f001898c88fdd48e64a0 Reviewed-by: Thiago Macieira <[email protected]>
* GraphWidget example: use QBasicTimer instead of raw timer IDsAhmad Samir2024-10-032-7/+8
| | | | | Change-Id: I9ba66ff37112b749d29a9121f4c89cab1a8e9d07 Reviewed-by: Thiago Macieira <[email protected]>
* examples/*/network-chat: port to std::chrono intervalsAhmad Samir2024-10-031-5/+5
| | | | | Change-Id: Id5ba0f412f1643f6a0588ae69d5bfcb163dc1c81 Reviewed-by: Thiago Macieira <[email protected]>
* examples/network/network-chat: use QBasicTimer instead of raw timer IDsAhmad Samir2024-10-032-10/+9
| | | | | Change-Id: I6ea464a6d19c775edca187fea1d7cd82f5f22d3f Reviewed-by: Thiago Macieira <[email protected]>
* Examples/Sql/Masterdetail: Fix deleting rowsChristian Ehrlicher2024-09-075-1/+7
| | | | | | | | | | | | | | Completely deleting a row in a QSqlTableModel needs a call to select() afterwards, otherwise a blank column will stay according the documentation of QSqlTableModel::removeRows() Also add albumdetails.xml to the resource file to make sure it's found during runtime. Pick-to: 6.8 Task-number: QTBUG-128434 Change-Id: Ie5cc38edfa27984d186467e3372b05987f78d14c Reviewed-by: David Faure <[email protected]> Reviewed-by: Axel Spoerl <[email protected]>