aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlmetatype.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add support for enum declarations in QMLMichael Brasser2017-07-131-94/+57
| | | | | | | | | | | | | | | | | Enums can be declared with the following syntax: enum MyEnum { Value1, Value2 } Grammar changes done by Simon Hausmann. [ChangeLog][QtQml] Enums can now be declared directly in QML. Task-number: QTBUG-14861 Change-Id: Ic6b6e032651d01ee2ecf9d5ce5734976cb3ad7ab Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* C++11 scoped enum support for QMLMichael Brasser2017-05-031-2/+189
| | | | | | | | | [ChangeLog][QtQml] Support C++11 scoped enums in QML. These can now be accessed as <TypeName>.<EnumName>.<EnumValue> Change-Id: I29bd3f16e980f3e6f1b2390b5a8e9e8e999952a3 Task-number: QTBUG-54961 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix QQmlMetaType::prettyTypeName to deal with malformed type namesUlf Hermann2017-03-151-4/+8
| | | | | | | | We can have QML type names that are empty or end in '/'. In those cases use the QMetaObject to retrieve a more meaningful type name. Change-Id: I4dd0841de13d4e7524a104f0bbc08cb854484cfe Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QQmlMetaType: Fix an invalid commentRobin Burchell2017-01-251-1/+1
| | | | | | | No such function as qmlRegisterCompositeType. Change-Id: I0a8faef8a707b64958a7023136a36853a99b7f0a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-141-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp src/qml/qml/qqmlimport.cpp src/quick/items/context2d/qquickcontext2dtexture_p.h tools/qmleasing/splineeditor.h Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
| * 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 <simon.hausmann@qt.io>
* | Introduce qmlRegisterModule()J-P Nurmi2016-11-181-7/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Qml: mark some methods as constAnton Kudryavtsev2016-10-241-2/+2
| | | | | | | | | | | | | | These methods do not modify objects. Change-Id: Iefe8effa97e6f6142308d61d57d08f9dc14a7709 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QQmlMetaType: replace QString::left with QString::leftRefAnton Kudryavtsev2016-10-211-1/+1
| | | | | | | | | | | | | | Reduce memory allocations. Change-Id: Idfa6284757524396e6154cf8150be4228e9218be Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Qml: replace 'foreach' with 'range for'Anton Kudryavtsev2016-09-201-2/+2
|/ | | | | | | Not all, just instances with low risk. Change-Id: Ie6b4530f748e04ccb90e7ef23415a91d6c377417 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Qml: use const (and const APIs) moreAnton Kudryavtsev2016-08-091-4/+4
| | | | | | | For CoW types, prefer const methods to avoid needless detach()ing. Change-Id: I13e4d5b091877319984c1ddaed4da8dc59a7c0a3 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-301-2/+2
|\ | | | | | | | | | | | | | | | | Conflicts: src/quick/items/context2d/qquickcanvasitem.cpp src/quickwidgets/qquickwidget.cpp tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp Change-Id: Idf279cb88e0df2a383489af5b6afdf04d04ae611
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-291-2/+2
| |\ | | | | | | | | | Change-Id: I70c0c672708522f7157849365cc53ee271d8e460
| | * Fix QQmlTypeData object leakJian Liang2016-06-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Don't forget to drop refcount of QQmlTypeData object in QQmlType::resolveCompositeBaseType() to prevent leakage. Change-Id: I079839a3347def1c2ac8f9cc07a52debb885b36e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Remove QQmlCompiledData in favor of QV4::CompiledData::CompilationUnitSimon Hausmann2016-06-011-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | QQmlCompiledData used to contain the binary data for instantiating QML types in the QML VME. Nowadays the QML type compiler as well as the JavaScript compiler create a QV4::CompiledData::CompilationUnit. Change-Id: I155f62a5ecfb55a3fe230520231b6d8fd5b28ac9 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* | | Move property caches from QQmlCompiledData to QV4::CompiledData::CompilationUnitSimon Hausmann2016-05-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This makes particularly sense as the binding property data per object that allows us to avoid a by-name property lookup when instantiating types is also stored there. Change-Id: I4d9275c1d8fde252df83eb11a9dfea71e5e9583a Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Get rid of QQmlCompiledData::rootPropertyCache memberSimon Hausmann2016-05-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This would not seem like a member variable that is hot enough to keep there and it is two loads away. Change-Id: Id7088771bd33545a2846cc3497e5904dd8ac4f5d Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Make this loop more readable with a range-forFrank Meerkoetter2016-05-131-3/+3
| | | | | | | | | | | | | | | Change-Id: I867652aa168bd4a3eae191bf09946f98207a5ba6 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Avoid QHash::values()Frank Meerkoetter2016-05-131-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | Doing so will spare us from creating a temporary container just to iterate over it. Change-Id: Iab6aec0d83bfc168f12d2348909b053dfddf67a1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Scrape off a few allocations by using the QStringBuilderFrank Meerkoetter2016-05-091-2/+1
|/ / | | | | | | | | Change-Id: I7689fabb5398c2c2d2781b2c788dcc60f4e1ea44 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-291-1/+1
|\| | | | | | | Change-Id: Iec1b2de53c275996364c4bab0123ccb3e6e9895e
| * Fix don't delete singletons objects owned by C++BogDan Vatra2016-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | Don't delete singletons objects that are created only from C++ and have explicitSetObjectOwnership flag set, explicitSetObjectOwnership flag is set only by QQmlEngine::setObjectOwnership. Task-number: QTBUG-49865 Change-Id: I0ef658c2094e67b5cd9a1585e273144dfcee736a Reviewed-by: Simon Hausmann <simon.hausmann@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>
* Don't delete singletons objects owned by C++.BogDan Vatra2015-10-151-1/+6
| | | | | | | | | | This way we can enable the usage of a single singletons in both worlds. Currently singletons are destructed before the other QML types, and using a singleton that is owned by C++ we don't need to care about the destruction order anymore. Change-Id: I120fcb8659e16321ae6e70c7b0d62be3bc650d73 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Make QML composite types inherit attached propertiesJ-P Nurmi2015-10-091-22/+40
| | | | | | | | Change-Id: Ic06af4805da987dd08e361f2668e7a1788d3eefe Task-number: QTBUG-43581 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com> Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Factor out method to get pretty QML type nameTobias Koenig2015-09-241-0/+39
| | | | | | | | | Factor out the code to get the pretty QML type name for an QObject from ~QQmlInfo and put it into QQmlMetaType::prettyTypeName() method. Change-Id: I54ab0c49ba4a52074877447ef67708104f954f2d Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Make QML composite types inherit enumsJ-P Nurmi2015-09-211-3/+27
| | | | | | | | | | | | | | | | | | | | | | | Problem: in Qt Quick Controls 2, enums declared in the abstract C++ base types were not accessible with the concrete QML type name, but had to be referenced using the base type name: Slider { snapMode: AbstractSlider.SnapOnRelease } Solution: this change resolves the C++ base type and creates the missing link between the composite type and its base type's meta- object. This allows referencing enums using the concrete/composite QML type name: Slider { snapMode: Slider.SnapOnRelease } Change-Id: Icefdec91b012b12728367fd54b4d16796233ee12 Task-number: QTBUG-43582 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Explicitly push/pop ExecutionContextsLars Knoll2015-09-151-6/+2
| | | | | | | | Avoid the implicit push inside the execution context constructor and rather make this explicit in the code. Change-Id: I1bb0fb523fddbb273fc666370d619f55f49cd40a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Ulf Hermann2015-08-181-1/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * add null check for qmlRegisterSingletonType()Tasuku Suzuki2015-07-241-0/+3
| | | | | | | | | | | | | | | | | | | | When the callback passed to the function returns nullptr, QQmlData::ensurePropertyCache(e, o) crashes. Change-Id: I11efd7e9d6c5f18611e796d896384dd14a280303 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Christopher Adams <chris.adams@jollamobile.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * 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>
* | qml: Pass non-trivially-copyable types by const-refSérgio Martins2015-07-201-1/+1
| | | | | | | | | | Change-Id: Id3d960ee8236a4c6f4bb4e0add1f88dfa32d3592 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Don't try to load (or unload) QML plugins if QT_NO_LIBRARYUlf Hermann2015-06-191-0/+2
| | | | | | | | | | | | | | | | Most of the code already has those #ifdefs, so let's add the missing ones. Change-Id: I2a46d5ab660daa837d9ce432184d0b55818a5dc1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Add 28 QList::reserve() callsSérgio Martins2015-06-081-0/+1
| | | | | | | | | | Change-Id: Id4820ac458f48b10f2bf457144767efdef9e2c07 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Fix build with QT_STRICT_ITERATORSSérgio Martins2015-05-151-6/+6
|/ | | | | Change-Id: I3df6ac107cb46b3a1b15b80f39d7c6015adcd9ac Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Changed QML type lockingSimon Hausmann2015-04-161-44/+44
| | | | | | | | | | Replace the use of QReadWriteLock with a plain QMutex. At this point QReadWriteLock adds a lot of overhead due to its internal QHash and otherwise offers little over a recursive mutex, especially given that there is most of the time only one reading thread and one writing thread. Change-Id: I0a91e4a64cff5d25e4a133ed46b08912e81bb055 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QtQml: Micro-optimize iterator loops.Friedemann Kleint2015-02-261-4/+2
| | | | | | | Avoid repeated instantiation of end() in loops, use variable instead. Change-Id: I3bb1c6918cfd16a5dcefbcc03c442e99fe9bf76b Reviewed-by: Erik Verbruggen <erik.verbruggen@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>
* Allow importing protected modules with different major versionsJ-P Nurmi2015-01-081-2/+2
| | | | | | | | This allows QtQuick.Controls 1.x and 2.x imports to co-exist even if they are two different plugins with the same module directive. Change-Id: Idee302439e3c2fd6813ba2f41b69144fbae7902c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Allow multiple cached qml unit registration functionsSimon Hausmann2014-09-241-5/+7
| | | | | | | | Only few will be necessary, but this allows for greater flexibility at run-time. Change-Id: Ia03abeb6296a5dee97544209c578dc2974af7cbc 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>
* Accelerate property lookups for C++-based QObject singletons.Michael Brasser2014-08-071-1/+4
| | | | | Change-Id: Icbdf06a077014db5dd57cba42f84591433ec4196 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove dead codeSimon Hausmann2014-03-291-22/+0
| | | | | | | | | Remove qquick anchor line comparison hooks, which were intended to be used inside the old v4 interpreter (but that was incomplete) and are now completely unused. Change-Id: I06b0dd684a292adb44efa52d27258242954285ee Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make it possible to supply compilation units from pluginsSimon Hausmann2014-03-291-0/+22
| | | | | | | | | This also cleans up the script and type initialization in the type loader, for example by getting rid of the m_irUnit member for scripts. Change-Id: I207afeb21c0bae9091d3c7b4cac2e80e9aae0ea3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-01-241-0/+11
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/dialogs/qquickmessagedialog.cpp src/imports/dialogs/qquickmessagedialog_p.h src/qml/debugger/qqmlprofilerservice_p.h src/qml/jsruntime/qv4regexpobject.cpp tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro Change-Id: Ic8a43366b44d6970966acbf03b206d0dee00c28d
| * Fix compile error with clang 3.4Lars Knoll2014-01-231-1/+1
| | | | | | | | | | Change-Id: Iaf43f0527142bb5615e8c97bb1a80faf7b8b2e00 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * qmplugindump is not able to dump all registered componentsDaniel Pesch2014-01-211-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | This patch implements a new function QQmlMetaType::qmlAllTypes() used by qmlplugindump that returns list of all registered components. Previous implementation used QQmlMetaType::qmlATypes() call that returned only components with defined QML name. Task-number: QTBUG-36199 Change-Id: I85acba61cfa511973a004934cf0650f38cc46ed9 Signed-off-by: Daniel Pesch <dpesch@blackberry.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* | fix whitespaceOswald Buddenhagen2014-01-221-10/+10
| | | | | | | | | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | QQmlMetaType: adapt to upcoming MOC format changeMarc Mutz2013-12-041-1/+1
|/ | | | | | | | | | | A change is pending on qtbase that turns relatedMetaObjects into a const pointer-to-const in order to make the relocation a read-only one. Adapt. Change-Id: I503eca13c1fe80d070e3078620fa3fd5ecdef0b0 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Initial support for accelerated property access to QML singletons and enumsSimon Hausmann2013-11-251-2/+6
| | | | | | | | | With this patch we determine the meta-object of singletons, propagate it into the IR and load them separately using a dedicated run-time function. In addition enums in singletons and QML types are resolved at compile time. Change-Id: I01ce1288391b476d1c9af669cb2987a44c885703 Reviewed-by: Lars Knoll <lars.knoll@digia.com>