aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* QQmlDelegateModel: build fixGiuseppe D'Angelo2021-04-201-1/+1
| | | | | | | | Capturing of `this` via `[=]` is deprecated in C++20. Be explicit. Pick-to: 6.0 6.1 Change-Id: Ic3b0a14c8eea83afbd17e97a2e3cdefbce045ff2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix C4267 warning in qqmlirbuilder.cppKai Köhne2021-04-201-2/+2
| | | | | | | Fixes: QTBUG-92966 Pick-to: 6.1 Change-Id: I9acdb0d624a0950f9e28c6463530b27d282123e2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Warn about multiline stringsMaximilian Goldstein2021-04-202-15/+56
| | | | | | Task-number: QTBUG-92448 Change-Id: Ic6305f05cb8a0af5c36ac03d8b541ac78cea0612 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Properly export QQuickDrag and QQuickDragAttachedUlf Hermann2021-04-201-2/+3
| | | | | | | Those are mentioned in the qmltypes. They should be available. Change-Id: I934f2b2282dfbee903d7b53b1e5ab0ca6ca46368 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Optimize property capture for known property cachesUlf Hermann2021-04-193-31/+61
| | | | | | | | If we already know the property cache and data we don't have to look them up again in captureProperty(). Such lookups can be expensive. Change-Id: I94553260311912c5acee3105295f124721203e01 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Clear passive grabbers on press in QQWindow not in DeliveryAgentShawn Rutledge2021-04-192-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | In case the window's main scene and a subscene both contain handlers, and one of the handlers in the main scene takes a passive grab on press, we don't want to lose it while we are delivering to the subscene. For example in Qt Quick 3D's dynamictexture example, if you click on one of the doors, the TapHandler in the View3D grabs on press; but the door also has a 2D subscene, which allows dragging (either dragging one yellow note item, or flicking the ListView). If you drag, the TapHandler does not detect a tap; if you tap, nothing gets dragged. So this is an example of a cooperative scenario involving multiple DeliveryAgents at the same time: a passive grab can occur in the main scene, an exclusive grab can occur in the subscene, and they don't interfere with each other. But if we clear the passive grab while delivering to the subscene, the TapHandler does not get a chance to detect a tap. So we should do that only once, when the window receives the press event. Amends 68c103225f4e8bd6c1b18ef547108fd60f398c0f Task-number: QTBUG-92944 Pick-to: 6.1 Change-Id: I9f064764a17b1efe758909f61fca6658f65d43e5 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* qqmlirbuilder: Fix treating parser warnings as errrosMaximilian Goldstein2021-04-191-1/+3
| | | | | | | | | | Previously parser warnings (i.e. inline components having lowercase names) were treated as errors. Because these were not handled properly this also resulted in the QQmlComponent with the warning never becoming ready. This resulted applications hanging instead of terminating. Pick-to: 5.15 6.0 6.1 Change-Id: Ia5ad3b54edc1b94dd94d0bf771c3494691abec71 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Document that QML_SINGLETON only works with QObjectsMitch Curtis2021-04-191-7/+8
| | | | | | Pick-to: 6.1 6.0 5.15 Change-Id: I18c38037cd635fa3300c761b16038b67ac3b0d74 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove documentation references to NVPR rendererAndy Shaw2021-04-192-44/+11
| | | | | | | | | | Since this is no longer supported, it is removed from the docs Pick-to: 6.1 6.0 Change-Id: Id23716594e6ea9fd3d05d88a2586d380d1db09db Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Nico Vertriest <nico.vertriest@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Optimize the case of AOT functions returning QObject*Ulf Hermann2021-04-191-6/+17
| | | | | | | | | | We don't need to go through all the metatype construction, conversion, and destruction if we know that both the expected and the actual return types are QObject pointers. We can just check if they're compatible and assign if they are. Change-Id: Ic5ab13536cf2e0e2a982ed9a9be81eb5927e85c2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Adjust to QProperty using eager evaluationFabian Kosmale2021-04-193-8/+10
| | | | | | | | | | | | Besides API changes, we need to - adjust QQmlBind to unlink the binding properly (that probably was broken already before, but did not cause issues so far, as the old binding would not have been evaluated without a read access) and - skip tests in tst_qmlcompiler_manual, as the bindings are executed before the engine is correctly set. Change-Id: I97b0ac32b428c1a033664fe8593effadb69cd348 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Don't pre-resolve the QQmlContext for AOT functionsUlf Hermann2021-04-194-8/+14
| | | | | | | | We only ever need it to retrieve the QQmlEngine. However, resolving the context can involve an allocation. Change-Id: I064fd528fa7ab9bd37043c5dd1c62d17ea9380e3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix qdoc warnings from wrong linking attemptsVolker Hilsheimer2021-04-191-7/+7
| | | | | | | | Document parameters with \a, and link to other members correctly. Pick-to: 6.1 Change-Id: I3529aa96fff0e5b78faa7438f40dc217de7b6262 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* qmllint: Warn about deprecated functionsMaximilian Goldstein2021-04-193-0/+22
| | | | | | | | | Now qmllint will also warn when functions have a Deprecated annotation which previously only applied to properties and elements. Task-number: QTBUG-84895 Fixes: QTBUG-79857 Change-Id: Ie1436822dc06bfd1ee4305a8468900409c3f8b0a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix build without features.qml-sequence-objectTasuku Suzuki2021-04-191-0/+2
| | | | | Change-Id: I2da9712201f3057b4d20aa0176716442d69d0ab9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix documentationVolker Hilsheimer2021-04-171-1/+1
| | | | | | | | | The '### Qt 7' comment between documentation and function definition breaks qdoc's matching logic, so put the comment above all that. Pick-to: 6.1 Change-Id: I4a6786422d8c30a257f09d630351a878c64bd377 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickTextInput: update cursor rectangle after padding changedWang Chuan2021-04-161-0/+5
| | | | | | | | | | The position of cursor delegate needs to be updated when we change padding, otherwise it will be in a wrong position. Fixes: QTBUG-91867 Pick-to: 5.12 5.15 6.0 6.1 Change-Id: I89ca84fe893ebf517ab67890196eede14a4055d7 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QQuickItem::forceActiveFocus(): actually force active focusShawn Rutledge2021-04-161-0/+12
| | | | | | | | | | | | | | | | | | | | It was trying to get by with setFocus() but that doesn't always work, in cases when the item's d->focus flag is true (leftover state) but it doesn't actually have focus anymore after a reparenting scenario. Item.focus represents the intention to be focused when possible, and does not necessarily change due to environmental circumstances, such as having its parent reparented. QQuickItem::setFocus(true) returns early if the new requested focus state is the same as the stored d->focus; so it was not enough for foceActiveFocus() to call only setFocus(). In the bug, TextInput and Loader both get stuck in the state d->focus == true, so forceActiveFocus() did not do anything before. Pick-to: 5.15 6.0 6.1.0 6.1 Fixes: QTBUG-89736 Change-Id: Ib7f4caccf81b60a02e2655332b64efba4d1fd7cf Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix documentation of QQmlListReference::sizeVolker Hilsheimer2021-04-161-1/+1
| | | | | | | | | Amends ca06d488f3c5d899c008b431f6939793813243cb. count was already documented. Pick-to: 6.1 Change-Id: I2f79d132f29ae03f03dd7204ea09e4841971d650 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlpreview: Fix preview position is out of scope warningMaximilian Goldstein2021-04-162-8/+11
| | | | | | | | When the position was restored with setPosition() in many cases the window size was invalid leading to a false "preview position is out of scope" warning. Task-number: QTBUG-83391 Change-Id: I8cdbc7701585b3cce526998fcdd25ed3c16fecbc Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* qmltyperegistrar: Do not omit change signals from qmltypes filesFabian Kosmale2021-04-162-21/+11
| | | | | | | | | | | | | | | qmltyperegistrar used to omit change signals from qmltype files if they had neither a version nor arguments. This does however cause issues with the semantic analysis of signal handlers, who in this case would not find the matching signal. Instead of adding additional logic in qmllint and any other place which might need that information, we now simply write out those signals, too. Pick-to: 6.1 Fixes: QTBUG-92372 Change-Id: Iaa6137c5d45f94e4874dc285e23a24f9c8319bb6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmltyperegistrar: Warn about classes using future revisionsMaximilian Goldstein2021-04-161-0/+27
| | | | | | | | | | | If a class using a future revision is registered for a module this can cause unforeseen consequences such as unintentionally bumping up the default version for unversioned imports. This has caused (among other bugs) the issue described below. Task-number: QTBUG-92861 Change-Id: I53e9e475ec2bc711c4a6e45900491364f7243f8f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qqmljsannotation: Use std::variant instead of QVariantMaximilian Goldstein2021-04-163-7/+45
| | | | | | | Makes it easier to reason about the values stored in QQmlJSAnnotation. Change-Id: I13bf8294a25f00edf78fad3b2b91fbc7a313d49e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Rework qmljsrootgenUlf Hermann2021-04-164-237/+1357
| | | | | | | | | This way it actually generates interesting data about the JavaScript types, for example the functions of the String prototype. Add a helper method to create a symbol to QJSEngine. This should be generally useful. Change-Id: I6c7b253b9d6cdb61602ceeae0955aed8d942c139 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix QQmlContext::nameForObject()Ulf Hermann2021-04-162-14/+42
| | | | | | | | | | | | | nameForObject() should not search the linked contexts. Linked contexts are not reachable from the "head" context in QML. However, it should search context objects, just like contextProperty() does. [ChangeLog][QtQml][Important Behavior Changes] QQmlContext::nameForObject() now finds properties of context objects, but it does not search unrelated other ("linked") contexts anymore. Change-Id: Ic6e01fddf3e2d4b3a1bc7308e126f47fae7cd6d1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Provide an objectForName() function in QQmlContextUlf Hermann2021-04-162-7/+53
| | | | | | | | This is the reverse of nameForObject(). We don't need to wrap id'd objects in QVariant just to unwrap them again at the call site. Change-Id: Ie1c5382af33b5c05b0b931fcc5bcf8d232d27c21 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix build without features.gesturesTasuku Suzuki2021-04-161-0/+2
| | | | | | Change-Id: I9c5cb83ad45b7af7060fee2fed593da7efae7158 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* CMake: Fix qml module version to use the repo project versionAlexandru Croitor2021-04-1534-34/+34
| | | | | | | | | | | Use PROJECT_VERSION instead of CMAKE_PROJECT_VERSION, so that the repo project version is used in a top-level build, rather than the version of the qt5 project. Pick-to: 6.1 6.0 Task-number: QTBUG-92861 Change-Id: I5a7a09baf81353558e512800746ac24e8e8b9a47 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Streamline retrieval of context property names and IDsUlf Hermann2021-04-157-45/+51
| | | | | | | | Most of this can be inline, and we never need to copy the actual identifier hash. Change-Id: I6468b6b1a571e4854c00c865a2aa57c3b2f0ca8c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix build without features.settingsTasuku Suzuki2021-04-151-1/+4
| | | | | Change-Id: I176a5b166bcdfdbfc13987d9f1d4a89e2e3d47b6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix build without features.textmarkdownreaderTasuku Suzuki2021-04-152-0/+6
| | | | | Change-Id: Ie385488133838fcbea8f848f595f45511a341fe0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix build without features.itemmodelTasuku Suzuki2021-04-154-27/+21
| | | | | Change-Id: I12073e43b34d7c72b441aaf081e4210a3161b4e8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Rename the AOT context to aotContextUlf Hermann2021-04-141-7/+7
| | | | | | | We want the "context" name for other things. Change-Id: I9dcc88a9a7c7f5e8c495ee29f57e2c9d15c4990f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qqmljsmetatypes: Use all members in operator== / qHashMaximilian Goldstein2021-04-141-1/+4
| | | | | | Change-Id: Iddcb4ce6859fb433f57e6449630dae39dd8e85f4 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix QQmlJSImportVisitor::visit(UiObjectBinding *)Andrei Golubev2021-04-141-12/+89
| | | | | | | | | | | | | | | | | | | | | | | | Visit UiObjectBinding shouldn't create any properties, otherwise we end up having invalid QQmlJSScope state in cases with attached properties (and maybe somewhere else) property QtObject prop: QtObject {...} is parsed as two AST elements: 1. As UiPublicMember, which handles a property definition "property QtObject prop" (and, consequently, creates the property) 2. As UiObjectBinding, which handles a property assignment "prop: QtObject {...}" As a drive-by, refine the endVisit(UiObjectBinding *), which sets the property type. Now, only update the property when property already exists and when the new property type has the same type hierarchy (in other words, property type must be a base of a new type). At the moment endVisit() issues an error if either of the preconditions is not satisfied Test the fix through tst_qmllint Change-Id: I149090ffe46ae86268dd2c3b0ec3713b6bde0627 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Check thisObject when calling various methods on URLUlf Hermann2021-04-141-38/+122
| | | | | | | | | We should not crash when you try to call them on the wrong object. Rather, throw a type error. Pick-to: 6.1.0 6.1 Change-Id: I1b146d9c77d838e013408988e02a65a623641f1f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* add "double" into the list of built in QML typesEvgeniy A. Dushistov2021-04-141-1/+1
| | | | | | | | | Also this fixed "property type checking" for qmllint in case of QML code like "property double xyz" Fixes: QTBUG-92566 Change-Id: Ice33be4287ce0eba2cf9dfaabb760406bdca02b7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Increment QV4_DATA_STRUCTURE_VERSIONFabian Kosmale2021-04-141-1/+1
| | | | | | | | | The bytecode format has been changed, as two new instructions were added. Amends 5f7ecce23321f499b1b002c32a27c63815535baa. Change-Id: Ie81651a48eec38b014e3bc859cc8ecb0cf8396d0 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmldom: astdumperFawzi Mohamed2021-04-144-0/+1193
| | | | | | | | Dumper for AST and support for comparison of AST trees. Derived and improved from test shared AST dumper. Change-Id: Ica4d30a1ca3b430ce0971b479b35048bed5d73d2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmldom: Improve basic infrastructureFawzi Mohamed2021-04-1417-464/+1237
| | | | | | | | | | | | | | | * introduce function_ref to represent a reference to a function and use it consistently (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0792r5.html) * restricted errormessage levels to those of QtMsgType * made path iterate on its segments * made path methods mirror the DomItem methods, so that path construction and access are similar * AttachedInfo to keep the location information * SourceLocation::combine Change-Id: I152c4cc2c601e867f205a4f4b7b3f24884d60ad9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qv4codegen: Fix codecheker warning about invalid base referencesMaximilian Goldstein2021-04-141-0/+1
| | | | | Change-Id: Ie5a229d7e62d8df356359094e7e6d38530672a43 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQuickTableView: add API to get column widths and row heightsRichard Moe Gustavsen2021-04-132-0/+111
| | | | | | | | | | | | | | | | | | Add a set of functions that can be used to query both the actual row and column sizes, but also what the implicit sizes are. The implicit size of a column is defined as the maximum implicit width found among the items in that column. This implicit size is just a recommendation that can be used by e.g HeaderView to resize a column to perfectly fit the contents. [ChangeLog][QtQuick][TableView] Added API to query row heights and column widths: columnWidth(col), rowHeight(row), implicitColumnWidth(col), implicitRowHeight(row). Fixes: QTBUG-92124 Change-Id: Id8adbd558dab670d4d1c0bb268105b56b898b72a Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickTableView: add isColumnLoaded() and isRowLoaded()Richard Moe Gustavsen2021-04-132-2/+85
| | | | | | | | | | | | | | | | | | | | TableView needs an API that lets you check if the delegate items inside a row or column is available for iteration from within the columnWidth/rowHeightProvider. This is especially needed since we call the providers several times when loading a new row or column - once to figure out if it's visible, and another time later, to get the width to use for layout when the items are loaded. [ChangeLog][QtQuick][TableView] Added API to query if a row or column is loaded and available for iteration: isRowLoaded(row) and isColumnLoaded(column). Fixes: QTBUG-92151 Change-Id: Iad0c9953a794bb6464b973f79e18826b4727fb47 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Implement optional chainingMaximilian Goldstein2021-04-1316-18/+460
| | | | | | | | | | | | | | | | | This change implements optional chaining (https://github.com/tc39/proposal-optional-chaining) by adding a new type of optional lookup with an offset to the end of a chain. If `undefined` or `null` is encountered during an access marked as optional, we jump to that end offset. Features: - Full support for all kinds of optional chain - With some codegen overhead but zero overhead during normal non-optional FieldMemberExpression resolution - Properly retains this contexts and does not need to resolve anything twice (this has been an issue previously) - No extra AST structures, just flags for existing ones [ChangeLog][QtQml] Added support for optional chaining (https://github.com/tc39/proposal-optional-chaining) Fixes: QTBUG-77926 Change-Id: I9a41cdc4ca272066c79c72b9b22206498a546843 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* doc: demystify QSGOpenGLTexture::fromNativeExternalOES()Shawn Rutledge2021-04-131-2/+3
| | | | | | | | | | | Plausible explanation comes from https://stackoverflow.com/questions/25618977/how-to-render-to-a-gl-texture-external-oes Amends c2c180e4ee58f8cfc104207b3b56e83ddcb7e79a Pick-to: 6.1 Change-Id: I9baba2119ea85823cda829d32859c4e45f757d09 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* QQmlJSImportVisitor: add find-or-create version of enterEnvironmentAndrei Golubev2021-04-132-3/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems that in cases of grouped and attached properties we don't want to create a new scope every time, but instead reuse the created one, falling back to create if the scope doesn't exist Consider: ```qml QtObject { myGroup.property1: 42 // case 1 myGroup.property2: "hello" // case 2 MyAttached.property1: 42 // case 3 MyAttached.property2: "hello" // case 4 } ``` The intuition tells that cases 1 and 2 should use the same shared scope "myGroup" and so should cases 3 and 4 both use the same "MyAttached". Creating a new scope each time for attached and grouped properties seems erroneous As a drive-by, add attached property type to tst_qmllint and test that this still works after the changes to the related code Change-Id: Ib1ae85b404a7954a3a3211cbd267c414b98ac59d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlJSImportVisitor: put name setting logic into a functionAndrei Golubev2021-04-131-4/+14
| | | | | | | | This would make the logic more visible for the reader (as it's in a separate function now) and also allow reuse Change-Id: I9a9aeaaab65163b7b5161fe9f793bdf0b8e7b554 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QV4::EngineBase: Remove pragma packFabian Kosmale2021-04-131-7/+0
| | | | | | | | | | | This was only used on a subset of our compilers, and caused issues with pointer alignment. We have static_assert's in place to verify that the struct members are in the correct place, and pack had no effect anyway after we added the alignment padding to the struct. Change-Id: I162664ec01d4b5d97ac800afc354d0ab2e04de42 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Check also property type namesEvgeniy A. Dushistov2021-04-132-6/+18
| | | | | | | | | | At the moment, qmllint only check the types of objects and classes being imported, it totally ignored types of properties that should be also imported. Fixes: QTBUG-92449 Change-Id: Ia5173bed84640d93fc48f6239179604ceb5db2cd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlJSLexer: Add support for peeking one QCharFabian Kosmale2021-04-132-0/+9
| | | | | | | | | This is helpful for the upcoming handling of ?., which needs to be treated as a single token (T_QUESTION_DOT), unless it is followed by a number literal. Change-Id: Id5e992bd037c2df88ef6e66905ec58a39bb67d73 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>