diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-10-02 14:41:35 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-10-02 14:41:35 +0200 |
commit | 4653217c3f36e7914f2cc0573347a078dd11768f (patch) | |
tree | 7c7e862bdec55ae7ea0e2b6816bda189febbe4d1 /src/quick/items | |
parent | c5dcabeb6a07ed358e64f26cd8475bfe5daae0e4 (diff) | |
parent | ad125bd18ef5c98a264b9e4fac258dd07511035d (diff) |
Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
src/quickwidgets/qquickwidget.cpp
Change-Id: I3e2326bc86a9d3adaafbe3830b75ce9afa81c45b
Diffstat (limited to 'src/quick/items')
-rw-r--r-- | src/quick/items/context2d/qquickcanvasitem.cpp | 6 | ||||
-rw-r--r-- | src/quick/items/qquickframebufferobject.cpp | 6 | ||||
-rw-r--r-- | src/quick/items/qquickimage.cpp | 7 | ||||
-rw-r--r-- | src/quick/items/qquickimagebase.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickitem.cpp | 19 | ||||
-rw-r--r-- | src/quick/items/qquickitemviewtransition.cpp | 6 | ||||
-rw-r--r-- | src/quick/items/qquickpincharea.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickscreen.cpp | 27 | ||||
-rw-r--r-- | src/quick/items/qquickscreen_p.h | 2 | ||||
-rw-r--r-- | src/quick/items/qquickshadereffect.cpp | 8 | ||||
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 4 | ||||
-rw-r--r-- | src/quick/items/qquickwindow_p.h | 2 |
12 files changed, 72 insertions, 19 deletions
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index 070ede930a..9abca59b1c 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -774,6 +774,12 @@ bool QQuickCanvasItem::isTextureProvider() const QSGTextureProvider *QQuickCanvasItem::textureProvider() const { + // When Item::layer::enabled == true, QQuickItem will be a texture + // provider. In this case we should prefer to return the layer rather + // than the canvas itself. + if (QQuickItem::isTextureProvider()) + return QQuickItem::textureProvider(); + Q_D(const QQuickCanvasItem); QQuickWindow *w = window(); if (!w || !w->openglContext() || QThread::currentThread() != w->openglContext()->thread()) { diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp index 74abd8cf9f..5ce3ae57f7 100644 --- a/src/quick/items/qquickframebufferobject.cpp +++ b/src/quick/items/qquickframebufferobject.cpp @@ -342,6 +342,12 @@ bool QQuickFramebufferObject::isTextureProvider() const */ QSGTextureProvider *QQuickFramebufferObject::textureProvider() const { + // When Item::layer::enabled == true, QQuickItem will be a texture + // provider. In this case we should prefer to return the layer rather + // than the fbo texture. + if (QQuickItem::isTextureProvider()) + return QQuickItem::textureProvider(); + Q_D(const QQuickFramebufferObject); QQuickWindow *w = window(); if (!w || !w->openglContext() || QThread::currentThread() != w->openglContext()->thread()) { diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp index 3ba09f9cea..483d86c97d 100644 --- a/src/quick/items/qquickimage.cpp +++ b/src/quick/items/qquickimage.cpp @@ -551,6 +551,13 @@ QSGTextureProvider *QQuickImage::textureProvider() const { Q_D(const QQuickImage); + // When Item::layer::enabled == true, QQuickItem will be a texture + // provider. In this case we should prefer to return the layer rather + // than the image itself. The layer will include any children and any + // the image's wrap and fill mode. + if (QQuickItem::isTextureProvider()) + return QQuickItem::textureProvider(); + if (!d->window || !d->sceneGraphRenderContext() || QThread::currentThread() != d->sceneGraphRenderContext()->thread()) { qWarning("QQuickImage::textureProvider: can only be queried on the rendering thread of an exposed window"); return 0; diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp index 1ad37ef414..c37e6c942c 100644 --- a/src/quick/items/qquickimagebase.cpp +++ b/src/quick/items/qquickimagebase.cpp @@ -320,7 +320,7 @@ void QQuickImageBase::itemChange(ItemChange change, const ItemChangeData &value) void QQuickImageBase::handleScreenChanged(QScreen* screen) { // Screen DPI might have changed, reload images on screen change. - if (screen && isComponentComplete()) + if (qmlEngine(this) && screen && isComponentComplete()) load(); } diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 80bad4dc27..fdbd4c90a3 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -7445,9 +7445,11 @@ bool QQuickItem::event(QEvent *ev) dropEvent(static_cast<QDropEvent*>(ev)); break; #endif // QT_NO_DRAGANDDROP +#ifndef QT_NO_GESTURES case QEvent::NativeGesture: ev->ignore(); break; +#endif // QT_NO_GESTURES default: return QObject::event(ev); } @@ -7560,6 +7562,8 @@ QQuickItemLayer::~QQuickItemLayer() None of the other layer properties have any effect when the layer is disabled. + + \sa {Item Layers} */ void QQuickItemLayer::setEnabled(bool e) { @@ -7684,7 +7688,7 @@ void QQuickItemLayer::deactivateEffect() The effect is typically a \l ShaderEffect component, although any \l Item component can be assigned. The effect should have a source texture property with a name matching \l layer.samplerName. - \sa layer.samplerName + \sa layer.samplerName, {Item Layers} */ void QQuickItemLayer::setEffect(QQmlComponent *component) @@ -7724,6 +7728,8 @@ void QQuickItemLayer::setEffect(QQmlComponent *component) \note Some OpenGL ES 2 implementations do not support mipmapping of non-power-of-two textures. + + \sa {Item Layers} */ void QQuickItemLayer::setMipmap(bool mipmap) @@ -7757,6 +7763,7 @@ void QQuickItemLayer::setMipmap(bool mipmap) be used with caution, as support for these formats in the underlying hardare and driver is often not present. + \sa {Item Layers} */ void QQuickItemLayer::setFormat(QQuickShaderEffectSource::Format f) @@ -7779,6 +7786,8 @@ void QQuickItemLayer::setFormat(QQuickShaderEffectSource::Format f) rendered into the texture. The source rectangle can be larger than the item itself. If the rectangle is null, which is the default, then the whole item is rendered to the texture. + + \sa {Item Layers} */ void QQuickItemLayer::setSourceRect(const QRectF &sourceRect) @@ -7797,6 +7806,8 @@ void QQuickItemLayer::setSourceRect(const QRectF &sourceRect) \qmlproperty bool QtQuick::Item::layer.smooth Holds whether the layer is smoothly transformed. + + \sa {Item Layers} */ void QQuickItemLayer::setSmooth(bool s) @@ -7820,6 +7831,8 @@ void QQuickItemLayer::setSmooth(bool s) \note Some platforms have a limit on how small framebuffer objects can be, which means the actual texture size might be larger than the requested size. + + \sa {Item Layers} */ void QQuickItemLayer::setSize(const QSize &size) @@ -7850,6 +7863,8 @@ void QQuickItemLayer::setSize(const QSize &size) \note Some OpenGL ES 2 implementations do not support the GL_REPEAT wrap mode with non-power-of-two textures. + + \sa {Item Layers} */ void QQuickItemLayer::setWrapMode(QQuickShaderEffectSource::WrapMode mode) @@ -7901,7 +7916,7 @@ void QQuickItemLayer::setTextureMirroring(QQuickShaderEffectSource::TextureMirro This value must match the name of the effect's source texture property so that the Item can pass the layer's offscreen surface to the effect correctly. - \sa layer.effect, ShaderEffect + \sa layer.effect, ShaderEffect, {Item Layers} */ void QQuickItemLayer::setName(const QByteArray &name) { diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp index 6fa299bf03..565377df58 100644 --- a/src/quick/items/qquickitemviewtransition.cpp +++ b/src/quick/items/qquickitemviewtransition.cpp @@ -851,7 +851,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) */ /*! - \qmlattachedproperty list QtQuick::ViewTransition::index + \qmlattachedproperty int QtQuick::ViewTransition::index This attached property holds the index of the item that is being transitioned. @@ -861,7 +861,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) */ /*! - \qmlattachedproperty list QtQuick::ViewTransition::item + \qmlattachedproperty item QtQuick::ViewTransition::item This attached property holds the item that is being transitioned. @@ -870,7 +870,7 @@ QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) */ /*! - \qmlattachedproperty list QtQuick::ViewTransition::destination + \qmlattachedproperty point QtQuick::ViewTransition::destination This attached property holds the final destination position for the transitioned item within the view. diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp index 07bf268309..f419d570f3 100644 --- a/src/quick/items/qquickpincharea.cpp +++ b/src/quick/items/qquickpincharea.cpp @@ -765,11 +765,11 @@ bool QQuickPinchArea::event(QEvent *event) d->pinchRotation = angle; updatePinchTarget(); } break; -#endif // QT_NO_GESTURES default: return QQuickItem::event(event); } } break; +#endif // QT_NO_GESTURES case QEvent::Wheel: event->ignore(); return false; diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp index 3bf7229b33..5bd6430f2d 100644 --- a/src/quick/items/qquickscreen.cpp +++ b/src/quick/items/qquickscreen.cpp @@ -351,15 +351,24 @@ void QQuickScreenAttached::screenChanged(QScreen *screen) emit orientationUpdateMaskChanged(); } - emit widthChanged(); - emit heightChanged(); - emit nameChanged(); - emit orientationChanged(); - emit primaryOrientationChanged(); - emit desktopGeometryChanged(); - emit logicalPixelDensityChanged(); - emit pixelDensityChanged(); - emit devicePixelRatioChanged(); + if (!oldScreen || screen->size() != oldScreen->size()) { + emit widthChanged(); + emit heightChanged(); + } + if (!oldScreen || screen->name() != oldScreen->name()) + emit nameChanged(); + if (!oldScreen || screen->orientation() != oldScreen->orientation()) + emit orientationChanged(); + if (!oldScreen || screen->primaryOrientation() != oldScreen->primaryOrientation()) + emit primaryOrientationChanged(); + if (!oldScreen || screen->availableVirtualGeometry() != oldScreen->availableVirtualGeometry()) + emit desktopGeometryChanged(); + if (!oldScreen || screen->logicalDotsPerInch() != oldScreen->logicalDotsPerInch()) + emit logicalPixelDensityChanged(); + if (!oldScreen || screen->physicalDotsPerInch() != oldScreen->physicalDotsPerInch()) + emit pixelDensityChanged(); + if (!oldScreen || screen->devicePixelRatio() != oldScreen->devicePixelRatio()) + emit devicePixelRatioChanged(); connect(screen, SIGNAL(geometryChanged(QRect)), this, SIGNAL(widthChanged())); diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h index 3d0f00b22c..266f7bfed8 100644 --- a/src/quick/items/qquickscreen_p.h +++ b/src/quick/items/qquickscreen_p.h @@ -102,7 +102,7 @@ protected Q_SLOTS: void screenChanged(QScreen*); private: - QScreen* m_screen; + QPointer<QScreen> m_screen; QQuickWindow* m_window; QQuickItem* m_attachee; Qt::ScreenOrientations m_updateMask; diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp index 0be305b693..349207f145 100644 --- a/src/quick/items/qquickshadereffect.cpp +++ b/src/quick/items/qquickshadereffect.cpp @@ -578,8 +578,12 @@ void QQuickShaderEffectCommon::propertyChanged(QQuickItem *item, int mappedId, \li QTransform -> mat3 \li QMatrix4x4 -> mat4 \li QQuaternion -> vec4, scalar value is \c w. - \li \l Image, \l ShaderEffectSource -> sampler2D - Origin is in the top-left - corner, and the color values are premultiplied. + \li \l Image -> sampler2D - Origin is in the top-left corner, and the + color values are premultiplied. The texture is provided as is, + excluding the Image item's fillMode. To include fillMode, use a + ShaderEffectSource or Image::layer::enabled. + \li \l ShaderEffectSource -> sampler2D - Origin is in the top-left + corner, and the color values are premultiplied. \endlist The QML scene graph back-end may choose to allocate textures in texture diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 8ab910f299..48b7c5841a 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -1401,9 +1401,11 @@ bool QQuickWindow::event(QEvent *e) d->windowManager->handleUpdateRequest(this); break; } +#ifndef QT_NO_GESTURES case QEvent::NativeGesture: d->deliverNativeGestureEvent(d->contentItem, static_cast<QNativeGestureEvent*>(e)); break; +#endif default: break; } @@ -1780,6 +1782,7 @@ void QQuickWindow::wheelEvent(QWheelEvent *event) } #endif // QT_NO_WHEELEVENT +#ifndef QT_NO_GESTURES bool QQuickWindowPrivate::deliverNativeGestureEvent(QQuickItem *item, QNativeGestureEvent *event) { QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); @@ -1811,6 +1814,7 @@ bool QQuickWindowPrivate::deliverNativeGestureEvent(QQuickItem *item, QNativeGes return false; } +#endif // QT_NO_GESTURES bool QQuickWindowPrivate::deliverTouchCancelEvent(QTouchEvent *event) { diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index 0d33d2398a..e475c48b0a 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -145,7 +145,9 @@ public: #ifndef QT_NO_WHEELEVENT bool deliverWheelEvent(QQuickItem *, QWheelEvent *); #endif +#ifndef QT_NO_GESTURES bool deliverNativeGestureEvent(QQuickItem *, QNativeGestureEvent *); +#endif bool deliverTouchPoints(QQuickItem *, QTouchEvent *, const QList<QTouchEvent::TouchPoint> &, QSet<int> *, QHash<QQuickItem *, QList<QTouchEvent::TouchPoint> > *, QSet<QQuickItem*> *filtered); void deliverTouchEvent(QTouchEvent *); |