aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp2
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp374
-rw-r--r--src/quick/items/items.pri17
-rw-r--r--src/quick/items/items.qrc16
-rw-r--r--src/quick/items/qquickanimatedsprite.cpp55
-rw-r--r--src/quick/items/qquickborderimage.cpp10
-rw-r--r--src/quick/items/qquickflickable.cpp6
-rw-r--r--src/quick/items/qquickgridview.cpp2
-rw-r--r--src/quick/items/qquickimage.cpp16
-rw-r--r--src/quick/items/qquickitem.cpp11
-rw-r--r--src/quick/items/qquickitem_p.h7
-rw-r--r--src/quick/items/qquickitemanimation.cpp2
-rw-r--r--src/quick/items/qquickitemsmodule.cpp11
-rw-r--r--src/quick/items/qquickitemview.cpp2
-rw-r--r--src/quick/items/qquicklistview.cpp5
-rw-r--r--src/quick/items/qquickmousearea.cpp2
-rw-r--r--src/quick/items/qquickpainteditem.cpp2
-rw-r--r--src/quick/items/qquickpathview.cpp4
-rw-r--r--src/quick/items/qquickscreen.cpp51
-rw-r--r--src/quick/items/qquickscreen_p.h3
-rw-r--r--src/quick/items/qquickshadereffect.cpp34
-rw-r--r--src/quick/items/qquickshadereffectnode.cpp22
-rw-r--r--src/quick/items/qquickshadereffectsource.cpp50
-rw-r--r--src/quick/items/qquickshadereffectsource_p.h7
-rw-r--r--src/quick/items/qquicksprite.cpp2
-rw-r--r--src/quick/items/qquickspritesequence.cpp55
-rw-r--r--src/quick/items/qquicktext.cpp32
-rw-r--r--src/quick/items/qquicktextedit.cpp5
-rw-r--r--src/quick/items/qquicktextinput.cpp19
-rw-r--r--src/quick/items/qquicktextinput_p.h1
-rw-r--r--src/quick/items/qquicktextnode.cpp21
-rw-r--r--src/quick/items/qquicktextnode_p.h3
-rw-r--r--src/quick/items/qquicktextnodeengine.cpp4
-rw-r--r--src/quick/items/qquicktranslate.cpp2
-rw-r--r--src/quick/items/qquickwindow.cpp128
-rw-r--r--src/quick/items/qquickwindow.h6
-rw-r--r--src/quick/items/qquickwindow_p.h3
-rw-r--r--src/quick/items/shaders/shadereffect.frag9
-rw-r--r--src/quick/items/shaders/shadereffect.vert12
-rw-r--r--src/quick/items/shaders/shadereffect_core.frag13
-rw-r--r--src/quick/items/shaders/shadereffect_core.vert14
-rw-r--r--src/quick/items/shaders/shadereffectfallback.frag4
-rw-r--r--src/quick/items/shaders/shadereffectfallback.vert8
-rw-r--r--src/quick/items/shaders/shadereffectfallback_core.frag8
-rw-r--r--src/quick/items/shaders/shadereffectfallback_core.vert10
-rw-r--r--src/quick/items/shaders/sprite.frag12
-rw-r--r--src/quick/items/shaders/sprite.vert23
-rw-r--r--src/quick/items/shaders/sprite_core.frag16
-rw-r--r--src/quick/items/shaders/sprite_core.vert24
49 files changed, 664 insertions, 481 deletions
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index d9feb8d8eb..ba3592986c 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -112,7 +112,7 @@ QSGTexture *QQuickCanvasPixmap::texture()
Q_ASSERT(m_pixmap->textureFactory());
m_texture = m_pixmap->textureFactory()->createTexture(m_window);
} else {
- m_texture = QQuickWindowPrivate::get(m_window)->context->createTexture(m_image);
+ m_texture = m_window->createTextureFromImage(m_image, QQuickWindow::TextureCanUseAtlas);
}
}
return m_texture;
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 2fb6cb9f63..2a9e0f2ac2 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -488,45 +488,45 @@ public:
}
QQuickContext2D* context;
- static QV4::ReturnedValue method_get_globalAlpha(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_globalAlpha(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_get_globalCompositeOperation(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_globalCompositeOperation(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_get_fillStyle(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_fillStyle(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_get_fillRule(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_fillRule(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_get_strokeStyle(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_strokeStyle(QV4::SimpleCallContext *ctx);
-
- static QV4::ReturnedValue method_get_lineCap(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_lineCap(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_get_lineJoin(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_lineJoin(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_get_lineWidth(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_lineWidth(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_get_miterLimit(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_miterLimit(QV4::SimpleCallContext *ctx);
-
- static QV4::ReturnedValue method_get_shadowBlur(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_shadowBlur(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_get_shadowColor(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_shadowColor(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_get_shadowOffsetX(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_shadowOffsetX(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_get_shadowOffsetY(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_shadowOffsetY(QV4::SimpleCallContext *ctx);
+ static QV4::ReturnedValue method_get_globalAlpha(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_globalAlpha(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_get_globalCompositeOperation(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_globalCompositeOperation(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_get_fillStyle(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_fillStyle(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_get_fillRule(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_fillRule(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_get_strokeStyle(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_strokeStyle(QV4::CallContext *ctx);
+
+ static QV4::ReturnedValue method_get_lineCap(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_lineCap(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_get_lineJoin(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_lineJoin(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_get_lineWidth(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_lineWidth(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_get_miterLimit(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_miterLimit(QV4::CallContext *ctx);
+
+ static QV4::ReturnedValue method_get_shadowBlur(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_shadowBlur(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_get_shadowColor(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_shadowColor(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_get_shadowOffsetX(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_shadowOffsetX(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_get_shadowOffsetY(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_shadowOffsetY(QV4::CallContext *ctx);
// should these two be on the proto?
- static QV4::ReturnedValue method_get_path(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_path(QV4::SimpleCallContext *ctx);
+ static QV4::ReturnedValue method_get_path(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_path(QV4::CallContext *ctx);
- static QV4::ReturnedValue method_get_font(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_font(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_get_textAlign(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_textAlign(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_get_textBaseline(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_set_textBaseline(QV4::SimpleCallContext *ctx);
+ static QV4::ReturnedValue method_get_font(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_font(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_get_textAlign(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_textAlign(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_get_textBaseline(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_set_textBaseline(QV4::CallContext *ctx);
protected:
static void destroy(Managed *that)
@@ -594,50 +594,50 @@ public:
defineAccessorProperty(QStringLiteral("canvas"), QQuickJSContext2DPrototype::method_get_canvas, 0);
}
- static QV4::ReturnedValue method_get_canvas(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_restore(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_reset(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_save(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_rotate(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_scale(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_translate(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_setTransform(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_transform(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_resetTransform(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_shear(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_createLinearGradient(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_createRadialGradient(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_createConicalGradient(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_createPattern(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_clearRect(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_fillRect(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_strokeRect(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_arc(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_arcTo(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_beginPath(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_bezierCurveTo(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_clip(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_closePath(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_fill(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_lineTo(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_moveTo(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_quadraticCurveTo(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_rect(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_roundedRect(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_ellipse(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_text(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_stroke(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_isPointInPath(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_drawFocusRing(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_setCaretSelectionRect(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_caretBlinkRate(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_fillText(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_strokeText(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_measureText(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_drawImage(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_createImageData(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_getImageData(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_putImageData(QV4::SimpleCallContext *ctx);
+ static QV4::ReturnedValue method_get_canvas(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_restore(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_reset(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_save(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_rotate(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_scale(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_translate(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_setTransform(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_transform(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_resetTransform(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_shear(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_createLinearGradient(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_createRadialGradient(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_createConicalGradient(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_createPattern(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_clearRect(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_fillRect(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_strokeRect(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_arc(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_arcTo(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_beginPath(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_bezierCurveTo(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_clip(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_closePath(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_fill(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_lineTo(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_moveTo(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_quadraticCurveTo(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_rect(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_roundedRect(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_ellipse(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_text(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_stroke(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_isPointInPath(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_drawFocusRing(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_setCaretSelectionRect(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_caretBlinkRate(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_fillText(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_strokeText(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_measureText(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_drawImage(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_createImageData(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_getImageData(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_putImageData(QV4::CallContext *ctx);
};
@@ -659,7 +659,7 @@ public:
bool patternRepeatX:1;
bool patternRepeatY:1;
- static QV4::ReturnedValue gradient_proto_addColorStop(QV4::SimpleCallContext *ctx);
+ static QV4::ReturnedValue gradient_proto_addColorStop(QV4::CallContext *ctx);
protected:
static void destroy(Managed *that)
{
@@ -880,7 +880,7 @@ struct QQuickJSContext2DPixelData : public QV4::Object
static QV4::ReturnedValue getIndexed(QV4::Managed *m, uint index, bool *hasProperty);
static void putIndexed(QV4::Managed *m, uint index, const QV4::ValueRef value);
- static QV4::ReturnedValue proto_get_length(QV4::SimpleCallContext *ctx);
+ static QV4::ReturnedValue proto_get_length(QV4::CallContext *ctx);
QImage image;
};
@@ -904,12 +904,13 @@ struct QQuickJSContext2DImageData : public QV4::Object
defineAccessorProperty(QStringLiteral("data"), method_get_data, 0);
}
- static QV4::ReturnedValue method_get_width(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_get_height(QV4::SimpleCallContext *ctx);
- static QV4::ReturnedValue method_get_data(QV4::SimpleCallContext *ctx);
+ static QV4::ReturnedValue method_get_width(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_get_height(QV4::CallContext *ctx);
+ static QV4::ReturnedValue method_get_data(QV4::CallContext *ctx);
- static void markObjects(Managed *that) {
- static_cast<QQuickJSContext2DImageData *>(that)->pixelData.mark();
+ static void markObjects(Managed *that, QV4::ExecutionEngine *engine) {
+ static_cast<QQuickJSContext2DImageData *>(that)->pixelData.mark(engine);
+ QV4::Object::markObjects(that, engine);
}
@@ -949,7 +950,7 @@ static QV4::ReturnedValue qt_create_image_data(qreal w, qreal h, QV8Engine* engi
This property is read only.
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_get_canvas(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_get_canvas(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -965,7 +966,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_get_canvas(QV4::SimpleCall
\sa save()
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_restore(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_restore(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -980,7 +981,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_restore(QV4::SimpleCallCon
\qmlmethod object QtQuick::Context2D::reset()
Resets the context state and properties to the default values.
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_reset(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_reset(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1022,7 +1023,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_reset(QV4::SimpleCallConte
The current path is NOT part of the drawing state. The path can be reset by
invoking the beginPath() method.
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_save(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_save(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1052,7 +1053,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_save(QV4::SimpleCallContex
where the \a angle of rotation is in radians.
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_rotate(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_rotate(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1081,7 +1082,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_rotate(QV4::SimpleCallCont
\image qml-item-canvas-scale.png
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_scale(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_scale(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1127,7 +1128,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_scale(QV4::SimpleCallConte
\sa transform()
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_setTransform(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_setTransform(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1157,7 +1158,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_setTransform(QV4::SimpleCa
\sa setTransform()
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_transform(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_transform(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1184,7 +1185,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_transform(QV4::SimpleCallC
Translating the origin enables you to draw patterns of different objects on the canvas
without having to measure the coordinates manually for each shape.
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_translate(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_translate(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1205,7 +1206,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_translate(QV4::SimpleCallC
\sa transform(), setTransform(), reset()
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_resetTransform(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_resetTransform(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1224,7 +1225,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_resetTransform(QV4::Simple
Shears the transformation matrix by \a sh in the horizontal direction and
\a sv in the vertical direction.
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_shear(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_shear(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1245,7 +1246,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_shear(QV4::SimpleCallConte
The value must be in the range from \c 0.0 (fully transparent) to \c 1.0 (fully opaque).
The default value is \c 1.0.
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_globalAlpha(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_globalAlpha(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1255,7 +1256,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_globalAlpha(QV4::SimpleCallCont
return QV4::Encode(r->context->state.globalAlpha);
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_globalAlpha(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_globalAlpha(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1300,7 +1301,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_globalAlpha(QV4::SimpleCallCont
extension composition modes are provided as "vendorName-operationName" syntax, for example: QPainter::CompositionMode_Exclusion is provided as
"qt-exclusion".
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_globalCompositeOperation(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_globalCompositeOperation(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1310,7 +1311,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_globalCompositeOperation(QV4::S
return QV4::Encode(ctx->engine->newString(qt_composite_mode_to_string(r->context->state.globalCompositeOperation)));
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_globalCompositeOperation(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_globalCompositeOperation(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1318,7 +1319,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_globalCompositeOperation(QV4::S
CHECK_CONTEXT_SETTER(r)
if (!ctx->callData->argc)
- ctx->throwTypeError();
+ return ctx->throwTypeError();
QString mode = ctx->callData->args[0].toQString();
QPainter::CompositionMode cm = qt_composite_mode_from_string(mode);
@@ -1355,7 +1356,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_globalCompositeOperation(QV4::S
\sa createPattern()
\sa strokeStyle
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_fillStyle(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_fillStyle(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1377,7 +1378,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_fillStyle(QV4::SimpleCallContex
return r->context->m_fillStyle.value();
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_fillStyle(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_fillStyle(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1425,7 +1426,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_fillStyle(QV4::SimpleCallContex
\sa fillStyle
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_fillRule(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_fillRule(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1436,7 +1437,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_fillRule(QV4::SimpleCallContext
return engine->fromVariant(r->context->state.fillRule);
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_fillRule(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_fillRule(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1470,7 +1471,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_fillRule(QV4::SimpleCallContext
\sa createPattern()
\sa fillStyle
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_strokeStyle(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_strokeStyle(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1492,7 +1493,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_strokeStyle(QV4::SimpleCallCont
return r->context->m_strokeStyle.value();
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_strokeStyle(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_strokeStyle(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1547,7 +1548,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_strokeStyle(QV4::SimpleCallCont
\sa strokeStyle
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_createLinearGradient(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_createLinearGradient(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1594,7 +1595,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createLinearGradient(QV4::
\sa strokeStyle
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_createRadialGradient(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_createRadialGradient(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1649,7 +1650,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createRadialGradient(QV4::
\sa strokeStyle
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_createConicalGradient(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_createConicalGradient(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1659,7 +1660,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createConicalGradient(QV4:
QV8Engine *engine = ctx->engine->v8Engine;
- if (ctx->callData->argc == 6) {
+ if (ctx->callData->argc == 3) {
qreal x = ctx->callData->args[0].toNumber();
qreal y = ctx->callData->args[1].toNumber();
qreal angle = DEGREES(ctx->callData->args[2].toNumber());
@@ -1725,7 +1726,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createConicalGradient(QV4:
\sa strokeStyle
\sa fillStyle
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1797,7 +1798,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(QV4::SimpleC
\endlist
Other values are ignored.
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_lineCap(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_lineCap(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1816,7 +1817,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_lineCap(QV4::SimpleCallContext
return QV4::Encode(ctx->engine->newString(QStringLiteral("butt")));
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_lineCap(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_lineCap(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1855,7 +1856,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_lineCap(QV4::SimpleCallContext
\endlist
Other values are ignored.
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_lineJoin(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_lineJoin(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1874,7 +1875,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_lineJoin(QV4::SimpleCallContext
return QV4::Encode(ctx->engine->newString(QStringLiteral("miter")));
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_lineJoin(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_lineJoin(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1882,7 +1883,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_lineJoin(QV4::SimpleCallContext
CHECK_CONTEXT_SETTER(r)
if (!ctx->callData->argc)
- ctx->throwTypeError();
+ return ctx->throwTypeError();
QString lineJoin = ctx->callData->args[0].toQString();
Qt::PenJoinStyle join;
@@ -1906,7 +1907,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_lineJoin(QV4::SimpleCallContext
\qmlproperty real QtQuick::Context2D::lineWidth
Holds the current line width. Values that are not finite values greater than zero are ignored.
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_lineWidth(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_lineWidth(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1916,7 +1917,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_lineWidth(QV4::SimpleCallContex
return QV4::Encode(r->context->state.lineWidth);
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_lineWidth(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_lineWidth(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1937,7 +1938,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_lineWidth(QV4::SimpleCallContex
Holds the current miter limit ratio.
The default miter limit value is 10.0.
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_miterLimit(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_miterLimit(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1947,7 +1948,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_miterLimit(QV4::SimpleCallConte
return QV4::Encode(r->context->state.miterLimit);
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_miterLimit(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_miterLimit(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1968,7 +1969,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_miterLimit(QV4::SimpleCallConte
\qmlproperty real QtQuick::Context2D::shadowBlur
Holds the current level of blur applied to shadows
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_shadowBlur(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_shadowBlur(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1978,7 +1979,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowBlur(QV4::SimpleCallConte
return QV4::Encode(r->context->state.shadowBlur);
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_shadowBlur(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_shadowBlur(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -1998,7 +1999,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowBlur(QV4::SimpleCallConte
\qmlproperty string QtQuick::Context2D::shadowColor
Holds the current shadow color.
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_shadowColor(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_shadowColor(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2008,7 +2009,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowColor(QV4::SimpleCallCont
return QV4::Encode(ctx->engine->newString(r->context->state.shadowColor.name()));
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_shadowColor(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_shadowColor(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2033,7 +2034,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowColor(QV4::SimpleCallCont
\sa shadowOffsetY
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetX(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetX(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2043,7 +2044,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetX(QV4::SimpleCallCo
return QV4::Encode(r->context->state.shadowOffsetX);
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetX(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetX(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2063,7 +2064,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetX(QV4::SimpleCallCo
\sa shadowOffsetX
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetY(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetY(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2073,7 +2074,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetY(QV4::SimpleCallCo
return QV4::Encode(r->context->state.shadowOffsetY);
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetY(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetY(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2088,7 +2089,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetY(QV4::SimpleCallCo
return QV4::Encode::undefined();
}
-QV4::ReturnedValue QQuickJSContext2D::method_get_path(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_path(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2098,7 +2099,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_path(QV4::SimpleCallContext *ct
return r->context->m_v4path.value();
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_path(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_path(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2123,7 +2124,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_path(QV4::SimpleCallContext *ct
\qmlmethod object QtQuick::Context2D::clearRect(real x, real y, real w, real h)
Clears all pixels on the canvas in the given rectangle to transparent black.
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_clearRect(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_clearRect(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2145,7 +2146,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_clearRect(QV4::SimpleCallC
\sa fillStyle
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillRect(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillRect(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2167,7 +2168,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillRect(QV4::SimpleCallCo
\sa lineJoin
\sa miterLimit
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeRect(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeRect(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2201,7 +2202,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeRect(QV4::SimpleCall
\sa arcTo, {http://www.w3.org/TR/2dcontext/#dom-context-2d-arc}{W3C's 2D
Context Standard for arc()}
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_arc(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_arc(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2253,7 +2254,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_arc(QV4::SimpleCallContext
\sa arc, {http://www.w3.org/TR/2dcontext/#dom-context-2d-arcto}{W3C's 2D
Context Standard for arcTo()}
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_arcTo(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_arcTo(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2281,7 +2282,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_arcTo(QV4::SimpleCallConte
Resets the current path to a new path.
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_beginPath(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_beginPath(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2312,7 +2313,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_beginPath(QV4::SimpleCallC
\sa {http://www.w3.org/TR/2dcontext/#dom-context-2d-beziercurveto}{W3C 2d context standard for bezierCurveTo}
\sa {http://www.openrise.com/lab/FlowerPower/}{The beautiful flower demo by using bezierCurveTo}
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_bezierCurveTo(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_bezierCurveTo(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2361,7 +2362,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_bezierCurveTo(QV4::SimpleC
\sa fill()
\sa {http://www.w3.org/TR/2dcontext/#dom-context-2d-clip}{W3C 2d context standard for clip}
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_clip(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_clip(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2379,7 +2380,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_clip(QV4::SimpleCallContex
\sa {http://www.w3.org/TR/2dcontext/#dom-context-2d-closepath}{W3C 2d context standard for closePath}
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_closePath(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_closePath(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2401,7 +2402,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_closePath(QV4::SimpleCallC
\sa fillStyle
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_fill(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_fill(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2416,7 +2417,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_fill(QV4::SimpleCallContex
Draws a line from the current position to the point (x, y).
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_lineTo(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_lineTo(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
@@ -2441,7 +2442,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_lineTo(QV4::SimpleCallCont
Creates a new subpath with the given point.
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_moveTo(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_moveTo(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
@@ -2465,7 +2466,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_moveTo(QV4::SimpleCallCont
See \l{http://www.w3.org/TR/2dcontext/#dom-context-2d-quadraticcurveto}{W3C 2d context standard for for quadraticCurveTo}
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_quadraticCurveTo(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_quadraticCurveTo(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
@@ -2491,7 +2492,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_quadraticCurveTo(QV4::Simp
Adds a rectangle at position (\c x, \c y), with the given width \c w and height \c h, as a closed subpath.
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_rect(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_rect(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
@@ -2508,7 +2509,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_rect(QV4::SimpleCallContex
Adds the given rectangle rect with rounded corners to the path. The \c xRadius and \c yRadius arguments specify the radius of the
ellipses defining the corners of the rounded rectangle.
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_roundedRect(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_roundedRect(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
@@ -2532,7 +2533,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_roundedRect(QV4::SimpleCal
The ellipse is composed of a clockwise curve, starting and finishing at zero degrees (the 3 o'clock position).
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_ellipse(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_ellipse(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
@@ -2551,7 +2552,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_ellipse(QV4::SimpleCallCon
Adds the given \c text to the path as a set of closed subpaths created from the current context font supplied.
The subpaths are positioned so that the left end of the text's baseline lies at the point specified by (\c x, \c y).
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_text(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_text(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
@@ -2577,7 +2578,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_text(QV4::SimpleCallContex
\sa strokeStyle
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_stroke(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_stroke(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
@@ -2594,7 +2595,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_stroke(QV4::SimpleCallCont
\sa {http://www.w3.org/TR/2dcontext/#dom-context-2d-ispointinpath}{W3C 2d context standard for isPointInPath}
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_isPointInPath(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_isPointInPath(QV4::CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->engine;
QV4::Scope scope(v4);
@@ -2607,21 +2608,21 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_isPointInPath(QV4::SimpleC
return QV4::Primitive::fromBoolean(pointInPath).asReturnedValue();
}
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawFocusRing(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawFocusRing(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "Context2D::drawFocusRing is not supported");
}
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_setCaretSelectionRect(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_setCaretSelectionRect(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "Context2D::setCaretSelectionRect is not supported");
}
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_caretBlinkRate(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_caretBlinkRate(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
@@ -2651,7 +2652,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_caretBlinkRate(QV4::Simple
The default font value is "10px sans-serif".
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_font(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_font(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
@@ -2660,13 +2661,15 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_font(QV4::SimpleCallContext *ct
return QV4::Encode(ctx->engine->newString(r->context->state.font.toString()));
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_font(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_font(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
CHECK_CONTEXT_SETTER(r)
QV4::Scoped<QV4::String> s(scope, ctx->argument(0), QV4::Scoped<QV4::String>::Convert);
+ if (scope.engine->hasException)
+ return QV4::Encode::undefined();
QFont font = qt_font_from_string(s->toQString(), r->context->state.font);
if (font != r->context->state.font) {
r->context->state.font = font;
@@ -2688,7 +2691,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_font(QV4::SimpleCallContext *ct
\endlist
Other values are ignored. The default value is "start".
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_textAlign(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_textAlign(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
@@ -2710,13 +2713,15 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_textAlign(QV4::SimpleCallContex
return QV4::Encode(ctx->engine->newString(QStringLiteral("start")));
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_textAlign(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_textAlign(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
CHECK_CONTEXT_SETTER(r)
QV4::Scoped<QV4::String> s(scope, ctx->argument(0), QV4::Scoped<QV4::String>::Convert);
+ if (scope.engine->hasException)
+ return QV4::Encode::undefined();
QString textAlign = s->toQString();
QQuickContext2D::TextAlignType ta;
@@ -2754,7 +2759,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_textAlign(QV4::SimpleCallContex
\endlist
Other values are ignored. The default value is "alphabetic".
*/
-QV4::ReturnedValue QQuickJSContext2D::method_get_textBaseline(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_get_textBaseline(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
@@ -2776,12 +2781,14 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_textBaseline(QV4::SimpleCallCon
return QV4::Encode(ctx->engine->newString(QStringLiteral("alphabetic")));
}
-QV4::ReturnedValue QQuickJSContext2D::method_set_textBaseline(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2D::method_set_textBaseline(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
CHECK_CONTEXT_SETTER(r)
QV4::Scoped<QV4::String> s(scope, ctx->argument(0), QV4::Scoped<QV4::String>::Convert);
+ if (scope.engine->hasException)
+ return QV4::Encode::undefined();
QString textBaseline = s->toQString();
QQuickContext2D::TextBaseLineType tb;
@@ -2812,7 +2819,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_textBaseline(QV4::SimpleCallCon
\sa textBaseline
\sa strokeText
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillText(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillText(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
@@ -2836,7 +2843,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillText(QV4::SimpleCallCo
\sa textBaseline
\sa fillText
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeText(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeText(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
@@ -2871,7 +2878,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeText(QV4::SimpleCall
\qmlmethod variant QtQuick::Context2D::measureText(text)
Returns a TextMetrics object with the metrics of the given text in the current font.
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_measureText(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_measureText(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
@@ -2947,7 +2954,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_measureText(QV4::SimpleCal
\sa {http://www.w3.org/TR/2dcontext/#dom-context-2d-drawimage}{W3C 2d context standard for drawImage}
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject);
@@ -2974,7 +2981,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::SimpleCallC
} else if (arg->isObject()) {
if (QV4::Referenced<QV4::QObjectWrapper> qobjectWrapper = arg->asRef<QV4::QObjectWrapper>()) {
if (QQuickImage *imageItem = qobject_cast<QQuickImage*>(qobjectWrapper->object())) {
- pixmap.take(r->context->createPixmap(imageItem->source()));
+ pixmap = r->context->createPixmap(imageItem->source());
} else if (QQuickCanvasItem *canvas = qobject_cast<QQuickCanvasItem*>(qobjectWrapper->object())) {
QImage img = canvas->toImage();
if (!img.isNull())
@@ -3083,12 +3090,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::SimpleCallC
\qmlproperty int QtQuick::CanvasImageData::width
Holds the actual width dimension of the data in the ImageData object, in device pixels.
*/
-QV4::ReturnedValue QQuickJSContext2DImageData::method_get_width(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DImageData::method_get_width(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, ctx->callData->thisObject);
if (!imageData)
- ctx->throwTypeError();
+ return ctx->throwTypeError();
QV4::Scoped<QQuickJSContext2DPixelData> r(scope, imageData->pixelData.as<QQuickJSContext2DPixelData>());
if (!r)
return QV4::Encode(0);
@@ -3099,12 +3106,12 @@ QV4::ReturnedValue QQuickJSContext2DImageData::method_get_width(QV4::SimpleCallC
\qmlproperty int QtQuick::CanvasImageData::height
Holds the actual height dimension of the data in the ImageData object, in device pixels.
*/
-QV4::ReturnedValue QQuickJSContext2DImageData::method_get_height(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DImageData::method_get_height(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, ctx->callData->thisObject);
if (!imageData)
- ctx->throwTypeError();
+ return ctx->throwTypeError();
QV4::Scoped<QQuickJSContext2DPixelData> r(scope, imageData->pixelData.as<QQuickJSContext2DPixelData>());
if (!r)
return QV4::Encode(0);
@@ -3115,12 +3122,12 @@ QV4::ReturnedValue QQuickJSContext2DImageData::method_get_height(QV4::SimpleCall
\qmlproperty object QtQuick::CanvasImageData::data
Holds the one-dimensional array containing the data in RGBA order, as integers in the range 0 to 255.
*/
-QV4::ReturnedValue QQuickJSContext2DImageData::method_get_data(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DImageData::method_get_data(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, ctx->callData->thisObject);
if (!imageData)
- ctx->throwTypeError();
+ return ctx->throwTypeError();
return imageData->pixelData.asReturnedValue();
}
@@ -3142,7 +3149,7 @@ QV4::ReturnedValue QQuickJSContext2DImageData::method_get_data(QV4::SimpleCallCo
The length attribute of a CanvasPixelArray object must return this h×w×4 number value.
This property is read only.
*/
-QV4::ReturnedValue QQuickJSContext2DPixelData::proto_get_length(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPixelData::proto_get_length(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2DPixelData> r(scope, ctx->callData->thisObject.as<QQuickJSContext2DPixelData>());
@@ -3158,7 +3165,7 @@ QV4::ReturnedValue QQuickJSContext2DPixelData::getIndexed(QV4::Managed *m, uint
QV4::Scope scope(v4);
QV4::Scoped<QQuickJSContext2DPixelData> r(scope, m->as<QQuickJSContext2DPixelData>());
if (!m)
- m->engine()->current->throwTypeError();
+ return m->engine()->current->throwTypeError();
if (r && index < static_cast<quint32>(r->image.width() * r->image.height() * 4)) {
if (hasProperty)
@@ -3188,9 +3195,14 @@ void QQuickJSContext2DPixelData::putIndexed(QV4::Managed *m, uint index, const Q
{
QV4::ExecutionEngine *v4 = m->engine();
QV4::Scope scope(v4);
+ if (scope.hasException())
+ return;
+
QV4::Scoped<QQuickJSContext2DPixelData> r(scope, m->as<QQuickJSContext2DPixelData>());
- if (!r)
- m->engine()->current->throwTypeError();
+ if (!r) {
+ v4->current->throwTypeError();
+ return;
+ }
const int v = value->toInt32();
if (r && index < static_cast<quint32>(r->image.width() * r->image.height() * 4) && v >= 0 && v <= 255) {
@@ -3237,7 +3249,7 @@ void QQuickJSContext2DPixelData::putIndexed(QV4::Managed *m, uint index, const Q
\sa Canvas::loadImage(), QtQuick::Canvas::unloadImage(),
QtQuick::Canvas::isImageLoaded
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_createImageData(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_createImageData(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject.as<QQuickJSContext2D>());
@@ -3277,7 +3289,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createImageData(QV4::Simpl
\qmlmethod CanvasImageData QtQuick::Context2D::getImageData(real sx, real sy, real sw, real sh)
Returns an CanvasImageData object containing the image data for the given rectangle of the canvas.
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_getImageData(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_getImageData(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject.as<QQuickJSContext2D>());
@@ -3305,7 +3317,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_getImageData(QV4::SimpleCa
\qmlmethod object QtQuick::Context2D::putImageData(CanvasImageData imageData, real dx, real dy, real dirtyX, real dirtyY, real dirtyWidth, real dirtyHeight)
Paints the data from the given ImageData object onto the canvas. If a dirty rectangle (\a dirtyX, \a dirtyY, \a dirtyWidth, \a dirtyHeight) is provided, only the pixels from that rectangle are painted.
*/
-QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->callData->thisObject.as<QQuickJSContext2D>());
@@ -3406,7 +3418,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(QV4::SimpleCa
gradient.addColorStop(0.7, 'rgba(0, 255, 255, 1');
\endcode
*/
-QV4::ReturnedValue QQuickContext2DStyle::gradient_proto_addColorStop(QV4::SimpleCallContext *ctx)
+QV4::ReturnedValue QQuickContext2DStyle::gradient_proto_addColorStop(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
QV4::Scoped<QQuickContext2DStyle> style(scope, ctx->callData->thisObject.as<QQuickContext2DStyle>());
@@ -4101,7 +4113,7 @@ void QQuickContext2D::init(QQuickCanvasItem *canvasItem, const QVariantMap &args
m_texture->moveToThread(renderThread);
if (m_renderTarget == QQuickCanvasItem::FramebufferObject && renderThread != sceneGraphThread) {
- QOpenGLContext *cc = QQuickWindowPrivate::get(window)->context->glContext();
+ QOpenGLContext *cc = QQuickWindowPrivate::get(window)->context->openglContext();
m_surface = window;
m_glContext = new QOpenGLContext;
m_glContext->setFormat(cc->format());
diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri
index cbdc5fd80f..3996512f9d 100644
--- a/src/quick/items/items.pri
+++ b/src/quick/items/items.pri
@@ -139,6 +139,21 @@ HEADERS += \
$$PWD/qquickshadereffectnode_p.h \
$$PWD/qquickshadereffectsource_p.h \
-include(context2d/context2d.pri)
+OTHER_FILES += \
+ $$PWD/shaders/sprite.vert \
+ $$PWD/shaders/sprite.frag \
+ $$PWD/shaders/shadereffect.vert \
+ $$PWD/shaders/shadereffect.frag \
+ $$PWD/shaders/shadereffectfallback.vert \
+ $$PWD/shaders/shadereffectfallback.frag \
+ $$PWD/shaders/sprite_core.vert \
+ $$PWD/shaders/sprite_core.frag \
+ $$PWD/shaders/shadereffect_core.vert \
+ $$PWD/shaders/shadereffect_core.frag \
+ $$PWD/shaders/shadereffectfallback_core.vert \
+ $$PWD/shaders/shadereffectfallback_core.frag
+RESOURCES += \
+ $$PWD/items.qrc
+include(context2d/context2d.pri)
diff --git a/src/quick/items/items.qrc b/src/quick/items/items.qrc
new file mode 100644
index 0000000000..671d8acdbb
--- /dev/null
+++ b/src/quick/items/items.qrc
@@ -0,0 +1,16 @@
+<RCC>
+ <qresource prefix="/items">
+ <file>shaders/sprite.frag</file>
+ <file>shaders/sprite.vert</file>
+ <file>shaders/shadereffect.vert</file>
+ <file>shaders/shadereffect.frag</file>
+ <file>shaders/shadereffectfallback.frag</file>
+ <file>shaders/shadereffectfallback.vert</file>
+ <file>shaders/shadereffect_core.frag</file>
+ <file>shaders/shadereffect_core.vert</file>
+ <file>shaders/shadereffectfallback_core.frag</file>
+ <file>shaders/shadereffectfallback_core.vert</file>
+ <file>shaders/sprite_core.frag</file>
+ <file>shaders/sprite_core.vert</file>
+ </qresource>
+</RCC>
diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp
index 846de15581..64b8f257dc 100644
--- a/src/quick/items/qquickanimatedsprite.cpp
+++ b/src/quick/items/qquickanimatedsprite.cpp
@@ -57,39 +57,6 @@
QT_BEGIN_NAMESPACE
-static const char vertexShaderCode[] =
- "attribute highp vec2 vPos;\n"
- "attribute highp vec2 vTex;\n"
- "uniform highp vec3 animData;// w,h(premultiplied of anim), interpolation progress\n"
- "uniform highp vec4 animPos;//x,y, x,y (two frames for interpolation)\n"
- "\n"
- "uniform highp mat4 qt_Matrix;\n"
- "\n"
- "varying highp vec4 fTexS;\n"
- "varying lowp float progress;\n"
- "\n"
- "\n"
- "void main() {\n"
- " progress = animData.z;\n"
- " //Calculate frame location in texture\n"
- " fTexS.xy = animPos.xy + vTex.xy * animData.xy;\n"
- " //Next frame is also passed, for interpolation\n"
- " fTexS.zw = animPos.zw + vTex.xy * animData.xy;\n"
- "\n"
- " gl_Position = qt_Matrix * vec4(vPos.x, vPos.y, 0, 1);\n"
- "}\n";
-
-static const char fragmentShaderCode[] =
- "uniform sampler2D _qt_texture;\n"
- "uniform lowp float qt_Opacity;\n"
- "\n"
- "varying highp vec4 fTexS;\n"
- "varying lowp float progress;\n"
- "\n"
- "void main() {\n"
- " gl_FragColor = mix(texture2D(_qt_texture, fTexS.xy), texture2D(_qt_texture, fTexS.zw), progress) * qt_Opacity;\n"
- "}\n";
-
class QQuickAnimatedSpriteMaterial : public QSGMaterial
{
public:
@@ -134,16 +101,11 @@ QQuickAnimatedSpriteMaterial::~QQuickAnimatedSpriteMaterial()
class AnimatedSpriteMaterialData : public QSGMaterialShader
{
public:
- AnimatedSpriteMaterialData(const char * /* vertexFile */ = 0, const char * /* fragmentFile */ = 0)
+ AnimatedSpriteMaterialData()
+ : QSGMaterialShader()
{
- }
-
- void deactivate() {
- QSGMaterialShader::deactivate();
-
- for (int i=0; i<8; ++i) {
- program()->setAttributeArray(i, GL_FLOAT, chunkOfBytes, 1, 0);
- }
+ setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/items/shaders/sprite.vert"));
+ setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/items/shaders/sprite.frag"));
}
virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *)
@@ -166,9 +128,6 @@ public:
m_animPos_id = program()->uniformLocation("animPos");
}
- virtual const char *vertexShader() const { return vertexShaderCode; }
- virtual const char *fragmentShader() const { return fragmentShaderCode; }
-
virtual char const *const *attributeNames() const {
static const char *attr[] = {
"vPos",
@@ -182,12 +141,8 @@ public:
int m_opacity_id;
int m_animData_id;
int m_animPos_id;
-
- static float chunkOfBytes[1024];
};
-float AnimatedSpriteMaterialData::chunkOfBytes[1024];
-
QSGMaterialShader *QQuickAnimatedSpriteMaterial::createShader() const
{
return new AnimatedSpriteMaterialData;
@@ -219,7 +174,7 @@ struct AnimatedSpriteVertices {
as multiple frames in the same image file. You can play it at a fixed speed, at the
frame rate of your display, or manually advance and control the progress.
- For details of how a sprite animation is defined see the \l{Sprite Animation} overview.
+ For details of how a sprite animation is defined see the \l{Sprite Animations} overview.
Note that the AnimatedSprite type does not use Sprite types to define multiple animations,
but instead encapsulates a single animation itself.
*/
diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp
index 9fc9752707..0bed5e96a2 100644
--- a/src/quick/items/qquickborderimage.cpp
+++ b/src/quick/items/qquickborderimage.cpp
@@ -301,7 +301,7 @@ void QQuickBorderImage::load()
d->oldSourceSize = sourceSize();
emit sourceSizeChanged();
}
- update();
+ pixmapChange();
return;
} else {
if (d->url.path().endsWith(QLatin1String("sci"))) {
@@ -509,7 +509,7 @@ void QQuickBorderImage::requestFinished()
emit sourceSizeChanged();
}
- update();
+ pixmapChange();
}
#define BORDERIMAGE_MAX_REDIRECT 16
@@ -551,7 +551,7 @@ QSGNode *QQuickBorderImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
{
Q_D(QQuickBorderImage);
- QSGTexture *texture = d->sceneGraphContext()->textureForFactory(d->pix.textureFactory(), window());
+ QSGTexture *texture = d->sceneGraphRenderContext()->textureForFactory(d->pix.textureFactory(), window());
if (!texture || width() <= 0 || height() <= 0) {
delete oldNode;
@@ -561,6 +561,7 @@ QSGNode *QQuickBorderImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
QSGImageNode *node = static_cast<QSGImageNode *>(oldNode);
bool updatePixmap = d->pixmapChanged;
+ d->pixmapChanged = false;
if (!node) {
node = d->sceneGraphContext()->createImageNode();
updatePixmap = true;
@@ -634,10 +635,7 @@ QSGNode *QQuickBorderImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
void QQuickBorderImage::pixmapChange()
{
Q_D(QQuickBorderImage);
-
d->pixmapChanged = true;
-
- // When the pixmap changes, such as being deleted, we need to update the textures
update();
}
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index f0a68b184a..ae174d86e0 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -1116,10 +1116,10 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
hData.velocity = 0;
}
- if ((hMoved && !prevHMoved) || (vMoved && !prevVMoved)) {
- draggingStarting();
+ draggingStarting();
+
+ if ((hMoved && !prevHMoved) || (vMoved && !prevVMoved))
q->movementStarting();
- }
qint64 currentTimestamp = computeCurrentTime(event);
qreal elapsed = qreal(currentTimestamp - (lastPos.isNull() ? lastPressTime : lastPosTime)) / 1000.;
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index 1c6168fbc5..c9e6d4d7e2 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -1248,7 +1248,7 @@ bool QQuickGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte
\image gridview-layout-toptobottom-rtl-btt.png
\endtable
- \sa {quick/modelviews/gridview}{GridView example}
+ \sa {QML Data Models}, ListView, PathView, {Qt Quick Examples - Views}
*/
QQuickGridView::QQuickGridView(QQuickItem *parent)
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp
index d6be13f3c0..0708304051 100644
--- a/src/quick/items/qquickimage.cpp
+++ b/src/quick/items/qquickimage.cpp
@@ -532,17 +532,17 @@ QRectF QQuickImage::boundingRect() const
QSGTextureProvider *QQuickImage::textureProvider() const
{
Q_D(const QQuickImage);
+
+ if (!d->window || !d->sceneGraphRenderContext() || QThread::currentThread() != d->sceneGraphRenderContext()->thread()) {
+ qWarning("QQuickImage::textureProvider: can only be queried on the rendering thread of an exposed window");
+ return 0;
+ }
+
if (!d->provider) {
- // Make sure it gets thread affinity on the rendering thread so deletion works properly..
- Q_ASSERT_X(d->window
- && d->sceneGraphContext()
- && QThread::currentThread() == d->sceneGraphContext()->thread(),
- "QQuickImage::textureProvider",
- "Cannot be used outside the GUI thread");
QQuickImagePrivate *dd = const_cast<QQuickImagePrivate *>(d);
dd->provider = new QQuickImageTextureProvider;
dd->provider->m_smooth = d->smooth;
- dd->provider->m_texture = d->sceneGraphContext()->textureForFactory(d->pix.textureFactory(), window());
+ dd->provider->m_texture = d->sceneGraphRenderContext()->textureForFactory(d->pix.textureFactory(), window());
}
return d->provider;
@@ -552,7 +552,7 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
Q_D(QQuickImage);
- QSGTexture *texture = d->sceneGraphContext()->textureForFactory(d->pix.textureFactory(), window());
+ QSGTexture *texture = d->sceneGraphRenderContext()->textureForFactory(d->pix.textureFactory(), window());
// Copy over the current texture state into the texture provider...
if (d->provider) {
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index c3b221b2c8..c11bf904be 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -732,7 +732,7 @@ void QQuickKeyNavigationAttached::setFocusNavigation(QQuickItem *currentItem, co
do {
isNextItem = false;
if (currentItem->isVisible() && currentItem->isEnabled()) {
- currentItem->setFocus(true);
+ currentItem->forceActiveFocus(Qt::OtherFocusReason);
} else {
QObject *attached =
qmlAttachedPropertiesObject<QQuickKeyNavigationAttached>(currentItem, false);
@@ -3827,7 +3827,12 @@ void QQuickItem::setBaselineOffset(qreal offset)
void QQuickItem::update()
{
Q_D(QQuickItem);
- Q_ASSERT(flags() & ItemHasContents);
+ if (!(flags() & ItemHasContents)) {
+#ifndef QT_NO_DEBUG
+ qWarning() << metaObject()->className() << ": Update called for a item without content";
+#endif
+ return;
+ }
d->dirty(QQuickItemPrivate::Content);
}
@@ -4125,7 +4130,7 @@ QQmlListProperty<QQuickItem> QQuickItemPrivate::children()
}
/*!
- \qmlproperty real QtQuick::Item::visibleChildren
+ \qmlproperty list<Item> QtQuick::Item::visibleChildren
This read-only property lists all of the item's children that are currently visible.
Note that a child's visibility may have changed explicitly, or because the visibility
of this (it's parent) item or another grandparent changed.
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index f731acabbb..7faf39f8e5 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -468,6 +468,7 @@ public:
QQuickWindow *window;
int windowRefCount;
inline QSGContext *sceneGraphContext() const;
+ inline QSGRenderContext *sceneGraphRenderContext() const;
QQuickItem *parentItem;
QQmlNotifier parentNotifier;
@@ -840,6 +841,12 @@ Qt::MouseButtons QQuickItemPrivate::acceptedMouseButtons() const
QSGContext *QQuickItemPrivate::sceneGraphContext() const
{
Q_ASSERT(window);
+ return static_cast<QQuickWindowPrivate *>(QObjectPrivate::get(window))->context->sceneGraphContext();
+}
+
+QSGRenderContext *QQuickItemPrivate::sceneGraphRenderContext() const
+{
+ Q_ASSERT(window);
return static_cast<QQuickWindowPrivate *>(QObjectPrivate::get(window))->context;
}
diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp
index 534ad0e2f4..b840ee421c 100644
--- a/src/quick/items/qquickitemanimation.cpp
+++ b/src/quick/items/qquickitemanimation.cpp
@@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE
ParentChange that has occurred during the state change. This can be
overridden by setting a specific target item using the \l target property.
- \sa {Animation and Transitions in Qt Quick}, {declarative/animation/basics}{Animation basics example}
+ \sa {Animation and Transitions in Qt Quick}, {Qt Quick Examples - Animation}
*/
QQuickParentAnimation::QQuickParentAnimation(QObject *parent)
: QQuickAnimationGroup(*(new QQuickParentAnimationPrivate), parent)
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index daf76c377e..a5b78b28e1 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -188,6 +188,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickTextEdit>(uri,major,minor,"TextEdit");
qmlRegisterType<QQuickTextEdit,1>(uri,2,1,"TextEdit");
qmlRegisterType<QQuickTextInput>(uri,major,minor,"TextInput");
+ qmlRegisterType<QQuickTextInput,2>(uri,2,2,"TextInput");
qmlRegisterType<QQuickViewSection>(uri,major,minor,"ViewSection");
qmlRegisterType<QQuickItemLayer>();
@@ -268,8 +269,17 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickTextEdit, 2>(uri, 2, 2, "TextEdit");
}
+static void initResources()
+{
+ Q_INIT_RESOURCE(items);
+}
+
+QT_BEGIN_NAMESPACE
+
void QQuickItemsModule::defineModule()
{
+ initResources();
+
QByteArray name = "QtQuick";
int majorVersion = 2;
int minorVersion = 0;
@@ -277,3 +287,4 @@ void QQuickItemsModule::defineModule()
qt_quickitems_defineModule(name, majorVersion, minorVersion);
}
+QT_END_NAMESPACE
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 513f8f3857..d9ff024d9f 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -1118,11 +1118,13 @@ void QQuickItemViewPrivate::itemGeometryChanged(QQuickItem *item, const QRectF &
if (header && header->item == item) {
updateHeader();
markExtentsDirty();
+ updateViewport();
if (!q->isMoving() && !q->isFlicking())
fixupPosition();
} else if (footer && footer->item == item) {
updateFooter();
markExtentsDirty();
+ updateViewport();
if (!q->isMoving() && !q->isFlicking())
fixupPosition();
}
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index 22d8176086..c55f9ef696 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -1744,7 +1744,7 @@ bool QQuickListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte
\image listview-layout-righttoleft.png
\endtable
- \sa {QML Data Models}, GridView, {quick/modelviews/listview}{ListView examples}
+ \sa {QML Data Models}, GridView, PathView, {Qt Quick Examples - Views}
*/
QQuickListView::QQuickListView(QQuickItem *parent)
: QQuickItemView(*(new QQuickListViewPrivate), parent)
@@ -1907,7 +1907,8 @@ QQuickListView::~QQuickListView()
so as to stay with the current item, unless the highlightFollowsCurrentItem
property is false.
- \sa highlightItem, highlightFollowsCurrentItem, {quick/modelviews/listview}{ListView examples}
+ \sa highlightItem, highlightFollowsCurrentItem,
+ {Qt Quick Examples - Views#Highlight demonstrates adding a custom highlight to a ListView.}{ListView highlight example}
*/
/*!
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index b9e6efaa10..ca64ebb6e3 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -156,7 +156,7 @@ bool QQuickMouseAreaPrivate::propagateHelper(QQuickMouseEvent *ev, QQuickItem *i
}
QQuickMouseArea* ma = qobject_cast<QQuickMouseArea*>(item);
- if (ma && ma != q && itemPrivate->acceptedMouseButtons() & ev->button()) {
+ if (ma && ma != q && ma->isEnabled() && itemPrivate->acceptedMouseButtons() & ev->button()) {
switch (sig) {
case Click:
if (!ma->d_func()->isClickConnected())
diff --git a/src/quick/items/qquickpainteditem.cpp b/src/quick/items/qquickpainteditem.cpp
index e0ac974022..3bf5d82e4d 100644
--- a/src/quick/items/qquickpainteditem.cpp
+++ b/src/quick/items/qquickpainteditem.cpp
@@ -276,7 +276,7 @@ void QQuickPaintedItem::setMipmap(bool enable)
/*!
Returns the performance hints.
- By default, no performance hint is enabled/
+ By default, no performance hint is enabled.
\sa setPerformanceHint(), setPerformanceHints()
*/
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index d8132bdd12..1f41fe04e5 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -553,7 +553,7 @@ void QQuickPathViewPrivate::setDragging(bool d)
to set \e {clip: true} in order to have the out of view items clipped
nicely.
- \sa Path, {quick/modelviews/pathview}{PathView example}
+ \sa Path, {QML Data Models}, ListView, GridView, {Qt Quick Examples - Views}
*/
QQuickPathView::QQuickPathView(QQuickItem *parent)
@@ -2031,7 +2031,7 @@ void QQuickPathView::modelUpdated(const QQmlChangeSet &changeSet, bool reset)
const int modelCount = d->modelCount;
int moveId = -1;
- int moveOffset;
+ int moveOffset = 0;
bool currentChanged = false;
bool changedOffset = false;
foreach (const QQmlChangeSet::Remove &r, changeSet.removes()) {
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp
index 75eccf6c59..48c0f8e084 100644
--- a/src/quick/items/qquickscreen.cpp
+++ b/src/quick/items/qquickscreen.cpp
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Screen
\instantiates QQuickScreenAttached
- \inqmlmodule QtQuick.Window 2
+ \inqmlmodule QtQuick.Window
\ingroup qtquick-visual-utility
\brief The Screen attached object provides information about the Screen an Item or Window is displayed on.
@@ -80,26 +80,26 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlattachedproperty String QtQuick.Window::Screen::name
+ \qmlattachedproperty string Screen::name
\readonly
\since 5.1
The name of the screen.
*/
/*!
- \qmlattachedproperty int QtQuick.Window::Screen::width
+ \qmlattachedproperty int Screen::width
\readonly
This contains the width of the screen in pixels.
*/
/*!
- \qmlattachedproperty int QtQuick.Window::Screen::height
+ \qmlattachedproperty int Screen::height
\readonly
This contains the height of the screen in pixels.
*/
/*!
- \qmlattachedproperty int QtQuick.Window::Screen::desktopAvailableWidth
+ \qmlattachedproperty int Screen::desktopAvailableWidth
\readonly
\since 5.1
@@ -113,7 +113,7 @@ QT_BEGIN_NAMESPACE
\endqml
*/
/*!
- \qmlattachedproperty int QtQuick.Window::Screen::desktopAvailableHeight
+ \qmlattachedproperty int Screen::desktopAvailableHeight
\readonly
\since 5.1
@@ -127,16 +127,30 @@ QT_BEGIN_NAMESPACE
\endqml
*/
/*!
- \qmlattachedproperty real QtQuick.Window::Screen::logicalPixelDensity
+ \qmlattachedproperty real Screen::logicalPixelDensity
\readonly
\since 5.1
+ \deprecated
- The number of logical pixels per millimeter. Logical pixels are the
- usual units in QML; on some systems they may be different than physical
- pixels.
+ The number of logical pixels per millimeter. This is the effective pixel
+ density provided by the platform to use in image scaling calculations.
+
+ Due to inconsistencies in how logical pixel density is handled across
+ the various platforms Qt supports, it is recommended to
+ use physical pixels instead (via the \c pixelDensity property) for
+ portability.
+
+ \sa pixelDensity
+*/
+/*!
+ \qmlattachedproperty real Screen::pixelDensity
+ \readonly
+ \since 5.2
+
+ The number of physical pixels per millimeter.
*/
/*!
- \qmlattachedproperty Qt::ScreenOrientation QtQuick.Window::Screen::primaryOrientation
+ \qmlattachedproperty Qt::ScreenOrientation Screen::primaryOrientation
\readonly
This contains the primary orientation of the screen. If the
@@ -153,7 +167,7 @@ QT_BEGIN_NAMESPACE
automatically, so again you will see the primaryOrientation change.
*/
/*!
- \qmlattachedproperty Qt::ScreenOrientation QtQuick.Window::Screen::orientation
+ \qmlattachedproperty Qt::ScreenOrientation Screen::orientation
\readonly
This contains the current orientation of the screen, from the accelerometer
@@ -167,7 +181,7 @@ QT_BEGIN_NAMESPACE
\l Item.transform to rotate your content.
*/
/*!
- \qmlattachedmethod int QtQuick.Window::Screen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
+ \qmlattachedmethod int Screen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
Returns the rotation angle, in degrees, between the two specified angles.
*/
@@ -233,6 +247,13 @@ qreal QQuickScreenAttached::logicalPixelDensity() const
return m_screen->logicalDotsPerInch() / 25.4;
}
+qreal QQuickScreenAttached::pixelDensity() const
+{
+ if (!m_screen)
+ return 0.0;
+ return m_screen->physicalDotsPerInch() / 25.4;
+}
+
Qt::ScreenOrientation QQuickScreenAttached::primaryOrientation() const
{
if (!m_screen)
@@ -291,6 +312,8 @@ void QQuickScreenAttached::screenChanged(QScreen *screen)
emit desktopGeometryChanged();
if (!oldScreen || screen->logicalDotsPerInch() != oldScreen->logicalDotsPerInch())
emit logicalPixelDensityChanged();
+ if (!oldScreen || screen->physicalDotsPerInch() != oldScreen->physicalDotsPerInch())
+ emit pixelDensityChanged();
connect(screen, SIGNAL(geometryChanged(QRect)),
this, SIGNAL(widthChanged()));
@@ -304,6 +327,8 @@ void QQuickScreenAttached::screenChanged(QScreen *screen)
this, SIGNAL(desktopGeometryChanged()));
connect(screen, SIGNAL(logicalDotsPerInchChanged(qreal)),
this, SIGNAL(logicalPixelDensityChanged()));
+ connect(screen, SIGNAL(physicalDotsPerInchChanged(qreal)),
+ this, SIGNAL(pixelDensityChanged()));
}
}
diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h
index 0f1e79b1a2..a155ff1843 100644
--- a/src/quick/items/qquickscreen_p.h
+++ b/src/quick/items/qquickscreen_p.h
@@ -64,6 +64,7 @@ class Q_AUTOTEST_EXPORT QQuickScreenAttached : public QObject
Q_PROPERTY(int desktopAvailableWidth READ desktopAvailableWidth NOTIFY desktopGeometryChanged REVISION 1)
Q_PROPERTY(int desktopAvailableHeight READ desktopAvailableHeight NOTIFY desktopGeometryChanged REVISION 1)
Q_PROPERTY(qreal logicalPixelDensity READ logicalPixelDensity NOTIFY logicalPixelDensityChanged REVISION 1)
+ Q_PROPERTY(qreal pixelDensity READ pixelDensity NOTIFY pixelDensityChanged REVISION 2)
Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation NOTIFY primaryOrientationChanged)
Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged)
@@ -76,6 +77,7 @@ public:
int desktopAvailableWidth() const;
int desktopAvailableHeight() const;
qreal logicalPixelDensity() const;
+ qreal pixelDensity() const;
Qt::ScreenOrientation primaryOrientation() const;
Qt::ScreenOrientation orientation() const;
@@ -90,6 +92,7 @@ Q_SIGNALS:
void heightChanged();
Q_REVISION(1) void desktopGeometryChanged();
Q_REVISION(1) void logicalPixelDensityChanged();
+ Q_REVISION(2) void pixelDensityChanged();
void primaryOrientationChanged();
void orientationChanged();
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index 354b9f751b..9a20703f18 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -43,6 +43,7 @@
#include <private/qquickshadereffectnode_p.h>
#include <QtQuick/qsgmaterial.h>
+#include <QtQuick/private/qsgshadersourcebuilder_p.h>
#include "qquickitem_p.h"
#include <QtQuick/private/qsgcontext_p.h>
@@ -57,24 +58,6 @@
QT_BEGIN_NAMESPACE
-static const char qt_default_vertex_code[] =
- "uniform highp mat4 qt_Matrix; \n"
- "attribute highp vec4 qt_Vertex; \n"
- "attribute highp vec2 qt_MultiTexCoord0; \n"
- "varying highp vec2 qt_TexCoord0; \n"
- "void main() { \n"
- " qt_TexCoord0 = qt_MultiTexCoord0; \n"
- " gl_Position = qt_Matrix * qt_Vertex; \n"
- "}";
-
-static const char qt_default_fragment_code[] =
- "varying highp vec2 qt_TexCoord0; \n"
- "uniform sampler2D source; \n"
- "uniform lowp float qt_Opacity; \n"
- "void main() { \n"
- " gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity; \n"
- "}";
-
static const char qt_position_attribute_name[] = "qt_Vertex";
static const char qt_texcoord_attribute_name[] = "qt_MultiTexCoord0";
@@ -576,6 +559,7 @@ void QQuickShaderEffectCommon::propertyChanged(QQuickItem *item, int mappedId,
\li QVector4D -> vec4
\li QTransform -> mat3
\li QMatrix4x4 -> mat4
+ \li QQuaternion -> vec4, scalar value is \c w.
\li \l Image, \l ShaderEffectSource -> sampler2D - Origin is in the top-left
corner, and the color values are premultiplied.
\endlist
@@ -979,10 +963,16 @@ QSGNode *QQuickShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa
if (m_dirtyProgram) {
Key s = m_common.source;
- if (s.sourceCode[Key::FragmentShader].isEmpty())
- s.sourceCode[Key::FragmentShader] = qt_default_fragment_code;
- if (s.sourceCode[Key::VertexShader].isEmpty())
- s.sourceCode[Key::VertexShader] = qt_default_vertex_code;
+ QSGShaderSourceBuilder builder;
+ if (s.sourceCode[Key::FragmentShader].isEmpty()) {
+ builder.appendSourceFile(QStringLiteral(":/items/shaders/shadereffect.frag"));
+ s.sourceCode[Key::FragmentShader] = builder.source();
+ builder.clear();
+ }
+ if (s.sourceCode[Key::VertexShader].isEmpty()) {
+ builder.appendSourceFile(QStringLiteral(":/items/shaders/shadereffect.vert"));
+ s.sourceCode[Key::VertexShader] = builder.source();
+ }
s.className = metaObject()->className();
material->setProgramSource(s);
diff --git a/src/quick/items/qquickshadereffectnode.cpp b/src/quick/items/qquickshadereffectnode.cpp
index b84d251de5..3ab13dbbc7 100644
--- a/src/quick/items/qquickshadereffectnode.cpp
+++ b/src/quick/items/qquickshadereffectnode.cpp
@@ -45,6 +45,7 @@
#include "qquickshadereffect_p.h"
#include <QtQuick/qsgtextureprovider.h>
#include <QtQuick/private/qsgrenderer_p.h>
+#include <QtQuick/private/qsgshadersourcebuilder_p.h>
QT_BEGIN_NAMESPACE
@@ -196,6 +197,12 @@ void QQuickCustomMaterialShader::updateState(const RenderState &state, QSGMateri
case QMetaType::QVector4D:
program()->setUniformValue(loc, qvariant_cast<QVector4D>(d.value));
break;
+ case QMetaType::QQuaternion:
+ {
+ QQuaternion q = qvariant_cast<QQuaternion>(d.value);
+ program()->setUniformValue(loc, q.x(), q.y(), q.z(), q.scalar());
+ }
+ break;
case QMetaType::QMatrix4x4:
program()->setUniformValue(loc, qvariant_cast<QMatrix4x4>(d.value));
break;
@@ -276,20 +283,15 @@ void QQuickCustomMaterialShader::compile()
m_log += program()->log();
}
- static const char fallbackVertexShader[] =
- "uniform highp mat4 qt_Matrix;"
- "attribute highp vec4 v;"
- "void main() { gl_Position = qt_Matrix * v; }";
- static const char fallbackFragmentShader[] =
- "void main() { gl_FragColor = vec4(1., 0., 1., 1.); }";
-
if (!m_compiled) {
qWarning("QQuickCustomMaterialShader: Shader compilation failed:");
qWarning() << program()->log();
- program()->removeAllShaders();
- program()->addShaderFromSourceCode(QOpenGLShader::Vertex, fallbackVertexShader);
- program()->addShaderFromSourceCode(QOpenGLShader::Fragment, fallbackFragmentShader);
+ QSGShaderSourceBuilder::initializeProgramFromFiles(
+ program(),
+ QStringLiteral(":/items/shaders/shadereffectfallback.vert"),
+ QStringLiteral(":/items/shaders/shadereffectfallback.frag"));
+
#ifndef QT_NO_DEBUG
for (int i = 0; i < attrCount; ++i) {
#else
diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp
index e86550d731..e076a342df 100644
--- a/src/quick/items/qquickshadereffectsource.cpp
+++ b/src/quick/items/qquickshadereffectsource.cpp
@@ -45,6 +45,7 @@
#include "qquickwindow_p.h"
#include <private/qsgadaptationlayer_p.h>
#include <QtQuick/private/qsgrenderer_p.h>
+#include <qsgsimplerectnode.h>
#include "qopenglframebufferobject.h"
#include "qmath.h"
@@ -140,10 +141,11 @@ QQuickShaderEffectTexture::QQuickShaderEffectTexture(QQuickItem *shaderSource)
, m_renderer(0)
, m_fbo(0)
, m_secondaryFbo(0)
+ , m_transparentTexture(0)
#ifdef QSG_DEBUG_FBO_OVERLAY
, m_debugOverlay(0)
#endif
- , m_context(QQuickItemPrivate::get(shaderSource)->sceneGraphContext())
+ , m_context(QQuickItemPrivate::get(shaderSource)->sceneGraphRenderContext())
, m_mipmap(false)
, m_live(true)
, m_recursive(false)
@@ -164,6 +166,8 @@ QQuickShaderEffectTexture::~QQuickShaderEffectTexture()
#ifdef QSG_DEBUG_FBO_OVERLAY
delete m_debugOverlay;
#endif
+ if (m_transparentTexture)
+ glDeleteTextures(1, &m_transparentTexture);
}
int QQuickShaderEffectTexture::textureId() const
@@ -188,8 +192,20 @@ void QQuickShaderEffectTexture::bind()
if (!m_recursive && m_fbo && ((m_multisampling && m_secondaryFbo->isBound()) || m_fbo->isBound()))
qWarning("ShaderEffectSource: \'recursive\' must be set to true when rendering recursively.");
#endif
- glBindTexture(GL_TEXTURE_2D, m_fbo ? m_fbo->texture() : 0);
- updateBindOptions();
+
+ if (!m_fbo && m_format == GL_RGBA) {
+ if (m_transparentTexture == 0) {
+ glGenTextures(1, &m_transparentTexture);
+ glBindTexture(GL_TEXTURE_2D, m_transparentTexture);
+ const uint zero = 0;
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &zero);
+ } else {
+ glBindTexture(GL_TEXTURE_2D, m_transparentTexture);
+ }
+ } else {
+ glBindTexture(GL_TEXTURE_2D, m_fbo ? m_fbo->texture() : 0);
+ updateBindOptions();
+ }
}
bool QQuickShaderEffectTexture::updateTexture()
@@ -326,7 +342,7 @@ void QQuickShaderEffectTexture::grab()
|| (!m_fbo->format().mipmap() && m_mipmap))
{
if (!m_multisamplingChecked) {
- if (m_context->glContext()->format().samples() <= 1) {
+ if (m_context->openglContext()->format().samples() <= 1) {
m_multisampling = false;
} else {
QList<QByteArray> extensions = QByteArray((const char *)glGetString(GL_EXTENSIONS)).split(' ');
@@ -342,7 +358,7 @@ void QQuickShaderEffectTexture::grab()
QOpenGLFramebufferObjectFormat format;
format.setInternalTextureFormat(m_format);
- format.setSamples(m_context->glContext()->format().samples());
+ format.setSamples(m_context->openglContext()->format().samples());
m_secondaryFbo = new QOpenGLFramebufferObject(m_size, format);
m_depthStencilBuffer = m_context->depthStencilBufferForFbo(m_secondaryFbo);
} else {
@@ -385,20 +401,16 @@ void QQuickShaderEffectTexture::grab()
#ifdef QSG_DEBUG_FBO_OVERLAY
if (qmlFboOverlay()) {
if (!m_debugOverlay)
- m_debugOverlay = m_context->createRectangleNode();
+ m_debugOverlay = new QSGSimpleRectNode();
m_debugOverlay->setRect(QRectF(0, 0, m_size.width(), m_size.height()));
m_debugOverlay->setColor(QColor(0xff, 0x00, 0x80, 0x40));
- m_debugOverlay->setPenColor(QColor());
- m_debugOverlay->setPenWidth(0);
- m_debugOverlay->setRadius(0);
- m_debugOverlay->update();
root->appendChildNode(m_debugOverlay);
}
#endif
m_dirtyTexture = false;
- QOpenGLContext *ctx = m_context->glContext();
+ QOpenGLContext *ctx = m_context->openglContext();
m_renderer->setDeviceRect(m_size);
m_renderer->setViewportRect(m_size);
QRectF mirrored(m_rect.left(), m_rect.bottom(), m_rect.width(), -m_rect.height());
@@ -591,8 +603,8 @@ void QQuickShaderEffectSource::ensureTexture()
return;
Q_ASSERT_X(QQuickItemPrivate::get(this)->window
- && QQuickItemPrivate::get(this)->sceneGraphContext()
- && QThread::currentThread() == QQuickItemPrivate::get(this)->sceneGraphContext()->thread(),
+ && QQuickItemPrivate::get(this)->sceneGraphRenderContext()
+ && QThread::currentThread() == QQuickItemPrivate::get(this)->sceneGraphRenderContext()->thread(),
"QQuickShaderEffectSource::ensureTexture",
"Cannot be used outside the rendering thread");
@@ -603,13 +615,13 @@ void QQuickShaderEffectSource::ensureTexture()
QSGTextureProvider *QQuickShaderEffectSource::textureProvider() const
{
+ const QQuickItemPrivate *d = QQuickItemPrivate::get(this);
+ if (!d->window || !d->sceneGraphRenderContext() || QThread::currentThread() != d->sceneGraphRenderContext()->thread()) {
+ qWarning("QQuickShaderEffectSource::textureProvider: can only be queried on the rendering thread of an exposed window");
+ return 0;
+ }
+
if (!m_provider) {
- // Make sure it gets thread affinity on the rendering thread so deletion works properly..
- Q_ASSERT_X(QQuickItemPrivate::get(this)->window
- && QQuickItemPrivate::get(this)->sceneGraphContext()
- && QThread::currentThread() == QQuickItemPrivate::get(this)->sceneGraphContext()->thread(),
- "QQuickShaderEffectSource::textureProvider",
- "Cannot be used outside the rendering thread");
const_cast<QQuickShaderEffectSource *>(this)->m_provider = new QQuickShaderEffectSourceTextureProvider();
const_cast<QQuickShaderEffectSource *>(this)->ensureTexture();
connect(m_texture, SIGNAL(updateRequested()), m_provider, SIGNAL(textureChanged()));
diff --git a/src/quick/items/qquickshadereffectsource_p.h b/src/quick/items/qquickshadereffectsource_p.h
index 7d1a9b7304..6218775700 100644
--- a/src/quick/items/qquickshadereffectsource_p.h
+++ b/src/quick/items/qquickshadereffectsource_p.h
@@ -60,6 +60,7 @@ QT_BEGIN_NAMESPACE
class QSGNode;
class UpdatePaintNodeData;
class QOpenGLFramebufferObject;
+class QSGSimpleRectNode;
class QQuickShaderEffectSourceTextureProvider;
@@ -138,11 +139,13 @@ private:
QOpenGLFramebufferObject *m_secondaryFbo;
QSharedPointer<QSGDepthStencilBuffer> m_depthStencilBuffer;
+ GLuint m_transparentTexture;
+
#ifdef QSG_DEBUG_FBO_OVERLAY
- QSGRectangleNode *m_debugOverlay;
+ QSGSimpleRectNode *m_debugOverlay;
#endif
- QSGContext *m_context;
+ QSGRenderContext *m_context;
uint m_mipmap : 1;
uint m_live : 1;
diff --git a/src/quick/items/qquicksprite.cpp b/src/quick/items/qquicksprite.cpp
index b2bfb69bab..00a265c814 100644
--- a/src/quick/items/qquicksprite.cpp
+++ b/src/quick/items/qquicksprite.cpp
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
can be in the middle of an image file, or split along multiple rows, as long as they form
a contiguous line wrapping to the next row of the file from the left edge of the file.
- For full details, see the \l{Sprite Animation} overview.
+ For full details, see the \l{Sprite Animations} overview.
*/
/*!
\qmlproperty int QtQuick::Sprite::duration
diff --git a/src/quick/items/qquickspritesequence.cpp b/src/quick/items/qquickspritesequence.cpp
index 3c1492e0b3..a90aa9ace2 100644
--- a/src/quick/items/qquickspritesequence.cpp
+++ b/src/quick/items/qquickspritesequence.cpp
@@ -56,39 +56,6 @@
QT_BEGIN_NAMESPACE
-static const char vertexShaderCode[] =
- "attribute highp vec2 vPos;\n"
- "attribute highp vec2 vTex;\n"
- "uniform highp vec3 animData;// w,h(premultiplied of anim), interpolation progress\n"
- "uniform highp vec4 animPos;//x,y, x,y (two frames for interpolation)\n"
- "\n"
- "uniform highp mat4 qt_Matrix;\n"
- "\n"
- "varying highp vec4 fTexS;\n"
- "varying lowp float progress;\n"
- "\n"
- "\n"
- "void main() {\n"
- " progress = animData.z;\n"
- " //Calculate frame location in texture\n"
- " fTexS.xy = animPos.xy + vTex.xy * animData.xy;\n"
- " //Next frame is also passed, for interpolation\n"
- " fTexS.zw = animPos.zw + vTex.xy * animData.xy;\n"
- "\n"
- " gl_Position = qt_Matrix * vec4(vPos.x, vPos.y, 0, 1);\n"
- "}\n";
-
-static const char fragmentShaderCode[] =
- "uniform sampler2D _qt_texture;\n"
- "uniform lowp float qt_Opacity;\n"
- "\n"
- "varying highp vec4 fTexS;\n"
- "varying lowp float progress;\n"
- "\n"
- "void main() {\n"
- " gl_FragColor = mix(texture2D(_qt_texture, fTexS.xy), texture2D(_qt_texture, fTexS.zw), progress) * qt_Opacity;\n"
- "}\n";
-
class QQuickSpriteSequenceMaterial : public QSGMaterial
{
public:
@@ -133,16 +100,11 @@ QQuickSpriteSequenceMaterial::~QQuickSpriteSequenceMaterial()
class SpriteSequenceMaterialData : public QSGMaterialShader
{
public:
- SpriteSequenceMaterialData(const char * /* vertexFile */ = 0, const char * /* fragmentFile */ = 0)
+ SpriteSequenceMaterialData()
+ : QSGMaterialShader()
{
- }
-
- void deactivate() {
- QSGMaterialShader::deactivate();
-
- for (int i=0; i<8; ++i) {
- program()->setAttributeArray(i, GL_FLOAT, chunkOfBytes, 1, 0);
- }
+ setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/items/shaders/sprite.vert"));
+ setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/items/shaders/sprite.frag"));
}
virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *)
@@ -165,9 +127,6 @@ public:
m_animPos_id = program()->uniformLocation("animPos");
}
- virtual const char *vertexShader() const { return vertexShaderCode; }
- virtual const char *fragmentShader() const { return fragmentShaderCode; }
-
virtual char const *const *attributeNames() const {
static const char *attr[] = {
"vPos",
@@ -181,12 +140,8 @@ public:
int m_opacity_id;
int m_animData_id;
int m_animPos_id;
-
- static float chunkOfBytes[1024];
};
-float SpriteSequenceMaterialData::chunkOfBytes[1024];
-
QSGMaterialShader *QQuickSpriteSequenceMaterial::createShader() const
{
return new SpriteSequenceMaterialData;
@@ -217,7 +172,7 @@ struct SpriteVertices {
SpriteSequence renders and controls a list of animations defined
by \l Sprite types.
- For full details, see the \l{Sprite Animation} overview.
+ For full details, see the \l{Sprite Animations} overview.
*/
/*!
\qmlproperty bool QtQuick::SpriteSequence::running
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index fbda2df2dc..d62bf8efa1 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -107,7 +107,6 @@ void QQuickTextPrivate::init()
Q_Q(QQuickText);
q->setAcceptedMouseButtons(Qt::LeftButton);
q->setFlag(QQuickItem::ItemHasContents);
- q->setAcceptHoverEvents(true);
}
QQuickTextDocumentWithImageResources::QQuickTextDocumentWithImageResources(QQuickItem *parent)
@@ -1523,6 +1522,7 @@ void QQuickText::setText(const QString &n)
qDeleteAll(d->imgTags);
d->imgTags.clear();
d->updateLayout();
+ setAcceptHoverEvents(d->richText || d->styledText);
emit textChanged(d->text);
}
@@ -2002,6 +2002,7 @@ void QQuickText::setTextFormat(TextFormat format)
d->determineHorizontalAlignment();
}
d->updateLayout();
+ setAcceptHoverEvents(d->richText || d->styledText);
emit textFormatChanged(d->format);
}
@@ -2241,11 +2242,10 @@ QSGNode *QQuickText::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data
const qreal dy = QQuickTextUtil::alignedY(d->layedOutTextRect.height(), height(), d->vAlign);
QQuickTextNode *node = 0;
- if (!oldNode) {
- node = new QQuickTextNode(QQuickItemPrivate::get(this)->sceneGraphContext(), this);
- } else {
+ if (!oldNode)
+ node = new QQuickTextNode(this);
+ else
node = static_cast<QQuickTextNode *>(oldNode);
- }
node->setUseNativeRenderer(d->renderType == NativeRendering && d->window->devicePixelRatio() <= 1);
node->deleteContent();
@@ -2635,34 +2635,34 @@ void QQuickTextPrivate::processHoverEvent(QHoverEvent *event)
{
Q_Q(QQuickText);
QString link;
- if (event->type() != QEvent::HoverLeave)
- link = anchorAt(event->posF());
+ if (isLinkHoveredConnected()) {
+ if (event->type() != QEvent::HoverLeave)
+ link = anchorAt(event->posF());
- if ((!extra.isAllocated() && !link.isEmpty()) || (extra.isAllocated() && extra->hoveredLink != link)) {
- extra.value().hoveredLink = link;
- emit q->linkHovered(extra->hoveredLink);
+ if ((!extra.isAllocated() && !link.isEmpty()) || (extra.isAllocated() && extra->hoveredLink != link)) {
+ extra.value().hoveredLink = link;
+ emit q->linkHovered(extra->hoveredLink);
+ }
}
+ event->setAccepted(!link.isEmpty());
}
void QQuickText::hoverEnterEvent(QHoverEvent *event)
{
Q_D(QQuickText);
- if (d->isLinkHoveredConnected())
- d->processHoverEvent(event);
+ d->processHoverEvent(event);
}
void QQuickText::hoverMoveEvent(QHoverEvent *event)
{
Q_D(QQuickText);
- if (d->isLinkHoveredConnected())
- d->processHoverEvent(event);
+ d->processHoverEvent(event);
}
void QQuickText::hoverLeaveEvent(QHoverEvent *event)
{
Q_D(QQuickText);
- if (d->isLinkHoveredConnected())
- d->processHoverEvent(event);
+ d->processHoverEvent(event);
}
QT_END_NAMESPACE
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index 48518f1ba3..ffc732621d 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -1769,6 +1769,9 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
d->updateType = QQuickTextEditPrivate::UpdateNone;
+ if (!oldNode) // If we had any text node references, they were deleted along with the root node
+ d->textNodeMap.clear();
+
RootNode *rootNode = static_cast<RootNode *>(oldNode);
TextNodeIterator nodeIterator = d->textNodeMap.begin();
while (nodeIterator != d->textNodeMap.end() && !(*nodeIterator)->dirty())
@@ -2367,7 +2370,7 @@ void QQuickTextEditPrivate::addCurrentTextNodeToRoot(QSGTransformNode *root, QQu
QQuickTextNode *QQuickTextEditPrivate::createTextNode()
{
Q_Q(QQuickTextEdit);
- QQuickTextNode* node = new QQuickTextNode(QQuickItemPrivate::get(q)->sceneGraphContext(), q);
+ QQuickTextNode* node = new QQuickTextNode(q);
node->setUseNativeRenderer(renderType == QQuickTextEdit::NativeRendering && window->devicePixelRatio() <= 1);
node->initEngine(color, selectedTextColor, selectionColor);
return node;
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 1848fbb80b..c56f3648e6 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -1212,6 +1212,17 @@ bool QQuickTextInput::hasAcceptableInput() const
state.
*/
+/*!
+ \qmlsignal QtQuick::TextInput::onEditingFinished()
+ \since 5.2
+
+ This handler is called when the Return or Enter key is pressed or
+ the text input loses focus. Note that if there is a validator or
+ inputMask set on the text input and enter/return is pressed, this
+ handler will only be called if the input follows
+ the inputMask and the validator returns an acceptable state.
+*/
+
#ifndef QT_NO_IM
Qt::InputMethodHints QQuickTextInputPrivate::effectiveInputMethodHints() const
{
@@ -1834,7 +1845,7 @@ QSGNode *QQuickTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
QQuickTextNode *node = static_cast<QQuickTextNode *>(oldNode);
if (node == 0)
- node = new QQuickTextNode(QQuickItemPrivate::get(this)->sceneGraphContext(), this);
+ node = new QQuickTextNode(this);
d->textNode = node;
if (!d->textLayoutDirty && oldNode != 0) {
@@ -2522,6 +2533,9 @@ void QQuickTextInputPrivate::handleFocusEvent(QFocusEvent *event)
&& !persistentSelection)
deselect();
+ if (hasAcceptableInput(m_text) || fixup())
+ emit q->editingFinished();
+
#ifndef QT_NO_IM
q->disconnect(qApp->inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),
q, SLOT(q_updateAlignment()));
@@ -3378,7 +3392,6 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo
*/
void QQuickTextInputPrivate::internalSetText(const QString &txt, int pos, bool edited)
{
- Q_Q(QQuickTextInput);
internalDeselect();
QString oldText = m_text;
if (m_maskData) {
@@ -3396,6 +3409,7 @@ void QQuickTextInputPrivate::internalSetText(const QString &txt, int pos, bool e
#ifdef QT_NO_ACCESSIBILITY
Q_UNUSED(changed)
#else
+ Q_Q(QQuickTextInput);
if (changed && QAccessible::isActive()) {
if (QObject *acc = QQuickAccessibleAttached::findAccessible(q, QAccessible::EditableText)) {
QAccessibleTextUpdateEvent ev(acc, 0, oldText, m_text);
@@ -4105,6 +4119,7 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event)
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
if (hasAcceptableInput(m_text) || fixup()) {
emit q->accepted();
+ emit q->editingFinished();
}
event->ignore();
return;
diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h
index 2b72afb9dc..5f0250aaf1 100644
--- a/src/quick/items/qquicktextinput_p.h
+++ b/src/quick/items/qquicktextinput_p.h
@@ -284,6 +284,7 @@ Q_SIGNALS:
void selectedTextChanged();
void accepted();
void acceptableInputChanged();
+ Q_REVISION(2) void editingFinished();
void colorChanged();
void selectionColorChanged();
void selectedTextColorChanged();
diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp
index 1f4ca34b13..18ee1a479d 100644
--- a/src/quick/items/qquicktextnode.cpp
+++ b/src/quick/items/qquicktextnode.cpp
@@ -47,6 +47,7 @@
#include <private/qsgadaptationlayer_p.h>
#include <private/qsgdistancefieldglyphnode_p.h>
#include <private/qquickclipnode_p.h>
+#include <private/qquickitem_p.h>
#include <QtQuick/private/qsgcontext_p.h>
#include <QtCore/qpoint.h>
@@ -80,8 +81,8 @@ namespace {
/*!
Creates an empty QQuickTextNode
*/
-QQuickTextNode::QQuickTextNode(QSGContext *context, QQuickItem *ownerElement)
- : m_context(context), m_cursorNode(0), m_ownerElement(ownerElement), m_useNativeRenderer(false)
+QQuickTextNode::QQuickTextNode(QQuickItem *ownerElement)
+ : m_cursorNode(0), m_ownerElement(ownerElement), m_useNativeRenderer(false)
{
#ifdef QSG_RUNTIME_DESCRIPTION
qsgnode_set_description(this, QLatin1String("text"));
@@ -141,9 +142,14 @@ QSGGlyphNode *QQuickTextNode::addGlyphs(const QPointF &position, const QGlyphRun
QQuickText::TextStyle style, const QColor &styleColor,
QSGNode *parentNode)
{
- QSGGlyphNode *node = m_useNativeRenderer
- ? m_context->createNativeGlyphNode()
- : m_context->createGlyphNode();
+ QSGRenderContext *sg = QQuickItemPrivate::get(m_ownerElement)->sceneGraphRenderContext();
+ QRawFont font = glyphs.rawFont();
+ bool smoothScalable = QFontDatabase().isSmoothlyScalable(font.familyName(),
+ font.styleName());
+ QSGGlyphNode *node = m_useNativeRenderer || !smoothScalable
+ ? sg->sceneGraphContext()->createNativeGlyphNode(sg)
+ : sg->sceneGraphContext()->createGlyphNode(sg);
+
node->setOwnerElement(m_ownerElement);
node->setGlyphs(position + QPointF(0, glyphs.rawFont().ascent()), glyphs);
node->setStyle(style);
@@ -189,8 +195,9 @@ void QQuickTextNode::initEngine(const QColor& textColor, const QColor& selectedT
void QQuickTextNode::addImage(const QRectF &rect, const QImage &image)
{
- QSGImageNode *node = m_context->createImageNode();
- QSGTexture *texture = m_context->createTexture(image);
+ QSGRenderContext *sg = QQuickItemPrivate::get(m_ownerElement)->sceneGraphRenderContext();
+ QSGImageNode *node = sg->sceneGraphContext()->createImageNode();
+ QSGTexture *texture = sg->createTexture(image);
m_textures.append(texture);
node->setTargetRect(rect);
node->setInnerTargetRect(rect);
diff --git a/src/quick/items/qquicktextnode_p.h b/src/quick/items/qquicktextnode_p.h
index 64f396eb10..0bff0d5cff 100644
--- a/src/quick/items/qquicktextnode_p.h
+++ b/src/quick/items/qquicktextnode_p.h
@@ -77,7 +77,7 @@ public:
};
Q_DECLARE_FLAGS(Decorations, Decoration)
- QQuickTextNode(QSGContext *, QQuickItem *ownerElement);
+ QQuickTextNode(QQuickItem *ownerElement);
~QQuickTextNode();
static bool isComplexRichText(QTextDocument *);
@@ -110,7 +110,6 @@ private:
void initEngine(const QColor &textColor, const QColor &selectedTextColor, const QColor &selectionColor, const QColor& anchorColor = QColor()
, const QPointF &position = QPointF());
- QSGContext *m_context;
QSGSimpleRectNode *m_cursorNode;
QList<QSGTexture *> m_textures;
QQuickItem *m_ownerElement;
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp
index fe7effa4f1..e9ff70e00b 100644
--- a/src/quick/items/qquicktextnodeengine.cpp
+++ b/src/quick/items/qquicktextnodeengine.cpp
@@ -898,8 +898,8 @@ void QQuickTextNodeEngine::addTextBlock(QTextDocument *textDocument, const QText
int fragmentEnd = textPos + fragment.length();
#ifndef QT_NO_IM
if (preeditPosition >= 0
- && preeditPosition >= textPos
- && preeditPosition <= fragmentEnd) {
+ && (preeditPosition + block.position()) >= textPos
+ && (preeditPosition + block.position()) <= fragmentEnd) {
fragmentEnd += preeditLength;
}
#endif
diff --git a/src/quick/items/qquicktranslate.cpp b/src/quick/items/qquicktranslate.cpp
index 1ea5a6f7d6..93104ffa7a 100644
--- a/src/quick/items/qquicktranslate.cpp
+++ b/src/quick/items/qquicktranslate.cpp
@@ -335,7 +335,7 @@ public:
\image axisrotation.png
- \sa {declarative/ui-components/dialcontrol}{Dial Control example}, {declarative/toys/clocks}{Clocks example}
+ \sa {declarative/ui-components/dialcontrol}{Dial Control example}, {Qt Quick Demo - Clocks}
*/
QQuickRotation::QQuickRotation(QObject *parent)
: QQuickTransform(*new QQuickRotationPrivate, parent)
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 894059e193..a993889c45 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -50,8 +50,6 @@
#include <QtQuick/private/qsgrenderer_p.h>
#include <QtQuick/private/qsgtexture_p.h>
-#include <QtQuick/private/qsgflashnode_p.h>
-
#include <private/qsgrenderloop_p.h>
#include <private/qquickanimatorcontroller_p.h>
@@ -218,6 +216,7 @@ void QQuickWindow::exposeEvent(QExposeEvent *)
/*! \reimp */
void QQuickWindow::resizeEvent(QResizeEvent *)
{
+ d_func()->windowManager->resize(this);
}
/*! \reimp */
@@ -416,12 +415,13 @@ void QQuickWindowPrivate::init(QQuickWindow *c)
contentItemPrivate->flags |= QQuickItem::ItemIsFocusScope;
windowManager = QSGRenderLoop::instance();
- context = windowManager->sceneGraphContext();
+ QSGContext *sg = windowManager->sceneGraphContext();
+ context = windowManager->createRenderContext(sg);
q->setSurfaceType(QWindow::OpenGLSurface);
- q->setFormat(context->defaultSurfaceFormat());
+ q->setFormat(sg->defaultSurfaceFormat());
animationController = new QQuickAnimatorController();
- animationController->window = q;
+ animationController->m_window = q;
QObject::connect(context, SIGNAL(initialized()), q, SIGNAL(sceneGraphInitialized()), Qt::DirectConnection);
QObject::connect(context, SIGNAL(invalidated()), q, SIGNAL(sceneGraphInvalidated()), Qt::DirectConnection);
@@ -666,14 +666,18 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, Q
QVarLengthArray<QQuickItem *, 20> changed;
// Does this change the active focus?
- if (item == contentItem || (scopePrivate->activeFocus && item->isEnabled())) {
+ if (item == contentItem || scopePrivate->activeFocus) {
QQuickItem *oldActiveFocusItem = 0;
oldActiveFocusItem = activeFocusItem;
- newActiveFocusItem = item;
- while (newActiveFocusItem->isFocusScope()
- && newActiveFocusItem->scopedFocusItem()
- && newActiveFocusItem->scopedFocusItem()->isEnabled()) {
- newActiveFocusItem = newActiveFocusItem->scopedFocusItem();
+ if (item->isEnabled()) {
+ newActiveFocusItem = item;
+ while (newActiveFocusItem->isFocusScope()
+ && newActiveFocusItem->scopedFocusItem()
+ && newActiveFocusItem->scopedFocusItem()->isEnabled()) {
+ newActiveFocusItem = newActiveFocusItem->scopedFocusItem();
+ }
+ } else {
+ newActiveFocusItem = scope;
}
if (oldActiveFocusItem) {
@@ -772,23 +776,24 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item,
oldActiveFocusItem = activeFocusItem;
newActiveFocusItem = scope;
- Q_ASSERT(oldActiveFocusItem);
-
#ifndef QT_NO_IM
qApp->inputMethod()->commit();
#endif
activeFocusItem = 0;
- QFocusEvent event(QEvent::FocusOut, reason);
- q->sendEvent(oldActiveFocusItem, &event);
- QQuickItem *afi = oldActiveFocusItem;
- while (afi && afi != scope) {
- if (QQuickItemPrivate::get(afi)->activeFocus) {
- QQuickItemPrivate::get(afi)->activeFocus = false;
- changed << afi;
+ if (oldActiveFocusItem) {
+ QFocusEvent event(QEvent::FocusOut, reason);
+ q->sendEvent(oldActiveFocusItem, &event);
+
+ QQuickItem *afi = oldActiveFocusItem;
+ while (afi && afi != scope) {
+ if (QQuickItemPrivate::get(afi)->activeFocus) {
+ QQuickItemPrivate::get(afi)->activeFocus = false;
+ changed << afi;
+ }
+ afi = afi->parentItem();
}
- afi = afi->parentItem();
}
}
@@ -821,6 +826,11 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item,
notifyFocusChangesRecur(changed.data(), changed.count() - 1);
}
+void QQuickWindowPrivate::clearFocusObject()
+{
+ contentItem->setFocus(false, Qt::OtherFocusReason);
+}
+
void QQuickWindowPrivate::notifyFocusChangesRecur(QQuickItem **items, int remaining)
{
QPointer<QQuickItem> item(*items);
@@ -862,7 +872,7 @@ void QQuickWindowPrivate::cleanup(QSGNode *n)
/*!
\qmltype Window
\instantiates QQuickWindow
- \inqmlmodule QtQuick.Window 2
+ \inqmlmodule QtQuick.Window
\ingroup qtquick-visual
\brief Creates a new top-level window
@@ -2136,7 +2146,7 @@ bool QQuickWindowPrivate::dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent
}
/*!
- \qmlproperty list<Object> QtQuick.Window::Window::data
+ \qmlproperty list<Object> Window::data
\default
The data property allows you to freely mix visual children, resources
@@ -2345,10 +2355,6 @@ void QQuickWindowPrivate::updateDirtyNodes()
void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item)
{
-#ifdef QML_RUNTIME_TESTING
- bool didFlash = false;
-#endif
-
QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(item);
quint32 dirty = itemPriv->dirtyAttributes;
itemPriv->dirtyAttributes = 0;
@@ -2572,19 +2578,6 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item)
}
#endif
-#ifdef QML_RUNTIME_TESTING
- if (itemPriv->sceneGraphContext()->isFlashModeEnabled()) {
- QSGFlashNode *flash = new QSGFlashNode();
- flash->setRect(item->boundingRect());
- itemPriv->childContainerNode()->appendChildNode(flash);
- didFlash = true;
- }
- Q_Q(QQuickWindow);
- if (didFlash) {
- q->maybeUpdate();
- }
-#endif
-
}
void QQuickWindow::maybeUpdate()
@@ -2624,9 +2617,7 @@ void QQuickWindow::setTransientParent_helper(QQuickWindow *window)
QOpenGLContext *QQuickWindow::openglContext() const
{
Q_D(const QQuickWindow);
- if (d->context->isReady())
- return d->context->glContext();
- return 0;
+ return d->context->openglContext();
}
/*!
@@ -2672,7 +2663,7 @@ QOpenGLContext *QQuickWindow::openglContext() const
/*!
\qmltype CloseEvent
\instantiates QQuickCloseEvent
- \inqmlmodule QtQuick.Window 2
+ \inqmlmodule QtQuick.Window
\ingroup qtquick-visual
\brief Notification that a \l Window is about to be closed
\since 5.1
@@ -2685,7 +2676,7 @@ QOpenGLContext *QQuickWindow::openglContext() const
*/
/*!
- \qmlproperty bool QtQuick.Window::CloseEvent::accepted
+ \qmlproperty bool CloseEvent::accepted
This property indicates whether the application will allow the user to
close the window. It is true by default.
@@ -2700,7 +2691,7 @@ QOpenGLContext *QQuickWindow::openglContext() const
*/
/*!
- \qmlsignal QtQuick.Window::closing(CloseEvent close)
+ \qmlsignal closing(CloseEvent close)
\since 5.1
This signal is emitted when the user tries to close the window.
@@ -2809,7 +2800,7 @@ QOpenGLFramebufferObject *QQuickWindow::renderTarget() const
Grabs the contents of the window and returns it as an image.
It is possible to call the grabWindow() function when the window is not
- visible. This requires that the window is \l{QWindow::create} {created}
+ visible. This requires that the window is \l{QWindow::create()} {created}
and has a valid size and that no other QQuickWindow instances are rendering
in the same process.
@@ -2822,7 +2813,7 @@ QImage QQuickWindow::grabWindow()
Q_D(QQuickWindow);
if (!isVisible()) {
- if (d->context->isReady()) {
+ if (d->context->openglContext()) {
qWarning("QQuickWindow::grabWindow: scene graph already in use");
return QImage();
}
@@ -2834,6 +2825,7 @@ QImage QQuickWindow::grabWindow()
QOpenGLContext context;
context.setFormat(requestedFormat());
+ context.setShareContext(QSGContext::sharedOpenGLContext());
context.create();
context.makeCurrent(this);
d->context->initialize(&context);
@@ -3019,7 +3011,7 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image) const
QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image, CreateTextureOptions options) const
{
Q_D(const QQuickWindow);
- if (d->context && d->context->isReady()) {
+ if (d->context && d->context->openglContext()) {
if (options & TextureCanUseAtlas)
return d->context->createTexture(image);
else
@@ -3047,7 +3039,7 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image, CreateText
QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, CreateTextureOptions options) const
{
Q_D(const QQuickWindow);
- if (d->context && d->context->isReady()) {
+ if (d->context && d->context->openglContext()) {
QSGPlainTexture *texture = new QSGPlainTexture();
texture->setTextureId(id);
texture->setHasAlphaChannel(options & TextureHasAlphaChannel);
@@ -3060,7 +3052,7 @@ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, Create
}
/*!
- \qmlproperty color QtQuick.Window::Window::color
+ \qmlproperty color Window::color
The background color for the window.
@@ -3189,7 +3181,7 @@ void QQuickWindow::resetOpenGLState()
}
/*!
- \qmlproperty string QtQuick.Window::Window::title
+ \qmlproperty string Window::title
The window's title in the windowing system.
@@ -3200,7 +3192,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty Qt::WindowModality QtQuick.Window::Window::modality
+ \qmlproperty Qt::WindowModality Window::modality
The modality of the window.
@@ -3210,7 +3202,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty Qt::WindowFlags QtQuick.Window::Window::flags
+ \qmlproperty Qt::WindowFlags Window::flags
The window flags of the window.
@@ -3223,10 +3215,10 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty int QtQuick.Window::Window::x
- \qmlproperty int QtQuick.Window::Window::y
- \qmlproperty int QtQuick.Window::Window::width
- \qmlproperty int QtQuick.Window::Window::height
+ \qmlproperty int Window::x
+ \qmlproperty int Window::y
+ \qmlproperty int Window::width
+ \qmlproperty int Window::height
Defines the window's position and size.
@@ -3241,8 +3233,8 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty int QtQuick.Window::Window::minimumWidth
- \qmlproperty int QtQuick.Window::Window::minimumHeight
+ \qmlproperty int Window::minimumWidth
+ \qmlproperty int Window::minimumHeight
\since 5.1
Defines the window's minimum size.
@@ -3252,8 +3244,8 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty int QtQuick.Window::Window::maximumWidth
- \qmlproperty int QtQuick.Window::Window::maximumHeight
+ \qmlproperty int Window::maximumWidth
+ \qmlproperty int Window::maximumHeight
\since 5.1
Defines the window's maximum size.
@@ -3263,7 +3255,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty bool QtQuick.Window::Window::visible
+ \qmlproperty bool Window::visible
Whether the window is visible on the screen.
@@ -3273,7 +3265,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty QWindow::Visibility QtQuick.Window::Window::visibility
+ \qmlproperty QWindow::Visibility Window::visibility
The screen-occupation state of the window.
@@ -3293,7 +3285,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty Qt::ScreenOrientation QtQuick.Window::Window::contentOrientation
+ \qmlproperty Qt::ScreenOrientation Window::contentOrientation
This is a hint to the window manager in case it needs to display
additional content like popups, dialogs, status bars, or similar
@@ -3314,7 +3306,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty real QtQuick.Window::Window::opacity
+ \qmlproperty real Window::opacity
The opacity of the window.
@@ -3331,7 +3323,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty Item QtQuick.Window::Window::activeFocusItem
+ \qmlproperty Item Window::activeFocusItem
\since 5.1
The item which currently has active focus or \c null if there is
@@ -3339,7 +3331,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty QtQuick.Window::Window::active
+ \qmlproperty Window::active
\since 5.1
The active status of the window.
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index 420b13eeff..5063b3b5db 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -64,7 +64,7 @@ class Q_QUICK_EXPORT QQuickWindow : public QWindow
Q_OBJECT
Q_PRIVATE_PROPERTY(QQuickWindow::d_func(), QQmlListProperty<QObject> data READ data DESIGNABLE false)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
- Q_PROPERTY(QQuickItem* contentItem READ contentItem CONSTANT FINAL)
+ Q_PROPERTY(QQuickItem* contentItem READ contentItem CONSTANT)
Q_PROPERTY(QQuickItem* activeFocusItem READ activeFocusItem NOTIFY activeFocusItemChanged REVISION 1)
Q_CLASSINFO("DefaultProperty", "data")
Q_DECLARE_PRIVATE(QQuickWindow)
@@ -143,7 +143,6 @@ Q_SIGNALS:
public Q_SLOTS:
void update();
- void forcePolish();
void releaseResources();
protected:
@@ -173,11 +172,12 @@ protected:
private Q_SLOTS:
void maybeUpdate();
void cleanupSceneGraph();
+ void forcePolish();
void setTransientParent_helper(QQuickWindow *window);
private:
friend class QQuickItem;
- friend class QQuickWindowRenderLoop;
+ friend class QQuickAnimatorController;
Q_DISABLE_COPY(QQuickWindow)
};
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index c02f7107d4..c23745b5f1 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -166,6 +166,7 @@ public:
void setFocusInScope(QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions = 0);
void clearFocusInScope(QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions = 0);
static void notifyFocusChangesRecur(QQuickItem **item, int remaining);
+ void clearFocusObject();
void updateFocusItemTransform();
@@ -194,7 +195,7 @@ public:
void fireFrameSwapped() { Q_EMIT q_func()->frameSwapped(); }
- QSGContext *context;
+ QSGRenderContext *context;
QSGRenderer *renderer;
QSGRenderLoop *windowManager;
diff --git a/src/quick/items/shaders/shadereffect.frag b/src/quick/items/shaders/shadereffect.frag
new file mode 100644
index 0000000000..c1c15ecb0c
--- /dev/null
+++ b/src/quick/items/shaders/shadereffect.frag
@@ -0,0 +1,9 @@
+varying highp vec2 qt_TexCoord0;
+
+uniform sampler2D source;
+uniform lowp float qt_Opacity;
+
+void main()
+{
+ gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity;
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/shadereffect.vert b/src/quick/items/shaders/shadereffect.vert
new file mode 100644
index 0000000000..ae1e84a50c
--- /dev/null
+++ b/src/quick/items/shaders/shadereffect.vert
@@ -0,0 +1,12 @@
+uniform highp mat4 qt_Matrix;
+
+attribute highp vec4 qt_Vertex;
+attribute highp vec2 qt_MultiTexCoord0;
+
+varying highp vec2 qt_TexCoord0;
+
+void main()
+{
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ gl_Position = qt_Matrix * qt_Vertex;
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/shadereffect_core.frag b/src/quick/items/shaders/shadereffect_core.frag
new file mode 100644
index 0000000000..2163753edc
--- /dev/null
+++ b/src/quick/items/shaders/shadereffect_core.frag
@@ -0,0 +1,13 @@
+#version 150 core
+
+in vec2 qt_TexCoord0;
+
+out vec4 fragColor;
+
+uniform sampler2D source;
+uniform float qt_Opacity;
+
+void main()
+{
+ fragColor = texture(source, qt_TexCoord0) * qt_Opacity;
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/shadereffect_core.vert b/src/quick/items/shaders/shadereffect_core.vert
new file mode 100644
index 0000000000..2ed2d47b5f
--- /dev/null
+++ b/src/quick/items/shaders/shadereffect_core.vert
@@ -0,0 +1,14 @@
+#version 150 core
+
+in vec4 qt_Vertex;
+in vec2 qt_MultiTexCoord0;
+
+out vec2 qt_TexCoord0;
+
+uniform mat4 qt_Matrix;
+
+void main()
+{
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ gl_Position = qt_Matrix * qt_Vertex;
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/shadereffectfallback.frag b/src/quick/items/shaders/shadereffectfallback.frag
new file mode 100644
index 0000000000..d279e54083
--- /dev/null
+++ b/src/quick/items/shaders/shadereffectfallback.frag
@@ -0,0 +1,4 @@
+void main()
+{
+ gl_FragColor = vec4(1., 0., 1., 1.);
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/shadereffectfallback.vert b/src/quick/items/shaders/shadereffectfallback.vert
new file mode 100644
index 0000000000..0a11a1d340
--- /dev/null
+++ b/src/quick/items/shaders/shadereffectfallback.vert
@@ -0,0 +1,8 @@
+uniform highp mat4 qt_Matrix;
+
+attribute highp vec4 v;
+
+void main()
+{
+ gl_Position = qt_Matrix * v;
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/shadereffectfallback_core.frag b/src/quick/items/shaders/shadereffectfallback_core.frag
new file mode 100644
index 0000000000..4abf124737
--- /dev/null
+++ b/src/quick/items/shaders/shadereffectfallback_core.frag
@@ -0,0 +1,8 @@
+#version 150 core
+
+out vec4 fragColor;
+
+void main()
+{
+ fragColor = vec4(1., 0., 1., 1.);
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/shadereffectfallback_core.vert b/src/quick/items/shaders/shadereffectfallback_core.vert
new file mode 100644
index 0000000000..b1ca84cc6d
--- /dev/null
+++ b/src/quick/items/shaders/shadereffectfallback_core.vert
@@ -0,0 +1,10 @@
+#version 150 core
+
+in vec4 v;
+
+uniform mat4 qt_Matrix;
+
+void main()
+{
+ gl_Position = qt_Matrix * v;
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/sprite.frag b/src/quick/items/shaders/sprite.frag
new file mode 100644
index 0000000000..e1fcb0f006
--- /dev/null
+++ b/src/quick/items/shaders/sprite.frag
@@ -0,0 +1,12 @@
+uniform sampler2D _qt_texture;
+uniform lowp float qt_Opacity;
+
+varying highp vec4 fTexS;
+varying lowp float progress;
+
+void main()
+{
+ gl_FragColor = mix(texture2D(_qt_texture, fTexS.xy),
+ texture2D(_qt_texture, fTexS.zw),
+ progress) * qt_Opacity;
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/sprite.vert b/src/quick/items/shaders/sprite.vert
new file mode 100644
index 0000000000..fc826f60b4
--- /dev/null
+++ b/src/quick/items/shaders/sprite.vert
@@ -0,0 +1,23 @@
+attribute highp vec2 vPos;
+attribute highp vec2 vTex;
+
+uniform highp vec3 animData;// w,h(premultiplied of anim), interpolation progress
+uniform highp vec4 animPos;//x,y, x,y (two frames for interpolation)
+
+uniform highp mat4 qt_Matrix;
+
+varying highp vec4 fTexS;
+varying lowp float progress;
+
+void main()
+{
+ progress = animData.z;
+
+ // Calculate frame location in texture
+ fTexS.xy = animPos.xy + vTex.xy * animData.xy;
+
+ // Next frame is also passed, for interpolation
+ fTexS.zw = animPos.zw + vTex.xy * animData.xy;
+
+ gl_Position = qt_Matrix * vec4(vPos.x, vPos.y, 0, 1);
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/sprite_core.frag b/src/quick/items/shaders/sprite_core.frag
new file mode 100644
index 0000000000..c1087a8754
--- /dev/null
+++ b/src/quick/items/shaders/sprite_core.frag
@@ -0,0 +1,16 @@
+#version 150 core
+
+in vec4 fTexS;
+in float progress;
+
+out vec4 fragColor;
+
+uniform sampler2D _qt_texture;
+uniform float qt_Opacity;
+
+void main()
+{
+ fragColor = mix(texture(_qt_texture, fTexS.xy),
+ texture(_qt_texture, fTexS.zw),
+ progress) * qt_Opacity;
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/sprite_core.vert b/src/quick/items/shaders/sprite_core.vert
new file mode 100644
index 0000000000..5027bf03fc
--- /dev/null
+++ b/src/quick/items/shaders/sprite_core.vert
@@ -0,0 +1,24 @@
+#version 150 core
+
+in vec2 vPos;
+in vec2 vTex;
+
+out vec4 fTexS;
+out float progress;
+
+uniform vec3 animData; // w,h(premultiplied of anim), interpolation progress
+uniform vec4 animPos; // x,y, x,y (two frames for interpolation)
+uniform mat4 qt_Matrix;
+
+void main()
+{
+ progress = animData.z;
+
+ // Calculate frame location in texture
+ fTexS.xy = animPos.xy + vTex.xy * animData.xy;
+
+ // Next frame is also passed, for interpolation
+ fTexS.zw = animPos.zw + vTex.xy * animData.xy;
+
+ gl_Position = qt_Matrix * vec4(vPos.x, vPos.y, 0, 1);
+} \ No newline at end of file