Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QJSEngine object proxy type comverter #9

Closed
wants to merge 193 commits into from
Closed

QJSEngine object proxy type comverter #9

wants to merge 193 commits into from

Conversation

rjcamatos
Copy link

When reciving a qobject from JavaScript into a c++ method that recives a qobject drived class as a Pointer it comes as a null widget and not a qobject Pointer, it is need to use qjsvalue::toObject to to covert.
It is not possibel to convert directly into a qobject pointer converted directly by the proxy engine?

andrey-golubev and others added 30 commits June 9, 2021 10:13
Amends 93b5744 where equality and hash
were accidentally forgotten

Change-Id: Ia1a3f1e92a5a59fbaaf1eba9ec617768b280a0dc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The qrc files are needed to analyze relations between the different
QML files.

Pick-to: 6.2
Change-Id: I288434a0822de7b9e55696c90f768eb9e5283ffc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
Moves the majority of qmllint warning logic to qmlcompiler, making them available to all tools using the library.
The end goal is to get rid off the additional AST visitor in qmllint altogether (We can't quite yet until we have ported over type interference).
This also prepares qmlcompiler to move to a two pass approach which isn't fully implemented in here yet due to the size of the change.

Pick-to: 6.2
Change-Id: Id2e108340d26a75085ce6ed97d56dec03ea3a12d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This is in line with what we declare in the builtins and what we
auto-register in QtQml.

Change-Id: I7357f92d3c1b2ccad10a4e3dc1f91fbdb372eaa1
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This saves us some ping-pong between the IDs and the QMetaTypes, and
avoids possible ambiguities if multiple metatypes are registered for the
same C++ type.

Change-Id: I81cec94a9cd05d69927dc884f65574f0ab2ddc22
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
By registering multiple QML types for the same metatype you can
otherwise end up with an object type or a namespace there.

Change-Id: Ie6f2b66ecc07ff8dc4983e38d07f9858391d80a9
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Function::updateInternalClass creates a reference to a QStringList that is appended to before being used.
This is unsafe and can leads to a segfault if the append() causes a reallocation.

Fixes: QTBUG-94360
Pick-to: 5.15 6.1 6.2
Change-Id: Iac49e8d816cf440ca2b70e133c88314eb8df6b91
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
If we call an AOT-compiled function we never need the JavaScript call
frame. We can just skip its setup and save some overhead.

Change-Id: I39dc2ca6eea5b5a66f3b87b642a310534cecf6cd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Fix up some minor issues in the documentation of
selection support in TableView.

Pick-to: 6.2
Change-Id: Ica2c0014f4e7f960332c283c1ff83a6b0bdd7df2
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Rename internal modules to adjust their name to the internal module
policy.

Pick-to: 6.2
Task-number: QTBUG-87775
Change-Id: I99cbc1214c6f0a9085e921df6225768fd55f5b89
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Rename internal modules to adjust their name to the internal module
policy.

Pick-to: 6.2
Task-number: QTBUG-87775
Change-Id: I79245c0e555dcf018494faf3f3f30fbf5f944f1f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Change-Id: Iccf6145734dbf936da418574737ac4d117dae7de
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Otherwise we trigger asserts in various places. We also need to generate
exceptions matching those the interpreter generates, and we need to
decline capturing of nullptr objects.

Pick-to: 6.2
Change-Id: I65744fa3e440939db28d7b16a044f6968500a67b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Now we do most properties after the fact which eliminates false positives on unknown types that are not known at the time of traversing the AST. It also allows for chaining inline components.
This effectively introduces a two pass system but there are some exceptions (i.e. signals) where some deduction that should be run after the fact still runs during parsing.

Fixes: QTBUG-93652
Pick-to: 6.2
Change-Id: Ic1ac0e8ce2d5d5dfbe80c16a341b10cf2b078d81
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
A palette has three color groups (Active, Inactive, Disabled), but we
only listened to changes of the enabled state, and always used the
Active color group for an enabled item.

In order for the Inactive color group to take effect, we need to also
trigger the update when the "active" property changes. Instead of
connecting yet another signal, deliver WindowActivate/Deactivate to
as well, and forward from contentItem to all children which can then
update the current color group.

Add a test case.

Fixes: QTBUG-93752
Pick-to: 6.2
Change-Id: I4f2b6121e822115aaa5c4faaa5d402932dacc67b
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Apparently we can still call bindings and functions on those. In
contrast to the QML engine, we throw a type error here, rather than
silently returning undefined.

Pick-to: 6.2
Change-Id: I7d7daf1582d891f6acadb705b50dc36e23f8425c
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
'resource-file-mapping option' is actually using '=' in code and tools

Change-Id: I0d67e13e9d614bf973a0d4332c6b4dcda4c121a4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Remove assignments to the transitionary variables
QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS and
QT_USE_FIXED_QT_ADD_RESOURCE_BASE.
Both are not needed anymore.

Task-number: QTBUG-94444
Change-Id: I9236056e5e2a4386242a8437580255d0713fd1bf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This ensures that we list all of Item's properties in the "List of all
Members" page.

Pick-to: 6.2 6.1 5.15
Change-Id: Ide7e270fd187e6adc4a20b70b8ef84d2c25a836c
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
A class with virtual methods should have a dtor.

Change-Id: I08316aadc6df72e8cb3f2d36f5eec2ac59cdeb42
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We need to write the inner data of the variant. Otherwise we create
double-wrapped objects.

Pick-to: 6.2
Change-Id: Iacc7b341168c4328172a4e442c16cfbedc6c36c0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
We cannot use the lookup metatype before we initialize it, and the
calling code cannot know the result metatype before the lookup is
initialized, either.

Pick-to: 6.2
Change-Id: I3c691b41dbdb416aa1822c0ea7c4b887398f7908
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
This was an oversight: We only checked that normal properties have
unique names, and that alias properties have unique names, but we
neglected to check that alias properties and properties do not have name
collisions either.

Fixes: QTBUG-94456
Pick-to: 6.2 6.1 5.15
Change-Id: I0fa7666b143bc84f4dc5b2ad6e62427adff60cd7
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Change-Id: I54fa11345c189196df119c536ab465935a8263a3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Change-Id: Ia4f7e92115279d53369a3ccfb005899cabf76c7c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Previously QObject's could get garbage collected while in use.
This change fixes this by making them indestructible while in use and then restoring their previous state.

[ChangeLog][QtQml][QQmlListModel][Important Behavior Changes] ListModels now take ownership of the objects added to them, only releasing them after the object has been removed again. This may break existing solutions which rely on the object not being owned by the model.

Fixes: QTBUG-91390
Pick-to: 6.2
Change-Id: Ifd37c90e13fb0b6ad8a5a06e89f9fc9a429f6316
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This was forgotten in 1875ad7.

Fixes: QTBUG-91365
Pick-to: 6.2
Change-Id: I8dabf0e2a5a13f0db5feac5c03e3494948393cb7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
...and rephrase one of the general description paragraphs to be
more accurate.

Pick-to: 6.2 6.1
Fixes: QTBUG-93489
Change-Id: If238fff84480720a618c8a337fe416cd08ee9b79
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Task-number: QTBUG-93489
Change-Id: Ife9db7b066add1f41de964d4c41309568f954320
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Change-Id: I9e9bf8ee19543c3ecd3d96c7aef59121567077c5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
ec1oud and others added 27 commits July 6, 2021 22:38
As in mouseEvent(), it's not the qWait() that usually matters as much
as the timestamp difference that the delivery code will see.

Task-number: QTBUG-56075
Change-Id: Ifc3b0830b6973997916465f3a9313d607428ede1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This allows the developer to easily run all linting tasks. The project
can set the QT_QMLLINT_ALL_TARGET variable to override the name of the
target to add each individual ${target}_qmllint target to. They can
set that variable to different values at different places, giving the
ability to group different sets of ${target}_qmllint targets
conveniently.

Fixes: QTBUG-94523
Pick-to: 6.2
Change-Id: I238af8e49e5805408e37df0ef0dbab318ea3bb42
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
The *.qmltypes files are usually generated automatically. They are
needed by qmllint when it is run when bringing the ${target}_qmllint
target up to date. If the ${target}_qmllint target is built before the
${target} itself, we need to ensure the ${target}.qmltypes file has
been generated. Furthermore, ${target} might depend on other QML
modules and the *.qmltypes files for those QML modules also need to
exist at the time qmllint runs. The only way we can robustly ensure
this is to make each ${target}_qmllint target depend on the
generation of all *.qmltypes files, since we don't have a way to
know the QML module dependencies at configure time (at least, not
for shared builds where qmlimportscanner isn't used).
This commit adds the required dependencies to enforce this
conservative constraint.

Task-number: QTBUG-94761
Pick-to: 6.2
Change-Id: I13561517db3d268dc3d2d6ed8e183516d5b57dc4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
In order to use the source tree files, qmllint needs to know where they
will end up in the resource system. The source files could be at any
arbitrary location and have their resource path set by a
QT_RESOURCE_ALIAS source file property. Therefore, we have to give the
generated .qrc files to qmllint so it can work out where each source
file will end up.

The qmllint command previously only supported a single --resource
option, but now we need to potentially pass more than one .qrc file.
Extend qmllint to allow multiple --resource options to be given, in
the same way that multiple -I options can be given.

Task-number: QTBUG-94761
Pick-to: 6.2
Change-Id: Ibeb6541e1f54bea6eeeccd07426dd238b0459ff2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Change-Id: I23a6fc7d41afb933cdd4c51314b9b5c599a3baba
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
Change-Id: I201dcc375a5601c5655567b4c3dce3361c852b79
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
This can easily happen if the same module is imported several times with
different prefixes, or if there are multiple implicit imports from other
modules. Before, the last request for a qmldir URL overwrote any
previous requests, leading to the previous requests never getting
notified about their completion.

The QQmlTypeLoader test exercises this code in a particularly mean way
by intercepting local URLs and making them remote. This, combined with
the fact that we now can have multiple local locations for the same
module, made it much more likely to hit the above condition.

This change makes the test even meaner by randomizing the response time.
This way we increase the probability that some qmldir request is posted
twice before a response is received.

Pick-to: 6.2
Change-Id: Ie8b802cb65cfb78b0cde22f485ad7a31f60ee5bf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
This change helps bring in type inference and compiler warnings previously only generated by qmlcachegen+.
These warnings are disabled by default and have to be enabled manually via the --compiler option.

Also makes the logger handle zero length SourceLocations properly by just highlighting the entire line instead of hitting an assert.

Change-Id: Iebad6e9236214d9367f97487e7b5787592edab7d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
In order to properly integrate the type propagator into qmllint we need to use the logging system instead of qWarning().

Change-Id: Ie9840066f8afa3d7f8a63a69444b6dc20c41a706
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Change-Id: Ib15fcbdf253fbc422f862ac8a2cd4694134cd010
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
Pick-to: 6.2
Change-Id: I5175252af1439741d88683f99bc21b3c47354d2e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Change-Id: I9533f373a198a0b0c4d03a53496d6ccd7b396fad
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
Global Names should start with "QQmlJS".

Change-Id: I6ab39339161541b5027ab959c19a288c1af8e2da
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Change-Id: I9019a5617295e0e11e8c11da1abbcd6df9d99bbd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Use qmlcachegenplus by default if available, and fall back to
qmlcachegen.

Pick-to: 6.2
Change-Id: I36af4cff6f05c8525a785b1b128859b012c7c377
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
qt_add_resources() would not add the files to the QML module.

Pick-to: 6.2
Change-Id: I75abb056255ec60e53aee7d53e87f53937d73dbe
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This allows adding additional resources, which are not part of the
actual QML module, and makes it possible to place them somewhere else in
the resource system than the QML import resource prefix.

Fixes: QTBUG-95025
Pick-to: 6.2
Change-Id: I63af825954081a8a6a284852c4add96cab7d8677
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
The pro2cmake.py conversion script faithfully reproduced the .pro files
for the plugins, which specified the libraries as public. But in CMake,
the implications of this are that public usage requirements should then
be propagated to consumers. We don't expect any consumers, since a
plugin is created as a MODULE library in CMake, so for Windows we don't
even have an import library to link with. The only exception to this is
for static builds where plugins are created as STATIC libraries
instead, but only in certain controlled situations do we then link to
plugins. Even then, usage requirements are not expected to propagate to
the consumers, so these relationships should always be specified as
private.

Pick-to: 6.2
Task-number: QTBUG-90819
Change-Id: I0dd04990d047aae73382421614723360b8e48aaa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Change-Id: I0371b3cd6c2c2303d972ce4913cb3d5d9b28461e
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
When following static semantics we assume that properties and methods
cannot be shadowed and just access them. This is independent of wrapping
all non-primitive types in QVariant.

Change-Id: Ic037148c74d5e157ec2ecbaac6089f7d70386638
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This is extremely dangerous and offers very little benefit over just
copying the string. QString is implicitly shared after all. If the
string copying really becomes our bottleneck, we can revisit this, but
that won't happen anytime soon.

Change-Id: I274c89aec0a59067d03bb1b58dae4cf2c029b475
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
PinchHandler.minimumTouchPoints was probably just an early idea for the
name, because MultiPointTouchArea has it. Anyway it's now honoring the
inherited minimum/maximumPointCount properties from MultiPointHandler.

Pick-to: 5.12 5.15 6.1 6.2
Change-Id: I6408da9dfe1d31a38da2777efa2c5d79ad17390f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
QNativeGestureEvent::fingerCount() is new in 6.2, and on Wayland
touchpads it's actually populated, so we can now do this.

Fixes: QTBUG-95070
Pick-to: 6.2
Change-Id: Ia365ff34003be8ae8f7f860c195f08b66f6c4a4e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We need that for list properties, and among those most default
properties.

Change-Id: I6aa1659548769654c6cbb18fd04db1cf62437f99
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
In static mode, we assume that the "parent" property denotes the
document parent. If the document parent then matches the expected type,
we allow access to its properties.

Task-number: QTBUG-93662
Change-Id: Iaf213492aa52571876c80f85faa04d8f76ab1254
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This mostly reverts commit 33c8773.
The problem with that fix is that if we don't use the timeline at all,
we don't get the completed() signal from it, so movementEnding() doesn't
occur, it doesn't return to bounds because it doesn't recognize that
movement ended (another wheel event could come at any time, after all),
the "moving" property does not get reset, etc. I don't want to put back
movementEndingTimer from 1929fee just
to compensate, because that was also a hacky workaround which we
(wisely?) removed in 3d57afa.
Let's rather fix the velocity calculation so that the core Flickable
animation feature stays in control even on touchpads that don't provide
QWheelEvent::phase(). A little momentum would actually feel nice.
But we keep some of the categorized logging: it will be useful later.

Task-number: QTBUG-56075
Change-Id: If08be84d7ca23c9463d321a00ebea811a599891f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Angular velocity is defined as angle rotated divided by time elapsed.
But the historical problem with Flickable is that the calculation
ignored time, as if there was a maximum frequency of events and we
only needed to know the rotation angle per fixed unit of time.
With "clicky" mouse wheels perhaps it was a reasonable approximation.
With touchpads that provide pixel deltas, we've been doing the velocity
calculation the right way since a6ed830
Now we divide by dt also in the wheel rotation case.

That gives instantaneous velocity.  Next question: how to do smoothing?
AxisData::velocityBuffer is basically a Kalman filter, but until now
it was used only when dragging ends and we animate the deceleration from
the velocity at that time.  It seems to work well for smoothing the
velocity that comes from wheel events, too.  So now we use that instead
of smoothVelocity, and it stays in control better.

Next question: when a series of wheel events occurs, we have valid
dt for the dy / dt velocity calculation (or dx / dt horizontally),
but what about the initial flick?  What if first thing the user does
is rotate a physical mouse wheel by one "click", how far should
Flickable move before it comes to rest?  QStyleHints::wheelScrollLines()
tells us how far to move for one wheel event... in "lines", whatever
that is.  Flickable doesn't know about its contents.  But it "feels"
reasonable if we define a "line" as 24 pixels.  At least the setting
will do something now: applications can adjust it, and some system
control panels can adjust it.  A subclass of QQuickFlickable (such as
TableView) could even change QQFlickablePrivate::initialWheelFlickDistance
to be the actual number of pixels per "line", to scroll exactly by rows.
(But when the events occur faster, it moves further and faster, like it
always did.)

OK so we know how far we want to move when the Flickable is at rest
and receives a QWheelEvent with angleDelta of 120.  I.e. when isMoving()
is false.  So I tried an experiment: set dt to 0.25.  How far did it move?
77 pixels.  Why?  We're making it move via QQuickFlickablePrivate::flick()
which does some math and drives the timeline. The key formula is
qreal dist = v2 / (accel * 2.0)
which agrees with the testing: if the wheel turns by 120 units,
(120 / 0.25)^2 / (1500 * 2) =~ 77
So it's possible to do the algebra to reverse-engineer what dt should be
so that we will move the right distance with a single wheel event,
despite the complexity of the animation itself.  That's what is now
done.  When the user rotates the wheel very slowly, it moves by discrete
amounts but with smooth animation.  A little faster, and it speeds up,
somewhat like it did before, but with more control.  If it has sped
up to a high speed and then the user rotates the wheel backwards,
it reverses instantly: we clear the Kalman filter and insert instantaneous
velocity (so it will go from there at the next event).

On a touchpad, it also feels quite in-control because the velocity
is calculated properly as distance-delta / time-delta.  Smoothing
it out doesn't hurt, and animating after release doesn't hurt.
It longer goes "zing" out of control when the wheel events come in too
frequently from a touchpad or a free-spinning wheel.

None of this affects trackpads on macOS, because then the wheel events
have phases and pixel deltas, and we don't use this animation.  We still
should try to get that working on as many OSes as possible, eventually.

Clarify the meaning of the flickDeceleration property.

[ChangeLog][QtQuick][Flickable] Flickable no longer tries to detect
whether you're using a "clicky" wheel or a touchpad, but rather does the
velocity calculation more correctly with elapsed time (dθ / dt).
A single rotation of a "clicky" wheel also moves a fixed distance,
which is now adjustable via QStyleHints::wheelScrollLines().
Animation is restored, but should now stay in control on touchpads;
and it will once again transition the "moving" properties correctly
when scrolling ends.

Fixes: QTBUG-56075
Pick-to: 6.2
Change-Id: I5166ca31c86335641cf407a922a3a970fced653d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
@rjcamatos
Copy link
Author

When reciving a qobject from JavaScript into a c++ method that recives a qobject drived class as a Pointer it comes as a null widget and not a qobject Pointer, it is need to use qjsvalue::toObject to to covert.
It is not possibel to convert directly into a qobject pointer converted directly by the proxy engine?

Forget, i didnt register that type on jsengine

@rjcamatos rjcamatos closed this Jul 11, 2021
qtprojectorg pushed a commit that referenced this pull request Dec 8, 2023
Using std::binary_search has the requirement that the passed
range fulfils ordering requirements, which was not the case
for the cppKeywords array here.

As the QString doc says [1]:

> QStrings can be compared using overloaded operators such as operator<(),
> operator<=(), operator==(), operator>=(), and so on. Note that
> the comparison is based exclusively on the numeric Unicode
> values of the characters. It is very fast, but is not what a
> human would expect; (...)

Therefore, sort the array accordingly and add an assert to
ensure it will remain sorted.

Fixes an crash/assert when building qtdeclarative with
CXXFLAGS='-D_GLIBCXX_DEBUG':

    /usr/include/c++/13/bits/stl_algo.h:2243:
    In function:
        bool std::binary_search(_FIter, _FIter, const _Tp&) [with _FIter = const
        QString*; _Tp = QStringView]

    Error: elements in iterator range [first, last) are not partitioned by the
    value __val.

    Objects involved in the operation:
        iterator "first" @ 0x7ffc4a2c4f18 {
          type = QString const* (constant iterator);
        }
        iterator "last" @ 0x7ffc4a2c4f10 {
          type = QString const* (constant iterator);
        }
    Aborted (core dumped)
    ninja: build stopped: subcommand failed.

GDB backtrace:

    Program terminated with signal SIGABRT, Aborted.
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    44      ./nptl/pthread_kill.c: No such file or directory.
    (gdb) bt
    #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
    #1  0x00007f307e0a815f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
    #2  0x00007f307e05a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    #3  0x00007f307e0444b2 in __GI_abort () at ./stdlib/abort.c:79
    #4  0x00007f307e2a300d in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00005639ff90471d in std::binary_search<QString const*, QStringView> (__first=0x5639ffa1a9c0 <QmltcVisitor::checkForNamingCollisionsWithCpp(QDeferredSharedPointer<QQmlJSScope const> const&)::cppKeywords>,
        __last=0x5639ffa1b2c0 <guard variable for QmltcVisitor::checkForNamingCollisionsWithCpp(QDeferredSharedPointer<QQmlJSScope const> const&)::cppKeywords>, __val=...) at /usr/include/c++/13/bits/stl_algo.h:2243
    #6  0x00005639ff8fb837 in operator() (__closure=0x7ffc4a2c52bf, word=...) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:764
    #7  0x00005639ff8fb89e in operator() (__closure=0x7ffc4a2c52a0, name=..., errorPrefix=...) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:768
    #8  0x00005639ff8fc99b in QmltcVisitor::checkForNamingCollisionsWithCpp (this=0x7ffc4a2c6070, type=...) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:787
    #9  0x00005639ff8f9dea in QmltcVisitor::endVisit (this=0x7ffc4a2c6070, program=0x563a002e0628) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:341
    #10 0x00007f307f6636fa in QQmlJS::AST::UiProgram::accept0 (this=0x563a002e0628, visitor=0x7ffc4a2c6070) at /home/michi/development/git/qt5/qtdeclarative/src/qml/parser/qqmljsast.cpp:1193
    #11 0x00007f3080159b8f in QQmlJS::AST::Node::accept (this=0x563a002e0628, visitor=0x7ffc4a2c6070)
        at /home/michi/development/git/qt5/qtbase/include/QtQml/6.7.0/QtQml/private/../../../../../../qtdeclarative/src/qml/parser/qqmljsast_p.h:272
    #12 0x00007f3080212f4b in QQmlJSTypeResolver::init (this=0x7ffc4a2c5b50, visitor=0x7ffc4a2c6070, program=0x563a002e0628) at /home/michi/development/git/qt5/qtdeclarative/src/qmlcompiler/qqmljstyperesolver.cpp:173
    #13 0x00005639ff8f0bd3 in QmltcTypeResolver::init (this=0x7ffc4a2c5b50, visitor=0x7ffc4a2c6070, program=0x563a002e0628) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltctyperesolver.cpp:19
    #14 0x00005639ff8c02d4 in main (argc=23, argv=0x7ffc4a2c7a68) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/main.cpp:269

[1] https://doc.qt.io/qt-6/qstring.html#comparing-strings

Change-Id: I82ebbcdca4ab90155b935f9af24b3a3821134563
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.