aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Add a -i <qmltypes> option to qmlcachegenUlf Hermann2021-01-121-0/+5
| | | | | | | | | | | | | qmlcachegen needs to see the qmltypes file for the current project so that it can query it for C++ types exposed to QML. This is only relevant when generating C++ code, which qmlcachegen itself cannot do. However, in order to write a compatible drop-in, we need it. Also, hide related ignored options from --help in qmlcachegen. Change-Id: Id2f1b8b1750351c7de8dfe49e4065ef1b29423b7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlListReference: Allow construction from a QVariantUlf Hermann2021-01-122-0/+37
| | | | | | | | | | | | Currently there is no public API to transform a QVariant holding a QQmlListProperty into a QQmlListReference. We cannot pass QQmlListProperty itself as that is templated. The metatype-based casting is somewhat evil, but not more so than what we already have in the other ctor. Change-Id: I2d56499b1fd188613bc71016cb00ec23081d3cea Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* QJSManagedValue: Allow retrieving and instantiating JS metatypesUlf Hermann2021-01-122-1/+109
| | | | | | | | ... a.k.a InternalClass. This is a faster way of creating multiple similar objects, compared to a sequence of setProperty() calls. Change-Id: Iecc8c581e50b9062895dae9500ffe2482d88028e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Make QQmlImport::removeDynamicPlugin() saferUlf Hermann2021-01-121-28/+24
| | | | | | | | | | | | | Consistently never unload plugins on macOS, also remove half-broken plugins from the map, and always unregister any types in them. Unloading plugins on macOS is ill-advised as it will actually unmap the memory, making string data (among other things) inaccessible. We've already done the same change to qmlClearEnginePlugins(). Change-Id: I8fa40db5c3cd83f12e6d85d0efc3b9679dd4381e Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QJSManagedValue: Allow array access to stringsUlf Hermann2021-01-121-0/+13
| | | | | | | | | If you access a string as an array you get a one-character string of the index you are asking for. Change-Id: Ie2ac3243c9e23f37b8904c54d824946646a596eb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Cache static compilation unitsUlf Hermann2021-01-123-12/+61
| | | | | | | | | | | | If we load the same file multiple times, we can re-use the old mapping. In fact we may leak memory if we don't. The fact that we have to use a mutex here is somewhat regrettable, but I haven't found a better way of serializing access. Task-number: QTBUG-89659 Pick-to: 5.15 Change-Id: Iaa44ac80faa5e95f30c05e950ab35083a8b0416b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* masm: Add error handling for failed mprotect()Ulf Hermann2021-01-1215-208/+29
| | | | | | | | | | | | If we cannot mprotect() we have to abort the JIT compilation. Delete RepatchBuffer.h as it is unfixable in that regard. Luckily we don't use it. Task-number: QTBUG-89659 Pick-to: 5.15 Change-Id: Ic5ddbdf51b471db4ddeaa75aab48b24c1f7ced56 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Remove QQmlCleanup from QQmlScriptDataUlf Hermann2021-01-122-26/+1
| | | | | | | | | | | | It prevents the compilation unit held by QQmlScriptData from being released on clearComponentCache(). The comment justifying the QQmlCleanup has been wrong since we moved away from V8. Task-number: QTBUG-89659 Pick-to: 5.15 Change-Id: I220561d90f707540e47c76d60a51468ee231ce9a Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Doc: Add links to examples of Qt Quick Particle SystemNico Vertriest2021-01-121-0/+6
| | | | | | | | | | Doc Using the Qt Quick Particle System did not contain links to examples. Fixes: QTBUG-29378 Pick-to: 6.0 Change-Id: I82e3a3af4925f7c8e58ce6a5c5af57b854cb9e36 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Pass a more comprehensive context to AOT-compiled functionsUlf Hermann2021-01-115-25/+55
| | | | | | | | | | We need the compilation unit, and a way to retrieve JavaScript metatypes from it. Also, prepare for cases where we only have a QJSEngine, not a QQmlEngine, and pass the scope object as part of the AOT context. Change-Id: Ica81e92c99f3c9b6baffd04db1e0e91603fd2ac7 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QJSManagedValue: Silence some static analysis warningsUlf Hermann2021-01-111-2/+7
| | | | | | | | The engine should really always be available if we have a d pointer. Change-Id: If620e69de07c6d365b45e714bae3ec0fb7eb86ef Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qqmlengine: Fix crash when encountering bad singletonsMaximilian Goldstein2021-01-111-0/+6
| | | | | | | | | Previously errors occurring when parsing QML singletons would just be ignored resulting in a crash. The errors are now properly printed and the execution is aborted in time. Fixes: QTBUG-85932 Change-Id: I61cef5f97546ce2e0753bc46c548838a21b1f506 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix warning and assert when removing items from groupsMaximilian Goldstein2021-01-112-1/+5
| | | | | | | | | When removing items from groups actively shown by a model filter a warning and assert was triggered in the past. This change fixes this behavior. Fixes: QTBUG-86017 Change-Id: I49b7498a3d03141b654e453a3c35a43fc7ba804a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Avoid crash for deep aliasesMaximilian Goldstein2021-01-111-0/+4
| | | | | | | | | Aliases are seriously broken and need a larger overhaul. This patch at least prevents the application from crashing. Task-number: QTBUG-89822 Change-Id: Ib6acc5b6f621a902f7f5ce370043986486f3c0d0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Encode target name into foreign_types.txt fileUlf Hermann2021-01-111-1/+1
| | | | | | | | Otherwise you cannot have multiple targets in the same directory. Change-Id: Ibf50a4e0752273965e4570527085787cf8060710 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Fix accidentally removed initialization of m_sizeJonas Karlsson2021-01-081-1/+2
| | | | | | | Removed in dfb36c91b401308f74a5bc635f9a77ba2f9872a0 Change-Id: I56bd239f068e51950cbe8b5d3df6fea92156d7fe Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* doc: Override the docs for the WheelHandler::acceptedDevices propertyShawn Rutledge2021-01-081-10/+21
| | | | | | | | | | | The existing docs were inherited from PointerDeviceHandler::acceptedDevices and contained the statement "By default, this property is set to AllDevices", which is true for many handlers, but not WheelHandler. Fixes: QTBUG-89861 Change-Id: I5227037ffbecedc8fdd19750e60c421383ec5581 Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
* Use new QTextureFileData::getDataView methodJonas Karlsson2021-01-074-22/+16
| | | | | Change-Id: Ib675bfaa3fd818ef3e372bc2affd87e0d9d8f480 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* QJSManagedValue: Add JavaScript 'function' typeUlf Hermann2021-01-072-11/+13
| | | | | | | | | 'function' is a separate type in JavaScript and should be treated that way. Replace the isCallable() method with a new isFunction() to reflect that, and add an entry to the Type enum. Change-Id: I09cc28a9edf8aa0380eb9caeb738dfc298a02567 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* Doc: Fix typos ECMA-26 and boolean value quotingNico Vertriest2021-01-071-3/+3
| | | | | | Pick-to: 6.0 Change-Id: I1bf34b68ecfa2d6eb8e687a0b12def5e7c96c318 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix EngineBase::globalObject being misalignedMaximilian Goldstein2021-01-061-1/+3
| | | | | | Fixes: QTBUG-85602 Change-Id: I7cdd83c16bec76c8f902c9136fa89decfc1cbd3d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Make software backend fallback automatic with vnc and similarLaszlo Agocs2021-01-051-0/+12
| | | | | | Change-Id: I3ce4494e9dddc9bf933793b354dc43494b3c84ef Fixes: QTBUG-89561 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Doc: mention that Item's childrenRect property is local to the itemMitch Curtis2021-01-052-0/+76
| | | | | | | | As opposed to being local to the item's parent. Pick-to: 6.0 5.15 Change-Id: Idcf2cdbedcac24a6890ce761c3f2a23f2c7a8dc4 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Doc: Fix broken QDoc markupPaul Wicking2021-01-051-2/+2
| | | | | | | | | \code must be closed with \endcode. Pick-to: 6.0 5.15 Fixes: QTBUG-89738 Change-Id: I0cadb14b6726a6fdc6c3fb773155066d30490e74 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Use the new, dedicated D3D surface type for QQuickWindowLaszlo Agocs2021-01-051-1/+1
| | | | | | | | | | This way any potential logic in the platform plugin that branches based on the surface type can now distinguish between OpenGL and D3D based windows. Fixes: QTBUG-89715 Change-Id: I01e9f8a525280982a9d4a18defb970e8a2fcc362 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* CMake: Make error in defer qmldir file generation more verboseAlexey Edelev2021-01-041-0/+5
| | | | | | | | | | | When CMake version >=3.19 is used, qmldir file for qml module is generated using DEFER CMake call. If find_package of Qml component was not explicitly called error message is not really obvious. Add explicit fatal error for this case and point to possible solution. Fixes: QTBUG-89622 Change-Id: I82fee717478461762deb2d66a1bc347680b48d06 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* doc: explain QQItem event delivery, handlers, setAcceptTouchEvents()Shawn Rutledge2021-01-041-4/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | We quietly recommended calling setAcceptTouchEvents() in the Qt 5.10 release notes in any Item subclass that wants to receive touch events, and in the docs for setAcceptTouchEvents() itself; but the message about the impending behavior change might not have been obvious enough. In Qt 6 it becomes mandatory, so clearer docs will hopefully help to stave off bogus bug reports. We also never had a great overview of event handling from an Item's perspective; now it's a little better. Followup to ab91e7fa02a562d80fd0747f28a60e00c3b45a01 and a97759a336c597327cb82eebc9f45c793aec32c9 [ChangeLog][QtQuick][QQuickItem] When subclassing QQuickItem, you should call setAcceptTouchEvents(true) if you need the item to receive touch events. It will be required in Qt 6. Pick-to: 6.0 Pick-to: 5.15 Task-number: QTBUG-87018 Task-number: QTBUG-87082 Change-Id: I1c7a43979e3665778d61949c9d37c1d085ed594b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Implement command for running qmllint on targetMaximilian Goldstein2021-01-041-2/+16
| | | | | | | | | Adds qt6_target_enable_qmllint which automatically picks up all QML files marked for processing by qmlcachegen which then can be checked using a ${TARGETNAME}_qmllint target. Change-Id: I1d228d3435e6ad2389e9885f55952231c69d38ec Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* definetypes.qdoc: Add note about include path prefixesMaximilian Goldstein2021-01-041-0/+1
| | | | | | | | | We do not allow for prefixes when using declarative QML registration. Task-number: QTBUG-87221 Change-Id: Ie1ce604390d49601a48217c71ba161f1b5f5e6e0 Reviewed-by: Erik Schilling <ablu.erikschilling@gmail.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* DesignerSupport: Don't skip already inspected objectsMiikka Heikkinen2021-01-041-9/+4
| | | | | | | | | | | | | | | Already inspected objects should not be skipped when determining their properties, as recursive call will always have different base name for the properties. Internally we don't need inspectedObjects list at all anymore, but it's kept to avoid changing API and in case the caller is interested in inspected objects. Fixes: QDS-3301 Change-Id: I76198b96d420e2a5ae6b13cfee65df4bce22d8f5 (cherry picked from commit 5e0ba6b797ca7843609fc19d8c4c96f6f26aacd2) Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
* QJSValue: Add a toPrimitive() methodUlf Hermann2020-12-192-0/+34
| | | | | | | We need a way to easily get a primitive from a QJSValue. Change-Id: I91a55d92ffa4ba6139b1e3f2e9308800b7047563 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QJSManagedValue: Throw an exception when trying to call a non-callableUlf Hermann2020-12-191-3/+18
| | | | | | | The JavaScript engine does this, so we should do the same here. Change-Id: I011a60bc2c013f19306c843da7a9c22dc80a39cb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QJSPrimitiveValue: Add a toVariant() method and ctor from QVariantUlf Hermann2020-12-181-0/+42
| | | | | | | | This is rather handy. Without it, we have to go through either QJSValue or QJSManagedValue, which causes much greater overhead. Change-Id: I40e2ecb6e2005f80c8f52b5e9a59028b3984eea4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add a QJSManagedValueUlf Hermann2020-12-1813-65/+1374
| | | | | | | | | | | | | A QJSManagedValue is a view on a QJSValue which always knows the engine the value belongs to. This allows us to implement the JavaScript semantics of the various QJSValue methods in a much more rigorous way. [ChangeLog][QtQml] The new QJSManagedValue should be used instead of QJSValue for manipulating properties and prototypes of JavaScript values, as well as for calling JavaScript functions. Change-Id: I9d445ffcf68dfa72dba9bae0818e83c80665ad66 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow JavaScript primitive type transformations inline in C++Ulf Hermann2020-12-1815-59/+1099
| | | | | | | | | | We don't want to call into the engine just for adding two numbers. This implements the most common operators on primitive JavaScript values. More are to follow in the future. Change-Id: Id51a5af59a3af9fec78a2d8f293e59e6567e9204 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Fix proxy iterationFabian Kosmale2020-12-171-2/+6
| | | | | | | | | | | If the target of a proxy was extensible, we did not set the iteratorTarget to its correct value, and thus the ForInIteratorObject would not be usable. Pick-to: 6.0 5.15 Fixes: QTBUG-86323 Change-Id: Id1924ac4087bab38c006b8eba92b619b79d36b7a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* JIT: When making memory writable, include the exception handlerUlf Hermann2020-12-177-18/+40
| | | | | | | | | | | | makeWritable() rounds the memory down to the next page boundary. Usually we include the exception handler this way, unless the offset from the page boundary is less than the exception handler size. Make it explicit that we do want the exception handler to be writable, too. Fixes: QTBUG-89513 Pick-to: 5.15 6.0 Change-Id: I2fb8fb0e1dcc3450b036924463dc1b40d2020c46 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix crash during model resetJoni Poikelin2020-12-171-0/+5
| | | | | | | | | | Commit 37fcffa035d55ac00f85f57ce1390fff3be213c6 fixed the issue for remove rows, but it can also happen with model reset. Fixes: QTBUG-83352 Pick-to: 6.0 5.15 Change-Id: I0ec1a67e822e4f8fe5b8f87f38dfae1f26b3fab5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQuickShapeGradientCacheKey: Fix a MSVC integer conversion warningFriedemann Kleint2020-12-171-1/+1
| | | | | | Pick-to: 6.0 Change-Id: Ie81bc6504cb79fbfe30d552a85016f5acf0ff6f3 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-12-1617-23/+23
| | | | | | | | | | | | | 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 QtDeclarative. As the two are synonymous, this patch should have no impact on users. Task-number: QTBUG-86829 Change-Id: I5bb418483a3b06619abb4ff62cf0290a7b3bcd4f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Automatically create qmllint targets for modulesMaximilian Goldstein2020-12-161-0/+18
| | | | | | | | Adds ${TARGET}_qmllint targets to every qt module using qmlfiles. You may specify additional import paths by adding them to QML2_IMPORT_PATH. Change-Id: Icb920756a26c49db5e8edb9c0f691b90af9d5311 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlfunctions.doc: Improve qmlRegisterSingleton documentationMaximilian Goldstein2020-12-151-4/+3
| | | | | | | | Reflect that qmlRegisterSingleton can't be used in conjunction with QML_SINGLETON. Change-Id: Ie7b2fd4f6fa5cb29806a212c284781799b796a32 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qqmltypeloader: Allow pluginless qmldir + declarative type registrationFabian Kosmale2020-12-151-1/+9
| | | | | | | | | | | | | | Assume an application which uses a QML singleton (so needs qmldir), and wants to use declarative type registration. This currently breaks because we find the qmldir, see that there is no plugin to load, and thus never search for registration functions. Requiring the creation of a plugin is rather pointless for an application which doesn't reuse the QML types; so instead enable this usecase to work. Note that qmldir + imperative registration did always work, as the imperative registration code did always run. Change-Id: Iac40020eb97d602d10eb8c4eecac5195ffeabe14 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* docs/QML_ELEMENT: Warn about possible namespace conflictsMaximilian Goldstein2020-12-151-0/+4
| | | | | Change-Id: I8fff0ba3e571273c203d4e566dcb604b75a835a8 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlMetaType: Remove lists setFabian Kosmale2020-12-112-6/+6
| | | | | | | | | | The information can be found in the metatype. Task-number: QTBUG-88766 Change-Id: I6c460e3100057498b17d9ed74d2e85b609a6ab4c Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlMetaType: Get rid of objectsFabian Kosmale2020-12-112-9/+6
| | | | | | | | | | | Use the information from the metatype instead. Task-number: QTBUG-88765 Task-number: QTBUG-88766 Change-Id: Ie0a748861388e8c36f5f607ccd5aba4d6049b930 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Clean up (QQmlEnginePrivate|QQmlMetaType)::toQObjectFabian Kosmale2020-12-112-9/+2
| | | | | | | | | | | | | | | All the necessary information is contained in the QVariant's metatype, so we can use that. This removes the need to acquire the data pointer lock. The method in QQmlEnginePrivate now simply forwards to QQmlMetaType; in a later commit, all usages of the forwarding functions from QQmlEnginePrivate will be replaced with the equivalents from QQmlMetaType, so that they can be removed from QQmlEnginePrivate. Task-number: QTBUG-88766 Change-Id: Iebcda9b18b4952fff2c7c1aeae210c677c6869b8 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Respect QML_DISABLE_DISK_CACHE also for caches built into the binaryUlf Hermann2020-12-104-8/+27
| | | | | | | | Previously it would only disable loading of separate cache files. Change-Id: Iae92fc03d2e5566ef7dc44a6730b788b7512fd3d Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Regenerate projects using pro2cmake one last timeAlexandru Croitor2020-12-105-20/+48
| | | | | | | | | And fix up some incorrect qmake project files Pick-to: 6.0 Change-Id: Ia6d27ac68195635021fe7c4a5f06386a60f3f323 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Support namespaced QML_ELEMENTMaximilian Goldstein2020-12-101-2/+9
| | | | | | | Fixes: QTBUG-87266 Change-Id: Iad8c7765b339c5498f541702bbf7df64164f5358 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>