summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* MetaObjectBuilder: add support for Virtual and OverrideDmitrii Akshintsev45 hours2-0/+56
| | | | | | | | | Adapt MetaObjectBuilder to newly added property attributes. Task-number: QTBUG-98320 Change-Id: Ife1d388fd75939c730055746426dbf5459e170d8 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QMetaObject: Include a class def's hash in the meta objectOlivier De Cannière45 hours6-4/+39
| | | | | | | | | | | | | | The hash has the following format <hash_revision>$<hash_b64>, where hash_revision is an integer and hash_b64 is the base64 encoding of the hash. MetaObjects built using QMetaObjectBuilder do not yet support the hash. That will need to be added at a later point. Task-number: QTBUG-142186 Change-Id: Ifafc7df2202decf48e8a1a45e652c2f61c5cea64 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QRM(A): Allow initializing a raw nullptr with an objectVolker Hilsheimer2 days1-9/+25
| | | | | | | | | | | | The ownership mess is not a problem if there's nothing stored at the position yet, and it allows gradually populating a row of raw object pointers. Hook newly inserted objects up to the autoConnectProperties mechanism. Add test case. Change-Id: Ie029a2a358e6a1ed5f24869039be9c2ad542dff9 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Short live QtPrivate::fuzzyCompare()!Marc Mutz2 days4-19/+29
| | | | | | | | | | | | | | | | | | | | | Extract Method QtPrivate::fuzzyCompare() from the qFuzzyCompare() implementations that correctly validate the preconditions of the public qFuzzyCompare() (QMarginsF, QSizeF, QPointF), so we can more easily apply the same technique to other in-tree callers. In the process, replace comparison to literal 0.0 with calls to qIsNull() so we're a) insulated from -Wfloat-compare and b) have a customization point to extend to types other than float and double. Amends: - 473d06970d224b202e7a8ee8feaa2a2d98d5b257 (QMarginsF) - fa0d77e290f5ccb5afa7d02716f8726aa6b810e6 (QPointF) - 3ca9877f8cae41e1b1cb3c72d4a7872d97fb8254 (QSizeF) Pick-to: 6.10 6.8 6.5 Task-number: QTBUG-142020 Change-Id: Ib7ec06822f8006771a1c3a96145e98d574a29fbe Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Implement a backend of QIORing for WindowsMårten Nordheim2 days6-19/+851
| | | | | | | | | | | | | | | | | | | | | Using the IORing API on Windows to provide asynchronous I/O operations. Some parts supplemented by using some blocking API where we don't have an option (yet). Currently that just includes the 'stat'/size operation as well as Open and Close. Though with Close we schedule a flush and close the handle ourselves once the callback is invoked. The API is quite limited so far, but sufficient for what we have now. The implementation can be extended later as needed. The Vectored I/O operations are not actually vectored unfortunately, the Windows API requires page-aligned memory and sector-aligned file offsets, which makes it really impractical to provide generically. For a very limited time: limit the configure options to Windows 11. Task-number: QTBUG-136763 Change-Id: Iee57a23358a71ab6bfd007ff15b760b65ea76406 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QRM: implement itemData in terms of multiDataVolker Hilsheimer3 days1-61/+23
| | | | | | | | | | | | | | No need to duplicate the entire logic. The only overhead is that we have to create a QModelRoleDataSpan for all roles, except our internal roles. Using a QVarLengthArray makes that cheap. The only special case we keep is for items that are backed by a type that is directly convertible to a QMap<int, QVariant>. This comes with a small overhead for acessing the element at runtime. Pick-to: 6.10 Change-Id: I33f86d231bef9036a7e83584d1bf013f129b8075 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* QRM: extract role check into helper and deduplicate reading codeVolker Hilsheimer3 days1-46/+47
| | | | | | | Amends e22cd01076e795ed853b0536605d3bb205587d78. Change-Id: If463efce1006a62c43bd85a7f1f9d913f806ad94 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* QRMA: clarify performance implications of accessing objectsVolker Hilsheimer3 days1-5/+3
| | | | | | | | | There is no performance difference between accessing mutable or const adapters, but in either case we are going to have to copy the value, as we go through QRM::data() to get a QVariant, which then stores a copy. Change-Id: I1712c3d87002b3650dcfee2900b0d00357695f11 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* QRM: add missing \since 6.11 to the autoConnectPolicy propertyVolker Hilsheimer3 days1-0/+1
| | | | | | | | The enum was already tagged, but the property was forgotten in f9bb6c8d900205375c70bb33f359ce0250212460. Change-Id: If52b4929f4548ba4603d8a565917afe624110522 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* mimetypes: keep track of whether extra mimetype existsDavid Edmundson3 days1-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | In the BinaryProvider backend each mimetype optionally has additional data in an XML file. For each mimetype this data is cached in m_mimetypeExtra. However, if a mimetype does not have any additional data this code returns early without caching anything. This causes an additional access and open call for every mimetype for each lookup of globPatterns. Given we have typically have hundreds of mimetypes and applications may need to look up thousands of files this becomes a very hot path that should not be making system calls after the first time. This patch should improve performance but not make any behavioural changes. All callers treat an invalid iterator the same as the default MimeTypeExtraMap. Change-Id: Ibe415ec4e70198655d7a6ad610664fe54e3b9215 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <david.faure@kdab.com>
* QMetaProperty: Introduce VIRTUAL, OVERRIDE attributesDmitrii Akshintsev3 days5-5/+46
| | | | | | | | | | [ChangeLog][QML] VIRTUAL and OVERRIDE attributes will be used for the expanded override semantics in QML. See QTBUG-98320 for the details. Task-number: QTBUG-98320 Change-Id: I56826a6b9158c0beeb58ad1564a58c22f15027bf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QFlatMap: restore NRVO in do_take()Marc Mutz3 days1-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The usual problem, the usual solution... At the time of construction of the return object it is known which of the two variables to construct, so NRVO would be permissible, but most compilers don't enable it because the structure isn't T result; // first (non-trivial) variable declared // must be a function's top-level scope ~~~ return result; // only one // or else all return statements are token-by-token the same The usual fix is to wrap the tail part of the function (= the one that constructs a T and returns it, as opposed to the part that returns temporaries) in an IILE expression: the lambda then _has_ said structure, so is NRVO'ed and the call to the lambda is RVO'ed in the caller. Invert the polarity of the if statement in order to keep the meat of the function's git history intact. Amends deddafe0a6a32aa438cc36c7dcfae8c323274487. Pick-to: 6.10 6.8 Change-Id: I3f22665daca320be283e4088cf1062f115cd49e4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QFlatMap: avoid mixing rvalues and lvalues in the ternary operatorMarc Mutz3 days1-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As pointed out by Coverity elsewhere¹, use of a ternary in return statements can sometimes lead to superfluous copies, because lvalues are forced to materialize an rvalue when they appear together with an rvalue in the resp. other leg. I'm pretty sure that's the case here, because it.value(), while being an lvalue, returns a reference-to-const, so isn't a local object that would enjoy a transparent move, anyway. But by rewriting the code as an if statement instead of a ternary expression, the reader doesn't need to understand the issue (if they are aware of it in the first place): the 'return T()' is definitely RVO'ed, and the return 'it.value()' definitely calls the copy constructor. As the result isn't worse in executable speed, but easier to reason about, do the rewrite. Amends deddafe0a6a32aa438cc36c7dcfae8c323274487 for the original value() and 64bc6509c350c5750c6432a0ae6876f4bfb97cd0 for the is_transparent case. ¹ e.g. cd96362492375c50a9d0614b829c51eb6597d713 Pick-to: 6.10 6.8 Change-Id: Id8b3bc31e0f38ea961cfe6169e68b1b4744c799f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Document QFuture::cancelChain() limitationsIvan Solovev4 days2-0/+38
| | | | | | | | | | | Explicitly mention that cancelChain() cannot cancel a nested QFuture once the related computation has started. The user needs to explicitly capture and cancel the nested future instead. Task-number: QTBUG-140786 Pick-to: 6.10 Change-Id: Icc629071659a5833f7e9b55c640fd9920b6bd8a9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QRMA: hook inserted objects up to auto-connectVolker Hilsheimer4 days3-8/+35
| | | | | | | | | | | | | | | | Auto-connecting properties is enabled in models where all item data is backed by the same QObject subclass. When assigning a new row, an entire branch of rows in a tree, or assigning a fresh range as the children of a row, then the new items need to be connected. Some of these items might be nullptr, in which case we have so far stopped the connection loop early (by returning false from the helpers). Fix that to only stop early if a connection failed (i.e. if role names and properties in the objects are not aligned), but continue if we encounter a nullptr entry in the item data. Change-Id: I2c4b5e5beedc7b38c40ee459c2e0437568b9b087 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Add QRangeModelAdapter: C++-style access to the range while talking QAIMVolker Hilsheimer4 days11-17/+3436
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a QRangeModel represents a C++ range, then the C++ range must no longer be modified directly, as clients of the model won't be notified about data or structural changes. Ignoring this (documented) warning might end up with views not presenting the data correctly, or even result in crashes as the model cannot update QPersistentModelIndex instances. Modifying the range through the QAbstractItemModel API is ok, but clumsy, as it requires dealing with QModelIndex and QVariant for basic operations. QRangeModelAdapter provides an easy, type safe, and data-structure aware API for reading and also modifying a range that a QRangeModel operates on. This includes an interator API for rows, and - unless the range is a list - columns. Dereferencing row iterators yields a row reference type from which a row can be accessed for reading, or that a new row can be assigned to. Dereferencing a const column iterator yields an item; dereferencing a mutable column iterator yields a reference type that a new item value can be assigned to. Since QRangeModel itself is not a template class (so we don't know the type of the range anymore once it has been created), we have to create the adapter from the range (and optional protocol), which then implicitly creates the model. Constructing the adapter implicitly constructs the model, which is owned by the adapter. QRangeModelAdapter is a value type, using std::shared_ptr for the model so that all copies of the adapter operate on the same model. To be able to set entire multi-role objects as items, introduce a new Qt::ItemDataRole enum value, Qt::RangeModelAdapterRole. This is very similar to Qt::RangeModelDataRole, but QML has specific requirements that QRangeModelAdapter doesn't have, and we want to pass items back and forth without modifying their value category - ie. an item that is a shared_ptr<Object> is not useful for QML (which needs an Object *), but a C++ user expects to get a shared_ptr<Object> from a call to at(), and also expects to be able to set such an item. The code has room for de-duplicating some logic in follow-up commits. [ChangeLog][Core] Added QRangeModelAdapter for C++-style access to a range used in a QRangeModel, while implementing QAbstractItemModel protocol. Change-Id: I3f2f94cb51b850100590fbe2c9a7c9dabbec59bd Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Core: Deprecate QVariant{Ref|ConstPointer|Pointer} only in 6.15Ulf Hermann4 days2-10/+10
| | | | | | | | Amends commit 9dec893bf64f36fa339a1226a77bf938c5603587 Task-number: QTBUG-140181 Change-Id: If2fdb72b901ef7c577e7a46266f35c749a6958cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Core: Restore export of Q{Associative|Sequential}IterableUlf Hermann4 days5-44/+72
| | | | | | | | | | | | | | | gcc < 13 doesn't accept both visibility and deprecation attributes on the same class. Therefore omit the deprecation attribute there. We need to retain the export attribute because MSVC also exports the inline methods. Also, push the deprecations forward to 6.15. We can't deprecate the iterables in 6.13. Amends commit 8b246f262346ded7860ad76fdedc8d59f037a374. Change-Id: I333a4c05baf12a75dc93e1dbb08dabbc23ccf468 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRM: don't use std::applyVolker Hilsheimer4 days1-8/+14
| | | | | | | | | | | | | | std::apply only works for types compatible with std::get, but it doesn't consider get() in terms of ADL. So we can't use it to call a function on each element in a tuple-like row type with get() in its namespace. Instead, we roll our own helper template using an index sequence + ADL-compatible get() usage. Amends f9bb6c8d900205375c70bb33f359ce0250212460 Change-Id: Ic0858f95f1dcc6333b09336189f5adde7309ef75 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Remove operator[] from meta-association iteratorsUlf Hermann4 days3-23/+0
| | | | | | | | Most of them are not random access and operator[] makes no sense then. Amends commit 8d359d61c16641d523e4189a7d473b6126b11011. Change-Id: I724aaf98e14114d0fd1cb5bce5fdc2ed4690dae0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QByteArray: move percentDecoded() to the correct section in removed_apiAhmad Samir5 days1-7/+7
| | | | | | | | | Found in API hash tag review. Amends 8f4adf0948937ff2f0139bb676d064f2b26febc4. Change-Id: I8c32c4fc2e4c9cd8e32f9d029800364432e5c7dd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Core: Add operator[] to our meta-iteratorsUlf Hermann6 days5-0/+44
| | | | | | | | It's required by std::random_access_iterator_tag. Fixes: QTBUG-140181 Change-Id: Icb9c72395ea5c1a26069ac66d969c98fb9a58407 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Core: Deprecate QVariant{Ref|ConstPointer|Pointer}Ulf Hermann6 days2-8/+29
| | | | | | | | | They cannot be fixed and have to be replaced by QVariant::{ConstReference|Reference|ConstPointer|Pointer}. Task-number: QTBUG-140181 Change-Id: I0b1f5799565a4965eef16bd6c88e6868c748f493 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Core: Deprecate Q{Associative|Sequential}IterableUlf Hermann6 days5-64/+155
| | | | | | | | | They cannot be fixed and have to be replaced by QMeta{Association|Sequence}::Iterable. Task-number: QTBUG-140181 Change-Id: Ic62dcfecb576f8cd11902a245a2ac5422f5011d3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Core: Provide non-broken metacontainer iterablesUlf Hermann6 days12-86/+1194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QSequentialIterable and QAssociativeIterable are incapable of providing operator[] on their iterators because the references used by those iterators are not actually stable when the iterator is modified. The only way to fix this in a binary compatible way is to provide a complete set of new iterables and iterators. These are implemented in qmeta{association|sequence}.h and exposed through QMeta{Association|Sequence}::Iterable. In order to give users a convenient way to include those, we instruct syncqt to regard qmeta{association|sequence}.h as header to use in order to provide QMetaSequence and QMetaAssociation. These headers are the natural choice anyway. qmetacontainer.h still has to hold the (now incomplete) declarations for QMetaSequence and QMetaAssociation so that we remain source compatible. The new iterables offer a more consistent set of accessor methods and deprecate some of the old accessor methods. It makes little sense to add or remove a value from/to an iterable at an unspecified place. The new sequential iterable offers the more familiar append/prepend and removeFirst/removeLast methods. Finally, the new iterables warn when taking a slow code path that synthesizes operations not avaible on the actual container using iterators. There generally is a reason for those operations to not be available and we shouldn't second-guess the choices made by the authors of the container. For now, we have to keep those code paths intact to remain compatible with QSequentialIterable and QAssociativeIterable. Task-number: QTBUG-140181 Change-Id: I2f4c32716951fa023ae1fb8028d1a87e4c85c3a0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* JNI: document the JObject type, remove TECH_PREVIEW_API tagsVolker Hilsheimer6 days4-9/+190
| | | | | | | | | | | | | The JObject(Base) types have been around for a while now, and are heavily used in Qt code. We can be confident that they work. Add documentation for the JObject helper type. The JObjectBase type has no public usage, it's just a technicality that takes care of type-independent implementations. Document it as internal. Fixes: QTBUG-141156 Change-Id: Ia6567e10dc57a022beb3d3aff0420b2b9b9f6b2f Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Silence missing deployment qtpaths warning on non-Windows platformsAlexandru Croitor6 days1-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | In 36cee508a088e1570e1d89e060c3ccd14585d3f1 we started showing a warning when a qtpaths executable or shell wrapper was not found in the qt prefix. This warning would appear on all platforms equally, even though in the end the __QT_DEPLOY_TARGET_QT_PATHS_PATH variable is only used when deploying a Windows app using windeployqt. An example of when the warning appears is with a yocto SDK, where the target qt prefix does not contain a qtpaths executable. Make sure the warning is only shown when targeting the Windows platform. I considered searching for candidate qtpaths also in the host prefix when available, but such a qtpaths most likely will not show information for the target platform, and thus deploy the wrong libraries. Amends 36cee508a088e1570e1d89e060c3ccd14585d3f1 Pick-to: 6.8 6.10 Fixes: QTBUG-142336 Change-Id: If3df1f61cf1550b7271268c71a5826ed673a62fa Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QList: add missing Q_CHECK_PTR in the constructors and in reserve()Thiago Macieira6 days1-5/+18
| | | | | | | | | | | | | Because QArrayDataPointer doesn't. QString and QByteArray constructors do this. resize() already has the macro because it uses QArrayDataPointer::reallocateAndGrow(). squeeze() is untestable. Pick-to: 6.10 6.8 Fixes: QTBUG-142345 Change-Id: I8e7898aed09364f20d1efffdc7ed70a2c152005c Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Add QIORing backend for QRandomAccessAsyncFileMårten Nordheim6 days4-0/+463
| | | | | | | | | | | | | | | | This adds a backend for QRandomAccessAsyncFile to use the recently introduced QIORing. Since all uses of of QRandomAccessAsyncFile expects signals to be emitted after returning control to the caller, and QIORing may complete anything synchronously, we emit signals only after returning to the event loop. This could probably be optimized later to be a direct emission when it's not technically needed, but is not a priority right now. Task-number: QTBUG-136763 Change-Id: I8acfa7f716e5625da498cc4b6fbe493ebd783f99 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QIORing/Linux: handle >2gib reads&writesMårten Nordheim6 days2-42/+173
| | | | | | | | | | | | | | | | | Linux internally truncates any read and write at a limit of 'MAX_RW_COUNT', which is slightly less than 2 GiB, for a few reasons. We will work around it by reading or writing some segments at a time, re-issuing another read/write operation whenever one completes until completed, EOF if reading, or an error occurs. Note that this MAX_RW_COUNT also applies to readv and writev, which means we would need a similar mechanism there to handle this. This is to be done in a follow-up. Task-number: QTBUG-136763 Change-Id: I9bcb75587ae5e84cb80ea3950a569f60c4906617 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Introduce QIORing to abstract io_uring on LinuxMårten Nordheim6 days5-0/+1204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Somewhat low level code, intended as a low level abstraction. The QIORing interface would also be used for Windows' IORing, developed at the same time as the io_uring version. There is some shared code and helper functions, but a lot of the code in some way touch the platform specifics, so without yet more abstractions quite some code is left as unique. The fiveGiBReadWrite test case is currently EXPECT_FAIL because of the MAX_RW_COUNT limit on Linux (and its inability to report >2GiB results). Either we have to document this in the public-facing parts, or we need to work around / iron over the issue. To be done in a follow-up patch. We only ever notify the kernel of the work to be done after returning to the event loop, unless the ring is full. Then we notify the kernel right away in hopes it will manage to clear up some space to queue more. We, ourselves, are not actually limited by the kernel ring buffers as we keep a queue (in the form of a std::list) of pending tasks. The reason why it's a std::list is that it guarantees stable references, and that lets us use the pointer-to-task as the 'user_data' of the submitted work, so we can easily access the task again when the kernel adds it to the completion queue. Task-number: QTBUG-136763 Change-Id: I9cb80a2b96a49f2a557bef3b0ad6d367d76f5ab8 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QRangeModel: fix two more unqualified wrapped_t usesMarc Mutz7 days1-3/+7
| | | | | | | | | One amending 4207a1664d6901322c19edddad95ec53bdd2a017, the other amending c1341b7557ce52c681618c77c17687623fc0f3b2. Pick-to: 6.10 Change-Id: Ib5db1a0728e359499a1a53d12a8157df7c3569e6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QRM: Only detect rotate if the iterator models at least forward_iteratorVolker Hilsheimer7 days1-2/+4
| | | | | | | | Amends dc2521c156fb694f379104191e540a57371b41f0 Change-Id: I2a1e7da5aa5b7015ced25fcc49c1e66275db4bc8 Reviewed-by: Nils Petter Skålerud <nils.petter.skalerud@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* QRangeModel: don't refer to wrapped_t with its unqualified nameMarc Mutz8 days1-21/+28
| | | | | | | | | | | | | | | | This enables ADL, which might end up picking up unrelated templates from user namespaces, and, due to QtPrivate::wrapped_t in qanystringview.h, breaks TUs (such as -unity-build), where both headers are included. Amends the addition of the feature, somewhere before the bdbe4c8858e378d5b90bed799b67304d452fc0da rename to QRangeModel. Task-number: QTBUG-142184 Fixes: QTBUG-142182 Pick-to: 6.10 Change-Id: Id41ec4bca1059ab525c5c6bfad052d83572e1d91 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QFlatMap: use QtPrivate::ArrowProxy instead of own mock_pointerMarc Mutz9 days1-26/+3
| | | | | | | | | | | | .. to use a common vocabulary, and share code. Amends 900d4bd29f30effbb5dbb0efa96886af03839a15, which introduced ArrowProxy for use in QKeyValueIterator and QDomNodeList::It. This is just another user I've overlooked up to now. Pick-to: 6.10 6.8 Change-Id: I2c1eecc75a209ce552ddd1fdebfc6da784c83a00 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QFlatMap: use QT_DEFINED_TAG for OrderedUniqueRangeMarc Mutz9 days1-2/+2
| | | | | | | | | | | | It applies extra safety measures for such tag types. Amends 74a87a329498422db0dea3e469fb84704accbb2b, which ought to have ported this tag struct, too. Pick-to: 6.10 6.8 Change-Id: Idd2c116d1045f4218ec74c52f8ddf00324abd59c Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* JNI: Allow clients to opt into their own exception handlingVolker Hilsheimer10 days5-239/+432
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Detect whether the return type of a call is similar to std::expected. This indicates that the caller wants to handle exceptions explicitly, so in case of error, we pass it through the the std::expected-like value. We still clear the exception state. The caller is responsible for freeing the jthrowable local reference. For this to work, we have to propagate errors through to the outer-most function. This includes allowing QJniObject to create QJniEnvironment instances that don't implicitly return a clean environment in the destructor. As long as we can call checkAndClearExceptions() in the public functions (unless the caller opts in), this should not break any existing code that expects QJniObject to implicitly clear exceptions. Add tests for all overloads to make sure that exceptions (from wrong class or method names, and thrown in methods) are caught. Add "Impl" helpers that do not handle exceptions if instantiated accordingly, and call those if we have to maintain compatibility in public functions while also enabling opt-in handling for modern APIs. Add tests that show that we can now handle exceptions ourselves for all public QJniObject APIs. If possible, we build the test with C++23 so that we can use std::expected; otherwise, try to use tl::expected by downloading the header-only implementation from github; and failing that, use a minimal implementation of a type that could be used instead and makes the test pass. Fixes: QTBUG-93800 Fixes: QTBUG-119791 Task-number: QTBUG-92952 Change-Id: I1cfac37ac9af8fd421bc0af030a1d448dd0e259e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Doc: Document the LegacyBehavior enum separately for clarityDavid Boddie10 days1-5/+7
| | | | | | | | | | | | | Improve the layout of the enum documentation by splitting LegacyBehavior from the rest of the enum values to prevent the value column from taking up too much of the page width. Mention transition details rather than times to avoid confusion about terminology. Fixes: QTBUG-141801 Change-Id: Ib995ab2af3bcddce669df818ff949b7a3e959667 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QFlatMap: remove STL-compatibility guard macroMarc Mutz10 days1-21/+0
| | | | | | | | | | The macro has been silently active since 6.5, with no way to disable it, so remove it now, after two LTS releases have been released with this new default. Pick-to: 6.10 Change-Id: Ibc12fa59707a75eb9e4a452471a83e9df206a7b6 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* wasm: Refactor PromiseEven Oscar Andersen10 days2-6/+188
| | | | | | | | | | | | | | | | | | | | | | | | Switch from a function based implementation to making Promise a object. Maps straightforward to a javascript promise, except for this: We need to do cleanup when the promise has been fully processed. We do this by adding a final handler. However, the handlers are called in the order they are added, so the final handler we add in the constructor will be executed too early. We solve this, in a non optimal way, by adding a final handler after each then, and catch, handler. This makes the interface easy to use, even if it is suboptimal Fixes: QTBUG-142138 Change-Id: I6be3f102e838467cc98f4a9825fd5f6fe0e1e1a2 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Add check for -Wcharacter-conversion supportMorten Sørvig10 days1-1/+1
| | | | | | | | | | | | | | | | | Use __has_warning() to check if -Wcharacter-conversion is supported before disabling it, in order to avoid "unknown warning" warnings. This is/was a problem when building with Emscripten 4.0.7, which uses a git snapshot of Clang 21 which does not support the warning. Amends f20f12baab1f40ec0aad2635186e7d270139509b. Pick-to: 6.10 Change-Id: I4c08e69013b36b87709295d9a3a79d8986078ef1 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Docs: Add note about need for <!-- %%INSERT_PERMISSIONS -> in ManifestSheree Morphett10 days2-1/+9
| | | | | | | | | | | Added a note to the qt_add_android_permission documentation clarifying the need for INSERT_PERMISSIONS to be present for it to work with the API. Fixes: QTBUG-138568 Pick-to: 6.8 6.10 Change-Id: Ibb7a5594ae731f3c64582ea27db329a582a94d5b Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
* CMake: Automatically generate a vcpkg manifestJoerg Bornemann11 days1-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][configure] Added a -generate-vcpkg-manifest configure option. This generates a vcpkg.json file in the build directory. To just generate the manifest without configuring Qt, run configure with -generate-vcpkg-manifest -dry-run. [ChangeLog][configure] When configuring with -vcpkg, generate a vcpkg manifest file in the build directory, and set VCPKG_MANIFEST_DIR to the build directory to use that manifest file. You can turn off the manifest generation with -no-generate-vcpkg-manifest. You can turn off setting the manifest directory by passing -- -UVCPKG_MANIFEST_DIR to configure. Configuring with pure CMake won't generate a vcpkg.json. This patch adds a low-level CMake API for creating vcpkg manifests in QtVcpkgManifestHelpers.cmake. The functions qt_find_package and qt_feature gained arguments for creating dependencies in the manifest and add them to features. This adds a package dependency (not guarded by any feature): qt_find_package(WrapSystemFreetype 2.2.0 MODULE ... VCPKG_PORT freetype VCPKG_VERSION 2.3.4 ) This adds a package dependency `freetype` to the feature `freetype`: qt_find_package(WrapSystemFreetype 2.2.0 MODULE ... VCPKG_PORT freetype VCPKG_ADD_TO_FEATURE freetype ) This adds a feature `freetype` with `gui` as its "parent dependency": qt_vcpkg_scope(gui) ... qt_feature("freetype" PUBLIC PRIVATE SECTION "Fonts" LABEL "FreeType" PURPOSE "Supports the FreeType 2 font engine (and its supported font formats)." ) If features are turned on/off via configure arguments, we set the CMake variables VCPKG_MANIFEST_NO_DEFAULT to ON and VCPKG_MANIFEST_FEATURES to the list of corresponding vcpkg features to only install libraries that are needed for the build. For a per-repo build, we create a vcpkg.json with dependencies only for that repository. For a top-level build, we create a vcpkg.json with all dependencies of all repositories, excluding those that have been skipped (with configure's -skip argument). Task-number: QTBUG-73760 Change-Id: I6cc449d712f32d9e564acecaede5a7b31f309a8c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QObject: optimize err_ functions for sizeMarc Mutz11 days1-10/+25
| | | | | | | | | | | | | The compiler cannot look into format strings and extract common parts for us. We need to do it manually. Saves more than 400B in text size on optimized GCC 15 C++26 unity AMD64 builds. Pick-to: 6.10 6.8 6.5 Change-Id: Ia8db139d9a1fc219a84eaec42c6f72dc9dc9d135 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QRangeModel: port some predicates to qxp::is_detectedMarc Mutz11 days1-23/+18
| | | | | | | | | | | | | | | It's easier to read, and involves less class template instantiations. As a drive-by, refer to wrapped_t using qualified lookup, to prevent ADL injections. There's much more whence these came. Created QTBUG-142184 to keep track of the general issue. Amends 8edabea2a76192788d30afc22e2ebcb560195401. Task-number: QTBUG-142182 Pick-to: 6.10 Change-Id: I1a54b904df4e0204a7909ea10845acccb539866b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add public interface for dynamic feature java binariesLauri Pohjanheimo11 days2-0/+51
| | | | | | | | | | | Dynamic Feature functionality requires java classes in jni interface to enable google play feature delivery functionality. This function adds public interface to add java source folder to the build. Task-number: QTBUG-124600 Change-Id: I77e87f752cfb74b734dc34470e39b279d11868a6 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QMetaContainer: Optimize iterator comparison a bitUlf Hermann12 days1-4/+4
| | | | | | | | | | | If the iterator pointers are the same, then the iterators are the same and their distance is 0. No need to call any functions for this. This also makes empty container interfaces less dangerous. The resulting containers are simply empty, too. Change-Id: I64896fdaa391e97e46430233a74071aadf20f0ea Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: Make Qt Core examples accessible from the TOC treeAlexei Cazacov12 days2-1/+15
| | | | | | Pick-to: 6.10 Change-Id: I16544e9e64f9ef4b43cbd40ad4dd2bc3c30173d4 Reviewed-by: Topi Reinio <topi.reinio@qt.io>
* Add security scoped file engine for Apple operating systemsTor Arne Vestbø12 days7-1/+606
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Apple operating systems where the app runs in a sandbox, the application can not access files outside of its sandbox without explicit user approval. This applies to iOS and friends, as well as optionally for macOS (when the sandbox is enabled, which is a requirement for publishing apps to the macOS App Store). When the user gives explicit access to a file or directory, we need to manage this access at runtime by starting and stopping the access via startAccessingSecurityScopedResource and stopAccessingSecurityScopedResource, and these functions must be balanced, to avoid leaking kernel resources. The access unfortunately doesn't persist automatically when the application terminates (unlike takePersistableUriPermission on Android), so we have to manually persist the access via security scoped bookmarks. We store these inside the app's own sandbox, in a way that limits the access to only that application, so persisting them on behalf of the user should be fine. The persisted bookmarks are loaded in the background on application start, ready for when the application wants to open earlier accessed file or directories. [ChangeLog][Apple] Sandboxed applications on Apple platforms, (including macOS if opted in to) can now access files outside of the application sandbox (so called security scoped resources) for both reading and writing. Files or folders chosen by the user via file dialogs or similar native mechanism are automatically and transparently handled, including persistent access across application and device restarts. Fixes: QTBUG-120528 Task-number: QTBUG-117832 Task-number: QTBUG-120528 Task-number: QTBUG-141414 Change-Id: I90d94066cbf7cd74750049d5d1b990917fd10cad Reviewed-by: Doris Verria <doris.verria@qt.io>
* wasm: Make Promise/exclusiveHandler process all three handlersEven Oscar Andersen12 days4-51/+80
| | | | | | | | We need to process events for the then and catch handlers as well. We stop processing on receiving the finally handler, as before. Change-Id: Ie173f31367b4c408c884134428329b2b7e54c5dd Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>