4 years agoFix crash in QQuickLoader when source component is garbage collected
Simon Hausmann [Thu, 5 Dec 2013 15:21:03 +0000 (16:21 +0100)]
Fix crash in QQuickLoader when source component is garbage collected

It may happen that the QQuickLoader is the last entity left in the system
holding a reference to the QQmlComponent *sourceComponent. We have to let the
garbage collector know about that by keeping a persistent value for it.

Task-number: QTBUG-35334
Change-Id: I715864440378fd9dd4f2d5ef8ff2f171c81ed7ef
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoProfile a pixmap start event also when loading is asynchronous.
Ulf Hermann [Tue, 3 Dec 2013 13:45:12 +0000 (14:45 +0100)]
Profile a pixmap start event also when loading is asynchronous.

If those events aren't profiled we get unmatched events for finished
loading and errors.

Task-number: QTBUG-35337

Change-Id: I132638edf5625566e37ee06453484f80b2adb74a
Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
4 years agoFix: QSGGeometry lineWidth in qsgbatchrenderer
Torgeir Lilleskog [Thu, 5 Dec 2013 11:34:40 +0000 (12:34 +0100)]
Fix: QSGGeometry lineWidth in qsgbatchrenderer

lineWidth was ignored in the new scenegraph batchrenderer.
Regression from 5.1.1

Task-number: QTBUG-35346
Change-Id: I80eacc165f70b5f39d4a01cf458ab1a0e49cbd2d
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
4 years agoPropegate filtering state when we extract texture from atlas.
Gunnar Sletta [Thu, 5 Dec 2013 08:15:06 +0000 (09:15 +0100)]
Propegate filtering state when we extract texture from atlas.

Task-number: QTBUG-35395

Change-Id: I5ac08ade7763d14bca855b8300156aee0e6a6920
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoAvoid warnings on cast from char* to QString
Thiago Macieira [Thu, 14 Nov 2013 23:38:12 +0000 (15:38 -0800)]
Avoid warnings on cast from char* to QString

Why isn't QtQml being built with those functions disabled, so they
produce errors?

Change-Id: I2c0cf945523142800982f100a61a6c10e1929632
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
4 years agoOnly emit focusObjectChanged when an actual change occurs.
Michael Brasser [Thu, 5 Dec 2013 17:35:44 +0000 (11:35 -0600)]
Only emit focusObjectChanged when an actual change occurs.

Change-Id: If18b460a8773e5cac597c02c51836b79711c20f4
Done-with: Matthew Vogt <matthew.vogt@jollamobile.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
4 years agoClean up property dependency data structures
Simon Hausmann [Thu, 5 Dec 2013 13:53:58 +0000 (14:53 +0100)]
Clean up property dependency data structures

As a follow-up to the previous commit, this patch cleans up the data structures
used to track dependencies of QML binding expressions and functions to context
and scope properties, determined at compile time.

Instead of "collecting" these depending properties upfront (codegen time), we
propagate the information that a property is a context or scope property into
the IR at codegen time and later in the isel collect these properties and their
notify signal index in a hash in the IR functions. The CompileData structure
generator then can read these hashes directly when writing out the dependency

Change-Id: I32134706e2d24bf63d1b1abad0259ab072460173
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoFix dependency calculation for context and scope properties
Simon Hausmann [Wed, 4 Dec 2013 15:30:54 +0000 (16:30 +0100)]
Fix dependency calculation for context and scope properties

We were incorrectly calculating writing to a context or scope property as a
dependency for an expression. We don't know whether a property is being written
only or also being read from at lookup time, but we can make that decision in
the isel then when generating the move instructions.

So initially context and scope properties end up in a candidate set first
and get promoted to real dependencies when they're being used in reading

Task-number: QTBUG-35210
Change-Id: Ia67057abafc2d611e1e6605327b4965ebe91cbed
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoFix data layout of Managed class
Lars Knoll [Fri, 29 Nov 2013 14:24:16 +0000 (15:24 +0100)]
Fix data layout of Managed class

The internal class should really be the first member. The
flags should go away over time.

Change-Id: Id2373a438e2af63a55704819c9dd5569c3895080
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoFix dynamic properties in QQmlPropertyMap not always being visible in QML
Simon Hausmann [Wed, 4 Dec 2013 13:24:24 +0000 (14:24 +0100)]
Fix dynamic properties in QQmlPropertyMap not always being visible in QML

QQmlPropertyMap is a fully dynamic class that can add properties at any point
in time. In order for these properties to be visible inside QML, we must
disable the property cache (instead of trying to unsuccessfully re-fresh it).

What happened in this particular case is that the QQmlPropertyMap derived type
was instantiated and the VME instruction for creating it would also assign the
property cache the compiler determined. There's no way for QQmlPropertyMap
itself to access this property cache instance (stored in
output->types[id].typePropertyCache) or invalidate it, so instead don't use the
compiler's property cache when instantiating the type.

This patch also disallows the adding properties to QQmlPropertyMap when it
is used as base type for a new QML type, as we cannot provide the derived
type to the QQmlPropertyMap constructor - this is only possible in C++.

Task-number: QTBUG-35233
Change-Id: I7fa9e4a2224ccfdd7ccb3fd9f73919ecd46058a8
Reviewed-by: Alberto Mardegan <mardy@users.sourceforge.net>
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoFix Flickable StopAtBounds drag over, back, over behavior.
Martin Jones [Wed, 27 Nov 2013 06:13:29 +0000 (16:13 +1000)]
Fix Flickable StopAtBounds drag over, back, over behavior.

A Flickable with StopAtBounds failed when:
1. position on a boundary.
Without lifting your finger:
2. attempt to drag beyond the boundary -> doesn't drag
3. drag back to initiate dragging
4. attempt to quickly drag beyond the boundary.

After 4, the view should be back on the boundary, but it could get
stuck a little short of the boundary.

Change-Id: I9bfbb4293f4d464bddb97c5c37e9bb91ed7d48e4
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
4 years agoV4 IR: reverse propagate int32 truncation.
Erik Verbruggen [Fri, 18 Oct 2013 15:02:57 +0000 (17:02 +0200)]
V4 IR: reverse propagate int32 truncation.

Change-Id: I5cb0c7798d0e530f3137710bf0e723bd7b64dc89
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoQQmlMemoryProfiler: Fix dangling pointer use.
Robin Burchell [Tue, 3 Dec 2013 21:16:27 +0000 (22:16 +0100)]
QQmlMemoryProfiler: Fix dangling pointer use.

toUtf8 returns a temporary, accessing constData isn't safe

Change-Id: I3c4d077f24cee0eaf1df230c4d8079619967b51a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoRemove unused member
Lars Knoll [Fri, 29 Nov 2013 07:42:07 +0000 (08:42 +0100)]
Remove unused member

Change-Id: I9926f1ab10ea04387f17794944dcc11f4a2a9054
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoFix some header guards
Lars Knoll [Fri, 29 Nov 2013 07:40:53 +0000 (08:40 +0100)]
Fix some header guards

Change-Id: Ib696c79754cc238e3f4fa356c461a07d9f06d6e7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoEncapsulate the current context and fix it's usage
Lars Knoll [Thu, 21 Nov 2013 15:41:32 +0000 (16:41 +0100)]
Encapsulate the current context and fix it's usage

Encapsulate accesses to the current context, and rework
the way we push and pop this context from the context

Largely a cleanup, but simplifies the code in the long term

Change-Id: I409e378490d0ab027be6a4c01a4031b2ea35c51d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoRemove setVTable calls in performance critical areas
Lars Knoll [Thu, 21 Nov 2013 13:26:08 +0000 (14:26 +0100)]
Remove setVTable calls in performance critical areas

Remove all the calls to setVTable that were in performance
critical parts of the code. This now brings performance
back to the level we had with the vtable inlined in the
Managed objects.

Change-Id: I76317cc5c53b5b700d1d3883b954407142a4c424
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoMove the vtable pointer from the object to the internal class
Lars Knoll [Thu, 21 Nov 2013 12:15:46 +0000 (13:15 +0100)]
Move the vtable pointer from the object to the internal class

This saves one pointer per object, and willmake other optimizations
easier in the future.

Change-Id: I1324cad31998896b5dc76af3c8a7ee9d86283bfe
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoFix a bug in the code for eval
Lars Knoll [Fri, 22 Nov 2013 07:32:37 +0000 (08:32 +0100)]
Fix a bug in the code for eval

When eval was being used as an indirect call, the code
didn't reset the current context properly before
returning from the eval call.

Change-Id: Id5c7e9a897101d25593ef0f3b9945adaf19360b3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoAdd a static toArrayIndex() method to QV4::String
Lars Knoll [Thu, 21 Nov 2013 13:25:49 +0000 (14:25 +0100)]
Add a static toArrayIndex() method to QV4::String

This avoids a hack in QV4::Codegen where we created a V4::String
on the stack to convert to an array index.

Change-Id: I9a88d45817bbcde52a4037a52fbae299b8c9cb1a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoFixup the implementation mess for QJSValue(QString)
Lars Knoll [Tue, 26 Nov 2013 09:46:44 +0000 (10:46 +0100)]
Fixup the implementation mess for QJSValue(QString)

Until now we were using a QV4::String without engine to
represent this case. But this leads to lots of quirks, where
we ended up trying to access the engine (or the internalclass/vtable)
of this string anyway.

Now just represent it by using an QString in QJSValuePrivate, and use
an empty value to represent it. This adds a little bit of code to
QJSValue and QJSEngine, but is more stable and maintainable in the
longer term.

Change-Id: I3358165ee64e788274225743a95dfb13346225cc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoOptimize ExecutionContext::setProperty
Lars Knoll [Fri, 15 Nov 2013 21:40:07 +0000 (22:40 +0100)]
Optimize ExecutionContext::setProperty

No need to call hasProperty followed by put. Instead get the
property descriptor and call putValue for it.

Improves v8-bench by 5%.

Change-Id: Ied047126c651c033f7ad4c27deaeec08e5fee7f9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoUse an internalClass to represent formals and locals in CallContexts
Lars Knoll [Fri, 15 Nov 2013 15:36:13 +0000 (16:36 +0100)]
Use an internalClass to represent formals and locals in CallContexts

formals and locals in a CallContext where so far accessed through a
linear search in ExecutionContext::getProperty. Fix this by
introducing an internalClass for the Function used by the call

Change-Id: I1141efa12b19d6de4a354bfd6e769c5ffcb8898b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoRemove unused inline wrapper
Lars Knoll [Fri, 15 Nov 2013 13:22:35 +0000 (14:22 +0100)]
Remove unused inline wrapper

The wrapper method for Function::code() was still there
from the times we used C++ exceptions. It's not needed
any more, so get rid of it.

Change-Id: I2ec25fbca71eeef9d7a94a38b5adfa42e4de3a84
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoFix url type test
Lars Knoll [Fri, 15 Nov 2013 12:44:47 +0000 (13:44 +0100)]
Fix url type test

it passed before, but wasn't testing two methods it
should be testing.

Change-Id: I5784ecfe1b5a00620832c7b995ed3cf5ed7e27dd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoSpeedup JS instanceof operator
Lars Knoll [Thu, 14 Nov 2013 21:08:00 +0000 (22:08 +0100)]
Speedup JS instanceof operator

Cache the prototype of the functionobject, and inline hasInstance.
This removes a vtbl method and speeds things up quite a bit.

Change-Id: Ic68f301f7e09763d445a98bffa2cd201303f902e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoInitialize variable
Lars Knoll [Fri, 29 Nov 2013 13:26:52 +0000 (14:26 +0100)]
Initialize variable

Change-Id: I37b14a406ebb9cf87fef20426a94725a2441b7cd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoFix qsTr() in .js context
J-P Nurmi [Mon, 2 Dec 2013 16:25:23 +0000 (17:25 +0100)]
Fix qsTr() in .js context

Don't assume a four characters long file name suffix (.qml)

Task-number: QTBUG-32850
Change-Id: I522c06b71bf1b38f32f2947a6c06017f83eb50be
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
4 years agoQQmlImport: Don't try use a dangling pointer.
Robin Burchell [Tue, 3 Dec 2013 20:47:02 +0000 (21:47 +0100)]
QQmlImport: Don't try use a dangling pointer.

toUtf8 would return a temporary, and constData would hold a pointer inside that
temporary. This isn't even remotely safe. Move the pointer use down to the
initializeEngine call so it is kept around long enough for us to do our stuff.

Task-number: QTBUG-35355
Task-number: QTBUG-35343
Change-Id: Ie816d0d1a37e42607f26d9ad02cf999f3d459cd9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoMerge "Merge remote-tracking branch 'origin/release' into stable" into refs/staging...
Frederik Gladhorn [Tue, 3 Dec 2013 17:26:49 +0000 (18:26 +0100)]
Merge "Merge remote-tracking branch 'origin/release' into stable" into refs/staging/stable

4 years agoMerge remote-tracking branch 'origin/release' into stable
Frederik Gladhorn [Tue, 3 Dec 2013 17:15:53 +0000 (18:15 +0100)]
Merge remote-tracking branch 'origin/release' into stable

Change-Id: I894ad7b4888744833f487b481950c087fa960a5c

4 years agoImprove the Canvas threading model
Gunnar Sletta [Wed, 27 Nov 2013 16:04:06 +0000 (17:04 +0100)]
Improve the Canvas threading model

The canvas classes were mixing scene graph resources and GL
content across threads. This led to a number of potential crashes
in addition to that the FBO based rendering had significant
potential for stalling.

QQuickContext2DTexture is no longer a QSGTexture with ambiguous
ownership. Instead we use textureForNextFrame which is called
on the render thread while the GUI is locked to synchronize
state from the Context2D's "texture" into the actual QSGTexture.
This means that cleanup of the QQuickContext2DTexture and
the QSGTexture used for display is no longer in conflict.

QQuickPixmap no longer contains a QSGTexture either as these
are strictly for use on the scene graph thread. The Images are
anyway loaded explicitly as QImage files in QQuickContext2DContext
and uploaded again for every Canvas, so relying on the GL paint
engine to do the caching will give us the same with less code.

I also changed the default strategy to Immediate as that one
supports the full API (cooperative does not support readback)
and because cooperative is pretty bad for performance since the
rendering happens in the sync() step.

Task-number: QTBUG-34268
Task-number: QTBUG-31052
Task-number: QTBUG-21935
Task-number: QTBUG-30689
Task-number: QTBUG-29007

Change-Id: Ic540b22d5faa1188e21e56a3beee24191d13f423
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoDrop the "missing provider" warning from ShaderEffect.
Gunnar Sletta [Mon, 2 Dec 2013 08:13:04 +0000 (09:13 +0100)]
Drop the "missing provider" warning from ShaderEffect.

Task-number: QTBUG-34676
Change-Id: I5f1c2f9ebe6048da5d5c1d1ea5e4799eacea3e8b
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoFix typo in debug define
Gunnar Sletta [Tue, 3 Dec 2013 09:24:29 +0000 (10:24 +0100)]
Fix typo in debug define

Change-Id: I4d024aeb4618228cad3000ddfda32e5c8aba5742
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
4 years agoFix style animations to stop when the item is hidden
J-P Nurmi [Mon, 2 Dec 2013 21:44:21 +0000 (22:44 +0100)]
Fix style animations to stop when the item is hidden

QStyleAnimation automatically stopped for hidden QWidgets, but didn't
know anything about QQuickItems and kept animating regardless of their
visibility. QStyleAnimation was changed so that it will keep animating
only as long as the animation target accepts animation updates. This
change ensures that the style animation updates are accepted only when
the item is visible.

Task-number: QTBUG-35319
Change-Id: I3c93a653316b8abbbc32940cd7499b660828eff8
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
4 years agoFix build in release mode with forced asserts
Konstantin Ritt [Thu, 28 Nov 2013 18:31:04 +0000 (20:31 +0200)]
Fix build in release mode with forced asserts

Change-Id: I0e35533af7f65200a8bc3c4024c29344fa6f4b7a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoV4 IR: remove common toInt32 casts.
Erik Verbruggen [Mon, 2 Dec 2013 15:57:32 +0000 (16:57 +0100)]
V4 IR: remove common toInt32 casts.

a | 0
b & 0xffffffff

These operations force the operands to be converted to int32 without
changing their value. At this point we already added convert calls to
the IR, so we can safely get rid of these operations.

Change-Id: Ic4d3b989e13439eccd2c878fa7bf5030acae7630
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoV4 IR: change the worklist to a QSet for block scheduling.
Erik Verbruggen [Mon, 2 Dec 2013 15:35:17 +0000 (16:35 +0100)]
V4 IR: change the worklist to a QSet for block scheduling.

Fixes a crash in octane.

Change-Id: Ib72ac0b7a2941230a87543f30fcf7e55d7094886
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoV4: remove invalid assert.
Erik Verbruggen [Mon, 2 Dec 2013 15:33:58 +0000 (16:33 +0100)]
V4: remove invalid assert.

Both the base and the index of a subscript can (and are allowed to) be
other things than temporaries.

Change-Id: If073e262712bab488f18eac5ebe097be99c40359
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoSafely abort when we don't succeed in creating a GL context.
Gunnar Sletta [Tue, 12 Nov 2013 15:53:47 +0000 (16:53 +0100)]
Safely abort when we don't succeed in creating a GL context.

Task-number: QTBUG-33363
(cherry-picked from commit 12eab9162781)

Change-Id: Ia2b0c329157786cb4ec703989f12d2fdb1ce6bc8
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoAdd a namespace for a global variable in a public header
Thiago Macieira [Fri, 29 Nov 2013 05:28:38 +0000 (21:28 -0800)]
Add a namespace for a global variable in a public header

The "Qml" prefix should suffice.

This was found by ICC 14.0 in a bogus warning:
qqml.h(470): error #2415: variable "CurrentSingletonTypeRegistrationVersion" of static storage duration was declared but never referenced

Change-Id: I604cd712529b1c4553457c1ea0904182ac4a9e80
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
4 years agoFix change-of-sign warning in the new QML compiler
Thiago Macieira [Fri, 29 Nov 2013 05:38:42 +0000 (21:38 -0800)]
Fix change-of-sign warning in the new QML compiler

The m_line and m_column members are of type quint16, so -1 is not
valid. BTW, aren't 65535 possible lines too few?

qqmlboundsignal.cpp(92): error #68: integer conversion resulted in a change of sign

Change-Id: I2f73c276c5fc9b6988b5fa4274f7fa3f6bb85c4b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoAllow QtQml to compile with ICC 14.0 with -Werror
Thiago Macieira [Fri, 29 Nov 2013 05:35:33 +0000 (21:35 -0800)]
Allow QtQml to compile with ICC 14.0 with -Werror

Third-party source contains a static variable that is only used in
debugging code (an ASSERT).

cached-powers.cc(134): warning #2415: variable "double_conversion::kCachedPowersLength" of static storage duration was declared but never referenced
  static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers);

Change-Id: I97ea9ada8f03d9fd45149fbc4bfdf61877498339
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
4 years agoFix QQuickTextInput not overriding shortcuts (del/home...)
Frederik Gladhorn [Mon, 25 Nov 2013 19:36:26 +0000 (20:36 +0100)]
Fix QQuickTextInput not overriding shortcuts (del/home...)

[ChangeLog][QtQuick] QQuickTextInput would not accept
delete/home/backspace/left/right keys when the key was used in a

Task-number: QTBUG-34517

Change-Id: I553af8247191ecdadcb4677e9fc85848270a95d3
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
4 years agoUpdate changelog for 5.2.0
Alan Alpert [Mon, 25 Nov 2013 20:57:49 +0000 (12:57 -0800)]
Update changelog for 5.2.0

Includes taking entries for 5.1.2, which is no longer a general bugfix

Change-Id: I33b4c06aa83d6344a2f14b4147eaf7056c3bacb9
Reviewed-by: Sergio Ahumada <sahumada@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoDoc: Change the order of QQuickText function definitions
Topi Reinio [Tue, 26 Nov 2013 10:15:05 +0000 (11:15 +0100)]
Doc: Change the order of QQuickText function definitions

For Text QML type, some property and method documentation
is missing from the output because in the source file,
they appear before the '\qmltype Text' command.

This change reorders the functions so that qdoc will see
all documentation for Text QML type.

Task-number: QTBUG-35018
Change-Id: Icd995f66679d5105912ee12a7aeffd510921a54d
Reviewed-by: Martin Smith <martin.smith@digia.com>
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
4 years agoDoc: Update examples used in Writing QML Extensions tutorial
Topi Reinio [Mon, 25 Nov 2013 12:27:42 +0000 (13:27 +0100)]
Doc: Update examples used in Writing QML Extensions tutorial

Update the examples to use Qt's resource file system to
store the qml files in, enabling them to run unmodified
in any platform/build configuration.

    - Chapter 6: Move the plugin code to a subproject
      and create a C++ application to use the plugin
    - Update documentation related to above chapter
    - Add thumbnails for the examples so they will
      appear in Qt Creators example list.

Task-number: QTBUG-35001
Change-Id: I29122af11bb11c7e5e17993438e5fc18c7f96f89
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
4 years agoHandle boundingboxes with NaN in them.
Gunnar Sletta [Thu, 28 Nov 2013 10:44:39 +0000 (11:44 +0100)]
Handle boundingboxes with NaN in them.

NaN does not compare well with other floats. The result is that the
bounding box is left at its initial values, FLT_MAX for top-left and
FLT_MIN for bottom-right. If so, treat geometry as invalid, aka

Task-number: QTBUG-35192
Change-Id: I1df6987d56a0ce1f500b0eba344a5dcbc55f80a4
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agodisable qml import scan for qmljs
Oswald Buddenhagen [Wed, 27 Nov 2013 13:43:06 +0000 (14:43 +0100)]
disable qml import scan for qmljs

there is nothing to scan here.

Task-number: QTBUG-35160
Change-Id: I47223a295eafe67f0f2dd85a12444260f88d0623
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoEnsure that QML Windows respect the default platform window state
Tor Arne Vestbø [Wed, 27 Nov 2013 16:57:25 +0000 (17:57 +0100)]
Ensure that QML Windows respect the default platform window state

The 'visible' property of a Window would be set on the baseclass QWindow
like any other property during QML component creation, which would cause
create() to be called and the platform window would be created.

This left the 'visibility' of the QML window as Windowed, not respecting
the platform defaults for how windows should be shown. The user would
have to explicitly set "visibility: Window.AutomaticVisibility" for
this default to apply, which doesn't make sense -- it should be the

We solve this by deferring setVisible and setVisibility on the window
until the component is complete and we have a full picture of its state.
We then ask the platform for the default state based on the window flags
(ensuring that eg "flags: Qt.Popup" will not result in maximized
windows on iOS and Android), and apply the deferred visibility.

The deferred visibility may still be 'false', but setting the window
state makes sense anyways, so that a later "visible = true" will
apply the default window state.

Deferring platform window creation until the geometry has been
potentially set from user code also has the benefit that the
platform window can check the geometry and apply a default
geometry if it's null. This was not possible when the 'visible'
property was a regular property, as you could not know if the
user's geometry changes would come after platform window creation.

Task-number: QTBUG-35174
Change-Id: Icf3236187992048a85b2196c059f9b54699041a4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
4 years agoSet all attached section properties before emitting change signals.
Martin Jones [Fri, 29 Nov 2013 01:56:49 +0000 (11:56 +1000)]
Set all attached section properties before emitting change signals.

If we have bindings to the section properties, e.g. implementing manual
section header creation, we want previousSection, section and
nextSection to be set before emitting the change signals to prevent
different results each time the binding is run.

Change-Id: Id3a0b4a53419681f35102c9e7c620b5c6112ebb0
Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
4 years agoWhen the MouseArea loses grab, an active drag should be cancelled.
Robin Burchell [Mon, 25 Nov 2013 22:55:22 +0000 (23:55 +0100)]
When the MouseArea loses grab, an active drag should be cancelled.

Change-Id: Icc784dd3265c211d9b077b692464591a41976354
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
4 years agoAdd support pre-compiled bindings for QML custom parsers
Simon Hausmann [Wed, 27 Nov 2013 12:46:58 +0000 (13:46 +0100)]
Add support pre-compiled bindings for QML custom parsers

For example the x property in

    PropertyChanges {
        target: foo
        x: someItem.x - other.width / 2

was compiled at run-time dynamically, which produces slower code (no type
information available) and slows down the type instantiation, because the
compilation happens every time at instantiation time (or later).

With this change, when the custom parser behind PropertyChanges requests a
binding ID for "x", the right hand side will be added to the bindings to
compile, then compiled and later at run-time the QQmlBinding constructor that
takes a QQmlBinding::Identifier can retrieve the correct compiled function from
the QV4::CompiledData::CompilationUnit.

Change-Id: I857fb2d39e82714b225bc9394b9904b795c6662b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoAdapt tests to new events from qqmlprofilerservice
Ulf Hermann [Fri, 29 Nov 2013 09:15:41 +0000 (10:15 +0100)]
Adapt tests to new events from qqmlprofilerservice

Change-Id: I59baa1f9aa0751d4bffc6eff0332318efc6fe9a8
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoSome documentation for the VME profiler
Ulf Hermann [Thu, 28 Nov 2013 11:48:23 +0000 (12:48 +0100)]
Some documentation for the VME profiler

Change-Id: Ifa36166e803e81484c6a96c732b72f0ee2412c28
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoUse the new object creation profiler in qqmlvme
Ulf Hermann [Wed, 27 Nov 2013 16:21:27 +0000 (17:21 +0100)]
Use the new object creation profiler in qqmlvme

There are 3 ways to create objects: "Simple", "Cpp" and "Qml". This
patch starts a new profiler whenever a new object is created.
It's assumed that everything the interpreter main loop does between
two creation instructions is related to the object just created.
The componentComplete calls are profiled by restoring saved states
of the profilers used during the creation of the respective objects.

Task-number: QTCREATORBUG-10631

Change-Id: I2645eab7ba32dfb8749cb51ec888d0f0e8fef188
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoAdd a stack-based object creation profiler
Ulf Hermann [Wed, 27 Nov 2013 11:58:13 +0000 (12:58 +0100)]
Add a stack-based object creation profiler

The simple instantiate-in-context way of profiling object
creation doesn't work anymore because the VME's contexts don't
necessarily map to C++ contexts anymore. The new profiler
introduces two stacks of contexts, one for currently running
ranges (such as components) and one for ranges that will be
revived later to profile componentComplete() and similar things.

Task-number: QTCREATORBUG-10631

Change-Id: Idf19b2adf062bc9c185b3bb5ff5229381f577645
Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoRemove old qml object creation profiling
Ulf Hermann [Tue, 26 Nov 2013 14:54:43 +0000 (15:54 +0100)]
Remove old qml object creation profiling

The old way the object creation profiler works is unsuitable for
detailed profiling as it only tracks top level components.

Task-number: QTCREATORBUG-10631

Change-Id: I502d0e144f2965f5e09af8461b50b56c61de5b4b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoEnable broken IBO fallback for Hisilicon Immersion 16 GPU
Eskil Abrahamsen Blomfeldt [Thu, 28 Nov 2013 14:47:12 +0000 (15:47 +0100)]
Enable broken IBO fallback for Hisilicon Immersion 16 GPU

This GPU is on the Huawei Ascend D1 and exhibits crashes
in glDrawElements() when rendering scenegraph when the workaround
is not turned on.

Change-Id: Ic601d34c01e34faaa091a631cfed74c3601c9c43
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
4 years agoFix accelerated property lookup on id addressed objects
Simon Hausmann [Sun, 17 Nov 2013 17:17:28 +0000 (18:17 +0100)]
Fix accelerated property lookup on id addressed objects

For properties on id referenced objects, we can ignore the lack of the FINAL
keyword on properties, as we want the same "lexical" lookup rules like for
properties on the scope or context objects. In addition we need to initialize
the resolver on the returned temp, to ensure a successful type determination in
the use of the id object afterwards.

Change-Id: I496c942ade55aa331e6972f06b21c2c86d4b00a4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoFix JavaScript signal connect on alias without other handlers
Simon Hausmann [Thu, 28 Nov 2013 15:57:41 +0000 (16:57 +0100)]
Fix JavaScript signal connect on alias without other handlers

The changed handlers for aliases are connected lazily in the engine.
QQmlPropertyPrivate::flushSignal is responsible for that and called in other
places, for example when installing a onSomeAliasPropertyChanged handler.
However we were missing a call to flushSignal when doing
onSomeAliasPropertyChanged.connect(...), i.e. using the JavaScript connect API.

Task-number: QTBUG-30493
Change-Id: Ia3f008626fd7af3f2cfbdd30d13fb83158bed4d5
Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoFix warnings: initialize Instruction variables created on the stack
Thiago Macieira [Wed, 27 Nov 2013 07:05:57 +0000 (23:05 -0800)]
Fix warnings: initialize Instruction variables created on the stack

GCC 4.7-4.9 are right that the "code" member is used uninitialized. In
fact, GCC 4.9 was quite assertive about it:

qqmlinstruction_p.h:538:102: error: ‘def.QQmlInstructionData<8>::<anonymous>.QQmlInstruction::instr_common::code’ is used uninitialized in this function [-Werror=uninitialized]
         static void setData(QQmlInstruction &instr, const DataType &v) { memcpy(&instr.FMT, &v, Size); } \

(It says "is used uninitialized" for this particular case; the "may be
used uninitialized" appears in other places)

The analysis is as follows:
 - variable declared on qqmlcompiler.cpp:1467:
     Instruction::SetDefault def;
 - type is POD, so no initialization is performed (def contains garbage)
 - on qqmlcompiler.cpp:1468 we use the variable:
 - QQmlCompiledData::addInstruction is inlined and does:
        QQmlInstructionMeta<Instr>::setData(genericInstr, data);
 - which is the call above, doing a memcpy with a source (&v) equal to
   the uninitialized "def" variable
 - result: memcpy is copying uninitialized bytes

Valgrind doesn't report this because it doesn't care about copying
uninitialized data. It will only complain if a decision is made based
on it, which we don't since the first thing we do after the memcpy is
initialize the member.

The solution is simple to not copy the common part of the
instructions. This way, we save 8 bytes of unnecessary copying and we
still keep the warning if a member of an extended instruction isn't

Change-Id: I940b40ea9aa61c7386e5cced4a7865be7bfddb5d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoSet sampler precision in shifted distance field text shader
Eskil Abrahamsen Blomfeldt [Tue, 26 Nov 2013 11:23:03 +0000 (12:23 +0100)]
Set sampler precision in shifted distance field text shader

The precision would default to lowp and we would attempt to
call smoothstep(mediump, mediump, lowp) which was a
non-existent overload on some drivers, thus causing a compiler
failure. We can use mediump for the sampler, like in the
regular distance field shader.

Task-number: QTBUG-35122
Change-Id: Ib50325d48fe7e0d25559da97e7f53e5170f705a1
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
4 years agoSlightly accelerate access to value type properties
Simon Hausmann [Sun, 17 Nov 2013 17:07:06 +0000 (18:07 +0100)]
Slightly accelerate access to value type properties

We can't do a fast property index based access on them, due to the inability to
read individual fields from the original object (i.e.  the logic in
QQmlValueTypeWrapper). However what we can determine and propagate is the type
information of the individual properties, i.e. that the x and y properties of a
QPointF are always doubles.

Change-Id: Iee71ece2117294b7bc0b93deb0a77d7c51148b11
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoAdd a QML debug config option QML_LOOKUP_HINTS to find non-final properties
Simon Hausmann [Sun, 17 Nov 2013 04:10:23 +0000 (05:10 +0100)]
Add a QML debug config option QML_LOOKUP_HINTS to find non-final properties

This helps to optimize property access, especially for attached properties.

Change-Id: Id47a9c5f184f84ce5ab813d3b01d1a6c6031233e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoAdd support for accelerated property access to QML types and namespace support
Simon Hausmann [Thu, 14 Nov 2013 23:06:18 +0000 (00:06 +0100)]
Add support for accelerated property access to QML types and namespace support

* Resolve lookups in namespaces at compile time and instruct the SSA optimizer
  to eliminate reads from the namespace (QQmlTypeWrapper) if possible. For example
  access to attached properties of types (i.e. MyNameSpace.ListView.isCurrentItem)
  requires neither reading the namespace nor the type.
* Add support for accelerated lookup of attached properties

Change-Id: Ib0b66404ed7e70e1d4a46a1ac8218743a4cc8608
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agotests: update tst_qquicktextinput
Liang Qi [Thu, 21 Nov 2013 10:06:24 +0000 (11:06 +0100)]
tests: update tst_qquicktextinput

* add signal_accepted() with validator
* update signal_editingfinished() with validator
* cleanup many qWait() and etc

Change-Id: Ic0a8f1cdc4f1f811501c06513efff9b6217fc749
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
4 years agoRevert 99480d5420c0beea6771be582c039b550a4461f5
Gunnar Sletta [Wed, 27 Nov 2013 10:19:09 +0000 (11:19 +0100)]
Revert 99480d5420c0beea6771be582c039b550a4461f5

The Mac OS X platform plugin has been fixed so that this
hack is no longer needed. Not to mention that it breaks on XCB.

We keep the warning about bad exposes from the plugin in debug
mode. These are still useful for tracking down future bugs.

Task-number: QTBUG-35143
Change-Id: I5125f7ae2b7fd77c55e9a29b10aa5434598a9ea9
Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
4 years agoTextInput: call fixup() when appropriate
J-P Nurmi [Tue, 26 Nov 2013 15:56:00 +0000 (16:56 +0100)]
TextInput: call fixup() when appropriate

[ChangeLog][QtQuick] Fixed TextInput to call fixup() on its validator
when being accepted or losing focus, and the validator reports that the
input is in "intermediate" state ie. the input should be fixed up.

Task-number: QTBUG-35128
Change-Id: I4b15406c584a9647bcf892badfaf6d845868fbf1
Reviewed-by: Liang Qi <liang.qi@digia.com>
4 years agoDelay renderWindow with a timer
Robin Burchell [Tue, 26 Nov 2013 13:59:19 +0000 (14:59 +0100)]
Delay renderWindow with a timer

Add an exhaust delay to QSGGuiThreadRenderLoop. Some updates
may be done with posted events, and maybeUpdate event competed
with those, leading to partial updates and frames drawn twice.

Change-Id: I532bff692c597eeba5bbd6def89ae68c80fdd69b
Done-with: Mikko Harju <mikko.harju@jollamobile.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
4 years agoProspective fix for crashes when sorting JS arrays on Windows
Simon Hausmann [Tue, 26 Nov 2013 11:22:36 +0000 (12:22 +0100)]
Prospective fix for crashes when sorting JS arrays on Windows

std::sort doesn't seem to like sorting empty arrays, so check the
size before sorting.

Task-number: QTBUG-33658

Change-Id: I841259939ea3bf850d23c129744c322ed46a95fe
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
4 years agoFix build with QT_NO_ACCESSIBILITY
Thomas McGuire [Tue, 26 Nov 2013 08:48:42 +0000 (09:48 +0100)]

"q" was an unused variable, which triggered a warning/error.

Change-Id: I83bdc63a7caa12a5cd48331729492c0f36ed6fa0
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
4 years agoMerge "Merge branch 'release' of ssh://codereview.qt-project.org/qt/qtdeclarative...
Lars Knoll [Tue, 26 Nov 2013 09:04:58 +0000 (10:04 +0100)]
Merge "Merge branch 'release' of ssh://codereview.qt-project.org/qt/qtdeclarative into stable" into refs/staging/stable

4 years agoMerge branch 'release' of ssh://codereview.qt-project.org/qt/qtdeclarative into stable
Simon Hausmann [Tue, 26 Nov 2013 09:01:56 +0000 (10:01 +0100)]
Merge branch 'release' of ssh://codereview.qt-project.org/qt/qtdeclarative into stable

Change-Id: I0bf06be69927d5961f1bdb4948c3572ef6111923

4 years agoFix MSVC-64-warnings about truncation of integers.
Friedemann Kleint [Mon, 25 Nov 2013 13:08:19 +0000 (15:08 +0200)]
Fix MSVC-64-warnings about truncation of integers.

Change-Id: Ib92ce4b7e42061bb1892957f04cbfc1fcfe43615
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
4 years agoFix MSVC-64-warning about shift word size.
Friedemann Kleint [Mon, 25 Nov 2013 13:01:12 +0000 (15:01 +0200)]
Fix MSVC-64-warning about shift word size.

jsruntime\qv4mm.cpp(301) : warning C4334: '<<' : result of 32-bit shift
implicitly converted to 64 bits (was 64-bit shift intended?).

Change-Id: I6a4ca024d43776e16a323fdb8c35a339b74e6c09
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
4 years agoAlso update viewport size when header/footer size changes
Robin Burchell [Mon, 25 Nov 2013 22:54:47 +0000 (23:54 +0100)]
Also update viewport size when header/footer size changes

Task-number: QTBUG-24292
Change-Id: I8e7f5abe077b6e8d2ce6625dcf43a34a7260934e
Done-with: Martin Jones <martin.jones@jollamobile.com>
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
4 years agoQSmoothedAnimation: Don't set property if animation isn't running
Robin Burchell [Wed, 20 Nov 2013 21:36:30 +0000 (22:36 +0100)]
QSmoothedAnimation: Don't set property if animation isn't running

This could cause things to get "stuck" in the wrong state under some rather hard
to reproduce conditions.

Change-Id: Ied23d2bdfcfd0b197f4b28fed9c82ffd64e52ebf
Done-with: Aaron Kennedy <aaron.kennedy@jollamobile.com>
Done-with: Alan Alpert <416365416c@gmail.com>
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
4 years agoInitial support for accelerated property access to QML singletons and enums
Simon Hausmann [Sat, 2 Nov 2013 21:46:25 +0000 (22:46 +0100)]
Initial support for accelerated property access to QML singletons and enums

With this patch we determine the meta-object of singletons, propagate it into
the IR and load them separately using a dedicated run-time function. In
addition enums in singletons and QML types are resolved at compile time.

Change-Id: I01ce1288391b476d1c9af669cb2987a44c885703
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoIR Cleanup, resolve ID objects through array subscripts
Simon Hausmann [Sat, 2 Nov 2013 17:48:18 +0000 (18:48 +0100)]
IR Cleanup, resolve ID objects through array subscripts

...instead of a special MEMBER type. This allows removing the
type member from V4IR::Member altogether (and thus unshadow from
V4IR::Expr::type). By not requiring the base of a id lookup
member expression to be a NAME, we can also speed up repeated
id lookups by fetching the id object array wrapper only once
per function.

Change-Id: I3e9b8f498d32ace4a0cc2254f49e02ecc124f79c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoCleanup, get rid of MemberOfQObject V4IR::Member specialization
Simon Hausmann [Sat, 2 Nov 2013 16:40:35 +0000 (17:40 +0100)]
Cleanup, get rid of MemberOfQObject V4IR::Member specialization

It is technically redundant to the Member::property field.

Change-Id: If0ee35b2c94a2c9373784d36a1f8dfe8ad7dcfb3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoSpeed up repeated context, scope and import script lookups
Simon Hausmann [Tue, 29 Oct 2013 12:02:48 +0000 (13:02 +0100)]
Speed up repeated context, scope and import script lookups

Instead of querying for the context, scope or imported scripts object on each
access, do it once at the beginning of the expression in the IR and re-use the
temp. The optimizer will optimize away unused temps.

Change-Id: I703e737469030c4454d23c567873012a2b537d71
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoImprove type interference for QObject properties
Simon Hausmann [Wed, 30 Oct 2013 15:49:32 +0000 (16:49 +0100)]
Improve type interference for QObject properties

Propagate QObject properties in member expressions across temporaries
as part of the type interference SSA pass. This replaces the earlier
attempt to resolving QObject properties in fieldMemberExpression()
in the codegen, but it was incomplete and now things like the following
are fully resolved:

    var tmp = blah.somePropertyThatReturnsAQQuickItem; <-- QQuickItem property return type propagated into tmp
    var width = tmp.width; <-- and picked up here again to resolve the index of width instead of by name

With this patch Temp gets a helper structure with a function pointer,
initialized to aid the resolution of properties in Qt meta objects. This
structure is propagated into the temps until it reaches the next member
expression that uses the temp. Similarly QObjectType is added as IR type, next
to VarType.

The resolution inside the SSA type interference pass also requires passing
through the QQmlEngine from the upper caller levels, in order to resolve the
property type to a potential QMetaObject property.

Change-Id: I14c98fa455db57603da46613ce49c174d0944291
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoFix crash on QQmlEngine destruction.
Robin Burchell [Mon, 25 Nov 2013 15:15:58 +0000 (16:15 +0100)]
Fix crash on QQmlEngine destruction.

QQmlTypeLoader references QQmlImportDatabase in a thread, so change the
declaration order so QQmlTypeLoader is destroyed and its thread stopped
before QQmlImportDatabase is destroyed.

Change-Id: If1f8ef0a5ce56103a417ecfb6897d2c3b9c8d364
Done-with: Andrew den Exter <andrew.den.exter@jollamobile.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoFix out of bounds array access when index is integer and negative v5.2.0-rc1
Simon Hausmann [Mon, 25 Nov 2013 08:21:27 +0000 (09:21 +0100)]
Fix out of bounds array access when index is integer and negative

When the index is a double, the branchTruncateDoubleToUInt takes care of
branching when the index is negative, but when it's an integer we need
to perform that check ourselves.

Without the patch it's rather easy to cause the application to crash.

Change-Id: If908923ddc2077b3fb3dd42350f038ff0072e8e1
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoUse QFontDatabase to check if a font is scalable.
Yoann Lopes [Fri, 22 Nov 2013 17:52:22 +0000 (18:52 +0100)]
Use QFontDatabase to check if a font is scalable.

The flag set in QFontEngine was not always correctly set, use
QFontDatabase instead which is slower but should always be correct.
We fallback to native font rendering when the font is not scalable.

Change-Id: Ie9a2397abd42890d0fb05bc2f9c46a60040296f2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
4 years agoStop render thread regardless when the window is being destroyed
Gunnar Sletta [Mon, 25 Nov 2013 10:40:12 +0000 (11:40 +0100)]
Stop render thread regardless when the window is being destroyed

When a window is shown and quickly hidden again we can get to
a state, on a asynchronous windowing system API, where the
isExposed=true event has been pushed to the event queue but
not yet processed at the time the user calls hide().
As hide() immediately sets isVisible() to false, we end up with
isExposed=true and isVisible=false which prevent the WM_Obscure
event to be sent to render loop which means the render thread
thought the window was still on screen when we reched the
shutdown in WM_TryRelease.

Changed WM_TryRelease handling to disregard window state when
the window is being deleted. This forces SG and GL cleanup
and stops the thread.

Task-number: QTBUG-35055
Change-Id: Ibac5aa27354d6450f30a61450214cb785ab855bf
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoFix rendering of Flipable content.
Gunnar Sletta [Mon, 25 Nov 2013 09:06:36 +0000 (10:06 +0100)]
Fix rendering of Flipable content.

When a batch is merged in the renderer, we use the z component to
stack the item front to back. This works because each item is
guaranteed to have a z-range of 0->1. However, when a projective
matrix is used, we need to compensate for the implicit [x,y,z]/w,
which GL applies to gl_Position after the vertex stage completes,
so that this guarantee still holds.

Task-number: QTBUG-35020
Change-Id: I254a3d4dc9ad22f53717160ec6ad8f3a27b43d1c
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
4 years agoNo assert when the focus changes and a window has no active focus item.
Frederik Gladhorn [Fri, 22 Nov 2013 18:13:20 +0000 (19:13 +0100)]
No assert when the focus changes and a window has no active focus item.

[ChangeLog][QtQuick] Fix crash when showing and hiding a window that has
no active focus item.
QtQuickControls hit the situation where a popup window was shown without
ever having an active focus item. When then closing the popup,
clearFocusInScope would assume it had to always modify the old focus,
but in this case the focus would be on the window itself, so there is
nothing to update.

Task-number: QTBUG-35057

Change-Id: Ifbde4689d39f98b13e6f90573cb22e28bb86f2c4
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Liang Qi <liang.qi@digia.com>
4 years agoFix memory corruption in QML expression compilation
Simon Hausmann [Mon, 25 Nov 2013 14:58:36 +0000 (15:58 +0100)]
Fix memory corruption in QML expression compilation

We store QQmlPropertyData pointers in our IR for Qt meta-object property
resolution at compile time. As it turns out however, it is possible that these
pointers change after retrieval from the QQmlPropertyCache, as the cache may
change later in the compilation process. Therefore we must do what also
QQmlCompiler does by storing a copy of the QQmlPropertyData. For the JS IR we
can do that conveniently through the IR memory pool.

A side-effect of this bug was that QQmlPropertyData pointers were re-used
and so the identity check in the isel later such as


for dependency tracking failed. In the example given in the bug report it was
determined that the window.contentWidth property wouldn't need a property
capture, and therefore the binding was not re-evaluated as window.contentWidth
later in the binding evaluation phase received its correct value.

This patch also fixes the incorrect debug output names assigned to JS binding
expressions, where the index used to look up the name is per compiled object,
not per QML component.

Task-number: QTBUG-35063
Change-Id: I3e5bbfaac11e5c122a2ed15a3e486a93988e1b6e
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoTests: Enable TestHTTPServer to receive data in chunks.
Friedemann Kleint [Wed, 20 Nov 2013 16:28:14 +0000 (17:28 +0100)]
Tests: Enable TestHTTPServer to receive data in chunks.

Fixes tst_qqmlxmlhttprequest on Windows.

Task-number: QTQAINFRA-573

Change-Id: Ie685cfa90904672246c1c5d8d3cec54c63cc76ba
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
4 years agoAllow for QtQml and QtDeclarative to co-exist at run-time
Simon Hausmann [Mon, 25 Nov 2013 09:11:10 +0000 (10:11 +0100)]
Allow for QtQml and QtDeclarative to co-exist at run-time

This patch changes QQmlData to share the very first bit with QDeclarativeData,
to indicate if the QObject in question is exposed in the QML1 or QML2 run-time.

Task-number: QTBUG-35006

Change-Id: I3aa1d7c99038792011afd9f481ad30d9b981721f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoDo not crash when resizing invisible (non-tracked) windows.
Gunnar Sletta [Mon, 25 Nov 2013 07:25:21 +0000 (08:25 +0100)]
Do not crash when resizing invisible (non-tracked) windows.

Change-Id: I776c21a0f675d2dbe831325cef2c1c2a103e03e5
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
4 years agoPerformance note about QQuickWindow::setColor vs top-level Rectangle
Gunnar Sletta [Mon, 25 Nov 2013 09:33:20 +0000 (10:33 +0100)]
Performance note about QQuickWindow::setColor vs top-level Rectangle

Change-Id: I58d271b108734958b6e0cd55ff62417d5b649a63
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
4 years agoFix crash when assigning a null QObject or derived property as a ListView model
Andrew den Exter [Thu, 21 Nov 2013 01:15:59 +0000 (11:15 +1000)]
Fix crash when assigning a null QObject or derived property as a ListView model

Fall through to the null case handler in the event of a QVariant of QObject or
derived type with a null value, rather than asserting in the instance handler.

Task-number: QTBUG-34999

Change-Id: I5eeffbe29a263c57e6157d516b138ddc8e2e7a95
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
4 years agoAndroid: Add qmltooling plugins to apk
Daniel Teske [Wed, 20 Nov 2013 15:54:16 +0000 (16:54 +0100)]
Android: Add qmltooling plugins to apk

Task-number: QTCREATORBUG-10560

Change-Id: Ifabe6a74552dbc74b1de3030f8d60efda865f84a
Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
4 years agoBe even more tolerant towards broken platform behavior.
Gunnar Sletta [Thu, 21 Nov 2013 13:13:07 +0000 (14:13 +0100)]
Be even more tolerant towards broken platform behavior.

When the platform (Mac in particular) sends us exposes for windows
which are not renderable, we store it for later and fake expose events
when we get resized.

Task-number: QTCREATORBUG-10814
Change-Id: I909bb5a920550589322afd97ae1834884754cf81
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoQtQuick.Dialogs MessageDialog docs
Shawn Rutledge [Mon, 11 Nov 2013 20:41:47 +0000 (21:41 +0100)]
QtQuick.Dialogs MessageDialog docs

Change-Id: Ic229a26c395be0542409ba3e13739e55b6ffb521
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
4 years agoSafeguard the threaded renderloop against incorrectly exposed windows.
Gunnar Sletta [Wed, 20 Nov 2013 12:27:02 +0000 (13:27 +0100)]
Safeguard the threaded renderloop against incorrectly exposed windows.

On Mac we had a situation where we got expose events for windows which
were either 0x24 in size or completely off the screen. These would
result in makeCurrent failing and lead to crashes later on in the
scene graph. Safeguard against invalid dimensions during initialization
and abort after a call to makeCurrent if any of them fail.

Task-number: QTCREATORBUG-10814
Change-Id: I9063ea4d078eea3914666e4c155d141a1502e2ff
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
4 years agoAvoid symbol clashes when linking QtDeclarative and QtScript statically
Simon Hausmann [Fri, 22 Nov 2013 14:37:08 +0000 (15:37 +0100)]
Avoid symbol clashes when linking QtDeclarative and QtScript statically

Re-define the three symbols we actually implement (as stubs).

Task-number: QTBUG-35041
Change-Id: Ie9511207440fa23645e52643881f5993177a4368
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>