The qmldom part of qtdeclarative must compile against Qt 6.3. To avoid
special teatment regarding the automated port to Q_UNREACHABLE_RETURN
in a subsequent commit, add a simplified version of the macro to the
existing compatibility layer in standalone/private's
qtqmlcompilerexports_p.h.
Change-Id: Id6b2baa476ad8200518ce7b8619a05420dd331a0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
As it stands now it would often end up crashing with inline-declared
sources. Pre-6.5 this used old-style connects with a different QObject
(the separate ShaderEffectImpl object no longer exists in dev) which
survived. The new approach with passing in the QQuickShaderEffect as
the connect's 'context' is apparently not safe due to the order
during destruction, leading to missing on destroyed() signals when
QObject deletes children (during the QQuickShaderEffect destruction
process) and thus ending up invalid objects in our source table. This
is also closer to what we did pre-6.5.
Fixes: QTBUG-107772
Change-Id: If1322b2525075af6e7091c6a58be8f2ad32a8587
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
'size' and 'rect' are names that should be avoided. In Qt 6 newer
code, such as QRhi, explicitly uses pixelSize instead of size, and
this is visible in some of the newer Qt Quick code as well, but old
code from Qt 5 times suffers from confusion still: even though on
the scenegraph level "everything" is in pixels, there are things
that aren't, for example the "rect" that gets passed to the
projection matrix calculation is in logical units! Comprehension
and maintenance gets challenged also when there are higher level
"size", "rect", "textureSize", etc. kind of names in QQuickItem
and elsewhere that are not necessarily in pixels yet can be
mistaken to map 1:1 to the scenegraph data.
Try to indicate this in argument and member names.
Also add a missing word to the QSGTexture docs. The overview
mentions this in fact but the function doc does not.
Task-number: QTBUG-107691
Change-Id: Idef7a83a2194ba5c0e3b12b1c0115b2b13fb7d66
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
More autotests should test mouse, especially touch and maybe tablet
events, with similar expectations, instead of testing mainly mouse and
mostly neglecting the other device types. This makes it easier to work
with data-driven tests that take specific QPointingDevice instances as
test data.
Started using them in tst_TapHandler::gesturePolicyDragWithinBounds()
which was already data-driven by device type. Clearly, this code is
now easier to read and less repetitious.
In tst_qquickwindow::subclassWithPointerEventVirtualOverrides() the
improvement is somewhat smaller, but this test validates that
tablet events are working.
Change-Id: I74d0fcc2f082af3737a0754c58205fa2b18c1a2d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The test has been blacklisted on openSUSE Leap due to flakiness.
The flakiness results from system tray messages popping up, stealing
focus from test widgets and interfering with mouse emulation.
This patch adds functionality that tries to regain focus in case of an
interference. The test will time out, if that attempt fails.
Fixes: QTBUG-78153
Change-Id: Ifcab3990166bdf6b6fbc8a8cd4554b22130336c2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
We want to trigger the qFatal() when running qmlcachegen or qmlsc, but
we don't want to trigger it in qmllint, even if we are using the same
QtMsgType for the severity of the messages.
In turn, demote qmlCompiler messages to QtWarningMsg in qmlcachegen.
Pick-to: 6.4
Task-number: QTBUG-107168
Change-Id: Ib660df41742b2d426241eb29ac4c91f4933c5ba1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This enables us to forgo manual object lifetime control.
Change-Id: I50894d685d98eae8b18d49c52eafa66984a8429f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
A DelegateModel for a table model passed to a TableView
is one-dimensional.
Fixes: QTBUG-104960
Pick-to: 6.4
Change-Id: I8bb9aeff929f6964ae8986a04738a94356c89595
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The implementation of modal blocking for input events is distributed
over several Qt Quick classes. It's partially implemented by the overlay
handling mouse events for children (via childMouseEventFilter),
partially implemented via eventFilter, and partially happens to work if
the overlay is the top most item under the mouse.
These incomplete implementations only consider mouse and touch events.
QQuickDeliveryAgent redirects those explicitly to childMouseEventFilter.
It doesn't do anything for wheel or tablet events.
Since the overlay is the only data structure in Qt Quick that maintains
a list of popups (QQuickPopups add and remove themselves via addPopup),
the implementation of modality needs to live in QQuickOverlay. And since
the overlay installs itself as an event filter, it sees every input
event and can implement the modal blocking there.
For that it needs to know if the first item that would see the event is
modally blocked by any of the currently open popups. That is the case if
the popup is not an ancestor of the receiver item.
Add the case of nested modal popups to the existing QQuickPopup test.
Ultimately, the entire modality implementation should probably move into
this eventFilter, for all pointer events (key events are taken care of
by moving the focus when a popup opens and closes), in which case we
need to respect the auto-closing policy in QQuickPopup, and overlayEvent
overrides.
Fixes: QTBUG-107013
Pick-to: 6.4 6.2
Change-Id: I60359edad08586041b6f4080edd85be926cad091
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Both types have functionality to write themselves back to the properties
they were loaded from on change, but so far we could not nest those
writes.
[ChangeLog][QtQml] You can now assign to properties of nested value
types and to elements of containers from QML functions. You cannot,
however, take references of such values and elements. This is in
contrast to non-nested value types and the containers themselves.
However, passing references of value types and containers around
generally leads to very confusing effects. Don't do this.
Fixes: QTBUG-99766
Change-Id: I74cb89e5c3d733b0b61e42969d617b2ecc1562f4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
There can in fact only be one type argument, and we don't need a
finish() method. In fact the finish() method didn't return the type
argument at all.
Task-number: QTBUG-107171
Change-Id: Ifb7d85ca42a38d37da71b6453b458c7ec10cd64d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
All type annotations in qml did drop any typeArgument due to a bug in
TypeArgumentList: instead of keeping a circular list that is inverted
while building, and finally transformed in the inverse in the finish()
method, it kept a singly linked list and the finish method would
return a nullptr.
Fix the formatting and indenting of type annotations now that they
work.
Pick-to: 6.4
Task-number: QTBUG-107171
Change-Id: I9deff83d328c5c0784a4104e406036a435278945
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Some "value" properties might not have a valueChanged signal, (e.g. the
HSV color picker in the non-native Color Dialog exposes a "value"
property, but "value" is really part of a compound property set, where
"color" is the main property. Therefore, it emits a "colorChanged()"
instead of "valueChanged()" signal).
Make the heuristic more fail-safe by checking for both a "value"
property and a "valueChanged()" signal.
From the meta-objects POV this heuristic is wrong (we could have asked
for QMetaProperty::hasNotifySignal() instead), but exposing *only* a
sub-component of a compound property doesn't make much sense normally,
so therefore this approach was chosen.
Also, a screen reader will reveal the real values of these
properties by drilling down to the respective input fields for H,S,V or
color.
Make the similar fix for the cursorPosition property.
Pick-to: 6.4
Task-number: QTBUG-106407
Change-Id: Ie7a4b0d62ac6011f9eccfe7405f0e3eb7a6cea10
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
CI logs tell us that QTRY_COMPARE(mouseHandler->isHovered(), true)
has been failing sometimes. It's not supposed to fail, because we are
sending a mouse move event that should result in HoverHandler detecting
hovering (as opposed to using QCursor::setPos(), which is known for
being a more thorough test on window systems that support it, but also
not working on some systems).
On the hypothesis that this has something to do with timing,
avoid checking isHovered() until after we have verified that the
mouse-handling HoverHandler has received an event with a timestamp at
least 100 ms after the one that went to the last tablet-handling
HoverHandler, and only in that case continue with checking hover states
and the cursor. And anyway, if it keeps failing, we might at least
get the qCDebug line in the logs to be able to check the timestamps.
Amends 79893e1773
Pick-to: 6.4
Task-number: QTBUG-107763
Change-Id: Id7c657bfadf7b49ba3440e28d13121c041d38816
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
If, when asked to populate the cache for a set of glyphs, you have only
(a) empty bounding rect(s), then we don't pre-render anything.
That's fine, but following 2fb43a35df
we deem such a cache as not active, since it has 0 glyphs in use
and 0 glyphs in the unused set. That's bad because we then decide to
invalidate the glyph cache to clean up resources, leading to a crash
later when we try to use it.
As a simple solution we keep track of glyphs we've been asked to
reference, and only count ourselves as inactive once we have no
glyphs left.
Fixes: QTBUG-107594
Pick-to: 6.4
Change-Id: I7a276ac0b68eca2d9d49c55b29ef94d954baec89
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
While a delegate normally lives as long as the ItemView in which it is
used, that can unfortunately not be guarantueed. As demonstrated in the
test test case (and in a different way, in the bug report), it is
possible to delete the backing Component, and end up with a dangling
pointer in the table view.
Avoid this by using a QQmlGuard to reset the pointer to null when the
object gets deleted.
Pick-to: 6.4 6.2 5.15
Fixes: QTEXT-7
Change-Id: I6407b19a35b9707a039c9b4b3b387f191589cda8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Rectangle's parent was null when setting
left and right anchors. Use
pragma ComponentBehavior: Bound and
required properties instead.
Pick-to: 6.4
Fixes: QTBUG-106645
Change-Id: Ie5b8c3a20948799363fad1332113884612d18968
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The referenced bug report specifically complained about warnings caused
by including qquickpointerhandler_p.h. All of those -Wshorten-64-to-32
warnings come from headers that aren't strictly needed for
qquickpointerhandler_p, though.
So fix the issue by only including what is actually need, which also
slightly improves compile times. This requires adding a few transitive
includes in select places.
As a drive-by, remove the unneeded QML_DECLARE_TYPE.
Fixes: QTBUG-105055
Change-Id: I24d78e7131771a4bbcb402e6838a5a9a11abbbec
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
If exclusiveSignals == NotExclusive (the default), behavior remains as
it was: singleTapped() and doubleTapped() are emitted as the taps occur,
so it's not very useful to react on singleTapped() if you mean to
distinguish these two cases.
If exclusiveSignals == SingleTap, the doubleTapped signal will not be
emitted at all, and therefore singleTapped can be emitted immediately
and unambiguously.
If exclusiveSignals == DoubleTap, the singleTapped signal will not be
emitted at all, and therefore doubleTapped can be emitted immediately
and unambiguously.
If exclusiveSignals == SingleTap | DoubleTap, we must wait
qApp->styleHints()->mouseDoubleClickInterval() milliseconds after a tap
is detected before emitting either signal, so that they are distinct and
can be used to drive behavior that should not occur in other cases.
A triple-tap will not trigger either signal.
[ChangeLog][QtQuick][Event Handlers] TapHandler.exclusiveSignals now
lets you make the singleTapped and doubleTapped signals exclusive.
Task-number: QTBUG-65088
Fixes: QTBUG-107264
Change-Id: Ifb2c4b72759246c64b3bfa2f776c28266806b985
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
If the test can't send QTabletEvents, we can't use
AA_SynthesizeMouseForUnhandledTabletEvents to test device-specific
cursor conflicts. There is so little left to test that we might as well
skip it.
Since QTest::mouseMove() takes a delay argument, we don't need to use
qWait(). It should not have resulted in any flakiness, but we might
as well remove it to save a little time.
Amends 79893e1773
Pick-to: 6.4
Task-number: QTBUG-107763
Change-Id: Ic83a80f83fe51ad9413e21c5ca48c338d9ca3728
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
...rather than by subtracting from QTest::lastMouseTimestamp. Reverts
parts of cfa2c53bc0 This is possible
(and cleaner) after qtbase 0f94430a0fba5509d2d756832cb44a266d1d2e86
Task-number: QTBUG-102441
Change-Id: Ib5525aa2bc1f851a2f4e2650383a63fd92442ce2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Use Qt::StringLiterals::_s instead.
Also reflow lines because stricter /Zc options coming in from a
qtbase update make MSVS barf on line-broken u"" ""_s expressions.
Change-Id: I95a2a3d878d2ac506d9c54bbdeb734cf5d94bb8b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
While QLatin1String is constexpr, and so one can create a constexpr
array of QLatin1String, there's really no point in doing so, because
if, indeed, the compiler creates a static lifetime object out of this,
it'll do nothing but create relocations, and one set per template
argument(!) at that.
By just making the array const, we allow the compiler to optimize this
into a bunch of lea and movi.
Also unbreaks the build with /Zc:lambda on MSVC.
Amends ca68b0cde7.
Change-Id: I9317c08df380cfe323efe5c09ffa7e688d6a6ffc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Don't override the native style detection of Qt Quick Controls, let the
framework decide, and only print information about what to expect.
This fixes running the base line tests with the native windows style,
and has the benefit that we will see mismatches if the native style on
a platform changes.
Change-Id: I8e9e855e3acb6a38d46ae84a1ec2582d4eb22b0f
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Add a new virtual function to QQuickSelectable that lets
SelectionRectangle ask TableView up front if it's OK
to start a new selection at the given pos. This will
be useful once TableView adds its own pointer/drag
handler for resizing columns, and will be used to
avoid a situation where a selection starts at the
same time as a resize.
Task-number: QTBUG-106792
Change-Id: Ib0ed2d46802a05b717844ea6278ceef03f28840e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
When the FileDialog in the goUp test is first created, it sets a bunch
of properties, two of which are sortCaseSensitive and nameFilters.
These cause FileInfoThread's sortUpdate and folderUpdate flags to be set
to true, respectively.
When FileInfoThread::getFileInfos() ran, it would see that folderUpdate
was set to true, run related code, and then unset folderUpdate. However,
sortUpdate would not be unset. This meant that the next time
getFileInfos() was called, it would effectively reset the model when it
didn't need to. This caused the currentIndex we set on
fileDialogListView to be ignored because the ListView set it to 0 as a
result of the insertion and removal of rows from the model caused by
QQuickFolderListModelPrivate::_q_sortFinished().
This patch fixes the issue by:
- Introducing an enum to manage the different types of updates
requested, which also makes the code a little easier to understand.
- Unsetting the various flags whenever needUpdate is unset.
It also adds categorized logging to make debugging such issues in the
future easier.
Task-number: QTBUG-101488
Pick-to: 6.4
Change-Id: Iaf53509d3f028fd2e1385a2597898e8e0327aedb
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
The iLine variable is set, incremented, but it's value is never used
for anything. Clang figures this out and warns about it.
Fix by removing the unused variable.
Amends 6d36ff2cf5.
Change-Id: Iff53628d5580fd0471296b22b54635ccefcc8627
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The Basic style is designed for touch. So ensure that the rows
and the indicator inside TreeViewDelegate follows the same
size factor as the other controls (e.g a Button).
Pick-to: 6.4
Change-Id: Ib75650eadafa8a344d87f51780b36581bd2a9cf2
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
With this in place we can enforce that reference objects we add in the
future can only be written back in the same statement as they were
created.
Task-number: QTBUG-99766
Change-Id: I1c74bd239caa1bb5febd1a3705d8ee29a8fc4249
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
It was mostly consistent already, but not in these two cases.
Pick-to: 6.2 6.4
Change-Id: I5ed7b9cf7fd7e7dc6f4b43085035b375e1e9cc1e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
By default, the QML engine does not enforce signatures given as type
annotations to functions. By passing different types than the function
declares, you can get different behavior between the interpreter/JIT and
the AOT-compiled code. In addition, in interpreted or JIT'ed mode, we
pass all non-primitive value types as references. This means, if you
modify them within the called function, the modifications are propagated
back to the place where the value was loaded from.
Enforcing the signature prevents all of this, at a run time cost. Since
we have to coerce all arguments to the desired types, the function call
overhead grows. This change introduces a pragma
"FunctionSignatureBehavior" which you can set to "Ignored" or "Enforced"
to choose one way or the other as universal way of handling type
annotations.
Fixes: QTBUG-106819
Change-Id: I50e9b2bd6702907da44974cd9e05b48a96bb609e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
When a TableView has a sync view, the sync view will always
decide the size of the rows and the columns. As such, also
forward any calls to setColumnWidth/RowHeight to the sync
view, otherwise it will have no effect.
This is needed to e.g allow the application to resize the
columns in a TableView by setting the size on the HeaderView
instead. The opposite solution would be to just ignore any
such assignments when having a sync view, but this would
need to be documented as well, so then we might as well
just forward the calls.
Task-number: QTBUG-106792
Change-Id: Iadcd8c75677a69ab19fa2455274d340b5a4ad340
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
The code in qmlcompiler working on ContextualTypes is very confusing
as it handles internal types (c++ and synthetic jsrootgen type names)
and qml types at the same places.
Furthermore, some methods like qqmljsscope::findType() have different
behaviors when running in different contexts, e.g. in the internal
type context it needs to lookup namespaced c++ enums (e.g.
QQmlComponent::Status) while in the qml type context it needs to
lookup inline components (qmlFileName.MyInlineComponent).
Changed ContextualTypes to be a struct with the types QHash and
an enum with the context (QML or INTERNAL),
Drive-by change: amend the iterations over types.keys() to use an iterator
instead of allocating a temporary QList as types is not that small
(may contain around 400 items just for the builtins).
Fixes: QTBUG-107191
Change-Id: Ib463ec873019ea1e6844c522a090030e9a44d53f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
List in qml should not include an object whose scope types is attached or grouped.
In case an attached or grouped type is a member of a list, they don't
have a separate scope, but only one scope is created per name. This
causes a crash as creating bindings for array members since it is not
known if any of the child scope is omitted or not. To prevent this,
simply early return if any of the child scopes include an object
definition that is attached object or group type.
Fixes: QTBUG-107250
Change-Id: I08fdfb43d766569c4dfefc50135f98f74d25bad2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We will need the statement indices when tracking value type references.
New value type references shall only be written back in the same
statement they were created in.
Task-number: QTBUG-99766
Change-Id: I83f908df034e7da8ba46ccacaa29bd9d78020d20
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We generate translation bindings for all the other translation functions
already. We can just as well generate a translation binding for this
one, too.
Fixes: QTBUG-107536
Change-Id: I851f03c26510b6d450aa78f5d7a1f0142d3a81aa
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Add dependency on 'Qml_sync_headers' for all QML modules that are built
in the qtdeclarative build tree.
'moc' requires QtQml/qqmlextensionplugin.h to process IID in the
generated plugin source code. Since the '_autgen/timestamp' target
doesn't have the 'Qml_sync_headers' target in its dependency chain,
the header file is not created by syncqt before the 'moc' run. We need
to make this explicitly, because CMake doesn't add the main target
dependencies to the dependency list of the '_autgen/timestamp' target.
Change-Id: I1a199b4044e1dd9caddf7c0a9d75d59860893f60
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Calling alloc with a qint64 parameter is a good indicator that we got
that value from Object::getLength. In that case, the value needs to be
sanitized with safeForAllocLength.
As a consequence, we notice that method_stringify did indeed use alloc
in an usasafe way; this is now fixed.
In a few other places, variables had to be changed from unsigned to
signed int (as the conversion is now ambiguous).
An even stricter check would be to only accepd a value of (not yet
existing) "sanitized_size_t" type. However, that requires more effort,
at it would each and every call-site, and is thus left as an exercise
for later.
Pick-to: 6.4 6.2 5.15
Fixes: QTBUG-107619
Change-Id: I3bba9be1e0aea72e11ccb6c168219b4591eb8f5b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This extracts the check from Function.prototype.apply into a shared
function, and uses it in Reflect.apply, which has the same issue.
Pick-to: 6.4 6.2 5.15
Task-number: QTBUG-107619
Change-Id: I899464c86554f9bbb5270a95bbe3fe27531e9a27
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
To allow the user to customize the C++ code that QDoc sees, so as to be
able to work-around some limitations on QDoc itself, QDoc defines two
symbols: Q_QDOC and Q_CLANG_QDOC, both of which are "true" during an
entire execution of QDoc.
At a certain point in time, QDoc allowed the user the choice between a
custom C++ parser and a Clang based one.
The Q_QDOC symbol would always be defined while the Q_CLANG_QDOC symbol
would be defined only when the Clang based parser was chosen.
In more recent times, QDoc always uses a Clang based parser, such that
both Q_CLANG_QDOC and Q_QDOC are always defined, making them equivalent.
To avoid using different symbols, and the possible confusion and
fragmentation that derives from it, all usages of Q_CLANG_QDOC are now
replaced by the equivalent usages of Q_QDOC.
Change-Id: I25a2fe3b870281b336d5eca1f887940a7961dc31
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This type has been used internally as QQuickAttachedObject by the
Imagine, Material and Universal styles to enable propagation of colors,
dark mode flags, etc. for a while now. Users would benefit from having
access to it to create their own styles (although it's not just limited
to that use case).
This patch:
- Makes the type public in quickcontrols2.
- Adds documentation and an example.
- Fixes the test_window test to ensure that propagation through child
windows actually works.
[ChangeLog][Controls] Added QQuickAttachedPropertyPropagator, which
provides a way to propagate attached properties from parent objects
to children. This is especially useful when creating your own style.
Fixes: QTBUG-63267
Change-Id: I2f1794dc4a9f2be56fad2f5e5f39e2ab845157fa
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that on() was replaced with a matcher that doesn't ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Change-Id: I58e1b41b91c34d2e860dbb5847b3752edbfc6fc9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Every QQmlValueTypeWrapper is potentially a reference now. Since most
were already before, the overhead of checking the vtables at every step
was dubious at best.
Extract a common base class that handles the reading and writing of
object properties employed in both value type references and sequences.
Task-number: QTBUG-99766
Change-Id: Idf72d9a20a52366e5c2d0dcd4b3a18072c0ccc41
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
In case of an enum the actual contained type is the one the enum
dictates. This brings registerContains() in line with containedType()
and makes it possible to match previously discovered types on subsequent
passes of the type propagator. Therefore, it avoids infinite loops where
the same types would be tracked over and over.
Pick-to: 6.4
Fixes: QTBUG-107176
Fixes: QTBUG-107542
Change-Id: I4b8d66b157d0ec0ece4ca345cb99a630b8898a1b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>