aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types
Commit message (Collapse)AuthorAgeFilesLines
* Use functions as signal handlers when accessing parametersUlf Hermann2021-02-121-1/+1
| | | | | | | | | | Injected signal handlers are bad practice because they aren't declared. Task-number: QTBUG-89943 Change-Id: I3a691f68342a199bd63034637aa7ed438e3a037b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 4cc91a6a0e4f9063233a4d6554ae64855cf99c14) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove the qmake project filesFabian Kosmale2021-01-151-22/+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>
* Remove unused functionVolker Hilsheimer2020-12-041-3/+0
| | | | | | Pick-to: 6.0 Change-Id: I7ee5187b4e17f2aba2788adfb47325f7a7020d69 Reviewed-by: David Faure <david.faure@kdab.com>
* Don't return reference to temporary QModelIndexVolker Hilsheimer2020-12-031-1/+1
| | | | | | | | | | Follow up on change in qtbase; QPMI casting to QModelIndex returns a value, not a reference. Change-Id: I227cd8ef64450986069837edee25512d9538286d Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 039c2801cfbd67e22da83f77375a06f7434b5c85) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Replace old Q_DECL statements with modern C++Allan Sandfeld Jensen2020-10-311-4/+4
| | | | | | | Since we depend on C++17 now, all of these can go. Change-Id: I0484fd4bb99e4367ec211c29146c316453729959 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtQml: Use unicode character literalsUlf Hermann2020-06-031-1/+2
| | | | | | | This avoids the warnings on conversion to QChar. Change-Id: Ib774f24592d6f09a531c60bb6fa6e5bdbec88120 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-05-051-2/+7
|\ | | | | | | Change-Id: I0e495f3d59f2a507aeb73c013e1d8ec0668313c4
| * Make Connections object qmlWarning follow a logging categoryDavid Edmundson2020-04-301-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Connections{} emits a warning if an old syntax is used. Unfortunately that syntax is not available in Qt5.12. Downstream needs to support both at once, which means we have code constantly hitting this warning. We can't even #ifdef the QML code. By introducing a logging category we can still have the warning but provides some option for downstream to temporarily disable through an existing mechanism until older Qt is not supported. Task-number: QDS-2007 Change-Id: Idd34c18ae3e8b3e53c430fab8229bb9812370d0e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Register value types declarativelyUlf Hermann2020-04-281-0/+10
| | | | | | | | | | | | | | | | | | For now this has the effect of adding them to the .qmltypes files. In the future, the registration shall actually add additional value types you can declare as properties in QML. Change-Id: Ifee5a8ec054f35cc7bd07eb992a136730be68da7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Encapsulate QQmlContextDataUlf Hermann2020-03-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This class is not a private detail of QQmlContext. And it is incredibly hard to see who owns what in there. Let's add some civilization ... We enforce refcounting for QQmlContextData across the code base, with two exceptions: 1. QQmlContextPrivate may or may not own its QQmlContextData. 2. We may request a QQmlContextData owned by its parent QQmlContextData. For these two cases we keep flags in QQmlContextData and when the respective field (m_parent or m_publicContext) is reset, we release() once. Furthermore, QQmlContextData and QQmlGuardedContextData are moved to their own files, in order to de-spaghettify qqmlcontext_p.h and qqmlcontext.cpp. When the QQmlEngine is deleted, any QQmlComponents drop their object creators now, in order to release any context data held by those. Before, the context data would be deleted, but the object creators would retain the dangling pointer. [ChangeLog][QML][Important Behavior Changes] QQmlContext::baseUrl() does what the documentation says now: It prefers explicitly set baseUrls over compilation unit URLs. Only if no baseUrl is set, the CU's URL is returned. It used to prefer the CU's URL. Change-Id: Ieeb5dcb07b45d891526191321386d5443b8f5738 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-111-2/+0
|\| | | | | | | Change-Id: I0d32fc5b99f8c9e4acb922fffe4dd5f3c5be553c
| * Remove hard-coded notes for 'Corresponding handler' for QML signalsTopi Reinio2020-03-101-2/+0
| | | | | | | | | | | | | | | | QDoc will generate these notes automatically. Task-number: QTBUG-37355 Change-Id: I8ed058ecbbcc630ad0351f6ce167c3fa61936f6f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Add major version to all Q_REVISIONsUlf Hermann2020-02-193-4/+7
| | | | | | | | | | Change-Id: Id72fbe10c16de61bd847773d0055d83cfe03f63c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-171-1/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/qtqml/plugin.cpp src/qml/qml/qqml.h src/qml/qml/qqmlmetatype.cpp src/qml/qml/qqmlmetatype_p.h src/qml/qml/qqmltypeloader.cpp src/qml/types/qqmlbind.cpp src/quick/items/qquickitemsmodule.cpp tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp Change-Id: I52548938a582cb6510271ed4bc3a9aa0c3c11df6
| * Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-131-1/+2
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4engine.cpp Change-Id: I61f41672e2dfe7e542ca30fed5f173d0a9ee3412
| | * Fix QQmlProperty and Connections for properties starting with '_'Fabian Kosmale2020-02-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | We do a weird renaming for the change handler of properties starting with '_', now we do it at least in a consistent way. Fixes: QTBUG-82017 Change-Id: I1535a5ee462f3a344c972461f1fb954f039aa854 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-061-3/+5
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qml/types/qqmlbind.cpp src/quick/items/qquicklistview.cpp tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp Change-Id: Id6805c13256ad13d5651011e5dd09bba0ec02987
| | * Clarify the Binding.restoreMode warning messageUlf Hermann2020-02-031-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specify that you need to import QtQml 2.14 and where. Fixes: QTBUG-81787 Change-Id: Ia8e7fb3229971294cbade2791075dcd0b5943fae Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * | QML binding restoreMode warning: split into several linesFrederik Gladhorn2019-12-101-10/+10
| | | | | | | | | | | | | | | | | | | | | The text was printed without spaces. Add newlines as was probably originally intended. Change-Id: I4ee10b777c324a8f92c62b813ae6c959835b7a61 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * | Make clear how to fix QML binding restoreMode warningFrederik Gladhorn2019-12-101-0/+2
| | | | | | | | | | | | | | | Change-Id: Ia0cc6bc5273f84709b4e649627f074ae6bccece6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | QQmlBinding: Change the restoreMode defaultUlf Hermann2019-10-161-25/+4
|/ / | | | | | | | | | | | | | | | | | | | | | | | | As promised in 5.14 we now change the default to RestoreBindingOrValue. Update the documentation accordingly. [ChangeLog][Important Behavior Changes] By default Binding elements now restore values as well as bindings when they become inactive. Task-number: QTBUG-78566 Change-Id: Id5c0247eff253f37cc6714179601c4277d2de7d0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-102-8/+63
|\| | | | | | | Change-Id: I2835748c27616103f275849141fbe5a93e3dfd8c
| * Output a message when changing the target of a Binding from elsewhereUlf Hermann2019-10-092-3/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Explicitly created Binding elements should not be silently disabled when writing their target property. That would be rather confusing. Instead, the binding stays active and updates the target property again on the next change. This behavior is still somewhat confusing. Therefore, if the qt.qml.binding.removal logging category is enabled, output a helpful message. Fixes: QTBUG-78566 Change-Id: Idcd8e51e1cd7eaf78d70b15f065fd9159521ff20 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Postpone the Binding restore mode behavior change to Qt 6.0Ulf Hermann2019-10-091-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | Also, add a note to the "when" property about it. [ChangeLog] The change in the default behavior of Binding elements regarding literal values has been postponed to Qt 6.0. Task-number: QTBUG-78566 Change-Id: I2cc6f01230589b176b08f53a45c02123bb961020 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-082-8/+21
|\| | | | | | | Change-Id: Ib381f350ada365747ce20b989bfdc368d75f2219
| * QML Binding: do not convert stringsFabian Kosmale2019-10-072-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The root cause for the issue is that QQmlObjectCreator::setPropertyValue calls QQmlStringConverters::variantFromString on strings if the property is of type QVariant. Unfortunately, this cannot be changed easily as the current behavior is explicitly documented and tested in tst_qqmllanguage, thus making it a breaking change. As a workaround, QML Binding does now take a QJSValue instead of a QVariant (making value a var property), which does not trigger the conversion path. Fixes: QTBUG-78943 Change-Id: I0b64dffdb6b84b2bab2bb85a8cb263e530c18570 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * Re-add the warnings about deprecated default binding restore modeUlf Hermann2019-10-041-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | We _really_ want people to port away from this. And yes, we are going to change it. Amends commit c273175ffec925a4164de41a79c21d785a1761a7. Task-number: QTBUG-33444 Task-number: QTBUG-78566 Change-Id: Iab50b8c7bad043528602e2e617c772de06d18b1e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Pierre-Yves Siret <gr3cko@gmail.com>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-041-1/+1
|\| | | | | | | | | | | | | | | Conflicts: src/imports/qtquick2/plugins.qmltypes src/quick/items/qquickitemsmodule.cpp Change-Id: I841c65c9c131354788b4f3fcfe3d7ed27be316d5
| * QQmlBind: Mark restoreMode as explicitly also when set to default valueUlf Hermann2019-10-021-1/+1
| | | | | | | | | | Change-Id: I8aa36cbba95a64498b34c689086e45c115ce542b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Specify parameters of type registration in class declarationsUlf Hermann2019-09-263-0/+10
|/ | | | | | | | | | | | | | | | | | | | | Using this technique we can automatically register all necessary revisions and minor versions of a type, using the metaobject system. This greatly reduces the potential for mistakes and resulting incompatibilities between versions of imports. We assume that for each type we need to register all revisions of its super types and its attached type, and that the revisions match. That is, if you import version X of type A, you will also get version X of its attached type and of any super types. As we previously didn't take these dependencies into account when manually registering the types, a number of extra revisions are now registered for some types. Potentially, we can now generate the qmltypes files at compile time, using moc. Change-Id: I7abb8a5c39f5e63ad1a0cb41a783f2c91909491b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge dev into 5.14Kari Oikarinen2019-08-272-2/+4
|\ | | | | | | Change-Id: I3ae119563f41fda63ac2b452f2d05fa83e411faa
| * Harmonize meta object revisions and minor versionsUlf Hermann2019-08-261-2/+2
| | | | | | | | | | | | | | | | | | | | In order to avoid complexity we want those to match. We can easily "rename" the meta object revisions as those are not public interfaces. Change-Id: I48e063d49758c7bacd9b7816bf5541cf67e07b0d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * Postpone the deprecation warning for Connections onFoo until 5.15Ulf Hermann2019-08-211-0/+2
| | | | | | | | | | | | | | | | Fixes: QTBUG-77734 Change-Id: I5c666d0aa9ec41f3d9bfcb78869b98336ede557b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | QQmlBind: Fix qdoc warningFriedemann Kleint2019-08-211-1/+1
| | | | | | | | | | | | | | | | | | Fix src/qml/types/qqmlbind.cpp:370: (qdoc) warning: Missing '\endlist' Change-Id: I687b136caa1a1696b5efc5d8352baedfe091c89b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | qqmlconnections.cpp: Fix deprecation warning about QStringFriedemann Kleint2019-08-211-1/+2
|/ | | | | | | | types/qqmlconnections.cpp:328:72: warning: ‘QString::QString(const char*)’ is deprecated: Use fromUtf8, QStringLiteral, or QLatin1String [-Wdeprecated-declarations] Change-Id: I3c9a341a955010a643c17e2e0a58dfdc05728e93 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Allow Connections to handle signals using JavaScript functionsUlf Hermann2019-08-162-3/+73
| | | | | | | | | | | | | | | | | | | | | | Requiring full function definitions as signal handlers has two advantages: 1, We don't need a custom parser that magically recognizes properties which would otherwise be an error in other components. 2, The user is forced to specify the full signature of the handler, including any parameters. This helps when the functions will eventually be compiled to C++ The old behavior is retained, generating a warning if any of the magic bindings are still set in a Connections element. Only if no magic bindings are found, the functions are connected. This is because there might be functions named onFoo in old-style Connections elements and silently connecting those to any matching signals would be a change in behavior. Change-Id: I8c78d8994fdcddd355fe822cde9a0702dc8c75de Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix tests in qtquickcontrols 1 and 2Simon Hausmann2019-08-071-26/+1
| | | | | | | | | | | | | This patch partially reverts the 5.15 related #ifdefs from commit f38e071f5b353cbf9ce6c6c104bd82099ae0aa14. Those were introduced without any test coverage and our own modules (qtquickcontrols 1 and 2) were not tested with it or adapted. The change of behavior breaks our own existing code. Task-number: QTBUG-33444 Change-Id: Ie9823638c1a02281798b725f745b15e622f837c5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix build without features.itemmodelTasuku Suzuki2019-07-081-4/+9
| | | | | Change-Id: Ia4304644a2a365c359eed31c55c2ca9d7d42f10c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix crash when binding to QML componentFabian Kosmale2019-07-041-3/+3
| | | | | | | | | | As the properties were missing their context, we could not get the correct QMetaObject and would trigger an assertion in canConvert. We now always set the context when creating QQmlProperties in qqmlbind. Fixes: QTBUG-40487 Change-Id: I766c5697dc33fc1e18c2316e28d944975e84ae3c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Restore value bindings when disabling a Binding elementErik Verbruggen2019-05-172-5/+155
| | | | | | | | | | | | | | We previously only restored script bindings that were replaced by a Binding. Now we handle both. [ChangeLog] QML Binding elements now support restoring previous values of the bound property when the binding is disabled. This will be the default behavior in Qt 5.15. Reliance on the old behavior of only restoring binding, not literal values results in a warning now. Fixes: QTBUG-33444 Change-Id: I833403b0645c08eee486fbd4acf5d3c7de2ef73a Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Split CompiledData::CompilationUnit in twoUlf Hermann2019-05-162-5/+5
| | | | | | | | We need a CompilationUnit that only holds the data needed for compilation and another one that is executable by the runtime. Change-Id: I704d859ba028576a18460f5e3a59f210f64535d3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move workerscript to its own moduleUlf Hermann2019-05-063-799/+0
| | | | | Change-Id: I778cfe842ddf1c600a837d8f2061a338887eed95 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move model types into their own libraryUlf Hermann2019-05-0228-13141/+2
| | | | | | | | | | The model types are not part of the core QML runtime and should only be loaded if you explicitly import them. We cannot enforce that in Qt5 as some of them are available from the QtQml import, but we can change it in Qt6. Change-Id: I1e49e84d748e352537ec2d4af901c034c91d038f Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com>
* Clean up type registrationUlf Hermann2019-04-182-0/+42
| | | | | | | | | | | | | | | | | | | 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>
* Remove QQmlV4HandleUlf Hermann2019-04-108-31/+25
| | | | | | | | This is just an alias for QV4::ReturnedValue. We can as well use the latter. Change-Id: Ibd2c038a3ca726b39a8f0f05e02922adb9fccbdb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-101-0/+2
|\ | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlmetatype.cpp src/qml/types/qqmlmodelsmodule.cpp Change-Id: Idc63689ba98d83a455283674f4b5cf3014473605
| * Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-beta2Qt Forward Merge Bot2019-04-091-0/+2
| |\ | | | | | | | | | Change-Id: I68211a7d4568a1c31c6a124fe6777709c53736a5
| | * Don't use delegate model types on -no-feature-delegate-modelUlf Hermann2019-04-081-0/+2
| | | | | | | | | | | | | | | | | | Fixes: QTBUG-74884 Change-Id: I7a675f6ef41937cef0f8e67960486c5b022d735c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Add TableModelColumnMitch Curtis2019-04-086-335/+884
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to support simple object rows by default, which we expect to be the most common use case for TableModel. Complex rows are supported, but with a limited subset of functionality. Things that could be improved: - Would be nice if we could get arbitrary/dynamic properties like ListModel has, without the complex code that comes with it. That way we could get rid of all of the role properties and users could have their own custom roles. The limitation of only having built-in roles becomes too restrictive very quickly. Change-Id: Icbdb6b39665851c55c69c0b79e0aa523c5d46dfe Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | | QQuickWorkerScript: remove unused includesUlf Hermann2019-04-031-4/+0
| | | | | | | | | | | | | | | Change-Id: Ib231bb59347bc47edd2e339da4c197daf9bc24e3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>