aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlapplicationengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix additional warnings from usage of deprecated APIsVolker Hilsheimer2020-09-161-1/+1
| | | | | | | | | | Replace more QLibaryInfo::location with QLibraryInfo::path Replace old event accessors APIs, including relevant comments. Change-Id: Ie205fc93b6e1c0dfb3dca9100fbde417ab68fc9f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Remove non-const overload of QQmlApplicationEngine::rootObjectsFabian Kosmale2020-06-201-11/+0
| | | | | Change-Id: Icb4ba3d282bb556236dd9415ab3ccf9163965808 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: add code example of QQmlApplicationEngine::setInitialProperties()Mitch Curtis2020-04-291-0/+11
| | | | | | | | Show how to use the simpler C++ initializer syntax to create the map. Pick-to: 5.15 Change-Id: I42b9e8d1be3b45054b1fa8c9f3e026d1e419947a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-091-2/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4executablecompilationunit.cpp src/qml/jsruntime/qv4executablecompilationunit_p.h src/qml/qml/qqmlobjectcreator.cpp src/qml/qml/qqmlpropertycachecreator_p.h src/qml/qml/qqmltypecompiler.cpp src/qml/qml/qqmltypedata.cpp tests/auto/qml/qmlformat/tst_qmlformat.cpp tools/qmllint/scopetree.cpp src/qml/qml/qqmlapplicationengine_p.h Adjusted tools/qmllint/findunqualified.cpp to use newer API Change-Id: Ibfb4678ca39d626d47527265e3c96e43313873d4
| * fix -no-feature-translation buildTim Jenssen2020-04-021-2/+0
| | | | | | | | | | Change-Id: I817564e979d4c69f4d7ebd2c9e1d8cddf0727c13 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Add support for translation bindings on QProperty based propertiesSimon Hausmann2020-04-021-1/+1
| | | | | | | | | | Change-Id: I439653123cdc96df97a1801664655c9d28a8b9b5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Clean up QQmlFileSelectorUlf Hermann2020-03-191-3/+27
|/ | | | | | | | | | | | | | | | | | | | | | | | | | The global static map of file selectors is not thread safe. If you add a file selector to engine A running in thread 1, you cannot at the same time retrieve the file selector of engine B running in thread 2. Alas, we only need the static map to discern file selectors from other URL interceptors, and we only need to do this on QQmlFileSelector::get(), which we don't use. Unfortunately it is public API, though. Deprecate QQmlFileSelector::get() and add a different hack to discern the interceptors for the case that it's still called. Also remove the duplicate setExtraSelectors() method. For this to work, we also add a method to QQmlApplicationEngine that allows us to pass extra file selectors and delay the initialization of QQmlApplicationEngine's QQmlFileSelector until the first file is loaded. [ChangeLog][QML] QQmlFileSelector::get() is deprecated. You can use the new method QQmlAplicationEngine::setExtraFileSelectors() to pass extra selectors to QQmlApplicationEngine's internal QQmlFileSelector. Manually created QQmlFileSelectors should be configured immediately after creation, before they are used by the QQmlEngine. Change-Id: Ia61a93777dc910b441a03ffb42d35a2a224c0e26 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add Qt.uiLanguage and QJSEngine::uiLanguage propertiesSimon Hausmann2020-01-231-10/+27
| | | | | | | | | | | | | | [ChangeLog][QtQml] Added Qt.uiLanguage and QJSEngine::uiLanguage properties These properties mirror the same value in QML and C++ and can be used freely. They also provide API symmetry to Qt for MCUs. QQmlApplicationEngine binds to this property and applies translations accordingly by constructing a QLocale with the value and using QTranslator::load(locale). Change-Id: Id87d6ee64679b07ff3cb47844594e8eeebd8c8b6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Christian Kamm <mail@ckamm.de>
* Emit QQmlEngine::warnings when load failsFabian Kosmale2020-01-061-1/+1
| | | | | | | | | This uses the existing infrastructure for reporting QML errors, instead of simply using qWarning. Fixes: QTBUG-81093 Change-Id: Ie18656a57f28fa9dfe922936fd05b44ebe1281e2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* doc: Fix several qdoc warningsMartin Smith2019-09-231-1/+1
| | | | | | | | This update repares several "Can't link to...," "No such parameter...," and "Undocumented parameter..." warnings. Change-Id: I3649cf35f766e5a87ca5df48301e8063a31d7904 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Introduce functions to set properties during creationFabian Kosmale2019-08-191-1/+17
| | | | | Change-Id: Idd4c8ab9e34b9bc3e00f21d7cf1e4f1a70586e7f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Split qqmltypeloader{_p.h|.cpp} into a several filesUlf Hermann2019-07-111-0/+1
| | | | | | | No one can read this mess. Change-Id: Icec4f2afc466435c1ae5e4e80fa2c1b5baf7d087 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QQmlApplicationEngine: delete translators through their parentsTasuku Suzuki2019-07-021-13/+7
| | | | | | | QQmlApplicationEngine doesn't need to manage it by itself. Change-Id: Ib954a97caf5b36093a032220f349057fcf804090 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlApplicationEngine: delete unused translator earlierTasuku Suzuki2019-07-021-2/+5
| | | | | Change-Id: I4161624c663ff87bbf9385991cd65027dd5cfd5f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix for loading translations automatically from resourcesTasuku Suzuki2019-06-011-3/+6
| | | | | | | | When qml file is in resources, translations under i18n was not loaded Task-number: QTBUG-76085 Change-Id: I75315ceb6a1e6ab10309634a3c445a82476d525c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Doc: QQmlApplicationEngine::objectCreated() also signals errorsUlf Hermann2019-03-011-3/+5
| | | | | | Fixes: QTBUG-73298 Change-Id: Icb872963982f32baf6e9489f43d228041bcea2b8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Connect quit() and exit() signals with queued connectionsMichal Policht2019-02-131-2/+4
| | | | | | | | | | | | | | | | | | Class QQmlApplicationEngine connects QQmlApplicationEngine::quit() signal to QCoreApplication::quit() and QQmlApplicationEngine::exit() signal to QCoreApplication::exit(), but it does so with AutoConnection. This causes in some circumstances problems, which are described in Qt documentation (see QCoreApplication::exit()). This change modifies type of connections to queued connections. [ChangeLog][QtQml][QQmlApplicationEngine] QQmlApplicationEngine connects quit() and exit() signals with queued connections to avoid problems with AutoConnection, when connecting to QCoreApplication slots. Task-number: QTBUG-73649 Change-Id: Ib27738b5af2f879efee8862b1ca01613a2e8dc4e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Use QTranslator::install(QLocale, ...) everywhereKai Koehne2018-07-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | QTranslator::install(QLocale, ...) indirectly uses QLocale::uiLanguages(), which is the correct way to ask the system for ui languages. This was already attempted once in commit 427646b8d7, but reverted later on in commit 05d8ffb4df, because it requires shipping .qm files for the native language. Anyhow, we're shipping empty Qt translations for English since a while, and also have been fixing our examples to do so. [ChangeLog][Important Behavior Changes] The automatic translation loading in qml, qmlscene and QQmlApplicationEngine now tries to load translations for all languages in QLocale::uiLanguages(). This might require shipping an empty translation for the source language. Task-number: QTBUG-7329 Task-number: QTBUG-41977 Task-number: QTBUG-69196 Change-Id: Ifcf45b453ee9d05c018f379cc01e192d1b0a3f56 Reviewed-by: Jan Arve Sæther <jan-arve.saether@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>
* QQmlApplicationEngine: Fix using invalid pointersRainer Keller2017-04-261-2/+9
| | | | | | | | | | When a root object was deleted before QQmlApplicationEngine the invalid pointers stayed in the list of root objects leading to crashes when destructing QQmlApplicationEngine. Root objects are watched for destruction and removed from the list. Change-Id: I1babab54dbb7d7b16ed883ada5b3e420ca8690cb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Replace usage of QSignalMapper by lambdaOlivier Goffart2017-02-141-10/+3
| | | | | | | | | | | | | | | | | QSignalMapper ought to be deprecated soon. It simplifies the code, too. There is still one use in QQuickGenericShaderEffect which is a bit complicated to get rid of. A very similar use of QSignalMapper was in use in QQuickOpenGLShaderEffectCommon but was removed in commit 8c745d80, the same should be done for QQuickGenericShaderEffect. (Note the QueuedConnection in qquickparticlesystem is there because the QSignalMapper used to be in the main thread, meaning a round-trip via the event loop) Change-Id: I331b787becbad37f717035bf119bafd7a7214630 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* QQmlApplicationEngine: Yet another fix after QUrl behavior changes in QtBaseRobin Burchell2017-01-161-5/+10
| | | | | | | | | | | | | | | | | | | | Picture the following application: QQmlApplication qAppEngine("main.qml"); With main.qml: ... AComponentInTheSameDirectory { } ... This was failing, with the error: file:main.qml:13 AComponentInTheSameDirectory is not a type Which is wrong, but also reveals the root cause in that the original filename was not a fully resolved path. Change-Id: Ifc5557cc43f4bb92fd121ea9f7a37f09b3b38a9b Reviewed-by: David Faure <david.faure@kdab.com>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-141-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | 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-3/+3
| | | | | | | | | | | | | | | | 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>
* | QQmlApplicationEngine: mark rootObjects() as constAnton Kudryavtsev2016-10-131-2/+15
|/ | | | | | | | | This method does not modify the object. Can't change the API, so overload and mark the old function for removal in Qt 6. Change-Id: I15943c770b30460f8ccd14239526e2249c59a242 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Qt object: Add exit(int)Cavit Sina Dogru2016-08-091-0/+1
| | | | | | | | | | | | This is similar to the Qt.quit() function but also specifies the return code that the event loop will return. [ChangeLog][QtQml] Added exit(int retCode) method to the Qt global object. An application can call Qt.exit to specify a return code of the engine. Task-number: QTBUG-54360 Change-Id: Iaa319e6dc4d6b99dc3a5c01845e87b936fd2cab0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Qml: use const (and const APIs) moreAnton Kudryavtsev2016-08-091-1/+1
| | | | | | | For CoW types, prefer const methods to avoid needless detach()ing. Change-Id: I13e4d5b091877319984c1ddaed4da8dc59a7c0a3 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Introduce delegating constructors.Friedemann Kleint2016-05-061-9/+2
| | | | | | | Reduce code duplication by chaining constructors. Change-Id: I8a0afd20ed13d4eb938536dcb05787ba2565a4cc 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>
* Support debugging and profiling for pure QJSEnginesUlf Hermann2015-12-151-0/+4
| | | | | | | | | | | The engines will register themselves with the debug server whenever they are created without a private object. The assumption is that we get the latest possible registration like this. They try to deregister in all dtors, but they check if a different engine has done the same first. Change-Id: Ife7d7532d1de2e4a6ee21d9f7e673fcdfff2387b Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-6/+6
| | | | | | | | | 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>
* Revert: use the new form of QTranslator::load() for more flexibilityShawn Rutledge2014-10-281-4/+2
| | | | | | | | | | | | | | | | | | | This reverts commit 427646b8d7c52e5b84240e07ffd391217ce3bfa8. It seems that it should have been more correct, but we are still not shipping English translations, and static QString find_translation() in qtranslator.cpp will return any language which is in QLocale::uiLanguages() for which the translation file is found. That is a long list on OSX. Reverting the patch means find_translation() is not called in such cases. This change can be re-done whenever we are more sure that the attempt to find a translation will succeed in finding a sensible one, or fall back to not translating, rather than choosing a language that the user didn't intend. Task-number: QTBUG-41977 Change-Id: I425946cc71cec96b4f38629eb2b7e80220c5236d Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
* use the new form of QTranslator::load() for more flexibilityShawn Rutledge2014-10-011-2/+4
| | | | | | | | | | | | | | As the docs explain, the variant of QTranslator::load() taking a const QLocale& is better because it "uses QLocale::uiLanguages() and not simply the locale name, which refers to the formatting of dates and numbers and not necessarily the UI language." And, using a default-constructed QLocale permits QLocale::setDefault() to override the system locale, so for example an application's main.cpp can do that before constructing a QQmlApplicationEngine. Task-number: QTBUG-7329 Change-Id: Ia29a4c894087c92b071c0fe484728866f2660fe6 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
* Document that QQmlApplicationEngine's root item must be a window.Mitch Curtis2014-09-301-1/+5
| | | | | Change-Id: I22466e82105c9b56894a53400394d1124191f93d Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Update license headers and add new licensesJani Heikkinen2014-08-251-18/+10
| | | | | | | | | - 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>
* Make qtdeclarative compile with QT_NO_TRANSLATIONTasuku Suzuki2014-01-101-3/+5
| | | | | | Change-Id: I73efc8c568e2368bc804eacab9e8f9cced8a030b Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Polish up QQmlFileSelectorAlan Alpert2013-11-131-1/+1
| | | | | | | | Incorporate beta feedback, and hide QQmlAbstractUrlInterceptor as the implementation (instead of making that "the API"). Change-Id: Ib7b14afeb9205fb8a87ed16a6d38b1f468b2aaaa Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Apply file selectors to QQmlApplicationEngine appsAlan Alpert2013-09-201-3/+4
| | | | | | | | | You can also manually apply them to a QQmlEngine using setUrlInterceptor(new QQmlFileSelector(parent)), or using your own QQmlAbstractUrlInterceptor subclass. Change-Id: I0c0ff8b080c138686b3c03e0bc3b9f25bcd11a85 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Clean up objects in QQmlApplicationEngine earlierAlan Alpert2013-07-311-1/+6
| | | | | | | | | | | Deleting the objects in the private class destructor leads to crashes in V8 because the JS engine is in the middle of being deleted. Instead, delete the objects in the public class destructor so that it occurs before the actual engine cleanup starts to happen. Change-Id: I6bac813ce188be54842a78d7b532fcf2d54dc444 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* Add future compatibility noteAlan Alpert2013-06-071-0/+4
| | | | | | | | | | | File selectors are being delayed from releasing at the same time as QQmlApplicationEngine, but will need to be enabled by default (in QQmlApplicationEngine only) when they do arrive. Adding a note to the documentation to help forwards compatibility. Change-Id: Ia47a1da1afebd0da3bd1a97e7e4c8ee85f70b49a Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Set incubation controller when a Window{} is loaded via QQmlApplicationEngineAlan Alpert2013-06-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This was the one convenience that was lost when transitioning templates from QQuickView + Item{} to QQmlApplicationEngine + Window{}. As the default window incubation controller was tied to the first window's frameSwapped, we could easily run into a situation where a secondary window required incubation while the first window was idle. This would then starve the incubation controller. Instead make it so that the renderloop emits "timeToIncubate" once it is done with a renderpass over all windows, so the incubator gets to run once and exactly once per vsync when animating. The incubator logic was also flawed in that it could post a lot of events to itself as a result of incubatingObjectCountChanged and thus starve system events while processing incubation requests. Now we start a timer and don't start it again until we have completed an incubation pass. Task-number: QTBUG-31203 Change-Id: Iea9e2c81efb46bb7875c70ccda0cdc4b3b3e58e7 Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Fix crash in QQmlApplicationEngine when loading finishesJosh Faust2013-05-141-1/+2
| | | | | | | Task-number: QTBUG-30997 Change-Id: I10cb2c689408d1b31360095c2aa9e0943a5d9452 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Doc: Qt Quick: Fix module name format (Pt 1/2)Sze Howe Koh2013-04-231-1/+1
| | | | | | | | | | | | Follow the conventions at http://qt-project.org/wiki/Spelling_Module_Names_in_Qt_Documentation Attempt to differentiate between the whole module ("Qt Quick") and the QML import ("QtQuick") by encoding the latter with monospace font. There are places in the text where both representations are valid. Change-Id: Id6e157a4191aaa4e23a9cd5c76abfe902fe43d33 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Add QQmlApplicationEngineAlan Alpert2013-03-201-0/+285
This helper class exposes QML application functionality that QML-only applications want to have, but QML-using applications may not. Change-Id: If91c3f55ffa2a4aecdd9d6cc62f6ad09fd35b0dd Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>