aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove warnings with clangYann Bodson2012-02-072-3/+1
| | | | | Change-Id: I924f0adc036b47e2342bf383d308c6a5269c2de6 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* More fixes for QDeclarativeListModelWorkerAgent cleanupCharles Yin2012-02-071-1/+2
| | | | | | | | | 1) Use deleteLater() instead of delete to avoid crashing with any pending events 2) During event processing, return earlier if possible Change-Id: Ia7d6c95acf1175a16b80e952b95909bb5bbc9433 Reviewed-by: Glenn Watson <glenn.watson@nokia.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Fix some QJSValue test failures.Glenn Watson2012-02-061-2/+10
| | | | | | | | | | | Fix precision issues causing test failures on platforms where qreal is defined as single precision. Also use explicit casts to ensure well defined behaviour when converting a negative double value to an unsigned integer. Change-Id: Ia0048bf83169d3b617f70828f86368c23f4f3786 Reviewed-by: Chris Adams <christopher.adams@nokia.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Fix incorrect ref count with dynamic roles on worker thread.Glenn Watson2012-02-061-0/+3
| | | | | | | | | | When using the dynamic roles mode from a worker script thread, the reference count for the list model worker agent was not being incremented correctly, causing the final release of the agent to be reading from memory that had already been freed. Change-Id: I06d8e363c95133c1c162f32e1efb2d4020ed96be Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Fix crash bug related to QDeclarativeListModelCharles Yin2012-02-034-44/+60
| | | | | | | | | | If QDeclarativeListModel is deleted, all references to this object in QDeclarativeListModelWorkerAgent and WorkerScript objects should be removed and additional checking is needed when process the pending sync() events. Change-Id: I12b1f06699cc908e684af0886cf06d811c3fceb4 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Glenn Watson <glenn.watson@nokia.com>
* Ensure || expressions in v4 will always exit.Michael Brasser2012-02-031-0/+1
| | | | | | Change-Id: I7188e38403fec96f83f3bdfc68b763a9aec9346a Task-number: QTBUG-24038 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Remove QtQuick1 elements from qtdeclarativeMatthew Vogt2012-02-0312-62/+14
| | | | | | | | QtQuick1 is now contained in a separate repository. Task-number: QTBUG-23737 Change-Id: I09eae67af5693a22b896b916f816f73ccc3a89b1 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Fix spelling errors that refer to non-existent symbolsMatthew Vogt2012-02-022-2/+2
| | | | | | | | | These erors create the appearance of symbols that do not actually exist. Task-number: QTBUG-23737 Change-Id: I249742998524b6156185a6601f36e7691013ddf3 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Remove QJSEngine::undefinedValue() functionKent Hansen2012-02-023-21/+0
| | | | | | | | | | | | | | | | Rationale: It's strange to have an undefined value factory function. There should just be one way of constructing undefined values: By passing UndefinedValue to the QJSValue constructor. The undefinedValue() function created a value that was bound to the engine; the QJSValue constructor does not. In order to ensure that we're testing the same behavior as before, I've replaced undefinedValue() calls by toScriptValue(QVariant()) in the autotests. Task-number: QTBUG-23604 Change-Id: Ie9295b7af49c853b5a4a3445da48c325fef8d6b1 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
* Remove QJSValue::isFunction() functionKent Hansen2012-02-022-18/+0
| | | | | | | | | | Rationale: QJSValue::isCallable() should be used instead. There is no compelling reason to be able to distinguish between JS Function instances and other callable objects. Task-number: QTBUG-23604 Change-Id: Ieef6b32030ef70f54081035fd4ffc3c17c184cd3 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSValue::construct() and deprecated call() overloadKent Hansen2012-02-022-29/+1
| | | | | | | | callAsConstructor() should be used instead. Task-number: QTBUG-23604 Change-Id: If95ab9906712ede7cbae5e9d24624708bccf880f Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSValue::toInt32() and toUInt32() functionsKent Hansen2012-02-022-30/+0
| | | | | | | | toInt() and toUInt() should be used instead. Task-number: QTBUG-23604 Change-Id: Ib64aea139e9082066a1e5096ef9fe3a97c35d3eb Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSEngine::nullValue() functionKent Hansen2012-02-023-21/+1
| | | | | | | | | | | | | | | Rationale: It's strange to have a null value factory function. There should just be one way of constructing null values: By passing NullValue to the QJSValue constructor. The nullValue() function created a value that was bound to the engine; the QJSValue constructor does not. In order to ensure that we're testing the same behavior as before, I've replaced nullValue() calls by evaluate("null") in the autotests. Task-number: QTBUG-23604 Change-Id: Ie40b61fa64e070b90c6245fd21554963073c5f80 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSValue constructors that take QJSEngine argumentKent Hansen2012-02-022-128/+0
| | | | | | | | | | | Rationale: These were remnants from QtScript. The difference from the standard constructors is that the value is eagerly bound to the engine, so they can be a bit faster. But they are also more low-level and look ugly in use. Task-number: QTBUG-23604 Change-Id: I5dae7452389383f60055d5ccc4f28d53c52f6092 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSValue::propertyFlags() functionKent Hansen2012-02-0210-71/+32
| | | | | | | | | | | | | | | | Rationale: The API is incomplete. There is no way to set/update the flags; adding a third (optional) argument to setProperty() is ugly. If necessary, a QJSPropertyDescriptor API should be added, to enable complete setting/querying of properties. The flags were moved to QJSValuePrivate, and the propertyFlags() implementation kept, because there is one place the read-only flag is checked internally (in qv8typewrapper). Task-number: QTBUG-23604 Change-Id: I089dce28dbda428662aac7c8d1536987fe6d855c Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove invalid QJSValue typeKent Hansen2012-02-027-181/+33
| | | | | | | | | | | | | | | | | | | Rationale: It's confusing to have an invalid type (which doesn't exist in JavaScript), and it creates lots of extra cases that have to be handled e.g. in value conversion and comparison. The Undefined type should be sufficient. Also, the invalid value type was being (ab)used to 1) make setProperty() act as a property deleter, and 2) signify that a property queried by property() doesn't exist. The recently introduced functions has(Own)Property() and deleteProperty() now provide that functionality. Default-constructed QJSValues now have the Undefined type. Task-number: QTBUG-23604 Change-Id: I1847492724d31e03ee1212c09ec87a2010920dc5 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Fix include of private header used between two qtdeclarative librariesKalle Juhani Lehtonen2012-02-021-4/+4
| | | | | | | | | Installed private headers can only include installed Qt headers. It is not safe to include headers from source tree, which can be removed after installation. Change-Id: I3b90e93a9b1b77e53bfcbf0eb914394ff7e48a57 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* QmlProfiling: don't send v8 data if not profilingChristiaan Janssen2012-02-021-2/+7
| | | | | | Change-Id: I41085ed06bcf28e9de0a72f25076b91b9a3b2aea Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com> Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
* Remove QJSEngine::newVariant() functionKent Hansen2012-02-014-28/+1
| | | | | | | | | | | | | Rationale: This is a remnant from QtScript. There is no reason one should be able to explicitly wrap an arbitrary C++ type in a QVariant. toScriptValue() will automatically wrap the type in a QVariant if it's a type that's not specifically handled by the meta-type system, or if it can't usefully/losslessly be converted to a native JavaScript type. Task-number: QTBUG-23604 Change-Id: I5790cd92b9ffd5fcfbee1cd73a8eaa16fc74846f Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSEngine::newDate() functionsKent Hansen2012-02-012-40/+1
| | | | | | | | | | | | | | Rationale: Passing a QDateTime to toScriptValue() should be sufficient, there's no need to have a dedicated factory function for Date objects. QDateTime has API for specifying a time in milliseconds, so the newDate() overload that takes a double argument should be redundant. Task-number: QTBUG-23604 Change-Id: Iec1d4ce8e1fd0a6ebef58dde3141730d27c2fb8c Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSValue::instanceOf() functionKent Hansen2012-02-014-57/+0
| | | | | | | | | | | | | Rationale: This is a remnant from QtScript. There is no good reason for providing this type of low-level "prototype inheritance chain" checks in this high-level QJSValue class. If you want to check if an object is of the "right type", you can check if it has the properties you require using property(). Task-number: QTBUG-23604 Change-Id: I3a274212cc57c38228fab73423af481e1b95d8a5 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* QJS{Engine,Value}: Remove QRegExp-specific functionsKent Hansen2012-02-018-111/+2
| | | | | | | | | | | | | Rationale: QRegExp regular expressions have different semantics than JavaScript RegExp. This can cause data loss and unexpected behavior. qjsvalue_cast() and fromScriptValue() can still be used to convert between QRegExp and JS RegExp. Task-number: QTBUG-23604 Change-Id: Iacf4aaea232aff9e4cecf4afa40753229bc5d643 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSValue::toUInt16() functionKent Hansen2012-02-012-21/+1
| | | | | | | | | | | Rationale: Remnant from QtScript. The implementation is just zeroing the upper 16 bits of the 32-bit integer conversion. Task-number: QTBUG-23604 Change-Id: I6b4b40883da01713d2a946eb028264f3a351276b Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSValue::toInteger() functionKent Hansen2012-02-012-27/+1
| | | | | | | | | | | | Rationale: This is a remnant from QtScript. A function called toInteger() that returns a double looks strange. Use toInt32() to convert a QJSValue to an integer. Task-number: QTBUG-23604 Change-Id: I2829704c64b077fca264b660c46248c3f35cb5c0 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove QJSEngine::toObject() and QJSValue::toObject()Kent Hansen2012-02-016-90/+1
| | | | | | | | | | Rationale: There is no compelling usecase for these functions. They are a remnant from QtScript. Task-number: QTBUG-23604 Change-Id: I6d8b4299956dd8f6284934739c4f1a65e4deb64c Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* QmlProfiler: profiling binding loopsChristiaan Janssen2012-02-012-3/+4
| | | | | | | | Moved the trace call in bindings so that they are also registered when binding loops occur. Change-Id: I56aa7bda6c5305f14dee98bebd929fb720f1ab32 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
* QmlProfiler: moved v4 tracing to run methodChristiaan Janssen2012-02-011-5/+2
| | | | | | | | We used to register the calls to update, but that happens only when the binding is created. Evaluation occurs at run. Change-Id: I01927a1eb515a83b4e5c69c6fcf5f358a8e5878f Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
* QmlProfiler: profiling compiled v8 bindingsChristiaan Janssen2012-02-015-21/+32
| | | | | Change-Id: I8c61b3805244595de6e1c7fbed7ed23440fe0a82 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-30256-258/+258
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: If39bd256b0fa85eba17ea30f8ab87ea27d758908 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Improve QRegExp property literal assignment error messageChris Adams2012-01-271-0/+3
| | | | | | | | | | | Previously, the error message given when a string literal was assigned to a regular expression property was not very helpful. This commit adds a better error message. Task-number: QTBUG-23068 Change-Id: Ia57b6434b9cdf009429e7b55edab4ab5c2b91c2a Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Fix breakage due to meta-type id reordering in qtbaseKent Hansen2012-01-261-1/+7
| | | | | | | | | | | | | | | Commit aee1f6cc413f56bf4962324799ee3887c3dd037f in qtbase changed the order/IDs of the "extended" meta-types, so that they are not bigger than QVariant::UserType (127) anymore. This caused autotests in qtdeclarative to assert/fail. Ths commit adapts the logic in qtdeclarative accordingly, in particular so that QVariant/QObjectStar aren't treated as value types. Change-Id: I3e6c0b2c9fb04bfd7f7fd94da2741f9536229b87 Reviewed-by: Kai Koehne <kai.koehne@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Remove the work-around for avoiding possible deadlock.Xizhi Zhu (Steven)2012-01-251-6/+0
| | | | | | | | The possible deadlock has been fixed by: http://codereview.qt-project.org/#change,13989 Change-Id: I1238052d4452ac37dedf8939fa27c8c8f6536f16 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Use QMetaType::QVariant as the type for QVariantKent Hansen2012-01-255-43/+29
| | | | | | | | | | | Change http://codereview.qt-project.org/#change,12408 in qtbase updates moc and friends to use QMetaType::QVariant instead of the magic -1 / 0xffffffff / QVariant::LastType. This change adapts qtdeclarative accordingly. Change-Id: Ifb120485a4ee1501df6ad42d8ecd590824c85e9f Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com> Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Move sqldatabase into a module API pluginCharles Yin2012-01-257-58/+168
| | | | | Change-Id: Icd0bbfe16804abf1bbadbabddf3a30b5b18df30c Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Allow JS API in modulesMatthew Vogt2012-01-2411-73/+266
| | | | | | | | | Allow modules to export verisoned javascript code into specified namespaces. Task-number: QTBUG-20857 Change-Id: Ic968c697ba36cbc4535870ed5eed2fe7f01af11d Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Console API: Add console.exceptionAurindam Jana2012-01-243-0/+12
| | | | | | | | | console.exception writes a message to the console and prints the JavaScript stack trace at the point where it is called. Change-Id: Idd2ff5982826accae0895db44c7ecf6130338cc7 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
* Console API: Add console.assertAurindam Jana2012-01-243-13/+41
| | | | | | | | | console.assert tests if an expression is true. If it is false, it writes a message to the console and prints the JavaScript stack trace at that point. Change-Id: I5487552cb8a947e1947914166834e0bdedba3354 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
* Don't hang the worker script engineCharles Yin2012-01-243-1/+12
| | | | | | | | | | | | 1. Wake up the syncDone wait condition when delete the QDeclarativeListModelWorkerAgent, otherwise the the whole worker script engine thread will hang at the sync() call and can't exit gracefully. 2. Call QCoreApplication::processEvents() before delete the worker script engine to cleanup all pending events in main thread to release wait conditions which some worker scripts/agents are waiting for (QDeclarativeListModelWorkerAgent::sync() for example) Change-Id: Ia3712318771633e68238b4d629ba870ff7ce45b9 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
* Console API: Add console.countKai Koehne2012-01-244-13/+58
| | | | | | | | console.count can be handy to check how often code snippets are executed. Change-Id: I0eaf17ab893c76e7b8956122aa31e218745e92bf Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
* Update obsolete contact address.Jason McDonald2012-01-23254-275/+275
| | | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I6a730abc0c396fb545a48b2d6938abedac2e3f1c Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Mark deprecated functions in QJSEngine and QJSValueKent Hansen2012-01-204-38/+142
| | | | | | | | | | | | | This functionality will be removed or renamed in the final Qt 5 API. From this commit and with deprecated warnings enabled (DEFINES += QT_DEPRECATED_WARNINGS), it's easy to see how existing users of this API (e.g. qtjsondb) are affected. Task-number: QTBUG-23604 Change-Id: I242c43377bb34ddcca84b6ed5b7ef9fbf2017a83 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Add QJSValue::callAsConstructor() functionKent Hansen2012-01-204-27/+38
| | | | | | | | | | The old name, construct(), was bad. This name is more descriptive and consistent with the other callXXX() functions. Task-number: QTBUG-23604 Change-Id: Ie205b0c52721782101e665f7dfedcac9051a00d0 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Add QJSValue::callWithInstance() functionKent Hansen2012-01-202-4/+17
| | | | | | | | | | | | | | With the deprecated call() overload, it was confusing what the first argument was (the this-object or an actual argument passed to the function). Introduce a dedicated function for the "explicit this-object" case. This makes code more readable, and eliminates the need to pass a "dummy" this-object to call() in the quite common case where you don't care about the this-object. Task-number: QTBUG-23604 Change-Id: I18f8be6592a848436351516bea266fc7e9195777 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Add QJSValue::call() overloadKent Hansen2012-01-202-0/+23
| | | | | | | | | | | | This overload takes only an argument list, not a this-object, since that is a very common way of calling stand-alone ("non-member") functions. Now there is no longer a need to pass a dummy value for the this-object. Task-number: QTBUG-23604 Change-Id: Iae952d91fce5bcaa62a05b9978c15f32802da90a Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Add QJSValue::isCallable() functionKent Hansen2012-01-202-3/+16
| | | | | | | | | | | This replaces the isFunction() function. isFunction() will be removed. It's possible that objects are callable even if they aren't Function instances. Also, "isCallable" is consistent with call(). Task-number: QTBUG-23604 Change-Id: I42e0ab2ad9dc84e7793199254bbd89d5c9466e6a Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Add QJSValue::toInt() and toUInt()Kent Hansen2012-01-203-5/+31
| | | | | | | | | | These replace toInt32() and toUInt32(), which are obsolete and will be removed. Task-number: QTBUG-23604 Change-Id: I83c055dbbe399fa7242889cee8a177440a693d9a Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Add QJSValue::deleteProperty() functionKent Hansen2012-01-202-1/+30
| | | | | | | | | | | This makes it possible to delete a property without relying on passing a QJSValue of invalid type to setProperty() (the invalid type is going to be removed). Task-number: QTBUG-23604 Change-Id: I653b3349050ad1aac1cf6ccc8547c753abbb9f1d Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Add QJSValue::hasProperty() and hasOwnProperty() functionsKent Hansen2012-01-204-1/+52
| | | | | | | | | | These functions provide a way of querying whether a property exists, without relying on the QJSValue invalid type (which will be removed). Task-number: QTBUG-23604 Change-Id: I2efd53a1e54cc202ecc022d12730b2775384cf53 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Build fix.Jędrzej Nowacki2012-01-201-1/+0
| | | | | | | | QBool was removed from QtBase in change I6642f43f (Remove QBool and use bool instead) Change-Id: Ia4c5d12fae8779d7e8c880755cd16e215f073a6d Reviewed-by: David Faure <faure@kde.org>
* Doc: Improve Qt.locale docs.Martin Jones2012-01-201-2/+2
| | | | | Change-Id: I3ef5c4a0bedbaa346b001852bba8e9ff9347e9e0 Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>