Commit Graph

82 Commits

Author SHA1 Message Date
Ulf Hermann c4addf7d0e Pass QMetaType by value rather than by ID in more places
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>
2021-06-09 14:47:13 +02:00
Andreas Buhr 702b00bc8b Consistent naming for (to|from)Is(Defined|Sourced) in animations
To store whether "from" and "to" values are defined and/or sourced,
QQuickPathAnimationUpdater     used fromDefined format,
QQuickAbstractAnimationPrivate used fromIsDefined format,
QQuickAnimationPropertyUpdater used fromIsDefined format,
QQuickAnimatorPrivate          used isFromDefined format,
QQuickBulkValueAnimator        used fromDefined format,
QQuickAnimationPropertyUpdater used fromDefined format.
This patch changes all these to use the variable names
"fromIsDefined", "fromIsSourced", and "toIsDefined".
This makes the code more readable.

Pick-to: 6.0 5.15
Change-Id: Ia6c228208eb651247b0ba70f83afadb5b1027049
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-03-30 14:04:19 +01:00
Fabian Kosmale b527d8db60 QQmlMetaTypeData: Purge custom string converters
Those were never exposed anyway. color, date, etc. are handled by the
less generic converters in qqmlstringconverters_p.h.

Change-Id: I43a94acda08344de742440dd3b956a7077096b11
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-03-30 15:04:16 +02:00
Fan PengCheng 2208cc7fd0 Correct the error in the help document
Item's attribute is transitions instead of transition

Change-Id: Ic17f834d480b14b658db15d3688c47dd4d3b8d6d
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
2021-03-22 08:57:47 +08:00
Ulf Hermann 25f765cbd9 Unregister value types when tearing down QML types
Move the value type registry into QQmlMetaTypeData. This way we can
conveniently drop the relevant entries when unregistering a type.

Fixes: QTBUG-86946
Change-Id: Id024a34a8b2b622fd9417fc0e52864b43c66cc01
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-02-12 11:36:25 +01:00
Ulf Hermann 17fa564a94 Animations: Drop checks for duplicate jobs
We cannot return the same job multiple times from transition(). The
calling code takes ownership of the job, and even retaining a pointer to
it in the animation would be a problem. There are no animations that
return the same job multiple times, though.

Task-number: QTBUG-90401
Change-Id: I3a113c624a20dceee745cd6a4fca6f3634bdbdd1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-02-03 10:53:26 +01:00
Fabian Kosmale 77c02343e2 Use QMetaType instead of metatype-id, take 2
This time, the ValueTypeFactory gets converted. As a consequence, many
callers get touched again.

Task-number: QTBUG-88766
Change-Id: I3a8b7d5cfeb7fac85daf1702febba205971d4256
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-12-03 10:38:43 +01:00
Ulf Hermann d7008c79d4 QQmlListProperty: Use qsizetype rather than int for sizes
[ChangeLog][QtQml] The QQmlListProperty callback functions use qsizetype
now as type for the size of a list. This is in line with the containers
that you might use to back the list.

Fixes: QTBUG-88269
Change-Id: Ia38403cb32f241e6c70e1a580dbeff1d6d694331
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-11-09 18:09:30 +01:00
Ulf Hermann 0b92a93e8e Avoid various warnings about deprected QMetaType methods
Change-Id: I8f4b2703fdd08ff341904219cec33c321e0511c7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-09-16 08:36:58 +02:00
Karsten Heimrich 1b10ce6a08 Port QtDeclarative from QStringRef to QStringView
Task-number: QTBUG-84319
Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-06-16 22:46:16 +02:00
Ulf Hermann cd9f15bc1a Quick: Use unicode character literals
This avoid warnings on conversion to QChar.

Change-Id: Idad6a35bb47b029688c5752a03ef83cb5b63373e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-06-10 10:05:55 +02:00
Volker Hilsheimer 69126c7bb1 Fix warnings from deprecated QChar constructor
Change-Id: I7238c6aaac2f4e0ee2f64afcb4dc9b46497e2c91
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-06-04 22:45:45 +02:00
Ulf Hermann 19ea4e630c Clean up registration of QEasingCurve
We don't need to register the Type enum for both QtQml and QtQuick.
QtQml is enough. Removing this makes the whole manual value type
registration obsolete. Furthermore, we want QEasingCurve as QML_FOREIGN
as we have several classes with properties of that type. To keep it nice
and tidy, we make the uppercase-named enum holder class a separate type.

Unfortunately, the Type enums differ in one entry:
QEasingCurve::BezierSpline is called Easing.Bezier in QML. Therefore, we
need to keep the custom enum around. We can change all users in
qtdeclarative to use the name from QEasingCurve, though.

Change-Id: Ibbc78d8bbf8938e2a8722f8c09833a0c73394c3d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-05-19 08:36:04 +02:00
Jan Arve Saether 8e0711cafd Fix signal emission order for zero-duration animations
The order for non-zero-duration animations are:

* started()
* runningChanged(true)
* stopped()
* runningChanged(false)
* finished()

This patch tries to ensure that zero-duration animations have the same signal
emission order.

The problem was that when setRunning(true) was called on zero-duration
animation, it would call itself (setRunning(false)) lower in the call stack in
order to immediately stop again. This had the implication that we could emit
stopped() even before started() was emitted (since the recursive call to
setRunning(false) would actually complete before the ancestor stack frame
setRunning(true) was completed)

To fix this we emit started() *before* we call start() on the animationInstance.

There is still a bug in that runningChanged(true) is still not emitted for a
zero-duration animation, but this patch should improve the current behavior in
the sense that stopped() is not emitted _before_ started().

Task-number: QTBUG-48193
Change-Id: Ic2bc85e648e6746f6a058e2e9136515e7fdb6192
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-03-31 11:36:46 +01:00
Topi Reinio 4034eea1ec Remove hard-coded notes for 'Corresponding handler' for QML signals
QDoc will generate these notes automatically.

Task-number: QTBUG-37355
Change-Id: I8ed058ecbbcc630ad0351f6ce167c3fa61936f6f
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-03-10 09:36:07 +01:00
Olivier Goffart c6899f1638 Replace QVariant::type with QVariant::userType
as type is going to be deprecated.

This change was done automatically with the help of clazy.
In addition, ColumnRoleMetadata was changed to take an int instead
of a QVariant::Type

Change-Id: Ibc02d7b52e7d931a56c19fdebc4788b5e6df2a39
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-01-17 11:31:35 +01:00
Ulf Hermann 5a4ffa0de0 QQmlListProperty: Add replace and removeLast functions
This allows us to implement QmlListWrapper::virtualPut(). Also, the
additional functions make the list properties useful in other contexts.

Fixes: QTBUG-79263
Change-Id: I528bc69222ca7743f0fc3697c3aed2a3468b4d87
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-01-15 14:09:19 +01:00
Alexandru Croitor 5fb8f1a328 Fix Qt6 build in preparation of qt5 submodule update
Fixes the QTextStream usages.

Change-Id: I0c009a82fb644a9f3c3d42ec410d18b680977f23
(cherry picked from commit 1c5c5f7aad)
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-19 07:37:51 +00:00
Albert Astals Cid ce94b847c8 Small performance improvements suggested by clang-tidy
mostly add const &, a few std::move and in particular case, remove const
so the std::move being done over the variable actually has effect

Change-Id: Id611cd31bc012f219d7a17d4626b1c2a5fbddd66
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-10-07 09:09:49 +02:00
Paul Wicking 8ec25f301d Doc: Fix typo in code snippet
Fixes: QTBUG-74444
Change-Id: If504fe2a6b4a0d88d69e777d433a6773db5f4df3
Reviewed-by: Michael Brasser <michael.brasser@live.com>
2019-03-27 13:05:10 +00:00
Ulf Hermann fbf6f7400a Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp
	src/quick/handlers/qquickhandlerpoint.cpp
	src/quick/handlers/qquicksinglepointhandler.cpp
	tests/auto/qml/ecmascripttests/test262

Change-Id: I8908ec8c6116ca626fbd269af7625d4c429429ca
2018-06-25 12:15:55 +02:00
Paul Wicking ed3a93feee Doc: Add missing dots (qtdeclarative)
Task-number: QTBUG-68933
Change-Id: Ibb5aa227e82825085e7214e17dcffcb17fd44157
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2018-06-19 12:44:48 +00:00
Mitch Curtis 31e64606f2 Animation: add finished() signal
Currently, Animation has a stopped() signal. This is executed even if
the animation is stopped manually. To react to an animation finishing
naturally, you currently have to do the following:

    onRunningChanged: if (!running) doStuff()

This patch adds a dedicated signal:

    onFinished: doStuff()

[ChangeLog][QtQuick][Animation] Added finished() signal to
Animation as a convenient way to react to an animation finishing
naturally.

Change-Id: I8765d3e8e2b7bf7ef66a6acb69feafb43e9619d3
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2018-03-09 09:11:31 +00:00
Ville Voutilainen 12afec6c2f Silence a GCC 8 warning in qquickanimation
qtdeclarative/src/quick/util/qquickanimation.cpp:1669:109: error: cast between incompatible function types from ‘QVariant (*)(qreal&, qreal&, qreal)’ {aka ‘QVariant (*)(double&, double&, double)’} to ‘QVariantAnimation::Interpolator’ {aka ‘QVariant (*)(const void*, const void*, double)’} [-Werror=cast-function-type]
         d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&_q_interpolateClockwiseRotation);

Change-Id: I8da70ef666deb3cbdbf05c5bac89f705a2ec5ea8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-02-28 16:11:18 +00:00
Shawn Rutledge 499ec43937 use nullptr consistently (clang-tidy)
From now on we prefer nullptr instead of 0 to clarify cases where
we are assigning or testing a pointer rather than a numeric zero.

Also, replaced cases where 0 was passed as Qt::KeyboardModifiers
with Qt::NoModifier (clang-tidy replaced them with nullptr, which
waas wrong, so it was just as well to make the tests more readable
rather than to revert those lines).

Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-02-26 07:13:18 +00:00
Kevin Krammer af128db8eb Add NOTIFY signals for QtQuick Animation classes to/from properties
Task-number: QTBUG-63178
Change-Id: Id3cd21625c17a3febba759e6895cb92db6ba314f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-12-16 19:11:56 +00:00
Thiago Macieira 80dc036882 Run includemocs in qtdeclarative
Change-Id: I84e363d735b443cb9beefffd14b8c023a37aa489
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-26 13:19:13 +00:00
Robin Burchell 3057ec0447 Port existing qmlInfo callers to qmlWarning
Now that qmlInfo actually reports info messages, we want to change
existing callers to use warning-level messages to preserve the original
message level.

This was done through:
    perl -p -i -e "s/qmlInfo\(/qmlWarning\(/" **/*.{cpp,h,qdoc}
.. with a little care taken to only add the hunks that should be changed.

Change-Id: I511cee11ce0a26ec1048cd2b84c7536b812a0d89
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-01-11 23:10:31 +00:00
Anton Kudryavtsev b6412090f3 Quick: add missing 'override'
... and drop redundant 'virtual'

Change-Id: Ifb887b149226769d3168f349ddccf0ee1d51bb1c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2016-10-07 13:48:52 +00:00
Anton Kudryavtsev b35858d4b8 Quick: replace 'foreach' with 'range for'
Change-Id: I3493b16a184fc811289db9e98eff37bb987113a3
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2016-08-18 08:42:37 +00:00
Erik Verbruggen 007ae316a6 QML: Unify property reads/writes and use accessors
Pass property reads/writes through utility functions in QQmlProperty,
which in turn will try to use accessors when available (and no
interceptors have to be called).

Change-Id: I60ecfc202b6024bfe4a33206a46299787b152546
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-07-25 09:26:38 +00:00
Anton Kudryavtsev 1be53f4e14 Use QStringRef to optimize memory allocation
Replace substring functions that return QString with
corresponding functions that return QStringRef where
it's possible.

Create QString from QStringRef only where necessary.

While touching the code, also port loops to C++11 style.

Change-Id: I04c99b24ea6afd3715e3edf9ea00bfab838fd53c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
2016-04-26 10:31:19 +00:00
Liang Qi 68ba8fe3cc Merge remote-tracking branch 'origin/5.6' into 5.7
This change also fixes the build of two benchmarks, tst_affectors
and tst_emission.

Conflicts:
	src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro
	src/qml/qml/ftw/qhashfield_p.h
	tests/benchmarks/particles/affectors/tst_affectors.cpp
	tests/benchmarks/particles/emission/tst_emission.cpp
	tests/benchmarks/qml/pointers/pointers.pro
	tests/benchmarks/qml/pointers/tst_pointers.cpp
	tests/benchmarks/qml/qmltime/qmltime.pro
	tests/benchmarks/qml/qquickwindow/qquickwindow.pro

Change-Id: I595309d1e183c18371cb9b07af6e4681059de3b2
2016-04-08 13:03:25 +02:00
Vladimir Moolle 3fb0f3fc83 Documentation: fix vector3danimation property type names.
Was real instead of vector3d.

Task-number: QTBUG-52213
Change-Id: Ib8d9bb39b51277c6f63d2b5c45433542a127149d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2016-04-01 13:09:44 +00:00
Jani Heikkinen 45bd04ba73 Updated license headers
From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/

Updated license headers to use new LGPL header instead of LGPL21 one
(in those files which will be under LGPL v3)

Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-19 14:53:18 +00:00
Mitch Curtis e333c1ac2d Don't warn about non-existent default properties when one was found
When at least one default property of a target object is considered
valid by an animation, we don't need to warn about other default
properties that weren't found.

Change-Id: I648f17a55fdfcbed2b4c7e94d88206c3dc3d1a32
Task-number: QTBUG-22141
Reviewed-by: Michael Brasser <michael.brasser@live.com>
2015-12-15 08:15:59 +00:00
Edward Welbourne fe83ad3ca6 Several cases of s/decelerating from/decelerating to/.
The relevant easing curves all start out fast and end stationery; so
it's at the *end* that they attain zero "velocity", so they're
decelerating *to* zero, not from it.

Change-Id: Ia691e39ef59708828a7e7f8af46b775abbff86fd
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2015-10-21 13:20:49 +00:00
Nico Vertriest c3d26e75b0 Doc: resize tables with overflow
Task-number: QTBUG-46475
Change-Id: Iebb2f7677f8b514d2b3e08480abfc98a0e155c1c
Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com>
2015-06-25 10:58:58 +00:00
Thiago Macieira 30aa0a1cc9 QtQuick: Fix const correctness in old style casts
Found with GCC's -Wcast-qual.

Change-Id: Ia0aac2f09e9245339951ffff13c9589afabc7ade
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-05-13 20:30:26 +00:00
Jani Heikkinen c5796292ad Update copyright headers
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.

Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9
Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
2015-02-12 10:28:11 +00:00
Jani Heikkinen e7ceacda70 Update license headers and add new licenses
- Renamed LICENSE.LGPL to LICENSE.LGPLv21
- Added LICENSE.LGPLv3 & LICENSE.GPLv2
- Removed LICENSE.GPL

Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0
Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
2014-08-25 11:28:46 +02:00
Nico Vertriest 2dcad8f5c8 Doc: correct link/compilation errors in Qt Declarative
Task-number: QTBUG-34749
Change-Id: I507d54b0568d77c6099a0bd99f5c369b8667032a
Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com>
Reviewed-by: Martin Smith <martin.smith@digia.com>
2014-07-02 14:52:54 +02:00
Michael Brasser 02ad96fa88 Support dumping of animation jobs via QML_ANIMATION_TICK_DUMP.
Change-Id: I0b444321667691be3e1037164d02f29ed4dfc13e
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-04-08 01:39:37 +02:00
Sze Howe Koh 303db2e8a1 Doc: Document signals (not handlers) under \qmlsignal
Append the handler names to the end of the corresponding signal doc.

Task-number: QTBUG-35846
Change-Id: I3d627ba7ed5be94e5c402ab092b4d582536499e8
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2014-03-18 13:17:42 +01:00
Sze Howe Koh ef9f85ad8d Doc: Fix broken links
Change-Id: I4c4577edde96978a986606bf30fbb925f871bd42
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2013-12-30 12:13:29 +01:00
J-P Nurmi ae59cb90ce QtQuick docs: add missing \qmlpropertygroup commands
"warning: No QML property group command found; using..."

Change-Id: Iafbdbc09cbd76bf81a5baf3a5a4fab843778b5cb
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2013-12-20 15:06:05 +01:00
Jacek Całusiński e2ca539562 Do not crash when one of group animation's children is null
Check if pointer to QQuickAbstractAnimation for which we are setting
group is valid.

Task-number: QTBUG-34851
Change-Id: Iecb549f080804fd9489f884911fa51892def05a5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-11-15 16:33:46 +01:00
Sze Howe Koh 22c138abfc Doc: Fix broken links
Change-Id: Ie7408409ddbaa354370267f2dd74326ec56a4186
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2013-11-05 15:37:29 +01:00
Gabriel de Dietrich 4ce2c0310c Remane private QQuickAction into QQuickStateAction
This avoid symbol conflicts when statically linking with Qt Quick
Controls, that has its own QQuickAction class and which may become
public some day. (QQuickPropertyAction might be a more apt name, but
it's already taken).

Change-Id: Ia9514d63d38295603a89d8ec5a88815a651380f7
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
2013-10-03 17:48:34 +02:00
Martin Smith 4706b1ceff qdoc: no longer recognizes the version nr in QML refs
All QML references of the form
<QML-module-name><QML-module-version>::<QML-type>::<member-name> have
had the <QML-module-version> removed i.

Task-number: QTBUG-33776
Change-Id: Idde279e0f254cd24ea44f9841662dd81a2c5bbc6
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2013-10-02 14:40:01 +02:00