summaryrefslogtreecommitdiffstats
path: root/src/remoteobjects/qremoteobjectabstractitemmodelreplica.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-071-2/+2
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: Ifc205a53ed6809f98d6cd552de901ea7e90716f5 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Replace qExchange with std::exchangeMarc Mutz2022-10-061-1/+1
| | | | | | | | | None of these users require C++20 constexpr or C++23 noexcept, the only remaining difference between std::exchange and qExchange. Task-number: QTBUG-99313 Change-Id: I3a1cc903f8298085dd2bf09a08234557e9eb430a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add QList<int> metatype registration so that QDataStream worksJuha Vuolle2022-08-301-0/+1
| | | | | | | | | | | | | Recent changes in qtbase have the consequence that some of the metatypes that were previously implicitly/indirectly registered no longer are. Fixes: QTBUG-105469 Change-Id: I3a62fc46dad82c64271d62f74e466b0a54fcd2d4 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Use SPDX license identifiersLucie Gérard2022-06-141-38/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I315d7ce1d6c6c3497afdfe8b61a113fdc181c935 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Replace Q_DECLARE_METATYPE with QT_DECL_METATYPE_EXTERNSona Kurazyan2022-06-091-0/+9
| | | | | | | | | | | | | This reduces compilation time by avoiding repeated metatype instantiations. Can't backport to Qt 6.3 or 6.2 because this change introduces new exported symbols. Pick-to: 6.4 Fixes: QTBUG-102219 Change-Id: Ice0f606bdcfa283b8eb89c57c4b06650d3f88928 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Fix header change replicationJoni Poikelin2021-10-131-1/+6
| | | | | | | | | Fixes: QTBUG-91041 Pick-to: 6.2 5.15 Change-Id: I5b56ed81ee9df658e0c596199dfde067bba6cd43 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Refactor decodeVariant to pass by rvalue ref/std::moveBrett Stottlemyer2021-08-041-1/+1
| | | | | | | | | | | | | | The decodeVariant calls were weird in how their parameters were pass by reference so they could be changed, but without forcing a copy. It is clearer to pass by rvalue ref, using std::move on the calling side. This rippled up to calls that called the method, including setProperties which is part of the repc generated code. Because of the repc change, this should *not* be picked to Qt5. Pick-to: 6.2 Change-Id: Ieb1b0620569ad8eb9797edc57cc189d0b426510c Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Move items from qremoteobjectabstractitemmodeltypes_p.h to QtPrivateSona Kurazyan2021-06-241-50/+50
| | | | | | | | | | | | Move the classes and methods to QtPrivate namespace, to avoid clashes with user code when static linking. Task-number: QTBUG-94407 Pick-to: 6.2 Change-Id: I9194a13fa923429aa1a294d41befc1a05ff12d78 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Update the replica when the layoutChanged signal is emittedAndy Shaw2021-05-051-0/+37
| | | | | | | | | | | When a sort() is done on a QSortFilterProxyModel then it will emit the layoutChanged() signal, so it should ensure that the replica is updated in that case accordingly. Pick-to: 5.15 Fixes: QTBUG-85795 Change-Id: I7f34b24f4fab78c18655e986f54a0eb61db3a7b7 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Fix documentation mishapsMårten Nordheim2021-03-171-4/+4
| | | | | | | | | | I'm somewhat scatterbrained, so when applying the parenthesis to the functions in one of the patchsets I only did it on one function. I also forgot to prepend the classname to the signal name (generating a qdoc warning.) Change-Id: I40b7960376203b831d5aa2d00078ecbac30f713e Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Reimplement QAIM:multiData for QAbstractItemModelReplicaSona Kurazyan2021-03-161-20/+52
| | | | | | | | | | | Reimplemented the QAbstractItemModelReplica::multiData method. This will allow fetching data for multiple roles in a more efficient way. Also made use of it in the implementation, the users that reimplement QAIM::multiData for their models may benefit from it. Change-Id: Iac8bdb5a3a6b45afb87e7f8187a2f3a6e73c7b7e Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Document QAbstractItemModelReplicaMårten Nordheim2021-03-151-0/+107
| | | | | | | | | | This patch adds the missing documentation to QAbstractItemModelReplica. Fixes: QTBUG-90823 Task-number: QTBUG-90848 Change-Id: Iae8784e522da691b5bcceaebae64eed5712fc051 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Clean-up integer conversion warningsSona Kurazyan2021-02-261-1/+1
| | | | | Change-Id: Ib1229eb973066a7500cb759082a1a3a7ce978bfa Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Clean-up warningsSona Kurazyan2021-02-221-7/+7
| | | | | | | | | | | | | Fixed the following warnings: - empty expression statement has no effect; remove unnecessary ';' - use of old-style cast - zero as null pointer constant - other minor things Change-Id: Ia672f48d2aa87c59354fc93fd19862f1875e13db Reviewed-by: Brett Stottlemyer <bstottle@ford.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use QList instead of QVectorJarek Kobus2021-02-161-30/+30
| | | | | | | | | Task-number: QTBUG-84469 Task-number: QTBUG-90907 Change-Id: Ifc6f05fb5e17e32ec04b383770080e812c854510 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Fix compilation with Qt 6Sona Kurazyan2021-02-151-9/+5
| | | | | | | Task-number: QTBUG-90685 Change-Id: Iba9ee0a28ec0ceeca5ae318204deb14190042533 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Add ; to Q_UNUSEDLars Schmertmann2020-06-291-1/+1
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: Ib62dc7739fcc494e1c111053f0f5d52663b174a9 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Clear the cached header data when resetting the modelAndy Shaw2020-03-171-0/+10
| | | | | | Fixes: QTBUG-81602 Change-Id: Ic173f8b65e1d4fcc45eebfbf4283491493e648b2 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Annual QStringLiteral sweepMarc Mutz2019-08-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | It makes little sense to use QStringLiteral in the following situations: - for comparison to a QString, because operator==, startsWith(), indexOf() etc are overloaded for QLatin1String. - for strings which are immediately appended to, or which are appended or prepended to other strings. because no dynamic memory allocation is saved by doing so. But if the only advantage of QStringLiteral does not apply, all its disadvantages dominate, to wit: injection of calls to the QString dtor, non-sharability of data between C strings and QStringLiterals and among QStringLiterals, and doubled storage requirements. Fix by replacing QStringLiteral with QLatin1String, or char16_t literals, whichever is more fitting. Also use new QLatin1String::arg() more. Change-Id: I55d05783889f521001a1cb8dedd276d0a183882f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace some Q_FOREACH loops by consume loopsMarc Mutz2019-07-041-2/+1
| | | | | | | | | | These loops consume their input container, so make it explicit by using qExchange(). This also means we dodge the potential issue of container modification under iteration. Change-Id: Ifc18f3d77b171e8f8e80f7c7c2db1b6ecf25f461 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Eradicate some simple Q_FOREACH loopsMarc Mutz2019-07-041-4/+3
| | | | | | | | | | | | | | | | | | | | | All these are relatively easily verified to be safe: They clearly don't modify the container they iterate over, are already const or trivially marked as such. In QRegistrySource::removeServer(), merge with an adjacent loop. In tst_modelview.cpp, replaced a loop over QHash::keys() + QHash::op[] with an STL-style loop and it.key()/it.value(). In tst_signature.cpp, replaced a QStringList with a C array of QLatin1Strings, saving a qAsConst call. Add some reserve() as a drive-by. Change-Id: Ibf09371ca8b58437834734c3bab997527219c823 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix include directivesFriedemann Kleint2019-01-181-3/+3
| | | | | | | | | | Always prepend the module and use headers directly. Qt for Python requires the modules to be present. Task-number: PYSIDE-862 Fixes: QTBUG-72675 Change-Id: I94e38fbab0f041370ca9d67ca13c78f0d33816b7 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* QAbstractItemModelReplicaImplementation::fetchPendingData(): Fix compiler ↵Friedemann Kleint2019-01-171-2/+4
| | | | | | | | | | | warning Add braces, fixing: remoteobjectabstractitemmodelreplica.cpp: In member function ‘void QAbstractItemModelReplicaImplementation::fetchPendingData()’: qremoteobjectabstractitemmodelreplica.cpp:603:16: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else] Change-Id: I399fef3f19b0ac3b585acb9e8e3dd7bd6587723f Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Make sure types needed for MODELs are registeredBrett Stottlemyer2018-11-071-16/+18
| | | | | | | | The types were registered when using repc generated classes, but would fail if used with dynamic replicas. Change-Id: I1c2bbe967b76558d672e233082bde3ffa46f897f Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Fix issue proxying modelsMichael Brasser2018-08-141-1/+1
| | | | | Change-Id: Ie3fd6a57559604aea231aad7936ffbaf9cdce185 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Ensure we always emit initialized signalMichael Brasser2018-04-271-2/+4
| | | | | | | | Model resets clear any pending watchers. Prevent this until init (which performs a reset) is complete. Change-Id: I342f288f3944acf92e2cb64474584277654b0515 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Update metatype registrations for QAbstractItemModelReplicaImplementationMichael Brasser2017-12-061-0/+2
| | | | | | | | Fix the following error: QVariant::load: unknown user type with name MetaAndDataEntries Change-Id: I325bd9b4c21c90c06645143bfc5acbbbd24ef984 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Optionally cache QAIM data prior to initialized signalBogDan Vatra2017-11-291-16/+41
| | | | | | | | Allow specifying whether the model should fetch some data from the source before the *initialized* signal is fired. Change-Id: I5849c9572a4f27cd4392c9bf690e5e8b62fd07d2 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Don't push the same request twiceBogDan Vatra2017-11-291-1/+0
| | | | | | | | Fixes a crash when it can't connect to source Change-Id: Ieca3dd5affff45b0bf43a689f7016b20bfe2fccf Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Rename ReplicaPrivate -> ReplicaImplementationKevin Funk2017-10-061-47/+47
| | | | | | | | | | | | | | All those implementations for the QtROReplica ('InProcess', 'Connected', 'RemoteObject') aren't technically d-pointers. Mark them as such by naming them differently. This also has the nice benefit that one does not override QObject's 'd_ptr' variable accidentally with these implementation instances. Needed in order to pimpl QRemoteObjectRegistry properly Change-Id: I88322e37d2ff7e5044980e8fdf9f713d6be80c38 Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Provide static method for registering metatypesBrett Stottlemyer2017-05-161-3/+3
| | | | | | | | | | This provides an entry point (before a type is instantiated) to register the needed types (for instance, enums used by a type). It also makes it easier to guard against attempting to register a replica's types multiple times. Change-Id: Ic01c70586eab618afeb90c98df042b1ae7a9eed9 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Correct QtRO license headers and added missing license filesv5.9.0-beta4Jani Heikkinen2017-05-021-13/+19
| | | | | | | | | | | | | Unify licensing as it is in other submodules - Src is licensed under Commercial, LGPLv3, GPLv2 and GPLv3 licenses - Examples are licensed under Commercial and BSD licenses - Tools and tests are licensed under commercial and GPLv3 license with some exceptions Task-number: QTBUG-58921 Change-Id: I4494bf8b705568b243340c98316bedd706145db5 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Delete all pending requests when reseting the modelBogDan Vatra2017-02-211-0/+2
| | | | | | | | | | It is necessary because when we reset the model we also reset its internal data. Any previous requests (e.g. a header data request) will crash the application because the data that is commning from remote doesn't fit anymore with the local data. Change-Id: Iec1c4541d3440f8c4a560d9d81c47e14863bf5aa Reviewed-by: Kevin Funk <kevin.funk@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Fixes for license checkBrett Stottlemyer2017-01-141-21/+13
| | | | | | | | Change-Id: I3cf39180b08b80ea65c46e7b6a9e81f3aa79d1af Reviewed-by: Kevin Funk <kevin.funk@kdab.com> Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Request only the cached dataBogDan Vatra2016-05-241-6/+38
| | | | | | | | | | The server side model might changed the data which is not in the client LRU cache, so, there is no point to request that data because is not visible. Change-Id: I3aa4312f8113cb58e1df3bc4c70eeb61efb91c89 Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Clear the exceeding elements and reserve enough elements for hashBogDan Vatra2016-05-241-3/+3
| | | | | | Change-Id: I9a5ca2c55dc3a80bad8d476fb554db88809c1338 Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Increase the default cache size to 1000BogDan Vatra2016-05-241-1/+1
| | | | | | | | | | 1000 is the default contents precision used by QHeaderView (in a QTableView). Setting a less value will cause the tableview to flicker. Change-Id: I7302ca895b8db893539be24972f86bad48aa1939 Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Make sure the parent is cached when we try to insert a child.BogDan Vatra2016-05-241-2/+11
| | | | | | | | | Fix crash when we start with an empty tree modele and we insert a child of a child. Change-Id: I726e1806b737ba35a506fb7745d1432c3b249a18 Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Replace `Variant::value<QSize>()` with `QVariant::toSize()`.Daniel Pfeifer2016-05-231-2/+2
| | | | | | | | | The former results in more code being generated. Change-Id: I290a6a7dc4228563a2acd8c36236582427a8181b Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Kevin Funk <kevin.funk@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Ensure the item is in cache when reqest itBogDan Vatra2016-05-171-2/+3
| | | | | | Change-Id: Ic739c4e761350fc38b42485b18b5b4c3a30c946b Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Memory performanceBogDan Vatra2016-05-091-87/+124
| | | | | | | | Use a LRU Cache to keep the most m_cacheSize used items. Change-Id: I2c46153e4236b4ba354c0b45f0840b28da710366 Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* [fix] Avoid rare crash in QAIMBrett Stottlemyer2016-03-281-14/+15
| | | | | | | | | | | Catch condition where multiple Replica's of the same model do not have the same data cached. Only applies when a selectionModel is used. Cleanup - convert OnConnectHandler to regular slot. Change-Id: I7fb86e55560b36c20b84cd65fc34844006c3468b Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Split requests into smaller pieces and request current data firstBogDan Vatra2016-03-251-6/+7
| | | | | | | | | | | | | The last requests are also the (currently) visible ones, therefore, requesting in reverse order will help to get the visible ones first. It happens when the user browse trough a list. Splitting the requests into smaller pieces (100 rows) will help to get the visible items faster. Change-Id: I49e5733f82ed2b60f583ef15fde4fdbf397693ed Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* QHash has faster lookup than QMapBogDan Vatra2016-03-221-4/+4
| | | | | | Change-Id: Ifd93b4da6ce3d49f4bee27698e1d76f9a16179af Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Check if the model supports the role.BogDan Vatra2016-03-221-0/+9
| | | | | | | | | It saves lot of calls and lot of cached data. Change-Id: I69e2e1258d104055af3dca4a17cf36f7f9fcdd90 Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Kevin Funk <kevin.funk@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
* Rename QAbstractItemFoo -> QAbstractItemModelFooKevin Funk2016-03-211-0/+867
Source-incompatible change, but worth it, IMO. Change-Id: I2e1c716dafaf3d8b031fc3459aa8b7f6fb8bc545 Reviewed-by: Continuous Integration (KDAB) <build@kdab.com> Reviewed-by: Brett Stottlemyer <bstottle@ford.com>