aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
Commit message (Collapse)AuthorAgeFilesLines
* V4: Fix usage of QV4::Value tags/typesErik Verbruggen2016-10-265-17/+41
| | | | | | | | | These two were mixed, but have completely different values. Task-number: QTBUG-56471 (cherry picked from commit 9d2169a2d8b81b8707b20ab892550f4a55c07feb) Change-Id: I6745521ea4356acdd710285084cce8e965bfc072 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Fix QML Compiler crashSimon Hausmann2016-10-261-4/+1
| | | | | | | | | | | | | | | | After commit 2afb54fb51091765f79548b0b057795bc3c6eb38, Primitive::undefinedValue() uses setM() to clear out all bits. Previously that code was #ifndef'ed out for the bootstrap build, but now that we can do the correct boxing in host builds (as we know the pointer size), we can re-enable setM() in bootstrap builds and fix this crash that was a Q_UNREACHABLE() assertion. Change-Id: I49036792c06c9a17272aba65261ab8f32beb2ad8 Task-number: QTBUG-56658 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 9f6ae7fce68d1592b71be7df7ebfffade60ef737) Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-052-5/+8
|\ | | | | | | Change-Id: I081d9b15796b4133d2ba6f1a862f15b873a4846d
| * Use QElapsedTimer instead of QTime to measure elapsed timeMilian Wolff2016-10-051-5/+4
| | | | | | | | | | | | | | | | | | Getting the current time from QTime is expensive as it adheres to the locale timezone. To measure elapsed time in a code block, using the monotonic QElapsedTimer is much faster. Change-Id: Ibea390d7bc5270a20cf35111dfc919e37be7001e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * QML: Clear weak references on Object destruction for C++-owned QObjectsErik Verbruggen2016-10-051-0/+4
| | | | | | | | | | | | | | | | | | | | Otherwise a re-use of the C++-owned QObject will have a back reference to a possibly GCed QV4::QObjectWrapper, which results in exciting behavior. Task-number: QTBUG-46263 Change-Id: Iff0e36f9e67c01abd02cfb5a89605d0f26ddb0de Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-047-13/+47
|\| | | | | | | Change-Id: I48764527fa1ab6d8d59c24552394459b1cdc58ee
| * qv4jsonobject: Make use of QVariant::toString in stringificationRobin Burchell2016-09-301-0/+5
| | | | | | | | | | | | | | | | This covers a whole host of missing cases, notably QUrl stored in a QV4::Value. Task-number: QTBUG-50592 Change-Id: I8afd772046c7bfbbcf916a7e90a57be5257b9df8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Fix crash with window-less QQuickItemsSimon Hausmann2016-09-306-13/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark QQuickItem visual children directly in QQuickItem instead of relying on the item being a (grand) child of a window. [ChangeLog][QtQuick] Fix crash with QQuickItems created via JavaScript being garbage collected sometimes when they're not assigned to a window. This may happen even in qmlscene when between the creation of the root item and the assignment to the QQuickWindow the garbage collector runs. The previous approach of a persistent in QQuickView marking the visual item hierarchy relies on the existence of a view. The only thing left to do in the view and qml window implementation is enforcing the CppOwnership policy set on the content item in QQuickWindow by ensuring the presence of the JS wrapper, replacing the persistent with a weak value. This also introduces a new internal mechanism for QObject sub-classes to provide their own V4 JS wrapper types. Task-number: QTBUG-39888 Change-Id: Icd45a636a6d4e4528fc19165b13f4e1ca7967087 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-3012-161/+303
|\| | | | | | | | | | | | | Conflicts: tests/auto/quick/qquicktext/tst_qquicktext.cpp Change-Id: I241cd418bb7e7b95e0a0a2ee4c465d48be2a5582
| * Fix crash on Array.prototype.join.call(0)Robin Burchell2016-09-291-5/+8
| | | | | | | | | | | | | | | | | | We (incorrectly) didn't check the return value to make sure we had a valid self. At the same time, rename the self variable to match up with other methods. Task-number: QTBUG-53672 Change-Id: Ia0ae5a553e49c4c3b2834c7fdf649fe6373951a2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * V4: Free up 2 address bits in 64bit modeErik Verbruggen2016-09-288-152/+269
| | | | | | | | | | | | | | | | | | This allows for the OS to use 49 address bits. It also maps JS Undefined to the C++ nullptr on 64bit. Task-number: QTBUG-54822 Change-Id: I7cc90620f499be1506a61aac77d72d067308838c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * Add a facility to version type information for debugginghjk2016-09-221-0/+18
| | | | | | | | | | | | | | | | This serves the same purpose as qtbase/corelib/global/qhooks.cpp, but is meant to be in sync with changes in Qt Declarative internals. Change-Id: I5a4a7d9ca5c340367581749e05d09380590c46fb Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * Give SquareButton types a side property to mediate being square.Edward Welbourne2016-09-213-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We shouldn't be setting width and height for each square; we should only need to set their side, which determines their width and height - so that they're actually square ! More pertinently, this could later serve as an illustration of how to use properties and bindings. Ideally, we'd do this in some way that actually ensures setting width or height changes side; but the simple approach will do for now. Change-Id: I0df89e11221dde5d1d2930c4a779b59cf0d46654 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-164-7/+28
|\| | | | | | | Change-Id: Ib45654e3e79087da4754377f0d78b70c44ed4695
| * Merge remote-tracking branch 'origin/5.6.2' into 5.6Liang Qi2016-09-161-0/+4
| |\ | | | | | | | | | Change-Id: I410c2bd25a1bddc0e395316d62791437684b8942
| | * QtQml: Disable new optimizer of MSVC2015/Update 3Friedemann Kleint2016-09-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add compiler option -d2SSAOptimizer- for this version of the compiler since it causes crashes. Task-number: QTBUG-55238 Change-Id: I9b38c669ad25f519150dd352b402dec982dc5555 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | Destroy an incubating delegate if it is removed before incubation completesMartin Jones2016-09-151-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | Removing an item from a model after its delegate has started incubation, but before it has completed results is an orphaned item. Task-number: QTBUG-55901 Change-Id: I3d3136dc05a950ca38d53687ae7d38a6d0c7ec35 Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
| * | Document that attached properties are created in C++Mitch Curtis2016-09-051-1/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | There was some uncertainty about whether or not it could be done from QML, which it can't. This patch also links to the documentation for creating custom attached objects. Change-Id: Icb9eff0ec96e7911b8d401bd38813bbd6eda227d Reviewed-by: Gavin Kistner <gkistner@nvidia.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Allow for garbage collection of types with errors in trimCache()Michael Brasser2016-08-301-2/+4
| | | | | | | | | | | | | | Change-Id: I821ea14f60871735bface4e2cf4e61fcb61b2784 Task-number: QTBUG-55567 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * Workaround crashes in QtQml code related to dead-store eliminationJonathan Liu2016-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When compiled in release mode with GCC 6, QtQml may crash. This is because the C++ compiler is more aggressive about dead-store elimination in situations where a memory store to a location precedes the construction of an object at that memory location. The QV4::MemoryManager::allocate{Managed,Object} functions allocate memory and write to it before the caller does a placement new to construct an object in the same memory. The compiler considers these writes before the constructor as "dead stores" and eliminates them. The -fno-lifetime-dse compiler flag is added to disable this more aggressive dead-store eliminiation optimization. This is a temporary workaround until a proper solution is found. Task-number: QTBUG-55482 Change-Id: I7dbae6e9e613e53ce5fb25957c449bc6657803b5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix V4 on big-endianAllan Sandfeld Jensen2016-09-121-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't both invert offset position and inter-value positions of tag and value. This patch changes 32-bit big-endian to use the same order inside the tag/value but just at different offsets. This also make it compatible with how we use it with doubles. This fixes value/tag reads on 32-bit big-endian and offsets on 64-bit. Change-Id: I95cf792c29ac3f42a4018ce1f115193c143a0df0 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | V4: Correctly format on Number.toPrecision(n)Ulf Hermann2016-08-231-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | The ecmascript standard mandates that we add trailing zeroes if the given precision is greater than the number of digits available. The only way to request this from QLocale is currently QString::asprintf(), which adds a few other incompatibilities that are easier to 'fix' by editing the resulting string. Thus we use it as a stop gap measure until we can expose better API from qtbase. Task-number: QTBUG-55358 Change-Id: Iafc11f21abb341fbe458ad75b46b4222ae5bc1db Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-192-2/+2
|\| | | | | | | Change-Id: I7bd70996e3372d154c6b0e47336baa22146667b0
| * Remove some double-meaning text from documentationFrederik Schwarzer2016-08-181-1/+1
| | | | | | | | | | Change-Id: I9b69dbe929947795bdfbff4e0e3a16a47fa94197 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * QML: Do not register dependencies of deleted bindingErik Verbruggen2016-08-181-1/+1
| | | | | | | | | | | | | | Because it can lead to a use-after-free. Change-Id: I6701b370c0ecee4967e5f749f673a6f9ee3d504c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-186-7/+16
|\| | | | | | | Change-Id: I20c622263f40c322954328e4d10a8071db3ca6d1
| * QV4Object: fix GCC 6.1 tautologial compare warningMarc Mutz2016-08-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC warned: qtdeclarative/src/imports/localstorage/plugin.cpp:152:126: error: self-comparison always evaluates to true [-Werror=tautological-compare] Fix by comparing the types for equality instead of the addresses of their static_vtbls. Task-number: QTBUG-53373 Change-Id: Idd1598610ad6381c03c3a46abe56a332726bd6a0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * Fix throwing an exception inside a finally block with a return in catchSimon Hausmann2016-08-162-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When exiting a catch block with a return statement, we'll unwind the exception handling manually and emit finally statements right before jumping to the exit block. If we throw an exception in the final block, we'll end up using the exception handler of the catch block that contains the return statement, which means we'll end up popping the exception scope one too many times, once through ScopeAndFinally::CatchScope in unwindException() and then when executing the exception handler block. The latter we should not be executing, instead we should jump straight to the exit block. Therefore any statements emitted as part of the manual exception unwinding (finally block here) need to be part of a new basic block with no exception handler. This bug became visible in debug builds where the Scope destructor compares the scope mark against the engine stack top to ensure correct cleanup order (which was wrong). However that in turn was hidden in debug builds again due to an accidental = instead of == in a Q_ASSERT. With the Q_ASSERT fixed this use-case is covered by ch12/12.14/S12.14_A13_T3 Change-Id: Id74a1b2bb3e063871b89cc05353b601dd60df08e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * Doc: Change instances of 'OS X' to 'macOS'Topi Reinio2016-08-153-3/+3
| | | | | | | | | | | | | | | | | | | | | | As of version 10.12 (Sierra), the name of Apple's desktop operating system will be macOS. Change all occurrences where the Mac platform is discussed to use the macro \macos (defined in the documentation configuration in qtbase). Change-Id: Iea114ac73c01d74401bcd77373b41a825d2636c9 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | Doc: Remove references to Windows CEVenugopal Shivashankar2016-08-171-1/+0
| | | | | | | | | | | | | | | | The platform is not supported since Qt 5.7 Task-number: QTBUG-55331 Change-Id: I5a38940bd8ebf7dd62d04015e1738ee23ac65bb2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-138-197/+197
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4isel_moth.cpp src/qml/compiler/qv4ssa_p.h tests/benchmarks/qml/qqmlimage/qqmlimage.pro tests/benchmarks/qml/qqmlimage/tst_qqmlimage.cpp Change-Id: Iad11ce7fdf0c6d200fdebc16a94081bd8069a87a
| * Move the moth stack slot allocator into qmldevtoolsSimon Hausmann2016-08-122-162/+164
| | | | | | | | | | | | | | This way it's accessible to the QML compiler. Change-Id: I3918a796c698fc75e134b29a61eed2ec028bc851 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * QQmlObjectCreator: prefer initializer syntax over assignmentEdward Welbourne2016-08-111-5/+4
| | | | | | | | | | | | | | | | Greater uniformity; also opens the door to potential const-ing, should this ever be worht considering. Change-Id: I91b44472cb7d84f85b3033f14a763beeea837459 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * QQmlObjectCreator: initialize _bindingTargetEdward Welbourne2016-08-111-0/+1
| | | | | | | | | | | | | | Coverity (CID 163180) noticed _bindingTarget wasn't initialized. Change-Id: Ia727d00a161e514c437a72084b6ef01a7ebf4abc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Fix char conversions in QMLChristian Strømme2016-08-092-27/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a partial revert of 90b06e2773842, as it had unwanted side effects. The original intention was to make assignment from char to string possible, or more specifically, we wanted a solution where a QChar could be assigned to a QString, as a character and not a string representation of its value. While this behavior is desirable for QChar, we most likely want the opposite for the regular character types. Task-number: QTBUG-49232 Change-Id: I82d5f72b900fe984c4db1478fd52a9eb69ad2ee6 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Clarify doc on modification of the global object in JS imported by QMLMitch Curtis2016-08-081-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, reading the documentation for modification of the global object in JavaScript can be confusing. http://doc.qt.io/qt-5/qtqml-javascript-hostenvironment.html says: JavaScript code cannot modify the global object. In QML, the global object is constant - existing properties cannot be modified or deleted, and no new properties may be created. ... Any attempt to modify the global object - either implicitly or explicitly - will cause an exception. If uncaught, this will result in a warning being printed, that includes the file and line number of the offending code. http://doc.qt.io/qt-5/qjsengine.html#globalObject says: Returns this engine's Global Object. By default, the Global Object contains the built-in objects that are part of ECMA-262, such as Math, Date and String. Additionally, you can set properties of the Global Object to make your own extensions available to all script code. Non-local variables in script code will be created as properties of the Global Object, as well as local variables in global code. If QQmlEngine "is-a" QJSEngine, and QJSEngine can have its global object modified, it might seem reasonable to expect that imported JavaScript code should be able to modify the global object. This patch aims to be more explicit about the restrictions and give examples of how libraries should expose their APIs correctly for use by QML code. Change-Id: I11beb894a88d52038be90ffe6baa9337943810db Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Fix crash with Component.onDestructionSimon Hausmann2016-08-051-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A call to a handler of Component.onDestruction may end up causing WeakValues such as QQmlData::jsWrapper to be set again, even though they've been set to undefined in an earlier iteration of the loop that walks through the weak references. That in turn may result in invalid object references to objects that are scheduled for destruction by the collector. So after calling all destroy handlers for QObjects, reset all of the weak values again. Task-number: QTBUG-54939 Change-Id: I00ebabb76274e296fb1bd90d8d3e21dbbb920b57 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * Fix crash when cache property can not be foundFilipe Azevedo2016-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | For some reason if a cache property is not found this cause an application crash instead of just reporting an error. Now instead of a crash we get this kind of error visible: qrc:///the_file.qml line 64 column 30: Cannot assign object to property Change-Id: Ic420713df30603f1d164da439cba30a18af8f2bc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-053-4/+10
|\| | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h Change-Id: I1e6a9424e7f87d9e4ac1ea387ec70e151106f1c7
| * Fix recursion during aggressive GCSimon Hausmann2016-08-041-0/+3
| | | | | | | | | | | | | | | | With aggressive GC enabled we may end up calling the GC recursively, which does not work at all, so disable that. Change-Id: I9ce0abbdb7b2bfa8499b33fd0be0d6e4a5212a15 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
| * Fix grammar in JavaScript Host Environment docMitch Curtis2016-08-041-2/+2
| | | | | | | | | | | | Change-Id: Ib7bc3f62fc27e982f59f1c8b2c2e0cf26306c3b9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * QQmlComponent: fix handling of relative pathsDavid Faure2016-08-031-2/+5
| | | | | | | | | | | | | | | | Calling QUrl::fromLocalFile() on a relative path leads to a non-relative URL, as per the definition of QUrl::isRelative(). Change-Id: Ibaa9ecac56c6a14f6e41c5cf5250d7bbafed9837 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-017-25/+151
|\| | | | | | | | | | | | | | | Conflicts: tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp tests/auto/quick/qquickitem/tst_qquickitem.cpp Change-Id: If261f8eea84dfa5944bb55de999d1f70aba528fd
| * Fix documentation of Component.createObjectGiuseppe D'Angelo2016-07-261-1/+1
| | | | | | | | | | | | | | The parent argument should really be any QObject, not just Items. Change-Id: I4d105722b9d76585dd353eddf464a1ec39fea75e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Mention Q_FLAG in C++ <=> QML type conversion documentationMitch Curtis2016-07-261-0/+2
| | | | | | | | | | | | | | | | | | For a user visiting doc.qt.io/qt-5/qtqml-cppintegration-data.html, it's very difficult to know how to use an enum as flags in QML, because it's not mentioned anywhere on this page. Change-Id: I35065bff825b8aebab1477ec883d17cbab92b3ba Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
| * QQmlPropertyMap: Don't spuriously emit valueChanged() signalThomas McGuire2016-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | The valueChanged() signal was emitted when the property was written with the same value. This increased the potential for binding loops in user code. Change-Id: Ifeb8f6f23e2022aa35cb6cac7cf1a3dbc0e8ca2f Task-number: QTBUG-48136 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Fix string property assignments to 2d vectors and quaternionsSimon Hausmann2016-07-212-0/+50
| | | | | | | | | | | | | | | | | | Just like it's possible to assign "1,2,3" to a QVector3D, the same should be possible for a QVector2D and a QQuaternion. Task-number: QTBUG-54858 Change-Id: I8f394279dcdf5c057876efaa316b4bad51a4c126 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
| * Fix QQmlEngine crash on big endian 64 bit architectures (s390x)Maximiliano Curia2016-07-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This change disables the BIG_ENDIAN 32 bits words mangling in 64 bits machines (where the words are 64 bits long); this would otherwise result in a segfault. Task-number: QTBUG-54717 Change-Id: I6b5ab6f213880b030795185c05e609d290168901 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Timo Jyrinki <timo.jyrinki@iki.fi> Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
| * JS: Check for errors before using sub-expression resultsErik Verbruggen2016-07-201-21/+95
| | | | | | | | | | | | | | | | Specifically: don't de-reference a result and assume that it's not-null. Task-number: QTBUG-54687 Change-Id: If07d3250a95a7815ab7a3262b88e0227965ef8e7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Doc: syntax error qml exampleNico Vertriest2016-07-201-1/+1
| | | | | | | | | | | | | | | | onRelased --> onReleased Change-Id: I0078229b66bc8db4c70789d0536de70166ee0852 Reviewed-by: Martin Smith <martin.smith@theqtcompany.com> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>