diff options
23 files changed, 102 insertions, 35 deletions
diff --git a/src/qml/doc/src/javascript/qmlglobalobject.qdoc b/src/qml/doc/src/javascript/qmlglobalobject.qdoc index c9e018525a..b3d8a2b2a5 100644 --- a/src/qml/doc/src/javascript/qmlglobalobject.qdoc +++ b/src/qml/doc/src/javascript/qmlglobalobject.qdoc @@ -45,7 +45,9 @@ additional imports: \li \l{XMLHttpRequest}, DOMException: These objects implement a subset of the \l{http://www.w3.org/TR/XMLHttpRequest/}{W3C XMLHttpRequest specification}. \endlist - +\note The \l {QJSEngine::}{globalObject()} function cannot be used to modify +the global object of a \l QQmlEngine. For more information about this, see +\l {JavaScript Environment Restrictions}. \target XMLHttpRequest \section1 XMLHttpRequest diff --git a/src/qml/doc/src/qtqml.qdoc b/src/qml/doc/src/qtqml.qdoc index 64d6bb9ac4..33bb0c0750 100644 --- a/src/qml/doc/src/qtqml.qdoc +++ b/src/qml/doc/src/qtqml.qdoc @@ -106,8 +106,8 @@ JavaScript expressions allow QML code to contain application logic. Qt QML provides the framework for running JavaScript expressions in QML and from C++. These sections are from \l{The QML Reference}. -\l{qtqml-javascript-topic.html}{Integrating QML and JavaScript} \list + \li \l{qtqml-javascript-topic.html}{Integrating QML and JavaScript} \li \l{qtqml-javascript-expressions.html}{Using JavaScript Expressions with QML} \li \l{qtqml-javascript-dynamicobjectcreation.html}{Dynamic QML Object Creation from JavaScript} \li \l{qtqml-javascript-resources.html}{Defining JavaScript Resources In QML} @@ -140,8 +140,6 @@ Further information for writing QML applications: - essential information for application development with QML and Qt Quick \li \l{Qt Quick} - a module which provides a set of QML types and C++ classes for building user interfaces and applications with QML -\li \l{Qt QML Release Notes} - list of changes and - additions in the Qt QML module \endlist \section2 Reference diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h index 6f5564300f..413181309f 100644 --- a/src/qml/jsruntime/qv4managed_p.h +++ b/src/qml/jsruntime/qv4managed_p.h @@ -60,7 +60,7 @@ inline void qYouForgotTheQ_MANAGED_Macro(T1, T2) {} #define V4_NEEDS_DESTROY static void destroy(QV4::Heap::Base *b) { static_cast<Data *>(b)->~Data(); } -#define V4_MANAGED(DataClass, superClass) \ +#define V4_MANAGED_ITSELF(DataClass, superClass) \ public: \ Q_MANAGED_CHECK \ typedef QV4::Heap::DataClass Data; \ @@ -70,6 +70,12 @@ inline void qYouForgotTheQ_MANAGED_Macro(T1, T2) {} V4_MANAGED_SIZE_TEST \ QV4::Heap::DataClass *d() const { return static_cast<QV4::Heap::DataClass *>(m()); } +#define V4_MANAGED(DataClass, superClass) \ + private: \ + DataClass() Q_DECL_EQ_DELETE; \ + Q_DISABLE_COPY(DataClass) \ + V4_MANAGED_ITSELF(DataClass, superClass) + #define Q_MANAGED_TYPE(type) \ public: \ enum { MyType = Type_##type }; @@ -100,7 +106,7 @@ const QV4::VTable classname::static_vtbl = DEFINE_MANAGED_VTABLE_INT(classname, struct Q_QML_PRIVATE_EXPORT Managed : Value { - V4_MANAGED(Base, Managed) + V4_MANAGED_ITSELF(Base, Managed) enum { IsExecutionContext = false, IsString = false, diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index 58dab9691f..b87e8fe0ad 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -73,6 +73,9 @@ struct Object : Base { Data *d() const { return static_cast<Data *>(m()); } #define V4_OBJECT2(DataClass, superClass) \ + private: \ + DataClass() Q_DECL_EQ_DELETE; \ + Q_DISABLE_COPY(DataClass) \ public: \ Q_MANAGED_CHECK \ typedef QV4::Heap::DataClass Data; \ diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index be482b4639..040089db20 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -777,8 +777,8 @@ QObject *QQmlComponent::create(QQmlContext *context) /*! This method provides advanced control over component instance creation. - In general, programmers should use QQmlComponent::create() to create a - component. + In general, programmers should use QQmlComponent::create() to create object + instances. Create an object instance from this component. Returns 0 if creation failed. \a publicContext specifies the context within which to create the object diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 9c5e48ae32..0c003790dd 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -912,7 +912,7 @@ QQuickWorkerScriptEngine *QQmlEnginePrivate::getWorkerScriptEngine() Note that the \l {Qt Quick 1} version is called QDeclarativeEngine. - \sa QQmlComponent, QQmlContext + \sa QQmlComponent, QQmlContext, {QML Global Object} */ /*! diff --git a/src/qml/qml/qqmlinfo.h b/src/qml/qml/qqmlinfo.h index b56f74198c..90ac1dd777 100644 --- a/src/qml/qml/qqmlinfo.h +++ b/src/qml/qml/qqmlinfo.h @@ -48,7 +48,11 @@ namespace QtQml { Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QQmlError &error); Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors); } +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wheader-hygiene") +// This is necessary to allow for QtQuick1 and QtQuick2 scenes in a single application. using namespace QtQml; +QT_WARNING_POP class QQmlInfoPrivate; class Q_QML_EXPORT QQmlInfo : public QDebug diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 8666c0db01..043113bc31 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -314,10 +314,6 @@ struct Node : public Object static ReturnedValue create(ExecutionEngine *v4, NodeImpl *); bool isNull() const; - -private: - Node &operator=(const Node &); - Node(const Node &o); }; Heap::Node::Node(NodeImpl *data) diff --git a/src/qml/types/qqmlitemselectionmodel.qdoc b/src/qml/types/qqmlitemselectionmodel.qdoc index 441d219de8..b4da0c63f3 100644 --- a/src/qml/types/qqmlitemselectionmodel.qdoc +++ b/src/qml/types/qqmlitemselectionmodel.qdoc @@ -38,7 +38,7 @@ This page only enumerates the properties, methods, and signals available in QML. See \l QItemSelectionModel for the actual documentation of this class. - \sa ItemModels + \sa QItemSelectionModel, {Models and Views in Qt Quick} */ diff --git a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc index 0a8fc2ab0a..187085a5d8 100644 --- a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc +++ b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc @@ -762,7 +762,7 @@ with multiple windows. faster to process in the renderer and faster to draw on the GPU. For instance, PNG files will often have an alpha channel, even though each pixel is fully opaque. JPG files are always opaque. When - providing images to an QQuickImageProvider or creating images with + providing images to a QQuickImageProvider or creating images with QQuickWindow::createTextureFromImage(), let the image have QImage::Format_RGB32, when possible. 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 *); diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 9cfec370f9..edaa1352ae 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -211,6 +211,8 @@ void QQuickWidgetPrivate::render(bool needsSync) if (!fbo) return; + Q_ASSERT(context); + if (!context->makeCurrent(offscreenSurface)) { qWarning("QQuickWidget: Cannot render due to failing makeCurrent()"); return; @@ -1089,7 +1091,10 @@ void QQuickWidget::showEvent(QShowEvent *) Q_D(QQuickWidget); d->updatePending = false; d->createContext(); - d->render(true); + if (d->offscreenWindow->openglContext()) + d->render(true); + else + triggerUpdate(); } /*! \reimp */ |