summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/code
Commit message (Collapse)AuthorAgeFilesLines
* Teach QByteArrayView how to parse numbersEdward Welbourne2021-08-301-1/+22
| | | | | | | | | | | | Now that we don't need '\0'-termination on the data, this is possible. Moved QByteArray's tests to tst_QByteArrayApiSymmetry and added some more test-cases. [ChangeLog][QtCore][QByteArrayView] Added numeric parsing methods. Change-Id: Ic0df91ecfe5dbf6f008d344dd0464d7927f32273 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QLocale: improve documentation snippetIvan Solovev2021-08-261-9/+11
| | | | | | | | | | | | QString::toDouble() now always uses C locale, so the previous code snippet does not make much sense, as the results do not depend on the selected default locale. The updated snippet uses the default locale, which allows to show the difference between locales. Pick-to: 6.2 Change-Id: I76a00429fa5b75cf109cf45bc25280a7fd427e0f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Replace the example for QFileInfo::setFileLuca Di Sera2021-08-252-10/+20
| | | | | | | | | | | | | | | | The example in the documentation of `QFileInfo::setFile` made no use of `setFile` and only showed a use of `QDir::setCurrent`. The example was replaced with a new example showing how `setFile` changes the file that the information are retrieved from. The old example was moved under the documentation for `QDir::setCurrent` as it shows its working. Fixes: QTBUG-87128 Pick-to: 6.2 6.1 5.15 Change-Id: I8227876cfcb4d582040bda9b4b7f3f7debea1e07 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QRegularExpressionMatch: add a way to know if a capturing group capturedGiuseppe D'Angelo2021-08-251-0/+12
| | | | | | | | | | | | | | | | | | | | | | | Relying on the fact that a given capturing group captured a null string doesn't allow users to distinguish whether a capturing group did not capture anything, or captured a null substring (say, from a null subject string). Perl allows for the distinction: the entries in the @- and @+ arrays are set to values in case there is a capture, but they're undef otherwise. PCRE2 gives us the information already in the results "ovector", but it was simply not exposed to QREM users. So, expose it. [ChangeLog][QtCore][QRegularExpressionMatch] Added the hasCaptured() family of functions to know if a given capturing group has captured something. Change-Id: Ic1320933d4554e2e313c0a680be1b1b9dd95af0b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Improve docs for QFuture continuationsSona Kurazyan2021-08-101-6/+6
| | | | | | | | | | | Replace phrases like "future has been running", "parent" with more precise descriptions. Pick-to: 6.1 6.2 Fixes: QTBUG-95273 Change-Id: Ibd5a464007d41cc437da49ba250b9ea0a46078c6 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QObject: optimize the common case of findChildren(QString())Marc Mutz2021-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Outside tests, all in-tree callers of QObject::findChildren() pass no name to match, and in my experience that is also true for the vast majority of out-of-tree users. Avoid the temporary QString creation in the caller and the repeated QString::isNull() checks in the implementation by overloading findChildren() without a name argument and checking for name.isNull() only once, forking off into separate helper functions. Adjust in-tree callers that used an explicit `QString()` argument in order to pass options, which goes to show that `name` should never have been the first argument of findChilden() in the first place, even though I appreciate the symmetry with findChild() (the use-cases of which, however, are radically different). Change a `findChildren().size() == 0` call found while scanning for findChildren() calls to `!findChild()` as a drive-by. Modernize loops in the various qt_qFindChild{,ren}_helper() overloads to match how the new code looks. [ChangeLog][QtCore][QObject] Added findChildren() overload taking no name (thus optimizing this common case). Change-Id: Ifc56e5438023d079b40c67f11ae274a3e128ad5e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix QStringEncoder code exampleNicolas Fella2021-07-061-1/+1
| | | | | | | | Make sure the right variable is used Pick-to: 6.2 Change-Id: Iec6d8392b320b704423ecbd4434270883fa9fd96 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Use https for links to unicode.orgPaul Wicking2021-06-251-1/+1
| | | | | | | | | | * Change all outbound links in user-facing documentation. * Reflow lines that exceed 100 cols as mandated by clang-format. * Add unicode.org as a global \externalsite. Pick-to: 6.2 6.1 5.15 Change-Id: I2ba1e434aa913e678406d62c2801f1a8b2d9e4f4 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Doc: Fix snippet for QRandomGenerator64 docsPaul Wicking2021-06-141-1/+1
| | | | | | | Pick-to: 6.2 6.1 5.15 Fixes: QTBUG-94347 Change-Id: Iaf007534214cffc83858833e80dad447df9b297a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Fix QVariant documentationKai Köhne2021-06-091-9/+5
| | | | | | | | | | Update documentation to not reference API that is obsolete in Qt 6. Also fix documentation for changed behavior (isNull()), and fix snippets. Pick-to: 6.1 6.2 Change-Id: I526efeff63d907bbadd5e8a539ccf237cb992125 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Make QLocale documentation more honestEdward Welbourne2021-04-151-4/+0
| | | | | | | | | | | | | | Documented the fall-back process by which QLocale selects an actual locale based on what it is asked for. The prior documentation was wrong. In the process, removed some out-of-date claims about QString's toInt() and toDouble() caring about the default locale; and caught a few more cases (in \internal docs) of country -> territory. Fixes: QTBUG-90962 Change-Id: I5e7cfa66443c9335a71fb2048c3f2ebf7af64573 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add example to QObjectBindableProperty change handler docsAndreas Buhr2021-03-251-0/+41
| | | | | | | | | QObjectBindableProperty has a callback, which is called whenever the value changes. This patch adds an example showing this. Task-number: QTBUG-90511 Change-Id: I56c0bce15af8121159630b5c0922c287c15b7618 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* The conditional statement is missing parenthesesZhang Yong2021-03-111-1/+1
| | | | | | | Add a ')' to the judgment statement. Change-Id: Iadfdfb7643bc5224cb3029a2abb42c3c14982eef Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QtGlobal docs: code tidiesZhang Yong2021-03-101-4/+2
| | | | | | | Reformat a couple of examples correctly. Change-Id: I2f0897267b4e3c4d7d2925f2d20cc45687278b0b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Improve docs for QFuture::then() with contextSona Kurazyan2021-02-251-0/+11
| | | | | | | | | | | | | Be more precise about attaching a continuation with the default (QtFuture::Launch::Sync) launch policy after a continuation with context. Pick-to: 6.1 Change-Id: I5b80063df2443e5742033864ba012bf34ed4cdf7 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Revert "Remove the qmake project files" for snippetsNico Vertriest2021-02-122-0/+9
| | | | | | | | | | | This reverts a limited part of commit ad2da2d27a590333fc89a56fc58700a09c3017b3 that deleted .pro files for snippets compilation. Some .pro files which contain snippets used in the documentation itself should be restored. Task-number: QTBUG-90483 Change-Id: I1b03833c8ff17b5fca43a5b6c5417e8545b1711b Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QBindable: add initial documentationFabian Kosmale2021-01-271-0/+12
| | | | | | Change-Id: I43681093c8819289037c76bd9c05b88a6da8311b Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Update QMutexLocker documentationLars Knoll2021-01-261-1/+1
| | | | | | | | | And add an entry about the API changes to qt6-changed.qdoc. Pick-to: 6.0 Task-number: QTBUG-89429 Change-Id: I146574acd3e4aa5ed6f1629fc68888f009472f19 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove the qmake project filesJoerg Bornemann2021-01-072-9/+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>
* QRegularExpression: mention raw string literal in the docsAhmad Samir2020-12-281-0/+10
| | | | | | | | | | | | | | Raw string literals (since C++11 according to [1]), make writing/reading regex patterns easier, since one can just use e.g. "\w\d" without having to escape those backslashes e.g. "\\w\\d"; this is especially useful with longer/more complex regex patterns. [1] https://en.cppreference.com/w/cpp/language/string_literal Pick-to: 5.15 6.0 Change-Id: I119f9566d27222b915af931ee7e13e064baede61 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* Bindable property with initializationIvan Solovev2020-12-171-0/+39
| | | | | | | | | | Implement Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS and Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS macros. They allow to directly initialize the property member. Task-number: QTBUG-85520 Change-Id: I76541d6785bbbf27976b9f0b865fb45be1e9beee Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add sections about std containers and algorithmsOle-Morten Duesund2020-12-171-0/+21
| | | | | | | | | | | Add section comparing Qt containers and std containers. Add snippets showing use of std algorithms with Qt containers. Task-number: QTBUG-86584 Pick-to: 6.0 Change-Id: I1133a5214a5acd086c37658ca11ab205a19a489b Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Move QObjectBindableProperty documentation into snippet fileFabian Kosmale2020-12-151-0/+70
| | | | | | | | | | | The \Q_OBJECT macro has been removed but using Q_OBJECT in the file would erroneously trigger automoc. Avoid the issue by moving the snippet into its own file. Task-number: QTBUG-89505 Pick-to: 6.0 Change-Id: I6630ff4bfcbf33eae348ac3d92aae1878dc573ea Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add support of invoking QFuture continuations in a given contextSona Kurazyan2020-12-111-0/+31
| | | | | | | | | | | | Added overloads of .then()/.onFailed()/.onCanceled() which take a pointer of a context object, and invoke the continuations in the object's thread. Task-number: QTBUG-86794 Change-Id: I0f3cbb0500695673fc4087af5d4b96b416e3e1ce Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* QByteArray: update documentationIvan Solovev2020-12-051-13/+0
| | | | | | | | | | | | | The QByteArray documentation is extended to align with QList and QString regarding common wording and ideas: - Extend general class description - Revise description of several methods - Wrap descriptions at 80 characters Pick-to: 6.0 Task-number: QTBUG-87962 Change-Id: Ie9e8ef47a85d0867c2fa63889a60cafbe76ee47a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Document BINDABLE attribute for Q_PROPERTY macroTopi Reinio2020-11-301-0/+1
| | | | | | | | Pick-to: 6.0 Fixes: QTBUG-87036 Change-Id: Ia6067d887b9b697dbcb8e02bce5a560a8ac5eaf3 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QHash: support std::hash as hashing functionGiuseppe D'Angelo2020-11-301-0/+10
| | | | | | | | | | | | | | | | | | | | In addition (and as a fallback) from requiring qHash, add support for std::hash specializations. This catches two birds with one stone: 1) users of Qt can simply specialize std::hash for their datatypes, and use them in both QHash and stdlib unordered associative containers; 2) we get QHash support for any (stdlib) datatype that is hashable without having to overload qHash for them. [ChangeLog][QtCore][QHash] QHash, QMultiHash and QSet now support for key types anything that can be hashed via std::hash, instead of always requiring a qHash() overload. Change-Id: Ib5ecba86e4b376d318389500bd24883ac6534c5f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-11-301-1/+1
| | | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this patch should have no impact on users. Pick-to: 6.0 Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Clean up QCollator's documentation and tell fewer liesEdward Welbourne2020-11-271-0/+58
| | | | | | | | | | | | | | | | | | | | Its collation strategy can't be passed to the constructor, so describing it as initialized with a strategy was misleading. The "Linux without ICU" disclaimer was poorly phrased and only mentioned on one of the options; it actually applies to all. The operator() was marked internal, but the class doc's claim that QCollator can be used with std::sort() relies on it being callable. Moved option descriptions to the getters and filled in the missing ones. Mention the default in all cases. Added a minimal illustration of how to use a QCollator. Fixes: QTBUG-72233 Change-Id: Ifa846eca05e8e42aaa08c4947a59a82d8a8a79bc Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Improve *_CAST_FROM_ASCII documentationKai Koehne2020-11-271-6/+0
| | | | | | Pick-to: 5.15 6.0 Change-Id: Iba73c0a38e2c4add740aab20036aa39c56eb4d98 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Remove deprecated algorithms from documentationMarcel Krems2020-11-261-300/+3
| | | | | Change-Id: Ie1eff48696c62ed23fedda1a9e711aeb8264432f Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Remove documentation for removed qHash overloadVolker Hilsheimer2020-10-291-4/+0
| | | | | | | | QPair is an alias to std::pair in Qt 6, so no need for two qHash functions. Also remove note and snippet from std::pair overload documentation. Change-Id: Ica8f6961af1eac493e909ad06fe46f8f68542bc5 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Scrub QByteArray/QByteArrayView documentationKarsten Heimrich2020-10-291-7/+7
| | | | | | Fixes: QTBUG-86555 Change-Id: I3221e0de10e692ca767eeb69daa82da55b93e395 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix QList snippets to use qsizetype instead of intAndrei Golubev2020-10-281-3/+3
| | | | | | Task-number: QTBUG-86553 Change-Id: I37e9607e014deaeebfa9fddf2e49a04ee2194cce Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Store std::exception_ptr in QUnhandledExceptionSona Kurazyan2020-10-261-0/+16
| | | | | | | | | | | | | | | | For historical reasons Qt Concurrent reports QUnhandledException in case if an exception that is not derived from QException is thrown from a worker thread. Changing this behavior may not be a good idea, since the existing user code may rely on it. Changed QUnhandledException to wrap the std::exception_ptr to the actual exception, so that the users can obtain the information about the thrown exception if needed. [ChangeLog][QtCore][QUnhandledException] Improved QUnhandledException to store the std::exception_ptr to the actual exception thrown from a QtCocnurrent worker thread. Change-Id: I30e7c1d3e01aff6e1ed9938c421da0a888f12066 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* doc: fix description in doc_src_containers.cppHiweed Mandriva2020-10-251-1/+1
| | | | | | Change-Id: Iade0a8ea7fc51df1ee624c4059f93d470abb9b08 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: <hiweedmandriva@163.com>
* 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>
* QList docs: remove some QVector->QList leftoversGiuseppe D'Angelo2020-10-191-17/+0
| | | | | Change-Id: I2a7b5ef07ddb07a261110914088b9942801a3c25 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-071-1/+1
| | | | | | | | | 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>
* QREMatchIterator: add support for range-based forGiuseppe D'Angelo2020-09-301-0/+9
| | | | | | | | | | | | | Add begin()/end() on QRegularExpressionMatchIterator, making iterators over an iterator (like directory_iterator). [ChangeLog][QtCore][QRegularExpression] The iterator object (QRegularExpressionMatchIterator) returned by a global match is now usable in a range-based for loop. Change-Id: If3d31bd2e84e7d1fb626a0b3d2745914dff03e39 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Fix incorrectly placed closing bracket in Q_PROPERTY codeKai Koehne2020-09-301-2/+2
| | | | | | | | Amends cb3152086c61e7c Pick-to: 5.15 Change-Id: I1615a686a53da7ca5ae454565283c9e83399d947 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Remove traces of QObject::trUtf8 from documentationVolker Hilsheimer2020-09-251-2/+0
| | | | | | | | ... and from the duplicated Q_DECLARE_TR_FUNCTION macro for QXmlStream. We expect source code to be utf8 encoded in Qt 6, so the function is gone. Change-Id: Ie25329a54e709dc92a22893ad5ab023852300d81 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Fix some qdoc warnings from QByteArrayVolker Hilsheimer2020-09-231-1/+1
| | | | | | | | A snippet bug, and removed overloads. Change-Id: I82aee3627ba1a4e75e392b28d8ec72d470c395db Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Documentation: purge QSet and QHash members that no longer existVolker Hilsheimer2020-09-231-9/+0
| | | | | | | | | | | | QMutableSet/HashIterator can not walk backwards, neither can the STL iterator. When function documentation was shared with other iterator types, move it into separate section to avoid linking to incorrect see-alsos. Remove or fix other member function documentation that had errors, e.g. in parameter types after move to qsizetype. Change-Id: Ic7f97a295eff63ee748998b10f08a160706fa650 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Q(Any|Utf8)StringView: move array size deduction feature to fromArrayMårten Nordheim2020-09-183-11/+2
| | | | | | | | | | | | | The constructor taking an array literal will now stop at the first null-terminator encountered. And fromArray is introduced which only supports array literals. Constructs a view of the full size. Explicit so it shouldn't be surprising. Change-Id: I1497c33a5c12453a95e87c990abe6335b2817081 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QByteArrayView: move array size deduction feature to fromArrayMårten Nordheim2020-09-181-7/+0
| | | | | | | | | | | | | | | | 1. Make the ctor unable to construct a QByteArrayView from array literals other than 'char'. With the new behavior it would either be (very likely) unintended to pass e.g. a std::byte array to the ctor. And it would be confusing because you would get different sizes based on signed-ness. 2. Introduce fromArray Only supports array literals. Constructs a view of the full size. Explicit so it shouldn't be surprising. Change-Id: Ifdb55eb21057dfe7053b2561bd81e2c9825e9bc6 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Introduce QProcess::startCommand(QString, OpenMode)Joerg Bornemann2020-09-101-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The removal of the QProcess::start(QString, OpenMode) leads to more porting work than anticipated. A call like QProcess p; p.start(cmdline); must be transformed in the following cumbersome way: QProcess p; QStringList args = QProcess::splitCommand(cmdline); QString program = args.takeFirst(); p.start(program, args); This patch revives QProcess::start(QString, OpenMode) and renames it to QProcess::startCommand. This is still source-incompatible, but the transformation is much simpler: QProcess p; p.startCommand(cmdline); [ChangeLog][QtCore][QProcess] Added QProcess::startCommand(QString, OpenMode) as replacement for the removed QProcess::start(QString, OpenMode). Change-Id: I5499bbb39a025e115042c43a4cc63affddae585c Reviewed-by: hjk <hjk@qt.io>
* Doc: clean up the QProcess::setChildProcessModifier exampleThiago Macieira2020-09-101-3/+3
| | | | | | | | | | - Use nullptr instead of 0 - Pass directory to chroot that is not in /etc - Set umask to a sensible value (0 is insecure) Change-Id: I1dba29bc0f454df09ca1fffd161801257f9ccb3c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QProcess/Unix: introduce setChildProcessModifier()Thiago Macieira2020-09-081-20/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][Source-Incompatible Changes] QProcess::setupChildProcess() was removed. To execute code in a child process, use QProcess::setChildProcessModifier() [ChangeLog][QtCore][QProcess] Added setChildProcessModifier() function with which one can provide code to be run in the Unix child process between fork() and execve(). With this function, it is no longer necessary to derive from QProcess in order to execute actions in the child process. Another reason is that we can tell whether the std::function carries a valid target much more easily than we can tell whether QProcess was overridden. The setupChildProcess() virtual function does not need to be marked final, since no overrider could ever return an inaccessible private class. This also makes sure the error presented to the user is about the return type, not about attempting to override a final. Clang: error: virtual function 'f' has a different return type ('void') than the function it overrides (which has return type 'QProcess::Use_setChildProcessModifier_Instead') GCC: error: conflicting return type specified for 'virtual void MyProcess::setupChildProcess()' note: overridden function is 'virtual QProcess::Use_setChildProcessModifier_Instead QProcess::setupChildProcess()' ICC: error: return type is neither identical to nor covariant with return type "QProcess::Use_setChildProcessModifier_Instead" of overridden virtual function "QProcess::setupChildProcess" MSVC is not relevant since it doesn't compile to Unix. Change-Id: Ia8b65350cd5d49debca9fffd15f801161363aea7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Clean up the QByteArray API and implementationLars Knoll2020-09-031-1/+1
| | | | | | | | | | | | | | Add overloads using a QByteArrayView where it makes sense, and call those inline from the other overloads. Remove overloads that are not required anymore (due to implicit conversion of a const char * to a QByteArrayView). Guard all implementations against passing this object to them. Change-Id: I930156f8b05ce72c32cb8201c70513f2e6e19d3e Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>