aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util
Commit message (Collapse)AuthorAgeFilesLines
* Make the internals of QQuickAnimatorController privateUlf Hermann2021-02-021-1/+2
| | | | | | | | | | No one should mess with those. All the pointers have complicated ownership semantics. We can just befriend the test instead of making it all public. Task-number: QTBUG-90401 Change-Id: I6c4adbab7046b40db7f4628780ef928445ea3eb2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Export QML and Quick value typesUlf Hermann2021-01-221-9/+9
| | | | | | | They need to be accessible from C++. Change-Id: I60f2213bdbe6b8b64856e13f1e0cc798f8a51086 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove the qmake project filesFabian Kosmale2021-01-151-90/+0
| | | | | | | | | Remove all qmake project files, except for examples which are used to test that qmake continues to work. Change-Id: Ic4abb72dc2dcd75df7a797c56056b6b3c5fe62ac Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Change QQuickShortcut::setSequences to bind to all sequencesAndreas Buhr2021-01-151-23/+60
| | | | | | | | | | | | | | | When binding a Shortcut to a standard key sequence like QKeySequence::FullScreen, it binds only to one key sequence, even though there might be multiple key sequences associated. This patch changes the code to emit a warning in this case and allows to bind to multiple key sequences using 'sequences: [ <key> ]'. Fixes: QTBUG-88682 Pick-to: 6.0 5.15 Change-Id: I88998aa8858d8f2c0c86e46bae94afd7ceb15b66 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Do not revert properties of deleted objectsAlexey Edelev2021-01-141-0/+5
| | | | | | | | | | If state contains revert action of properties of deleted objects, we should avoid adding them to apply list Fixes: QTBUG-85106 Pick-to: 5.15 Change-Id: Iff57eb9958a054476096f6d951ab7390277a2b39 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix QQuickShortcut::setContext so re-grab all shortcutsAndreas Buhr2021-01-131-0/+7
| | | | | | | | | | | | A while ago, QQuickShortcut was extended to not only have a shortcut m_shortcut but in addition a list m_shortcuts. During this extension, the setContext method was missed: Shortcuts in m_shortcuts are not re-grabbed on context change. This patch fixes this. Task-number: QTBUG-88682 Pick-to: 6.0 5.15 Change-Id: Ie73d516f2a325a328b6e975d69490eea29a18401 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove unused variable fromSourcedAndreas Buhr2021-01-131-2/+1
| | | | | Change-Id: I20ff922136018960371ef00c6aa5c30d29c25690 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-12-161-1/+1
| | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in QtDeclarative. As the two are synonymous, this patch should have no impact on users. Task-number: QTBUG-86829 Change-Id: I5bb418483a3b06619abb4ff62cf0290a7b3bcd4f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Use QMetaType instead of metatype-id, take 2Fabian Kosmale2020-12-032-14/+14
| | | | | | | | | 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>
* Quick: Fortify QQuickApplication ctorUlf Hermann2020-12-021-12/+13
| | | | | | | | | | If the qApp we have is in fact not a QGuiApplication we cannot connect those signals. The "if (qApp)" was probably supposed to check for this but actually doesn't because qApp is a static_cast. Pick-to: 6.0 Change-Id: Iaa30e3d56768e97601d51d30500fc3b12d0626a3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix Animators requiring an explicit from valueRobert Griebl2020-11-282-3/+7
| | | | | | | | | | | | | | | | | | | Contrary to the documentation, Animators have always had the requirement that an explicit from value was specified, which isn't very convenient e.g. in Transitions. This patch was tested against a (quite big) real world customer application using Qt 5.12 and Qt 5.15. Also a new unit test was added to test this feature. I couldn't find another way to access the actual AnimatorJob besides querying the window's AnimatorController, so I had to add an auto-test only export on that class. Task-number: QTBUG-66475 Pick-to: 6.0 6.0.0 Change-Id: Icc2a220a13f587d69594a4b2ed345abf0438e29e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQuickStyledText: Avoid warning about setFontFamilyFabian Kosmale2020-11-231-1/+1
| | | | | | Pick-to: 6.0 Change-Id: I3595be758c757998951b24e46cb90bb74c9c45a4 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* pixmapcache: avoid deadlock when canceling async image loadNick Shaforostov2020-11-181-2/+2
| | | | | | | | was only possible if qml_network is disabled Pick-to: 5.15 Change-Id: If8a8addc0aa5c4c768dd7df3aa4d627f82a78059 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* QML: Rewrite Qt object in actual C++Ulf Hermann2020-11-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Quite obviously, the Qt object is a singleton, extended with a namespace, backed by a member of the JavaScript global object. Defining all the methods as JavaScript functions is unnecessary and duplicates the general type transformation code. Also, it makes it hard to use those same methods from a C++ context as we cannot properly set up the arguments outside the JS engine. Rewriting the Qt object reveals some deficiencies in the old implementation that we need to fix now: 1. The enums of the Qt type were listed as properties of the Qt object, which means you could iterate them with a for..in loop in in JavaScript. This is just wrong. Enums are not properties. This functionality is deleted and the test adapted to check for each enum value separately. The commit message for the change that introduced the iterability already mentioned that the author had failed to find any occurrence of this in the real world. 2. Parsing time objects from strings was done by parsing the string as a date/time and then picking the time from that. We still support that for now, but output a (categorized) warning. Parsing the time directly is preferred where possible. 3. Previously you could create (invalid) dates and times from various kinds of QML types, like int and color. This does not work anymore as we now validate the types before calling the functions. 4. Passing more arguments to a function than the function accepted was unconditionally ignored before. Now, a Q_CLASSINFO on the surrounding class can specify that the arguments should be checked, in which case a JavaScript error is thrown if too many arguments are passed. In order for this to work correctly we also have to ignore JS undefined values as trailing arguments for overload resolution. This way, if a method matching the defined arguments exists, it will be preferred over a method that matches the full argument count, but possibly cannot accept undefined as parameter. Consequently a number of error messages change, which is reflected in the qqmlqt test. [ChangeLog][QtQMl][Important Behavior Changes] You can not iterate the enumerations of the Qt object in JavaScript anymore. This does not work with any other enumeration type either. You can of course still access them by name, for example as Qt.LeftButton or similar. [ChangeLog][QtQMl][Important Behavior Changes] The time formatting functions of the Qt object in QML now allow you to pass an actual time string, rather than a date/time string as argument. Passing a date/time string results in a warning now. [ChangeLog][QtQml][Important Behavior Changes] Functions in the Qt object for formatting date and time will now throw a JavaScript error when presented with a value of an incompatible type, such as int or color. [ChangeLog][QtQml][Important Behavior Changes] The Qt.resolvedUrl() function now returns a URL rather than a string. This follows the documentation. [ChangeLog][QtQml][Important Behavior Changes] The GlobalColor enum of the Qt namespace is not exposed to QML anymore. It did not make any sense before as the enum values could not be used as colors. Change-Id: I7fc2f24377eb2fde8f63a1ffac5548d652de7b12 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlListProperty: Use qsizetype rather than int for sizesUlf Hermann2020-11-098-30/+30
| | | | | | | | | | [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>
* Doc: Fix documentation warnings for Qt QuickTopi Reinio2020-11-051-1/+1
| | | | | | | | | | | - Remove links to modules and examples that are not part of Qt 6. - Remove links to entities marked as \internal - Add missing enum value and QML property docs where it's trivial to do so. Task-number: QTBUG-88156 Change-Id: I10a1c7bcc5fe0e2354ea69eaf24930362edb7415 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Remove some outdated comments about FontLoader.nameEskil Abrahamsen Blomfeldt2020-11-041-4/+2
| | | | | | | | | | | In 15ea475b40f6ad28d46e5cbd65a1ccc8556a53df, I made FontLoader.name readonly and got rid of the usage where it could also be used as an indirection for the font family string. But there were a couple of comments about this usage still in the documentation, so those should also be removed. Change-Id: Ibf182e1252644e155843dea8f85f4a2f7fb56297 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Get rid of all instance usage of QFontDatabaseVolker Hilsheimer2020-11-021-2/+1
| | | | | | | | All QFontDatabase APIs are static, use them accordingly. Task-number: QTBUG-88114 Change-Id: Iaa6be07e47adcdb5115e475cc5228f403e9a2b27 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix documentation links to removed functionsVolker Hilsheimer2020-10-232-2/+2
| | | | | Change-Id: I01fe454c521d4d85118e5ebfdfe4e343978fe874 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix alwaysRunToEnd==true prevented complex Anim from stoppingPiotr Mikolajczyk2020-10-132-0/+10
| | | | | | | | | | AnimatorProxyJob would not forward loopCount to the controlled job causing the sequential or parallel animation to go infinitely after attempt to stop Task-number: QTBUG-82890 Pick-to: 5.15 Change-Id: I6a1ca787f06789064e05407bbe9ae5e5861f24d5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Use factory functions and ctors for creating value typesUlf Hermann2020-10-023-397/+236
| | | | | | | | | | As you can extend value types with QML_EXTENDED we may as well allow a factory function in the extended type. Furthermore, if the original type allows construction from QJSValue, we may just use that. In turn, we can get rid of the value type providers now. Change-Id: I9124ea47537eab6c33d7451080ab2fff942eaa7b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Eliminate QQmlValueTypeProvider::storeValueType()Ulf Hermann2020-09-231-28/+0
| | | | | | | | | | | | It was only used for QColor. The string representation of QColor was funneled through the color provider to get a numerical RGBA value and that one was passed to storeValueType() which would create a QColor object. The RGBA value was retrieved by creating a QColor object. We can just directly create the QColor from the string, and we can use the generic create() method for that. Change-Id: If36775830882237e5e36f748872ce23530c3bb71 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Eliminate QQmlValueTypeProvider::createVariantFromString()Ulf Hermann2020-09-231-52/+0
| | | | | | | This can be expressed as constructing the variant from a QJSValue. Change-Id: I3140958469423acdc498e26129e349bcfb601198 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Eliminate QQmlValueTypeProvider::createFromStringUlf Hermann2020-09-231-24/+42
| | | | | | | It can be expressed as a special case of create() with a QJSValue. Change-Id: I7342026ad694077d2780dd8a852714fa72dd68d0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove QQmlValueTypeProvider::variantFromJsObjectUlf Hermann2020-09-231-128/+84
| | | | | | | This can be expressed in terms of create(). Change-Id: Id1950390bf4a1c9dfd9364ea351b81c75eb7e28f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlValueTypeProvider: Pass arguments as QJSValueUlf Hermann2020-09-231-25/+36
| | | | | | | | This is so that we can replace them with factory functions as a next step. Change-Id: Ic8619e4e779bd3e47471642c556601555758697b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow proper registration of value typesUlf Hermann2020-09-233-119/+107
| | | | | | | | | | | | | | | | | | | | You can now have an extension object on a value type that offers additional properties. This is how we model the QtQuick value types. It allows us to retrieve the extension's metaobject without using the virtual functions in the value type provider. As before, this mechanism is still rather dangerous and not fit for public consumption. It relies on the extension object having exactly the same layout as the original value type, and it hides any properties the original value type might expose. Furthermore we enforce now that gadgets should have lowercase names. The ones that didn't before are split up into an anonymous value type and a namespace that contains all the addressable bits. Task-number: QTBUG-82443 Change-Id: Ic93d6764538d6ccc0774b3c5648eee08ba0939c0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Register StandardKey as foreign namespace rather than elementUlf Hermann2020-09-211-4/+3
| | | | | | | | | We are only interested in the enum of the same name. StandardKey is not creatable nor does it have any properties. It is also written in uppercase. Logically it therefore is a namespace. Change-Id: I98217625161f8d6f04bc328620cb2d93aa601fae Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlValueTypeProvider: Use QMetaTypeUlf Hermann2020-09-161-136/+0
| | | | | | | | We can create, compare, convert registered types without going through special virtual value type providers. Change-Id: I0431256540b8dd6861ff3a945570ea7df45ed98d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QQmlValueTypeProvider: Remove dead codeUlf Hermann2020-09-161-54/+0
| | | | | | | | | The more adventurous variant/string conversions are luckily unused. Let's remove them before anyone gets ideas. Change-Id: I6f95cbdf9ead12ab723cafdbb2b0f02a0ff461fa Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Avoid various warnings about deprected QMetaType methodsUlf Hermann2020-09-161-2/+2
| | | | | Change-Id: I8f4b2703fdd08ff341904219cec33c321e0511c7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix build after API changes to QColorLars Knoll2020-09-151-6/+6
| | | | | Change-Id: I21dcde88ab8e8ede127c9c0b992db537bb07354f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Quick: Manually register metatype for QVector<QVector<QPointF>>Ulf Hermann2020-09-151-0/+5
| | | | | | | | For some reason this doesn't happen automatically anymore, and therefore the qquickshape test failed. Change-Id: Idc1281375123458923fdbc3ce2041d9e4fcfaf5f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QQuickImageProvider: Remove reliance on RTTIFabian Kosmale2020-09-012-1/+2
| | | | | | | | | | | | | Using staticCast is unsafe, because in theory you can derive from QQmlImageProviderBase instead of QQuickImageProvider. But using dynamicCast runs into issues, because while Qt needs to be compiled with RTTI, user code does not. We thus turn the baseclass into a QObject so that qobject_cast does work. Fixes: QTBUG-84127 Change-Id: Id40d8a13eaa0101d80bd5742a23996354d70c72a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Use OpenType font weightsJonas Karlsson2020-08-283-3/+3
| | | | | | Task-number: QTBUG-42248 Change-Id: Ib26d4945307b630b054e270b3213e1c9ad0d5357 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Use QPalette::resolveMask() and setResolveMask() where necessaryShawn Rutledge2020-08-282-3/+3
| | | | | | | This is needed after qtbase b77a3f47c9d6f4fd68a687e3bdb38e550d2810ad. Change-Id: I41cf66d51dad7209c21d9e4049497a1f911e132a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* webOS: Share images even if cache is falseElvis Lee2020-08-171-1/+34
| | | | | | | | | | | | | | | | | | Regardless Image::cache property, pixmap will be shared between images having same source. Image::cache property had two aspect of internal functionality. 1. Share image instance if source file is same. 2. Store cache for a while even if unreferenced. So we couldn't choose one of them with existing the cache property. In webOS, sharing image instance is quite natural. So by default, the sharing is always supported regardless the cache property. And the property will only cares the 2nd functionality to store cache. Pick-to: 5.15 Change-Id: I68208cf633ce2afd5f086a61dcc77d0f3d0da037 Task-number: QTBUG-83115 Reviewed-by: Risto Avila <risto.avila@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Use qHashMulti in qHash(QQuickPixmapKey)Shawn Rutledge2020-08-171-6/+2
| | | | | | | Amends 9cc4568de330e0075c960a5431ecd69a1f9a761d (and others). Change-Id: Ic67a34ffb903d79882d4a74415f52db5a79d30d6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Quick: Make sure the module initialization runs in static buildsUlf Hermann2020-08-101-1/+142
| | | | | | | | | | | | We need to keep a reference to the module initialization function somewhere in order to prevent the linker from removing it. In order to avoid further littering of the namespace, the QQuick_initializeProviders function is transformed to cover all of the initialization. Task-number: QTBUG-85693 Change-Id: Ie93e5abd1dfb5a425b87c70d8ec6327bb68880cb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix compilation with newer qtbaseFabian Kosmale2020-08-061-2/+2
| | | | | | | | | | qstrtod is no longer exported, but instead an inline function. This replaces the existing forward declarations with an include of the required private header. Change-Id: I50bd32557c55dddcb197f163609fd7d5a1b2301b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make the qtquick and qtqml plugins optionalUlf Hermann2020-07-021-7/+0
| | | | | | | | | We can do the initialization and de-initialization as constructor and destructor functions. Then we don't need to load the plugins. Task-number: QTBUG-84639 Change-Id: I2aeeee7e8d028555e3af91e93518c2c2afd70dbb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Reimplement UniformAnimator for ShaderEffectJonas Karlsson2020-06-294-74/+23
| | | | | | Fixes: QTBUG-83976 Change-Id: I307e96be0d3d2edeb8d9065d100c1ef38c8824c7 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Add ; to Q_UNUSED and UNUSED_PARAMLars Schmertmann2020-06-261-1/+1
| | | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: Iead53d18fd790fb2d870d80ef2db79666f0d2392 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Replace QQmlBoundSignalExpressionPointer with QQmlRefPointerUlf Hermann2020-06-241-8/+11
| | | | | | | They do the same thing. Change-Id: Ia35832e6175728e7480d09caba6d3833718d9e80 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Move resetOpenGLState out of QQFBOGiuseppe D'Angelo2020-06-233-0/+194
| | | | | | | | | | | | | QQFBO is not the only client of resetOpenGLState. Although in theory third-party GL code that integrates with QtQuick should reset its state, in practice it doesn't. By making resetOpenGLState only available into QQFBO, now we're blocking a Qt5->6 upgrade path. There's also no compelling reason for this function to be in QQFBO at all, so move it out to as a free function in a ad-hoc new namespace. Change-Id: Ic8e5c7e244db37a5b6257d516e6aea3a9db44898 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Do not resolve URLs when assigning them to a propertyUlf Hermann2020-06-221-10/+16
| | | | | | | | | | | | | | | We don't know in advance if a URL is part of the source code and should be relative to the current element, or if it is part of the application data and should not be touched. [ChangeLog][QtQml][Important Behavior Changes] URLs are not resolved or intercepted anymore when assigning them to a "url" property. Instead they are resolved and possibly intercepted when used to access an actual resource. Fixes: QTBUG-76879 Change-Id: Iaa2385aff2c13aa71a12e57385d9afb5dc60a073 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Port QtDeclarative from QStringRef to QStringViewKarsten Heimrich2020-06-164-43/+43
| | | | | | | | 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>
* Quick: Use unicode character literalsUlf Hermann2020-06-101-1/+1
| | | | | | | This avoid warnings on conversion to QChar. Change-Id: Idad6a35bb47b029688c5752a03ef83cb5b63373e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix warnings from deprecated QChar constructorVolker Hilsheimer2020-06-041-1/+1
| | | | | Change-Id: I7238c6aaac2f4e0ee2f64afcb4dc9b46497e2c91 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Remove QQuickOpenGLShaderEffectPaul Olav Tvete2020-06-044-23/+7
| | | | | | | | | This also removes QQuickUniformAnimator, which is not yet ported to RHI (QTBUG-83976) Task-number: QTBUG-83977 Change-Id: I3e656e6817ac991371b7f6557f050e122635d279 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>