aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlvaluetype.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Run includemocs in qtdeclarativeThiago Macieira2017-04-261-0/+2
| | | | | Change-Id: I84e363d735b443cb9beefffd14b8c023a37aa489 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Qml: optimize string usageAnton Kudryavtsev2016-08-091-3/+3
| | | | | | | | | | Use QStringBuilder more. Use QString::asprintf instead of arg()'s chain. Use += operator to reserve extra capacity for possible free following append/prepend/+= call. Change-Id: Ib65398b91566994339d2c4bbfaf94e49806b7471 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QJSValue: Adapt to introduction of QMetaType::NullptrChristian Kandeler2016-08-081-0/+1
| | | | | | | | | [ChangeLog][QtQml][Important Behavior Changes] A JS null value converted to a QVariant now has type QMetaType::Nullptr rather than QMetaType::VoidStar. Change-Id: I91a64e444ada0f1884fe807f9973348ba1a878ff Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Unify property reads/writes and use accessorsErik Verbruggen2016-07-251-1/+1
| | | | | | | | | 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>
* QQmlEasingValueType: replace QList<qreal> with QVector<qreal>Anton Kudryavtsev2016-04-141-1/+1
| | | | | | | | | | In this case QVector is more efficient, e.g. for 64-bit builds with qreal=float or for 32-bit builds with qreal=double Change-Id: Ie6cf965ee1130e768c4da148f281c7d8319ac873 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QQmlEasingValueType: use reserve() to optimize memory allocationAnton Kudryavtsev2016-04-141-3/+4
| | | | | | | | While touching the code, also port the loop to C++11 style. Change-Id: Iff5182fa7e4678b2366d9ae8fbd1427140b92ac5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-191-14/+20
| | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.5' into 5.6Simon Hausmann2015-09-021-1/+2
|\ | | | | | | Change-Id: Ibc7a47f7ce6d15dff79fdc59f8ded297d1b8d50d
| * Don't consider QLocale a value type.Mitch Curtis2015-09-021-1/+2
| | | | | | | | | | | | | | | | | | | | This fixes a regression where all of the properties of Qt.inputMethod.locale were undefined. Change-Id: Id33890a78296709baad6aeda96d74ca8cb39c61d Task-number: QTBUG-47916 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.5' into 5.6Ulf Hermann2015-08-181-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/debugger/qv4debugservice.cpp src/qml/jsruntime/qv4value_inl_p.h src/qml/jsruntime/qv4value_p.h src/qml/memory/qv4mm.cpp src/qml/memory/qv4mm_p.h src/qml/qml/qqmlnotifier_p.h src/qml/qml/qqmlproperty.cpp src/quick/items/qquickflickable.cpp src/quick/items/qquicktextedit.cpp tests/auto/quick/qquickwindow/BLACKLIST The extra changes in qqmlbinding.cpp are ported from changes to qqmlproperty.cpp that occurred in parallel with writeBinding() being moved to qqmlbinding.cpp. Change-Id: I16d1920abf448c29a01822256f52153651a56356
| * QtQml: Fix const correctness in old style castsThiago Macieira2015-07-091-1/+1
| | | | | | | | | | | | | | Found with GCC's -Wcast-qual. Change-Id: Ia0aac2f09e9245339951ffff13c958364a2e9859 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-06-301-0/+39
|\| | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qml/qml/qqmlengine.cpp src/quick/items/qquickitemsmodule.cpp tools/qml/main.cpp Change-Id: Ida8daf6b4d7e675385f2f5514c446e52dedaf136
| * Add left, right, top and bottom properties to basic QML rect type.Mitch Curtis2015-06-031-0/+39
| | | | | | | | | | | | | | Task-number: QTBUG-45528 Task-number: QTBUG-45530 Change-Id: I83c4056b4bde37ef2dc4424ffddd823c1654d92e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Add 28 QList::reserve() callsSérgio Martins2015-06-081-1/+3
|/ | | | | Change-Id: Id4820ac458f48b10f2bf457144767efdef9e2c07 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Speed up value type binding creationSimon Hausmann2015-04-161-5/+7
| | | | | | | | | | | * Avoid calling QMetaType::construct/destruct(typeId, ...) as that requires repeated lookups in the type registry. Instead cache the constructor/destructor/etc. function addresses in the QQmlValueType singletons as QMetaType * Allocate memory for the gadget pointer lazily, to accommodate the common case of a value type binding by property reference. Change-Id: I98a3ac73453b8f80027c06401b4f29a9707949d2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove QItemSelection value-type, use Array insteadGabriel de Dietrich2015-03-221-3/+0
| | | | | | | | We implement this by adding QItemSelection to the set of sequence types. Change-Id: Ia3db376c806d8f062639e22c7f4bf392f114c266 Reviewed-by: Stephen Kelly <steveire@gmail.com>
* Remove QModelIndexList value type, use Array insteadGabriel de Dietrich2015-03-221-8/+5
| | | | | | | | We implement this by adding QModelIndexList to the set of sequence types. Change-Id: If7e0e88ab0c2916c2b65a926f8241549520d7391 Reviewed-by: Stephen Kelly <steveire@gmail.com>
* Acknowledge QPersistentModelIndex is a built-in meta-typeGabriel de Dietrich2015-03-121-30/+3
| | | | | | | | | | We remove the now unnecessary meta-type registration and conversions for QPersistenModelIndex. This reverts and amends commit 7b29a983fa794291ff8ec. Change-Id: I4e8346bb7ab03766e1dd5c2c23bb6cf47ab1f455 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Work around QPersistentModelIndex being a built-in meta-typeGabriel de Dietrich2015-03-051-3/+27
| | | | | | | | This is a temporary work-around and will be removed once I63d733d1eb66aa61691e7afce27fe7372a83ac00 is merged in qtbase. Change-Id: I6cfcf1ddc2c9d408c26c171be865d40141de7fa0 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Add Q_GADGET wrappers for QModelIndex & Co.Gabriel de Dietrich2015-02-121-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | The complete list of types is, * QModelIndex * QModelIndexList * QPersistentModelIndex * QItemSelection * QItemSelectionRange These wrapper types follow the QQmlValueType conventions and allow us to expose the wrapped types without introducing meta-type changes. They also allow to customize the string type representation. We also extend QQmlValueTypeFactory to return the meta-object for those types. Finally, we add two-way meta-type conversion between QModelIndex and QPersistentModelIndex to get the same interoperability as in C++ when passing an object of one type to a function requir- ing an object of the other type. Change-Id: Iaa7089ea576c901f12715ffa21e4d94603d53755 Reviewed-by: Caroline Chao <caroline.chao@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | 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>
* Fix property access and method invocation on value types that use inheritanceSimon Hausmann2015-01-071-1/+3
| | | | | | | | | | For gadgets/value types we use moc's static_metacall, which doesn't call the parent class implementation. Therefore before placing a static metacall we must resolve the indicies and find the right meta-object. Change-Id: I258e3d9ecfc704498c68772dc42b16134a3bfd83 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Enable gadget wrapping for custom value typesSimon Hausmann2015-01-021-0/+3
| | | | | | | | | | | | | | | | | | [ChangeLog][QtQml] Custom C++ value types annotated with Q_GADGET are now fully accessible in the QML and QJSEngine JavaScript environment. QJSEngine::toScriptValue can be used for injection and fromScriptValue to extraction. The QML "built-in" gadget wrappers for QPoint and the gui types are not exposed this way, toScriptValue(point) will still return an opaque QVariant wrapper. We could expose the core types right away, but then we would be lacking an API to enable use of the Gui types that are registered in QtQuick. It would be better to make the core types in qtbase gadgets and thus enable them without the need for hooks and init functions to be called by the user. Task-number: QTBUG-29769 Change-Id: I8179cd599bdc1209ff61cfdbdda419cb400296bb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Removed usage of QQmlValueType in QQmlValueTypeWrapperSimon Hausmann2014-12-281-42/+5
| | | | | | | | | | | | | | | QQmlValueType doesn't have anything really necessary :). Some code it has, but that was only called from the wrapper, so it was moved there. This also reduces one level of memory allocation for the wrapper. In theory the allocation for the JavaScript wrapper could be changed to be the size of the wrapper _plus_ the size needed for the gadget. However in anticipation of wanting to be able to move objects, we can't do that as we can't memmove() gadgets around - they might contain pointers to memory areas within. Change-Id: Icb5a6f5513e3b2c87f6639f6f7b1fb572af08137 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Initial work on gadget supportSimon Hausmann2014-12-221-79/+119
| | | | | | | | | | | | | | | | | | | | | | Changed built-in QtQml value types to use gadgets. This is in preparation for supporting external gadgets. This replaces the mostly direct inheritance of the concrete value types with gadgets and "dynamic" inheritance through QQmlValueType being generic. Over time as some of the value types may become gadgets, we can remove the ones here. It's important that these "separate" gadgets have the same memory layout as the actual types (QPointF, etc.). Also while QQmlValueType remains practically a singleton, it's not required anymore to be one. Consequently the JS wrappers for value types keep their own instance of QQmlValueType. This allows eliminating the qobject_cast in various places that dealt with the singleton nature. This comes at a cost, making the JS wrappers slightly heavier. However that is meant to be a temporary situation and finally the value type wrapper should merely store the meta-object in addition to the data and the type. Change-Id: I15071ded0a1e54203f29ec1ecf7a9ab646d1168e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - 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>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-101-1/+1
| | | | | | Change-Id: I6c3bd7bebe3d62d1cfd0fa6334544c9db8398c76 Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-231-24/+24
| | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Ie7f5d49ed8235d7a7845ab68f99ad1c220e64d5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix warnings in QtQmlMatthew Vogt2012-08-241-1/+1
| | | | | Change-Id: Ibba3b8e878257f7019bdc90a1344462b77f95a21 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Remove the use of QWidgetStar from QtQml.Stephen Kelly2012-08-151-1/+0
| | | | | | | | | The enum value can be removed so that it can be replaced in functionality with QMetaType::PointerToQObject. There is no advantage to QtDeclarative knowing that a value is a QWidget pointer. Change-Id: I14530132bc37fbb0dc55ba8aaa5bb68db0d87bad Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Permit value types with metatype IDs >= QMetaType::UserMatthew Vogt2012-08-101-13/+76
| | | | | | | | | Remove the assumption that value types must be types defined by Qt, having metatype IDs below QMetaType::User. Task-number: QTBUG-26352 Change-Id: Ib5a56ff2e7892e82adf17a3a1e7517a0c9fe0534 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Fix broken value-type support by allowing property definitionChris Adams2012-07-111-9/+9
| | | | | | | | | | | | | | | | | | | | | In QtQuick 1.x the "variant" property type was supported, which could be used to allow value type properties to be defined in QML. In QtQuick 2.0, we have deprecated the "variant" property, but its replacement ("var") is not suited for defining lightweight C++ type values (such as QColor, QFont, QRectF, QVector3D etc). This commit allows those QML basic types to be used in QML once more, by supporting them in the property definition syntax. Note that since some value types are provided by QtQuick and others are provided by QtQml, if a client imports only QtQml they can define but not use properties of certain types (eg, font). Task-number: QTBUG-21034 Task-number: QTBUG-18217 Change-Id: Ia951a8522f223408d27293bb96c276281a710277 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
* Put basic language types into QtQml importChris Adams2012-06-211-6/+1
| | | | | | | | | | This import is automatically registered by the engine. It provides basic language types (Component and QtObject). Note that the QtQuick import still has these types registered into it, so this commit doesn't break existing code. Change-Id: I8ff190f057fc92969020cf8e896da1649ca3069b Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Fix potential buffer overrun.Martin Jones2012-05-291-2/+2
| | | | | | | | Found by static analysis. operator[]() accepts index up to QVariant::UserType-1 but only QVariant::UserType-1 were allocated. Change-Id: I0691fe268e3ba029441e43bdfcd191400ea21f38 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
* Do not use deprecated APIOlivier Goffart2012-04-241-1/+1
| | | | | | | Change-Id: I0c61f9cb4abe926d5f1e0a3acda7117d8d54efb6 Reviewed-by: Simjees Abraham <simjees.abraham@nokia.com> Reviewed-by: Kai Koehne <kai.koehne@nokia.com> Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
* Migrate gui dependencies from QtQml to QtQuick.Matthew Vogt2012-03-201-508/+88
| | | | | | | | | | | | | Ensure that users of declarative that have no need for functionality provided by the Qt Gui module do not have to link against it. Any use of QtGui functionality is delegated to providers that can be installed by another library; QtQuick adds default providers for this functionality when linked against QtQml. Task-number: QTBUG-24559 Change-Id: I5e6a58a4198732dc2f8f52f71abfa1152b871aa7 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Rename QDeclarative symbols to QQuick and QQmlMatthew Vogt2012-02-241-0/+868
Symbols beginning with QDeclarative are already exported by the quick1 module. Users can apply the bin/rename-qtdeclarative-symbols.sh script to modify client code using the previous names of the renamed symbols. Task-number: QTBUG-23737 Change-Id: Ifaa482663767634931e8711a8e9bf6e404859e66 Reviewed-by: Martin Jones <martin.jones@nokia.com>