Commit Graph

19018 Commits

Author SHA1 Message Date
Qt Submodule Update Bot 90cdbe504e Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: Icc9c977cb2517d77a7c76db19cb804934891341f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-25 18:44:03 +01:00
Fabian Kosmale f615541442 qqml.h: do not use QML_REGISTER_TYPE(QObject)
This breaks code if the following circumstances all apply:

- A project is compiled with CMake using AUTOMOC
- It contains a class with a property of type QQmlList<QObject>
- In the resulting mocs_compilation.cpp, qqml.h is (transitively
  included).

Then, a use of QMetaTypeId<QQmlList<QObject>> will be in a
single file before its definition. The use comes from the instation
of qt_metaTypeArray. The explicit specialization comes from QMetaTypeID,
and happens afterwards (depending on include order).
gcc does not like this, and the compilation fails. There is probably no
reason for QML_REGISTER_TYPE(QObject), so we just remove it.

Removes the Q_DECLARE_METATYPE(QVariant), too, while we're at it.

Change-Id: Ia6607c31af92dadd809633188bb82fa90efaf922
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-03-25 13:47:33 +00:00
Ulf Hermann 3f0c9122c5 Encapsulate QV4::ResolvedTypeReference
It's used all over the place. We need a proper interface.

Change-Id: Iebe254ef3bf35503bf3fdd3639979a5db2b3449e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-25 10:51:47 +01:00
Ulf Hermann d9eeab6e2c Make QQmlType::inlineComponentObjectId() const
It does not modify anything.

Change-Id: I88630ba60c6123fc6dbc78d7e74225c8d3d01345
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-25 10:11:03 +01:00
Qt Submodule Update Bot 944edcf817 Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: Ib4aea592f75c7defd7f633416406c48f3462e5e6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-25 09:36:55 +01:00
Shawn Rutledge 99215e04e3 Screen example: avoid shadowing final props with required context props
Amends 90b4528b84 to fix the error
qrc:/window/AllScreens.qml:75 Cannot override FINAL property

Change-Id: Ie6528f6c9ccc6648ec76b4d237973588450cc932
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-03-24 23:11:31 +00:00
Ulf Hermann 581250ff9e Fix typo: inlineComponendId -> inlineComponentId
Change-Id: Ic0c768fc2402d8674e06e84dfe4dc90d05407167
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-24 19:05:05 +01:00
Laszlo Agocs 1a1028a1e4 Move legacy rendercontrol example into a subdirectory
...called rendercontrol_opengl under examples/quick/rendercontrol. This
example is going to be migrated to support operating with RHI-on-OpenGL
later on.

Additionally, we can this way introduce more rendercontrol examples in
the future, for example to show how to do things with Vulkan, Metal,
D3D.

Task-number: QTBUG-78595
Change-Id: I7f5243b1f86e62949400107bf12bfa07b17b1031
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-03-24 17:03:12 +01:00
Qt Submodule Update Bot 40e27dd547 Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: I492272278c93488ec4ab921c3394929e684c183c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-24 16:03:31 +01:00
Qt Forward Merge Bot 73894987a2 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I9f0d5adf1ba7d3246b1107a20d145e7aac2c7a77
2020-03-24 01:00:15 +01:00
Ulf Hermann 8aa1379951 QQuickEvents: Delete pointer devices on shutdown
Letting them leak makes ASAN report false positives.

Change-Id: I59dfcdffa380294cada9b79c11af0faaab38e3a0
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-03-23 16:36:29 +01:00
Fabian Kosmale 861f53d60c PropertyUpdater: Do not crash on invalid context
If the context is gone, we assume that the object is
currently torn down. Therefore we do not print an error
message in that case.

Fixes: QTBUG-82809
Change-Id: I74e5a4f41490ea9c13639c158a4d5fc0a52a38a4
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-03-23 15:22:38 +00:00
Mårten Nordheim d7e847ba25 QNetworkReply: fix use of deprecated error signal
Task-number: QTBUG-82605
Change-Id: I015547da20dd38c4de75f21c1896d53e1ca355c2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-03-23 15:45:27 +01:00
Richard Moe Gustavsen 2d99c751cc QQuickTableView: add private support for transposing the view
This is needed by HorizontalHeaderView when assigning it one
dimensional models.

Change-Id: I183f0d35b8f3a97853fc7496dc68b0e13e9be990
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-03-23 15:37:37 +01:00
Simon Hausmann 67b73ad009 Minor cleanup in QQmlJavaScriptExpression
We _can_ provide a default implementation for expressionIdentifier() -
it doesn't have to be located in QQmlBinding as it only uses fields from
QQmlJavaScriptExpression.

Change-Id: Ifcead72c4f3ed4597cde732afca466eba83f5e0d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-23 15:01:53 +01:00
Mitch Curtis 619dfbe8d0 StackLayout: add attached index, isCurrentItem, and layout properties
These properties are useful for items within StackLayout to get access
to their index within it, especially when those items are
declared in their own QML files. Similar API already exists for e.g.
ListView and SwipeView.

[ChangeLog][StackLayout] Added attached index, isCurrentItem,
and layout properties.

Change-Id: I648d4434ab21573b56edd9a0f8399463946fd571
Fixes: QTBUG-76999
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-03-23 14:01:16 +01:00
Laszlo Agocs 8a7e8190b7 Add autotest for QQuickRenderControl
Let's celebrate the feature's 6 year anniversary with introducing an
autotest for it.

Also happens to be good sample code for generating image sequences from
animated Quick scenes driven by a custom animation driver.

Tied to (direct) OpenGL at the moment. The RHIified version will appear
eventually as the work for introducing RHI support in QQuickRenderControl
progresses.

Task-number: QTBUG-78595
Change-Id: I7294ce986dca9968407ae738afe7ed2640ecd103
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-03-23 12:18:37 +01:00
Qt Submodule Update Bot b9c7f8989b Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: I2b900c0caad33b0f54c5ebf918ad5ea12f023ee5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-23 12:03:32 +01:00
Ulf Hermann d51c007ecc Encapsulate QQmlContextData
This class is not a private detail of QQmlContext. And it is incredibly
hard to see who owns what in there. Let's add some civilization ...

We enforce refcounting for QQmlContextData across the code base, with
two exceptions:

1. QQmlContextPrivate may or may not own its QQmlContextData.
2. We may request a QQmlContextData owned by its parent QQmlContextData.

For these two cases we keep flags in QQmlContextData and when the
respective field (m_parent or m_publicContext) is reset, we release()
once.

Furthermore, QQmlContextData and QQmlGuardedContextData are moved to
their own files, in order to de-spaghettify qqmlcontext_p.h and
qqmlcontext.cpp.

When the QQmlEngine is deleted, any QQmlComponents drop their object
creators now, in order to release any context data held by those.
Before, the context data would be deleted, but the object creators would
retain the dangling pointer.

[ChangeLog][QML][Important Behavior Changes] QQmlContext::baseUrl() does
what the documentation says now: It prefers explicitly set baseUrls over
compilation unit URLs. Only if no baseUrl is set, the CU's URL is
returned. It used to prefer the CU's URL.

Change-Id: Ieeb5dcb07b45d891526191321386d5443b8f5738
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-23 12:00:33 +01:00
Ulf Hermann c83a39fd46 tst_qqmlpreview: Increase timeout
macOS does some interesting scheduling and takes up to 20s to generate
those 10 frames. We're generous and allow for 30s.

Change-Id: I1e2e8b5282f8e46cdf01e3501c83924d853c67a4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-23 11:59:42 +01:00
Ulf Hermann af57d45003 QQmlValueTypeWrapper: Avoid compile warnings
The type names are expected to be UTF-8 and we don't need to keep
temporary meta types.

Change-Id: I676d04d8733ef0ea3e159038d4973753350572bf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-23 10:54:47 +01:00
Ulf Hermann ea775373c5 QQuickViewTestUtil: Don't leak on matchAgainst()
QTest::toString() returns a bare pointer to a heap-allocated character
array. We need to delete it.

Change-Id: I5a5cf1054e582af21e784595c00646d5b4fc0b7f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-23 09:58:53 +01:00
Ulf Hermann bc30b5f3b4 tst_qquicklistview: Fix a few memory leaks
Change-Id: I8bcd06ce79e1d6795a8249df6f72d4b583dbfa28
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2020-03-23 09:58:47 +01:00
Ulf Hermann ba2fe5ec6c QQmlDelegateModel: Don't require a delegate to cancel an incubation
It is actually not needed, and declining to cancel the incubation leaks
memory.

Change-Id: I478ed2a4eef34bd27c716762a2fced1e9091607c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-23 09:58:41 +01:00
Ulf Hermann 29fc018b74 QQmlDelegateModel: On deletion, cancel any remaining incubations
This fixes the memory leaks from the "x items in the process of being
created at engine destruction" situation.

Change-Id: I65fe278ead3d4de0cbddc075972a6774b231814f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-23 09:58:34 +01:00
Lars Knoll 7edb2d2e65 Add MatchRegularExpression flag
This is there to stay consistent with C++, where MatchRegExp
is deprecated and will in Qt6 be an alias to MatchRegularExpression.

Change-Id: Ibbb0885dddebaba3464e93cc6a0d05e94c01f4e1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-03-20 12:38:13 +01:00
Ulf Hermann 34a5567ae6 tst_qquicklistview: Don't use QTest::toString()
This construction leaks the resulting character array. You need to
actually delete[] it. However, we can be pretty sure that there are no
questionable characters in those strings. Therefore we can just use
qPrintable instead.

Change-Id: Ib863f0ed7db800680a44df534e3b46a4ba807798
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-20 09:49:01 +01:00
Ulf Hermann 4656ea5252 QQuickView: Don't leak root object in error case
Change-Id: I506c944fe3a472b3950d66167089054e91dd942c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-20 09:48:51 +01:00
Qt Forward Merge Bot 1eef06e64f Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I6f320ea43b5837444226228c118e57c4bda8702a
2020-03-20 01:00:59 +01:00
Qt Submodule Update Bot 4b0034a01c Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: Ibf330266f2aef4d68857caea5039f9e14d4aa986
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-19 19:35:31 +01:00
Ulf Hermann f726d23727 qmllint: Break inheritance cycles
Previously we would run into infinite loops on those. Mind that qmllint
will reject a file called Window.qml that imports QtQuick.Window and
then instantiates a Window {}. Such a thing is bad style.

Task-number: QTBUG-82817
Change-Id: I6db82ca1794c3020dcb7d7e837fe44f72bca5029
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-19 16:37:44 +01:00
Ulf Hermann 75563fa761 Clean up QQmlFileSelector
The global static map of file selectors is not thread safe. If you add a
file selector to engine A running in thread 1, you cannot at the same
time retrieve the file selector of engine B running in thread 2. Alas,
we only need the static map to discern file selectors from other URL
interceptors, and we only need to do this on QQmlFileSelector::get(),
which we don't use. Unfortunately it is public API, though.

Deprecate QQmlFileSelector::get() and add a different hack to discern
the interceptors for the case that it's still called. Also remove the
duplicate setExtraSelectors() method.

For this to work, we also add a method to QQmlApplicationEngine that
allows us to pass extra file selectors and delay the initialization of
QQmlApplicationEngine's QQmlFileSelector until the first file is loaded.

[ChangeLog][QML] QQmlFileSelector::get() is deprecated. You can use the
new method QQmlAplicationEngine::setExtraFileSelectors() to pass extra
selectors to QQmlApplicationEngine's internal QQmlFileSelector.
Manually created QQmlFileSelectors should be configured immediately
after creation, before they are used by the QQmlEngine.

Change-Id: Ia61a93777dc910b441a03ffb42d35a2a224c0e26
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-19 15:04:55 +01:00
Norihito Tohge 266dbbef1f Doc: Add missing documentations of Window Type signals
Task-number: QTBUG-82705
Change-Id: I78a614c47a0f7d95b2a215d94e964c1202d89bcf
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-03-19 17:34:59 +09:00
Qt Submodule Update Bot 585ee10c63 Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: I241886ecb71c0e28b6eee324df83578b68249eb3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-19 09:09:37 +01:00
Allan Sandfeld Jensen 056016a1d8 Fix copy-pasted typo minimimal -> minimal
Change-Id: I4afef3fdbb9e3c3ec20ba5d00307992131b9ba3e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-03-18 22:03:50 +01:00
Fabian Kosmale 61406f7619 qmlRegisterSingletonInstance: show user-friendly signature in documentation
Change-Id: I50ee4c014acf3f95d00a38c6d115776143688c8e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-18 20:41:09 +01:00
Fabian Kosmale d097d77ece fix developer build on clang
Change-Id: I413cbce42d7405b17eff18293a68c2a26f30fd08
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-03-18 16:52:19 +01:00
Fabian Kosmale df6d816fe3 QQmlPropertyCache: Avoid costly string comparison
The qqmlecmacsript required changes, because the call to id makes the
type now known to the QML engine.

Change-Id: I73aed804ae8769c71676b44d8450e1dabf5baa6d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-03-18 16:37:01 +01:00
Qt Forward Merge Bot 2757f8e0e1 Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-03-18 16:35:17 +01:00
Ulf Hermann 748411fa64 Store a QV4::ReturnedValue in QJSValue
Being careful, we can now save primitive values inline. We use the heap
pointer of QV4::Value as either QString* or QV4::Value* for complex
types. We cannot store persistent managed QV4::Value without the double
indirection as those need to be allocated in a special place.

The generic QVariant case is not supported anymore. The only place where
it was actually needed were the stream operators for QJSValue. Those
were fundamentally broken:

* A managed QJSValue saved and loaded from a stream was converted to a
  QVariant-type QJSValue
* QVariant-type QJSValues were not callable, could not be objects or
  arrays, or any of the special types.
* Cyclic references were forcibly broken when saving to a data stream.

In general the support for saving and loading of managed types to/from
a data stream was so abysmally bad that we don't lose much by dropping
it.

[ChangeLog][QML][Important Behavior Changes] When saving a QJSValue to a
QDataStream only primitive values or strings will be retained. Support
for objects and arrays was incomplete and unreliable already before. It
cannot work correctly as we don't necessarily have a JavaScript heap
when loading a QJSValue from a stream. Therefore, we don't have a proper
place to keep any managed values. Using QVariant to keep them instead is
a bad idea because QVariant cannot represent everything a QJSValue can
contain.

Fixes: QTBUG-75174
Change-Id: I75697670639bca8d4b1668763d7020c4cf871bda
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-18 16:35:02 +01:00
Lars Knoll 7230005ef6 Remove QRegExpValidator usages
This also means the RegExpValidator QML type will be gone. Use
QRegularExpressionValidator instead.

[ChangeLog][QtQuick][RegExpValidator] The RegExpValidator QML type has
been removed. Use RegularExpressionValidator instead.

Change-Id: If25fc5a258a669dfd28e705271757caa252ce05c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-18 16:02:36 +01:00
Qt Forward Merge Bot 13caf26b29 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	tools/qmllint/findunqualified.cpp

Change-Id: I2593b5cc0db1d14e0c944aec4b88a80f46f5b0c1
2020-03-18 12:37:04 +01:00
Ulf Hermann c5b48c735e Also support partly specified versions in JS .imports
Task-number: QTBUG-71278
Change-Id: Ie3167d44780a192b5010052eea5192eee8c21c32
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-18 11:00:31 +01:00
Laszlo Agocs b1e89b5766 rhi: Enable layer updateTexture(), and so grabs, in the sync phase
Calling updateTexture() from an updatePaintNode() implementation means
we are still in the synchronization phase, with the render step (as in
QQuickWindow::renderSceneGraph()) not started yet. Make sure the
QRhiCommandBuffer is sent around early enough, so it is usable by
QSGRhiLayer already during sync.

There is no use case for this in Qt Quick itself since all standard
items invoke updateTexture() from QSGNode::preprocess() (which is part
of the render, not the sync, step), but Qt Quick 3D relies on this in
Texture.sourceItem.

This should fix the sourceitem manual test in Qt Quick 3D, so that it
will not crash anymore when running with RHI enabled.

Task-number: QTBUG-82927
Change-Id: I38adf512e49b1c6eef4730cd23663d351725d6cd
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-03-18 10:17:01 +01:00
Alexandru Croitor 36fb7cf832 CMake: Remove testlogger.js from qmldir
Install it, without adding it as entry to the generated qmldir
file.

Change-Id: I0b63d4069767e2ad21afcf94741212d14ceb2745
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-17 16:11:20 +01:00
Alexandru Croitor bb1998e29d CMake: Handle QT_QML_SKIP_QMLDIR_ENTRY property
Add a new source file property QT_QML_SKIP_QMLDIR_ENTRY which tells
the build system not to add the source file as an entry in the
generated qmldir file.

This is useful to mark a file for installation via
qt6_target_qml_files without exposing it as a QML
type (like a helper javascript file).

Change-Id: I2aa595692bcbb65925635abc1b12519d1a45fe53
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-17 16:11:13 +01:00
Ulf Hermann f4937a21b6 Allow multiple URL interceptors per engine
We may want to have, for example, a QQmlFileSelector and a
component-specific interceptor that chooses a theme or similar.

Also, make the API public. We want to propose this as alternative to
dynamically registering QML files via qmlRegisterType(QUrl, ...).

Change-Id: I4a535d3ea556da6710fde816579ec188b3f57099
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-17 14:44:26 +01:00
Ulf Hermann 1eb20d7061 Allow partial and absent version specifiers in import statements
An import statement without version specifier imports the latest version
available, one with only a major version imports the latest minor
version from that major version.

Task-number: QTBUG-71278
Change-Id: I43907ae4e1052be533039d545de5391c41d38307
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-17 14:44:17 +01:00
Friedemann Kleint e3c64aff65 qsgrhisupport.cpp: Fix warnings
scenegraph/qsgrhisupport.cpp: In member function ‘void QSGRhiSupport::applySettings()’:
warning: ‘QSting::QString(const QByteArray&)’ is deprecated
scenegraph/qsgrhisupport.cpp:161:102: note: in expansion of macro ‘qPrintable’

scenegraph/qsgrhisupport.cpp:585:112: warning: ‘void QAbstractSocket::error(QAbstractSocket::SocketError)’ is deprecated

Change-Id: I848e089f9d6d26fcb7f44e9e83883f5f971eba3e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-03-17 14:24:35 +01:00
Tor Arne Vestbø a5df29201f CMake: Update Apple platform defines after rename in qtbase
Change-Id: Ia0a075e3199eab735f9b289873beeb8730ebc47e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-17 10:42:00 +01:00