aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-06-30 09:08:35 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-06-30 09:08:35 +0200
commit5112821a37ab749f758e354e84703df2d09d5471 (patch)
tree8f19ba6e7661109675b5e1e9b0ddae94b4c96d4f /src/quick
parent5d2ea1d5e9d6e29a16d0e9333cfc2dc8e7c5b677 (diff)
parenta3f686cf7cc14ff481b972b1170a7ff76d0e0fd0 (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts: .qmake.conf src/qml/qml/qqmlengine.cpp src/quick/items/qquickitemsmodule.cpp tools/qml/main.cpp Change-Id: Ida8daf6b4d7e675385f2f5514c446e52dedaf136
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/doc/snippets/qml/loader/KeyReader.qml3
-rw-r--r--src/quick/doc/snippets/qml/loader/sizeitem.qml29
-rw-r--r--src/quick/doc/snippets/qml/loader/sizeloader.qml29
-rw-r--r--src/quick/doc/snippets/qml/propertyanimation.qml6
-rw-r--r--src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc4
-rw-r--r--src/quick/doc/src/concepts/visualcanvas/visualparent.qdoc8
-rw-r--r--src/quick/doc/src/qmltypereference.qdoc56
-rw-r--r--src/quick/items/qquickimage.cpp1
-rw-r--r--src/quick/items/qquickimage_p.h2
-rw-r--r--src/quick/items/qquickimagebase.cpp6
-rw-r--r--src/quick/items/qquickimagebase_p.h5
-rw-r--r--src/quick/items/qquickitemsmodule.cpp1
-rw-r--r--src/quick/items/qquicklistview.cpp30
-rw-r--r--src/quick/items/qquickloader.cpp11
-rw-r--r--src/quick/items/qquickmousearea.cpp1
-rw-r--r--src/quick/items/qquickmousearea_p.h4
-rw-r--r--src/quick/items/qquickshadereffect.cpp11
-rw-r--r--src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp5
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp49
-rw-r--r--src/quick/scenegraph/qsgdefaultrectanglenode.cpp8
-rw-r--r--src/quick/scenegraph/scenegraph.qrc2
-rw-r--r--src/quick/scenegraph/shaders/32bitcolortext.frag9
-rw-r--r--src/quick/scenegraph/shaders/32bitcolortext_core.frag13
-rw-r--r--src/quick/scenegraph/shaders/smoothtexture_core.vert7
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp11
-rw-r--r--src/quick/util/qquickanimation.cpp5
26 files changed, 223 insertions, 93 deletions
diff --git a/src/quick/doc/snippets/qml/loader/KeyReader.qml b/src/quick/doc/snippets/qml/loader/KeyReader.qml
index a61d2bd11a..eebd72b96d 100644
--- a/src/quick/doc/snippets/qml/loader/KeyReader.qml
+++ b/src/quick/doc/snippets/qml/loader/KeyReader.qml
@@ -37,7 +37,8 @@ Item {
Item {
focus: true
Keys.onPressed: {
- console.log("Loaded item captured:", event.text);
+ console.log("Loaded item captured:",
+ event.text);
event.accepted = true;
}
}
diff --git a/src/quick/doc/snippets/qml/loader/sizeitem.qml b/src/quick/doc/snippets/qml/loader/sizeitem.qml
index db79e28816..750ea9f58a 100644
--- a/src/quick/doc/snippets/qml/loader/sizeitem.qml
+++ b/src/quick/doc/snippets/qml/loader/sizeitem.qml
@@ -34,21 +34,22 @@
import QtQuick 2.0
Item {
- width: 200; height: 200
+ width: 200; height: 200
- Loader {
- // position the Loader in the center of the parent
- anchors.centerIn: parent
- sourceComponent: rect
- }
+ Loader {
+ // position the Loader in the center
+ // of the parent
+ anchors.centerIn: parent
+ sourceComponent: rect
+ }
- Component {
- id: rect
- Rectangle {
- width: 50
- height: 50
- color: "red"
- }
- }
+ Component {
+ id: rect
+ Rectangle {
+ width: 50
+ height: 50
+ color: "red"
+ }
+ }
}
//![0]
diff --git a/src/quick/doc/snippets/qml/loader/sizeloader.qml b/src/quick/doc/snippets/qml/loader/sizeloader.qml
index d691f460cb..9643768774 100644
--- a/src/quick/doc/snippets/qml/loader/sizeloader.qml
+++ b/src/quick/doc/snippets/qml/loader/sizeloader.qml
@@ -34,21 +34,22 @@
import QtQuick 2.0
Item {
- width: 200; height: 200
+ width: 200; height: 200
- Loader {
- // Explicitly set the size of the Loader to the parent item's size
- anchors.fill: parent
- sourceComponent: rect
- }
+ Loader {
+ // Explicitly set the size of the
+ // Loader to the parent item's size
+ anchors.fill: parent
+ sourceComponent: rect
+ }
- Component {
- id: rect
- Rectangle {
- width: 50
- height: 50
- color: "red"
- }
- }
+ Component {
+ id: rect
+ Rectangle {
+ width: 50
+ height: 50
+ color: "red"
+ }
+ }
}
//![0]
diff --git a/src/quick/doc/snippets/qml/propertyanimation.qml b/src/quick/doc/snippets/qml/propertyanimation.qml
index 2d8a3744ce..1cbb84e1db 100644
--- a/src/quick/doc/snippets/qml/propertyanimation.qml
+++ b/src/quick/doc/snippets/qml/propertyanimation.qml
@@ -92,7 +92,11 @@ Rectangle {
color: "red"
// this is a standalone animation, it's not running by default
- PropertyAnimation { id: animation; target: theRect; property: "width"; to: 30; duration: 500 }
+ PropertyAnimation { id: animation;
+ target: theRect;
+ property: "width";
+ to: 30;
+ duration: 500 }
MouseArea { anchors.fill: parent; onClicked: animation.running = true }
}
diff --git a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
index 40190051e2..dffcabbd5b 100644
--- a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
+++ b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
@@ -169,6 +169,7 @@ created directly as types within QML:
\table
\row
+\li C++
\li
\code
class MyModelPlugin : public QQmlExtensionPlugin
@@ -183,7 +184,8 @@ public:
}
}
\endcode
-
+\row
+\li QML
\li
\qml
MyModel {
diff --git a/src/quick/doc/src/concepts/visualcanvas/visualparent.qdoc b/src/quick/doc/src/concepts/visualcanvas/visualparent.qdoc
index 9ccb0b53b3..fd5bf51307 100644
--- a/src/quick/doc/src/concepts/visualcanvas/visualparent.qdoc
+++ b/src/quick/doc/src/concepts/visualcanvas/visualparent.qdoc
@@ -63,7 +63,9 @@ import QtQuick 2.0
Item {
width: 100; height: 100
- Rectangle { width: 50; height: 50; color: "red" }
+ Rectangle { width: 50;
+ height: 50;
+ color: "red" }
}
\endcode
@@ -75,7 +77,9 @@ Item {
width: 100; height: 100
data: [
- Rectangle { width: 50; height: 50; color: "red" }
+ Rectangle { width: 50;
+ height: 50;
+ color: "red" }
]
}
\endcode
diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc
index e3641f2d76..630e0f58bc 100644
--- a/src/quick/doc/src/qmltypereference.qdoc
+++ b/src/quick/doc/src/qmltypereference.qdoc
@@ -252,7 +252,7 @@ available when you import \c QtQuick.
The vector2d type has the following idempotent functions which can be
invoked in QML:
- \table
+ \table 60%
\header
\li Function Signature
\li Description
@@ -430,9 +430,11 @@ console.log(c); // 32
the 4x4 \c matrix with the matrix applied post-vector
\li \code
var a = Qt.vector3d(1,2,3);
-var b = Qt.matrix4x4(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
+var b = Qt.matrix4x4(4,5,6,7,8,9,10,11,
+ 12,13,14,15,16,17,18,19);
var c = a.times(b);
-console.log(c.toString()); // QVector3D(0.774194, 0.849462, 0.924731)
+console.log(c.toString());
+// QVector3D(0.774194, 0.849462, 0.924731)
\endcode
\row
@@ -481,7 +483,8 @@ console.log(c.toString()); // QVector3D(-3, -3, -3)
\li \code
var a = Qt.vector3d(1,2,3);
var b = a.normalized();
-console.log(b.toString()); // QVector3D(0.267261, 0.534522, 0.801784)
+console.log(b.toString());
+// QVector3D(0.267261, 0.534522, 0.801784)
\endcode
\row
@@ -515,7 +518,8 @@ console.log(b.toString()); // QVector4D(1, 2, 3, 0)
\li bool fuzzyEquals(vector3d other, real epsilon)
\li Returns true if \c this vector3d is approximately equal to the \c other vector3d.
The approximation will be true if each attribute of \c this is within \c epsilon
- of \c other. Note that \c epsilon is an optional argument, the default \c epsilon
+ of \c other.
+ Note that \c epsilon is an optional argument, the default \c epsilon
is 0.00001.
\li \code
var a = Qt.vector3d(1,2,3);
@@ -591,7 +595,8 @@ console.log(c.toString()); // QVector4D(5, 12, 21, 32)
var a = Qt.vector4d(1,2,3,4);
var b = 4.48;
var c = a.times(b);
-console.log(c.toString()); // QVector3D(4.48, 8.96, 13.44, 17.92)
+console.log(c.toString()); // QVector3D(4.48, 8.96,
+ 13.44, 17.92)
\endcode
\row
@@ -620,7 +625,8 @@ console.log(c.toString()); // QVector4D(-4, -4, -4, -4)
\li \code
var a = Qt.vector4d(1,2,3,4);
var b = a.normalized();
-console.log(b.toString()); // QVector4D(0.182574, 0.365148, 0.547723, 0.730297)
+console.log(b.toString());
+// QVector4D(0.182574, 0.365148, 0.547723, 0.730297)
\endcode
\row
@@ -701,7 +707,7 @@ console.log(c + " " + d); // false true
The matrix4x4 type has the following idempotent functions which can be
invoked in QML:
- \table
+ \table 70 %
\header
\li Function Signature
\li Description
@@ -715,7 +721,9 @@ console.log(c + " " + d); // false true
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.matrix4x4(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
var c = a.times(b);
-console.log(c.toString()); // QMatrix4x4(120, 130, 140, 150, 280, 306, 332, 358, 440, 482, 524, 566, 600, 658, 716, 774)
+console.log(c.toString());
+// QMatrix4x4(120, 130, 140, 150, 280, 306, 332, 358, 440, 482,
+//524, 566, 600, 658, 716, 774)
\endcode
\row
@@ -749,7 +757,9 @@ console.log(c.toString()); // QVector3D(0.155556, 0.437037, 0.718518)
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = 4.48;
var c = a.times(b);
-console.log(c.toString()); // QMatrix4x4(4.48, 8.96, 13.44, 17.92, 22.4, 26.88, 31.36, 35.84, 40.32, 44.8, 49.28, 53.76, 58.24, 62.72, 67.2, 71.68)
+console.log(c.toString());
+// QMatrix4x4(4.48, 8.96, 13.44, 17.92, 22.4, 26.88, 31.36, 35.84,
+// 40.32, 44.8, 49.28, 53.76, 58.24, 62.72, 67.2, 71.68)
\endcode
\row
@@ -759,7 +769,9 @@ console.log(c.toString()); // QMatrix4x4(4.48, 8.96, 13.44, 17.92, 22.4, 26.88,
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.matrix4x4(5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
var c = a.plus(b);
-console.log(c.toString()); // QMatrix4x4(6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36)
+console.log(c.toString());
+// QMatrix4x4(6, 8, 10, 12, 14, 16, 18, 20, 22,
+// 24, 26, 28, 30, 32, 34, 36)
\endcode
\row
@@ -769,7 +781,9 @@ console.log(c.toString()); // QMatrix4x4(6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 2
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.matrix4x4(5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
var c = a.minus(b);
-console.log(c.toString()); // QMatrix4x4(-4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4)
+console.log(c.toString());
+// QMatrix4x4(-4, -4, -4, -4, -4, -4, -4, -4, -4,
+// -4, -4, -4, -4, -4, -4, -4)
\endcode
\row
@@ -780,7 +794,8 @@ console.log(c.toString()); // QMatrix4x4(-4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.vector4d(a.m21, a.m22, a.m23, a.m24);
var c = a.row(2); // zero based access! so not equal to b
-console.log(b.toString() + " " + c.toString()); // QVector4D(5, 6, 7, 8) QVector4D(9, 10, 11, 12)
+console.log(b.toString() + " " + c.toString());
+// QVector4D(5, 6, 7, 8) QVector4D(9, 10, 11, 12)
\endcode
\row
@@ -791,7 +806,8 @@ console.log(b.toString() + " " + c.toString()); // QVector4D(5, 6, 7, 8) QVector
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.vector4d(a.m12, a.m22, a.m32, a.m42);
var c = a.column(2); // zero based access! so not equal to b
-console.log(b.toString() + " " + c.toString()); // QVector4D(2, 6, 10, 14) QVector4D(3, 7, 11, 15)
+console.log(b.toString() + " " + c.toString());
+// QVector4D(2, 6, 10, 14) QVector4D(3, 7, 11, 15)
\endcode
\row
@@ -809,7 +825,9 @@ console.log(b); // 6
\li \code
var a = Qt.matrix4x4(1,0,0,0,0,2,0,0,0,0,3,0,100,200,300,1);
var b = a.inverted();
-console.log(b.toString()); // QMatrix4x4(1, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.333333, 0, -100, -100, -100, 1)
+console.log(b.toString());
+// QMatrix4x4(1, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.333333, 0, -100,
+// -100, -100, 1)
\endcode
\row
@@ -818,7 +836,8 @@ console.log(b.toString()); // QMatrix4x4(1, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.33333
\li \code
var a = Qt.matrix4x4(1,0,0,0,0,2,0,0,0,0,3,0,100,200,300,1);
var b = a.transposed();
-console.log(b.toString()); // QMatrix4x4(1, 0, 0, 100, 0, 2, 0, 200, 0, 0, 3, 300, 0, 0, 0, 1)
+console.log(b.toString());
+// QMatrix4x4(1, 0, 0, 100, 0, 2, 0, 200, 0, 0, 3, 300, 0, 0, 0, 1)
\endcode
\row
@@ -829,7 +848,10 @@ console.log(b.toString()); // QMatrix4x4(1, 0, 0, 100, 0, 2, 0, 200, 0, 0, 3, 30
argument, the default \c epsilon is 0.00001.
\li \code
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
-var b = Qt.matrix4x4(1.0001,2.0001,3.0002,4.0003,5.0001,6.0002,7.0002,8.0004,9.0001,10.0003,11.0003,12.0004,13.0001,14.0002,15.0003,16.0004);
+var b = Qt.matrix4x4(1.0001,2.0001,3.0002,4.0003,5.0001,6.0002,
+ 7.0002,8.0004, 9.0001,10.0003,
+ 11.0003,12.0004,13.0001,
+ 14.0002,15.0003,16.0004);
var c = a.fuzzyEquals(b); // default epsilon
var d = a.fuzzyEquals(b, 0.005); // supplied epsilon
console.log(c + " " + d); // false true
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp
index f0f17551b7..3ba09f9cea 100644
--- a/src/quick/items/qquickimage.cpp
+++ b/src/quick/items/qquickimage.cpp
@@ -152,7 +152,6 @@ QQuickImagePrivate::QQuickImagePrivate()
QQuickImage::QQuickImage(QQuickItem *parent)
: QQuickImageBase(*(new QQuickImagePrivate), parent)
{
- connect(this, SIGNAL(autoTransformBaseChanged()), SIGNAL(autoTransformChanged()));
}
QQuickImage::QQuickImage(QQuickImagePrivate &dd, QQuickItem *parent)
diff --git a/src/quick/items/qquickimage_p.h b/src/quick/items/qquickimage_p.h
index b8a0b3b86f..a780f9a626 100644
--- a/src/quick/items/qquickimage_p.h
+++ b/src/quick/items/qquickimage_p.h
@@ -88,6 +88,8 @@ public:
bool mipmap() const;
void setMipmap(bool use);
+ virtual void emitAutoTransformBaseChanged() { emit autoTransformChanged(); }
+
Q_SIGNALS:
void fillModeChanged();
void paintedGeometryChanged();
diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp
index cb2bf574b5..e54f5bb9c9 100644
--- a/src/quick/items/qquickimagebase.cpp
+++ b/src/quick/items/qquickimagebase.cpp
@@ -197,7 +197,7 @@ void QQuickImageBase::load()
}
if (autoTransform() != d->oldAutoTransform) {
d->oldAutoTransform = autoTransform();
- emit autoTransformBaseChanged();
+ emitAutoTransformBaseChanged();
}
update();
@@ -296,7 +296,7 @@ void QQuickImageBase::requestFinished()
}
if (autoTransform() != d->oldAutoTransform) {
d->oldAutoTransform = autoTransform();
- emit autoTransformBaseChanged();
+ emitAutoTransformBaseChanged();
}
update();
}
@@ -402,7 +402,7 @@ void QQuickImageBase::setAutoTransform(bool transform)
if (d->autoTransform != UsePluginDefault && transform == (d->autoTransform == ApplyTransform))
return;
d->autoTransform = transform ? ApplyTransform : DoNotApplyTransform;
- emit autoTransformBaseChanged();
+ emitAutoTransformBaseChanged();
}
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickimagebase_p.h b/src/quick/items/qquickimagebase_p.h
index 638b8dbdcf..98943a235c 100644
--- a/src/quick/items/qquickimagebase_p.h
+++ b/src/quick/items/qquickimagebase_p.h
@@ -83,6 +83,10 @@ public:
void resolve2xLocalFile(const QUrl &url, qreal targetDevicePixelRatio, QUrl *sourceUrl, qreal *sourceDevicePixelRatio);
+ // Use a virtual rather than a signal->signal to avoid the huge
+ // connect/conneciton overhead for this rare case.
+ virtual void emitAutoTransformBaseChanged() { }
+
Q_SIGNALS:
void sourceChanged(const QUrl &);
void sourceSizeChanged();
@@ -91,7 +95,6 @@ Q_SIGNALS:
void asynchronousChanged();
void cacheChanged();
void mirrorChanged();
- void autoTransformBaseChanged();
protected:
virtual void load();
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index 6e50a9a77b..8a6766770e 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -260,6 +260,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickPinchArea, 1>(uri, 2, 5,"PinchArea");
qmlRegisterType<QQuickImage, 2>(uri, 2, 5,"Image");
+ qmlRegisterType<QQuickMouseArea, 2>(uri, 2, 5, "MouseArea");
qmlRegisterType<QQuickText, 6>(uri, 2, 6, "Text");
qmlRegisterType<QQuickTextEdit, 6>(uri, 2, 6, "TextEdit");
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index c14419dbee..a2920f8bad 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -1157,9 +1157,11 @@ void QQuickListViewPrivate::updateSections()
if (visibleIndex > 0)
prevSection = sectionAt(visibleIndex-1);
QQuickListViewAttached *prevAtt = 0;
+ int prevIdx = -1;
int idx = -1;
for (int i = 0; i < visibleItems.count(); ++i) {
- QQuickListViewAttached *attached = static_cast<QQuickListViewAttached*>(visibleItems.at(i)->attached);
+ FxViewItem *item = visibleItems.at(i);
+ QQuickListViewAttached *attached = static_cast<QQuickListViewAttached*>(item->attached);
attached->setPrevSection(prevSection);
if (visibleItems.at(i)->index != -1) {
QString propValue = model->stringValue(visibleItems.at(i)->index, sectionCriteria->property());
@@ -1168,9 +1170,10 @@ void QQuickListViewPrivate::updateSections()
}
updateInlineSection(static_cast<FxListItemSG*>(visibleItems.at(i)));
if (prevAtt)
- prevAtt->setNextSection(attached->section());
+ prevAtt->setNextSection(sectionAt(prevIdx+1));
prevSection = attached->section();
prevAtt = attached;
+ prevIdx = item->index;
}
if (prevAtt) {
if (idx > 0 && idx < model->count()-1)
@@ -3088,6 +3091,18 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch
: visibleItems.last()->endPosition()+spacing;
}
+ // Update the indexes of the following visible items.
+ for (int i = 0; i < visibleItems.count(); ++i) {
+ FxViewItem *item = visibleItems.at(i);
+ if (item->index != -1 && item->index >= modelIndex) {
+ item->index += count;
+ if (change.isMove())
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, false);
+ else
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, false);
+ }
+ }
+
int prevVisibleCount = visibleItems.count();
if (insertResult->visiblePos.isValid() && pos < insertResult->visiblePos) {
// Insert items before the visible item.
@@ -3153,17 +3168,6 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch
}
}
- for (; index < visibleItems.count(); ++index) {
- FxViewItem *item = visibleItems.at(index);
- if (item->index != -1) {
- item->index += count;
- if (change.isMove())
- item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, false);
- else
- item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, false);
- }
- }
-
updateVisibleIndex();
return visibleItems.count() > prevVisibleCount;
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index c1e3fbb4e0..df09780895 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -217,7 +217,7 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const
loads \c MyItem.qml, and is able to receive the \c message signal from
the loaded item through a \l Connections object:
- \table
+ \table 70%
\row
\li application.qml
\li MyItem.qml
@@ -263,7 +263,6 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const
In some cases you may wish to use a Loader within a view delegate to improve delegate
loading performance. This works well in most cases, but there is one important issue to
- be aware of related to the \l{QtQml::Component#Creation Context}{creation context} of a Component.
In the following example, the \c index context property inserted by the ListView into \c delegateComponent's
context will be inaccessible to Text, as the Loader will use the creation context of \c myComponent as the parent
@@ -516,7 +515,7 @@ void QQuickLoader::loadFromSourceComponent()
is changed after calling this function but prior to setting the loader \l active.
Example:
- \table
+ \table 70%
\row
\li
\qml
@@ -545,11 +544,13 @@ void QQuickLoader::loadFromSourceComponent()
Item {
Loader {
id: squareLoader
- onLoaded: console.log(squareLoader.item.width); // prints [10], not [30]
+ onLoaded: console.log(squareLoader.item.width);
+ // prints [10], not [30]
}
Component.onCompleted: {
- squareLoader.setSource("ExampleComponent.qml", { "color": "blue" });
+ squareLoader.setSource("ExampleComponent.qml",
+ { "color": "blue" });
// will trigger the onLoaded code when complete.
}
}
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index 9b1d54173a..4a44760035 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -498,6 +498,7 @@ void QQuickMouseArea::setEnabled(bool a)
/*!
\qmlproperty bool QtQuick::MouseArea::scrollGestureEnabled
+ \since 5.5
This property controls whether this MouseArea responds to scroll gestures
from non-mouse devices, such as the 2-finger flick gesture on a trackpad.
diff --git a/src/quick/items/qquickmousearea_p.h b/src/quick/items/qquickmousearea_p.h
index 9fa213c254..4ad14e6bdd 100644
--- a/src/quick/items/qquickmousearea_p.h
+++ b/src/quick/items/qquickmousearea_p.h
@@ -54,7 +54,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickMouseArea : public QQuickItem
Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged)
Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
- Q_PROPERTY(bool scrollGestureEnabled READ isScrollGestureEnabled WRITE setScrollGestureEnabled NOTIFY scrollGestureEnabledChanged)
+ Q_PROPERTY(bool scrollGestureEnabled READ isScrollGestureEnabled WRITE setScrollGestureEnabled NOTIFY scrollGestureEnabledChanged REVISION 2)
Q_PROPERTY(Qt::MouseButtons pressedButtons READ pressedButtons NOTIFY pressedButtonsChanged)
Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged)
Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged)
@@ -112,7 +112,7 @@ Q_SIGNALS:
void hoveredChanged();
void pressedChanged();
void enabledChanged();
- void scrollGestureEnabledChanged();
+ Q_REVISION(2) void scrollGestureEnabledChanged();
void pressedButtonsChanged();
void acceptedButtonsChanged();
void hoverEnabledChanged();
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index 5903052dbd..0be305b693 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -601,7 +601,7 @@ void QQuickShaderEffectCommon::propertyChanged(QQuickItem *item, int mappedId,
\l blending is enabled, source-over blending is used. However, additive
blending can be achieved by outputting zero in the alpha channel.
- \table
+ \table 70%
\row
\li \image declarative-shadereffectitem.png
\li \qml
@@ -610,7 +610,8 @@ void QQuickShaderEffectCommon::propertyChanged(QQuickItem *item, int mappedId,
Rectangle {
width: 200; height: 100
Row {
- Image { id: img; sourceSize { width: 100; height: 100 } source: "qt-logo.png" }
+ Image { id: img;
+ sourceSize { width: 100; height: 100 } source: "qt-logo.png" }
ShaderEffect {
width: 100; height: 100
property variant src: img
@@ -629,7 +630,9 @@ void QQuickShaderEffectCommon::propertyChanged(QQuickItem *item, int mappedId,
uniform lowp float qt_Opacity;
void main() {
lowp vec4 tex = texture2D(src, coord);
- gl_FragColor = vec4(vec3(dot(tex.rgb, vec3(0.344, 0.5, 0.156))), tex.a) * qt_Opacity;
+ gl_FragColor = vec4(vec3(dot(tex.rgb,
+ vec3(0.344, 0.5, 0.156))),
+ tex.a) * qt_Opacity;
}"
}
}
@@ -649,6 +652,7 @@ void QQuickShaderEffectCommon::propertyChanged(QQuickItem *item, int mappedId,
\row
\li \b {Layer with effect disabled} \inlineimage qml-shadereffect-nolayereffect.png
\li \b {Layer with effect enabled} \inlineimage qml-shadereffect-layereffect.png
+ \row
\li \snippet qml/layerwitheffect.qml 1
\endtable
@@ -657,6 +661,7 @@ void QQuickShaderEffectCommon::propertyChanged(QQuickItem *item, int mappedId,
\table
\row
\li \inlineimage qml-shadereffect-opacitymask.png
+ \row
\li \snippet qml/opacitymask.qml 1
\endtable
diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
index 136f23f339..dcc485ce17 100644
--- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
+++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
@@ -38,6 +38,7 @@
#include <QtQml/private/qqmlglobal_p.h>
#include <QtQuick/private/qsgdistancefieldutil_p.h>
#include <qopenglfunctions.h>
+#include <qopenglframebufferobject.h>
#include <qmath.h>
#if !defined(QT_OPENGL_ES_2)
@@ -324,7 +325,7 @@ void QSGDefaultDistanceFieldGlyphCache::resizeTexture(TextureInfo *texInfo, int
GL_COLOR_BUFFER_BIT, GL_NEAREST);
// Reset the default framebuffer
- m_coreFuncs->glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ QOpenGLFramebufferObject::bindDefault();
return;
} else if (useTextureResizeWorkaround()) {
@@ -449,7 +450,7 @@ void QSGDefaultDistanceFieldGlyphCache::resizeTexture(TextureInfo *texInfo, int
m_funcs->glDeleteTextures(1, &tmp_texture);
m_funcs->glDeleteTextures(1, &oldTexture);
- m_funcs->glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ QOpenGLFramebufferObject::bindDefault();
// restore render states
if (stencilTestEnabled)
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index 9f1a44154c..14bc0fad07 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -267,6 +267,30 @@ void QSG24BitTextMaskShader::updateState(const RenderState &state, QSGMaterial *
}
}
+class QSG32BitColorTextShader : public QSGTextMaskShader
+{
+public:
+ QSG32BitColorTextShader(QFontEngine::GlyphFormat glyphFormat)
+ : QSGTextMaskShader(glyphFormat)
+ {
+ setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/scenegraph/shaders/32bitcolortext.frag"));
+ }
+
+ void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) Q_DECL_OVERRIDE;
+};
+
+void QSG32BitColorTextShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
+{
+ QSGTextMaskShader::updateState(state, newEffect, oldEffect);
+ QSGTextMaskMaterial *material = static_cast<QSGTextMaskMaterial *>(newEffect);
+ QSGTextMaskMaterial *oldMaterial = static_cast<QSGTextMaskMaterial *>(oldEffect);
+
+ if (oldMaterial == Q_NULLPTR || material->color() != oldMaterial->color() || state.isOpacityDirty()) {
+ float opacity = material->color().w() * state.opacity();
+ program()->setUniformValue(m_color_id, opacity);
+ }
+}
+
class QSGStyledTextShader : public QSG8BitTextMaskShader
{
public:
@@ -497,8 +521,16 @@ void QSGTextMaskMaterial::populate(const QPointF &p,
QSGMaterialType *QSGTextMaskMaterial::type() const
{
- static QSGMaterialType rgb, gray;
- return glyphCache()->glyphFormat() == QFontEngine::Format_A32 ? &rgb : &gray;
+ static QSGMaterialType argb, rgb, gray;
+ switch (glyphCache()->glyphFormat()) {
+ case QFontEngine::Format_ARGB:
+ return &argb;
+ case QFontEngine::Format_A32:
+ return &rgb;
+ case QFontEngine::Format_A8:
+ default:
+ return &gray;
+ }
}
QOpenGLTextureGlyphCache *QSGTextMaskMaterial::glyphCache() const
@@ -508,10 +540,15 @@ QOpenGLTextureGlyphCache *QSGTextMaskMaterial::glyphCache() const
QSGMaterialShader *QSGTextMaskMaterial::createShader() const
{
- QFontEngine::GlyphFormat glyphFormat = glyphCache()->glyphFormat();
- return glyphFormat == QFontEngine::Format_A32
- ? (QSGMaterialShader *) new QSG24BitTextMaskShader(glyphFormat)
- : (QSGMaterialShader *) new QSG8BitTextMaskShader(glyphFormat);
+ switch (QFontEngine::GlyphFormat glyphFormat = glyphCache()->glyphFormat()) {
+ case QFontEngine::Format_ARGB:
+ return new QSG32BitColorTextShader(glyphFormat);
+ case QFontEngine::Format_A32:
+ return new QSG24BitTextMaskShader(glyphFormat);
+ case QFontEngine::Format_A8:
+ default:
+ return new QSG8BitTextMaskShader(glyphFormat);
+ }
}
static inline int qsg_colorDiff(const QVector4D &a, const QVector4D &b)
diff --git a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp
index 3e251a4051..f3f5c7f79f 100644
--- a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp
@@ -323,11 +323,11 @@ void QSGDefaultRectangleNode::updateGeometry()
const QGradientStops &stops = m_gradient_stops;
int nextGradientStop = 0;
- float gradientPos = 0.5f * penWidth / height;
+ float gradientPos = penWidth / height;
while (nextGradientStop < stops.size() && stops.at(nextGradientStop).first <= gradientPos)
++nextGradientStop;
int lastGradientStop = stops.size() - 1;
- float lastGradientPos = 1.0f - 0.5f * penWidth / height;
+ float lastGradientPos = 1.0f - penWidth / height;
while (lastGradientStop >= nextGradientStop && stops.at(lastGradientStop).first >= lastGradientPos)
--lastGradientStop;
int gradientIntersections = (lastGradientStop - nextGradientStop + 1);
@@ -643,11 +643,11 @@ void QSGDefaultRectangleNode::updateGeometry()
for (int part = -1; part <= 1; part += 2) {
float y = (part == 1 ? innerRect.bottom() : innerRect.top());
float Y = (part == 1 ? outerRect.bottom() : outerRect.top());
- gradientPos = (y - innerRect.top() + 0.5f * penWidth) / height;
+ gradientPos = (y - innerRect.top() + penWidth) / height;
while (nextGradientStop <= lastGradientStop && stops.at(nextGradientStop).first <= gradientPos) {
// Insert vertices at gradient stops.
- float gy = (innerRect.top() - 0.5f * penWidth) + stops.at(nextGradientStop).first * height;
+ float gy = (innerRect.top() - penWidth) + stops.at(nextGradientStop).first * height;
fillColor = colorToColor4ub(stops.at(nextGradientStop).second);
diff --git a/src/quick/scenegraph/scenegraph.qrc b/src/quick/scenegraph/scenegraph.qrc
index e6a90c9120..5db242e46b 100644
--- a/src/quick/scenegraph/scenegraph.qrc
+++ b/src/quick/scenegraph/scenegraph.qrc
@@ -4,6 +4,7 @@
<file>shaders/flatcolor.vert</file>
<file>shaders/8bittextmask.frag</file>
<file>shaders/24bittextmask.frag</file>
+ <file>shaders/32bitcolortext.frag</file>
<file>shaders/opaquetexture.frag</file>
<file>shaders/opaquetexture.vert</file>
<file>shaders/outlinedtext.frag</file>
@@ -34,6 +35,7 @@
<file>shaders/stencilclip.vert</file>
<file>shaders/8bittextmask_core.frag</file>
<file>shaders/24bittextmask_core.frag</file>
+ <file>shaders/32bitcolortext_core.frag</file>
<file>shaders/distancefieldoutlinetext_core.frag</file>
<file>shaders/distancefieldshiftedtext_core.frag</file>
<file>shaders/distancefieldshiftedtext_core.vert</file>
diff --git a/src/quick/scenegraph/shaders/32bitcolortext.frag b/src/quick/scenegraph/shaders/32bitcolortext.frag
new file mode 100644
index 0000000000..6fdb6e6aeb
--- /dev/null
+++ b/src/quick/scenegraph/shaders/32bitcolortext.frag
@@ -0,0 +1,9 @@
+varying highp vec2 sampleCoord;
+
+uniform sampler2D _qt_texture;
+uniform lowp float color; // just the alpha, really...
+
+void main()
+{
+ gl_FragColor = texture2D(_qt_texture, sampleCoord) * color;
+}
diff --git a/src/quick/scenegraph/shaders/32bitcolortext_core.frag b/src/quick/scenegraph/shaders/32bitcolortext_core.frag
new file mode 100644
index 0000000000..010aca97b4
--- /dev/null
+++ b/src/quick/scenegraph/shaders/32bitcolortext_core.frag
@@ -0,0 +1,13 @@
+#version 150 core
+
+in vec2 sampleCoord;
+
+out vec4 fragColor;
+
+uniform sampler2D _qt_texture;
+uniform float color; // just the alpha, really...
+
+void main()
+{
+ fragColor = texture(_qt_texture, sampleCoord) * color;
+}
diff --git a/src/quick/scenegraph/shaders/smoothtexture_core.vert b/src/quick/scenegraph/shaders/smoothtexture_core.vert
index a2489a39c5..6821398e57 100644
--- a/src/quick/scenegraph/shaders/smoothtexture_core.vert
+++ b/src/quick/scenegraph/shaders/smoothtexture_core.vert
@@ -50,5 +50,8 @@ void main()
bool onEdge = any(notEqual(vertexOffset, vec2(0.)));
bool outerEdge = all(equal(texCoordOffset, vec2(0.)));
- vertexOpacity = onEdge && outerEdge ? 0. : opacity;
-} \ No newline at end of file
+ if (onEdge && outerEdge)
+ vertexOpacity = 0.;
+ else
+ vertexOpacity = opacity;
+}
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index 7a2587dacd..8c649fb6bd 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -148,8 +148,15 @@ Atlas::Atlas(const QSize &size)
|| deviceName->compare(QStringLiteral("samsung SM-T215"), Qt::CaseInsensitive) == 0);
#else
static bool wrongfullyReportsBgra8888Support = false;
+ // The Raspberry Pi (both 1 and 2) GPU refuses framebuffers with BGRA color attachments.
+ const GLubyte *renderer = QOpenGLContext::currentContext()->functions()->glGetString(GL_RENDERER);
+ if (renderer && strstr((const char *) renderer, "VideoCore IV"))
+ wrongfullyReportsBgra8888Support = true;
#endif // ANDROID
+ if (qEnvironmentVariableIsSet("QSG_ATLAS_NO_BGRA_WORKAROUNDS"))
+ wrongfullyReportsBgra8888Support = false;
+
const char *ext = (const char *) QOpenGLContext::currentContext()->functions()->glGetString(GL_EXTENSIONS);
if (!wrongfullyReportsBgra8888Support
&& (strstr(ext, "GL_EXT_bgra")
@@ -484,7 +491,11 @@ QSGTexture *Texture::removedFromAtlas() const
f->glBindTexture(GL_TEXTURE_2D, texture);
QRect r = atlasSubRectWithoutPadding();
// and copy atlas into our texture.
+ while (f->glGetError() != GL_NO_ERROR) ;
f->glCopyTexImage2D(GL_TEXTURE_2D, 0, m_atlas->internalFormat(), r.x(), r.y(), r.width(), r.height(), 0);
+ // BGRA may have been rejected by some GLES implementations
+ if (f->glGetError() != GL_NO_ERROR)
+ f->glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, r.x(), r.y(), r.width(), r.height(), 0);
m_nonatlas_texture = new QSGPlainTexture();
m_nonatlas_texture->setTextureId(texture);
diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp
index 3a0c19e3d2..ec3abf7090 100644
--- a/src/quick/util/qquickanimation.cpp
+++ b/src/quick/util/qquickanimation.cpp
@@ -2144,7 +2144,10 @@ void QQuickPropertyAnimation::setTo(const QVariant &t)
\c Easing.Linear.
\qml
- PropertyAnimation { properties: "y"; easing.type: Easing.InOutElastic; easing.amplitude: 2.0; easing.period: 1.5 }
+ PropertyAnimation { properties: "y";
+ easing.type: Easing.InOutElastic;
+ easing.amplitude: 2.0;
+ easing.period: 1.5 }
\endqml
Available types are: