Fix performance regression of parent setting during QML object creation

This showed up in the profiles again: In QML we create a lot of objects
with many children and sending a child event each time is expensive. That's
why the VME didn't do that and hadn't done so in ages. This patch restores
that behavior and aspect of loading performance.

Change-Id: I5078fe330d913dc832b284aaecf031152dc80802
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Document the QSG_VISUALIZE environment variable.

The explanations are taken from 3f8d5d0.

Change-Id: I9901b5f2c42f7bec6573101eb91eb9116089d4e9
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Fix compilation on QNX

Task-number: QTBUG-37979
Change-Id: Ie877317cded5b9eaf95389344712c66192696552
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Fix typo

creatScriptFunction -> createScriptFunction

Change-Id: Icdb9214b1ae067fa2b8693d50cdac0be9fe6d390
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Making the CHUNKSIZE setable via environment variable

With this modification the CHUNKSIZE is setable by QV4_MM_MAX_CHUNK_SIZE
environment variable so the memory usage which is important for embedded
devices can be finetuned.

Change-Id: I3cd75158f2255651edd341873de035c1222e3c92
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Move inline function Bool Runtime::compareEqual() above usage.

Fix MinGW-warnings:

src/qml/jsruntime/qv4runtime_p.h:496:13: warning:
'static QV4::Bool QV4::Runtime::compareEqual(QV4::ValueRef, QV4::ValueRef)' redeclared without dllimport attribute after being referenced with dll linkage

Change-Id: Ieb212ed6aba2a0deeeddd033126ae7e9737bb38e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Give the QML and the debug server thread an objectname.

Now it is easier to identify the threads in e.g. the debugger in
QtCreator.

Change-Id: I032822e869df09cf43dc1d6e01d14610005ce217
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>
PinchArea docs: elaborate on confusing aspects

The pinch property and the pinch signal parameter are confusing,
especially since limits in the property don't apply to the values
in the signal parameter.

Task-number: QTBUG-37917
Change-Id: Id8fac60f505a1c54cc8debd3a29e013ca9d29773
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
Maroon example: use multimedia for audio; mute when inactive

Task-number: QTBUG-37742
Change-Id: If1a6ded9ccdaa4cd6f5e6e405e2d5caa21710d4c
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Make example work when QOffscreenSurface == QWindow

Change-Id: I7435d91b37a46c0bced301c5c9c82fdf499e0587
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Fix compilation of script strings

The right hand side of script string properties can be evaluated in entirely
dynamic scopes, due to QQmlExpressions' public API of allowing construction
from a QQmlScriptString and a variable scope/context. Nevertheless we should
compile these bindings at type compile time, as long as we make sure that the
compiled code doesn't try to do any compile time determined property lookups
and type resolution. This is implemented using a separate compilation pass
that ensures the disableAcceleratedLookups flag is set.

A few minor cleanups come with this patch:

 * Ensure that the property caches array is always symmetric to the list of
   compiled QML objects, as that allows the use of at() instead of value().
 * The code for creating a QML callable function object for a given run-time
   function is now centralized in a static function QmlBindingWrapper, used
   for script strings and bindings from custom parsers.

The provided unit test verifies the successful execution of the same script
string with two different scope objects.

Change-Id: Ica2cea46dd9e47263b4d494d922d3cc9664b08ae
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Fix performance regression for bindings from QtQuick state changes

This is a regression from the compiler change. We can and should try to
use the binding as it was compiled in the loader thread for things like

    PropertyChanges {
        target: foo
        width: someExpresion + to + calculate * width;
    }

It is already ensured that these expressions are compiled without type
optimizations.

Change-Id: Ib855d8a848fcab2524df008727eab436ac98514e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Avoid recompiling of signal handlers defined in QtQuick state changes and Connection objects

We can re-use the expression we've compiled at QML type compilation time, as
long as we "inject" the signal parameters in the dynamic qml lookup chain.

Change-Id: Icc417531c41dea06ff5d033011179af49b03f542
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reduce memory consumption of runtime compiled QML types

Don't store the string of binding scripts in the compiled data. The only
exception to the rule are properties of type QQmlScriptString as well as types
with custom parsers.

Change-Id: I7f53262bf957b442bac4db71d0a2c0bed74a9b54
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
On Mac only editable text input should receive tab focus

It's for all items with "readOnly: false" and has "text" property.

[ChangeLog][QtQuick] Mac: any editable text input will get tab focus
when "Text boxes and lists only" option was selected.

About "Text boxes and lists only", see commit
06332df7438c8d2215b02f1e01ce2ed28a49a320.

Task-number: QTBUG-38004
Change-Id: I73947b71b2fec69a66e122514d440656f4650e99
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Work around warning by GCC 4.8 with -O3 about array out of bounds

qqmldelegatemodel.cpp:1140:53: error: array subscript is above array bounds [-Werror=array-bounds]
             attached->m_currentIndex[i] += deltas[i];
                                                     ^
qqmldelegatemodel.cpp:2009:29: error: array subscript is above array bounds [-Werror=array-bounds]
             m_currentIndex[i] = m_previousIndex[i] = incubationTask->index[i];
                             ^

I can't tell how the count can be higher than MaximumGroupCount. Either
GCC is seeing something I'm not while inlining multiple functions, or
it's just getting lost. If it's the former case, this is change could be
a fix, but it's probably the wrong type of fix. If it's the latter,
we're just throwing the inliner a curve ball and it just stops
complaining.

Change-Id: I7907074005f5327a8592f47d72a4e79f9c6cd5ff
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Fix 'missing header' compilation error (shadow build)

Change the private header path to the canonical one. This fixes
shadow builds for me on Windows.

Change-Id: I7c18ec2d9f0769a51d296deac16c78ae41894c36
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
QtQuick test: Do not complain about Qt specific arguments

Commit 1ca5e82cccae0 caused a regression for Qt arguments like
-qmlsjsdebugger=xxx . These are automatically removed from argv by
QCoreApplication, but since we copied argv before instantiating
QCoreApplication this didn't have any effect.

Fix this by moving Q[Core]Application instantiation again before
the parsing and copying of testlib-specific arguments.

Task-number: QTBUG-37793
Change-Id: Ief41640b6cf3251f700a5d24d2e1141233a3888f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Liang Qi <liang.qi@digia.com>
Use RAII for VME profiler

Now that object creation is done in nested function calls we can
use an RAII-type profiler to trace it. This makes the profiling
much simpler and more robust.

Also, the stack of profiling data in the VME profiler has to match
the stack of completion callbacks in the VME, so the push and pop
operations are synchronized now.

Task-number: QTBUG-37978
Change-Id: I1bc5e0665b88e5b3772e48c8676cdda3fae59e1b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Doc: Fix some code snippet warnings

Seems like \qml \endqml is not able to parse some snippets, so using
\code \endcode instead to fix warnings like:

  Unable to parse QML snippet: "Expected token `{'" at line 1, column 13

Change-Id: Iecf033ff5610405d946390e69c3aa7ec54a21998
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>