aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-06-13 23:10:03 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-06-13 23:10:03 +0200
commit9932617582470d717c97f8161a65133293c185c5 (patch)
tree1df48d67c6e5ca4aa8b7810fc9e717083b4199e3
parent7fde8a8d20da7fa00d974286fa903b3fee76d466 (diff)
parent17ee404f2678684674b9c5c0c523602953146e37 (diff)
Merge remote-tracking branch 'origin/5.3' into dev
Conflicts: src/quickwidgets/qquickwidget.cpp Change-Id: Id4b080aea713df68608847bb82570231e37ce536
-rw-r--r--examples/qml/xmlhttprequest/doc/src/xmlhttprequest.qdoc12
-rw-r--r--examples/quick/animation/doc/src/animation.qdoc73
-rw-r--r--examples/quick/canvas/doc/src/canvas.qdoc44
-rw-r--r--examples/quick/demos/stocqt/content/StockChart.qml189
-rw-r--r--examples/quick/demos/stocqt/content/StockModel.qml12
-rw-r--r--examples/quick/draganddrop/doc/src/draganddrop.qdoc28
-rw-r--r--examples/quick/externaldraganddrop/doc/src/externaldraganddrop.qdoc14
-rw-r--r--examples/quick/imageelements/doc/src/imageelements.qdoc44
-rw-r--r--examples/quick/keyinteraction/doc/src/keyinteraction.qdoc12
-rw-r--r--examples/quick/localstorage/doc/src/localstorage.qdoc12
-rw-r--r--examples/quick/mousearea/doc/src/mousearea.qdoc25
-rw-r--r--examples/quick/positioners/doc/src/positioners.qdoc33
-rw-r--r--examples/quick/quick-accessibility/doc/src/accessibility.qdoc17
-rw-r--r--examples/quick/quickwidgets/quickwidget/main.cpp6
-rw-r--r--examples/quick/righttoleft/doc/src/righttoleft.qdoc19
-rw-r--r--examples/quick/shadereffects/doc/src/shadereffects.qdoc30
-rw-r--r--examples/quick/text/doc/src/text.qdoc55
-rw-r--r--examples/quick/threading/doc/src/threading.qdoc33
-rw-r--r--examples/quick/touchinteraction/doc/src/touchinteraction.qdoc50
-rw-r--r--examples/quick/views/doc/src/views.qdoc69
-rw-r--r--examples/quick/window/doc/src/window.qdoc59
-rw-r--r--src/3rdparty/masm/yarr/YarrJIT.cpp2
-rw-r--r--src/particles/qquickellipseextruder.cpp8
-rw-r--r--src/qml/doc/src/cppintegration/exposecppattributes.qdoc2
-rw-r--r--src/qml/doc/src/javascript/expressions.qdoc85
-rw-r--r--src/qml/doc/src/javascript/hostenvironment.qdoc4
-rw-r--r--src/qml/doc/src/javascript/qmlglobalobject.qdoc7
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp8
-rw-r--r--src/qml/qml/qqmlengine.cpp1
-rw-r--r--src/quick/doc/src/examples.qdoc8
-rw-r--r--src/quick/items/qquickgridview.cpp2
-rw-r--r--src/quick/items/qquickitem.cpp2
-rw-r--r--src/quick/items/qquickitemview.cpp4
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp4
-rw-r--r--src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp4
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp2
-rw-r--r--src/quick/scenegraph/shaders/visualization.vert2
-rw-r--r--src/quick/scenegraph/util/qsgpainternode.cpp5
-rw-r--r--src/quickwidgets/qquickwidget.cpp73
-rw-r--r--src/quickwidgets/qquickwidget_p.h2
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp98
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp49
-rw-r--r--tests/auto/quick/qquickgridview/data/negativeDisplayMargin.qml116
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp44
-rw-r--r--tests/auto/quick/qquickitem2/data/keysforward.qml6
-rw-r--r--tests/auto/quick/qquicklistview/data/negativeDisplayMargin.qml115
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp44
-rw-r--r--tests/auto/quick/scenegraph/data/render_OpacityThroughBatchRoot.qml90
-rw-r--r--tests/auto/quick/scenegraph/tst_scenegraph.cpp9
49 files changed, 1231 insertions, 401 deletions
diff --git a/examples/qml/xmlhttprequest/doc/src/xmlhttprequest.qdoc b/examples/qml/xmlhttprequest/doc/src/xmlhttprequest.qdoc
index db0b9e0a03..579cc5f80f 100644
--- a/examples/qml/xmlhttprequest/doc/src/xmlhttprequest.qdoc
+++ b/examples/qml/xmlhttprequest/doc/src/xmlhttprequest.qdoc
@@ -30,9 +30,15 @@
\brief This is a collection of XMLHttpRequest examples
\image qml-xmlhttprequest-example.png
- This is a collection of small QML examples relating to XML HTTP request functionality.
+ \e XMLHttpRequest contains a small QML example demonstrating \l{Qt QML}'s
+ XMLHTTPRequest functionality. For more information, visit the section about
+ \l{QML Global Object#XMLHttpRequest}{XMLHttpRequest}.
- Get data demos sending get XML request and showing the received header and XML body.
+ \include examples-run.qdocinc
-*/
+ \section1 Get data
+ \e{Get data} uses the XMLHttpRequest API to fetch an XML document from a
+ server. It displays the header of the HTTP response and the body of the XML
+ document.
+*/
diff --git a/examples/quick/animation/doc/src/animation.qdoc b/examples/quick/animation/doc/src/animation.qdoc
index 34a1eeb488..c76a53723b 100644
--- a/examples/quick/animation/doc/src/animation.qdoc
+++ b/examples/quick/animation/doc/src/animation.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -32,44 +32,81 @@
\image qml-animations-example.png
\ingroup qtquickexamples
- This is a collection of small QML examples relating to animation. Each example is
- a small QML file emphasizing a particular type or feature.
+ \e Animation is a collection of small QML examples relating to animation.
+ Each example is a small QML file emphasizing a particular type or feature.
- ColorAnimation demonstrates using a color animation to fade a sky from day to night.
+ For more information about animations, visit
+ \l{Important Concepts in Qt Quick - States, Transitions and Animations}.
+
+ \include examples-run.qdocinc
+
+ \section1 ColorAnimation
+
+ \e ColorAnimation uses color animations to fade a sky from day to
+ night.
\snippet animation/basics/color-animation.qml 0
- PropertyAnimation demonstrates using a number animation to bounce a circle up and down.
+ \section1 PropertyAnimation
+
+ \e PropertyAnimation uses number animations to bounce a
+ circle up and down.
\snippet animation/basics/property-animation.qml 0
- Animators demonstrates using a animators to bounce an icon up and down.
+ \section1 Animators
+
+ \e Animators uses animators to bounce an icon up and down.
\snippet animation/basics/animators.qml 0
- Behaviors demonstrates using behaviors to animate moving a rectangle to whereever you click.
+ \section1 Behaviors
+
+ \e Behaviors uses behaviors to move a rectangle to where you click.
\snippet animation/behaviors/behavior-example.qml 0
- Wiggly Text demonstrates using more complex behaviors to animate and wiggle some text around as you drag it.
- It does this by assigning a complex binding to each letter:
+ \section1 Wiggly Text
+
+ \e{Wiggly Text} demonstrates using more complex behaviors to animate and
+ wiggle some text around as you drag it. It does this by assigning a complex
+ binding to each letter:
\snippet animation/behaviors/wigglytext.qml 0
- Then, it uses behaviors to animate the movement on each letter:
+
+ Then, it uses behaviors to animate the movement of each letter:
\snippet animation/behaviors/wigglytext.qml 1
- Tv Tennis demonstrates using more complex behaviors to get paddles following a ball for an infinite game.
- Again a binding which depends on other values is applied to the position and a behavior provided the animation.
+ \section1 Tv Tennis
+
+ \e{Tv Tennis} uses complex behaviors to make the paddles follow a ball to
+ simulate an infinite tennis game. Again, a binding which depends on other
+ values is applied to the position and a behavior provided the animation.
\snippet animation/behaviors/tvtennis.qml 0
- Easing Curves shows off all the easing curves available in Qt Quick animations.
+ \section1 Easing Curves
+
+ \e{Easing Curves} shows off all the easing curves available in Qt Quick
+ animations.
+
+ \section1 States
+
+ \e States demonstrates how the properties of an item can vary between
+ \l{Qt Quick States}{states}.
- States demonstrates how the properties of an item can vary between states.
It defines several states:
\snippet animation/states/states.qml 0
- Note that there is also the implicit 'base state' from properties set directly on objects.
- Transitions takes the States example and animates the property changes by setting transitions:
+ \section1 Transitions
+
+ \e Transitions takes the States example and animates the property changes
+ by setting transitions:
\snippet animation/states/transitions.qml 0
- PathAnimation animates an image along a beizer curve using a PathAnimation.
+ \section1 PathAnimation
+
+ \e PathAnimation animates an image along a bezier curve using a
+ \l PathAnimation.
\snippet animation/pathanimation/pathanimation.qml 0
- PathInterpolator animates an image along the same beizer curve, using a PathInterpolator instead.
+ \section1 PathInterpolator
+
+ \e PathInterpolator animates an image along the same bezier curve, using a
+ \l PathInterpolator instead.
\snippet animation/pathinterpolator/pathinterpolator.qml 0
*/
diff --git a/examples/quick/canvas/doc/src/canvas.qdoc b/examples/quick/canvas/doc/src/canvas.qdoc
index f3eb78e1d1..2c4bd1f752 100644
--- a/examples/quick/canvas/doc/src/canvas.qdoc
+++ b/examples/quick/canvas/doc/src/canvas.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -32,27 +32,49 @@
\image qml-canvas-example.png
\ingroup qtquickexamples
- This is a collection of small QML examples relating to Canvas item. Each example is
- a small QML file emphasizing a particular type or feature.
+ \e Canvas is a collection of small QML examples relating to the \l Canvas
+ type. Each example is a small QML file emphasizing a particular type or
+ feature.
- Red heart demonstrates using a bezierCurve API to stroke and fill a red heart.
+ \include examples-run.qdocinc
+
+ \section1 Red heart
+
+ \e{Red heart} uses the bezier curve API to stroke and fill a red heart.
\snippet canvas/bezierCurve/bezierCurve.qml 0
- Talk bubble demonstrates using a quadraticCurveTo API to stroke and fill a customized talk bubble:
+ \section1 Talk bubble
+
+ \e{Talk bubble} uses the quadraticCurveTo() API to stroke and fill a
+ customized talk bubble:
\snippet canvas/quadraticCurveTo/quadraticCurveTo.qml 0
- This example also demonstrates the fillText API:
+
+ This example also demonstrates the fillText() API:
\snippet canvas/quadraticCurveTo/quadraticCurveTo.qml 1
- Squircle demonstrates using a collection of simple moveTo/lineTo path APIs to draw a smooth squircle.
+ \section1 Squircle
+
+ \e Squircle uses a collection of simple moveTo() and lineTo() path APIs to
+ draw a smooth squircle.
- Rounded rectangle demonstrates using a collection if lineTo/arcTo path APIs to draw a rounded rectangle.
+ \section1 Rounded rectangle
- Smile face demonstrates using several complex path APIs to draw an fill a smile face.
+ \e{Rounded rectangle} uses a collection of lineTo() and arcTo() path APIs to
+ draw a rounded rectangle.
- Clip demonstrates using clip API to clip a given image.
+ \section1 Smile face
+
+ \e{Smile face} uses several paths to draw and fill a smiling face.
+
+ \section1 Clip
+
+ \e Clip uses the clip API to clip a given image.
\snippet canvas/clip/clip.qml 0
- Tiger demonstrates using SVG path API to draw a tiger with a collection of SVG path strings.
+ \section1 Tiger
+
+ \e Tiger uses the SVG path API to draw a tiger with a collection
+ of SVG path strings.
\snippet canvas/tiger/tiger.qml 0
*/
diff --git a/examples/quick/demos/stocqt/content/StockChart.qml b/examples/quick/demos/stocqt/content/StockChart.qml
index e6bc02306e..2b97863f76 100644
--- a/examples/quick/demos/stocqt/content/StockChart.qml
+++ b/examples/quick/demos/stocqt/content/StockChart.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
@@ -44,25 +44,39 @@ Rectangle {
id: chart
width: 320
height: 200
- color: "transparent"
- property var _months: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]
property var stockModel: null
property var startDate: new Date()
property var endDate: new Date()
property string activeChart: "year"
property var settings
+ property int gridSize: 4
+ property real gridStep: gridSize ? (width - canvas.tickMargin) / gridSize : canvas.xGridStep
function update() {
endDate = new Date();
- if (chart.activeChart === "year")
- chart.startDate = new Date(chart.endDate.getFullYear() - 1, chart.endDate.getMonth(), chart.endDate.getDate());
- else if (chart.activeChart === "month")
- chart.startDate = new Date(chart.endDate.getFullYear() , chart.endDate.getMonth() -1, chart.endDate.getDate());
- else if (chart.activeChart === "week")
- chart.startDate = new Date(chart.endDate.getFullYear() , chart.endDate.getMonth(), chart.endDate.getDate() - 7);
- else
+ if (chart.activeChart === "year") {
+ chart.startDate = new Date(chart.endDate.getFullYear() - 1,
+ chart.endDate.getMonth(),
+ chart.endDate.getDate());
+ chart.gridSize = 12;
+ }
+ else if (chart.activeChart === "month") {
+ chart.startDate = new Date(chart.endDate.getFullYear(),
+ chart.endDate.getMonth() - 1,
+ chart.endDate.getDate());
+ gridSize = 0;
+ }
+ else if (chart.activeChart === "week") {
+ chart.startDate = new Date(chart.endDate.getFullYear(),
+ chart.endDate.getMonth(),
+ chart.endDate.getDate() - 7);
+ gridSize = 0;
+ }
+ else {
chart.startDate = new Date(2005, 3, 25);
+ gridSize = 4;
+ }
canvas.requestPaint();
}
@@ -121,40 +135,42 @@ Rectangle {
Text {
id: fromDate
color: "#000000"
- width: 50
font.family: "Open Sans"
- font.pointSize: 10
- wrapMode: Text.WordWrap
+ font.pointSize: 8
anchors.left: parent.left
- anchors.leftMargin: 20
anchors.bottom: parent.bottom
- text: _months[startDate.getMonth()] + "\n" + startDate.getFullYear()
+ text: "| " + startDate.toDateString()
}
Text {
id: toDate
color: "#000000"
- font.pointSize: 10
- width: 50
- wrapMode: Text.WordWrap
+ font.family: "Open Sans"
+ font.pointSize: 8
anchors.right: parent.right
- anchors.leftMargin: 20
+ anchors.rightMargin: canvas.tickMargin
anchors.bottom: parent.bottom
- text: _months[endDate.getMonth()] + "\n" + endDate.getFullYear()
+ text: endDate.toDateString() + " |"
}
Canvas {
id: canvas
+
+ // Uncomment below lines to use OpenGL hardware accelerated rendering.
+ // See Canvas documentation for available options.
+ // renderTarget: Canvas.FramebufferObject
+ // renderStrategy: Canvas.Threaded
+
anchors.top: activeChartRow.bottom
- anchors.left: chart.left
- anchors.right: chart.right
+ anchors.left: parent.left
+ anchors.right: parent.right
anchors.bottom: fromDate.top
- antialiasing: true
property int pixelSkip: 1
+ property int numPoints: 1
+ property int tickMargin: 32
- property real xGridOffset: width / 13
- property real xGridStep: width / 4
+ property real xGridStep: (width - tickMargin) / numPoints
property real yGridOffset: height / 26
property real yGridStep: height / 12
@@ -173,16 +189,17 @@ Rectangle {
// Vertical grid lines
var height = 35 * canvas.height / 36;
var yOffset = canvas.height - height;
- for (i = 0; i < 4; i++) {
- ctx.moveTo(canvas.xGridOffset + i * canvas.xGridStep, yOffset);
- ctx.lineTo(canvas.xGridOffset + i * canvas.xGridStep, height);
+ var xOffset = 0;
+ for (i = 0; i < chart.gridSize; i++) {
+ ctx.moveTo(xOffset + i * chart.gridStep, yOffset);
+ ctx.lineTo(xOffset + i * chart.gridStep, height);
}
ctx.stroke();
// Right ticks
ctx.strokeStyle = "#666666";
ctx.beginPath();
- var xStart = 35 * canvas.width / 36;
+ var xStart = canvas.width - tickMargin;
ctx.moveTo(xStart, 0);
ctx.lineTo(xStart, canvas.height);
for (i = 0; i < 12; i++) {
@@ -197,7 +214,30 @@ Rectangle {
ctx.restore();
}
- function drawPrice(ctx, from, to, color, price, points, highest)
+ function drawScales(ctx, high, low, vol)
+ {
+ ctx.save();
+ ctx.strokeStyle = "#888888";
+ ctx.font = "10px Open Sans"
+ ctx.beginPath();
+
+ // prices on y-axis
+ var x = canvas.width - tickMargin + 3;
+ var priceStep = (high - low) / 9.0;
+ for (var i = 0; i < 10; i += 2) {
+ var price = parseFloat(high - i * priceStep).toFixed(1);
+ ctx.text(price, x, canvas.yGridOffset + i * yGridStep - 2);
+ }
+
+ // highest volume
+ ctx.text(vol, 0, canvas.yGridOffset + 9 * yGridStep + 12);
+
+ ctx.closePath();
+ ctx.stroke();
+ ctx.restore();
+ }
+
+ function drawPrice(ctx, from, to, color, price, points, highest, lowest)
{
ctx.save();
ctx.globalAlpha = 0.7;
@@ -206,15 +246,19 @@ Rectangle {
ctx.beginPath();
var end = points.length;
- var xOffset = canvas.width / 36
+
+ var range = highest - lowest;
+ if (range == 0) {
+ range = 1;
+ }
for (var i = 0; i < end; i += pixelSkip) {
- var x = 34 * points[i].x / 36 + xOffset;
+ var x = points[i].x;
var y = points[i][price];
+ var h = 9 * yGridStep;
+
+ y = h * (lowest - y)/range + h + yGridOffset;
- y = canvas.height * y/highest;
- y = canvas.height - y;
- y = 9 * y / 12 + yGridOffset; // Scaling to graph area
if (i == 0) {
ctx.moveTo(x, y);
} else {
@@ -229,44 +273,65 @@ Rectangle {
{
ctx.save();
ctx.fillStyle = color;
- ctx.globalAlpha = 0.6;
- ctx.strokeStyle = Qt.rgba(0.8, 0.8, 0.8, 1);
- ctx.lineWidth = 1;
+ ctx.globalAlpha = 0.8;
+ ctx.lineWidth = 0;
+ ctx.beginPath();
var end = points.length;
- for (var i = 0; i < end; i+=pixelSkip) {
- var x = points[i].x;
+ var margin = 0;
+
+ if (chart.activeChart === "month" || chart.activeChart === "week") {
+ margin = 8;
+ ctx.shadowOffsetX = 4;
+ ctx.shadowBlur = 3.5;
+ ctx.shadowColor = Qt.darker(color);
+ }
+
+ // To match the volume graph with price grid, skip drawing the initial
+ // volume of the first day on chart.
+ for (var i = 1; i < end; i += pixelSkip) {
+ var x = points[i - 1].x;
var y = points[i][price];
- y = canvas.height * (1 - y/highest);
- y = 3 * y / 13;
- ctx.fillRect(x, canvas.height - y, canvas.width/points.length, y);
+ y = canvas.height * (y / highest);
+ y = 3 * y / 12;
+ ctx.fillRect(x, canvas.height - y + yGridOffset,
+ canvas.xGridStep - margin, y);
}
+
+ ctx.stroke();
ctx.restore();
}
onPaint: {
- var ctx = canvas.getContext("2d");
+ if (!stockModel.ready) {
+ return;
+ }
+ numPoints = stockModel.indexOf(chart.startDate);
+
+ if (chart.gridSize == 0)
+ chart.gridSize = numPoints
+
+ var ctx = canvas.getContext("2d");
ctx.globalCompositeOperation = "source-over";
ctx.lineWidth = 1;
drawBackground(ctx);
- if (!stockModel.ready) {
- return;
- }
-
- var last = stockModel.indexOf(chart.startDate);
- var first = 0;
-
- var highestPrice = stockModel.highestPrice;
- var highestVolume = stockModel.highestVolume;
+ var highestPrice = 0;
+ var highestVolume = 0;
+ var lowestPrice = -1;
var points = [];
- var step = canvas.width / (last + 0);
- for (var i = last, j = 0; i >= 0 ; i -= pixelSkip, j += pixelSkip) {
+ for (var i = numPoints, j = 0; i >= 0 ; i -= pixelSkip, j += pixelSkip) {
var price = stockModel.get(i);
+ if (parseFloat(highestPrice) < parseFloat(price.high))
+ highestPrice = price.high;
+ if (parseInt(highestVolume, 10) < parseInt(price.volume, 10))
+ highestVolume = price.volume;
+ if (lowestPrice < 0 || parseFloat(lowestPrice) > parseFloat(price.low))
+ lowestPrice = price.low;
points.push({
- x: j * step,
+ x: j * xGridStep,
open: price.open,
close: price.close,
high: price.high,
@@ -276,14 +341,16 @@ Rectangle {
}
if (settings.drawHighPrice)
- drawPrice(ctx, first, last, settings.highColor, "high", points, highestPrice);
+ drawPrice(ctx, 0, numPoints, settings.highColor, "high", points, highestPrice, lowestPrice);
if (settings.drawLowPrice)
- drawPrice(ctx, first, last, settings.lowColor, "low", points, highestPrice);
+ drawPrice(ctx, 0, numPoints, settings.lowColor, "low", points, highestPrice, lowestPrice);
if (settings.drawOpenPrice)
- drawPrice(ctx, first, last,settings.openColor, "open", points, highestPrice);
+ drawPrice(ctx, 0, numPoints,settings.openColor, "open", points, highestPrice, lowestPrice);
if (settings.drawClosePrice)
- drawPrice(ctx, first, last, settings.closeColor, "close", points, highestPrice);
- drawVolume(ctx, first, last, settings.volumeColor, "volume", points, highestVolume);
+ drawPrice(ctx, 0, numPoints, settings.closeColor, "close", points, highestPrice, lowestPrice);
+
+ drawVolume(ctx, 0, numPoints, settings.volumeColor, "volume", points, highestVolume);
+ drawScales(ctx, highestPrice, lowestPrice, highestVolume);
}
}
}
diff --git a/examples/quick/demos/stocqt/content/StockModel.qml b/examples/quick/demos/stocqt/content/StockModel.qml
index 682c96bb53..e3ae600aa0 100644
--- a/examples/quick/demos/stocqt/content/StockModel.qml
+++ b/examples/quick/demos/stocqt/content/StockModel.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,6 @@ ListModel {
property bool ready: false
property real stockPrice: 0.0
property real stockPriceChanged: 0.0
- property real highestPrice: 0
- property real highestVolume: 0
signal dataReady
@@ -111,10 +109,6 @@ ListModel {
}
function createStockPrice(r) {
- if (highestPrice < r[2])
- highestPrice = r[2];
- if (highestVolume < r[5])
- highestVolume = r[5];
return {
"date": r[0],
"open":r[1],
@@ -138,10 +132,6 @@ ListModel {
model.ready = false;
model.clear();
-
- highestPrice = 0;
- highestVolume = 0;
-
var i = 1; //skip the first line
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.LOADING || xhr.readyState === XMLHttpRequest.DONE) {
diff --git a/examples/quick/draganddrop/doc/src/draganddrop.qdoc b/examples/quick/draganddrop/doc/src/draganddrop.qdoc
index 2c62e271e6..909f2676bd 100644
--- a/examples/quick/draganddrop/doc/src/draganddrop.qdoc
+++ b/examples/quick/draganddrop/doc/src/draganddrop.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -31,11 +31,19 @@
\image qml-draganddrop-example.png
\ingroup qtquickexamples
- This is a collection of small QML examples relating to drag and drop functionality.
+ \e{Drag and Drop} is a collection of small QML examples relating to drag
+ and drop functionality. For more information, visit the \l{Drag and Drop}
+ page.
- \section2 Tiles adds drag and drop to simple rectangles, which you can drag into a specific grid.
+ \include examples-run.qdocinc
- It has a DragTile component which uses a MouseArea to move an item when dragged:
+ \section1 Tiles
+
+ \e Tiles adds drag and drop to simple rectangles, which you can drag into a
+ specific grid.
+
+ It has a DragTile component which uses a MouseArea to move an item when
+ dragged:
\snippet draganddrop/tiles/DragTile.qml 0
\snippet draganddrop/tiles/DragTile.qml 1
@@ -44,15 +52,15 @@
\snippet draganddrop/tiles/DropTile.qml 0
- The keys property of the DropArea will only allow an item with matching key in
- it's Drag.keys property to be dropped on it.
+ The keys property of the DropArea will only allow an item with a matching
+ key in its Drag.keys property to be dropped on it.
- \section2 GridView adds drag and drop to a GridView, allowing you to reorder the list.
+ \section1 GridView
- It uses a DelegateModel to move a delegate item to the position of another item
- it is dragged over.
+ \e GridView adds drag and drop to a \l GridView, allowing you to reorder the
+ list. It also uses a \l DelegateModel to move a delegate item to the
+ position of another item it is dragged over.
\snippet draganddrop/views/gridview.qml 0
\snippet draganddrop/views/gridview.qml 1
*/
-
diff --git a/examples/quick/externaldraganddrop/doc/src/externaldraganddrop.qdoc b/examples/quick/externaldraganddrop/doc/src/externaldraganddrop.qdoc
index 1251e6e1eb..51e5eddf04 100644
--- a/examples/quick/externaldraganddrop/doc/src/externaldraganddrop.qdoc
+++ b/examples/quick/externaldraganddrop/doc/src/externaldraganddrop.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -27,12 +27,18 @@
/*!
\title Qt Quick Examples - externaldraganddrop
\example externaldraganddrop
- \brief This is an example of drag and drop between Qml and other applications
+ \brief This is an example of drag-and-drop among QML applications.
\image qml-dnd2-example.png
\ingroup qtquickexamples
- This example shows you how to respond to do drag and drop using MouseArea and DropArea.
+ \e externaldraganddrop demonstrates how to perform drag and
+ drop with \l MouseArea and \l DropArea.
- Drag text between boxes, out of boxes into other applications, and from other applications into the boxes. Use option/ctrl to copy rather than move text when dragging between boxes.
+ The example allows you to drag the text to other boxes, out of boxes into
+ other applications, and from other applications into the boxes. Use the
+ option or CTRL keys to copy rather than move text when dragging between
+ boxes.
+
+ \include examples-run.qdocinc
*/
diff --git a/examples/quick/imageelements/doc/src/imageelements.qdoc b/examples/quick/imageelements/doc/src/imageelements.qdoc
index d88201faf9..07c09a02db 100644
--- a/examples/quick/imageelements/doc/src/imageelements.qdoc
+++ b/examples/quick/imageelements/doc/src/imageelements.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -31,29 +31,43 @@
\image qml-imageelements-example.png
\ingroup qtquickexamples
- This is a collection of small QML examples relating to image types.
+ \e{Image Elements} is a collection of small QML examples relating to image
+ types. For more information, visit \l{Use Case - Visual Elements In QML}.
- 'BorderImage' shows off the various scaling modes of the BorderImage item
- by setting its horizontalTileMode and verticalTileMode properties.
+ \include examples-run.qdocinc
- 'Image' shows off the various fill modes of the Image item.
+ \section1 BorderImage
- 'Shadows' shows how to create a drop shadow effect for a rectangular item
- using a BorderImage:
+ \e BorderImage shows off the various scaling modes of the \l BorderImage
+ type by setting its horizontalTileMode and verticalTileMode properties.
+
+ \section1 Image
+
+ \e Image shows off the various fill modes of the \l Image type.
+
+ \section1 Shadows
+
+ \e Shadows shows how to create a drop shadow effect for a rectangular item
+ using a \l BorderImage:
\snippet imageelements/content/ShadowRectangle.qml shadow
- 'AnimatedSprite' shows how to display a simple animation using an
- AnimatedSprite object:
+ \section1 AnimatedSprite
+
+ \e AnimatedSprite shows how to display a simple animation using an
+ \l AnimatedSprite object:
\snippet imageelements/animatedsprite.qml sprite
- The sprite animation will loop 3 times.
+ The sprite animation will loop three times.
+
+ \section1 SpriteSequence
- 'SpriteSequence' demonstrates using a sprite sequence to draw an animated
- and interactive bear.
- The SpriteSequence defines 5 different sprites. The bear is initially in
- a 'still' state:
+ \e SpriteSequence demonstrates using a sprite sequence to draw an animated
+ and interactive bear. The \l SpriteSequence object defines five different
+ sprites. The bear is initially in a \e still state:
\snippet imageelements/spritesequence.qml still
+
When the scene is clicked, an animation sets the sprite sequence to the
- 'falling' states and animates the bear's y property.
+ \e falling states and animates the bear's y property.
\snippet imageelements/spritesequence.qml animation
+
At the end of the animation the bear is set back to its initial state.
*/
diff --git a/examples/quick/keyinteraction/doc/src/keyinteraction.qdoc b/examples/quick/keyinteraction/doc/src/keyinteraction.qdoc
index d29536c66c..fa9fdcfde0 100644
--- a/examples/quick/keyinteraction/doc/src/keyinteraction.qdoc
+++ b/examples/quick/keyinteraction/doc/src/keyinteraction.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -31,5 +31,13 @@
\image qml-keyinteraction-example.png
\ingroup qtquickexamples
- This example demonstrates combining various methods of interacting with keyboard focus.
+ \e{Keyboard Focus in Qt Quick} combines various methods of
+ handling keyboard focus. For more information, visit
+ \l{Keyboard Focus in Qt Quick}.
+
+ \include examples-run.qdocinc
+
+ Using the keyboard arrow keys, the focus shifts to the menus and
+ the \l GridView.
+
*/
diff --git a/examples/quick/localstorage/doc/src/localstorage.qdoc b/examples/quick/localstorage/doc/src/localstorage.qdoc
index 0a5d1cd6fd..3e2fd7f006 100644
--- a/examples/quick/localstorage/doc/src/localstorage.qdoc
+++ b/examples/quick/localstorage/doc/src/localstorage.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -30,9 +30,13 @@
\brief A collection of QML local storage examples.
\image qml-localstorage-example.png
- This is a collection of small QML examples relating to local storage functionality.
+ \e{Local Storage} is a collection of small QML examples relating to
+ Qt Quick's \l{local storage} functionality.
- \e {Hello World} demonstrates creating a simple SQL table and doing insert/select operations.
+ \include examples-run.qdocinc
-*/
+ \section1 Hello World
+ \e {Hello World} demonstrates creating a simple SQL table and doing
+ insert and select operations.
+*/
diff --git a/examples/quick/mousearea/doc/src/mousearea.qdoc b/examples/quick/mousearea/doc/src/mousearea.qdoc
index 091be69e5d..827e5497ee 100644
--- a/examples/quick/mousearea/doc/src/mousearea.qdoc
+++ b/examples/quick/mousearea/doc/src/mousearea.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -27,20 +27,27 @@
/*!
\title Qt Quick Examples - MouseArea
\example mousearea
- \brief This is an example of the MouseArea type in QML
+ \brief This is an example of the MouseArea type in QML.
\image qml-mousearea-example.png
\ingroup qtquickexamples
- This example shows you how to respond to clicks and drags with a MouseArea.
+ \e MouseArea example shows how to respond to clicks and drags with a
+ \l MouseArea. For more information, visit
+ \l{Important Concepts In Qt Quick - User Input}.
- When you click inside the red square, the Text type will list several properties
- of that click which are available to QML.
+ \include examples-run.qdocinc
- Signals are emitted by the MouseArea when clicks or other discrete operations occur within it
+ \section1 MouseArea Behavior
+
+ When you click inside the red square, the \l Text type will list several
+ properties of that click which are available to QML.
+
+ Signals are emitted by the MouseArea when clicks or other discrete
+ operations occur within it.
\snippet mousearea/mousearea.qml clicks
- The MouseArea can also be used to drag items around. By setting the parameters of the drag property,
- the target item will be dragged around if the user starts to drag within the MouseArea.
+ \l MouseArea can also be used to drag items around. By setting the
+ parameters of the drag property, the target item will be dragged around if
+ the user starts to drag within the mouse area boundary.
\snippet mousearea/mousearea.qml drag
-
*/
diff --git a/examples/quick/positioners/doc/src/positioners.qdoc b/examples/quick/positioners/doc/src/positioners.qdoc
index 794b3b25f9..4acd42821a 100644
--- a/examples/quick/positioners/doc/src/positioners.qdoc
+++ b/examples/quick/positioners/doc/src/positioners.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -31,22 +31,35 @@
\image qml-positioners-example.png
\ingroup qtquickexamples
- This is a collection of small QML examples relating to positioners. Each example is
- a small QML file emphasizing a particular type or feature.
+ \e Positioners is a collection of small QML examples relating to
+ positioners. Each example is a small QML file emphasizing a particular type
+ or feature. For more information, visit
+ \l{Important Concepts In Qt Quick - Positioning}.
- Transitions shows animated transitions when showing or hiding items in a positioner.
- It consists of a scene populated with items in a variety of positioners: Column, Row, Grid and Flow.
- Each positioner has animations described as Transitions.
+ \include examples-run.qdocinc
+
+ \section1 Transitions
+
+ \e Transitions shows animated transitions when showing or hiding items in a
+ positioner. It consists of a scene populated with items in a variety of
+ positioners: \l Column, \l Row, \l Grid, and \l Flow. Each positioner has
+ animations described as Transitions.
\snippet positioners/positioners-transitions.qml move
- The move transition specifies how items inside a positioner will animate when they are displaced by the appearance or disappearance of other items.
+ The move transition specifies how items inside a positioner will animate
+ when they are displaced by the appearance or disappearance of other items.
\snippet positioners/positioners-transitions.qml add
- The add transition specifies how items will appear when they are added to a positioner.
+ The add transition specifies how items will appear when they are added to a
+ positioner.
\snippet positioners/positioners-transitions.qml populate
- The populate transition specifies how items will appear when their parent positioner is first created.
+ The populate transition specifies how items will appear when their parent
+ positioner is first created.
+
+ \section1 Attached Properties
- Attached Properties shows how the Positioner attached property can be used to determine where an item is within a positioner.
+ \e{Attached Properties} shows how the Positioner attached property can be
+ used to determine where an item is within a positioner.
\snippet positioners/positioners-attachedproperties.qml 0
*/
diff --git a/examples/quick/quick-accessibility/doc/src/accessibility.qdoc b/examples/quick/quick-accessibility/doc/src/accessibility.qdoc
index 5ad60d1c0f..da89333835 100644
--- a/examples/quick/quick-accessibility/doc/src/accessibility.qdoc
+++ b/examples/quick/quick-accessibility/doc/src/accessibility.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -27,14 +27,21 @@
/*!
\title Qt Quick Examples - Accessibility
\example quick-accessibility
- \brief This example has accessible buttons.
+ \brief This example demonstrates the implementation of accessible buttons.
\ingroup qtquickexamples
- Types in this example are augmented with meta-data for accessiblity systems.
+ \e Accessibility demonstrates QML types that are augmented with meta-data
+ for accessibility systems. For more information, visit the
+ \l{Accessibility} page.
- For example, the button identifies itself and its functionality to the accessibility system:
+ \include examples-run.qdocinc
+
+ \section1 Implementing Accessible Buttons
+
+ The button identifies itself and its functionality to the
+ accessibility system:
\snippet quick-accessibility/content/Button.qml button
- As do Text types inside the example:
+ Similarly, \l Text types inside the example also identify themselves:
\snippet quick-accessibility/accessibility.qml text
*/
diff --git a/examples/quick/quickwidgets/quickwidget/main.cpp b/examples/quick/quickwidgets/quickwidget/main.cpp
index 61c54735cf..3850dde157 100644
--- a/examples/quick/quickwidgets/quickwidget/main.cpp
+++ b/examples/quick/quickwidgets/quickwidget/main.cpp
@@ -58,12 +58,14 @@ private:
MainWindow::MainWindow()
: m_quickWidget(new QQuickWidget)
{
+ QSurfaceFormat format;
if (QCoreApplication::arguments().contains(QStringLiteral("--coreprofile"))) {
- QSurfaceFormat format;
format.setVersion(4, 4);
format.setProfile(QSurfaceFormat::CoreProfile);
- m_quickWidget->setFormat(format);
}
+ if (QCoreApplication::arguments().contains(QStringLiteral("--multisample")))
+ format.setSamples(4);
+ m_quickWidget->setFormat(format);
QMdiArea *centralWidget = new QMdiArea;
diff --git a/examples/quick/righttoleft/doc/src/righttoleft.qdoc b/examples/quick/righttoleft/doc/src/righttoleft.qdoc
index 6a207f7233..1671f9b1ad 100644
--- a/examples/quick/righttoleft/doc/src/righttoleft.qdoc
+++ b/examples/quick/righttoleft/doc/src/righttoleft.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -31,9 +31,18 @@
\image qml-righttoleft-example.png
\ingroup qtquickexamples
- This is a collection of small QML examples relating to right to left(RTL) localization support.
+ \e{Right to Left} is a collection of small QML examples relating to
+ right to left (RTL) localization support. For more information,
+ visit \l{Right-to-left User Interfaces}.
- Layout direction shows RTL layouting.
- Layout mirroring shows automatic mirroring of horizontal layouts in RTL locales.
- Text Alignment shows automatic mirroring of text alignment in RTL locales.
+ These are the examples in Right to Left:
+ \list
+ \li \e{Layout Direction} - shows RTL layout direction
+ \li \e{Layout Mirroring} - shows automatic mirroring of horizontal layouts
+ in RTL locales
+ \li \e{Text Alignment} - shows automatic mirroring of text alignment in RTL
+ locales
+ \endlist
+
+ \include examples-run.qdocinc
*/
diff --git a/examples/quick/shadereffects/doc/src/shadereffects.qdoc b/examples/quick/shadereffects/doc/src/shadereffects.qdoc
index 3d5f42eacc..448ee9f3e3 100644
--- a/examples/quick/shadereffects/doc/src/shadereffects.qdoc
+++ b/examples/quick/shadereffects/doc/src/shadereffects.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -28,24 +28,34 @@
\title Qt Quick Examples - Shader Effects
\example shadereffects
\image qml-shadereffects-example.png
- \brief This is a shader effects example
+ \brief This is a shader effects example.
\ingroup qtquickexamples
This example demonstrates a couple of visual effects that you can perform
- with shaders in \l {Qt Quick}.
+ with shaders in Qt Quick. For more information, visit
+ \l{Important Concepts In Qt Quick - Graphical Effects}
- ShaderEffects typically operate on other types, using a ShaderEffectSource
+ \include examples-run.qdocinc
+
+ \section1 Using ShaderEffect
+
+ The \l ShaderEffect type typically operates on other types, using a
+ \l ShaderEffectSource:
\snippet shadereffects/shadereffects.qml source
- In the above snippet, theItem is the id of a complex QML object in the file.
- ShaderEffects can use this ShaderEffectSource as a texture in their fragment shader.
+ In the above snippet, \c theItem is the ID of a complex QML object in the
+ file.
+
+ ShaderEffects can use this ShaderEffectSource as a texture in their fragment
+ shader:
\snippet shadereffects/shadereffects.qml fragment
- You can use any custom property on the ShaderEffect in your shader. This makes
- animated shader code very easy.
+ You can use any custom property on the ShaderEffect in your shader. This
+ makes animated shader code very easy:
\snippet shadereffects/shadereffects.qml properties
- ShaderEffects can also have a custom vertext shader. Setting the mesh property on ShaderEffect
- provides more vertices for you to manipulate, enabling many effects.
+ ShaderEffects can also have a custom vertext shader. Setting the mesh
+ property on ShaderEffect provides more vertices for you to manipulate,
+ enabling more effects.
\snippet shadereffects/shadereffects.qml vertex
*/
diff --git a/examples/quick/text/doc/src/text.qdoc b/examples/quick/text/doc/src/text.qdoc
index 3a300fbcf3..8ef79ab9d9 100644
--- a/examples/quick/text/doc/src/text.qdoc
+++ b/examples/quick/text/doc/src/text.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -27,44 +27,61 @@
/*!
\title Qt Quick Examples - Text
\example text
- \brief This is a collection of QML examples relating to text
+ \brief This is a collection of QML examples relating to text.
\image qml-text-example.png
\ingroup qtquickexamples
- This is a collection of small QML examples relating to text. Each example is
- a small QML file, usually containing or emphasizing a particular type or
+ \e Text is a collection of small QML examples relating to text. Each example
+ is a small QML file, usually containing or emphasizing a particular type or
feature. You can run and observe the behavior of each example.
- 'Hello' shows how to change and animate the letter spacing of a Text type.
- It uses a sequential animation to first animate the font.letterSpacing property
- from 0 to 50 over 3 seconds and then move the text to a random position on screen:
+ \section1 Hello
+
+ \e Hello shows how to change and animate the letter spacing of a \l Text
+ type. It uses a sequential animation to first animate the font.letterSpacing
+ property from \c 0 to \c 50 over three seconds and then move the text to a
+ random position on screen:
\snippet text/fonts/hello.qml letterspacing
- 'Fonts' shows different ways of using fonts with the Text type.
+ \section1 Fonts
+
+ \e Fonts shows different ways of using fonts with the \l Text type.
Simply by name, using the font.family property directly:
\snippet text/fonts/fonts.qml name
- or using a FontLoader type:
+
+ or using a \l FontLoader type:
\snippet text/fonts/fonts.qml fontloader
+
or using a FontLoader and specifying a local font file:
\snippet text/fonts/fonts.qml fontloaderlocal
+
or finally using a FontLoader and specifying a remote font file:
\snippet text/fonts/fonts.qml fontloaderremote
- 'Available Fonts' shows how to use the QML \l{QtQml::Qt}{Qt} global object and a list view
- to display all the fonts available on the system.
- The ListView type uses the list of fonts available as its model:
+ \section1 Available Fonts
+
+ \e{Available Fonts} shows how to use the QML \l{QtQml::Qt}{Qt} global object
+ and a list view to display all the fonts available on the system.
+ The \l ListView type uses the list of fonts available as its model:
\snippet text/fonts/availableFonts.qml model
+
Inside the delegate, the font family is set with the modelData:
\snippet text/fonts/availableFonts.qml delegate
- 'Banner' is a simple example showing how to create a banner using a row of text
- types and a NumberAnimation.
+ \section1 Banner
+
+ \e Banner is a simple example showing how to create a banner using a row of
+ text types and a \l NumberAnimation.
+
+ \section1 Img tag
+
+ \e{Img tag} shows different ways of displaying images in text objects using
+ the \c{<img>} tag.
- 'Img tag' shows different ways of displaying images in a text types using
- the <img> tag.
+ \section1 Text Layout
- 'Text Layout' shows how to create a more complex layout for a text item.
- This example lays out the text in two columns using the onLineLaidOut handler
- that allows you to position and resize each line:
+ \e{Text Layout} shows how to create a more complex layout for a text item.
+ This example lays out the text in two columns using the onLineLaidOut
+ handler that allows you to position and resize each line:
\snippet text/styledtext-layout.qml layout
*/
diff --git a/examples/quick/threading/doc/src/threading.qdoc b/examples/quick/threading/doc/src/threading.qdoc
index 1cced3b9d3..1695a2da6f 100644
--- a/examples/quick/threading/doc/src/threading.qdoc
+++ b/examples/quick/threading/doc/src/threading.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -27,23 +27,42 @@
/*!
\title Qt Quick Examples - Threading
\example threading
- \brief This is a collection of QML Multithreading examples.
+ \brief This is a collection of QML multithreading examples.
\image qml-threading-example.png
\ingroup qtquickexamples
- Threaded ListModel contains a ListView and a ListModel. The ListModel is updated asynchronusly in another thread, and the results propagate back to the main thread.
- A timer requests updates from the worker thread periodically:
+ \e Threading is a collection of QML multithreading examples.
+
+ \include examples-run.qdocinc
+
+ \section1 Threaded ListModel
+
+ \e{Threaded ListModel} contains a \l ListView and a \l ListModel.
+ The ListModel object is updated asynchronously in another thread, and the
+ results propagate back to the main thread. A timer requests updates from the
+ worker thread periodically:
\snippet threading/threadedlistmodel/timedisplay.qml 0
- Inside the worker thread, the ListModel is synchronized once the data is finished loading:
+ Inside the worker thread, the ListModel is synchronized once the data is
+ finished loading:
\snippet threading/threadedlistmodel/dataloader.js 0
- WorkerScript contains an example of using a WorkerScript to offload expensive calculations into another thread. This keeps the UI from being blocked. This example calculates numbers in Pascal's Triangle, and not in a very optimal way, so it will often take several seconds to complete the calculation. By doing this in a WorkerScript in another thread, the UI is not blocked during this time.
+ \section1 WorkerScript
+
+ \e WorkerScript contains an example of using a \l WorkerScript to offload
+ expensive calculations into another thread. This keeps the UI from being
+ blocked. This example calculates numbers in Pascal's Triangle, and not in a
+ very optimal way, so it will often take several seconds to complete the
+ calculation. By doing this in a WorkerScript in another thread, the UI is
+ not blocked during this time.
When the UI needs another value, a request is sent to the WorkerScript:
\snippet threading/workerscript/workerscript.qml 0
+
The workerscript then is free to take a really long time to calculate it:
\snippet threading/workerscript/workerscript.js 0
- When it's done, the result returns to the main scene via the WorkerScript type:
+
+ When it's done, the result returns to the main scene via the WorkerScript
+ type:
\snippet threading/workerscript/workerscript.qml 1
*/
diff --git a/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc b/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc
index 09a5f51105..245cd00592 100644
--- a/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc
+++ b/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -27,29 +27,53 @@
/*!
\title Qt Quick Examples - Touch Interaction
\example touchinteraction
- \brief This is a collection of QML Touch Interaction examples.
+ \brief A collection of QML Touch Interaction examples.
\image qml-touchinteraction-example.png
- This is a collection of small QML examples relating to touch interaction methods.
+ \e{Touch Interaction} is a collection of small QML examples relating to
+ touch interaction methods. For more information, visit
+ \l{Important Concepts In Qt Quick - User Input}.
+
+ \include examples-run.qdocinc
+
+ \section1 Multipoint Flames
+
+ \e{Multipoint Flames} demonstrates distinguishing different fingers in a
+ \l MultiPointTouchArea, by assigning a different colored flame to each touch
+ point.
- Multipoint Flames demonstrates distinguishing different fingers in a MultiPointTouchArea, by assigning a different colored flame to each touch point.
The MultipointTouchArea sets up multiple touch points:
\snippet touchinteraction/multipointtouch/multiflame.qml 0
- The flames are then simply bound to the coordiates of the touch point, and whether it is currently pressed, like so:
+
+ The flames are then simply bound to the coordinates of the touch point, and
+ whether it is currently pressed, as follows:
\snippet touchinteraction/multipointtouch/multiflame.qml 1
- Bear-Whack demonstrates using a MultiPointTouchArea to add multiple finger support to a simple game. The interaction with the game
- is done through a SpriteGoal that follows the TouchPoint. The TouchPoints added to the MultiPointTouchArea are a component with all
- this logic embedded into it:
+ \section1 Bear-Whack
+
+ \e{Bear-Whack} demonstrates using \l MultiPointTouchArea to add multiple
+ finger support to a simple game. The interaction with the game
+ is done through a SpriteGoal that follows the TouchPoint. The TouchPoints
+ added to the MultiPointTouchArea are a component with the relevant logic
+ embedded into it:
\snippet touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml 0
- Flick Resize uses a PinchArea to allow Pinch-to-Resize behavior. This is easily achieved just by listening to the PinchArea signals and responding
- to user input.
+ \section1 Flick Resize
+
+ \e{Flick Resize} uses a \l PinchArea to implement a \e{pinch-to-resize}
+ behavior. This is easily achieved by listening to the PinchArea signals and
+ responding to user input.
\snippet touchinteraction/pincharea/flickresize.qml 0
- Flickable is a simple example demonstrating the Flickable type. The object inside the flickable is very big, but the flickable itself is very small:
+ \section1 Flickable
+
+ \e Flickable is a simple example demonstrating the \l Flickable type.
\snippet touchinteraction/flickable/basic-flickable.qml 0
- Corkboards shows a more complex Flickable usecase, with types on the flickable that respond to mouse and keyboard interaction.
- This doesn't require special code, the Qt Quick types automatically cooperate with Flickable for accepting the touch events.
+ \section1 Corkboards
+
+ \e Corkboards shows another use for \l Flickable, with QML types within the
+ flickable object that respond to mouse and keyboard interaction. This
+ behavior does not require special code as the Qt Quick types already
+ cooperate with the Flickable type for accepting touch events.
*/
diff --git a/examples/quick/views/doc/src/views.qdoc b/examples/quick/views/doc/src/views.qdoc
index 2d664c9bd9..d25d9f40c9 100644
--- a/examples/quick/views/doc/src/views.qdoc
+++ b/examples/quick/views/doc/src/views.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -28,55 +28,86 @@
/*!
\title Qt Quick Examples - Views
\example views
- \brief This is a collection of QML model/view examples
+ \brief This is a collection of QML model-view examples.
\image qml-modelviews-example.png
\ingroup qtquickexamples
- This is a collection of small QML examples relating to model and view functionality. They demonstrate how to show data from a model using the \l {Qt Quick} view types.
+ \e Views is a collection of small QML examples relating to model and view
+ functionality. They demonstrate how to show data from a model using the
+ Qt Quick view types. For more information, visit the
+ \l{Models and Views in Qt Quick} page.
- \section2 GridView and PathView demonstrate usage of these types to display views.
+ \include examples-run.qdocinc
+
+ \section1 GridView and PathView
+
+ \e GridView and \e PathView demonstrate usage of these types to display
+ views.
\snippet views/gridview/gridview-example.qml 0
- \section2 Dynamic List demonstrates animation of runtime additions and removals to a ListView.
+ \section1 Dynamic List
+
+ \e{Dynamic List} demonstrates animation of runtime additions and removals to
+ a \l ListView.
- The ListView.onAdd signal handler runs an animation when new items are added to the
- view, and the ListView.onRemove another when they are removed.
+ The ListView.onAdd signal handler runs an animation when new items are added
+ to the view, and the ListView.onRemove another when they are removed.
\snippet views/listview/dynamiclist.qml 0
\snippet views/listview/dynamiclist.qml 1
- \section2 Expanding Delegates demonstrates delegates that expand when activated.
+ \section2 Expanding Delegates
- It has a complex delegate the size and appearance of which can change, displacing
- other items in the view.
+ \e{Expanding Delegates} demonstrates delegates that expand when activated.
+
+ It has a complex delegate the size and appearance of which can change,
+ displacing other items in the view.
\snippet views/listview/expandingdelegates.qml 0
\snippet views/listview/expandingdelegates.qml 1
\snippet views/listview/expandingdelegates.qml 2
\snippet views/listview/expandingdelegates.qml 3
- \section2 Highlight demonstrates adding a custom highlight to a ListView.
+ \section1 Highlight
+
+ \e Highlight demonstrates adding a custom highlight to a \l ListView.
\snippet views/listview/highlight.qml 0
- \section2 Highlight Ranges shows the three different highlight range modes of ListView.
+ \section1 Highlight Ranges
+
+ \e{Highlight Ranges} shows the three different highlight range modes of
+ ListView.
\snippet views/listview/highlightranges.qml 0
\snippet views/listview/highlightranges.qml 1
\snippet views/listview/highlightranges.qml 2
- \section2 Sections demonstrates the various section headers and footers available to ListView.
+ \section1 Sections
+
+ \e Sections demonstrates the various section headers and footers available
+ to \l ListView.
\snippet views/listview/sections.qml 0
- \section2 Packages demonstrates using Packages to transition delegates between two views.
+ \section1 Packages
+
+ \e Packages uses the \l Package type to transition delegates between
+ two views.
- It has a Package which defines delegate items for each view and an item that can
- be transferred between delegates.
+ It has a Package object which defines delegate items for each view and an
+ item that can be transferred between delegates.
\snippet views/package/Delegate.qml 0
- A DelegateModel allows the individual views to access their specific items from
- the shared package delegate.
+ A \l DelegateModel allows the individual views to access their specific
+ items from the shared package delegate.
\snippet views/package/view.qml 0
- \section2 ObjectModel uses an ObjectModel for the model instead of a ListModel.
+ \section1 ObjectModel
+
+ \e ObjectModel uses an ObjectModel for the model instead of a \l ListModel.
\snippet views/objectmodel/objectmodel.qml 0
+
+ \section1 Display Margins
+
+ \e{Display Margins} uses delegates to display items and implements a simple
+ header and footer components.
*/
diff --git a/examples/quick/window/doc/src/window.qdoc b/examples/quick/window/doc/src/window.qdoc
index 07d2f115c1..7725f39a46 100644
--- a/examples/quick/window/doc/src/window.qdoc
+++ b/examples/quick/window/doc/src/window.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -31,22 +31,35 @@
\image qml-window-example.png
\ingroup qtquickexamples
- This example shows you how to create a Window in QML, how to control its
- \l {QQuickWindow::visibility} {visibility}, how to present a splash screen
- during application startup, and how to access the properties of the
- \l Screen. It also demonstrates how to package QML into
- \l {The Qt Resource System} {resources} and provide an
- \l {Setting the Application Icon} {icon} to create a standalone QML desktop application.
+ \e{Window and Screen} shows how to:
+
+ \list
+ \li create a window in QML
+ \li control its \l {QQuickWindow::visibility} {visibility}
+ \li present a splash screen during application startup
+ \li access the properties of the \l Screen
+ \endlist
+
+ It also demonstrates how to package QML into \l {The Qt Resource System}
+ {resources} and provide an \l {Setting the Application Icon} {icon} to
+ create a standalone QML desktop application.
+
+ \include examples-run.qdocinc
+
+ \section1 Window Implementation
+
+ A splash screen can be created with the \l {Qt::SplashScreen}
+ {Qt.SplashScreen} flag, and should be \l {Qt::ApplicationModal}
+ {ApplicationModal} to prevent interaction with the main window. If the
+ splash window is also transparent, and showing a partially transparent
+ image, then it will look like a shaped window.
- A splash screen can be created with the \l {Qt::SplashScreen} {Qt.SplashScreen} flag,
- and should be \l {Qt::ApplicationModal} {ApplicationModal} to prevent interaction
- with the main window. If the splash window is also transparent, and showing a
- partially transparent image, then it will look like a shaped window.
\snippet window/Splash.qml splash-properties
In this example a \l Timer will automatically dismiss the splash screen,
but in a real application you might want to connect to a signal from the
application logic to hide the splash when initialization is complete.
+
\snippet window/Splash.qml timer
The main window in this example is the control window, with some buttons
@@ -54,18 +67,22 @@
window. Each checkbox has a binding to the property whose state it is
displaying, and also an onClicked handler to change the state. This is the
typical pattern to create a two-way binding while avoiding binding loops.
+
\snippet window/window.qml windowedCheckbox
- The \l Screen has several properties which are generally useful to applications
- which need to rotate some content when the screen orientation changes, to position
- windows on the screen or to convert real units to logical pixel units. ScreenInfo.qml
- (which is displayed inline in window.qml, or can be run by itself with qmlscene)
- simply displays the property values, while the splash screen uses them to
- center the window on the screen.
+ \l Screen has several properties which are generally useful to
+ applications which need to rotate some content when the screen orientation
+ changes, to position windows on the screen or to convert real units to
+ logical pixel units. ScreenInfo.qml (which is displayed inline in
+ window.qml, or can be run by itself with qmlscene) simply displays the
+ property values, while the splash screen uses them to center the window on
+ the screen.
+
\snippet window/Splash.qml screen-properties
- If a Window is nested inside an \l Item or another Window, the inner window
- becomes "transient for" the outer one (see \l Window for more explanation).
- But if you want to create multiple top-level windows as unrelated peers, you
- can create them inside a non-visual \l QtObject root item, as this example does.
+ If a \l Window is nested inside an \l Item or another Window, the inner
+ window becomes \e{transient for} the outer one (see \l Window for more
+ explanation). But if you want to create multiple top-level windows as
+ unrelated peers, you can create them inside a non-visual \l QtObject root
+ item, as this example does.
*/
diff --git a/src/3rdparty/masm/yarr/YarrJIT.cpp b/src/3rdparty/masm/yarr/YarrJIT.cpp
index 783a869b5a..94a72a57c7 100644
--- a/src/3rdparty/masm/yarr/YarrJIT.cpp
+++ b/src/3rdparty/masm/yarr/YarrJIT.cpp
@@ -2561,6 +2561,7 @@ class YarrGenerator : private MacroAssembler {
#if CPU(ARM_TRADITIONAL)
push(ARMRegisters::r8); // scratch register
#endif
+ push(addressTempRegister);
if (compileMode == IncludeSubpatterns)
move(ARMRegisters::r3, output);
#elif CPU(SH4)
@@ -2588,6 +2589,7 @@ class YarrGenerator : private MacroAssembler {
pop(X86Registers::ebx);
pop(X86Registers::ebp);
#elif CPU(ARM)
+ pop(addressTempRegister);
#if CPU(ARM_TRADITIONAL)
pop(ARMRegisters::r8); // scratch register
#endif
diff --git a/src/particles/qquickellipseextruder.cpp b/src/particles/qquickellipseextruder.cpp
index f4374d8013..6016d5966b 100644
--- a/src/particles/qquickellipseextruder.cpp
+++ b/src/particles/qquickellipseextruder.cpp
@@ -82,7 +82,13 @@ QPointF QQuickEllipseExtruder::extrude(const QRectF & r)
bool QQuickEllipseExtruder::contains(const QRectF &bounds, const QPointF &point)
{
- return bounds.contains(point);//TODO: Ellipse
+ if (!bounds.contains(point))
+ return false;
+
+ QPointF relPoint(bounds.center() - point);
+ qreal xa = relPoint.x()/bounds.width();
+ qreal yb = relPoint.y()/bounds.height();
+ return (xa * xa + yb * yb) < 0.25;
}
QT_END_NAMESPACE
diff --git a/src/qml/doc/src/cppintegration/exposecppattributes.qdoc b/src/qml/doc/src/cppintegration/exposecppattributes.qdoc
index f02c3da6af..8f883d9f42 100644
--- a/src/qml/doc/src/cppintegration/exposecppattributes.qdoc
+++ b/src/qml/doc/src/cppintegration/exposecppattributes.qdoc
@@ -106,6 +106,8 @@ public:
QString author() const {
return m_author;
}
+signals:
+ void authorChanged();
private:
QString m_author;
};
diff --git a/src/qml/doc/src/javascript/expressions.qdoc b/src/qml/doc/src/javascript/expressions.qdoc
index 79c11b3ac5..37baa49c52 100644
--- a/src/qml/doc/src/javascript/expressions.qdoc
+++ b/src/qml/doc/src/javascript/expressions.qdoc
@@ -37,44 +37,36 @@ Object} includes a number of helper methods that simplify building UIs and
interacting with the QML environment.
The JavaScript environment provided by QML is stricter than that in a web
-browser. For example, in QML you cannot add, or modify, members of the
+browser. For example, in QML you cannot add to, or modify, members of the
JavaScript global object. In regular JavaScript, it is possible to do this
accidentally by using a variable without declaring it. In QML this will throw
-an exception, so all local variables should be explicitly declared. See
+an exception, so all local variables must be explicitly declared. See
\l{JavaScript Environment Restrictions} for a complete description of the
restrictions on JavaScript code executed from QML.
-There are various ways in which JavaScript expressions may be defined and used
-in QML, including property bindings, signal handlers, custom methods and
-JavaScript imports.
-
-
-
-
-\section1 JavaScript Expressions in QML Objects
-
-QML \l{QML Object Types}{object types} defined in \l{QML Documents}
-{QML documents} can make use of JavaScript expressions which implement program
-logic. There are four ways that JavaScript can be used in a QML document:
+Various parts of \l{QML Documents}{QML documents} can contain JavaScript code:
\list 1
- \li Relationships between \l{Property Attributes}{properties} are described
- using JavaScript expressions in \l{Property Binding}{property bindings}.
- When any of a property's \e dependencies change, the property is
- automatically updated too, according to the specified relationship.
- \li \l{Signal Attributes}{Signal handlers} can be defined
- which are automatically evaluated when the object emits the associated
- signal.
- \li \l{Method Attributes}{Custom methods} can be defined
- in QML files as JavaScript functions.
- \li JavaScript files providing functions and variables can be
- \l{Importing JavaScript Resources in QML}{imported} in a QML
- document.
+ \li The body of \l{Property Binding}{property bindings}. These JavaScript
+ expressions describe relationships between QML object \l{Property Attributes}
+ {properties}. When any of a property's \e dependencies change, the property
+ is automatically updated too, according to the specified relationship.
+ \li The body of \l{Signal Attributes}{Signal handlers}. These JavaScript
+ statements are automatically evaluated whenever a QML object emits the
+ associated signal.
+ \li The definition of \l{Method Attributes}{custom methods}. JavaScript functions
+ that are defined within the body of a QML object become methods of that
+ object.
+ \li Standalone \l{Importing JavaScript Resources in QML}{JavaScript resource
+ (.js) files}. These files are actually separate from QML documents, but
+ they can be imported into QML documents. Functions and variables that are
+ defined within the imported files can be used in property bindings, signal
+ handlers, and custom methods.
\endlist
-\section2 Property Bindings
+\section1 JavaScript in Property Bindings
In the following example, the \l Rectangle's \c color depends on the
\l MouseArea's \c pressed property. This relationship is described using a
@@ -136,7 +128,7 @@ bindings differ from value assignments.
-\section2 Signal Handlers
+\section1 JavaScript in Signal Handlers
QML object types can emit signals in reaction to certain events occurring.
Those signals can be handled by signal handler functions, which can be defined
@@ -188,7 +180,7 @@ to define the implementation of signal handlers in QML with JavaScript.
-\section2 JavaScript Expressions in Functions
+\section1 JavaScript in Standalone Functions
Program logic can also be defined in JavaScript functions. These functions can
be defined inline in QML documents (as custom methods) or externally in
@@ -196,12 +188,12 @@ imported JavaScript files.
-\section3 Custom Methods
+\section2 JavaScript in Custom Object Methods
Custom methods can be defined in QML documents and may be called from signal
handlers, property bindings, or functions in other QML objects. Methods
-defined in this way are often referred to as "inline JavaScript functions" as
-their implementation is included in the QML object type definition
+defined in this way are often referred to as \e{inline JavaScript functions}
+because their implementation is included in the QML object type definition
(QML document), as opposed to an external JavaScript file.
An example of an inline custom method is as follows:
@@ -225,7 +217,7 @@ Item {
}
\endqml
-The factorial function will run whenever the MouseArea detects a clicked signal.
+The factorial function will run whenever the MouseArea detects a \c clicked signal.
Importantly, custom methods defined inline in a QML document are exposed to
other objects, and therefore inline functions on the root object in a QML
@@ -238,7 +230,7 @@ to define custom methods in QML with JavaScript code implementations.
-\section3 Functions in Imported JavaScript Files
+\section2 Functions in Imported JavaScript Files
Non-trivial program logic is best separated into external JavaScript files.
These files can be imported into QML files using an \c import statement, in
@@ -263,7 +255,7 @@ the section about \l{Importing JavaScript Resources in QML}.
-\section3 Connecting Signals to JavaScript Functions
+\section2 Connecting Signals to JavaScript Functions
QML object types which emit signals also provide default signal handlers for
their signals, as described in a previous section. Sometimes, however, a
@@ -292,23 +284,26 @@ See \l{qtqml-syntax-signals.html}
-\section1 Running JavaScript at Startup
+\section1 JavaScript in Application Startup Code
It is occasionally necessary to run some imperative code at application (or
component instance) startup. While it is tempting to just include the startup
script as \e {global code} in an external script file, this can have severe
limitations as the QML environment may not have been fully established. For
example, some objects might not have been created or some
-\l {Property Binding}{property bindings} may not have been run.
-\l {JavaScript Environment Restrictions} covers the exact limitations of global
+\l {Property Binding}{property bindings} may not have been established. See
+\l {JavaScript Environment Restrictions} for the exact limitations of global
script code.
-Every QML object has an \e attached \l Component property that references the
-component within which the object was instantiated. Every \l Component
-will emit a \c completed signal, and thus every object can define an
-implementation for the \c onCompleted() handler which can be used to trigger the
-execution of script code at startup after the QML environment has been
-completely established. For example:
+A QML object will emit the \c{Component.completed} \l{Signal and Handler Event
+System#Attached Signal Handlers}{attached signal} when its instantiation is
+complete. JavaScript code in the corresponding \c{Component.onCompleted} handler
+runs after the object is instantiated. Thus, the best place to write application
+startup code is in the \c{Component.onCompleted} handler of the top-level level
+object, because this object emits \c{Component.completed} when the QML environment
+is fully established.
+
+For example:
\qml
import QtQuick 2.0
@@ -346,7 +341,7 @@ signal just before being destroyed.
\section1 Scarce Resources in JavaScript
As described in the documentation for \l{QML Basic Types}, a \c var type
-property may hold a "scarce resource" (image or pixmap). There are several
+property may hold a \e{scarce resource} (image or pixmap). There are several
important semantics of scarce resources which should be noted:
\list
diff --git a/src/qml/doc/src/javascript/hostenvironment.qdoc b/src/qml/doc/src/javascript/hostenvironment.qdoc
index a63ef617c0..bd3ff63bf8 100644
--- a/src/qml/doc/src/javascript/hostenvironment.qdoc
+++ b/src/qml/doc/src/javascript/hostenvironment.qdoc
@@ -135,8 +135,8 @@ var initialPosition = { rootObject.x, rootObject.y }
\endcode
This restriction exists as the QML environment is not yet fully established.
-To run code after the environment setup has completed, refer to
-\l {Running JavaScript at Startup}.
+To run code after the environment setup has completed, see
+\l {JavaScript in Application Startup Code}.
\li The value of \c this is currently undefined in QML in the majority of contexts.
diff --git a/src/qml/doc/src/javascript/qmlglobalobject.qdoc b/src/qml/doc/src/javascript/qmlglobalobject.qdoc
index 4329bbb351..e89e49822e 100644
--- a/src/qml/doc/src/javascript/qmlglobalobject.qdoc
+++ b/src/qml/doc/src/javascript/qmlglobalobject.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@@ -122,7 +122,8 @@ browser. The following objects and properties are supported by the QML implemen
\endtable
-The \l{qml/xmlhttprequest}{XMLHttpRequest example} demonstrates how to
-use the XMLHttpRequest object to make a request and read the response headers.
+The \l{Qt Quick Examples - XMLHttpRequest}{XMLHttpRequest example} demonstrates
+how to use the XMLHttpRequest object to make a request and read the response
+headers.
*/
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index b61be913a6..a02424a3dc 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -1407,7 +1407,7 @@ static QV4::ReturnedValue CallOverloaded(QObject *object, const QQmlPropertyData
{
int argumentCount = callArgs->argc;
- const QQmlPropertyData *best = 0;
+ QQmlPropertyData best;
int bestParameterScore = INT_MAX;
int bestMatchScore = INT_MAX;
@@ -1453,7 +1453,7 @@ static QV4::ReturnedValue CallOverloaded(QObject *object, const QQmlPropertyData
methodMatchScore += MatchScore((v = callArgs->args[ii]), methodArgTypes[ii]);
if (bestParameterScore > methodParameterScore || bestMatchScore > methodMatchScore) {
- best = attempt;
+ best = *attempt;
bestParameterScore = methodParameterScore;
bestMatchScore = methodMatchScore;
}
@@ -1463,10 +1463,10 @@ static QV4::ReturnedValue CallOverloaded(QObject *object, const QQmlPropertyData
} while((attempt = RelatedMethod(object, attempt, dummy)) != 0);
- if (best) {
+ if (best.isValid()) {
if (valueTypeObject)
valueTypeObject->setValue(valueTypeValue);
- return CallPrecise(object, *best, engine, callArgs);
+ return CallPrecise(object, best, engine, callArgs);
} else {
QString error = QLatin1String("Unable to determine callable overload. Candidates are:");
const QQmlPropertyData *candidate = &data;
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index f78cdbb970..61246b92d8 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -809,6 +809,7 @@ void QQmlEnginePrivate::init()
qRegisterMetaType<QList<QObject*> >();
qRegisterMetaType<QList<int> >();
qRegisterMetaType<QQmlV4Handle>();
+ qRegisterMetaType<QQmlBinding*>();
v8engine()->setEngine(q);
diff --git a/src/quick/doc/src/examples.qdoc b/src/quick/doc/src/examples.qdoc
index 22c9786fda..3669a31de0 100644
--- a/src/quick/doc/src/examples.qdoc
+++ b/src/quick/doc/src/examples.qdoc
@@ -109,9 +109,8 @@ steps such as use cases and introductory material. For more information about Qt
\section2 Extending QML
The following tutorials show how a QML-based application can be combined with
-C++ code using the \l{Qt QML} module. The \l{Running the Examples} section
-has more information about opening the examples from within Qt Creator. For
-information about extending QML, visit the \l{Integrating QML and C++} page.
+C++ code using the \l{Qt QML} module. For information about extending QML, visit
+the \l{Integrating QML and C++} page.
\annotatedlist{qmlextendingexamples}
@@ -119,8 +118,7 @@ information about extending QML, visit the \l{Integrating QML and C++} page.
Examples are small applications which show how to implement various Qt Quick
features. The examples run on various platforms and are opened from within Qt
-Creator. The \l{Running the Examples} section has more information about opening
-the examples from within Qt Creator.
+Creator.
\div {class="landingicons"}
\div {class="icons1of3"}
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index 2c03903f36..d5ca3a128e 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -640,8 +640,8 @@ void QQuickGridViewPrivate::layoutVisibleItems(int fromModelIndex)
if (colPos != col * colSize()) {
colPos = col * colSize();
firstItem->setPosition(colPos, rowPos);
- firstItem->setVisible(firstItem->rowPos() + rowSize() >= from && firstItem->rowPos() <= to);
}
+ firstItem->setVisible(firstItem->rowPos() + rowSize() >= from && firstItem->rowPos() <= to);
for (int i = 1; i < visibleItems.count(); ++i) {
FxGridItemSG *item = static_cast<FxGridItemSG*>(visibleItems.at(i));
if (++col >= columns) {
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index da8ca9fd5d..73047add5d 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -1334,6 +1334,7 @@ void QQuickKeysAttached::keyPressed(QKeyEvent *event, bool post)
for (int ii = 0; ii < d->targets.count(); ++ii) {
QQuickItem *i = d->targets.at(ii);
if (i && i->isVisible()) {
+ event->accept();
QCoreApplication::sendEvent(i, event);
if (event->isAccepted()) {
d->inPress = false;
@@ -1376,6 +1377,7 @@ void QQuickKeysAttached::keyReleased(QKeyEvent *event, bool post)
for (int ii = 0; ii < d->targets.count(); ++ii) {
QQuickItem *i = d->targets.at(ii);
if (i && i->isVisible()) {
+ event->accept();
QCoreApplication::sendEvent(i, event);
if (event->isAccepted()) {
d->inRelease = false;
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 87e6728f86..94abbd0954 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -481,7 +481,7 @@ void QQuickItemView::setDisplayMarginBeginning(int margin)
if (d->displayMarginBeginning != margin) {
d->displayMarginBeginning = margin;
if (isComponentComplete()) {
- d->refillOrLayout();
+ d->forceLayoutPolish();
}
emit displayMarginBeginningChanged();
}
@@ -499,7 +499,7 @@ void QQuickItemView::setDisplayMarginEnd(int margin)
if (d->displayMarginEnd != margin) {
d->displayMarginEnd = margin;
if (isComponentComplete()) {
- d->refillOrLayout();
+ d->forceLayoutPolish();
}
emit displayMarginEndChanged();
}
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index d6e2487a89..b3342be5ce 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -418,7 +418,7 @@ void Updater::visitTransformNode(Node *n)
// The only change in this subtree is ourselves and we are a batch root, so
// only update subroots and return, saving tons of child-processing (flickable-panning)
- if (!n->becameBatchRoot && m_added == 0 && m_force_update == 0 && dirty && (n->dirtyState & ~QSGNode::DirtyMatrix) == 0) {
+ if (!n->becameBatchRoot && m_added == 0 && m_force_update == 0 && m_opacityChange == 0 && dirty && (n->dirtyState & ~QSGNode::DirtyMatrix) == 0) {
BatchRootInfo *info = renderer->batchRootInfo(n);
for (QSet<Node *>::const_iterator it = info->subRoots.constBegin();
it != info->subRoots.constEnd(); ++it) {
@@ -2020,6 +2020,8 @@ void Renderer::renderMergedBatch(const Batch *batch)
<< " root:" << batch->root;
if (batch->drawSets.size() > 1)
debug << "sets:" << batch->drawSets.size();
+ if (!batch->isOpaque)
+ debug << "opacity:" << e->node->inheritedOpacity();
batch->uploadedThisFrame = false;
}
diff --git a/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp b/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp
index 9ff0971774..bffdf40bc1 100644
--- a/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp
+++ b/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp
@@ -52,7 +52,6 @@ namespace QSGShaderRewriter {
struct Tokenizer {
enum Token {
- Token_Invalid,
Token_Void,
Token_OpenBrace,
Token_CloseBrace,
@@ -75,7 +74,6 @@ struct Tokenizer {
};
const char *Tokenizer::NAMES[] = {
- "Invalid",
"Void",
"OpenBrace",
"CloseBrace",
@@ -167,7 +165,7 @@ Tokenizer::Token Tokenizer::next()
}
}
- return Token_Invalid;
+ return Token_EOF;
}
}
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 1ba54ea19e..e4d61eb0ae 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -1199,6 +1199,8 @@ bool QSGThreadedRenderLoop::event(QEvent *e)
Window *w = windowForTimer(te->timerId());
if (w)
polishAndSync(w);
+ else
+ killTimer(te->timerId());
}
return true;
}
diff --git a/src/quick/scenegraph/shaders/visualization.vert b/src/quick/scenegraph/shaders/visualization.vert
index f1892b71da..591eb12ed6 100644
--- a/src/quick/scenegraph/shaders/visualization.vert
+++ b/src/quick/scenegraph/shaders/visualization.vert
@@ -3,7 +3,7 @@ uniform highp mat4 matrix;
uniform highp mat4 rotation;
// w -> apply 3d rotation and projection
-uniform lowp vec4 tweak;
+uniform mediump vec4 tweak;
varying mediump vec2 pos;
diff --git a/src/quick/scenegraph/util/qsgpainternode.cpp b/src/quick/scenegraph/util/qsgpainternode.cpp
index b454f666ac..8ccb9d2ffb 100644
--- a/src/quick/scenegraph/util/qsgpainternode.cpp
+++ b/src/quick/scenegraph/util/qsgpainternode.cpp
@@ -96,7 +96,6 @@ QSGPainterNode::QSGPainterNode(QQuickPaintedItem *item)
, m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
, m_texture(0)
, m_gl_device(0)
- , m_size(1, 1)
, m_dirtyContents(false)
, m_opaquePainting(false)
, m_linear_filtering(false)
@@ -116,6 +115,10 @@ QSGPainterNode::QSGPainterNode(QQuickPaintedItem *item)
setMaterial(&m_materialO);
setOpaqueMaterial(&m_material);
setGeometry(&m_geometry);
+
+#ifdef QSG_RUNTIME_DESCRIPTION
+ qsgnode_set_description(this, QString::fromLatin1("QQuickPaintedItem(%1):%2").arg(QString::fromLatin1(item->metaObject()->className())).arg(item->objectName()));
+#endif
}
QSGPainterNode::~QSGPainterNode()
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index a8a33c07c8..f91d512ab0 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -89,7 +89,6 @@ void QQuickWidgetPrivate::init(QQmlEngine* e)
offscreenWindow = renderControl->createOffscreenWindow();
offscreenWindow->setTitle(QString::fromLatin1("Offscreen"));
// Do not call create() on offscreenWindow.
- createOffscreenSurface();
if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RasterGLSurface))
setRenderToTexture();
@@ -144,6 +143,7 @@ QQuickWidgetPrivate::QQuickWidgetPrivate()
, offscreenSurface(0)
, renderControl(0)
, fbo(0)
+ , resolvedFbo(0)
, context(0)
, resizeMode(QQuickWidget::SizeViewToRootObject)
, initialSize(0,0)
@@ -164,21 +164,12 @@ QQuickWidgetPrivate::~QQuickWidgetPrivate()
Q_ASSERT(!context || (QOpenGLContext::currentContext() == context && context->surface() == offscreenSurface));
delete offscreenWindow;
delete renderControl;
+ delete resolvedFbo;
delete fbo;
- delete offscreenSurface;
destroyContext();
}
-void QQuickWidgetPrivate::createOffscreenSurface()
-{
- delete offscreenSurface;
- offscreenSurface = 0;
- offscreenSurface = new QOffscreenSurface;
- offscreenSurface->setFormat(offscreenWindow->requestedFormat());
- offscreenSurface->create();
-}
-
void QQuickWidgetPrivate::execute()
{
Q_Q(QQuickWidget);
@@ -237,6 +228,12 @@ void QQuickWidgetPrivate::renderSceneGraph()
renderControl->sync();
renderControl->render();
context->functions()->glFlush();
+
+ if (resolvedFbo) {
+ QRect rect(QPoint(0, 0), fbo->size());
+ QOpenGLFramebufferObject::blitFramebuffer(resolvedFbo, rect, fbo, rect);
+ }
+
context->doneCurrent();
q->update();
}
@@ -313,6 +310,7 @@ QQuickWidget::QQuickWidget(QWidget *parent)
: QWidget(*(new QQuickWidgetPrivate), parent, 0)
{
setMouseTracking(true);
+ setFocusPolicy(Qt::StrongFocus);
d_func()->init();
}
@@ -325,6 +323,7 @@ QQuickWidget::QQuickWidget(const QUrl &source, QWidget *parent)
: QWidget(*(new QQuickWidgetPrivate), parent, 0)
{
setMouseTracking(true);
+ setFocusPolicy(Qt::StrongFocus);
d_func()->init();
setSource(source);
}
@@ -342,6 +341,7 @@ QQuickWidget::QQuickWidget(QQmlEngine* engine, QWidget *parent)
: QWidget(*(new QQuickWidgetPrivate), parent, 0)
{
setMouseTracking(true);
+ setFocusPolicy(Qt::StrongFocus);
Q_ASSERT(engine);
d_func()->init(engine);
}
@@ -641,6 +641,13 @@ void QQuickWidgetPrivate::createContext()
return;
}
+ offscreenSurface = new QOffscreenSurface;
+ // Pass the context's format(), which, now that the underlying platform context is created,
+ // contains a QSurfaceFormat representing the _actual_ format of the underlying
+ // configuration. This is essential to get a surface that is compatible with the context.
+ offscreenSurface->setFormat(context->format());
+ offscreenSurface->create();
+
if (context->makeCurrent(offscreenSurface))
renderControl->initialize(context);
else
@@ -649,6 +656,8 @@ void QQuickWidgetPrivate::createContext()
void QQuickWidgetPrivate::destroyContext()
{
+ delete offscreenSurface;
+ offscreenSurface = 0;
delete context;
context = 0;
}
@@ -671,11 +680,23 @@ void QQuickWidget::createFramebufferObject()
context->makeCurrent(d->offscreenSurface);
+ int samples = d->offscreenWindow->requestedFormat().samples();
+ if (!QOpenGLExtensions(context).hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample))
+ samples = 0;
+
+ QOpenGLFramebufferObjectFormat format;
+ format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
+ format.setSamples(samples);
+
+ QSize fboSize = size() * window()->devicePixelRatio();
+
delete d->fbo;
- d->fbo = new QOpenGLFramebufferObject(size() * window()->devicePixelRatio());
- d->fbo->setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
+ d->fbo = new QOpenGLFramebufferObject(fboSize, format);
d->offscreenWindow->setRenderTarget(d->fbo);
+ if (samples > 0)
+ d->resolvedFbo = new QOpenGLFramebufferObject(fboSize);
+
// Sanity check: The window must not have an underlying platform window.
// Having one would mean create() was called and platforms that only support
// a single native window were in trouble.
@@ -685,9 +706,10 @@ void QQuickWidget::createFramebufferObject()
void QQuickWidget::destroyFramebufferObject()
{
Q_D(QQuickWidget);
- if (d->fbo)
- delete d->fbo;
+ delete d->fbo;
d->fbo = 0;
+ delete d->resolvedFbo;
+ d->resolvedFbo = 0;
}
QQuickWidget::ResizeMode QQuickWidget::resizeMode() const
@@ -766,7 +788,14 @@ void QQuickWidgetPrivate::setRootObject(QObject *obj)
GLuint QQuickWidgetPrivate::textureId() const
{
- return fbo ? fbo->texture() : 0;
+ Q_Q(const QQuickWidget);
+ if (!q->isWindow() && q->internalWinId()) {
+ qWarning() << "QQuickWidget cannot be used as a native child widget."
+ << "Consider setting Qt::AA_DontCreateNativeWidgetSiblings";
+ return 0;
+ }
+ return resolvedFbo ? resolvedFbo->texture()
+ : (fbo ? fbo->texture() : 0);
}
/*!
@@ -980,13 +1009,18 @@ bool QQuickWidget::event(QEvent *e)
switch (e->type()) {
#ifndef QT_NO_DRAGANDDROP
case QEvent::Drop:
- case QEvent::DragEnter:
case QEvent::DragMove:
case QEvent::DragLeave:
// Drag/drop events only have local pos, so no need to map,
// but QQuickWindow::event() does not return true
d->offscreenWindow->event(e);
return e->isAccepted();
+ case QEvent::DragEnter:
+ // Don't reject drag events for the entire widget when one
+ // item rejects the drag enter
+ d->offscreenWindow->event(e);
+ e->accept();
+ return true;
#endif
case QEvent::TouchBegin:
case QEvent::TouchEnd:
@@ -1038,10 +1072,7 @@ void QQuickWidget::setFormat(const QSurfaceFormat &format)
newFormat.setDepthBufferSize(qMax(newFormat.depthBufferSize(), currentFormat.depthBufferSize()));
newFormat.setStencilBufferSize(qMax(newFormat.stencilBufferSize(), currentFormat.stencilBufferSize()));
newFormat.setAlphaBufferSize(qMax(newFormat.alphaBufferSize(), currentFormat.alphaBufferSize()));
- if (currentFormat != newFormat) {
- d->offscreenWindow->setFormat(newFormat);
- d->createOffscreenSurface();
- }
+ d->offscreenWindow->setFormat(newFormat);
}
/*!
diff --git a/src/quickwidgets/qquickwidget_p.h b/src/quickwidgets/qquickwidget_p.h
index 8efe32b3ce..356c34e7f5 100644
--- a/src/quickwidgets/qquickwidget_p.h
+++ b/src/quickwidgets/qquickwidget_p.h
@@ -87,7 +87,6 @@ public:
void createContext();
void destroyContext();
void handleContextCreationFailure(const QSurfaceFormat &format, bool isEs);
- void createOffscreenSurface();
GLuint textureId() const Q_DECL_OVERRIDE;
@@ -108,6 +107,7 @@ public:
QOffscreenSurface *offscreenSurface;
QQuickRenderControl *renderControl;
QOpenGLFramebufferObject *fbo;
+ QOpenGLFramebufferObject *resolvedFbo;
QOpenGLContext *context;
QQuickWidget::ResizeMode resizeMode;
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index 2b1b7ce6ec..cebe9cb1ba 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -143,7 +143,8 @@ public:
{
}
- QList<QQmlProfilerData> synchronousMessages;
+ QList<QQmlProfilerData> qmlMessages;
+ QList<QQmlProfilerData> javascriptMessages;
QList<QQmlProfilerData> asynchronousMessages;
QList<QQmlProfilerData> pixmapMessages;
@@ -324,14 +325,12 @@ void QQmlProfilerClient::messageReceived(const QByteArray &message)
if (data.messageType == QQmlProfilerClient::PixmapCacheEvent)
pixmapMessages.append(data);
else if (data.messageType == QQmlProfilerClient::SceneGraphFrame ||
- (data.messageType == QQmlProfilerClient::Event &&
- (data.detailType == QQmlProfilerClient::FramePaint ||
- data.detailType == QQmlProfilerClient::AnimationFrame ||
- data.detailType == QQmlProfilerClient::Mouse ||
- data.detailType == QQmlProfilerClient::Key)))
+ data.messageType == QQmlProfilerClient::Event)
asynchronousMessages.append(data);
+ else if (data.detailType == QQmlProfilerClient::Javascript)
+ javascriptMessages.append(data);
else
- synchronousMessages.append(data);
+ qmlMessages.append(data);
}
void tst_QQmlProfilerService::connect(bool block, const QString &testFile)
@@ -360,23 +359,30 @@ void tst_QQmlProfilerService::connect(bool block, const QString &testFile)
void tst_QQmlProfilerService::checkTraceReceived()
{
QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time.");
- QVERIFY(m_client->synchronousMessages.count());
+ QVERIFY(m_client->asynchronousMessages.count());
// must start with "StartTrace"
- QCOMPARE(m_client->synchronousMessages.first().messageType, (int)QQmlProfilerClient::Event);
- QCOMPARE(m_client->synchronousMessages.first().detailType, (int)QQmlProfilerClient::StartTrace);
+ QCOMPARE(m_client->asynchronousMessages.first().messageType, (int)QQmlProfilerClient::Event);
+ QCOMPARE(m_client->asynchronousMessages.first().detailType, (int)QQmlProfilerClient::StartTrace);
// must end with "EndTrace"
- QCOMPARE(m_client->synchronousMessages.last().messageType, (int)QQmlProfilerClient::Event);
- QCOMPARE(m_client->synchronousMessages.last().detailType, (int)QQmlProfilerClient::EndTrace);
+ QCOMPARE(m_client->asynchronousMessages.last().messageType, (int)QQmlProfilerClient::Event);
+ QCOMPARE(m_client->asynchronousMessages.last().detailType, (int)QQmlProfilerClient::EndTrace);
}
void tst_QQmlProfilerService::cleanup()
{
if (QTest::currentTestFailed()) {
- qDebug() << "Synchronous Messages:" << m_client->synchronousMessages.count();
+ qDebug() << "QML Messages:" << m_client->qmlMessages.count();
int i = 0;
- foreach (const QQmlProfilerData &data, m_client->synchronousMessages) {
+ foreach (const QQmlProfilerData &data, m_client->qmlMessages) {
+ qDebug() << i++ << data.time << data.messageType << data.detailType << data.detailData
+ << data.line << data.column;
+ }
+ qDebug() << " ";
+ qDebug() << "JavaScript Messages:" << m_client->javascriptMessages.count();
+ i = 0;
+ foreach (const QQmlProfilerData &data, m_client->javascriptMessages) {
qDebug() << i++ << data.time << data.messageType << data.detailType << data.detailData
<< data.line << data.column;
}
@@ -547,22 +553,22 @@ void tst_QQmlProfilerService::signalSourceLocation()
m_client->setTraceState(false);
checkTraceReceived();
- QVERIFY2(m_client->synchronousMessages.count() >= 20,
- QString::number(m_client->synchronousMessages.count()).toUtf8().constData());
-
- QCOMPARE(m_client->synchronousMessages[14].messageType, (int)QQmlProfilerClient::RangeLocation);
- QCOMPARE(m_client->synchronousMessages[14].detailType, (int)QQmlProfilerClient::HandlingSignal);
- QVERIFY2(m_client->synchronousMessages[14].detailData.endsWith("signalSourceLocation.qml"),
- m_client->synchronousMessages[14].detailData.toUtf8().constData());
- QCOMPARE(m_client->synchronousMessages[14].line, 8);
- QCOMPARE(m_client->synchronousMessages[14].column, 28);
-
- QCOMPARE(m_client->synchronousMessages[19].messageType, (int)QQmlProfilerClient::RangeLocation);
- QCOMPARE(m_client->synchronousMessages[19].detailType, (int)QQmlProfilerClient::HandlingSignal);
- QVERIFY2(m_client->synchronousMessages[19].detailData.endsWith("signalSourceLocation.qml"),
- m_client->synchronousMessages[19].detailData.toUtf8().constData());
- QCOMPARE(m_client->synchronousMessages[19].line, 7);
- QCOMPARE(m_client->synchronousMessages[19].column, 21);
+ QVERIFY2(m_client->qmlMessages.count() >= 16,
+ QString::number(m_client->qmlMessages.count()).toUtf8().constData());
+
+ QCOMPARE(m_client->qmlMessages[13].messageType, (int)QQmlProfilerClient::RangeLocation);
+ QCOMPARE(m_client->qmlMessages[13].detailType, (int)QQmlProfilerClient::HandlingSignal);
+ QVERIFY2(m_client->qmlMessages[13].detailData.endsWith("signalSourceLocation.qml"),
+ m_client->qmlMessages[13].detailData.toUtf8().constData());
+ QCOMPARE(m_client->qmlMessages[13].line, 8);
+ QCOMPARE(m_client->qmlMessages[13].column, 28);
+
+ QCOMPARE(m_client->qmlMessages[15].messageType, (int)QQmlProfilerClient::RangeLocation);
+ QCOMPARE(m_client->qmlMessages[15].detailType, (int)QQmlProfilerClient::HandlingSignal);
+ QVERIFY2(m_client->qmlMessages[15].detailData.endsWith("signalSourceLocation.qml"),
+ m_client->qmlMessages[15].detailData.toUtf8().constData());
+ QCOMPARE(m_client->qmlMessages[15].line, 7);
+ QCOMPARE(m_client->qmlMessages[15].column, 21);
}
void tst_QQmlProfilerService::javascript()
@@ -577,26 +583,26 @@ void tst_QQmlProfilerService::javascript()
m_client->setTraceState(false);
checkTraceReceived();
- QVERIFY2(m_client->synchronousMessages.count() >= 36,
- QString::number(m_client->synchronousMessages.count()).toUtf8().constData());
+ QVERIFY2(m_client->javascriptMessages.count() >= 22,
+ QString::number(m_client->javascriptMessages.count()).toUtf8().constData());
- QCOMPARE(m_client->synchronousMessages[32].messageType, (int)QQmlProfilerClient::RangeStart);
- QCOMPARE(m_client->synchronousMessages[32].detailType, (int)QQmlProfilerClient::Javascript);
+ QCOMPARE(m_client->javascriptMessages[6].messageType, (int)QQmlProfilerClient::RangeStart);
+ QCOMPARE(m_client->javascriptMessages[6].detailType, (int)QQmlProfilerClient::Javascript);
- QCOMPARE(m_client->synchronousMessages[33].messageType, (int)QQmlProfilerClient::RangeLocation);
- QCOMPARE(m_client->synchronousMessages[33].detailType, (int)QQmlProfilerClient::Javascript);
- QVERIFY2(m_client->synchronousMessages[33].detailData.endsWith("javascript.qml"),
- m_client->synchronousMessages[33].detailData.toUtf8().constData());
- QCOMPARE(m_client->synchronousMessages[33].line, 4);
- QCOMPARE(m_client->synchronousMessages[33].column, 5);
+ QCOMPARE(m_client->javascriptMessages[7].messageType, (int)QQmlProfilerClient::RangeLocation);
+ QCOMPARE(m_client->javascriptMessages[7].detailType, (int)QQmlProfilerClient::Javascript);
+ QVERIFY2(m_client->javascriptMessages[7].detailData.endsWith("javascript.qml"),
+ m_client->javascriptMessages[7].detailData.toUtf8().constData());
+ QCOMPARE(m_client->javascriptMessages[7].line, 4);
+ QCOMPARE(m_client->javascriptMessages[7].column, 5);
- QCOMPARE(m_client->synchronousMessages[34].messageType, (int)QQmlProfilerClient::RangeData);
- QCOMPARE(m_client->synchronousMessages[34].detailType, (int)QQmlProfilerClient::Javascript);
- QVERIFY2(m_client->synchronousMessages[34].detailData == "something",
- m_client->synchronousMessages[34].detailData.toUtf8().constData());
+ QCOMPARE(m_client->javascriptMessages[8].messageType, (int)QQmlProfilerClient::RangeData);
+ QCOMPARE(m_client->javascriptMessages[8].detailType, (int)QQmlProfilerClient::Javascript);
+ QVERIFY2(m_client->javascriptMessages[8].detailData == "something",
+ m_client->javascriptMessages[8].detailData.toUtf8().constData());
- QCOMPARE(m_client->synchronousMessages[35].messageType, (int)QQmlProfilerClient::RangeEnd);
- QCOMPARE(m_client->synchronousMessages[35].detailType, (int)QQmlProfilerClient::Javascript);
+ QCOMPARE(m_client->javascriptMessages[21].messageType, (int)QQmlProfilerClient::RangeEnd);
+ QCOMPARE(m_client->javascriptMessages[21].detailType, (int)QQmlProfilerClient::Javascript);
}
QTEST_MAIN(tst_QQmlProfilerService)
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 9183c37df1..feef9d27f8 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -206,6 +206,7 @@ signals:
void slotWithSingleArgCalled(const QString &arg);
void slotWithArgumentsCalled(const QString &arg1, const QString &arg2, const QString &arg3);
void slotWithOverloadedArgumentsCalled(const QString &arg, Qt::KeyboardModifier modifier, Qt::KeyboardModifiers moreModifiers);
+ void slotWithTwoOverloadedArgumentsCalled(const QString &arg, Qt::KeyboardModifiers moreModifiers, Qt::KeyboardModifier modifier);
public slots:
void slotToCall() { emit slotWithoutArgCalled(); }
@@ -218,6 +219,10 @@ public slots:
{
emit slotWithOverloadedArgumentsCalled(arg, modifier, blah);
}
+ void slotToCallTwoDefault(const QString &arg, Qt::KeyboardModifiers modifiers = Qt::ShiftModifier | Qt::ControlModifier, Qt::KeyboardModifier modifier = Qt::AltModifier)
+ {
+ emit slotWithTwoOverloadedArgumentsCalled(arg, modifiers, modifier);
+ }
};
void tst_QJSEngine::callQObjectSlot()
@@ -275,6 +280,50 @@ void tst_QJSEngine::callQObjectSlot()
QCOMPARE(int(qvariant_cast<Qt::KeyboardModifiers>(arguments.at(2))), int(Qt::ShiftModifier));
}
+
+ {
+ QSignalSpy spy(&dummy, SIGNAL(slotWithTwoOverloadedArgumentsCalled(QString, Qt::KeyboardModifiers, Qt::KeyboardModifier)));
+ QJSValue v = eng.evaluate(QStringLiteral("dummy.slotToCallTwoDefault('arg', %1);").arg(QString::number(Qt::MetaModifier | Qt::KeypadModifier)));
+ QCOMPARE(spy.count(), 1);
+
+ const QList<QVariant> arguments = spy.first();
+ QCOMPARE(arguments.at(0).toString(), QString("arg"));
+ QCOMPARE(int(qvariant_cast<Qt::KeyboardModifiers>(arguments.at(1))), int(Qt::MetaModifier | Qt::KeypadModifier));
+ QCOMPARE(int(qvariant_cast<Qt::KeyboardModifier>(arguments.at(2))), int(Qt::AltModifier));
+ }
+
+ QJSValue jsArray = eng.newArray();
+ jsArray.setProperty(QStringLiteral("MetaModifier"), QJSValue(Qt::MetaModifier));
+ jsArray.setProperty(QStringLiteral("ShiftModifier"), QJSValue(Qt::ShiftModifier));
+ jsArray.setProperty(QStringLiteral("ControlModifier"), QJSValue(Qt::ControlModifier));
+ jsArray.setProperty(QStringLiteral("KeypadModifier"), QJSValue(Qt::KeypadModifier));
+
+ QJSValue value = eng.newQObject(new QObject);
+ value.setPrototype(jsArray);
+ eng.globalObject().setProperty(QStringLiteral("Qt"), value);
+
+ {
+ QSignalSpy spy(&dummy, SIGNAL(slotWithOverloadedArgumentsCalled(QString, Qt::KeyboardModifier, Qt::KeyboardModifiers)));
+ QJSValue v = eng.evaluate(QStringLiteral("dummy.slotToCall('arg', Qt.ControlModifier);"));
+ QCOMPARE(spy.count(), 1);
+
+ const QList<QVariant> arguments = spy.first();
+ QCOMPARE(arguments.at(0).toString(), QString("arg"));
+ QCOMPARE(arguments.at(1).toInt(), int(Qt::ControlModifier));
+ QCOMPARE(int(qvariant_cast<Qt::KeyboardModifiers>(arguments.at(2))), int(Qt::ShiftModifier));
+ }
+
+ {
+ QSignalSpy spy(&dummy, SIGNAL(slotWithTwoOverloadedArgumentsCalled(QString, Qt::KeyboardModifiers, Qt::KeyboardModifier)));
+ QJSValue v = eng.evaluate(QStringLiteral("dummy.slotToCallTwoDefault('arg', Qt.MetaModifier | Qt.KeypadModifier);"));
+ QCOMPARE(spy.count(), 1);
+
+ const QList<QVariant> arguments = spy.first();
+ QCOMPARE(arguments.at(0).toString(), QString("arg"));
+ QCOMPARE(int(qvariant_cast<Qt::KeyboardModifiers>(arguments.at(1))), int(Qt::MetaModifier | Qt::KeypadModifier));
+ QCOMPARE(int(qvariant_cast<Qt::KeyboardModifier>(arguments.at(2))), int(Qt::AltModifier));
+ }
+
}
void tst_QJSEngine::constructWithParent()
diff --git a/tests/auto/quick/qquickgridview/data/negativeDisplayMargin.qml b/tests/auto/quick/qquickgridview/data/negativeDisplayMargin.qml
new file mode 100644
index 0000000000..96063e32cf
--- /dev/null
+++ b/tests/auto/quick/qquickgridview/data/negativeDisplayMargin.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Canonical Limited and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.3
+
+ListView {
+ id: list
+ width: 400
+ height: 600
+ model: ListModel {
+ ListElement { kind: "Bought" }
+ ListElement { kind: "Available To Buy" }
+ }
+
+ delegate: GridView {
+ id: grid
+ objectName: "grid"
+ height: Math.ceil(count / (width / cellWidth)) * cellHeight / 1
+ width: list.width
+ interactive: false
+ property int count: 50
+ cellHeight: 200
+ cellWidth: cellHeight
+ model: count
+ property int createdItems: 0
+ property int destroyedItems: 0
+
+ delegate: Item {
+ objectName: "delegate"
+ width: cellWidth
+ height: cellHeight
+ Rectangle {
+ width: parent.width - 20
+ height: parent.height - 20
+ anchors.centerIn: parent
+ color: Math.random() * 2 > 1 ? "green" : "yellow";
+ Text {
+ text: index
+ }
+ Component.onCompleted: createdItems++
+ Component.onDestruction: destroyedItems++
+ }
+ }
+
+ displayMarginBeginning: 0
+ displayMarginEnd: -height
+
+ function updatedDelegateCreationRange() {
+ if (list.contentY + list.height <= grid.y) {
+ // Not visible
+ grid.displayMarginBeginning = 0
+ grid.displayMarginEnd = -grid.height
+ } else if (grid.y + grid.height <= list.contentY) {
+ // Not visible
+ grid.displayMarginBeginning = -grid.height
+ grid.displayMarginEnd = 0
+ } else {
+ grid.displayMarginBeginning = -Math.max(list.contentY - grid.y, 0)
+ grid.displayMarginEnd = -Math.max(grid.height - list.height - list.contentY + grid.y, 0)
+ }
+ }
+
+ Component.onCompleted: updatedDelegateCreationRange();
+ onHeightChanged: updatedDelegateCreationRange();
+ Connections {
+ target: list
+ onContentYChanged: updatedDelegateCreationRange();
+ onHeightChanged: updatedDelegateCreationRange();
+ }
+ }
+
+ section.property: "kind"
+ section.delegate: Text {
+ height: 40
+ font.pixelSize: 30
+ text: section
+ }
+}
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 890174e2a8..863fb69b84 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -210,6 +210,7 @@ private slots:
void moved_topToBottom_RtL_BtT_data();
void displayMargin();
+ void negativeDisplayMargin();
private:
QList<int> toIntList(const QVariantList &list);
@@ -6393,6 +6394,49 @@ void tst_QQuickGridView::displayMargin()
delete window;
}
+void tst_QQuickGridView::negativeDisplayMargin()
+{
+ QQuickItem *item;
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("negativeDisplayMargin.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickItem *listview = window->rootObject();
+ QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid");
+ QVERIFY(gridview != 0);
+
+ QTRY_COMPARE(gridview->property("createdItems").toInt(), 11);
+ QCOMPARE(gridview->property("destroyedItem").toInt(), 0);
+
+ QQuickItem *content = gridview->contentItem();
+ QVERIFY(content != 0);
+
+ QVERIFY(item = findItem<QQuickItem>(content, "delegate", 0));
+ QCOMPARE(delegateVisible(item), true);
+
+ QVERIFY(item = findItem<QQuickItem>(content, "delegate", 7));
+ QCOMPARE(delegateVisible(item), true);
+
+ QVERIFY(item = findItem<QQuickItem>(content, "delegate", 8));
+ QCOMPARE(delegateVisible(item), false);
+
+ // Flick until contentY means that delegate8 should be visible
+ listview->setProperty("contentY", 500);
+ QVERIFY(item = findItem<QQuickItem>(content, "delegate", 8));
+ QTRY_COMPARE(delegateVisible(item), true);
+
+ listview->setProperty("contentY", 1000);
+ QTRY_VERIFY(item = findItem<QQuickItem>(content, "delegate", 14));
+ QTRY_COMPARE(delegateVisible(item), true);
+
+ listview->setProperty("contentY", 0);
+ QVERIFY(item = findItem<QQuickItem>(content, "delegate", 4));
+ QTRY_COMPARE(delegateVisible(item), true);
+
+ delete window;
+}
+
QTEST_MAIN(tst_QQuickGridView)
#include "tst_qquickgridview.moc"
diff --git a/tests/auto/quick/qquickitem2/data/keysforward.qml b/tests/auto/quick/qquickitem2/data/keysforward.qml
index f0cb4d9508..5677aa62f1 100644
--- a/tests/auto/quick/qquickitem2/data/keysforward.qml
+++ b/tests/auto/quick/qquickitem2/data/keysforward.qml
@@ -58,7 +58,7 @@ Item {
objectName: "primary"
property var pressedKeys: []
property var releasedKeys: []
- Keys.forwardTo: secondaryTarget
+ Keys.forwardTo: [ secondaryTarget, extraTarget ]
Keys.onPressed: { event.accepted = event.key === Qt.Key_P; var keys = pressedKeys; keys.push(event.key); pressedKeys = keys }
Keys.onReleased: { event.accepted = event.key === Qt.Key_P; var keys = releasedKeys; keys.push(event.key); releasedKeys = keys }
@@ -81,4 +81,8 @@ Item {
Keys.onPressed: { event.accepted = event.key === Qt.Key_S; var keys = pressedKeys; keys.push(event.key); pressedKeys = keys }
Keys.onReleased: { event.accepted = event.key === Qt.Key_S; var keys = releasedKeys; keys.push(event.key); releasedKeys = keys }
}
+
+ Item {
+ id: extraTarget
+ }
}
diff --git a/tests/auto/quick/qquicklistview/data/negativeDisplayMargin.qml b/tests/auto/quick/qquicklistview/data/negativeDisplayMargin.qml
new file mode 100644
index 0000000000..64d9ce1956
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/negativeDisplayMargin.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Canonical Limited and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.3
+
+ListView {
+ id: list
+ width: 400
+ height: 600
+ model: ListModel {
+ ListElement { kind: "Bought" }
+ ListElement { kind: "Available To Buy" }
+ }
+
+ delegate: ListView {
+ id: innerList
+ objectName: "innerList"
+ height: count * lineHeight
+ width: list.width
+ interactive: false
+ property int count: 50
+ model: count
+ property int createdItems: 0
+ property int destroyedItems: 0
+ property int lineHeight: 85
+
+ delegate: Item {
+ objectName: "delegate"
+ width: innerList.width
+ height: innerList.lineHeight
+ Rectangle {
+ width: parent.width - 20
+ height: parent.height - 20
+ anchors.centerIn: parent
+ color: Math.random() * 2 > 1 ? "green" : "yellow";
+ Text {
+ text: index
+ }
+ Component.onCompleted: createdItems++
+ Component.onDestruction: destroyedItems++
+ }
+ }
+
+ displayMarginBeginning: 0
+ displayMarginEnd: -height
+
+ function updatedDelegateCreationRange() {
+ if (list.contentY + list.height <= innerList.y) {
+ // Not visible
+ innerList.displayMarginBeginning = 0
+ innerList.displayMarginEnd = -innerList.height
+ } else if (innerList.y + innerList.height <= list.contentY) {
+ // Not visible
+ innerList.displayMarginBeginning = -innerList.height
+ innerList.displayMarginEnd = 0
+ } else {
+ innerList.displayMarginBeginning = -Math.max(list.contentY - innerList.y, 0)
+ innerList.displayMarginEnd = -Math.max(innerList.height - list.height - list.contentY + innerList.y, 0)
+ }
+ }
+
+ Component.onCompleted: updatedDelegateCreationRange();
+ onHeightChanged: updatedDelegateCreationRange();
+ Connections {
+ target: list
+ onContentYChanged: updatedDelegateCreationRange();
+ onHeightChanged: updatedDelegateCreationRange();
+ }
+ }
+
+ section.property: "kind"
+ section.delegate: Text {
+ height: 40
+ font.pixelSize: 30
+ text: section
+ }
+}
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index c05434166d..b909d14301 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -221,6 +221,7 @@ private slots:
void typedModel();
void displayMargin();
+ void negativeDisplayMargin();
void highlightItemGeometryChanges();
@@ -7203,6 +7204,49 @@ void tst_QQuickListView::displayMargin()
delete window;
}
+void tst_QQuickListView::negativeDisplayMargin()
+{
+ QQuickItem *item;
+ QQuickView *window = createView();
+ window->setSource(testFileUrl("negativeDisplayMargin.qml"));
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickItem *listview = window->rootObject();
+ QQuickListView *innerList = findItem<QQuickListView>(window->rootObject(), "innerList");
+ QVERIFY(innerList != 0);
+
+ QTRY_COMPARE(innerList->property("createdItems").toInt(), 11);
+ QCOMPARE(innerList->property("destroyedItem").toInt(), 0);
+
+ QQuickItem *content = innerList->contentItem();
+ QVERIFY(content != 0);
+
+ QVERIFY(item = findItem<QQuickItem>(content, "delegate", 0));
+ QCOMPARE(delegateVisible(item), true);
+
+ QVERIFY(item = findItem<QQuickItem>(content, "delegate", 7));
+ QCOMPARE(delegateVisible(item), true);
+
+ QVERIFY(item = findItem<QQuickItem>(content, "delegate", 8));
+ QCOMPARE(delegateVisible(item), false);
+
+ // Flick until contentY means that delegate8 should be visible
+ listview->setProperty("contentY", 500);
+ QVERIFY(item = findItem<QQuickItem>(content, "delegate", 8));
+ QTRY_COMPARE(delegateVisible(item), true);
+
+ listview->setProperty("contentY", 1000);
+ QTRY_VERIFY(item = findItem<QQuickItem>(content, "delegate", 14));
+ QTRY_COMPARE(delegateVisible(item), true);
+
+ listview->setProperty("contentY", 0);
+ QTRY_VERIFY(item = findItem<QQuickItem>(content, "delegate", 4));
+ QTRY_COMPARE(delegateVisible(item), true);
+
+ delete window;
+}
+
void tst_QQuickListView::highlightItemGeometryChanges()
{
QScopedPointer<QQuickView> window(createView());
diff --git a/tests/auto/quick/scenegraph/data/render_OpacityThroughBatchRoot.qml b/tests/auto/quick/scenegraph/data/render_OpacityThroughBatchRoot.qml
new file mode 100644
index 0000000000..ed55a98979
--- /dev/null
+++ b/tests/auto/quick/scenegraph/data/render_OpacityThroughBatchRoot.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2
+
+/*
+ This test verifies that when we have an update to opacity above
+ a batch root, the opacity of the batch root's children is rendered
+ correctly. The Text element has 1000 glyphs in it, which is needed
+ for contentRoot to become a batch root when the scale changes.
+
+ #samples: 2
+ PixelPos R G B Error-tolerance
+ #base: 50 50 0.0 0.0 1.0 0.0
+ #final: 50 50 0.5 0.5 1.0 0.05
+*/
+
+RenderTestBase {
+ id: root
+
+ Item {
+ id: failRoot;
+ property alias itemScale: contentItem.scale
+
+ Item {
+ id: contentItem
+ width: 100
+ height: 100
+ Rectangle {
+ width: 100
+ height: 100
+ color: "blue"
+ Text {
+ id: input
+ color: "black"
+ Component.onCompleted: { for (var i = 0; i<1000; ++i) input.text += 'x' }
+ }
+ }
+ }
+ }
+
+ SequentialAnimation {
+ id: unifiedAnimation;
+ NumberAnimation { properties: "opacity,itemScale"; duration: 256; from: 1; to: 0.5; target: failRoot }
+ ScriptAction { script: root.finalStageComplete = true; }
+ }
+
+ onEnterFinalStage: {
+ unifiedAnimation.running = true;
+ }
+
+}
diff --git a/tests/auto/quick/scenegraph/tst_scenegraph.cpp b/tests/auto/quick/scenegraph/tst_scenegraph.cpp
index ac4938e8bc..d510fdcda8 100644
--- a/tests/auto/quick/scenegraph/tst_scenegraph.cpp
+++ b/tests/auto/quick/scenegraph/tst_scenegraph.cpp
@@ -43,7 +43,7 @@
#include <QtQuick>
-#include <private/qsgcontext_p.h>
+#include <private/qopenglcontext_p.h>
#include <QtQml>
@@ -168,7 +168,7 @@ void tst_SceneGraph::manyWindows_data()
struct ShareContextResetter {
public:
- ~ShareContextResetter() { QSGContext::setSharedOpenGLContext(0); }
+ ~ShareContextResetter() { QOpenGLContextPrivate::setGlobalShareContext(0); }
};
void tst_SceneGraph::manyWindows()
@@ -181,7 +181,7 @@ void tst_SceneGraph::manyWindows()
ShareContextResetter cleanup; // To avoid dangling pointer in case of test-failure.
if (shared) {
sharedGLContext.create();
- QSGContext::setSharedOpenGLContext(&sharedGLContext);
+ QOpenGLContextPrivate::setGlobalShareContext(&sharedGLContext);
}
QScopedPointer<QWindow> parent;
@@ -328,7 +328,8 @@ void tst_SceneGraph::render_data()
<< "data/render_StackingOrder.qml"
<< "data/render_Mipmap.qml"
<< "data/render_ImageFiltering.qml"
- << "data/render_bug37555.qml"
+ << "data/render_bug37422.qml"
+ << "data/render_OpacityThroughBatchRoot.qml"
;
QRegExp sampleCount("#samples: *(\\d+)");