aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* TableView pixelator exampleMichael Winkelmann2018-07-108-0/+488
| | | | | | | | Example of a QML TableView with custom table model. Inspired from the original pixelator example from the widget world. Change-Id: Ic33e6d2e9320fe135d56dde92326dd8a606fe109 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQmlAdaptorModel: move connection set-up code to QQmlDelegateModelRichard Moe Gustavsen2018-07-104-52/+78
| | | | | | | | | | | | There is no need that QQmlAdaptorModel sets up the connection between QQmlDelegateModel and QAIM. QQmlDelegateModel can do this internally. This removes more of the dependency to QQmlDelegateModel, and will make it easier to reuse the class also for other models as well (first and foremost the upcoming QQmlTableInstanceModel). Change-Id: I957ac7bf85c6976ac79df0500a3c1ec3f8be42e2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix invalid object property key conversionsSimon Hausmann2018-07-105-12/+330
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Different property names are mapped to the same property key through a the identifier hash table. In the case of QTBUG-69280 we map a for-in loop "for (var prop in testCase)" in TestCase.qml to an internal iterator object, which signals whether it's finished or not by setting a "done" property on the iterator result object to a boolean. On the setter side, the property is specified via result->put(engine->newString("done")) and on the getter side the code uses result->get(engine->id_done()) For this to work, the newly created string has to map to the same identifier, otherwise we end up with differing property keys and wrong values. The test failure of QTBUG-69280 reproduced a scenario where two strings, "pathChanged" and "done", mapped to the same index in the hash table after a rehashing (growing), despite different string hash values. As a consequence of the hash collision they had adjacent entries in the hash table, with "pathChanged" coming first. A subsequent garbage collection run ended up with "pathChanged" being not marked and subject to removal from the identifier table. IdentifierTable::sweep() wiped the entry for "pathChanged" and lastEntry to the now free index and also remembered the exact string hash value. In the next iteration, sweep() looked at the entry for "done", which should move to the now free slot, as both strings map to the same index. However sweep() didn't do that because the comparison of string hash values failed. The fix is to compare table indices (covered by sweepFirstEntryInSameBucketWithDifferingHash) and respect bucket boundaries (covered by dontSweepAcrossBucketBoundaries). However it may happen that entries that would map to the same bucket end up after another bucket because of the insertion order. This would lead to Q_ASSERT(table[lastIdx] == nullptr); failing right after lastIdx = (lastIdx + 1) % alloc; Instead the determination of the next free slot must follow the same logic as in addEntry, by finding the first null entry. This is covered by sweepAcrossBucketBoundariesIfFirstBucketFull. Task-number: QTBUG-69280 Change-Id: I284f53418d0a75e2edb631f8bacca8c5a596e603 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Teach Rectangle's gradient property to accept QGradient::PresetTor Arne Vestbø2018-07-108-28/+136
| | | | | Change-Id: Id640b596c1d8d52221f2f2be8807d6e245971bdc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QQuickTableViewPrivate::modelIndexAtCell(): print count when assertingMitch Curtis2018-07-091-1/+2
| | | | | | | | It's not useful to know the modelIndex without the count that it exceeded. Also, print the names of the variables. Change-Id: I97d83dad3980fa0fc3d85759a2adfb2b723a6ce1 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* QQuickTableViewPrivate::dumpTable(): print absolute path of imageMitch Curtis2018-07-091-3/+5
| | | | | | | | This way, you can just paste the path into e.g. Creator's locator instead of having to find the application's build directory yourself. Change-Id: If44d8fdf8c3c14c64a1f28432b13b8bdd9f80863 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* QQmlDelegateModelItem: set row and column explicitRichard Moe Gustavsen2018-07-094-44/+55
| | | | | | | | | | | | | Whenever we set a model index on a model item, set row and column explicit as well. We used to calculate row and column by calling out to QQmlDelegateModel from within QQmlDelegateModelItem. But we want to remove the dependency to QQmlDelegateModel as much as possible, to be able to reuse QQmlDelegateModelItem also from other model classes (first and foremost the upcoming QQmlTableInstanceModel). Change-Id: Ib80b31250010b2611ba1715d3324145117add865 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* tst_qquickpositioners: Remove forced basic renderloop workaroundTor Arne Vestbø2018-07-031-4/+0
| | | | | | | | | The issue has been worked around in the macOS platform plugin. Task-number: QTBUG-69040 Change-Id: I3b7ca71eb355c3ded11afbeb3e792179729c5208 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Bump internal API version after internal API changesSimon Hausmann2018-07-031-1/+1
| | | | | Change-Id: I60eb8a7185a2e6f62b56b1fd3dca01cbc6f784ab Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Quick tests: remember positions of stationary pointsShawn Rutledge2018-07-032-46/+49
| | | | | | | | | | | | | | | | We need Items to receive accurate positions for stationary touch points: that is, the last-known position from the previous touch event. (And we hope that all actual touch-capable platforms also send proper QPA events with correct positions for stationary points. We assert that it's a bug if they don't.) As explained in qtbase 7cef4b6463fdb73ff602ade64b222333dd23e46c, it's OK to retain a copy of a QTest::QTouchEventSequence for this purpose, so that the QMap<int, QTouchEvent::TouchPoint> previousPoints will not be discarded between events. Change-Id: I12a04323b0d82dc325348c0fa3e067a4b63f57e9 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Input handler tests: remember positions of stationary pointsShawn Rutledge2018-07-033-23/+26
| | | | | | | | | | | | | | | | | | | We need Handlers to receive accurate positions for stationary touch points: that is, the last-known position from the previous touch event. (And we hope that all actual touch-capable platforms also send proper QPA events with correct positions for stationary points. We assert that it's a bug if they don't.) As explained in qtbase 7cef4b6463fdb73ff602ade64b222333dd23e46c, it's OK to retain a copy of a QTest::QTouchEventSequence for this purpose, so that the QMap<int, QTouchEvent::TouchPoint> previousPoints will not be discarded between events. We have done this in other tests, but not consistently; e.g. 468626e99a90d6ac21cb311cde05c658ccb3b781 fixed the PinchArea test. Change-Id: I4dbe69f8dcc4b1cca30fd7ce91d7d2ecf5ec4bc3 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Fix handling of out-of-range year in Date's toISOString()Edward Welbourne2018-07-031-1/+1
| | | | | | | | | | ECMAScript 2015 clarified the handling of out-of-range years, requiring that an exception be raised: http://www.ecma-international.org/ecma-262/7.0/index.html#sec-corrections-and-clarifications-in-ecmascript-2015-with-possible-compatibility-impact http://www.ecma-international.org/ecma-262/7.0/index.html#sec-date.prototype.toisostring Change-Id: I91d76703705f3919d2ee77557e36af362db1adf9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Apply TimeClip() in a few places it was missingEdward Welbourne2018-07-031-3/+3
| | | | | | | | | When parsing or converting from a QDateTime, we didn't always check that the resulting Date object was within range (1e8 days either side of the start of 1970). Change-Id: I1bee69f9070829f68998d576c19907a827fabc39 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix class members that are generatorsLars Knoll2018-07-036-517/+37
| | | | | | | Properly support member functions that are generators in classes. Change-Id: I5fc8d5b58a17c61a446b43d6576bb83de5ecd920 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Allow for more than 128 bytecode instructionsLars Knoll2018-07-034-79/+108
| | | | | | | | | | | | | | | | | | | | | | Instructions always occupy two numbers, an even and the following odd one, for the single byte and four byte encoding. An instruction of 0x0 is now a NOP, but 0x1 implies that the instruction type is using two bytes, and the following byte needs to be read as well to get the correct instruction type. Encoding and decoding of those two byte instructions is fully transparent, and adding more instructions now doesn't require any special handling. The first 127 instructions in the FOR_EACH_MOTH_INSTR macro will get a single byte encoding, the remaining ones will use two bytes. When adding new instructions, make sure to put often used and fast instructions into the first 127 instructions, while adding rarely used (or slow) instructions to the end (before Debug though). Change-Id: Id772a109641ab68feb228c3abd05f41ae7075e94 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Change the instruction encoding for the bytecodeLars Knoll2018-07-034-22/+27
| | | | | | | | | | | | Change the encoding, so that even instructions are short ones, odd instructions long. This implies that the lowest bit encodes whether an instruction is short or long (1 vs 4 byte encoded). This prepares for allowing us to extend the totoal number of instructions beyond 128. Change-Id: I4732e7241d3593b24ad25cd69555edc25f38d2f6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Give classes a name propertyLars Knoll2018-07-032-80/+5
| | | | | | | Set the classes name as defined in the ES7 spec. Change-Id: I5ef1d317dfdf92f5e7c141b9092fa391a64ce8af Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Correctly setup the this object after a super callLars Knoll2018-07-032-9/+4
| | | | | Change-Id: I7c2d9c09b3059dcd6ce2eb356a74980a3410a245 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for super propertiesLars Knoll2018-07-0311-35/+148
| | | | | | | | Those are mostly working now, but when calling super properties the this object is not setup correctly. Change-Id: Ib42129ae6e729eeca00275f707f480371b7e42a5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of the duplication for the GetLookup instructionsLars Knoll2018-07-037-44/+9
| | | | | | | | | GetLookup and GetLookupA were doing exactly the same thing. Only keep the version that expects the base object in the accumulator and rename it to GetLookup. Change-Id: Ia14256880cef23f7b70d8c7e6bb74aba371b8d9a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix naming of classes in class expressionsLars Knoll2018-07-035-494/+51
| | | | | | | | As with function expressions, class expressions also get an implicitly defined name if they are directly assigned to a named variable. Change-Id: I5fda9d74c1c299107f15b82245333b54ca6d8917 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for super callsLars Knoll2018-07-0316-120/+225
| | | | | | | | Implement super call support for class constructor functions. Change-Id: I3c64276234689cf4f644b095e0fc8ca1c634ac53 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Refactor initialization code for JS stack framesLars Knoll2018-07-037-104/+112
| | | | | | | | | Move code into qv4stackframe_p.h, so that it can be re-used from different places. Clean up VME::exec and the generatorfunctions using this. Change-Id: Ib4f7eceeb5f55d98dd6ccf2584d13a3b864caea1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move the C++ and JS stack frame definitions into it's own fileLars Knoll2018-07-0318-107/+226
| | | | | Change-Id: I86e89e07197aec6071809c2d32bd5c98cb7ac6f6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove ExecutionEngine::setCurrentContext()Lars Knoll2018-07-032-9/+6
| | | | | | | | It's unused and shouldn't exist. Also de-inline currentContext() to avoid a dependency on the CppStackFrame in the header. Change-Id: I44724f8097883dc1b1064430778f45f7811460df Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Smaller refactoring of VME::exec() to preapre for upcoming changesLars Knoll2018-07-033-46/+55
| | | | | | | | | We'll need a more flexible interface here to support derived constructors properly. There's also quite some code in the generator functions that could benefit from some cleanups. Change-Id: I951b5d2171efa80d52fd6b0155f8f2c78af2f3b5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement support for new.targetLars Knoll2018-07-0346-99/+97
| | | | | | | | | Support the new.target meta property in the codegen, and add support for passing the newtarget into the constructor vtable methods and the execution context. Change-Id: I62ea58e5e92d894035a76e35776203e9837c383b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Prefix vtable methods with virtualLars Knoll2018-07-0368-407/+390
| | | | | | | | | Turns out that the overloading of vtable methods and regular ones is problematic in some cases. So let's rather make it explicit which methods are part of the vtable, and which aren't. Change-Id: Ifee32a26104d30f3c82bca8b5a9cdea2d4f4f526 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Unify the managed and object vtablesLars Knoll2018-07-0312-158/+149
| | | | | | | | | | Allow for nullptr entries in the vtable. To nevertheless get some decent error checking if one of the methods is reimplemented, use a base class for Managed that contains a full set of the vtable entries all being nullptr's. Change-Id: Ibc53973b539f87331e8e465a6c44436a30acbefd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move the Vtable for Managed objects into it's own fileLars Knoll2018-07-036-152/+219
| | | | | | | | Move both the code from qv4object and qv4managed into a new qv4vtable_p.h file. Change-Id: Ib1d58120b6c3b9b779b2692526c7e40a5265c4db Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add a newTarget parameter to the Construct runtime methodsLars Knoll2018-07-035-13/+22
| | | | | | | This is required to be able to support the super() call. Change-Id: I9998680341d701727ac1697187ad33481bdde422 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix qtquick_compiler_add_resources when cross-compilingSimon Hausmann2018-07-032-12/+40
| | | | | | | | | | Attempt to locate the qmlcachegen binary in the host bin directory if possible. Task-number: QTBUG-68724 Change-Id: If0d28408a316b3dd33f4734464e0d5fe44c9fc2c Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of Value::asArrayIndex()Lars Knoll2018-07-023-43/+11
| | | | | | | | | | | It was only used in a few places now, that can be replaced by either using a PropertyKey, or by limiting the fast path optimization in the runtime to array indices smaller than INT_MAX. Since there are less branches this should even be faster for pretty much all use cases. Change-Id: Ib4f2f2f3e27f14ad180b810546e82ac83170b106 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Rename IdentifierTable methodsLars Knoll2018-07-027-24/+24
| | | | | | | identifier -> asPropertyKey Change-Id: I4e6f33bdad12e901303ec6101dd2b8d6b0e99ac4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Clean up the property key API in StringOrSymbolLars Knoll2018-07-0223-156/+105
| | | | | | | | | | | | | | Get rid of makeIdentifier(), as toPropertyKey() will take care of it. Rename identifier() to propertyKey() and check that the key is valid. Remove String/StringOrSymbol::asArrayIndex(), we don't need it anymore. Change-Id: I3c490fabc1475c9ea288b49b1638b6fa1bc237b7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Replace Identifier by PropertyKeyLars Knoll2018-07-0255-338/+318
| | | | | | | | Change all uses of Identifier to use the new PropertyKey class and get rid of Identifier. Change-Id: Ib7e83b06a3c923235e145b6e083fe980dc240452 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Introduce a PropertyKey class that inherits from ValueLars Knoll2018-07-0210-36/+260
| | | | | | | | | | | This will replace Identifier over the next few commits. The advantage of PropertyKey is that it can be stored on the JS stack, so that a GC run won't accidentally clean up the string/symbol referenced by the key. Change-Id: Ib4daa4616bcfa537e6d371ef7c7740bc7727a50d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Cleanups in the Identifier APILars Knoll2018-07-0217-44/+45
| | | | | | | | | | Rename from/asHeapObject to from/asStringOrSymbol and fix the signature. Add a isStringOrSymbol() method and redefine isValid() to also include array indices. Change-Id: Ic8272bfbe84d15421e2ebe86ddda7fdaa8db4f3e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Unify the get and getIndexed vtable functions of QV4::ObjectLars Knoll2018-07-0249-296/+263
| | | | | | | | This finalizes the refactoring of Object's vtable API. Also added the receiver argument to the method as required by the ES7 spec. Change-Id: I36f9989211c47458788fe9f7e929862bcfe7b845 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Unify put and putIndexedLars Knoll2018-07-0238-264/+195
| | | | | | | | | | Pass an Identifier through those virtual methods to unify the string and integer based versions. Also add the receiver that's required in ES7 Change-Id: I4e7f01b4c97cc80bcb3c485f6343f28213dc9e6b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add basic support for subclassingLars Knoll2018-07-022-29/+16
| | | | | | | | | Set the prototype chain up correctly when subclassing. Many things still won't work, as we do not yet support the super keyword at all. Change-Id: Id5dbe3de9ffad98d67b7e6f6958b2cd727733786 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Improve error messageRainer Keller2018-07-022-3/+5
| | | | | Change-Id: I29b9a35c080c50469ac1a3ff5f83a31349e801ad Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Always use commit sha1 for QML_COMPILE_HASHSamuli Piippo2018-07-021-1/+1
| | | | | | | | | | | | git describe can produce different strings for the same sha1, depending on the version of git (length of short hash) and whether release tag was in place when build was done (v5.11.1-0- vs. v5.11.0-66-). Instead use rev-parse to get the unambiguous commit sha1 which is also what is used from the .tag file. Change-Id: If378f03eb764e2d858bda5b662106aa4402d6559 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* tst_qquicktestinput: Fix for test due to QIntValidator changeTuomas Heimonen2018-07-021-3/+0
| | | | | | | | | | | | As QIntValidator input value which is over the highest acceptable value, but consisting of a number of digits equal to or less than the max value is now considered as intermediate tst_qquicktestinput is now fixed according. Task-number: QTBUG-59650 Task-number: QTBUG-69228 Change-Id: I1fefdba1f2b834fe14a8dee5249734c37588a950 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Add QJSEngine::throwError() method to report run-time errorsRichard Weickelt2018-07-023-0/+105
| | | | | | | | | | | | | | | | It is quite common in JavaScript to use exceptions for error handling, but there was no way to generate an exception from C++ context, i.e. when the JS run-time invoked a C++ method or a slot. This patch adds an naive way to report run-time errors to QJSEngine from CPP context. The user may set a custom error message, but the location points always to the caller context in JavaScript. [ChangeLog][QtQml][QJSEngine] Added API to throw run-time errors. Task-number: QTBUG-39041 Change-Id: If59627b83d50351eb225adde63187fc251aa349e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix running the ES test suiteSimon Hausmann2018-07-023-6/+7
| | | | | | | | | When we have one or more failures, make sure that the auto-test fails. This produces a few additional failures but oddly also "fixes" some tests that are marked as expected failure. Change-Id: I0bbbed463b326336ab9caa33f434520c90ed36de Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* StrictlyEnforceRange should not override valid SnapOne decisionsMichael Brasser2018-06-294-4/+13
| | | | | | | | | | The changes made in 134d980a7fcf61c5440019bcfb3fdfc39c3f5f3c and 2b779fbd25aaf09897ee2cdc4edffd12a980420b were still a bit too broad. Tighten the condition further so original behavior is restored for smaller to medium drags. Change-Id: I9006e9cea80c1ef79e0b8d6a47b2a497532bef57 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix SnapOneItem/Row behavior for mid-range flicksMichael Brasser2018-06-294-26/+45
| | | | | | | | | | Previously small and large flicks would go to the next item, but there was a small range just under halfway where it would snap to the previous position (most easily hit with smaller delegates). Get rid of this blindspot. Change-Id: Ib8d026cad9427b2d209a9646b3ea515f578457ae Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Internal naming cleanupSimon Hausmann2018-06-294-9/+9
| | | | | | | | | Rename QV4::CompiledData::Binding::containsTranslations() to isTranslationBinding() in an attempt to improve the readability of the code. Change-Id: I73898298c4295d0def812c0526d908254d73c243 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Add cat. logging in wantsEventPoint; improve FlickableInterop testShawn Rutledge2018-06-293-35/+23
| | | | | | | It was too hard to debug behavior in this test. Change-Id: Iaec9534cca17bdd90b94cfa8fa8b21b7026839ae Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>