summaryrefslogtreecommitdiffstats
path: root/examples/sql
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Add deployment API to our examplesAlexandru Croitor2024-03-229-81/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Projects were modified using the tool at: https://git.qt.io/alcroito/cmake_refactor A couple of examples had to be adapted manually, due to them including more than one app per example subdirectory. The INSTALL_EXAMPLESDIR and INSTALL_EXAMPLEDIR assignments were removed. The install(TARGETS) calls were modified according to our documentation snippets for qt_generate_deploy_app_script. A qt_generate_deploy_app_script call was added for each executable target. Note that the deployment step will be skipped in the CI for now, because we enable QT_DEPLOY_MINIMAL_EXAMPLES and thus QT_INTERNAL_SKIP_DEPLOYMENT, and also because standalone examples are not enabled yet, and deployment is disabled for in-tree (so no-standalone-example) prefix builds. The install(TARGETS) calls for each example will still run, installing the examples into an installed_examples directory, that will not be archived by the CI. Pick-to: 6.7 Task-number: QTBUG-102056 Task-number: QTBUG-102057 Change-Id: Ida389bbad41710b2ae5da4d95e2d85be9e0cd9ce Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* SQL/QSqlField: deprecate internal functions setSqlType()/typeID()Christian Ehrlicher2024-03-101-3/+1
| | | | | | | | | These functions set/get the db-specific internal sql type but it's not used in any of the sql plugins since ages. Any external plugin using this for some reason must be ported away until Qt7. Change-Id: Ifb33e9d3be0b80fb4d0979d31436e89ea6a8208b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Correct license for examples filesLucie Gérard2024-03-0710-10/+10
| | | | | | | | | | | | | | Example takes precedent over build system file type. According to QUIP-18 [1], all examples file 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: Id348a89884bb309b96abb31077f14a51086b5d0c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Examples/sqlbrowser: improve coding styleChristian Ehrlicher2024-01-197-194/+248
| | | | | | | | | | | Fix the coding style to match the current Qt style. Pick-to: 6.7 Fixes: QTBUG-68661 Fixes: QTBUG-120909 Change-Id: I314ca9da8a03727e3e0336a23fce1ce9d065d3a4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* SQL examples: code cleanupChristian Ehrlicher2024-01-1419-129/+172
| | | | | | | | | | | Misc code cleanup for the sql examples: - don't include global Qt headers but only needed ones - use proper tr() where possible - pass parameters by const ref - style fixes Change-Id: I4fd4293948918b9d7b373b6d1e8eeecf6f25a622 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* Fix warning on SQL Browser startupKai Köhne2024-01-121-1/+2
| | | | | | | | | | | Browser::addConnection is not a slot/invokable, and requires arguments. What was probably meant to happen is that the connection dialog opens. Pick-to: 6.5 6.6 6.7 Change-Id: I4e6bffb3e0277ca3deb7111cf4bb47ff188f6f16 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Update the books exampleEd Cooke2023-12-1412-241/+184
| | | | | | | | | | | | | | | | | | | | | | | Remove the .ui file and write the equivalent implementation. Replace the outdated star icons with new star icons. 5 empty stars are now provided and filled in depending on the rating. The new stars are SVG, however, we do not use an SvgRenderer as we cannot use the QtSvg API from QtBase directly. It is safe to assume the SVG image loading plugin is present, the worst case scenario would be empty icons, but it would still build. We instead use QIcon. For the rating, draw the star icons in a combobox, replacing the old spinbox. Update the layout by moving the table view to the bottom, and arranging the input fields at the top. The scrollbar policies have been set to Qt::ScrollBarAsNeeded for the table view. Fixes: QTBUG-118476 Pick-to: 6.7 6.6 6.5 Change-Id: I27c13534ab06e17531d155469a1cc6e7e05197af Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* SQL/drilldown example: add new icons and misc cleanupChristian Ehrlicher2023-11-2312-21/+17
| | | | | | | | | | | | Cleanup the drilldown example: - use icons with the current style - remove unneeded QOverload<> - remove some empty lines which don't look good in the documentation - use Q_SLOTS/Q_SIGNALS instead slots/signals Fixes: QTBUG-113696 Change-Id: I62476a8989c0abd1f424d1425cb05489491e2153 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Preparations to deprecate QItemDelegateChristian Ehrlicher2023-10-051-4/+4
| | | | | | | | | | | | | QItemDelegate was superseded since Qt4 by QStyledItemDelegate but it took until Qt6.7 to remove the last occurrences in qtbase. - remove unused includes / replace with qabstractitemdelegate.h - replace references in the documentation with QStyledItemDelegate - adjust the examples and tests to use QStyledItemDelegate Pick-to: 6.5 6.6 Change-Id: I246755004ce2d01192a726ca0972106c237df0cc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* examples/: compile with QT_NO_CONTEXTLESS_CONNECTAhmad Samir2023-09-085-20/+11
| | | | | | | | | | | | | | | | | Examples are usually a good way to get to know a new codebase, do not teach developers who are new to Qt about the 3-arg connect() to begin with. Drive-by changes: - `this` can't be implicitly captured with [=] in a lambda, instead capture by reference - Update docs related to the sqlbrowser example; the overloaded signal it mentions has been removed in Qt6 - In the sqlbrowser example, rename addConnection() (no-arg) overload to openNewConnectionDialog, suggested in code review Change-Id: I30c9f35bda4ac2f460d767ab7f84422ae3ed09f7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Add remaining SQL examples to Data Processing & I/O categoryKai Köhne2023-07-138-0/+8
| | | | | | | Task-number: QTBUG-115174 Pick-to: 6.5 6.6 Change-Id: Idd8ba8504efb17f0e4a11b3c36b991739251f2ef Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Doc: Update example category namesKai Köhne2023-07-101-1/+1
| | | | | | Pick-to: 6.5 6.6 Change-Id: If4a50c403ed0fb299ac0d9a66f1f606151c55930 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Move simple widget mapper example to manual testTor Arne Vestbø2023-06-301-2/+1
| | | | | | Pick-to: 6.5 6.6 Change-Id: I703843b5ee935794c2e2fd0407f9a1508b088ab6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Examples: Revamp sql/booksLiang Qi2023-06-293-2/+6
| | | | | | | | | | | | * use nullptr * use member init * set ExpandingFieldsGrow fieldGrowthPolicy for QFormLayout, which makes it behaviors similar on macOS as other platforms * select first row to make up/down keys works by default Pick-to: 6.5 6.6 Change-Id: I25d9869d2ca1c7274c2b750aada8270734787546 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Examples: Remove unnecessary Q_INIT_RESOURCE callsKai Köhne2023-06-083-6/+0
| | | | | | | | | | | Explicit calls to Q_INIT_RESOURCE are only needed for resources embedded in static libraries. See also https://doc.qt.io/qt-6/resources.html#explicit-loading-and-unloading-of-embedded-resources Pick-to: 6.5 6.6 Change-Id: I06a24d1c04369eedc78ca60a6ca02ce33907d9e7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Update Cached Table example meta-dataVolker Hilsheimer2023-05-241-1/+2
| | | | | | | | | | | | | | Drop "Example" from the example's title, add SQL instead, and add it to the Input/Output category of examples. It's a documented example, does something meaningful, and looks reasonable. Having one SQL example categorised so that it's easy to see that Qt includes that functionality seems like a good idea. The other examples are mostly small API examples that are still good to have as fully-functional apps rather than just snippets. Pick-to: 6.5 Change-Id: Ib960f38db39c791f7ff5a2b9bf3157ee32b362ec Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
* examples: Connect Quit action to QCoreApplication::quit, not QWidget::closeTor Arne Vestbø2023-02-202-2/+2
| | | | | | Pick-to: 6.5 Change-Id: I44ca7b61a4a261a7d3aad0dfeb870eb927ee768d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Examples: Use PRIVATE CMake linkageKai Köhne2022-11-309-9/+9
| | | | | | | 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: Use qt_standard_project_setup()Kai Köhne2022-11-179-20/+18
| | | | | Change-Id: I0ceab08108b7e58e4e2ed25db9e3c289f5c0ddac Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Use Qt6:: to qualify Qt CMake packagesKai Köhne2022-11-1710-39/+39
| | | | | | | This is what we promote also in the documentation. Change-Id: If91aebafe861b0c934acbb2c69afd182abc3345d Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-2310-10/+10
| | | | | | | 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>
* Add license headers to cmake filesLucie Gérard2022-08-0310-0/+30
| | | | | | | | | | | | 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>
* Fix typos in docs and commentsKai Köhne2022-06-152-3/+3
| | | | | | | | | 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>
* Use SPDX license identifiersLucie Gérard2022-05-1649-2194/+98
| | | | | | | | | | | | | 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: Remove unneeded CMake optionsKai Köhne2022-01-249-32/+0
| | | | | | | | | | | | | | | CMAKE_INCLUDE_CURRENT_DIR is not necessary anymore for moc since CMake 3.8: https://cmake.org/cmake/help/latest/release/3.8.html#other-changes CMAKE_AUTORCC should not be used anymore. Instead, we now use qt_add_resources() or similar Enable CMAKE_AUTOUIC only if .ui files are present. Pick-to: 6.3 Task-number: QTBUG-87643 Change-Id: I835e2994cd5dba9918136999499b9077961b616c Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Examples: Remove unneeded target_include_directoriesKai Köhne2021-12-171-4/+0
| | | | | | Pick-to: 6.3 Change-Id: Icd97815ee231c34ad4ea5ab94a73bfc26df7e0ca Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Examples: Fix whitespace issues in CMakeLists.txtKai Köhne2021-12-139-12/+27
| | | | | | Pick-to: 6.3 Change-Id: I8e6dd1f250f8be6016ee4164cb2ab7034cbb1203 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Examples: Remove remaining conversion markers in CMakeLists.txtKai Köhne2021-12-1310-21/+1
| | | | | | Pick-to: 6.3 Change-Id: Ia5d474a3efd6aadbd0ef1537318f2f24e6c24fee Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Prefer unversioned commandsKai Köhne2021-12-133-3/+3
| | | | | | Pick-to: 6.3 Change-Id: Ib32700ab82cf6b271c49e25d12fbad8c9c6bc1d1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Examples: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiomKai Köhne2021-12-109-37/+9
| | | | | | | | | Also consolidate several find_package(Qt6 ...) calls in one call. Task-number: QTBUG-98867 Change-Id: Idfd5e71f46d4489fac7411cbfadb84437a0658f3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove .prev_CMakeLists.txtKai Köhne2021-12-061-18/+0
| | | | | | | | These are left-overs from the initial qmake2cmake conversion. Pick-to: 6.2 Change-Id: Ie15c9ff022ea4566d10c1ba74599de9af83d29a7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* SQL browser example: fix typoTalent Gc2021-09-021-1/+1
| | | | | | | | | Both 'First name' and 'Last name' are two words, therefore the column names should be spelled 'FirstName' and 'LastName'. Fixes: QTBUG-96123 Change-Id: Iaf58442eba0bc5eb63dcde83ecdebdc4a3c658a5 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Raise cmake_minimum_required to VERSION 3.16 in examplesJoerg Bornemann2021-08-179-9/+9
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-95636 Change-Id: I1270b4846d8a23bc3563b6942c0910e095d2be4a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Build examples in isolated sub-builds using ExternalProjectCraig Scott2021-05-261-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Examples are intended to show how to build against an installed Qt. Building them as part of the main build means the way the Qt targets are defined and created are not representative of an end user's build. By building them as separate projects using ExternalProject, we can more closely replicate the intended audience's environment. This should allow us to catch more problems earlier. Having examples built as part of the main build also creates problems with some static builds where a tool built by the main build is needed during configure time. This happens with other repos like qtdeclarative but not (currently) with qtbase. Converting the examples in qtbase to be built using ExternalProject is intended as a demonstrator for how other repos can do similar. Until other repos are converted, they will continue to work as they did before, with examples as part of the main build for non-static builds only. The new build-externally behavior is only supported for non-prefix builds with this change. Prefix builds will continue to use the old non-external method. Support for building examples externally in prefix builds will be a separate change. Task-number: QTBUG-90820 Fixes: QTBUG-91068 Change-Id: I2304329940568dbdb7da18d54d5595ea7d8668bc Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Regenerate examples to set the WIN32_EXECUTABLE propertyAlexandru Croitor2020-10-279-0/+36
| | | | | | | | | As well as the MACOSX_BUNDLE properties as necessary. Task-number: QTBUG-87664 Task-number: QTBUG-86827 Change-Id: I7677449a26d51fa853bd67bab6b3b61afbd2b12f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Regenerate examples to use qt_add_executableAlexandru Croitor2020-10-199-9/+9
| | | | | | Task-number: QTBUG-87661 Change-Id: I0dacfdc97a3fb7d88da85b67800f2c1b084d869b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix some qdoc warnings: typos and qdoc syntaxVolker Hilsheimer2020-09-221-1/+1
| | | | | Change-Id: Idf5c1490330e0f2e5d4bcf920eb03fc9993b3c8a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Derive some item delegates from QStyledItemDelegateLars Knoll2020-09-101-6/+1
| | | | | | | | | | | Address a ### Qt6 comment from change 283008e123e5eacb83869682528b2024186634f8, and start using QStyledItemDelegate in more places, so those get proper look and feel. Change-Id: I39767ba99b7942faada1fba0ac241deb35563b63 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Deprecate the static int based API in QMetaTypeLars Knoll2020-08-241-2/+2
| | | | | | | | | | | | | And remove one of the type id to name mapping that still existed in QMetaType. QMetaTypeInterface can provide that, so there's no need to have a second copy of the data. qMetaTypeTypeInternal() can still map all the names of all builtin types to ids. That functionality is for now still required by moc and can't be removed yet. Change-Id: Ib4f8e9c71e1e7d99d52da9e44477c9a1f1805e57 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Deprecate QVariant::Type uses in QSqlFieldLars Knoll2020-08-151-7/+7
| | | | | | | | Add metaType()/setMetaType() methods to be used instead of the type() methods taking a QVariant::Type. Change-Id: Ieaba35b73f8061cd83288dd6b50d58322db3c7ed Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* CMake: Regenerate examplesAlexandru Croitor2020-07-0911-10/+66
| | | | | | Change-Id: I1c51b10af4e2b26f54740f257164c56a0e2a03ce Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Replace calls to deprecated QEvent accessor functionsShawn Rutledge2020-06-082-2/+2
| | | | | | | Many of these were generated by clazy using the new qevent-accessors check. Change-Id: Ie17af17f50fdc9f47d7859d267c14568cc350fd0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-112-0/+6
|\ | | | | | | Change-Id: Ibee5acec72a1a1769d4bc5f23f56c7dc8d4cf3cb
| * Doc: Let SQL Drill Down example show correct use of qgraphicsitem_castPaul Wicking2020-03-062-0/+6
| | | | | | | | | | | | | | | | | | | | For qgraphicsitem_cast to work correctly with custom items, one must reimplement the type() function for each custom QGraphicsItem subclass. Do that in the example code. Fixes: QTBUG-7357 Change-Id: Ibf221817908355f0347cddfc46747b6955958f5f Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-031-1/+1
|\| | | | | | | Change-Id: If36d96c0fef3de5ab6503977501c55c62a2ecc97
| * Docs: Use Qt::SplitBehavior in preference to QString::SplitBehaviorEdward Welbourne2020-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | The Qt version was added in 5.14 "for use as eventual replacement for QString::SplitBehavior." Move another step closer to that goal. Applied suitable wrapping round various char and string literals, since docs are meant to show best practice. Change-Id: Ie061905fad26f9b4dda3eedba4612704f0a19126 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QComboBox: remove currentIndexChanged(const QString&)Vitaly Fanaskov2020-02-192-2/+2
| | | | | | | | | | | | | | Fixes: QTBUG-81913 Task-number: QTBUG-81845 Change-Id: I8f24b858ce4e35b495440001d7734cc8f169cd5f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | QtSql: remove compat SQL plugin namesChristian Ehrlicher2020-02-131-7/+0
| | | | | | | | | | | | | | | | | | | | | | Remove the compat SQL plugin names (QMYSQL3, QOCI8, QODBC3, QPSQL7) since they are not needed and just confuse the user [ChangeLog][QtSql] The compat plugin names QMYSQL3, QOCI8, QODBC3 and QPSQL7 are no longer available. Change-Id: I6d88f449ef3e18881a6970fb374ba0ab074ef302 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-02-131-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/widgets/graphicsview/boxes/scene.h src/corelib/Qt5CoreMacros.cmake src/corelib/Qt6CoreMacros.cmake src/network/ssl/qsslsocket.cpp src/network/ssl/qsslsocket.h src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp src/testlib/CMakeLists.txt src/testlib/.prev_CMakeLists.txt tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp Disabled building manual tests with CMake for now, because qmake doesn't do it, and it confuses people. Done-With: Alexandru Croitor <alexandru.croitor@qt.io> Done-With: Volker Hilsheimer <volker.hilsheimer@qt.io> Change-Id: I865ae347bd01f4e59f16d007b66d175a52f1f152
| * Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-041-2/+2
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf examples/widgets/widgets/imageviewer/imageviewer.cpp src/corelib/text/qchar.cpp src/corelib/time/qdatetime.cpp Change-Id: I9762f5c4ff650799219729d6aee79ac07ce9024a