aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util/qquickglobal.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix use of deprecated QColor ctorMårten Nordheim2022-03-231-2/+2
| | | | | | | | + Removed some .constData where it was not needed Change-Id: Ib52c6ec1a5e691c952a82903dea76d79535c72b7 Reviewed-by: Marc Mutz <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* Avoid unnecessary color format conversionJiDe Zhang2021-10-291-2/+2
| | | | | | | | | | | | If a color is not the rgb format, when QColor::red() QColor::blue() QColor::green() is used continuously to obtain the values of different channels, three times color conversions will occur. Therefore, use QColor::toRgb() before that to ensure that only one conversion is performed at most. Not only rgb, the conversion of other formats is the same. Change-Id: Ia969e1ca6f1524ad5d7e8dec915bcbc407875c66 Reviewed-by: Shawn Rutledge <[email protected]>
* Use QQmlAnyBinding in QQuickState and related classesFabian Kosmale2021-03-041-4/+3
| | | | | | Fixes: QTBUG-91000 Change-Id: I80b54d85ab694f0fbce8a05f55881cc88fefb1da Reviewed-by: Ulf Hermann <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* Use factory functions and ctors for creating value typesUlf Hermann2020-10-021-397/+0
| | | | | | | | | | 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* Remove QQmlValueTypeProvider::variantFromJsObjectUlf Hermann2020-09-231-128/+84
| | | | | | | This can be expressed in terms of create(). Change-Id: Id1950390bf4a1c9dfd9364ea351b81c75eb7e28f Reviewed-by: Fabian Kosmale <[email protected]>
* 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 <[email protected]>
* Allow proper registration of value typesUlf Hermann2020-09-231-26/+0
| | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]> Reviewed-by: Lars Knoll <[email protected]>
* 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 <[email protected]>
* Use OpenType font weightsJonas Karlsson2020-08-281-1/+1
| | | | | | Task-number: QTBUG-42248 Change-Id: Ib26d4945307b630b054e270b3213e1c9ad0d5357 Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
* 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 <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]> Reviewed-by: Ulf Hermann <[email protected]>
* Port QtDeclarative from QStringRef to QStringViewKarsten Heimrich2020-06-161-14/+14
| | | | | | | | Task-number: QTBUG-84319 Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15 Reviewed-by: Mårten Nordheim <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]> Reviewed-by: Timur Pocheptsov <[email protected]>
* Quick: Clean up some includesUlf Hermann2020-06-041-5/+5
| | | | | | | Uniformly use <...> and sort them by modules. Change-Id: I11cd160783dfb141d8824d635bdc56a63aaee50f Reviewed-by: Shawn Rutledge <[email protected]>
* Implement Qt.alpha()Maximilian Goldstein2020-04-141-0/+7
| | | | | | | | | | | | Introduces an easy way to get a version of a color with transparency (e.g. Qt.alpha("red", 0.5)). [ChangeLog][QML][General] Added Qt.alpha for easily modifying a color's alpha value Task-number: QTBUG-77635 Change-Id: Ic724e5fa503ca2ae5157a99eed1b5c913a39239f Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]>
* Merge remote-tracking branch 'origin/5.15' into devSimon Hausmann2020-02-031-0/+60
|\ | | | | | | | | | | | | | | Conflicts: src/qml/common/qv4compileddata_p.h tests/auto/qml/qmlmin/tst_qmlmin.cpp Change-Id: Ieabc9e0729630de6a8644024d11b765f35199f29
| * Image ColorSpace bindings for Quick/QMLAllan Sandfeld Jensen2020-01-311-0/+60
| | | | | | | | | | | | | | | | | | | | Adds a ColorSpace type mapped to QColorSpace, and adds a property to Image nodes to read and change it, converting the image if necessary on read. Fixes: QTBUG-80616 Change-Id: Ie80c8bc045f66de01de3a5d2c4a9974f07d2871d Reviewed-by: Andy Nichols <[email protected]>
* | Make Font.weight an integer instead of enumerationEskil Abrahamsen Blomfeldt2020-01-211-1/+1
|/ | | | | | | | | | | | | | | | | | | The weight in QFont is an integer, allowing you to request a font of any weight given the predefined scale. In Qt Quick, however, you were limited to the predefined values. This is done in Qt 6 because it breaks conversions from string to weight, as the change in the autotest illustrates. [ChangeLog][Font] Made Font.weight an integer value rather than limit it to a predefined set of weights. As a side effect, conversion from strings to font weights are no longer supported. Fixes: QTBUG-80402 Change-Id: Ifbe9a0e608b63bfa93bb54999b0b3c1851ccfa88 Reviewed-by: Ulf Hermann <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Simon Hausmann <[email protected]>
* Replace QVariant::type with QVariant::userTypeOlivier Goffart2020-01-171-1/+1
| | | | | | | | | | | 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 <[email protected]>
* Remove QQmlV4HandleUlf Hermann2019-04-101-3/+3
| | | | | | | | This is just an alias for QV4::ReturnedValue. We can as well use the latter. Change-Id: Ibd2c038a3ca726b39a8f0f05e02922adb9fccbdb Reviewed-by: Simon Hausmann <[email protected]>
* Remove unused includes of qv8engine_p.hUlf Hermann2019-04-091-1/+0
| | | | | Change-Id: Ic135a863581d29a3afb9c6c7f070d2630b3913b4 Reviewed-by: Lars Knoll <[email protected]>
* Unify the get and getIndexed vtable functions of QV4::ObjectLars Knoll2018-07-021-1/+1
| | | | | | | | This finalizes the refactoring of Object's vtable API. Also added the receiver argument to the method as required by the ES7 spec. Change-Id: I36f9989211c47458788fe9f7e929862bcfe7b845 Reviewed-by: Simon Hausmann <[email protected]>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-3/+3
| | | | | | | | | | | | | 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 <[email protected]>
* Replace Q_DECL_OVERRIDE with overrideKevin Funk2017-09-251-12/+12
| | | | | Change-Id: I176f91a8c51e81a2df3fe91733118261491223ee Reviewed-by: Lars Knoll <[email protected]>
* Add property to disable shaping on fontsEskil Abrahamsen Blomfeldt2017-08-251-0/+8
| | | | | | | | | | | | | | | Major performance improvements can be gained if you know for sure your text does not require any shaping features. This patch adds Qt Quick support for the QFont::PreferNoShaping flag (though as a boolean property to work better with property bindings). [ChangeLog][QtQuick][Text] Added "font.preferShaping" property to Text, TextEdit and TextInput. This makes it possible to improve performance at the expense of some cosmetic font features. Task-number: QTBUG-56728 Change-Id: Ib4e23d5b21b9d4929562df521347285b2586a62e Reviewed-by: Simon Hausmann <[email protected]>
* Expose "kerning" property for fontsEskil Abrahamsen Blomfeldt2017-06-301-0/+5
| | | | | | | | | | | | For text where the content is known, it can be handy to be able to disable the kerning feature in OpenType to improve performance. [ChangeLog][Qt Quick][Text] Added "kerning" property to the font type to support disabling kerning on text. Task-number: QTBUG-56728 Change-Id: I2e447587a066a7e12c5d38967e0845eaad021014 Reviewed-by: Simon Hausmann <[email protected]>
* Add Qt.platform.pluginName propertySami Nurmenniemi2017-06-061-0/+5
| | | | | | | | | | | | This exposes QGuiApplication::platformName() for qml. It is required at least for tests that are run on the "offscreen" platform (armv7 tests on qemu). [ChangeLog][QtQuick] Added Qt.platform.pluginName property. Task-number: QTBUG-60268 Change-Id: Ie55a282485d4d76ffe7ed8e77359ad7183f579c2 Reviewed-by: Simon Hausmann <[email protected]>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-211-0/+1
|\ | | | | | | Change-Id: Ibed6ee74d36b4ce37391c82db00a0abd30d09e7a
| * Fix warning for -no-feature-desktopservicesStephan Binner2017-04-181-0/+1
| | | | | | | | | | Change-Id: Ia3a590a564ab9bde9b19c4e7955420a7d1eacb2b Reviewed-by: Simon Hausmann <[email protected]>
* | sources: Add missing override and remove redundant virtualAlexander Volkov2017-02-231-13/+13
|/ | | | | | | Change-Id: I48e26b1491024d41ebf75d40f0d1a7e9a1b20f22 Reviewed-by: Anton Kudryavtsev <[email protected]> Reviewed-by: Marc Mutz <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]>
* Get rid of most QT_NO_FOO usagesLars Knoll2016-11-291-1/+1
| | | | | | | | Instead use QT_CONFIG(foo). This change actually detected a few mis-spelled macros and invalid usages. Change-Id: I06ac327098dd1a458e6bc379d637b8e2dac52f85 Reviewed-by: Simon Hausmann <[email protected]>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-131-11/+11
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsapi/qjsengine.cpp src/qml/qml/qqmlengine_p.h src/quick/items/qquickanchors.cpp src/quick/items/qquickanimatedimage_p_p.h src/quick/items/qquickitem_p.h tests/auto/qml/qqmlecmascript/testtypes.h tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp tests/benchmarks/qml/creation/tst_creation.cpp Change-Id: I65861e32f16e8a04c7090a90231627e1ebf6ba6f
| * Use QStringRef to optimize memory allocationAnton Kudryavtsev2016-04-261-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Simon Hausmann <[email protected]> Reviewed-by: Frank Meerkoetter <[email protected]> Reviewed-by: Shawn Rutledge <[email protected]> Reviewed-by: Robin Burchell <[email protected]>
* | Add property for setting hinting preference on fontsEskil Abrahamsen Blomfeldt2016-03-151-0/+5
|/ | | | | | | | | | | | | | | | | As screen density is rapidly increasing and user interfaces are moving more and more towards using unhinted text as default, we have to make it possible to select the hint level from Qt Quick as well. While this is already partially covered by the unhinted QtRendering render type, it is still interesting to be able to tweak the native rendering accordingly, since this is a more precise rasterization. QtRendering also doesn't support medium hinting. [ChangeLog][Text] Added "hintingPreference" property to Text, TextEdit and TextInput. Change-Id: Ib99dbea24aba082481629deddde88c04cdeb8cdb Reviewed-by: Konstantin Ritt <[email protected]> Reviewed-by: Simon Hausmann <[email protected]>
* Updated license headersJani Heikkinen2016-01-191-15/+21
| | | | | | | | | | | 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 <[email protected]>
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-11-211-1/+5
|\ | | | | | | Change-Id: I3567f741394f912d4312460e85555b6c39b61cb4
| * Introduce a more sane "default constructor" for Qt.matrix4x4()Sean Harmer2015-11-111-1/+5
| | | | | | | | | | | | | | | | | | | | If no arguments are specified, create an identity matrix. This is by far the most common use case. This change avoids having to type in the 16 arguments of the identity matrix. Change-Id: I9e0d71897c5368d19ae87cff936df4b9e5e9b84a Reviewed-by: Laszlo Agocs <[email protected]> Reviewed-by: Lars Knoll <[email protected]>
* | Use QStringRef in a bunch of places.wip/dbusSérgio Martins2015-10-181-5/+5
|/ | | | | | | Done automatically with clazy static analyzer. Change-Id: Ia0cf8fa24331ab102a3c3c30c2aa92ef1ba772e2 Reviewed-by: Simon Hausmann <[email protected]>
* Fix compiler warnings on recent clangLars Knoll2015-08-251-1/+1
| | | | | | | Add some Q_DECL_OVERRIDE and a cast Change-Id: I834d16049805b5fc6e64a64d26cd6c92ac873163 Reviewed-by: Simon Hausmann <[email protected]>
* Update copyright notice.Frank Meerkoetter2015-08-181-0/+1
| | | | | | | Update the copyright notice on files containing larger changes from me. Change-Id: I46cb83161331ef2f49a6ec92c078d6dc8019081e Reviewed-by: Simon Hausmann <[email protected]>
* Remove QQmlVMEVariant specific workaroundFrank Meerkoetter2015-08-181-9/+1
| | | | | | | | A Q4x4Matrix wouldn't fit inside a QQmlVMEVariant. Therefore it was wrapped in a QVariant. Change-Id: I68864e456a4fd76143277d5a10d1a3f307e833f2 Reviewed-by: Simon Hausmann <[email protected]>
* Remove unused codeFrank Meerkoetter2015-08-181-25/+2
| | | | | | | | The QQmlObjectCreator is the only user left. It is using it only with QVariant::Color. Change-Id: I5091fd160841118bee5d6cf6e30798f66c277b69 Reviewed-by: Simon Hausmann <[email protected]>
* Mark methods as overridesFrank Meerkoetter2015-08-181-11/+11
| | | | | | | Let the compiler help to catch interface changes Change-Id: Ic4add183ca95ef287df41f35bd25c3e9eb15032f Reviewed-by: Simon Hausmann <[email protected]>