summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Remove two obsolete #definesLars Knoll2020-09-061-5/+0
| | | | | Change-Id: Icc13408cfdb8ce0db6f274904c3e44f8376cd1e5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Cleanup QSemaphore and make it always 64bit largeLars Knoll2020-09-052-104/+60
| | | | | | | | This simplifies the implementation so that we don't need separate code paths for 32 and 64 bit anymore. Change-Id: I823612865e7d648fb0bd1632385ce67b5a452b8a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Cleanup a ### Qt 6Lars Knoll2020-09-052-6/+5
| | | | | | Change-Id: If9dd04e25ddc5164cc23ac7d5684254e38b7eda6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove /INCREMENTAL:YES from linker flagsMarcel Krems2020-09-051-2/+0
| | | | | | | | | This flag doesn't exist in MSVC 2015+: LINK : warning LNK4224: /INCREMENTAL:YES is no longer supported; ignored https://docs.microsoft.com/en-us/cpp/build/reference/incremental-link-incrementally?view=vs-2015 Change-Id: I3b2aace619351e2dc9cc86e1df28facc21b7d9fe Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_qdbuscpp2xml: stop doing math on enumerationsGiuseppe D'Angelo2020-09-051-1/+1
| | | | | | | Cast it to int to do math. Change-Id: Ia553cccb7e160df50e77fba63d66d0ed45c246c2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QCompleterItemDelegate: replace QItemDelegate with QStyledItemDelegateWang Peng2020-09-051-5/+4
| | | | | | | Resolve remaining Qt6 TODOs Change-Id: Ice8dae2f1cbd3ed452ab78d5d7735127d7662900 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QCalendarDelegate: replace QItemDelegate with QStyledItemDelegateWang Peng2020-09-051-6/+5
| | | | | | | | Resolve remaining Qt6 TODOs Change-Id: I018ef5e3761816dce052a78be3dcd07ede866135 Reviewed-by: JiDe Zhang <zccrs@live.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QMetaType: optimize comparisonFabian Kosmale2020-09-051-1/+1
| | | | | | | We can skip the id calls if we know that the pointers are equal. Change-Id: I62f9cac557d7b82b640a143965f9056a8cd46028 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Use QList instead of QVector in qmakeJarek Kobus2020-09-0511-22/+22
| | | | | | | Task-number: QTBUG-84469 Change-Id: I4a3da94702f1dad1ee10b1ba3c6712b6f40338c9 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* When finding the engine for a fallback font, then clear the familiesAndy Shaw2020-09-051-0/+1
| | | | | | | | | | | If it is a fallback font, then it should just have family set to that font so it does not get interference from what the families were originally set to. Fixes: QTBUG-85560 Change-Id: I6232f3d2ae12052fa3b0b3bc0e7f106e239a585d Pick-to: 5.15 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Get rid of the MSVC specific fileLars Knoll2020-09-053-61/+0
| | | | | | | | | It used to contain the MSVC specific export hack for QVector, but that one is not required in Qt 6 anymore and the file was not doing anything anymore. Change-Id: Ic8b4aa355a8934beb6abcf10235d218344a294cc Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QStyle: remove deprecated SH_SpellCheckUnderlineStyleChristian Ehrlicher2020-09-054-10/+0
| | | | | | | | It was deprecated with 88e6f8cff2974c46b1262f3a1a61e1440c664e0c and is not used anywhere anymore so it can be safely removed. Change-Id: If4050ac8bf116fb31491b3b08096554c5ea3e4d5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make test pass on machines with many coresLars Knoll2020-09-051-1/+1
| | | | | | | | | | Just starting 20 threads to test this won't cut it if the machine you're testing on has an ideal thread count of 16 or larger. Change-Id: Icba8f00aa836fec6da41c71b318e9e17bdd47c0e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove some comments that are no longer relevantEdward Welbourne2020-09-054-7/+2
| | | | | | | Task-number: QTBUG-85700 Change-Id: I5ce368e8edca2b9483a0f0ef34bc9eb6b4e44574 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove some obsolete codeLars Knoll2020-09-053-95/+0
| | | | | | | Those checks aren't required anymore for Qt 6. Change-Id: Ida9f93544f42cb03723659a81e0094aa0cf14799 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QWindowsKeyMapper: fix mixed math between int and enum/flagsGiuseppe D'Angelo2020-09-051-3/+3
| | | | | | | | | Either do it between ints, or cast to the right types before doing it. This should enable removing operator+ and - between int and QFlags. Change-Id: I30ecc03566cff8ce880b048ba3a9d7d50f3c8509 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Change QWidget::enterEvent signature to take a QEnterEventVolker Hilsheimer2020-09-0514-22/+21
| | | | | | | | | | | | | | | | | | | This is a source incompatible change for widget implementors. Leaving the old enterEvent as a virtual overload is problematic due to shadowing. Best to make a clean cut, widget reimplementors will get a compile time warning if they mark their override as such, or if they try to call the parent class implementation. Addresses ### Qt 6 comment. [ChangeLog][QtWidgets][QWidget] The virtual enterEvent handler now receives a QEnterEvent, which contains information about mouse position and button states, rather than a plain QEvent. Change-Id: I233f594fd79c0c090983b3db8532913d00132fde Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Change translation context of strings to new classVolker Hilsheimer2020-09-051-13/+6
| | | | | | | | | | | The strings were in QFileDialog context even though they were in QFileIconProvider, probably for historical reasons. Now that the strings have been moved into QtGui, using a QtWidgets class as the context makes no sense. Change-Id: Ia4f3bd18abaab2a5fbbb94e945782f4d2d94e7d1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix compiler warnings from using deprecated qChecksum overloadVolker Hilsheimer2020-09-052-4/+4
| | | | | Change-Id: Ib7a6d0e752dc662a42abe38f2010da3f2b4626f1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix compiler warnings after QKeyCombination introductionVolker Hilsheimer2020-09-052-11/+10
| | | | | Change-Id: If5d7c5e037b99c14c51d83adf8b1e20d6b924bc5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix compiler warning from unused private field in QSequentialIterableVolker Hilsheimer2020-09-051-0/+1
| | | | | Change-Id: I9c330b4f99f77404eacda2506d264f917f9e1161 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* xcb: drop Xinerama supportLiang Qi2020-09-0411-74/+5
| | | | | | | | | | [ChangeLog][Important Behavior Changes][X11] Xinerama is no longer supported. Fixes: QTBUG-86082 Change-Id: Ieb57d9035e1659fc22bf8333247fc3573fb62992 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Fix memory sanitizer complaint about uninitialized valueLiang Qi2020-09-041-1/+1
| | | | | | | Fixes: QTBUG-86383 Pick-to: 5.15 Change-Id: Ib2bbe5d8e11574456fdc8b5c5fb07f5e41b538b3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Merge QPainterPathPrivate and QPainterPathDataVolker Hilsheimer2020-09-043-93/+70
| | | | | | | As per ### Qt 6 comment, and the code that never allocated QPainterPathPrivate. Change-Id: I553e3559fdb2a675f37cdd9855462a2f22ef84c6 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Remove deprecated QPrinter and QPagedPaintDevice APIsVolker Hilsheimer2020-09-0417-1755/+318
| | | | | | | | | | | Adjusting the QPrinter test case - some use cases no longer exist, or are already tested in QPageSize and QPageLayout tests. Adjust examples and manual tests. Change-Id: I01cbc65f3d8031aea2dac86dd942126ba708b111 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* wasm: enable httpmultipartLorn Potter2020-09-049-6/+32
| | | | | | | This allows for multipart requests. Change-Id: I1206d160cfd9150a9627c36ed60ea4cbb58e95aa Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix flaky QFutureWatcher::startFinish() testJarek Kobus2020-09-031-11/+22
| | | | | | | | | | | | | | | | | | Since waiting for a spy employs polling, it may happen that while waiting for a startedSpy we had received already a signal for finishedSpy. This explains current flakiness. The fix is to connect to lambdas instead and update the hit count accordingly. Inside lambdas we also ensure the correct order for started / finised signals. After waitForFinished() unblocks we ensure that possible pending asynchronous signals (started / finished) are processed and check the final state. Task-number: QTBUG-83076 Change-Id: I16963ef9c011cb613d7b409d3e3032303a942336 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Tighten up QDialogButtonBox::ButtonLayout enumVolker Hilsheimer2020-09-033-13/+1
| | | | | | | | | | ... and the equivalent enum in QPlatformDialogHelper. No need to keep numerical values the same anymore. Remove ### Qt 6 comment. Change-Id: Ib369ea6ca2362f6ab0f71a3a6c90c4adaa7f11cd Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Remove timeStep parameter from QAnimationDrive::advanceAnimationVolker Hilsheimer2020-09-034-21/+16
| | | | | | | | | | | | | | Addresses ### Qt 6 comment, and documentation pointing out that the parameter value is ignored. It wasn't ignored in the code, but that's the kind of change we can make now. With this change, QUnifiedTimer::updateAnimationTimers is only called with -1 as the currentTick input parameter, also from Qt Declarative. Make it default, so that leaf modules can be fixed. Once that it done, the parameter can be removed completely. Change-Id: I80c57ff92f3b615b932dd73d711cf6397347efd8 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Fix build without features.highdpiscalingTasuku Suzuki2020-09-041-2/+2
| | | | | | | Broken since 37d5aaa4b42f9c837f0d27edb9da2185971d02be Change-Id: Id741f23ccae4f619e6a389ee71b3e7fe0c599989 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove obsolete native client platformMorten Johan Sørvig2020-09-037-266/+5
| | | | | Change-Id: Ia27cfbb618d216c371a0f8210f0bec483d4f15db Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Extend test blacklisting from Ubuntu 18.04 to 20.04Tor Arne Vestbø2020-09-034-0/+4
| | | | | | Task-number: QTBUG-86187 Change-Id: I3ac3233f7355d1c16bc9bf6e052fdf4bd9ea90de Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QCocoaKeyMapper: do not sum integral+QFlagsGiuseppe D'Angelo2020-09-031-2/+2
| | | | | | | | It will become illegal; keep the semantics but force the right casts. Change-Id: I4002c5bca6eb90e798e35ca263e7bbb4ff5ad4b1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* rhi: Sanity check the srb in debug buildsLaszlo Agocs2020-09-036-2/+91
| | | | | | | | | | | Instead of cryptic assertions and crashes depending on the backend, show some useful warnings (in debug builds only) when one tries to create an srb with a list where there are duplicated bindings. (a mistake that happens relatively often during the development of frameworks, such as Quick 3D, on top) Change-Id: If1b50a2e8165b001878ad566e048f146e636514f Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add QByteArrayView overloads for push_back and push_frontLars Knoll2020-09-032-18/+30
| | | | | | | | Change-Id: If70f3ac6764958d92dcbab44432b4f4994d20405 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Clean up the QByteArray API and implementationLars Knoll2020-09-033-272/+140
| | | | | | | | | | | | | | 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>
* QList/QByteArray/QString: Base GrowsBackwards heuristic on old sizeMårten Nordheim2020-09-033-6/+6
| | | | | | | | | | | If you grow from 10 to 100 characters then even if the point of insertion was the end then it will get the GrowsBackwards option on realloc. By basing it on the oldSize the intention of the position to insert at is better clarified. Change-Id: Ia73f4902e8356d94709556de5704cbfa0e1a3a56 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Enforce complete method types of QML registered classesFabian Kosmale2020-09-033-3/+16
| | | | | | | | | | | For QML, we like to avoid doing string to type lookups at runtime as much as possible. Therefore, QML registration macros like QML_ELEMENT now cause moc to require complete types not only for properties, but also for all methods known to the metatype system. Change-Id: Ied3d940c102719db4852d3a748d05be1f415b353 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix build without features.filesystemmodelTasuku Suzuki2020-09-031-0/+1
| | | | | | | 94dcb5454f0f8f144568dff7a9dd1316046ee197 breaks the build indirectly Change-Id: Iba76a76fd14e65a7eb230c53608e405bd821ef74 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Reimplement QSequentialIterable using QMetaSequenceUlf Hermann2020-09-0319-632/+593
| | | | | Change-Id: Ie721a5f0caa697c4bf15a81f3762cf79d3c54f5a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Ignore weight in .ui files instead of converting itEskil Abrahamsen Blomfeldt2020-09-034-80/+0
| | | | | | | | | | | | | | | | | | | | | | | In 3558704ed5c3d2c6dc6d024dfa454997469ca75f, we added code to support old .ui files which used the old integer scale for font weights by checking for a special attribute which would help separate new and old files. Since then, it has become apparent that the weight element in .ui is not actually used for anything, since it is only emitted when the bold flag is set and always has to match QFont::Bold in these cases. So instead of converting, we simply ignore it now, and respect the bold flag instead. This also reverts the changes to ui4.* in uic, since the scale attribute is no longer needed. Task-number: QTBUG-42248 Change-Id: I1898868b58004099590f4eaf01f24c57bd34d779 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Mark obsolete QPrinter functions as deprecated from 5.15 onVolker Hilsheimer2020-09-036-8/+58
| | | | | | | | | | | Some of the methods are overrides of virtuals in QPagedPaintDevice, so document and mark those as obsolete as well. Adjust code that calls those APIs to use the recommended replacement. Change-Id: I3cd1980609ea20808d17379a5f97ca595e869875 Pick-to: 5.15 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Long live QKeyCombination!Giuseppe D'Angelo2020-09-0335-67/+813
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++20 via P1120 is deprecating arithmetic operations between unrelated enumeration types, and GCC 10 is already complaining. Hence, these operations might become illegal in C++23 or C++26 at the latest. A case of this that affects Qt is in key combinations: a QKeySequence can be constructed by summing / ORing modifiers and a key, for instance: Qt::CTRL + Qt::Key_A Qt::SHIFT | Qt::CTRL | Qt::Key_G (recommended, see below) The problem is that the modifiers and the key belong to different enumerations (and there's 2 enumerations for the modifier, and one for the key). To solve this: add a dedicated class to represent a combination of keys, and operators between those enumerations to build instances of this class. I would've simply defined operator|, but again docs and pre-existing code use operator+ as well, so added both to at least tackle simple cases (modifier + key). Multiple modifiers create a problem: operator+ between them yields int, not the corresponding flags type (because operator+ is not overloaded for this use case): Qt::CTRL + Qt::SHIFT + Qt::Key_A \__________________/ / int / \______________/ int Not only this loses track of the datatypes involved, but it would also then "add" the key (with NO warnings, now its int + enum, so it's not mixing enums!) and yielding int again. I don't want to special-case this; the point of the class is that int is the wrong datatype. Everything works just fine when using operator| instead: Qt::CTRL | Qt::SHIFT | Qt::Key_A \__________________/ / Qt::Modifiers / \______________/ QKeyCombination So I'm defining operator+ so that the simple cases still work, but also deprecating it. Port some code around Qt to the new class. In certain cases, it's a huge win for clarity. In some others, I've just added the necessary casts to make it still compile without warnings, without attempting refactorings. [ChangeLog][QtCore][QKeyCombination] New class to represent a combination of a key and zero or more modifiers, to be used when defining shortcuts or similar. [ChangeLog][Potentially Source-Incompatible Changes] A keyboard modifier (such as Qt::CTRL, Qt::AltModifier, etc.) should be combined with a key (such as Qt::Key_A, Qt::Key_F1, etc.) by using operator|, not operator+. The result is now an object of type QKeyCombination, that stores the key and the modifiers. Change-Id: I657a3a328232f059023fff69c5031ee31cc91dd6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Turn QFileDevice::MemoryMapFlags into a proper QFlagEdward Welbourne2020-09-021-3/+5
| | | | | | Task-number: QTBUG-85700 Change-Id: I2a741b67927fa7185acece51d774b90b0b88c705 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* pro2cmake: Fix qmake parser's line continuation handlingJoerg Bornemann2020-09-023-13/+18
| | | | | | | | | | | | | | | | | | | | | | | | The qmake parser of pro2cmake handles completely commented lines to make assignments like this work: SUBDIRS = \ foo \ # bar \ bar However, assignments like SUBDIRS = \ foo \ #bar \ bar were cut off at the commented line. Fix this by allowing leading whitespace for "fully commented lines". Change-Id: Ib5de850a02fd9b9ebb7c056c2f64f9d684334b08 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* CMake: Teach QtProcessConfigureArgs.cmake to configure other modulesJoerg Bornemann2020-09-021-12/+18
| | | | | | | | | | | | | | | | | | | | Until now, QtProcessConfigureArgs.cmake could only handle qtbase and the top-level build. Add the variable MODULE_ROOT that the user can point to the module that is to be configured. Example - QtDeclarative can now be configured like this: cd qtdeclarative-build-dir echo -qml-network > config.opt cmake -DOPTFILE=config.opt -DMODULE_ROOT=<source-root>/qtdeclarative \ -DCMAKE_COMMAND=<install-prefix>/bin/qt-cmake-private \ -P <source-root>/qtbase/cmake/QtProcessConfigureArgs.cmake A convenience script that saves the user from entering this unwieldy incantation will be added in a subsequent commit. Change-Id: If46103de3a8eb84b15e7600ebfec25544451e1d5 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* QString/QList: disregard space at front during reserve()Andrei Golubev2020-09-022-3/+3
| | | | | | | | | | Aligned QString, QList to the new agreed upon behavior Aligned QList::resize() along the way to be consistent with QString/QBA Task-number: QTBUG-84320 Change-Id: Ie9d7b4b6ebe54bd373af78d92906144b383bbfe2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QByteArray: Disregard space at front during ::reserve(...)Mårten Nordheim2020-09-022-1/+9
| | | | | | | | | | | | Traditionally when calling reserve it's because you expect to append up to X amount of bytes. We should keep that behavior the same. With another patch still in the works current behavior caused an issue with QStringBuilder in QNAM, as mirrored in the testcase attached. Change-Id: I9792a8f158fc9235e3de48ac8b06ac2c10e7f3dc Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Long live QAIM::multiData!Giuseppe D'Angelo2020-09-027-29/+672
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Views / delegates absolutely *adore* hammering data(). A simple QListView showing a couple of dozens entries can call data() a hundred of times on the first show. Back of the hand calculation, * 2 times per visible item (sizeHint() + paint()), * times 9 roles used by the default delegate, * times 20 visible items = 360 as a bare minimum, assuming the view doesn't redraw twice accidentally. Move the mouse over the view, and that'll cause a full update with certain styles: 360 calls to data() per update. This has an overhead visible in profilers. The model's data() has to re-fetch the index from its data structure and extract the requested field every time. Also, QVariant is used for the data interexchange, meaning anything that won't fit in one is also a memory allocation. This problem will likely be gone in Qt6Variant as that will store sizeof(void*) * 3, meaning QImage/QPixmap and similar polymorphic classes will fit in a QVariant now... So I'm trying to to remove part of that overhead by allowing views to request all the data they need in one go. For now, one index a a time. A view might also store the data returned. The idea is that the same role on different indexes will _very likely_ return variants of the same type. So a model could move-assign the data into the variant, avoiding the memory allocation /deallocation for the variant's private. This patch: 1) Introduces QModelRoleData as a holder for role+data. 2) Introduces QModelRoleDataSpan as a span over QModelRoleData. The idea of a span type is twofold. First and foremost, we are in no position to choose which kind of container a view should use to store the QModelRoleData objects for a multiData() call; a span abstracts any contiguous sequence, leaving the view free to do whatever it wants (statically allocate, use a vector, etc.). It also solves the problem of efficient passing the roles and gathering the returned variants from multiData(). 3) Add multiData(), which populates a span of roles for a given model index. The main advantage here is that a model can fetch all the needed information for a given index just once, then iterate on the span and provide data for each requested role. Cf. this with data(), where every call has to re-fetch the information for the index. A couple of models have been ported to multiData(), as well as QStyledItemDelegate. [ChangeLog][QtCore][QModelRoleData] New class. [ChangeLog][QtCore][QModelRoleDataSpan] New class. [ChangeLog][QtCore][QAbstractItemModel] Added the multiData() function. Change-Id: Icce0d108ad4e156c9fb05c83ce6df5f58f99f118 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QVariant: Fix conversion codeFabian Kosmale2020-09-022-2/+49
| | | | | | Fixes: QTBUG-86330 Change-Id: Ib89dcf1195e0081b4c4e2845f90c52c612e5911a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>