summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Fix internal boundNames() API to expose optional typesSimon Hausmann2019-07-093-25/+47
| | | | | | | This allows extracting the type information for variable declarations. Change-Id: I1241df3b27ae292b83392d5caaa1587caafa46a3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add basic type annotation support for QML functions to the grammarSimon Hausmann2019-07-098-96/+360
| | | | | | | | | | | | | | | | | | | | | | | | | Inspired by TypeScript syntax, allow optional type annotations in the style of ": <name of type>" in for the parameters of functions and their return type. These annotations are not used at the moment, so by default we produce an error message when encountering them in the AST. In addition their usage is limited to functions declared in the QML scope. All other uses attempt to produce readable syntax errors. So for example this is okay: Item { function blah(param: string) string { ... } } And this is not okay: // some file.js function blah(param: string) : string { ... } Change-Id: I12d20b4e2ce92e01108132975a06cfd13ba4a254 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* remove QmlIR::Document::removeScriptPragmasUlf Hermann2019-07-094-57/+0
| | | | | | | | | We don't need to blank the script pragmas as the parser will ignore them anyway. Change-Id: Id93e9ba0a6aacb38692cb294fb140d8ef99a2d23 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix standalone buildSimon Hausmann2019-07-091-0/+2
| | | | | | | | | The header file uses std::function and should include the corresponding header file and not rely on the includee to do that. Change-Id: Ic7a87aea4fcf49d17b0e5ef6c1aaf35424b66f01 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix build without quick_itemviewTasuku Suzuki2019-07-091-0/+2
| | | | | | Change-Id: Ice015e39d54d0e7c2f77b365195c986d7c9d1d92 Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Internal API cleanupSimon Hausmann2019-07-081-23/+38
| | | | | | | | | In QQmlPropertyCacheCreator, move the code to determine the meta-type for a signal parameter type into a helper function. Makes the code more readable and available for re-use later. Change-Id: I2876ed247d0c42f4e6d90872fa4b6a2dc4e1ba7e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Centralize property & signal parameter type handling at compilation timeSimon Hausmann2019-07-085-89/+102
| | | | | | | | Collect all that code in the Parameter class, which allows for future re-use for function parameters and return types. Change-Id: Ib9dfec9313dc3938634f9ce3a2e5a3a59a7135d9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Move the memory pool into the common codeUlf Hermann2019-07-088-84/+151
| | | | | | | We need it in both, the compiler and the runtime. Change-Id: Iffacb9d150bf9eef6ef477bfd427dbac9bf49359 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove some unneeded includesUlf Hermann2019-07-085-10/+0
| | | | | | Change-Id: Id05059dfc9910dad206e511b08f18487e241e508 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move qQmlCompileError to QQmlPropertyCacheCreatorUlf Hermann2019-07-082-10/+10
| | | | | | | | It's only used in the runtime. Change-Id: Iac1d9f5eabeae7fb8c1816be61d2f35711815dc9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix build without features.itemmodelTasuku Suzuki2019-07-087-12/+62
| | | | | Change-Id: Ia4304644a2a365c359eed31c55c2ca9d7d42f10c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix build without features.translationTasuku Suzuki2019-07-084-0/+16
| | | | | Change-Id: Ic97c0245f06e3181bc528dbeeaa56cc43a37e67f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove dladdr usage from masmTasuku Suzuki2019-07-082-18/+1
| | | | | | | string literal "QtQml" is entirely enough for the name here Change-Id: I62c43f3535998e358d7012b5a455f4e01bb3f1a0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Minor internal API cleanupSimon Hausmann2019-07-055-105/+107
| | | | | | | | Move Property::Type out into a standalone BuiltinType enum class, as it's also used in the signal parameters (and more in the future). Change-Id: I1125c954f6e45c7a1ce6fe2aae77c5f0e68455f5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Reduce the size of Property fields in type compilation dataSimon Hausmann2019-07-055-69/+81
| | | | | | | | We can shave off 4 bytes of each property declaration by sharing the bits for the custom type name index or the builtin type enum. Change-Id: I77071cbef66c5a83b3e7e281dba3a435d3c68b39 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Streamline Var property handling in QQmlVMEMetaObject::metaCallSimon Hausmann2019-07-051-158/+153
| | | | | | | | | Fold the Var handling into the general type switch. That allows decreasing the level of indentation for a large chunk of code in the function. Change-Id: I04d4efd310b798b28e7946924accdaf2e775c5aa Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Minor cleanup in QQmlVMetaObject::metaCallSimon Hausmann2019-07-051-7/+4
| | | | | | | | | We can move the notify signal activation right into the QMetaProperty::WriteProperty block. Change-Id: If3cb8f41d3e460b2cec28854dec69f92355f1746 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Clean up property type to meta-type mappingSimon Hausmann2019-07-053-59/+37
| | | | | | | | Centralize the mapping in one place using a helper function. This eliminates the table where the first field was unused as well. Change-Id: I78b599d255e37931a02a8294b1df3d44023c9a15 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Internal API cleanupSimon Hausmann2019-07-053-11/+5
| | | | | | | | | Fold the only member of Property::Flags into a straight boolean (bit) member. This makes the code easier to read. Change-Id: Ib621952cf5b28ce8de6293bff4ca9ebb1290fb36 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix enum mis-matchSimon Hausmann2019-07-051-1/+1
| | | | | | | | | Although in terms of values CompiledData::Property::Flags::IsReadOnly is identical with CompiledData::Alias::Flags::IsReadOnly, they are intended be values from distinct types. Change-Id: If65ce91e56e88605c20c074c62b97c11963ffed2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Reduce the size of signal parameters in qml cache dataSimon Hausmann2019-07-053-11/+15
| | | | | | | | We can reduce the distinction between a built-in type or a custom type down to a single bit. Change-Id: Ibe15d35357aa8c3948809f981221df29a40c400b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove unused field memberSimon Hausmann2019-07-052-4/+1
| | | | | | | | | The location member of signal parameters is not used at the moment, so let's remove it. Change-Id: Ia33bbe3bb79c382a78d61945c285b773b3492b55 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove unimplemented QSGTexture::hasDirtyOptions()Friedemann Kleint2019-07-051-2/+0
| | | | | | | | | The function does not have an implementation and causes a link error in Qt for Python. Amends 341ab7708049b1a3f559b76f16393e688951a938. Change-Id: I70bb24d14d19e1fc95916e7ba6e9ee6256414a95 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Make openglunderqml functional with and without the rhiLaszlo Agocs2019-07-046-33/+100
| | | | | | | | | | It has to be written following the new split approach (beforeRendering for resource setup, beforeRenderPassRecording to issue the actual underlay draw calls), but it will then work both with and without QSG_RHI=1. Change-Id: I9b7b35434aa0caec543cae268064b2684256382d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Enable line width on the rhi code pathLaszlo Agocs2019-07-042-16/+40
| | | | | | | | | | | | | | | | | | | | So examples like customgeometry show up as they should now, at least with OpenGL and Vulkan (when wide lines are supported). This way applications drawing lines on Qt Quick on OpenGL can continue functioning on Qt Quick on RHI on OpenGL as well. Those relying on drawing points with a size set from C++ and not from the vertex shader will need to migrate, but this has not been supported on OpenGL ES in Qt 5 either. Those wishing full cross-platform, cross-graphics-API compatibility should avoid relying on wide lines and points completely. The unsupported cases get a helpful warning now. Change-Id: If4255ccc46ad5d91a3a10d69d1c90260055037cc Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Enable request setting the (gl) context current on rhi pathLaszlo Agocs2019-07-042-19/+40
| | | | | | | This was disabled due to the unmerged qtbase api change. Change-Id: I38beb8f2aa11dc233765bcfe06e91940b64b5758 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Simplify codegen error handlingUlf Hermann2019-07-046-174/+173
| | | | | | | | | | There can only ever be one error, either a syntax error or a reference error. We record the error type as we want to get rid of the virtual throw<X>Error methods in favor of an explicit compilation result. Change-Id: Ie228490aad8efb7885083f6485f931299567f54c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge "Merge remote-tracking branch 'origin/5.13' into dev"Qt Forward Merge Bot2019-07-043-8/+10
|\
| * Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-043-8/+10
| |\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I20ad6f8a260f387a3b73566a32c35a5772b401a5
| | * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-033-8/+10
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Icd05d016de5b4cf9af5234cb47b5c3fd0f6a053e
| | | * QQmlDelegateModel: ref objects before allocatingUlf Hermann2019-07-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The allocation might run the garbage collector and that might delete the object before we ref it. Change-Id: I13cb74ab011a4eabc8df136023958791a2183df0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| | | * Fix read access violation when using KeyNavigation attached propertyTom Scheler2019-07-021-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting the KeyNavigation.up property of an item to another item will implicitly set the reverse (KeyNavigation.down) property on that other item pointing back to the item. Once the item is destroyed, you will have an invalid pointer stored in the other item pointing to the destroyed item. Using QPointer<> instead of raw pointers fixes that issue, because they will become null on QObject's destruction. Added QQuickItem test that verifies the issue is solved. Fixes: QTBUG-75399 Change-Id: Ibb3e976c4eb9fcd81604bcc2eb757257d3653930 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| | | * Fix bindings not being re-evaluated when changing context propertySimon Hausmann2019-07-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 7cb6dce1f3e140ea68d6b05281950f212fc99d38 introduced an optimization to remove bindings that after their initial evaluation had no dependencies or errors (such as when accessing properties not set yet). However when accessing a context property in a silent way -- using typeof -- then no error state is set and the binding is removed. Any later change of the context property results therefore in no binding re-evaluation. This patch skips the optimization on bindings that are associated with a context that has unresolved names. This fixes the concrete bug at the expense of disabling further optimizations in the context if other bindings access unresolved context properties. However since context properties are discouraged anyway, this may be an acceptable price to pay. Change-Id: I95e120a4f71e8ebe0ec1fc44e8703c75f920dd28 Fixes: QTBUG-76796 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | | extend grammar for better version parsing supportFabian Kosmale2019-07-048-18/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Be more strict in parsing version numbers This also makes it easier to access the version number in other places using the Visitor interface, like (soon) the linter and avoids reparsing the text twice. Potential disadvantages: previously allowed import statements will rejected at parse time, e.g. import QtQuick 0b10 Potential further advantage: Weird import statements like import QtQuick 0b10 will be rejected earlier Change-Id: Ifcd187b79a90952bc964c688afa4ea9b158e5109 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | | Eradicate Java-style iterators and mark the module free of themMarc Mutz2019-07-043-63/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Java-style iterators are scheduled to be deprecated, or at the very least banned from use in Qt's own implementation. Change-Id: I6a1aeceb22dfa13c4ed7443296455b60abed7d67 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | | QQuickState: fix quadratic loopMarc Mutz2019-07-041-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QMutableListIterator::remove() is a linear operation, so calling it in a loop makes the overall loop quadratic. Fix by using std::remove_if + lambda, which is linear. Change-Id: Ia37b0ff947bd214d3b411dc4c274bf673c7f5577 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | | Fix crash when binding to QML componentFabian Kosmale2019-07-041-3/+3
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | As the properties were missing their context, we could not get the correct QMetaObject and would trigger an assertion in canConvert. We now always set the context when creating QQmlProperties in qqmlbind. Fixes: QTBUG-40487 Change-Id: I766c5697dc33fc1e18c2316e28d944975e84ae3c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Add the graphics api independent scenegraph portLaszlo Agocs2019-07-04234-2106/+14066
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Opt in via environment variables: QSG_RHI=1 -> enable using QRhi instead of GL QSG_RHI_BACKEND -> set to vulkan, metal, d3d11, gl to override the default (the default is d3d11 on Windows, metal on Mac, gl elsewhere) Or force a given rhi backend via the existing QQuickWindow::setSceneGraphBackend(). Otherwise the default behavior is the same as before, the rhi code path is never active by default. -no-opengl builds are supported in the sense that they work and default to the software backend. However, the rhi code path cannot currently be used in such builds, even though QRhi from qtbase is fully functional with Vulkan, D3D, or Metal even when qtbase was configured with -no-opengl. This cannot be utilized by Quick atm due to OpenGL usage being all over the place in the sources corresponding to the default backend, and those host the rhi code path as well. This will be cleaned up hopefully in Qt 6, with the removal all direct OpenGL usage. Other env.vars.: QSG_RHI_DEBUG_LAYER=1 -> enable D3D debug or Vulkan validation layer (assuming the system is set up for this) QSG_RHI_SHADEREFFECT_DEBUG=1 -> print stuff from ShaderEffect QSG_SAMPLES=1,2,4,... -> MSAA sample count (but QSurfaceFormat works too) QT_D3D_ADAPTER_INDEX=0,1,... -> D3D adapter index QT_VK_PHYSICAL_DEVICE_INDEX=0,1,... -> Vulkan physical device index QSG_RHI_UINT32_INDEX=1 -> always use uint index data (both merged/unmerged, convert when needed - with some rhi backends this is implicit) QSG_RENDER_LOOP -> to override the render loop as usual. The default with RHI is threaded for Metal, threaded for Vulkan on Windows, basic for Vulkan on Linux and Android (to be checked later), while the existing rules apply for OpenGL. Not supported when running with QRhi: - particles - compressed atlases (though this is transparent to the apps) - QSGRenderNode - QQuickRenderControl - QQuickFramebufferObject - certain QQuickWindow functionality that depends directly on OpenGL - anisotropic filtering for textures - native text may lack some gamma correction - QSGEngine applicability unclear - some QML profiler logs may be incorrect or irrelevant Change-Id: I7822e99ad79e342e4166275da6e9e66498d76521 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | QQuickState: replace some Java-style iterators with C++11 ranged-for loopsMarc Mutz2019-07-032-26/+8
| | | | | | | | | | | | | | | | | | | | | | | | More succinct, less code generated, and Java-style iterators will be deprecated at some point in the future. Change-Id: I17b9369669e7c494083f09c26ec3e7f06917f13d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | qtlite: Fix build with -no-feature-cursorMikhail Svetkin2019-07-031-0/+4
| | | | | | | | | | | | | | | | | | | | | Change-Id: I10140b5b2bb6c08e9de6c0300377466325ba4bde Reviewed-by: Timo Aarnipuro <timo.aarnipuro@qt.io> Reviewed-by: Tasuku Suzuki <tasuku.suzuki@qbc.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Intercept image source urlFabian Kosmale2019-07-031-0/+5
| | | | | | | | | | | | | | | | | | | | | Fixes: QTBUG-55027 Task-number: QTBUG-76879 Change-Id: Id0c7b33cf22827ebc984c4ee848ef4f63c359b20 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | When setting a QObject as context property reset it when it's destroyedUlf Hermann2019-07-032-0/+19
| | | | | | | | | | | | | | | | | | Fixes: QTBUG-76346 Change-Id: Ie21f831a775489f0f2ac2e296136ed4932f5154f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | use boolean for when propertyFabian Kosmale2019-07-024-14/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QQuickState used to store "when" as a QQmlBinding to reduce state oscillation. It is unclear whether this is still an issue, but it breaks if a user sets "when" to a primitive value like "true" or "1". Fixes: QTBUG-76838 Change-Id: If400e5b1283687838ed252be2dfa52067f44564e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | QQmlApplicationEngine: delete translators through their parentsTasuku Suzuki2019-07-022-18/+7
| | | | | | | | | | | | | | | | | | | | | QQmlApplicationEngine doesn't need to manage it by itself. Change-Id: Ib954a97caf5b36093a032220f349057fcf804090 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | QQmlApplicationEngine: delete unused translator earlierTasuku Suzuki2019-07-021-2/+5
| | | | | | | | | | | | | | | Change-Id: I4161624c663ff87bbf9385991cd65027dd5cfd5f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | QQmlEngine: Hoist some allocating code out of critical sectionsMarc Mutz2019-07-021-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | ... so the lock is held for shorter durations. Add optimistic std::move()s. Change-Id: I9e09e11a6e54b7ac4be3e23f06d65b3b7abc4fc0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Port from implicit to explicit atomic operationsMarc Mutz2019-07-026-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code used the implicit conversions from QAtomicPointer<T> to T*, and QAtomicInteger<T> to T, and vice versa. The semantics of these differ from the ones std::atomic uses, so we're going to deprecate these, like we did for load() and store(), too. This patch fixes some users of these APIs before we deprecate them. Change-Id: I892d705c22280f1c6fdc62c1777248b44e9c4329 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Fix some const-correctness issuesMarc Mutz2019-07-022-4/+4
| | | | | | | | | | | | | | | | | | | | | Found by locally making QExplicitlySharedDataPointer propagate const. Change-Id: Ib8fdb28420d0470ca839d0cab15439e23165a3e2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-0112-34/+131
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | Conflicts: src/imports/imports.pro src/qml/qml/qqmlmetatype.cpp Change-Id: I308436caf55402cb2246cb591c6ac8f83e1febf8
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-06-285-12/+58
| |\ \ | | |/ | | | | | | Change-Id: I59343fe228ca6b823b61577e5a0907e7381899c2