aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqml.h
Commit message (Collapse)AuthorAgeFilesLines
* Mark functions involving attached property IDs as deprecatedUlf Hermann2019-04-301-3/+5
| | | | | | Task-number: QTBUG-75176 Change-Id: I969e7987ebf8b98aed9ba9e17388a0e168ef5e09 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-231-2/+7
|\ | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlmetatype.cpp Change-Id: Ieff61c076e46eb50a059c8b0210f7f4d7ce0cbcf
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-191-2/+7
| |\ | | | | | | | | | Change-Id: I9ef4be23bfe35aa48d4c65d4159e72c527943845
| | * QML: Remove static attchedPropertyIds mapUlf Hermann2019-04-181-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the same object is available under two different names it should still have the same attached properties no matter which name you use. This was achieved by having a static map of metaobjects to attached property IDs that would always hold the first attached property ID registered for a given metaobject. This attached property ID was then used as key in the map of attached properties for the actual objects. The obvious downside to that is that we need a global static which gives us thread safety and static initialization (and destruction) problems. It turns out, all the attached properties are created by attached properties functions, registered by the user. Those functions only get the object to be amended as parameter. Therefore, no attached properties function can be registered for multiple attached properties on the same object as it wouldn't know which one to create for a given call. Thus, the whole ID dance is unnecessary as we can as well index the attached property objects by the function that created them. This nicely avoids creating two attached property objects for the same object and function and still makes the global static unnecessary. Fixes: QTBUG-75176 Change-Id: Ie8d53ef0a6f41c9b3d6b9d611cde1603a557901c Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Clean up type registrationUlf Hermann2019-04-181-2/+0
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QML-specific types need to be registered only for "QtQml". Make sure we don't accidentally add new QML-specific types to QtQuick. We also don't want the base types to be registered under any random URI and version. Formally qmlRegisterBaseTypes() is a public function, but it _really_ should not be called by anyone. Finally, split the types into ones that should belong to QtQml.Models and ones that belong to QtQml proper. Add a plugin that handles QtQml itself rather than using the QQmlEngine ctor for this. [ChangeLog] The accidentally exported function qmlRegisterBaseTypes() was removed. Change-Id: I8bf9f8515e18b016750c721fe694d4cda076780b Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* / Fix qdoc errorsFriedemann Kleint2019-03-151-1/+2
|/ | | | | | | | | | | | Add ',' to enumerator and rearrange Q_QDOC #ifdefs, fixing: LOG Build & visit PCH for QtQuickDoc src/quick/scenegraph/coreapi/qsgnode.h:97:49: error: missing ',' between enumerators src/qml/qml/qqml.h:593:17: error: expected namespace name Change-Id: I4491c5885c5cdb8a156d9a7abcca5db4d68d1c2e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix revision of Connections.enabled propertySimon Hausmann2018-08-141-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The enabled property was added with QtQuick/QtQml 2.3 as part of Qt 5.7, but due to multiple bugs, the property became visible across all versions, breaking lookup as outlined in the linked task. The first issue was that property revisioning needs to be specified via the REVISION tag inside Q_PROPERTY, not using Q_REVISION. The second issue was that in type registration the unversioned type must be registered first followed by the revisions. Otherwise the call to QQmlMetaType::qmlType(const QMetaObject *metaObject, const QHashedStringRef &module, int version_major, int version_minor) that will look through the metaObjectToType multi-hash will find the last inserted type first and that satisfies the minor version requiremend. In the case of the Connections type, that would be the base version registered last with qmlRegisterCustomType<QQmlConnections>(uri, versionMajor, versionMinor,"Connections", new QQmlConnectionsParser); Lastly, if we were to just call that one first and then register revision 1 afterwards, then only the first version would have a custom parser attached and we would fail to process the bindings correctly if using the newer revision. So to fix this, we introduce another private qmlRegisterCustomType specialization that includes a meta object revision, thus allowing us to register the Connections type in the correct order and both with a customer parser. That's not ideal, but also not worse than the previous three registration and it fixes the visibility. [ChangeLog][QtQml][Connections] Fixed the visibility of the enabled property to only appear when importing QtQml/QtQuick >= 2.3, which was introduced with Qt 5.7. Otherwise it would accidentally shadow for example an "enabled" context property. Task-number: QTBUG-69884 Change-Id: I888374d96f19502466358df81007bcb3c65d3a79 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Provide API to access singletons associated with a QQmlEngineRichard Weickelt2018-06-211-0/+2
| | | | | | | | | | | | | | | | | | | This patch adds allows C++ code to retrieve the instance of a registered singleton type. Until now this required a deturn via QML expression. Two methods are added to QQmlEngine: A generic one that encapsulates all singleton objects in a QJSValue and a template function for QObject-derived singleton types. An additional convenience function is added to query the QML type id. This function may also be used for other purposes in the future. [ChangeLog][QtQml][QQmlEngine] Added API to access singletons associated with a QQmlEngine. Task-number: QTBUG-39970 Change-Id: I67c132ede35f80b9aaf1c5e5456715cf4f1b0848 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-1/+1
| | | | | | | | | | | | | 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>
* Replace Q_NULLPTR with nullptrKevin Funk2017-09-271-27/+27
| | | | | Change-Id: I0c01862dbb475494c84e39c695cb563df8cbcfa8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add missing qmlRegisterExtendedUncreatableType variantKevin Ottens2017-02-171-0/+38
| | | | | | | | | | | | | We need another qmlRegisterExtendedUncreatableType allowing to pass the metaObjectRevision as third parameter. Otherwise extended uncreatable types can't use for instance REVISION in their properties. This is missing for some of the Qt 3D types for which we are cleaning up the versioning for 5.9.0 and which fall in this category. Change-Id: I20ebec339814d7f43cc4b2b58090406b0d5fb97e Task-Id: QTBUG-58895 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Introduce qmlRegisterModule()J-P Nurmi2016-11-181-0/+1
| | | | | | | | | | | | | | | | This is particularly useful for keeping the versions of related modules in sync. For example, when QtQuick.Controls introduces new types or revisions and bumps up the minor version, qmlRegisterModule() can be used to make the same version available for QtQuick.Controls.Styles in case it doesn't have new types or revisions to register. [ChangeLog][QtQml] Introduced qmlRegisterModule() that can be used to make a certain module version available, even if no types or revisions are registered for that version. Change-Id: I5ec457465cd778bb0adda55771d195f69cd4b31a Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add qmlRegisterUncreatableMetaObject convenience functionBogDan Vatra2016-09-071-0/+3
| | | | | | | | | qmlRegisterUncreatableMetaObject is needed to register Q_NAMESPACE QMetaObjects. Task-number: QTBUG-54982 Change-Id: I767dfcb15db647e0dceb0c37b17e64f2a5c1dd8f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-071-25/+30
|\ | | | | | | Change-Id: Icfa1d61fcc286c3418d4a625de11d2191336fa60
| * Make public headers compile with -Wzero-as-null-pointer-constantMarc Mutz2016-03-031-25/+30
| | | | | | | | | | | | | | | | | | | | | | ... or equivalent. QtBase 5.6 headers already compile that way, so let the other modules follow suit. Task-number: QTBUG-45291 Change-Id: Ied526fb2d7adc3a68946d6843a6bd6f475ebf864 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>
* Use the new macros for disabling warnings in qtdeclarativeThiago Macieira2015-07-281-7/+3
| | | | | Change-Id: I476da50ba23598c7ca98651477fb701f74053b82 Reviewed-by: Jake Petroules <jake.petroules@petroules.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 ICC-on-Mac warning about unknown #pragmaThiago Macieira2014-10-301-2/+2
| | | | | | | qqml.h(506): warning #161: unrecognized #pragma Change-Id: I089007db4c4d0701eff32ce0b1c2fff1f65d5c48 Reviewed-by: Simon Hausmann <simon.hausmann@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>
* qmlRegisterCustomExtendedType, qmlRegisterExtendedUncreatableTypePaul Lemire2014-07-251-0/+77
| | | | | | | | | | | | | | | | | | There are cases in Qt3D where we'd like to be able to register uncreatable extended types. The main use case is having an abstract class that has an extension class so as to have a clean separation between the C++ and QML API. Implementations of the abstract can then be easily registered to QML and rely on the extension class for QML specific properties. The other feature we'll need in the near future is the ability to create extended QML types that use a custom parser. Two new type registration method were added to qqml.h to fulfill those needs. Unit tests for those are present in qqmlecmascript and qqmllanguage. Change-Id: I15b2cd791ffd36b537305af1873491c079d4094e Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Suppress implicit sign conversion warnings in public APIKurt Pattyn2014-03-171-3/+3
| | | | | | | | | | Suppres implicit sign conversion warnings when compiling with the -wsign-conversion flag. E.g. “qqml.h:235:5: warning: implicit conversion changes signedness: 'const int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]” Change-Id: I7a51c51609c39f2431acb95febed6bb741f3c09c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Document qmlContext() and qmlEngine().Mitch Curtis2014-03-041-0/+4
| | | | | | | | | | | | | | | | | | | 146b942d59cca446516652d42718197573d34e46 documented them (Qt 5), but for some reason they aren't visible [1]. c74e4a74ba97d32df7406fb684527d415dd8a6ba (Qt 5.1) then moved them into the QtQml namespace "to avoid symbol conflicts with QtDeclarative", and then did the following trick so that they could be called without qualifying the functions with the namespace: using namespace QtQml; For that reason, qdoc shouldn't see the namespace, so we #ifdef it out. [1] project.org/doc/qt-5.0/qtqml/qqmlengine.html Change-Id: Id815ae4de7f081c22755eef7c37a2bc6e812b440 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* fix whitespaceOswald Buddenhagen2014-01-221-16/+16
| | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add a namespace for a global variable in a public headerThiago Macieira2013-12-031-2/+2
| | | | | | | | | | | The "Qml" prefix should suffice. This was found by ICC 14.0 in a bogus warning: qqml.h(470): error #2415: variable "CurrentSingletonTypeRegistrationVersion" of static storage duration was declared but never referenced Change-Id: I604cd712529b1c4553457c1ea0904182ac4a9e80 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
* Add a new variant of qmlRegisterSingletonType for QML singletons.Antti Piira2013-11-091-0/+18
| | | | | | | | | | | | | | Adds a new public API to register a QML based singleton type from C++. This is the equivalent of the the qmlRegisterType, but for singletons. qmldir file is not needed for types registered through this function, but the type still needs to include the following pragma statement among the import statements: pragma Singleton Change-Id: Icb35b665fe2a8605667fe8ac575347be2a60490c Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add qmlProtectModuleAlan Alpert2013-09-201-0/+3
| | | | | | | | | A C++ analog to the protected qmldir syntax, this is also a potential performance improvement because we can avoid some file system accesses. Change-Id: I41781a6cc72aa65bd2d397800345ea16ef442e90 Reviewed-by: Antti Piira <apiira@blackberry.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Silence clang header-hygiene warning.Zeno Albisser2013-07-221-0/+11
| | | | | | | | | Clang complains about namespaces leaking from a header. However in case of the QtQml namespace this is a conscious decision. So we disable the warning. Change-Id: I2a0536363abaa13b66984ddd681297aeab67edbd Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Switch to non-streaming version of qWarning()Alan Alpert2013-06-271-2/+1
| | | | | | | | | Allows us to drop the qdebug.h include in a public and frequently used header. Change-Id: I2cb05fbec6298ba600020db684e9eea4093ce663 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
* Move exports conflicting with QtDeclarative into namespaceKai Koehne2013-05-151-5/+11
| | | | | | | | | | | | | | Move exported qml* symbols that conflict with QtDeclarative into an - automatically imported - namespace. This ensures apps can link against both QtDeclarative and QtQml. To keep the BC promise the old symbols are still exported. Task-number: QTBUG-29584 Change-Id: I3d31c36ca4e2faaf6f5d67a77c5c5a304c0338a4 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Add qmlClearRegisteredTypes FunctionAlan Alpert2013-05-071-0/+2
| | | | | | | | | | | Registered types are stored in a global static variable, not on an engine instance. For applications managing multiple engines over their lifetime, there needs to be a way to clear the existing types so they can register new ones and avoid memory leaks. Task-Number: QTBUG-28572 Change-Id: Ic70a4dd1e29d99399b21fb42eaf10d4a52bf2adf Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
* Add qmlRegisterType for Composite TypesAlan Alpert2013-02-181-0/+21
| | | | | | | | | This is equivalent functionality to registering a composite type in a qmldir file, a type name in a versioned module is associated with a given file. This function now allows that to be done easily from C++. Change-Id: I1cf44b92c3ad7fee593f4f84773c35b56253e628 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-281-4/+0
| | | | | | | | | | | The macro was made empty in qtbase/ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Ia07e99676e0134fde5e32880edb95e57c779a7ff Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Alan Alpert <aalpert@rim.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>
* Refactor singleton type registration codeChris Adams2012-08-281-3/+6
| | | | | | | | | | | Previously each singleton type was registered as an implicit separate import. This commit changes the code so that these types are treated just like any other type in the registration sense. It also ensures that singleton types are instantiated per-engine. Change-Id: I5c81c4ca5bf65210f7125d74a62a282a21838068 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
* Add type name to singleton (module api) implementations.Glenn Watson2012-08-081-8/+8
| | | | | | | | | | | | | This change renames the previous module api implementation to singleton types. When a singleton type is registered, a type name must be provided that is used when accessing the API from QML. This makes the implementation more consistent with the rest of QML. Task-number: QTBUG-26549 Change-Id: Iab0bb1ccf516bd3ae20aee562a64d22976e0aecd Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* qmlRegisterRevision clashes with qmlRegisterUncreatableTypeMartin Jones2012-06-251-0/+31
| | | | | | | | | | | Add template<typename T, int metaObjectRevision> qmlRegisterUncreatableType() in order to register an uncreatable type for a particular revision. Task-number: QTBUG-23278 Change-Id: Ic165e41c8176916929cf19eb9bf6eef4b5bee1eb Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com> Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Remove non-templated qobject module api registration functionChris Adams2012-06-121-14/+0
| | | | | | | | | | | | | Previously, both templated and non-templated qobject module api registration functions were provided as public API. The non-templated version is identical to the templated version, except that bindings which access properties of module apis registered with that function cannot be optimized with v4. This commit removes the non-templated version of the function. Change-Id: Ic417aa241f1172bf6d055bdc7f528d7e9304097b Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Fix warnings about truncation from size_t to int (MSVC2010/64bit).Friedemann Kleint2012-05-291-2/+2
| | | | | Change-Id: I5e12f241484b497ae2bd79ea1cbde4913908bd20 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Optimize QML type registration.Martin Jones2012-05-231-50/+40
| | | | | Change-Id: I981f5e2e6d7f6089e9f326d41a65e54668b73120 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Remove unnecessary exportsMatthew Vogt2012-05-181-1/+0
| | | | | | | | | Reduce library load time by removing any exports which are not required by existing clients. Task-number: QTBUG-24768 Change-Id: Ia5754d6f97bb2ed46e290820a5b092f85a4bc5b0 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* QtQuick: Fix string related warnings, single character strings.Friedemann Kleint2012-05-141-9/+9
| | | | | | | | | - Fix warnings about truncation from size_t to int (MSVC 2010, 64bit). - Remove single character strings. Change-Id: Iaf4406e4e04d55d2d8b762f3433269868842a6f9 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Add templated module api registration functionChris Adams2012-03-261-2/+17
| | | | | | | | | | | | | | | This commit adds a templated module api registration function which allows clients to provide type information at registration time. We use this typeinformation in V4 if available, in order to allow module APIs to be used in v4 bindings. This commit also clarifies the ownership semantics of QObject module apis, and updates some documentation references which were missed during the rename of Declarative to Qml. Task-number: QTBUG-24894 Change-Id: Iebb61ca8d8eacbb15218549eab715e22f52a1474 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Rename QDeclarative symbols to QQuick and QQmlMatthew Vogt2012-02-241-0/+451
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>