aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/items')
-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
10 files changed, 44 insertions, 28 deletions
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