Commit Graph

91 Commits

Author SHA1 Message Date
Gunnar Sletta 0de680c8e8 Fix performance regression caused by SG signals in QQuickItem.
For a testcase with thosands of items, I measured an increase
in shutdown time from 800ms to 7500ms, all spent in disconnect().
This is not acceptible, so we're choosing a different approach.

If items implement a invalidateSceneGraph slot, this function
will be called during shutdown. It should be made a proper virtual
in Qt 6. This approach costs very little.

Change-Id: I5970143cc0a0744955687e17586f0bb00c9afb26
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-09-03 09:16:14 +02:00
Gunnar Sletta b0149afd07 Make Canvas a texture provider.
Change-Id: I8b5c9d8a5ed9ef9079eafb30ef0cb73786204ee6
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-08-26 06:12:51 +02:00
Jani Heikkinen e7ceacda70 Update license headers and add new licenses
- Renamed LICENSE.LGPL to LICENSE.LGPLv21
- Added LICENSE.LGPLv3 & LICENSE.GPLv2
- Removed LICENSE.GPL

Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0
Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
2014-08-25 11:28:46 +02:00
Gunnar Sletta 5b6be6456f Handle scene graph invalidation
Change-Id: Icff592a4ae48444a36406a65c1c04a3a6da77616
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-08-08 06:26:33 +02:00
Sze Howe Koh 5a9b5148a1 Doc: Fix broken \qmlsignal links
Fix the breaks caused by the re-categorizing of \qmlsignal pages

Task-number: QTBUG-35846
Change-Id: I528ae16ec522fc902133e22d8f53c87a7f0d56ad
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2014-03-18 13:17:42 +01:00
Sze Howe Koh 303db2e8a1 Doc: Document signals (not handlers) under \qmlsignal
Append the handler names to the end of the corresponding signal doc.

Task-number: QTBUG-35846
Change-Id: I3d627ba7ed5be94e5c402ab092b4d582536499e8
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2014-03-18 13:17:42 +01:00
J-P Nurmi 4ef1032a4e Canvas: do not emit paint when resized but hidden
It turns out to be a bad idea (as in, breaks the enterprise controls)
to block paint() altogether when hidden. The original bug report
QTBUG-31830 only complained about paint() being emitted upon resize
while _hidden_, so this change solves exactly that. User is still
free to call requestPaint() even when hidden, and Canvas now doesn't
recklessly ignore the request.

Task-number: QTBUG-31830
Change-Id: Icd82188f65406b3ef6ae3b19b5984944576886ff
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-03-16 00:53:31 +01:00
J-P Nurmi 4693102d94 Canvas: do not emit paint signal when invisible
Task-number: QTBUG-31830
Change-Id: I23c6fc822547120f14c2d9a09f01a8f985745e2a
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
2014-02-28 00:02:44 +01:00
Lars Knoll e37a9eb4a4 Rename some files
Rename qv4value_def_p.h -> qv4value_p.h and qv4value_p.h to
qv4value_inl_p.h.
It makes more sense to have the class definition in the file
that is named after the class and move the inline methods into
a _inl file. Doing this now, as I expect we'll be needing a few
more _inl files soon.

Change-Id: Ib59e9380e9e976254c6b4369574157f39b1b5f51
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-01-31 11:13:48 +01:00
Frederik Gladhorn 24e2b39e7a Merge remote-tracking branch 'origin/stable' into dev
Change-Id: If9a205bea219b9aca95d78b1e556ca9bbff58dd0
2014-01-06 16:12:41 +01:00
Sze Howe Koh ef9f85ad8d Doc: Fix broken links
Change-Id: I4c4577edde96978a986606bf30fbb925f871bd42
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2013-12-30 12:13:29 +01:00
Frederik Gladhorn 13e88fe2b9 Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
	src/quick/items/qquickitem.cpp
	src/quick/items/qquicktext.cpp
	tests/auto/quick/qquicklistview/tst_qquicklistview.cpp

Change-Id: I0bc5786098193c2c40b6fd8905de75d90f6ed0cf
2013-12-16 17:05:21 +01:00
Michael Brasser 3a9b011270 Support toggling antialiasing for Text and Rectangle.
Task-number: QTBUG-27968
Task-number: QTBUG-34366
Change-Id: Ic446ff4470abf21696e1764f902bd71e79762697
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
2013-12-03 22:10:50 +01:00
Gunnar Sletta 9ad9615d00 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>
2013-12-03 18:06:36 +01:00
Gunnar Sletta 906d5c5c40 Use one render loop per QQuickWindow
See the task for the full reasoning behind this patch.

The threaded renderloop has been refactored to have one window per
thread. This is mostly a simplification of the current code path where
for loops over multiple windows are turned into if (window).

The QSGContext has been split into two classes, QSGRenderContext
for which there is one per OpenGLContext.

The rest of the patch is name changes and a couple of cleanups
in the hopes of simplifying this change.

Task-number: QTBUG-33993

Change-Id: I31c81f9694d7da7474a72333169be38de62613c4
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2013-10-30 08:29:49 +01:00
Martin Smith 4706b1ceff qdoc: no longer recognizes the version nr in QML refs
All QML references of the form
<QML-module-name><QML-module-version>::<QML-type>::<member-name> have
had the <QML-module-version> removed i.

Task-number: QTBUG-33776
Change-Id: Idde279e0f254cd24ea44f9841662dd81a2c5bbc6
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2013-10-02 14:40:01 +02:00
Gunnar Sletta 424052000a Fix license headers of QtQuick sources.
Change-Id: I3750c47640bf21c3567c5fa1c4667e3e2552942e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-09-30 08:06:57 +02:00
Lars Knoll e57c2c8a0a remove more uses of QV4::Value
Change-Id: I11b0b2b7626297e2c98dc77784574da4b59ba8cf
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-30 08:05:48 +02:00
Lars Knoll cf2a253f2f Move Value::fromBool, ... to a new Primitive class
This will simplify finding the remaining direct usages of
QV4::Value that need fixing.

Change-Id: I223099727436d5748027c84c53d9dfc4028e38ed
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-28 13:33:24 +02:00
Lars Knoll 0f204625dc Fix QQmlV4Function API to be GC safe
Change-Id: Id4f79c22fc48ada1c8a9a858e1b7b3d1cf14d120
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-26 09:05:22 +02:00
Lars Knoll a57085f00b Fix API of QQmlV4Handle
Change-Id: Iac4a3fefebd33a5990408598486231a5add8e639
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-26 09:05:19 +02:00
Lars Knoll 12fd2ccd3f Fix Persistent/WeakValue API
Don't use unprotected Values in the API anymore.

Change-Id: I8851628227fca374de24701bc8ee0908b5ae3923
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-26 09:05:16 +02:00
Jerome Pasion 0e62896fdc Doc: Fixed and updated Qt Quick's \qmlmodule page
-incremented version to Qt Quick 2.2 (in \qmlmodule page)
-import changed to QtQuick 2.2
-\inqmlmodule no longer needs the version. QDoc will ignore the version
but it is better to remove it now to avoid confusion

Task-number: QTBUG-32172
Change-Id: I40b52e59667014720be40a35b3a8fb9836825e31
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
2013-09-25 13:51:51 +02:00
Jerome Pasion 779182eb4a Doc: Made Qt Quick items' \since consistent.
Qt 5.2:
-"\since QtQuick 2.2" -> "\since 5.2"

Qt 5.1:
-"\since QtQuick 2.1" -> "\since 5.1"
-"\since Qt 5.1" -> "\since 5.1"

Qt 5.0:
-"\since QtQuick 2.0" -> "\since 5.0"

Task-number: QTBUG-32172
Change-Id: I699b00b31373a434ddb8f4caccfef40c588bf8a4
Reviewed-by: Martin Smith <martin.smith@digia.com>
2013-09-25 13:51:06 +02:00
Lars Knoll a2d115fbaf Convert most remaining return values from Value to ReturnedValue
Change-Id: If8b0c3b91be50678693868c10fefc3678008834d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-18 13:13:55 +02:00
Lars Knoll d6837e9ca3 Rename QV4::ValueScope to QV4::Scope
The class is going to be used all over the place, so let's
give it a short name :)

Change-Id: If61543cb2c885e7fbb95c8fc4d0e870097c352ed
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-18 13:13:23 +02:00
Lars Knoll 002e6105f6 Require a ValueScope for ScopedCallData as well
This brings things more in line with ScopedValue, and
also simplifies cleanup of Scoped values.

Change-Id: If5f1466b4e13c629d56c1e7c638937f61ba48f77
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-18 13:13:21 +02:00
Lars Knoll a723c7ae75 Use a ReturnedValue when converting to String or Object
Also rename Value::toQString() to Value::toQStringNoThrow(),
and add a throwing toQString() method for JS use.

Change-Id: I821b33fc61abb7d08839df965fd337685f61a545
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-12 21:52:00 +02:00
Lars Knoll 6e8e5d16e1 Move CallData onto the JS stack
Change-Id: I22e853acfd2da337344b581bb0412c5f9930c510
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-11 13:01:50 +02:00
Lars Knoll 6f472680eb change calling convention for JS function calls
This allows faster pass through of the data if we have
nested calls.

Also make sure we always reserve at least
QV4::Global::ReservedArgumentCount Values on the
stack to avoid stack corruption.

Change-Id: I42976460f1ef11a333d4adda70fba8daac66acf3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-09-02 17:27:36 +02:00
Frederik Gladhorn d2628d9d70 Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
	tests/auto/quick/qquickgridview/qquickgridview.pro
	tests/auto/quick/qquickitem/qquickitem.pro

Change-Id: Ic54cafbdda1ac22757d2ee65dcc63a1b167c7556
2013-08-19 09:47:35 +02:00
Mitch Curtis 97daddee7a Don't repaint the Canvas if it's just changing position.
Task-number: QTBUG-33005

Change-Id: I94613c0a0e066798800e068aee7c6288fce54dbd
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
2013-08-16 12:02:46 +02:00
Simon Hausmann 3a6f5735ee Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into wip/v4
Conflicts:
	src/quick/items/context2d/qquickcontext2d.cpp
	tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro

Change-Id: I36a4fd28b3156839aecd70039a3ba566bf19a0bc
2013-07-22 13:43:43 +02:00
Marco Bubke ffe861a078 Request paint if scene changes for the canvas item
Otherwise for every scene the canvas is simply not painted anymore in the
designer. For example if you change the parent.

Change-Id: I4883eab44d73a59381230755f7caa596f2b6569f
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
2013-06-26 16:53:11 +02:00
Simon Hausmann 1a97598556 Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into wip/v4
Conflicts:
	src/imports/qtquick2/plugins.qmltypes
	src/qml/debugger/qv8debugservice.cpp
	src/qml/qml/qml.pri
	src/qml/qml/qqmlcompiler.cpp
	src/qml/qml/qqmlcomponent.cpp
	src/qml/qml/qqmlcontext.cpp
	src/qml/qml/qqmldata_p.h
	src/qml/qml/qqmlengine_p.h
	src/qml/qml/qqmljavascriptexpression.cpp
	src/qml/qml/qqmlxmlhttprequest.cpp
	src/qml/qml/v4/qv4bindings.cpp
	src/qml/qml/v4/qv4irbuilder.cpp
	src/qml/qml/v4/qv4jsonobject_p.h
	src/qml/qml/v8/qqmlbuiltinfunctions.cpp
	src/qml/qml/v8/qv8bindings.cpp
	src/qml/qml/v8/qv8contextwrapper.cpp
	src/qml/qml/v8/qv8listwrapper.cpp
	src/qml/qml/v8/qv8qobjectwrapper.cpp
	src/qml/qml/v8/qv8qobjectwrapper_p.h
	src/qml/qml/v8/qv8sequencewrapper_p_p.h
	src/qml/qml/v8/qv8typewrapper.cpp
	src/qml/qml/v8/qv8valuetypewrapper.cpp
	src/qml/types/qqmldelegatemodel.cpp
	src/quick/items/context2d/qquickcanvasitem.cpp
	src/quick/items/context2d/qquickcontext2d.cpp
	sync.profile
	tests/auto/qml/qjsengine/tst_qjsengine.cpp
	tests/benchmarks/qml/animation/animation.pro
	tools/qmlprofiler/qmlprofiler.pro

Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
2013-06-24 11:48:46 +02:00
Gunnar Sletta 8fa9263cb1 Don't show a negative size canvas.
This is in line with how Rectangle and Image elements
also behave.

Change-Id: I82cd6ecc6d233645bb3fd968f0f81218188a8991
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
2013-06-13 12:44:16 +02:00
Gunnar Sletta e500396d12 Fix resizing canvas with renderStrategy == Cooperative
updatePolish() called prepare() which would use a queued
metaInvoke() to change the size of the texture. However,
there is no guaranteed event processing on the render thread
between polish on the GUI thread and sync on the render
thread, we would very often get to updatePaintNode() before
the queued invoke landed, resulting the drawing being done
to a texture of the wrong size.

Fix this by calling prepare from updatePaintNode when
in CooperativeMode so that the autoconnection becomes
a direct one and we get prepare and flush processed in
the right order.

Change-Id: I0fa4687a94ada4bdaddca19133e686bca0bc745c
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2013-06-13 10:00:56 +02:00
Simon Hausmann f0e32d311a Move QV8QObjectWrapper::newQObject into QV4::QObjectWrapper
...where it is just called wrap(), because it doesn't always create a new
JS wrapper for the QObject.

Change-Id: Ieed0fc97174eb51cd04df0149e715c234a5822bd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-06-05 10:55:08 +02:00
Lars Knoll 70f8279338 Get rid of v8::String::(Ascii)Value
Change-Id: I792a94590efbec852620d101b620b263a90e1d54
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-05-22 06:21:29 +02:00
Sze Howe Koh 3c9dd93a03 Doc: Fix some broken links
Change-Id: I1385a8947107a7c80b32306fc587aff45536a4ec
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2013-05-20 12:28:40 +02:00
Simon Hausmann 434b5cde86 Initial port of JS canvas bindings to use QV4::Object subclass instead of V8 resources
This patch comes with the same prototype injection as during the QML locale
patch. This will allow for incremental porting method by method for this huge
binding.

Change-Id: Ie258f021ac6f926302bb375a8ce7a12fb5e0512a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-05-10 18:33:28 +02:00
Lars Knoll 995d65f3f4 Cleanup v8 dependencies from QQmlV8Function
... and rename it to QQmlV4Function

Change-Id: Iad72347babf62691e26306877d4f229fda127eb7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-05-08 19:57:01 +02:00
Lars Knoll 2b0d3bf812 Remove v8 dependencies from QQmlV4Handle
Change-Id: I87d2183738ec7cfeea846a28f2b9aed79a233f68
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-05-08 19:55:58 +02:00
Lars Knoll b256bba1e8 Remove v8::Persistent usage from qquickcanvas
Change-Id: If714583818f894e8ac839cd35cd475deff00eafb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-05-08 15:33:06 +02:00
Simon Hausmann e021ff7ba2 Replace v8::Null() with QV4::Value::nullValue()
Change-Id: I7901d5282afd71c1fd66bab223b2811f0d14b5f1
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-05-07 12:25:49 +02:00
Lars Knoll e537722604 Remove v8::HandleScope
This class never made sense with v4... :)

Change-Id: Id597d791d1adf52cc821d6d46f57cb24d1acd343
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-05-03 14:40:38 +02:00
Lars Knoll 7b8af027e5 Convert QObject methods inQV8Enginer to v4 based API
Change-Id: I954daac83b36d4cb667ecd7923577af90cfc4f9e

Fixup newQObject

Change-Id: I7b81754165b319a7fd81838313d0d654aad1132e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2013-04-29 13:16:17 +02:00
Gunnar Sletta a32ee86273 Mark the canvas texture dirty when we change it.
Because the texture is the same instance and the rect is the same,
the early-out checks in QSGSimpleTextureNode will abort.

Task-number: QTBUG-30666
Change-Id: I0e6a1fd3d4de33436057e8cdf62dc0e7964b5c21
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
2013-04-26 08:42:28 +02:00
Sze Howe Koh 61b4e90a0f Doc: Qt Quick: Fix module name format (Pt 2/2)
Follow the conventions at
http://qt-project.org/wiki/Spelling_Module_Names_in_Qt_Documentation

Attempt to differentiate between the whole module ("Qt Quick") and the
QML import ("QtQuick") by encoding the latter with monospace font. There
are places in the text where both representations are valid.

Change-Id: If398304757e0a5106542c09099e1814084e54c5c
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2013-04-23 18:29:25 +02:00
Samuel Rødal e865df80a9 Fixed crash in QQuickCanvasItem.
The d->contextInitialized variable is useless as it gets out of sync
with d->context when the latter is set to 0. Simply checking that
d->context is non-null fixes some crashes.

Task-number: QTBUG-30810

Change-Id: I474a807a402396b170ba45ae7546781eea92b481
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
2013-04-23 09:48:14 +02:00