From e05fbf5c8bf636db5c500c3371d673de17de8c33 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 16 Sep 2016 17:32:58 +1000 Subject: Fix MouseArea sticky grab with drag.filterChildren enabled Task-number: QTBUG-56036 Change-Id: Iad776f42cc776e0d397173b3d2f3922eb7914392 Reviewed-by: Andrew den Exter --- src/quick/items/qquickmousearea.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/quick') diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index d66e55aa12..a8a889d47b 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -666,6 +666,7 @@ void QQuickMouseArea::mousePressEvent(QMouseEvent *event) Q_D(QQuickMouseArea); d->moved = false; d->stealMouse = d->preventStealing; + d->overThreshold = false; if (!d->enabled || !(event->button() & acceptedMouseButtons())) { QQuickItem::mousePressEvent(event); } else { @@ -944,6 +945,7 @@ bool QQuickMouseArea::sendMouseEvent(QMouseEvent *event) if (!d->pressed) { // no other buttons are pressed d->stealMouse = false; + d->overThreshold = false; if (c && c->mouseGrabberItem() == this) ungrabMouse(); emit canceled(); -- cgit v1.2.3 From 0aea009425242417bffdb171c8eca02ff52f4a7b Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Thu, 10 Mar 2016 13:28:06 +1000 Subject: Fix Flickable state being reset when it replays a delayed press. Ignore mouseUngrabEvents() triggered by giving mouse grab to a child item when replaying a delayed press event. Change-Id: I6c8db61167e21bf10d533b17f7cc65e4754bd432 Reviewed-by: Shawn Rutledge Reviewed-by: Martin Jones --- src/quick/items/qquickflickable.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 870a0268e1..c838eae3c7 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1539,11 +1539,11 @@ void QQuickFlickablePrivate::replayDelayedPress() // If we have the grab, release before delivering the event if (QQuickWindow *w = q->window()) { + replayingPressEvent = true; if (w->mouseGrabberItem() == q) q->ungrabMouse(); // Use the event handler that will take care of finding the proper item to propagate the event - replayingPressEvent = true; QCoreApplication::sendEvent(w, mouseEvent.data()); replayingPressEvent = false; } @@ -2199,7 +2199,8 @@ void QQuickFlickable::mouseUngrabEvent() Q_D(QQuickFlickable); // if our mouse grab has been removed (probably by another Flickable), // fix our state - d->cancelInteraction(); + if (!d->replayingPressEvent) + d->cancelInteraction(); } void QQuickFlickablePrivate::cancelInteraction() -- cgit v1.2.3 From f5e2783acec1f46070330fc1ce90cb16901a5533 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 21 Sep 2016 12:29:50 +0200 Subject: Quick: Do not send SG updates when AnimatedSprite is not visible Task-number: QTBUG-55935 Change-Id: I475c1bb3e7aae9499b1b07a52f3c10f54c8b3481 Reviewed-by: Gunnar Sletta --- src/quick/items/qquickanimatedsprite.cpp | 32 ++++++++++++++++++++------------ src/quick/items/qquickanimatedsprite_p.h | 1 + 2 files changed, 21 insertions(+), 12 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp index 44b5ff1e45..7fd89e21a1 100644 --- a/src/quick/items/qquickanimatedsprite.cpp +++ b/src/quick/items/qquickanimatedsprite.cpp @@ -35,6 +35,7 @@ #include "qquicksprite_p.h" #include "qquickspriteengine_p.h" #include +#include #include #include #include @@ -362,7 +363,7 @@ void QQuickAnimatedSprite::start() } emit currentFrameChanged(0); emit runningChanged(true); - update(); + maybeUpdate(); } void QQuickAnimatedSprite::stop() @@ -372,7 +373,7 @@ void QQuickAnimatedSprite::stop() return; m_pauseOffset = 0; emit runningChanged(false); - update(); + maybeUpdate(); } /*! @@ -390,7 +391,15 @@ void QQuickAnimatedSprite::advance(int frames) m_curFrame += m_spriteEngine->maxFrames(); m_curFrame = m_curFrame % m_spriteEngine->maxFrames(); emit currentFrameChanged(m_curFrame); - update(); + maybeUpdate(); +} + +void QQuickAnimatedSprite::maybeUpdate() +{ + QQuickItemPrivate *priv = QQuickItemPrivate::get(this); + const QLazilyAllocated &extraData = priv->extra; + if ((extraData.isAllocated() && extraData->effectRefCount > 0) || priv->effectiveVisible) + update(); } /*! @@ -408,7 +417,7 @@ void QQuickAnimatedSprite::pause() m_pauseOffset = m_timestamp.elapsed(); m_paused = true; emit pausedChanged(true); - update(); + maybeUpdate(); } /*! @@ -426,7 +435,7 @@ void QQuickAnimatedSprite::resume() m_pauseOffset = m_pauseOffset - m_timestamp.elapsed(); m_paused = false; emit pausedChanged(false); - update(); + maybeUpdate(); } void QQuickAnimatedSprite::createEngine() @@ -438,7 +447,6 @@ void QQuickAnimatedSprite::createEngine() m_spriteEngine = new QQuickSpriteEngine(QList(spriteList), this); m_spriteEngine->startAssemblingImage(); reset(); - update(); } static QSGGeometry::Attribute AnimatedSprite_Attributes[] = { @@ -476,10 +484,10 @@ QSGGeometryNode* QQuickAnimatedSprite::buildNode() return 0; } else if (m_spriteEngine->status() == QQuickPixmap::Null) { m_spriteEngine->startAssemblingImage(); - update();//Schedule another update, where we will check again + maybeUpdate();//Schedule another update, where we will check again return 0; } else if (m_spriteEngine->status() == QQuickPixmap::Loading) { - update();//Schedule another update, where we will check again + maybeUpdate();//Schedule another update, where we will check again return 0; } @@ -541,7 +549,7 @@ QSGGeometryNode* QQuickAnimatedSprite::buildNode() void QQuickAnimatedSprite::reset() { m_pleaseReset = true; - update(); + maybeUpdate(); } QSGNode *QQuickAnimatedSprite::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) @@ -562,7 +570,7 @@ QSGNode *QQuickAnimatedSprite::updatePaintNode(QSGNode *oldNode, UpdatePaintNode if (m_running) { if (!m_paused) - update(); + maybeUpdate(); if (node) { node->markDirty(QSGNode::DirtyMaterial); @@ -618,7 +626,7 @@ void QQuickAnimatedSprite::prepareNextFrame(QSGGeometryNode *node) frameAt = 0; m_running = false; emit runningChanged(false); - update(); + maybeUpdate(); } } else { frameAt = m_curFrame; @@ -626,7 +634,7 @@ void QQuickAnimatedSprite::prepareNextFrame(QSGGeometryNode *node) if (m_curFrame != lastFrame) { if (isCurrentFrameChangedConnected()) emit currentFrameChanged(m_curFrame); - update(); + maybeUpdate(); } qreal frameCount = m_spriteEngine->spriteFrames(); diff --git a/src/quick/items/qquickanimatedsprite_p.h b/src/quick/items/qquickanimatedsprite_p.h index 5b181640f9..01c5c2d3bd 100644 --- a/src/quick/items/qquickanimatedsprite_p.h +++ b/src/quick/items/qquickanimatedsprite_p.h @@ -360,6 +360,7 @@ protected: void componentComplete() Q_DECL_OVERRIDE; QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE; private: + void maybeUpdate(); bool isCurrentFrameChangedConnected(); void prepareNextFrame(QSGGeometryNode *node); void reloadImage(); -- cgit v1.2.3 From 79121a0827df365468a02db20179d2c2d5ae720d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 25 Sep 2016 22:11:12 +0200 Subject: QSGRenderContext: Add null-checks for strings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On some systems, glGetString returns null for some reason, which causes a segfault here. Let's assume it's not one of the broken configurations and hope for the best instead. Task-number: QTCREATORBUG-15992 Task-number: QTBUG-56165 Change-Id: I83867e42f0fd8f576bf51ac0a2213e1348111ffd Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Michael BrĂ¼ning Reviewed-by: Laszlo Agocs --- src/quick/scenegraph/qsgcontext.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/quick') diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index be228e87c7..2580809b27 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -625,12 +625,12 @@ void QSGRenderContext::initialize(QOpenGLContext *context) #ifdef Q_OS_LINUX const char *vendor = (const char *) funcs->glGetString(GL_VENDOR); - if (strstr(vendor, "nouveau")) + if (vendor && strstr(vendor, "nouveau")) m_brokenIBOs = true; const char *renderer = (const char *) funcs->glGetString(GL_RENDERER); - if (strstr(renderer, "llvmpipe")) + if (renderer && strstr(renderer, "llvmpipe")) m_serializedRender = true; - if (strstr(vendor, "Hisilicon Technologies") && strstr(renderer, "Immersion.16")) + if (vendor && renderer && strstr(vendor, "Hisilicon Technologies") && strstr(renderer, "Immersion.16")) m_brokenIBOs = true; #endif -- cgit v1.2.3 From ef8c6f6a0bf5e4c9ee41306f2df59048ab96038f Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 8 Sep 2016 16:49:10 +0200 Subject: Flickable: don't activate velocityTimeline if scroll phase available The velocity timeline does not need to drive the movement if we can be sure that there are enough wheel events coming from the OS to move the flickable smoothly. And when the velocityTimeline is not active, the movementEndingTimer will emit the movementEnded signal, as it should. Task-number: QTBUG-55871 Change-Id: I5569be3aa6335d43ba162967ee03d08de3ba8096 Reviewed-by: J-P Nurmi --- src/quick/items/qquickflickable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 760eeed452..7c45d1c5ad 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1616,7 +1616,7 @@ void QQuickFlickable::viewportMoved(Qt::Orientations orient) void QQuickFlickablePrivate::viewportAxisMoved(AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, QQuickTimeLineCallback::Callback fixupCallback) { - if (pressed || calcVelocity) { + if (!scrollingPhase && (pressed || calcVelocity)) { int elapsed = data.velocityTime.restart(); if (elapsed > 0) { qreal velocity = (data.lastPos - data.move.value()) * 1000 / elapsed; -- cgit v1.2.3 From 7b84962c47c9618af49526e3a2ef8c1c969d5aaa Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 8 Sep 2016 17:14:33 +0200 Subject: Flickable: do not emit movementEnded until it really does This was occurring when using a physical mouse wheel: movementEnded was emitted, then contentYChanged would still be emitted a few more times. Task-number: QTBUG-55886 Change-Id: Ib5e833d5d84633bb07b8c240ea3ccc9977e443f8 Reviewed-by: J-P Nurmi --- src/quick/items/qquickflickable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 7c45d1c5ad..a5b4bb0309 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1563,7 +1563,7 @@ void QQuickFlickable::timerEvent(QTimerEvent *event) d->movementEndingTimer.stop(); d->pressed = false; d->stealMouse = false; - if (!d->velocityTimeline.isActive()) + if (!d->velocityTimeline.isActive() && !d->timeline.isActive()) movementEnding(true, true); } } -- cgit v1.2.3 From 84d3a064d7ab331c42ec1ced6e658a8bcc32f0f7 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 29 Sep 2016 13:00:33 +0200 Subject: QQuickText: fix paddings when wrapping or eliding is used Change-Id: I8ec8c8eff41e77225ef42f7bd9e52f4558d00130 Task-number: QTBUG-55779 Reviewed-by: Liang Qi --- src/quick/items/qquicktext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index ea2d2f3133..044e6ce8c1 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -921,7 +921,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) bool wasInLayout = internalWidthUpdate; internalWidthUpdate = true; - q->setImplicitHeight(naturalHeight); + q->setImplicitHeight(naturalHeight + q->topPadding() + q->bottomPadding()); internalWidthUpdate = wasInLayout; multilineElide = elideMode == QQuickText::ElideRight -- cgit v1.2.3 From 79cfc8788d6267eeb263983466ba21758f618dcd Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 12 May 2016 14:56:20 +0200 Subject: Fix incorrectly aligned text whose size depends on its implicit size The if statement in QQuickTextPrivate::setupTextLayout() was missing an OR clause for the case where the line width is neither greater nor less than the old width/natural width, but has actually changed. If that sounds confusing, it's because it is. Basically, the outer layouting loop in that function needs to run twice for this scenario, so that's what this patch makes it do. Change-Id: I13777667eb13506d50f05e9766785a1c2c46125c Task-number: QTBUG-50738 Task-number: QTBUG-50740 Reviewed-by: Liang Qi --- src/quick/items/qquicktext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 044e6ce8c1..ee5965676c 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -882,11 +882,11 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) // If the width of the item has changed and it's possible the result of wrapping, // eliding, scaling has changed, or the text is not left aligned do another layout. - if ((lineWidth < qMin(oldWidth, naturalWidth) || (widthExceeded && lineWidth > oldWidth)) + if ((!qFuzzyCompare(lineWidth, oldWidth) || (widthExceeded && lineWidth > oldWidth)) && (singlelineElide || multilineElide || canWrap || horizontalFit || q->effectiveHAlign() != QQuickText::AlignLeft)) { widthChanged = true; - widthExceeded = false; + widthExceeded = lineWidth >= qMin(oldWidth, naturalWidth); heightExceeded = false; continue; } -- cgit v1.2.3 From 0ca693407473eb9457cdf8f9d4be32c9d4968ced Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Thu, 29 Sep 2016 19:30:27 -0700 Subject: Remove dead code Qt 5.7 only deploys to macOS 10.8, so this code is never executed. Also, QSysInfo will be deprecated in Qt 5.9 so this will fix a warning. Change-Id: Iecebdb2aed3b0e31b0540621b16aa958031a8e81 Reviewed-by: Thiago Macieira --- src/quick/scenegraph/qsgcontext.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/quick') diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index 25945ad78a..0ad6b43be6 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -490,10 +490,6 @@ QSurfaceFormat QSGContext::defaultSurfaceFormat() const QSize QSGContext::minimumFBOSize() const { -#ifdef Q_OS_MAC - if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_8) - return QSize(33, 33); -#endif return QSize(1, 1); } -- cgit v1.2.3 From c9ffed92a0dee0ae00a9632177ea42f85ea8a48c Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 2 May 2016 16:55:36 +0200 Subject: Fix crash with window-less QQuickItems Mark QQuickItem visual children directly in QQuickItem instead of relying on the item being a (grand) child of a window. [ChangeLog][QtQuick] Fix crash with QQuickItems created via JavaScript being garbage collected sometimes when they're not assigned to a window. This may happen even in qmlscene when between the creation of the root item and the assignment to the QQuickWindow the garbage collector runs. The previous approach of a persistent in QQuickView marking the visual item hierarchy relies on the existence of a view. The only thing left to do in the view and qml window implementation is enforcing the CppOwnership policy set on the content item in QQuickWindow by ensuring the presence of the JS wrapper, replacing the persistent with a weak value. This also introduces a new internal mechanism for QObject sub-classes to provide their own V4 JS wrapper types. Task-number: QTBUG-39888 Change-Id: Icd45a636a6d4e4528fc19165b13f4e1ca7967087 Reviewed-by: Erik Verbruggen --- src/quick/items/qquickitem.cpp | 41 ++++++++++++++++++++++++++-------- src/quick/items/qquickitem.h | 2 ++ src/quick/items/qquickitem_p.h | 4 +--- src/quick/items/qquickview.cpp | 25 +++------------------ src/quick/items/qquickview_p.h | 29 ------------------------ src/quick/items/qquickwindowmodule.cpp | 7 +++--- 6 files changed, 41 insertions(+), 67 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 1c7a556540..7acb8b5ebf 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -6991,15 +6991,6 @@ void QQuickItemPrivate::setHasCursorInChild(bool hasCursor) #endif } -void QQuickItemPrivate::markObjects(QV4::ExecutionEngine *e) -{ - Q_Q(QQuickItem); - QV4::QObjectWrapper::markWrapper(q, e); - - foreach (QQuickItem *child, childItems) - QQuickItemPrivate::get(child)->markObjects(e); -} - #ifndef QT_NO_CURSOR /*! @@ -8138,6 +8129,38 @@ QAccessible::Role QQuickItemPrivate::accessibleRole() const } #endif +// helper code to let a visual parent mark its visual children for the garbage collector + +namespace QV4 { +namespace Heap { +struct QQuickItemWrapper : public QObjectWrapper { + QQuickItemWrapper(QQuickItem *item) : QObjectWrapper(item) {} +}; +} +} + +struct QQuickItemWrapper : public QV4::QObjectWrapper { + V4_OBJECT2(QQuickItemWrapper, QV4::QObjectWrapper) + static void markObjects(QV4::Heap::Base *that, QV4::ExecutionEngine *e); +}; + +DEFINE_OBJECT_VTABLE(QQuickItemWrapper); + +void QQuickItemWrapper::markObjects(QV4::Heap::Base *that, QV4::ExecutionEngine *e) +{ + QObjectWrapper::Data *This = static_cast(that); + if (QQuickItem *item = static_cast(This->object.data())) { + foreach (QQuickItem *child, QQuickItemPrivate::get(item)->childItems) + QV4::QObjectWrapper::markWrapper(child, e); + } + QV4::QObjectWrapper::markObjects(that, e); +} + +quint64 QQuickItemPrivate::_q_createJSWrapper(QV4::ExecutionEngine *engine) +{ + return (engine->memoryManager->allocObject(q_func()))->asReturnedValue(); +} + QT_END_NAMESPACE #include diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index bf208e1f3e..b1b0172262 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -143,6 +143,7 @@ class Q_QUICK_EXPORT QQuickItem : public QObject, public QQmlParserStatus Q_CLASSINFO("DefaultProperty", "data") Q_CLASSINFO("qt_HasQmlAccessors", "true") + Q_CLASSINFO("qt_QmlJSWrapperFactoryMethod", "_q_createJSWrapper(QV4::ExecutionEngine*)") public: enum Flag { @@ -434,6 +435,7 @@ protected: private: Q_PRIVATE_SLOT(d_func(), void _q_resourceObjectDeleted(QObject *)) + Q_PRIVATE_SLOT(d_func(), quint64 _q_createJSWrapper(QV4::ExecutionEngine *)) friend class QQuickWindow; friend class QQuickWindowPrivate; diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index c5d54a390b..7f9296396b 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -297,6 +297,7 @@ public: void _q_resourceObjectDeleted(QObject *); void _q_windowChanged(QQuickWindow *w); + quint64 _q_createJSWrapper(QV4::ExecutionEngine *engine); enum ChangeType { Geometry = 0x01, @@ -598,9 +599,6 @@ public: virtual void mirrorChange() {} void setHasCursorInChild(bool hasCursor); - - // recursive helper to let a visual parent mark its visual children - void markObjects(QV4::ExecutionEngine *e); }; /* diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp index 867f7d9d15..0094432904 100644 --- a/src/quick/items/qquickview.cpp +++ b/src/quick/items/qquickview.cpp @@ -49,25 +49,6 @@ QT_BEGIN_NAMESPACE -DEFINE_OBJECT_VTABLE(QV4::QQuickRootItemMarker); - -QV4::Heap::QQuickRootItemMarker *QV4::QQuickRootItemMarker::create(QQmlEngine *engine, QQuickWindow *window) -{ - QV4::ExecutionEngine *e = QQmlEnginePrivate::getV4Engine(engine); - return e->memoryManager->allocObject(window); -} - -void QV4::QQuickRootItemMarker::markObjects(QV4::Heap::Base *that, QV4::ExecutionEngine *e) -{ - QQuickItem *root = static_cast(that)->window->contentItem(); - if (root) { - QQuickItemPrivate *rootPrivate = QQuickItemPrivate::get(root); - rootPrivate->markObjects(e); - } - - QV4::Object::markObjects(that, e); -} - void QQuickViewPrivate::init(QQmlEngine* e) { Q_Q(QQuickView); @@ -81,10 +62,10 @@ void QQuickViewPrivate::init(QQmlEngine* e) engine.data()->setIncubationController(q->incubationController()); { + // The content item has CppOwnership policy (set in QQuickWindow). Ensure the presence of a JS + // wrapper so that the garbage collector can see the policy. QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(engine.data()); - QV4::Scope scope(v4); - QV4::Scoped v(scope, QV4::QQuickRootItemMarker::create(engine.data(), q)); - rootItemMarker.set(v4, v); + QV4::QObjectWrapper::wrap(v4, contentItem); } QQmlInspectorService *service = QQmlDebugConnector::service(); diff --git a/src/quick/items/qquickview_p.h b/src/quick/items/qquickview_p.h index 71b39f5b0f..0a454a1463 100644 --- a/src/quick/items/qquickview_p.h +++ b/src/quick/items/qquickview_p.h @@ -102,37 +102,8 @@ public: QQuickView::ResizeMode resizeMode; QSize initialSize; QElapsedTimer frameTimer; - QV4::PersistentValue rootItemMarker; }; -namespace QV4 { -namespace Heap { - -struct QQuickRootItemMarker : Object { - inline QQuickRootItemMarker(QQuickWindow *window) - : window(window) - { - } - - QQuickWindow *window; -}; - -} - -struct QQuickRootItemMarker : public Object -{ - V4_OBJECT2(QQuickRootItemMarker, Object) - - static Heap::QQuickRootItemMarker *create(QQmlEngine *engine, QQuickWindow *window); - - static void markObjects(QV4::Heap::Base *that, QV4::ExecutionEngine *e); - -}; - - - -} - QT_END_NAMESPACE #endif // QQUICKVIEW_P_H diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp index 5c66a2ef84..5278f25f21 100644 --- a/src/quick/items/qquickwindowmodule.cpp +++ b/src/quick/items/qquickwindowmodule.cpp @@ -100,12 +100,11 @@ void QQuickWindowQmlImpl::classBegin() if (e && !e->incubationController()) e->setIncubationController(incubationController()); } - Q_ASSERT(e); { + // The content item has CppOwnership policy (set in QQuickWindow). Ensure the presence of a JS + // wrapper so that the garbage collector can see the policy. QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(e); - QV4::Scope scope(v4); - QV4::ScopedObject v(scope, QV4::QQuickRootItemMarker::create(e, this)); - d->rootItemMarker = v; + QV4::QObjectWrapper::wrap(v4, d->contentItem); } } -- cgit v1.2.3 From d9d2277fb8e823af8977d6f3aa5cc7ee8213c26a Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Fri, 30 Sep 2016 12:28:13 +0200 Subject: Flickable: respect keepMouseGrab again The keep grab property works in a "cooperative" way, items need to respect it. Since we don't pre-grab any more, flickable would check the wrong item for the property. It should simply take the receiver item into account, which has to have the grab if anyone has it. If the receiver didn't have the grab, it wouldn't be the receiver in the first place. Task-number: QTBUG-55229 Change-Id: If7d8b0c99bf912c0e09427cd20e89be1798ace5d Reviewed-by: Shawn Rutledge --- src/quick/items/qquickflickable.cpp | 30 ++++++++++++++++++------------ src/quick/items/qquickflickable_p.h | 2 +- 2 files changed, 19 insertions(+), 13 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 0333f6b9bd..e69c6a8d59 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -2235,21 +2235,28 @@ void QQuickFlickablePrivate::cancelInteraction() } } -bool QQuickFlickable::sendMouseEvent(QQuickItem *item, QMouseEvent *event) +/*! + QQuickFlickable::filterMouseEvent checks filtered mouse events and potentially steals them. + + This is how flickable takes over events from other items (\a receiver) that are on top of it. + It filters their events and may take over (grab) the \a event. + Return true if the mouse event will be stolen. + \internal +*/ +bool QQuickFlickable::filterMouseEvent(QQuickItem *receiver, QMouseEvent *event) { Q_D(QQuickFlickable); QPointF localPos = mapFromScene(event->windowPos()); - QQuickWindow *c = window(); - QQuickItem *grabber = c ? c->mouseGrabberItem() : 0; - if (grabber == this && d->stealMouse) { + Q_ASSERT_X(receiver != this, "", "Flickable received a filter event for itself"); + if (receiver == this && d->stealMouse) { // we are already the grabber and we do want the mouse event to ourselves. return true; } - bool grabberDisabled = grabber && !grabber->isEnabled(); + bool receiverDisabled = receiver && !receiver->isEnabled(); bool stealThisEvent = d->stealMouse; - if ((stealThisEvent || contains(localPos)) && (!grabber || !grabber->keepMouseGrab() || grabberDisabled)) { + if ((stealThisEvent || contains(localPos)) && (!receiver || !receiver->keepMouseGrab() || receiverDisabled)) { QScopedPointer mouseEvent(QQuickWindowPrivate::cloneMouseEvent(event, &localPos)); mouseEvent->setAccepted(false); @@ -2259,7 +2266,7 @@ bool QQuickFlickable::sendMouseEvent(QQuickItem *item, QMouseEvent *event) break; case QEvent::MouseButtonPress: d->handleMousePressEvent(mouseEvent.data()); - d->captureDelayedPress(item, event); + d->captureDelayedPress(receiver, event); stealThisEvent = d->stealMouse; // Update stealThisEvent in case changed by function call above break; case QEvent::MouseButtonRelease: @@ -2269,15 +2276,14 @@ bool QQuickFlickable::sendMouseEvent(QQuickItem *item, QMouseEvent *event) default: break; } - grabber = qobject_cast(c->mouseGrabberItem()); - if ((grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) || grabberDisabled) { + if ((receiver && stealThisEvent && !receiver->keepMouseGrab() && receiver != this) || receiverDisabled) { d->clearDelayedPress(); grabMouse(); } else if (d->delayedPressEvent) { grabMouse(); } - const bool filtered = stealThisEvent || d->delayedPressEvent || grabberDisabled; + const bool filtered = stealThisEvent || d->delayedPressEvent || receiverDisabled; if (filtered) { event->setAccepted(true); } @@ -2286,7 +2292,7 @@ bool QQuickFlickable::sendMouseEvent(QQuickItem *item, QMouseEvent *event) d->lastPosTime = -1; returnToBounds(); } - if (event->type() == QEvent::MouseButtonRelease || (grabber && grabber->keepMouseGrab() && !grabberDisabled)) { + if (event->type() == QEvent::MouseButtonRelease || (receiver && receiver->keepMouseGrab() && !receiverDisabled)) { // mouse released, or another item has claimed the grab d->lastPosTime = -1; d->clearDelayedPress(); @@ -2306,7 +2312,7 @@ bool QQuickFlickable::childMouseEventFilter(QQuickItem *i, QEvent *e) case QEvent::MouseButtonPress: case QEvent::MouseMove: case QEvent::MouseButtonRelease: - return sendMouseEvent(i, static_cast(e)); + return filterMouseEvent(i, static_cast(e)); case QEvent::UngrabMouse: if (d->window && d->window->mouseGrabberItem() && d->window->mouseGrabberItem() != this) { // The grab has been taken away from a child and given to some other item. diff --git a/src/quick/items/qquickflickable_p.h b/src/quick/items/qquickflickable_p.h index 318b8ce473..610bfd1427 100644 --- a/src/quick/items/qquickflickable_p.h +++ b/src/quick/items/qquickflickable_p.h @@ -275,7 +275,7 @@ protected: void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; void mouseUngrabEvent() Q_DECL_OVERRIDE; - bool sendMouseEvent(QQuickItem *item, QMouseEvent *event); + bool filterMouseEvent(QQuickItem *receiver, QMouseEvent *event); bool xflick() const; bool yflick() const; -- cgit v1.2.3 From 5a59b11ce8c4230e3a7609e3ca46119340153052 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Sun, 2 Oct 2016 17:08:32 +0200 Subject: Fix release event delivery in deliverTouchAsMouse Originally in the complicated version of this part of the code, the event would always end up in the right place, since the grabber was kept and events delivered reliably. Now we take device and point ID for the grabs into account. When delivering a mouse event from a touch, we would clear the pointer device and ID before trying to send the release, which resulted in the release event never being delivered. Change-Id: I9bc1b2a795023740f8fe3961d779bc8bff0dc35e Reviewed-by: Shawn Rutledge --- src/quick/items/qquickwindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 5bc3b78f42..7dd567f90d 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -706,8 +706,6 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve } } else if (p.state() & Qt::TouchPointReleased) { // currently handled point was released - touchMouseId = -1; - touchMouseDevice = nullptr; if (QQuickItem *mouseGrabberItem = q->mouseGrabberItem()) { QScopedPointer me(touchToMouseEvent(QEvent::MouseButtonRelease, p, event, mouseGrabberItem, false)); QCoreApplication::sendEvent(item, me.data()); @@ -722,6 +720,9 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve } if (q->mouseGrabberItem()) // might have ungrabbed due to event q->mouseGrabberItem()->ungrabMouse(); + + touchMouseId = -1; + touchMouseDevice = nullptr; return me->isAccepted(); } } -- cgit v1.2.3 From 8955df4ff28076fb2bc2d6f35de2a48a0d993975 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 30 Sep 2016 15:45:15 +0200 Subject: add qt.quick.pointer.grab logging category to track pointer grab This is the ultimate destination of all grab/ungrab functions, both the legacy ones in QQuickWindow and the potential replacements. Since we rearchitected event delivery significantly in 5.8, it will be important to debug any behavior change issues that arise in the field; and in many such cases it's important to track which eventpoint on which device is being grabbed by which item. It generates output like [ 2.012 D] QQuickEventPoint::setGrabber - "Advanced Silicon" point 1c1 Updated : grab QQuickItem(0) -> MapComponent_QMLTYPE_7(0x25d0900, parent=0x23cb430, geometry=0,0 360x620) [ 2.012 D] QQuickEventPoint::setGrabber - "core pointer " point 0 Updated : grab QQuickMouseArea_QML_10(0x25a3dd0, name="big MA", parent=0x25d0900, geometry=0,0 360x620) -> QQuickItem(0) Change-Id: Ic98c3c91c719b430590530ba8c5a7eff8063d330 Reviewed-by: Frederik Gladhorn --- src/quick/items/qquickevents.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/quick') diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index dee3794521..a5497f4627 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcPointerEvents, "qt.quick.pointer.events") +Q_LOGGING_CATEGORY(lcPointerGrab, "qt.quick.pointer.grab") /*! \qmltype KeyEvent @@ -523,6 +524,14 @@ QQuickItem *QQuickEventPoint::grabber() const void QQuickEventPoint::setGrabber(QQuickItem *grabber) { + if (Q_UNLIKELY(lcPointerGrab().isDebugEnabled()) && m_grabber.data() != grabber) { + auto device = static_cast(parent())->device(); + static const QMetaEnum stateMetaEnum = metaObject()->enumerator(metaObject()->indexOfEnumerator("State")); + QString deviceName = (device ? device->name() : QLatin1String("null device")); + deviceName.resize(16, ' '); // shorten, and align in case of sequential output + qCDebug(lcPointerGrab) << deviceName << "point" << hex << m_pointId << stateMetaEnum.valueToKey(state()) + << ": grab" << m_grabber << "->" << grabber; + } m_grabber = QPointer(grabber); } -- cgit v1.2.3 From f986c0c3390ba7d033b6e6276f63dcd4818adb5c Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 29 Sep 2016 17:35:31 +0200 Subject: Fix crash on cancel QQuickImageResponse We don't need to deleteLater here, we can not be sure that the response won't continue for a bit after this, and it's not even needed since documentation says you need to emit finished in all cases and this will call deleteLater on the response anyway. Task-number: QTBUG-56056 Change-Id: I7cc90620f499beaaaaa61aac77d72d067308838c Reviewed-by: Michael Brasser --- src/quick/util/qquickimageprovider.cpp | 2 ++ src/quick/util/qquickpixmapcache.cpp | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp index d11229717a..9ed38f72c6 100644 --- a/src/quick/util/qquickimageprovider.cpp +++ b/src/quick/util/qquickimageprovider.cpp @@ -181,6 +181,8 @@ QString QQuickImageResponse::errorString() const This method is used to communicate that the response is no longer required by the engine. It may be reimplemented to cancel a request in the provider side, however, it is not mandatory. + + A cancelled QQuickImageResponse still needs to emit finished(). */ void QQuickImageResponse::cancel() { diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 230c31807c..50b6de25fb 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -584,7 +584,6 @@ void QQuickPixmapReader::processJobs() if (asyncResponse) { asyncResponses.remove(asyncResponse); asyncResponse->cancel(); - asyncResponse->deleteLater(); } } PIXMAP_PROFILE(pixmapStateChanged(job->url)); -- cgit v1.2.3 From 3841055714208e6bd2e3a5efee89ecc20181d893 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 3 Oct 2016 17:04:00 +0200 Subject: Fix behavior of Flickable::setPressDelay This expands the test and fixes the code. Before this patch, items would see the press event, but get the press stolen again immediately. Change-Id: Iece1d5ffbc09a98fb4bec8d810c7ad78b0f50afe Reviewed-by: Shawn Rutledge --- src/quick/items/qquickwindow.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 7dd567f90d..ada56fbc25 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -2253,6 +2253,10 @@ bool QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QQuickPo auto point = event->point(0); if (point->isAccepted()) return false; + + // The only reason to already have a mouse grabber here is + // synthetic events - flickable sends one when setPressDelay is used. + auto oldMouseGrabber = q->mouseGrabberItem(); QPointF localPos = item->mapFromScene(point->scenePos()); Q_ASSERT(item->contains(localPos)); // transform is checked already QMouseEvent *me = event->asMouseEvent(localPos); @@ -2260,7 +2264,7 @@ bool QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QQuickPo q->sendEvent(item, me); if (me->isAccepted()) { auto mouseGrabber = q->mouseGrabberItem(); - if (mouseGrabber && mouseGrabber != item) { + if (mouseGrabber && mouseGrabber != item && mouseGrabber != oldMouseGrabber) { item->mouseUngrabEvent(); } else { item->grabMouse(); -- cgit v1.2.3 From 7d5b1ec4be786f2933ca9ccf24c4acb4ad24fb18 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Sun, 2 Oct 2016 16:35:08 +0200 Subject: Rename parameter i to receiver in QQuickMultiPointTouchArea::childMouseEventFilter Change-Id: I7b936bd13d9e797ea4ed76a72ae1ff87b0d5b640 Reviewed-by: Shawn Rutledge --- src/quick/items/qquickmultipointtoucharea.cpp | 6 +++--- src/quick/items/qquickmultipointtoucharea_p.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp index d68cb8e3f6..504e63174a 100644 --- a/src/quick/items/qquickmultipointtoucharea.cpp +++ b/src/quick/items/qquickmultipointtoucharea.cpp @@ -852,10 +852,10 @@ bool QQuickMultiPointTouchArea::sendMouseEvent(QMouseEvent *event) return false; } -bool QQuickMultiPointTouchArea::childMouseEventFilter(QQuickItem *i, QEvent *event) +bool QQuickMultiPointTouchArea::childMouseEventFilter(QQuickItem *receiver, QEvent *event) { if (!isEnabled() || !isVisible()) - return QQuickItem::childMouseEventFilter(i, event); + return QQuickItem::childMouseEventFilter(receiver, event); switch (event->type()) { case QEvent::MouseButtonPress: case QEvent::MouseMove: @@ -878,7 +878,7 @@ bool QQuickMultiPointTouchArea::childMouseEventFilter(QQuickItem *i, QEvent *eve default: break; } - return QQuickItem::childMouseEventFilter(i, event); + return QQuickItem::childMouseEventFilter(receiver, event); } bool QQuickMultiPointTouchArea::shouldFilter(QEvent *event) diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h index b9ef7816e0..541eb04764 100644 --- a/src/quick/items/qquickmultipointtoucharea_p.h +++ b/src/quick/items/qquickmultipointtoucharea_p.h @@ -247,7 +247,7 @@ Q_SIGNALS: protected: void touchEvent(QTouchEvent *) Q_DECL_OVERRIDE; - bool childMouseEventFilter(QQuickItem *i, QEvent *event) Q_DECL_OVERRIDE; + bool childMouseEventFilter(QQuickItem *receiver, QEvent *event) Q_DECL_OVERRIDE; void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; -- cgit v1.2.3 From c6d66f2e88b42079df9c21c10cf8922871932a32 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Fri, 30 Sep 2016 14:47:31 +0200 Subject: Fix mouse and touch grabbing issues We keep track of the touch device and point ID, but didn't use them when queried for the mouse grabber. When setting the grabber, also take touch into account. Qt Location's touch/mouse handling, when it called the grab functions was not working correctly, because in QQuickWindow, we'd check for the old grabber and due to not checking the device/id, we'd get the wrong item, which would then result in the ungrab function not being called. When some item steals the grab for a touch point that was previously accepted as a synthetic mouse point, there was a high chance we would fail to deliver a mouse ungrab event. Make sure to ungrab the mouse as soon as we find any point with the corresponding ID. In addition, the multi point touch area tried to grab ids which were invalid (-1), avoid that. Task-number: QTBUG-55229 Task-number: QTBUG-56213 Change-Id: I73e4587bf4f94a65d88c5b60d93bc07743512e56 Reviewed-by: Shawn Rutledge Reviewed-by: Frederik Gladhorn --- src/quick/items/qquickmultipointtoucharea.cpp | 6 ++-- src/quick/items/qquickwindow.cpp | 44 +++++++++++++++++++-------- 2 files changed, 36 insertions(+), 14 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp index 504e63174a..706980cd13 100644 --- a/src/quick/items/qquickmultipointtoucharea.cpp +++ b/src/quick/items/qquickmultipointtoucharea.cpp @@ -470,8 +470,10 @@ void QQuickMultiPointTouchArea::grabGesture() QVector ids; ids.reserve(_touchPoints.size()); - for (auto it = _touchPoints.keyBegin(), end = _touchPoints.keyEnd(); it != end; ++it) - ids.append(*it); + for (auto it = _touchPoints.keyBegin(), end = _touchPoints.keyEnd(); it != end; ++it) { + if (*it != -1) // -1 might be the mouse-point, but we already grabbed the mouse above. + ids.append(*it); + } grabTouchPoints(ids); setKeepTouchGrab(true); } diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index ada56fbc25..0151a4e3ca 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -741,16 +741,16 @@ void QQuickWindowPrivate::setMouseGrabber(QQuickItem *grabber) qCDebug(DBG_MOUSE_TARGET) << "grabber" << q->mouseGrabberItem() << "->" << grabber; QQuickItem *oldGrabber = q->mouseGrabberItem(); - QQuickPointerEvent *event = QQuickPointerDevice::genericMouseDevice()->pointerEvent(); - Q_ASSERT(event->pointCount() == 1); - event->point(0)->setGrabber(grabber); - if (grabber && touchMouseId != -1 && touchMouseDevice) { // update the touch item for mouse touch id to the new grabber qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << touchMouseId << "->" << q->mouseGrabberItem(); auto point = touchMouseDevice->pointerEvent()->pointById(touchMouseId); if (point) point->setGrabber(grabber); + } else { + QQuickPointerEvent *event = QQuickPointerDevice::genericMouseDevice()->pointerEvent(); + Q_ASSERT(event->pointCount() == 1); + event->point(0)->setGrabber(grabber); } if (oldGrabber) { @@ -763,13 +763,30 @@ void QQuickWindowPrivate::setMouseGrabber(QQuickItem *grabber) void QQuickWindowPrivate::grabTouchPoints(QQuickItem *grabber, const QVector &ids) { - Q_Q(QQuickWindow); QSet ungrab; for (int i = 0; i < ids.count(); ++i) { // FIXME: deprecate this function, we need a device + int id = ids.at(i); + if (Q_UNLIKELY(id < 0)) { + qWarning("ignoring grab of touchpoint %d", id); + continue; + } + if (id == touchMouseId) { + auto point = touchMouseDevice->pointerEvent()->pointById(id); + auto touchMouseGrabber = point->grabber(); + if (touchMouseGrabber) { + point->setGrabber(nullptr); + touchMouseGrabber->mouseUngrabEvent(); + ungrab.insert(touchMouseGrabber); + touchMouseDevice = nullptr; + touchMouseId = -1; + } + qCDebug(DBG_MOUSE_TARGET) << "grabTouchPoints: mouse grabber changed due to grabTouchPoints:" << touchMouseGrabber << "-> null"; + } + const auto touchDevices = QQuickPointerDevice::touchDevices(); for (auto device : touchDevices) { - auto point = device->pointerEvent()->pointById(ids.at(i)); + auto point = device->pointerEvent()->pointById(id); if (!point) continue; QQuickItem *oldGrabber = point->grabber(); @@ -780,12 +797,6 @@ void QQuickWindowPrivate::grabTouchPoints(QQuickItem *grabber, const QVectormouseGrabberItem(); - if (touchMouseId == ids.at(i) && mouseGrabberItem && mouseGrabberItem != grabber) { - qCDebug(DBG_MOUSE_TARGET) << "grabTouchPoints: grabber" << mouseGrabberItem << "-> null"; - setMouseGrabber(nullptr); - } } for (QQuickItem *oldGrabber : qAsConst(ungrab)) oldGrabber->touchUngrabEvent(); @@ -1467,6 +1478,15 @@ QObject *QQuickWindow::focusObject() const */ QQuickItem *QQuickWindow::mouseGrabberItem() const { + Q_D(const QQuickWindow); + + if (d->touchMouseId != -1 && d->touchMouseDevice) { + QQuickPointerEvent *event = d->touchMouseDevice->pointerEvent(); + auto point = event->pointById(d->touchMouseId); + Q_ASSERT(point); + return point->grabber(); + } + QQuickPointerEvent *event = QQuickPointerDevice::genericMouseDevice()->pointerEvent(); Q_ASSERT(event->pointCount()); return event->point(0)->grabber(); -- cgit v1.2.3 From 643d75e3ff2f8cbe60eeff2084fb6ec3fcb096a0 Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Wed, 21 Sep 2016 16:13:00 +0200 Subject: QQuickRectangle: fix typo in apidoc Change-Id: Ib026302143df82196fdfd70b9ea9923098adbc7c Reviewed-by: Robin Burchell --- src/quick/items/qquickrectangle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickrectangle.cpp b/src/quick/items/qquickrectangle.cpp index eb17187ad5..ab22fceee1 100644 --- a/src/quick/items/qquickrectangle.cpp +++ b/src/quick/items/qquickrectangle.cpp @@ -360,7 +360,7 @@ QQuickPen *QQuickRectangle::border() The gradient to use to fill the rectangle. This property allows for the construction of simple vertical gradients. - Other gradients may by formed by adding rotation to the rectangle. + Other gradients may be formed by adding rotation to the rectangle. \div {class="float-left"} \inlineimage declarative-rect_gradient.png -- cgit v1.2.3 From 55b3d76671090da348d63a89417ea73dab5d315d Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Fri, 23 Sep 2016 13:47:40 +0200 Subject: QQuickPositioners: fix sentence structure in apidoc Change-Id: I14eb860386dfad57ab8cf492cb782970497756b9 Reviewed-by: Robin Burchell --- src/quick/items/qquickpositioners.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index de2596b679..8f690c03d4 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -866,7 +866,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) the item that is being added. See the \l ViewTransition documentation for more details and examples on using these transitions. - \note This transition is not applied to the items that already part of the positioner + \note This transition is not applied to the items that are already part of the positioner at the time of its creation. In this case, the \l populate transition is applied instead. \sa populate, ViewTransition, {Qt Quick Examples - Positioners} @@ -1033,7 +1033,7 @@ void QQuickColumn::reportConflictingAnchors() the item that is being added. See the \l ViewTransition documentation for more details and examples on using these transitions. - \note This transition is not applied to the items that already part of the positioner + \note This transition is not applied to the items that are already part of the positioner at the time of its creation. In this case, the \l populate transition is applied instead. \sa populate, ViewTransition, {Qt Quick Examples - Positioners} @@ -1301,7 +1301,7 @@ void QQuickRow::reportConflictingAnchors() the item that is being added. See the \l ViewTransition documentation for more details and examples on using these transitions. - \note This transition is not applied to the items that already part of the positioner + \note This transition is not applied to the items that are already part of the positioner at the time of its creation. In this case, the \l populate transition is applied instead. \sa populate, ViewTransition, {Qt Quick Examples - Positioners} @@ -1876,7 +1876,7 @@ void QQuickGrid::reportConflictingAnchors() the item that is being added. See the \l ViewTransition documentation for more details and examples on using these transitions. - \note This transition is not applied to the items that already part of the positioner + \note This transition is not applied to the items that are already part of the positioner at the time of its creation. In this case, the \l populate transition is applied instead. \sa populate, ViewTransition, {Qt Quick Examples - Positioners} -- cgit v1.2.3 From 3a205800c6ea0a88ae2ab35edabf6883e54a334b Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 6 Jul 2016 12:43:55 +0200 Subject: Doc: add spec on parameter image Error message: Undocumented parameter 'image' in QQuickTextureFactory::textureFactoryForImage() Change-Id: If7cb1e63091c23304b64c5688af0abe55fc37ff4 Reviewed-by: Martin Smith --- src/quick/util/qquickimageprovider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp index 6cecf6f6f6..f6a90cb70a 100644 --- a/src/quick/util/qquickimageprovider.cpp +++ b/src/quick/util/qquickimageprovider.cpp @@ -105,7 +105,7 @@ QImage QQuickTextureFactory::image() const } /*! - Returns a QQuickTextureFactory holding the given image. + Returns a QQuickTextureFactory holding the given \a image. This is typically used as a helper in QQuickImageResponse::textureFactory. -- cgit v1.2.3 From 54765de17916948ef56a3fd1111e8c765c07155a Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 28 Sep 2016 16:52:53 +0200 Subject: Adding QQuickDesignerSupportMetaInfo::registerMockupObject() This allows Qt Quick Designer to register a component with a custom parser that can serve as a mockup for known C++ components registered in e.g. main.cpp. In many cases those components are the interface to the C++ backend. While the C++ components itself are not relevant for the gui designer, the user has to be able to instantiate gui components that use such C++ components. Therefore we create mockup components with a custom parser, so all property assignments are accepted. Change-Id: I9c25752b0a5f11c2613346ffbbfd10e3b6eb3a6f Reviewed-by: Tim Jenssen --- src/quick/designer/designer.pri | 6 +- .../designer/qquickdesignercustomparserobject.cpp | 59 +++++++++++++++++++ .../designer/qquickdesignercustomparserobject_p.h | 68 ++++++++++++++++++++++ .../designer/qquickdesignersupportmetainfo.cpp | 6 ++ .../designer/qquickdesignersupportmetainfo_p.h | 1 + 5 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 src/quick/designer/qquickdesignercustomparserobject.cpp create mode 100644 src/quick/designer/qquickdesignercustomparserobject_p.h (limited to 'src/quick') diff --git a/src/quick/designer/designer.pri b/src/quick/designer/designer.pri index eb2141134d..f87ea4da04 100644 --- a/src/quick/designer/designer.pri +++ b/src/quick/designer/designer.pri @@ -7,7 +7,8 @@ HEADERS += \ designer/qquickdesignersupportproperties_p.h \ designer/qquickdesignersupportmetainfo_p.h \ designer/qqmldesignermetaobject_p.h \ - designer/qquickdesignersupport_p.h + designer/qquickdesignersupport_p.h \ + designer/qquickdesignercustomparserobject_p.h SOURCES += \ designer/qquickdesignercustomobjectdata.cpp \ @@ -18,4 +19,5 @@ SOURCES += \ designer/qquickdesignersupportpropertychanges.cpp \ designer/qquickdesignersupportstates.cpp \ designer/qquickdesignerwindowmanager.cpp \ - designer/qqmldesignermetaobject.cpp + designer/qqmldesignermetaobject.cpp \ + designer/qquickdesignercustomparserobject.cpp diff --git a/src/quick/designer/qquickdesignercustomparserobject.cpp b/src/quick/designer/qquickdesignercustomparserobject.cpp new file mode 100644 index 0000000000..b785abe361 --- /dev/null +++ b/src/quick/designer/qquickdesignercustomparserobject.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qquickdesignercustomparserobject_p.h" + +QT_BEGIN_NAMESPACE + +QQuickDesignerCustomParserObject::QQuickDesignerCustomParserObject() +{ + +} + +void QQuickDesignerCustomParser::verifyBindings(const QV4::CompiledData::Unit *, const QList &) +{ + /* Nothing to do we accept anything */ +} + +void QQuickDesignerCustomParser::applyBindings(QObject *, QV4::CompiledData::CompilationUnit *, const QList &) +{ + /* Nothing to do we accept anything */ +} + +QT_END_NAMESPACE diff --git a/src/quick/designer/qquickdesignercustomparserobject_p.h b/src/quick/designer/qquickdesignercustomparserobject_p.h new file mode 100644 index 0000000000..06206443b2 --- /dev/null +++ b/src/quick/designer/qquickdesignercustomparserobject_p.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUICKDESIGNERCUSTOMPARSEROBJECT_H +#define QUICKDESIGNERCUSTOMPARSEROBJECT_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QQuickDesignerCustomParserObject : public QObject +{ + Q_OBJECT + +public: + QQuickDesignerCustomParserObject(); +}; + +class QQuickDesignerCustomParser : public QQmlCustomParser +{ +public: + QQuickDesignerCustomParser() + : QQmlCustomParser(AcceptsAttachedProperties | AcceptsSignalHandlers) {} + + void verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList &props) override; + void applyBindings(QObject *obj, QV4::CompiledData::CompilationUnit *compilationUnit, const QList &bindings) override; +}; + +QT_END_NAMESPACE + +#endif // QUICKDESIGNERCUSTOMPARSEROBJECT_H diff --git a/src/quick/designer/qquickdesignersupportmetainfo.cpp b/src/quick/designer/qquickdesignersupportmetainfo.cpp index 27c9814ef1..332ae26bd4 100644 --- a/src/quick/designer/qquickdesignersupportmetainfo.cpp +++ b/src/quick/designer/qquickdesignersupportmetainfo.cpp @@ -37,6 +37,7 @@ ** ****************************************************************************/ +#include "qquickdesignercustomparserobject_p.h" #include "qquickdesignersupportmetainfo_p.h" #include "qqmldesignermetaobject_p.h" @@ -70,5 +71,10 @@ void QQuickDesignerSupportMetaInfo::registerNotifyPropertyChangeCallBack(void (* QQmlDesignerMetaObject::registerNotifyPropertyChangeCallBack(callback); } +void QQuickDesignerSupportMetaInfo::registerMockupObject(const char *uri, int versionMajor, int versionMinor, const char *qmlName) +{ + qmlRegisterCustomType(uri, versionMajor, versionMinor, qmlName, new QQuickDesignerCustomParser); +} + QT_END_NAMESPACE diff --git a/src/quick/designer/qquickdesignersupportmetainfo_p.h b/src/quick/designer/qquickdesignersupportmetainfo_p.h index 43cd8e8fb1..344d720d98 100644 --- a/src/quick/designer/qquickdesignersupportmetainfo_p.h +++ b/src/quick/designer/qquickdesignersupportmetainfo_p.h @@ -63,6 +63,7 @@ class Q_QUICK_EXPORT QQuickDesignerSupportMetaInfo public: static bool isSubclassOf(QObject *object, const QByteArray &superTypeName); static void registerNotifyPropertyChangeCallBack(void (*callback)(QObject *, const QQuickDesignerSupport::PropertyName &)); + static void registerMockupObject(const char *uri, int versionMajor, int versionMinor, const char *qmlName); }; QT_END_NAMESPACE -- cgit v1.2.3 From 9182797dec1897cda4e2e0368a16ddbd5c18b031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 20 Mar 2015 13:46:43 +0100 Subject: Canvas: Implement high-DPI render mode Scale the canvas image and texture buffer by the target devicePixelRatio. Task-number: QTBUG-37095 Change-Id: Ic432b278caa5c85cf3487d3108967cf3fcd2fa48 Reviewed-by: Shawn Rutledge --- src/quick/items/context2d/qquickcontext2dtexture.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/context2d/qquickcontext2dtexture.cpp b/src/quick/items/context2d/qquickcontext2dtexture.cpp index 5ac971dc7d..78c526b299 100644 --- a/src/quick/items/context2d/qquickcontext2dtexture.cpp +++ b/src/quick/items/context2d/qquickcontext2dtexture.cpp @@ -538,6 +538,9 @@ QPaintDevice* QQuickContext2DFBOTexture::beginPainting() { QQuickContext2DTexture::beginPainting(); + const qreal devicePixelRatio = (m_item && m_item->window()) ? + m_item->window()->effectiveDevicePixelRatio() : qApp->devicePixelRatio(); + if (m_canvasWindow.size().isEmpty()) { delete m_fbo; delete m_multisampledFbo; @@ -552,7 +555,7 @@ QPaintDevice* QQuickContext2DFBOTexture::beginPainting() delete m_paint_device; m_paint_device = 0; - m_fboSize = npotAdjustedSize(m_canvasWindow.size()); + m_fboSize = npotAdjustedSize(m_canvasWindow.size() * devicePixelRatio); m_canvasWindowChanged = false; if (doMultisampling()) { @@ -590,6 +593,7 @@ QPaintDevice* QQuickContext2DFBOTexture::beginPainting() QOpenGLPaintDevice *gl_device = new QOpenGLPaintDevice(m_fbo->size()); gl_device->setPaintFlipped(true); gl_device->setSize(m_fbo->size()); + gl_device->setDevicePixelRatio(devicePixelRatio); m_paint_device = gl_device; } @@ -694,8 +698,12 @@ QPaintDevice* QQuickContext2DImageTexture::beginPainting() if (m_canvasWindow.size().isEmpty()) return 0; + const qreal devicePixelRatio = (m_item && m_item->window()) ? + m_item->window()->effectiveDevicePixelRatio() : qApp->devicePixelRatio(); + if (m_canvasWindowChanged) { - m_image = QImage(m_canvasWindow.size(), QImage::Format_ARGB32_Premultiplied); + m_image = QImage(m_canvasWindow.size() * devicePixelRatio, QImage::Format_ARGB32_Premultiplied); + m_image.setDevicePixelRatio(devicePixelRatio); m_image.fill(0x00000000); m_canvasWindowChanged = false; } -- cgit v1.2.3 From 64afa01c32fc1824b280452ceb1ade4f655487f2 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 9 Sep 2016 10:06:31 +0200 Subject: QML: Introduce destroy() on Base subclasses This removes the destructors of subclasses of Base, making them nearly trivial. Change-Id: Ia6f7d467e87899b5ad37b8709a8f633a51689d59 Reviewed-by: Simon Hausmann --- src/quick/items/context2d/qquickcontext2d.cpp | 78 ++++++++++++++------------- 1 file changed, 41 insertions(+), 37 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index c26f641754..e621bc9eed 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -500,19 +500,22 @@ struct QQuickJSContext2DPrototype : Object { struct QQuickContext2DStyle : Object { QQuickContext2DStyle() { + brush = new QBrush; patternRepeatX = false; patternRepeatY = false; } + void destroy() { delete brush; } - QBrush brush; + QBrush *brush; bool patternRepeatX:1; bool patternRepeatY:1; }; struct QQuickJSContext2DPixelData : Object { QQuickJSContext2DPixelData(); + void destroy() { delete image; } - QImage image; + QImage *image; }; struct QQuickJSContext2DImageData : Object { @@ -899,6 +902,7 @@ struct QQuickJSContext2DPixelData : public QV4::Object QV4::Heap::QQuickJSContext2DPixelData::QQuickJSContext2DPixelData() { + image = new QImage; QV4::Scope scope(internalClass->engine); QV4::ScopedObject o(scope, this); o->setArrayType(QV4::Heap::ArrayData::Custom); @@ -943,11 +947,11 @@ static QV4::ReturnedValue qt_create_image_data(qreal w, qreal h, QV4::ExecutionE pixelData->setPrototype(p); if (image.isNull()) { - pixelData->d()->image = QImage(w, h, QImage::Format_ARGB32); - pixelData->d()->image.fill(0x00000000); + *pixelData->d()->image = QImage(w, h, QImage::Format_ARGB32); + pixelData->d()->image->fill(0x00000000); } else { Q_ASSERT(image.width() == qRound(w) && image.height() == qRound(h)); - pixelData->d()->image = image.format() == QImage::Format_ARGB32 ? image : image.convertToFormat(QImage::Format_ARGB32); + *pixelData->d()->image = image.format() == QImage::Format_ARGB32 ? image : image.convertToFormat(QImage::Format_ARGB32); } QV4::Scoped imageData(scope, scope.engine->memoryManager->allocObject()); @@ -1392,9 +1396,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_fillStyle(QV4::CallContext *ctx r->d()->context->m_fillStyle.set(scope.engine, value); } else { QV4::Scoped style(scope, value->as()); - if (style && style->d()->brush != r->d()->context->state.fillStyle) { - r->d()->context->state.fillStyle = style->d()->brush; - r->d()->context->buffer()->setFillStyle(style->d()->brush, style->d()->patternRepeatX, style->d()->patternRepeatY); + if (style && *style->d()->brush != r->d()->context->state.fillStyle) { + r->d()->context->state.fillStyle = *style->d()->brush; + r->d()->context->buffer()->setFillStyle(*style->d()->brush, style->d()->patternRepeatX, style->d()->patternRepeatY); r->d()->context->m_fillStyle.set(scope.engine, value); r->d()->context->state.fillPatternRepeatX = style->d()->patternRepeatX; r->d()->context->state.fillPatternRepeatY = style->d()->patternRepeatY; @@ -1501,9 +1505,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_strokeStyle(QV4::CallContext *c r->d()->context->m_strokeStyle.set(scope.engine, value); } else { QV4::Scoped style(scope, value->as()); - if (style && style->d()->brush != r->d()->context->state.strokeStyle) { - r->d()->context->state.strokeStyle = style->d()->brush; - r->d()->context->buffer()->setStrokeStyle(style->d()->brush, style->d()->patternRepeatX, style->d()->patternRepeatY); + if (style && *style->d()->brush != r->d()->context->state.strokeStyle) { + r->d()->context->state.strokeStyle = *style->d()->brush; + r->d()->context->buffer()->setStrokeStyle(*style->d()->brush, style->d()->patternRepeatX, style->d()->patternRepeatY); r->d()->context->m_strokeStyle.set(scope.engine, value); r->d()->context->state.strokePatternRepeatX = style->d()->patternRepeatX; r->d()->context->state.strokePatternRepeatY = style->d()->patternRepeatY; @@ -1561,7 +1565,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createLinearGradient(QV4:: QV4::Scoped gradient(scope, scope.engine->memoryManager->allocObject()); QV4::ScopedObject p(scope, ed->gradientProto.value()); gradient->setPrototype(p); - gradient->d()->brush = QLinearGradient(x0, y0, x1, y1); + *gradient->d()->brush = QLinearGradient(x0, y0, x1, y1); return gradient.asReturnedValue(); } @@ -1612,7 +1616,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createRadialGradient(QV4:: QV4::Scoped gradient(scope, scope.engine->memoryManager->allocObject()); QV4::ScopedObject p(scope, ed->gradientProto.value()); gradient->setPrototype(p); - gradient->d()->brush = QRadialGradient(QPointF(x1, y1), r0+r1, QPointF(x0, y0)); + *gradient->d()->brush = QRadialGradient(QPointF(x1, y1), r0+r1, QPointF(x0, y0)); return gradient.asReturnedValue(); } @@ -1655,7 +1659,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createConicalGradient(QV4: QV4::Scoped gradient(scope, scope.engine->memoryManager->allocObject()); QV4::ScopedObject p(scope, ed->gradientProto.value()); gradient->setPrototype(p); - gradient->d()->brush = QConicalGradient(x, y, angle); + *gradient->d()->brush = QConicalGradient(x, y, angle); return gradient.asReturnedValue(); } @@ -1720,7 +1724,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(QV4::CallCon if (patternMode >= 0 && patternMode < Qt::LinearGradientPattern) { style = static_cast(patternMode); } - pattern->d()->brush = QBrush(color, style); + *pattern->d()->brush = QBrush(color, style); } else { QImage patternTexture; @@ -1728,14 +1732,14 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(QV4::CallCon QV4::ScopedString s(scope, scope.engine->newString(QStringLiteral("data"))); QV4::Scoped pixelData(scope, o->get(s)); if (!!pixelData) { - patternTexture = pixelData->d()->image; + patternTexture = *pixelData->d()->image; } } else { patternTexture = r->d()->context->createPixmap(QUrl(ctx->args()[0].toQStringNoThrow()))->image(); } if (!patternTexture.isNull()) { - pattern->d()->brush.setTextureImage(patternTexture); + pattern->d()->brush->setTextureImage(patternTexture); QString repetition = ctx->args()[1].toQStringNoThrow(); if (repetition == QLatin1String("repeat") || repetition.isEmpty()) { @@ -2925,8 +2929,8 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext QV4::Scoped imageData(scope, arg); if (!!imageData) { QV4::Scoped pix(scope, imageData->d()->pixelData.as()); - if (pix && !pix->d()->image.isNull()) { - pixmap.adopt(new QQuickCanvasPixmap(pix->d()->image)); + if (pix && !pix->d()->image->isNull()) { + pixmap.adopt(new QQuickCanvasPixmap(*pix->d()->image)); } else { V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch"); } @@ -3034,7 +3038,7 @@ QV4::ReturnedValue QQuickJSContext2DImageData::method_get_width(QV4::CallContext QV4::Scoped r(scope, imageData->d()->pixelData.as()); if (!r) return QV4::Encode(0); - return QV4::Encode(r->d()->image.width()); + return QV4::Encode(r->d()->image->width()); } /*! @@ -3050,7 +3054,7 @@ QV4::ReturnedValue QQuickJSContext2DImageData::method_get_height(QV4::CallContex QV4::Scoped r(scope, imageData->d()->pixelData.as()); if (!r) return QV4::Encode(0); - return QV4::Encode(r->d()->image.height()); + return QV4::Encode(r->d()->image->height()); } /*! @@ -3088,10 +3092,10 @@ QV4::ReturnedValue QQuickJSContext2DPixelData::proto_get_length(QV4::CallContext { QV4::Scope scope(ctx); QV4::Scoped r(scope, ctx->thisObject().as()); - if (!r || r->d()->image.isNull()) + if (!r || r->d()->image->isNull()) return QV4::Encode::undefined(); - return QV4::Encode(r->d()->image.width() * r->d()->image.height() * 4); + return QV4::Encode(r->d()->image->width() * r->d()->image->height() * 4); } QV4::ReturnedValue QQuickJSContext2DPixelData::getIndexed(const QV4::Managed *m, uint index, bool *hasProperty) @@ -3101,13 +3105,13 @@ QV4::ReturnedValue QQuickJSContext2DPixelData::getIndexed(const QV4::Managed *m, QV4::Scope scope(v4); QV4::Scoped r(scope, static_cast(m)); - if (index < static_cast(r->d()->image.width() * r->d()->image.height() * 4)) { + if (index < static_cast(r->d()->image->width() * r->d()->image->height() * 4)) { if (hasProperty) *hasProperty = true; - const quint32 w = r->d()->image.width(); + const quint32 w = r->d()->image->width(); const quint32 row = (index / 4) / w; const quint32 col = (index / 4) % w; - const QRgb* pixel = reinterpret_cast(r->d()->image.constScanLine(row)); + const QRgb* pixel = reinterpret_cast(r->d()->image->constScanLine(row)); pixel += col; switch (index % 4) { case 0: @@ -3136,12 +3140,12 @@ void QQuickJSContext2DPixelData::putIndexed(QV4::Managed *m, uint index, const Q QV4::Scoped r(scope, static_cast(m)); const int v = value.toInt32(); - if (r && index < static_cast(r->d()->image.width() * r->d()->image.height() * 4) && v >= 0 && v <= 255) { - const quint32 w = r->d()->image.width(); + if (r && index < static_cast(r->d()->image->width() * r->d()->image->height() * 4) && v >= 0 && v <= 255) { + const quint32 w = r->d()->image->width(); const quint32 row = (index / 4) / w; const quint32 col = (index / 4) % w; - QRgb* pixel = reinterpret_cast(r->d()->image.scanLine(row)); + QRgb* pixel = reinterpret_cast(r->d()->image->scanLine(row)); pixel += col; switch (index % 4) { case 0: @@ -3192,8 +3196,8 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createImageData(QV4::CallC if (!!imgData) { QV4::Scoped pa(scope, imgData->d()->pixelData.as()); if (pa) { - qreal w = pa->d()->image.width(); - qreal h = pa->d()->image.height(); + qreal w = pa->d()->image->width(); + qreal h = pa->d()->image->height(); return qt_create_image_data(w, h, scope.engine, QImage()); } } else if (arg0->isString()) { @@ -3271,8 +3275,8 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(QV4::CallCont QV4::Scoped pixelArray(scope, imageData->d()->pixelData.as()); if (pixelArray) { - w = pixelArray->d()->image.width(); - h = pixelArray->d()->image.height(); + w = pixelArray->d()->image->width(); + h = pixelArray->d()->image->height(); if (ctx->argc() == 7) { dirtyX = ctx->args()[3].toNumber(); @@ -3321,7 +3325,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(QV4::CallCont dirtyHeight = h; } - QImage image = pixelArray->d()->image.copy(dirtyX, dirtyY, dirtyWidth, dirtyHeight); + QImage image = pixelArray->d()->image->copy(dirtyX, dirtyY, dirtyWidth, dirtyHeight); r->d()->context->buffer()->drawImage(image, QRectF(dirtyX, dirtyY, dirtyWidth, dirtyHeight), QRectF(dx, dy, dirtyWidth, dirtyHeight)); } return ctx->thisObject().asReturnedValue(); @@ -3356,9 +3360,9 @@ QV4::ReturnedValue QQuickContext2DStyle::gradient_proto_addColorStop(QV4::CallCo if (ctx->argc() == 2) { - if (!style->d()->brush.gradient()) + if (!style->d()->brush->gradient()) V4THROW_ERROR("Not a valid CanvasGradient object, can't get the gradient information"); - QGradient gradient = *(style->d()->brush.gradient()); + QGradient gradient = *(style->d()->brush->gradient()); qreal pos = ctx->args()[0].toNumber(); QColor color; @@ -3376,7 +3380,7 @@ QV4::ReturnedValue QQuickContext2DStyle::gradient_proto_addColorStop(QV4::CallCo } else { V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "CanvasGradient: parameter color is not a valid color string"); } - style->d()->brush = gradient; + *style->d()->brush = gradient; } return ctx->thisObject().asReturnedValue(); -- cgit v1.2.3 From 4a22a3b83be91cf781a049a7d9cb277950e5919f Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Thu, 6 Oct 2016 10:46:54 +0200 Subject: Fix some minor issues in documentation Change-Id: I19f1a75b2e1a1096077df7ea109fd70be9d3c759 Reviewed-by: Shawn Rutledge --- src/quick/doc/src/concepts/input/focus.qdoc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/quick') diff --git a/src/quick/doc/src/concepts/input/focus.qdoc b/src/quick/doc/src/concepts/input/focus.qdoc index ec4e4ca2d9..2d75bd9931 100644 --- a/src/quick/doc/src/concepts/input/focus.qdoc +++ b/src/quick/doc/src/concepts/input/focus.qdoc @@ -66,7 +66,7 @@ See also the \l {Keys}{Keys attached property} and \l {KeyNavigation}{KeyNavigat \section1 Querying the Active Focus Item Whether or not an \l Item has active focus can be queried through the -property \c {Item::activeFocus} property. For example, here we have a \l Text +\c {Item::activeFocus} property. For example, here we have a \l Text type whose text is determined by whether or not it has active focus. \snippet qml/focus/rectangle.qml active focus @@ -98,17 +98,17 @@ The code that imports and creates two MyWidget instances: The MyWidget code: \snippet qml/focus/MyWidget.qml mywidget -We would like to have the first MyWidget object to have the focus by setting its +We want the first \c MyWidget object to have the focus, so we set its \c focus property to \c true. However, by running the code, we can confirm that the second widget receives the focus. \image declarative-qmlfocus2.png Looking at both \c MyWidget and \c window code, the problem is evident - there -are three types that set the \c focus property set to \c true. The two -MyWidget sets the \c focus to \c true and the \c window component also sets the +are three types that set the \c focus property to \c true. The two +\c {MyWidget}s set the \c focus to \c true and the \c window component also sets the focus. Ultimately, only one type can have keyboard focus, and the system has -to decide which type receives the focus. When the second MyWidget is created, +to decide which type receives the focus. When the second \c MyWidget is created, it receives the focus because it is the last type to set its \c focus property to \c true. -- cgit v1.2.3 From 241205371b18ffdddcafb77212da3f93b4f90a0c Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Thu, 18 Aug 2016 16:20:25 +0200 Subject: focus.qdoc: fix grammar in documentation Change-Id: I9b8d0158346e432e44758ae153e9ea02a9513c7e Reviewed-by: Shawn Rutledge --- src/quick/doc/src/concepts/input/focus.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/doc/src/concepts/input/focus.qdoc b/src/quick/doc/src/concepts/input/focus.qdoc index 2d75bd9931..fc1361f7ac 100644 --- a/src/quick/doc/src/concepts/input/focus.qdoc +++ b/src/quick/doc/src/concepts/input/focus.qdoc @@ -190,7 +190,7 @@ print the name of the current list item. \image declarative-qmlfocus5.png -While the example is simple, there are a lot going on behind the scenes. Whenever +While the example is simple, there is a lot going on behind the scenes. Whenever the current item changes, the \l ListView sets the delegate's \c {Item::focus} property. As the \l ListView is a focus scope, this doesn't affect the rest of the application. However, if the \l ListView itself has -- cgit v1.2.3 From 3b14e2ffdd8eb4b7f7f4508768b75f2acc399370 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 9 Sep 2016 15:37:57 +0200 Subject: QML: Make Heap::Object and all subclasses trivial GCC6 might dead-store-eliminate out our secret write to Base::mmdata, because it expects all memory content to be "undefined" before constructor calls. Clang might take the same approach if the constructor of Heap::Object is removed. By making these structs trivial, it also makes them memcpy-able. Change-Id: I055b2ad28311b997fbe059849ebda4d5894eaa9b Reviewed-by: Simon Hausmann --- src/quick/items/context2d/qquickcontext2d.cpp | 16 +++++++++------- src/quick/items/qquickview_p.h | 5 +++-- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index e621bc9eed..d94a098897 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -489,16 +489,16 @@ namespace QV4 { namespace Heap { struct QQuickJSContext2D : Object { - QQuickJSContext2D() {} + void init() { Object::init(); } QQuickContext2D* context; }; struct QQuickJSContext2DPrototype : Object { - QQuickJSContext2DPrototype() {} + void init() { Object::init(); } }; struct QQuickContext2DStyle : Object { - QQuickContext2DStyle() + void init() { brush = new QBrush; patternRepeatX = false; @@ -512,14 +512,14 @@ struct QQuickContext2DStyle : Object { }; struct QQuickJSContext2DPixelData : Object { - QQuickJSContext2DPixelData(); + void init(); void destroy() { delete image; } QImage *image; }; struct QQuickJSContext2DImageData : Object { - QQuickJSContext2DImageData(); + void init(); QV4::Value pixelData; }; @@ -900,8 +900,9 @@ struct QQuickJSContext2DPixelData : public QV4::Object static QV4::ReturnedValue proto_get_length(QV4::CallContext *ctx); }; -QV4::Heap::QQuickJSContext2DPixelData::QQuickJSContext2DPixelData() +void QV4::Heap::QQuickJSContext2DPixelData::init() { + Object::init(); image = new QImage; QV4::Scope scope(internalClass->engine); QV4::ScopedObject o(scope, this); @@ -924,8 +925,9 @@ struct QQuickJSContext2DImageData : public QV4::Object } }; -QV4::Heap::QQuickJSContext2DImageData::QQuickJSContext2DImageData() +void QV4::Heap::QQuickJSContext2DImageData::init() { + Object::init(); pixelData = QV4::Primitive::undefinedValue(); QV4::Scope scope(internalClass->engine); diff --git a/src/quick/items/qquickview_p.h b/src/quick/items/qquickview_p.h index c21468ef53..9c0d87984f 100644 --- a/src/quick/items/qquickview_p.h +++ b/src/quick/items/qquickview_p.h @@ -115,9 +115,10 @@ namespace QV4 { namespace Heap { struct QQuickRootItemMarker : Object { - inline QQuickRootItemMarker(QQuickWindow *window) - : window(window) + inline void init(QQuickWindow *window) { + Object::init(); + this->window = window; } QQuickWindow *window; -- cgit v1.2.3 From 97a78aece3250dd0d58cf243a16327694abc33ca Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Thu, 18 Aug 2016 16:22:25 +0200 Subject: QQListView: use dot for property syntax Additionally, that way the braces are not needed anymore. Change-Id: I5afc8fa738211f884ac011079a2ee63613a46d08 Reviewed-by: Venugopal Shivashankar --- src/quick/items/qquicklistview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 9f126525d6..7f4870b84d 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -1757,7 +1757,7 @@ bool QQuickListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte State should \e never be stored in a delegate. ListView attaches a number of properties to the root item of the delegate, for example - \c {ListView:isCurrentItem}. In the following example, the root delegate item can access + \c ListView.isCurrentItem. In the following example, the root delegate item can access this attached property directly as \c ListView.isCurrentItem, while the child \c contactInfo object must refer to this property as \c wrapper.ListView.isCurrentItem. -- cgit v1.2.3 From 57c9d6969ac474177c77d5ea59768b39620a3b2f Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 9 Sep 2016 16:20:57 +0200 Subject: QML: Also check for correct destroy() chaining Check that the destroy() method of Heap::Base was called when a Managed object needs destruction. This checks if a call to the parent's destroy() method was accidentally omitted. Change-Id: Id025ecd6d4744bf3eab23503fbe317ed2a461138 Reviewed-by: Simon Hausmann --- src/quick/items/context2d/qquickcontext2d.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index d94a098897..2483a8eadb 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -504,7 +504,10 @@ struct QQuickContext2DStyle : Object { patternRepeatX = false; patternRepeatY = false; } - void destroy() { delete brush; } + void destroy() { + delete brush; + Object::destroy(); + } QBrush *brush; bool patternRepeatX:1; @@ -513,7 +516,10 @@ struct QQuickContext2DStyle : Object { struct QQuickJSContext2DPixelData : Object { void init(); - void destroy() { delete image; } + void destroy() { + delete image; + Object::destroy(); + } QImage *image; }; -- cgit v1.2.3 From a292697222dd85e586f26bd7133f3e17e30992c2 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Thu, 25 Aug 2016 12:54:05 +0200 Subject: Fix FastFBOResizing hint for QQuickPaintedItem The item updates the node in an order that would never actually take that flag into account. We now makes sure the FBO size is updated when the flag is set. Change-Id: I7aaaf64ed802ec0b53a3b47a39bbdea8195b4092 Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/util/qsgdefaultpainternode.cpp | 16 ++++++++++++++-- src/quick/scenegraph/util/qsgdefaultpainternode_p.h | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src/quick') diff --git a/src/quick/scenegraph/util/qsgdefaultpainternode.cpp b/src/quick/scenegraph/util/qsgdefaultpainternode.cpp index 7a92d61016..3f3eb4b88e 100644 --- a/src/quick/scenegraph/util/qsgdefaultpainternode.cpp +++ b/src/quick/scenegraph/util/qsgdefaultpainternode.cpp @@ -436,9 +436,21 @@ void QSGDefaultPainterNode::setContentsScale(qreal s) markDirty(DirtyMaterial); } -void QSGDefaultPainterNode::setFastFBOResizing(bool dynamic) +void QSGDefaultPainterNode::setFastFBOResizing(bool fastResizing) { - m_fastFBOResizing = dynamic; + if (m_fastFBOResizing == fastResizing) + return; + + m_fastFBOResizing = fastResizing; + updateFBOSize(); + + if ((m_preferredRenderTarget == QQuickPaintedItem::FramebufferObject + || m_preferredRenderTarget == QQuickPaintedItem::InvertedYFramebufferObject) + && (!m_fbo || (m_fbo && m_fbo->size() != m_fboSize))) { + m_dirtyRenderTarget = true; + m_dirtyGeometry = true; + m_dirtyTexture = true; + } } QImage QSGDefaultPainterNode::toImage() const diff --git a/src/quick/scenegraph/util/qsgdefaultpainternode_p.h b/src/quick/scenegraph/util/qsgdefaultpainternode_p.h index 6b6f485915..b00c9df4c0 100644 --- a/src/quick/scenegraph/util/qsgdefaultpainternode_p.h +++ b/src/quick/scenegraph/util/qsgdefaultpainternode_p.h @@ -102,7 +102,7 @@ public: void setContentsScale(qreal s); qreal contentsScale() const { return m_contentsScale; } - void setFastFBOResizing(bool dynamic); + void setFastFBOResizing(bool fastResizing); bool fastFBOResizing() const { return m_fastFBOResizing; } void setTextureSize(const QSize &textureSize); -- cgit v1.2.3 From e48c4134afcb8d4b33c3e965ce5d94e629982d2e Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 11 Aug 2016 15:46:45 +0200 Subject: Convert qtdeclarative over to use the new configure system Change-Id: I105d46e1a4e666f11c07ad63aa24a7c388da1be6 Reviewed-by: Oswald Buddenhagen --- src/quick/configure.json | 41 +++++++++++++++++++++++++++++++++++++++++ src/quick/qtquickglobal.h | 4 +++- src/quick/qtquickglobal_p.h | 4 ++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/quick/configure.json (limited to 'src/quick') diff --git a/src/quick/configure.json b/src/quick/configure.json new file mode 100644 index 0000000000..de75873972 --- /dev/null +++ b/src/quick/configure.json @@ -0,0 +1,41 @@ +{ + "module": "quick", + "depends": [ + "qml-private", + "gui-private" + ], + + "commandline": { + "options": { + "d3d12": "boolean" + } + }, + + "tests": { + "d3d12": { + "label": "Direct3D 12", + "type": "compile", + "test": "d3d12" + } + }, + + "features": { + "d3d12": { + "label": "Direct3D 12", + "purpose": "Provides a Direct3D 12 backend for the Qt Quick Scenegraph", + "condition": "tests.d3d12", + "output": [ + "privateFeature" + ] + } + }, + + "summary": [ + { + "section": "Qt Quick", + "entries": [ + "d3d12" + ] + } + ] +} diff --git a/src/quick/qtquickglobal.h b/src/quick/qtquickglobal.h index f6f8f42e7f..5e83c1db84 100644 --- a/src/quick/qtquickglobal.h +++ b/src/quick/qtquickglobal.h @@ -40,7 +40,9 @@ #ifndef QTQUICKGLOBAL_H #define QTQUICKGLOBAL_H -#include +#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/quick/qtquickglobal_p.h b/src/quick/qtquickglobal_p.h index 3c313de0a1..f6376a6d17 100644 --- a/src/quick/qtquickglobal_p.h +++ b/src/quick/qtquickglobal_p.h @@ -40,6 +40,10 @@ #ifndef QTQUICKGLOBAL_P_H #define QTQUICKGLOBAL_P_H +#include +#include +#include + #include // -- cgit v1.2.3 From 4ee2bc4e9c05d8daec8b04412a0b7c0264fbc1a4 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 15 Aug 2016 10:35:53 +0200 Subject: Turn the no-network support into a configurable feature Change-Id: Ic70f60c124fe166b37fbe9b853735be3c5e0d46d Reviewed-by: Oswald Buddenhagen Reviewed-by: Simon Hausmann --- src/quick/items/qquickanimatedimage.cpp | 10 +++++----- src/quick/items/qquickanimatedimage_p_p.h | 6 +++--- src/quick/items/qquickborderimage.cpp | 12 ++++++------ src/quick/items/qquickborderimage_p.h | 2 +- src/quick/items/qquickborderimage_p_p.h | 6 +++--- src/quick/quick.pro | 8 ++------ src/quick/util/qquickfontloader.cpp | 16 ++++++++-------- src/quick/util/qquickpixmapcache.cpp | 26 +++++++++++++------------- 8 files changed, 41 insertions(+), 45 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickanimatedimage.cpp b/src/quick/items/qquickanimatedimage.cpp index 6f14bf15fe..85251330cb 100644 --- a/src/quick/items/qquickanimatedimage.cpp +++ b/src/quick/items/qquickanimatedimage.cpp @@ -47,7 +47,7 @@ #include #include #include -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) #include #include #endif @@ -146,7 +146,7 @@ QQuickAnimatedImage::QQuickAnimatedImage(QQuickItem *parent) QQuickAnimatedImage::~QQuickAnimatedImage() { Q_D(QQuickAnimatedImage); -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) if (d->reply) d->reply->deleteLater(); #endif @@ -268,7 +268,7 @@ void QQuickAnimatedImage::setSource(const QUrl &url) if (url == d->url) return; -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) if (d->reply) { d->reply->deleteLater(); d->reply = 0; @@ -325,7 +325,7 @@ void QQuickAnimatedImage::load() d->_movie = new QMovie(lf); movieRequestFinished(); } else { -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) if (d->status != Loading) { d->status = Loading; emit statusChanged(d->status); @@ -354,7 +354,7 @@ void QQuickAnimatedImage::movieRequestFinished() Q_D(QQuickAnimatedImage); -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) if (d->reply) { d->redirectCount++; if (d->redirectCount < ANIMATEDIMAGE_MAXIMUM_REDIRECT_RECURSION) { diff --git a/src/quick/items/qquickanimatedimage_p_p.h b/src/quick/items/qquickanimatedimage_p_p.h index ed735d1c9c..6d0600b331 100644 --- a/src/quick/items/qquickanimatedimage_p_p.h +++ b/src/quick/items/qquickanimatedimage_p_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE class QMovie; -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) class QNetworkReply; #endif @@ -69,7 +69,7 @@ class QQuickAnimatedImagePrivate : public QQuickImagePrivate public: QQuickAnimatedImagePrivate() : playing(true), paused(false), preset_currentframe(0), _movie(0), oldPlaying(false) -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) , reply(0), redirectCount(0) #endif , currentSourceSize(0, 0) @@ -83,7 +83,7 @@ public: int preset_currentframe; QMovie *_movie; bool oldPlaying; -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) QNetworkReply *reply; int redirectCount; #endif diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp index ca5ad8dbbd..2fb151b36f 100644 --- a/src/quick/items/qquickborderimage.cpp +++ b/src/quick/items/qquickborderimage.cpp @@ -43,7 +43,7 @@ #include #include #include -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) #include #endif #include @@ -171,7 +171,7 @@ QQuickBorderImage::QQuickBorderImage(QQuickItem *parent) QQuickBorderImage::~QQuickBorderImage() { -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) Q_D(QQuickBorderImage); if (d->sciReply) d->sciReply->deleteLater(); @@ -274,7 +274,7 @@ void QQuickBorderImage::setSource(const QUrl &url) if (url == d->url) return; -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) if (d->sciReply) { d->sciReply->deleteLater(); d->sciReply = 0; @@ -317,7 +317,7 @@ void QQuickBorderImage::load() setGridScaledImage(QQuickGridScaledImage(&file)); return; } else { -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) if (d->progress != 0.0) { d->progress = 0.0; emit progressChanged(d->progress); @@ -537,7 +537,7 @@ void QQuickBorderImage::requestFinished() pixmapChange(); } -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) #define BORDERIMAGE_MAX_REDIRECT 16 void QQuickBorderImage::sciRequestFinished() @@ -567,7 +567,7 @@ void QQuickBorderImage::sciRequestFinished() setGridScaledImage(sci); } } -#endif // QT_NO_NETWORK +#endif // qml_network void QQuickBorderImage::doUpdate() { diff --git a/src/quick/items/qquickborderimage_p.h b/src/quick/items/qquickborderimage_p.h index f2764660f6..844f71e2c9 100644 --- a/src/quick/items/qquickborderimage_p.h +++ b/src/quick/items/qquickborderimage_p.h @@ -101,7 +101,7 @@ private: private Q_SLOTS: void doUpdate(); void requestFinished() Q_DECL_OVERRIDE; -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) void sciRequestFinished(); #endif diff --git a/src/quick/items/qquickborderimage_p_p.h b/src/quick/items/qquickborderimage_p_p.h index 56fbbab049..0f4e7acc05 100644 --- a/src/quick/items/qquickborderimage_p_p.h +++ b/src/quick/items/qquickborderimage_p_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) class QNetworkReply; #endif class QQuickBorderImagePrivate : public QQuickImageBasePrivate @@ -69,7 +69,7 @@ public: QQuickBorderImagePrivate() : border(0), horizontalTileMode(QQuickBorderImage::Stretch), verticalTileMode(QQuickBorderImage::Stretch), pixmapChanged(false) -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) , sciReply(0), redirectCount(0) #endif { @@ -108,7 +108,7 @@ public: QQuickBorderImage::TileMode verticalTileMode; bool pixmapChanged : 1; -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) QNetworkReply *sciReply; int redirectCount; #endif diff --git a/src/quick/quick.pro b/src/quick/quick.pro index 4909f7fce8..094791574f 100644 --- a/src/quick/quick.pro +++ b/src/quick/quick.pro @@ -1,12 +1,8 @@ TARGET = QtQuick QT = core-private gui-private qml-private -!no_network { - QT_PRIVATE = network -} -no_network { - DEFINES += QT_NO_NETWORK -} +qtConfig(qml-network): \ + QT_PRIVATE += network DEFINES += QT_NO_URL_CAST_FROM_STRING QT_NO_INTEGER_EVENT_COORDINATES win32-msvc*:DEFINES *= _CRT_SECURE_NO_WARNINGS diff --git a/src/quick/util/qquickfontloader.cpp b/src/quick/util/qquickfontloader.cpp index 6e23d99f7e..d13291c30a 100644 --- a/src/quick/util/qquickfontloader.cpp +++ b/src/quick/util/qquickfontloader.cpp @@ -52,7 +52,7 @@ #include #include -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) #include #include #endif @@ -70,7 +70,7 @@ Q_OBJECT public: explicit QQuickFontObject(int _id = -1); -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) void download(const QUrl &url, QNetworkAccessManager *manager); Q_SIGNALS: @@ -82,7 +82,7 @@ private: private Q_SLOTS: void replyFinished(); -#endif // QT_NO_NETWORK +#endif // qml_network public: int id; @@ -92,7 +92,7 @@ public: QQuickFontObject::QQuickFontObject(int _id) : QObject(0) -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) ,redirectCount(0), reply(0) #endif ,id(_id) @@ -100,7 +100,7 @@ QQuickFontObject::QQuickFontObject(int _id) } -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) void QQuickFontObject::download(const QUrl &url, QNetworkAccessManager *manager) { QNetworkRequest req(url); @@ -141,7 +141,7 @@ void QQuickFontObject::replyFinished() reply = 0; } } -#endif // QT_NO_NETWORK +#endif // qml_network class QQuickFontLoaderPrivate : public QObjectPrivate { @@ -268,7 +268,7 @@ void QQuickFontLoader::setSource(const QUrl &url) } } else { if (!fontLoaderFonts()->map.contains(d->url)) { -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) QQuickFontObject *fo = new QQuickFontObject; fontLoaderFonts()->map[d->url] = fo; fo->download(d->url, qmlEngine(this)->networkAccessManager()); @@ -282,7 +282,7 @@ void QQuickFontLoader::setSource(const QUrl &url) } else { QQuickFontObject *fo = fontLoaderFonts()->map.value(d->url); if (fo->id == -1) { -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) d->status = Loading; emit statusChanged(); QObject::connect(fo, SIGNAL(fontDownloaded(QString,QQuickFontLoader::Status)), diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 9722bf544b..46f6cccc62 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -67,7 +67,7 @@ #include #include -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) #include #include #include @@ -206,7 +206,7 @@ private: friend class QQuickPixmapReaderThreadObject; void processJobs(); void processJob(QQuickPixmapReply *, const QUrl &, const QString &, AutoTransform, QQuickImageProvider::ImageType, QQuickImageProvider *); -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) void networkRequestDone(QNetworkReply *); #endif void asyncResponseFinished(QQuickImageResponse *); @@ -220,7 +220,7 @@ private: QQuickPixmapReaderThreadObject *threadObject; QWaitCondition waitCondition; -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) QNetworkAccessManager *networkAccessManager(); QNetworkAccessManager *accessManager; QHash networkJobs; @@ -349,7 +349,7 @@ QQuickPixmapReply::Event::~Event() delete textureFactory; } -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) QNetworkAccessManager *QQuickPixmapReader::networkAccessManager() { if (!accessManager) { @@ -430,7 +430,7 @@ static bool readImage(const QUrl& url, QIODevice *dev, QImage *image, QString *e QQuickPixmapReader::QQuickPixmapReader(QQmlEngine *eng) : QThread(eng), engine(eng), threadObject(0) -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) , accessManager(0) #endif { @@ -454,7 +454,7 @@ QQuickPixmapReader::~QQuickPixmapReader() delete reply; } jobs.clear(); -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) const auto cancelJob = [this](QQuickPixmapReply *reply) { if (reply->loading) { @@ -476,7 +476,7 @@ QQuickPixmapReader::~QQuickPixmapReader() wait(); } -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) void QQuickPixmapReader::networkRequestDone(QNetworkReply *reply) { QQuickPixmapReply *job = networkJobs.take(reply); @@ -526,7 +526,7 @@ void QQuickPixmapReader::networkRequestDone(QNetworkReply *reply) // kick off event loop again incase we have dropped below max request count threadObject->processJobs(); } -#endif // QT_NO_NETWORK +#endif // qml_network void QQuickPixmapReader::asyncResponseFinished(QQuickImageResponse *response) { @@ -577,7 +577,7 @@ bool QQuickPixmapReaderThreadObject::event(QEvent *e) void QQuickPixmapReaderThreadObject::networkRequestDone() { -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) QNetworkReply *reply = static_cast(sender()); reader->networkRequestDone(reply); #endif @@ -599,7 +599,7 @@ void QQuickPixmapReader::processJobs() // Clean cancelled jobs if (!cancelled.isEmpty()) { -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) for (int i = 0; i < cancelled.count(); ++i) { QQuickPixmapReply *job = cancelled.at(i); QNetworkReply *reply = networkJobs.key(job, 0); @@ -644,7 +644,7 @@ void QQuickPixmapReader::processJobs() } else { localFile = QQmlFile::urlToLocalFileOrQrc(url); usableJob = !localFile.isEmpty() -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) || networkJobs.count() < IMAGEREQUEST_MAX_NETWORK_REQUEST_COUNT #endif ; @@ -772,7 +772,7 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u runningJob->postReply(errorCode, errorStr, readSize, QQuickTextureFactory::textureFactoryForImage(image)); mutex.unlock(); } else { -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) // Network resource QNetworkRequest req(url); req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); @@ -841,7 +841,7 @@ void QQuickPixmapReader::cancel(QQuickPixmapReply *reply) void QQuickPixmapReader::run() { if (replyDownloadProgress == -1) { -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) replyDownloadProgress = QMetaMethod::fromSignal(&QNetworkReply::downloadProgress).methodIndex(); replyFinished = QMetaMethod::fromSignal(&QNetworkReply::finished).methodIndex(); const QMetaObject *ir = &QQuickPixmapReaderThreadObject::staticMetaObject; -- cgit v1.2.3 From e4dfc6d749957bdd88a48b95aa67e59d93fd4b7b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 16 Aug 2016 15:26:45 +0200 Subject: Make the Canvas item configurable Change-Id: I22a84098bf3a7e2d48f09981c9c953f2e53e6cc1 Reviewed-by: Oswald Buddenhagen Reviewed-by: Simon Hausmann --- src/quick/configure.json | 13 +++++++++++-- src/quick/items/context2d/qquickcanvascontext_p.h | 5 ++++- src/quick/items/context2d/qquickcanvasitem_p.h | 4 ++++ src/quick/items/context2d/qquickcontext2d_p.h | 5 ++++- src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h | 4 ++++ src/quick/items/context2d/qquickcontext2dtexture_p.h | 4 ++++ src/quick/items/context2d/qquickcontext2dtile_p.h | 4 ++++ src/quick/items/items.pri | 3 ++- src/quick/items/qquickitemsmodule.cpp | 4 ++++ 9 files changed, 41 insertions(+), 5 deletions(-) (limited to 'src/quick') diff --git a/src/quick/configure.json b/src/quick/configure.json index de75873972..00e0b52905 100644 --- a/src/quick/configure.json +++ b/src/quick/configure.json @@ -7,7 +7,8 @@ "commandline": { "options": { - "d3d12": "boolean" + "d3d12": "boolean", + "quick-canvas": "boolean" } }, @@ -27,6 +28,13 @@ "output": [ "privateFeature" ] + }, + "quick-canvas": { + "label": "Canvas item", + "purpose": "Provides the Qt Quick Canvas Item", + "output": [ + "privateFeature" + ] } }, @@ -34,7 +42,8 @@ { "section": "Qt Quick", "entries": [ - "d3d12" + "d3d12", + "quick-canvas" ] } ] diff --git a/src/quick/items/context2d/qquickcanvascontext_p.h b/src/quick/items/context2d/qquickcanvascontext_p.h index 4f71770e1a..0746b7dcd3 100644 --- a/src/quick/items/context2d/qquickcanvascontext_p.h +++ b/src/quick/items/context2d/qquickcanvascontext_p.h @@ -51,10 +51,13 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_canvas); + #include #include - QT_BEGIN_NAMESPACE class QQuickCanvasItem; diff --git a/src/quick/items/context2d/qquickcanvasitem_p.h b/src/quick/items/context2d/qquickcanvasitem_p.h index 4f94393a45..8196debef1 100644 --- a/src/quick/items/context2d/qquickcanvasitem_p.h +++ b/src/quick/items/context2d/qquickcanvasitem_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_canvas); + #include #include #include diff --git a/src/quick/items/context2d/qquickcontext2d_p.h b/src/quick/items/context2d/qquickcontext2d_p.h index b526c8320d..e897263b6f 100644 --- a/src/quick/items/context2d/qquickcontext2d_p.h +++ b/src/quick/items/context2d/qquickcontext2d_p.h @@ -51,7 +51,10 @@ // We mean it. // -#include +#include + +QT_REQUIRE_CONFIG(quick_canvas); + #include #include #include diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h b/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h index f281cec2d5..3663e49f10 100644 --- a/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h +++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_canvas); + #include #include "qquickcontext2d_p.h" diff --git a/src/quick/items/context2d/qquickcontext2dtexture_p.h b/src/quick/items/context2d/qquickcontext2dtexture_p.h index ed38382892..6a5d4e8b09 100644 --- a/src/quick/items/context2d/qquickcontext2dtexture_p.h +++ b/src/quick/items/context2d/qquickcontext2dtexture_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_canvas); + #include #include "qquickcanvasitem_p.h" #include "qquickcontext2d_p.h" diff --git a/src/quick/items/context2d/qquickcontext2dtile_p.h b/src/quick/items/context2d/qquickcontext2dtile_p.h index a87202daae..2f3fdeb54f 100644 --- a/src/quick/items/context2d/qquickcontext2dtile_p.h +++ b/src/quick/items/context2d/qquickcontext2dtile_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_canvas); + #include "qquickcontext2d_p.h" #ifndef QT_NO_OPENGL # include diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri index d91705451e..eb9afdcd0e 100644 --- a/src/quick/items/items.pri +++ b/src/quick/items/items.pri @@ -174,4 +174,5 @@ qtConfig(opengl(es1|es2)?) { RESOURCES += \ $$PWD/items.qrc -include(context2d/context2d.pri) +qtConfig(quick-canvas): \ + include(context2d/context2d.pri) diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index 1bc1aebe4f..6bb6cdddba 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -71,8 +71,10 @@ #include "qquickitemanimation_p.h" #include //#include +#if QT_CONFIG(quick_canvas) #include #include +#endif #include "qquickitemgrabresult.h" #include "qquicksprite_p.h" #include "qquickspritesequence_p.h" @@ -216,7 +218,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterUncreatableType("QtQuick", 2, 0, "PaintedItem", QQuickPaintedItem::tr("Cannot create instance of abstract class PaintedItem")); +#if QT_CONFIG(quick_canvas) qmlRegisterType("QtQuick", 2, 0, "Canvas"); +#endif qmlRegisterType("QtQuick", 2, 0, "Sprite"); qmlRegisterType("QtQuick", 2, 0, "AnimatedSprite"); -- cgit v1.2.3 From 094e1f12945a04507054b5a5bad94b72a7982fb7 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 16 Aug 2016 15:46:30 +0200 Subject: Make Path and PathView configurable Change-Id: Ie9e35612fc274def96d63ef35817c03475077f1f Reviewed-by: Oswald Buddenhagen Reviewed-by: Simon Hausmann --- src/quick/configure.json | 23 +++++++++++++++++++++-- src/quick/items/items.pri | 11 ++++++++--- src/quick/items/qquickitemanimation.cpp | 6 ++++++ src/quick/items/qquickitemanimation_p.h | 6 ++++++ src/quick/items/qquickitemanimation_p_p.h | 5 +++++ src/quick/items/qquickitemsmodule.cpp | 14 ++++++++++++++ src/quick/items/qquickpathview_p.h | 4 ++++ src/quick/items/qquickpathview_p_p.h | 4 ++++ src/quick/util/qquickpath_p.h | 4 ++++ src/quick/util/qquickpath_p_p.h | 4 ++++ src/quick/util/qquickpathinterpolator_p.h | 4 ++++ src/quick/util/util.pri | 15 ++++++++++----- 12 files changed, 90 insertions(+), 10 deletions(-) (limited to 'src/quick') diff --git a/src/quick/configure.json b/src/quick/configure.json index 00e0b52905..8a0c6e3562 100644 --- a/src/quick/configure.json +++ b/src/quick/configure.json @@ -8,7 +8,9 @@ "commandline": { "options": { "d3d12": "boolean", - "quick-canvas": "boolean" + "quick-canvas": "boolean", + "quick-path": "boolean", + "quick-pathview": "boolean" } }, @@ -35,6 +37,21 @@ "output": [ "privateFeature" ] + }, + "quick-path": { + "label": "Path support", + "purpose": "Provides Path elements in Qt Quick", + "output": [ + "privateFeature" + ] + }, + "quick-pathview": { + "label": "PathView item", + "purpose": "Provides the Qt Quick PathView item", + "condition": "features.quick-path", + "output": [ + "privateFeature" + ] } }, @@ -43,7 +60,9 @@ "section": "Qt Quick", "entries": [ "d3d12", - "quick-canvas" + "quick-canvas", + "quick-path", + "quick-pathview" ] } ] diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri index eb9afdcd0e..703acaa9e8 100644 --- a/src/quick/items/items.pri +++ b/src/quick/items/items.pri @@ -45,8 +45,6 @@ HEADERS += \ $$PWD/qquickrepeater_p.h \ $$PWD/qquickrepeater_p_p.h \ $$PWD/qquickgridview_p.h \ - $$PWD/qquickpathview_p.h \ - $$PWD/qquickpathview_p_p.h \ $$PWD/qquickpositioners_p.h \ $$PWD/qquickpositioners_p_p.h \ $$PWD/qquickloader_p.h \ @@ -114,7 +112,6 @@ SOURCES += \ $$PWD/qquicklistview.cpp \ $$PWD/qquickrepeater.cpp \ $$PWD/qquickgridview.cpp \ - $$PWD/qquickpathview.cpp \ $$PWD/qquickpositioners.cpp \ $$PWD/qquickloader.cpp \ $$PWD/qquickanimatedimage.cpp \ @@ -146,6 +143,14 @@ SOURCES += \ $$PWD/qquickspritesequence.cpp \ $$PWD/qquickanimatedsprite.cpp +qtConfig(quick-pathview) { + HEADERS += \ + $$PWD/qquickpathview_p.h \ + $$PWD/qquickpathview_p_p.h + SOURCES += \ + $$PWD/qquickpathview.cpp +} + # Items that depend on OpenGL Renderer qtConfig(opengl(es1|es2)?) { SOURCES += \ diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp index 5c0caf5ca2..fd4a7d733f 100644 --- a/src/quick/items/qquickitemanimation.cpp +++ b/src/quick/items/qquickitemanimation.cpp @@ -42,7 +42,9 @@ #include "qquickstateoperations_p.h" #include +#if QT_CONFIG(quick_path) #include +#endif #include "private/qparallelanimationgroupjob_p.h" #include "private/qsequentialanimationgroupjob_p.h" @@ -554,6 +556,8 @@ QAbstractAnimationJob* QQuickAnchorAnimation::transition(QQuickStateActions &act return initInstance(animator); } + +#if QT_CONFIG(quick_path) /*! \qmltype PathAnimation \instantiates QQuickPathAnimation @@ -1044,4 +1048,6 @@ QQuickPathAnimationAnimator::~QQuickPathAnimationAnimator() } } +#endif // quick_path + QT_END_NAMESPACE diff --git a/src/quick/items/qquickitemanimation_p.h b/src/quick/items/qquickitemanimation_p.h index df80272eaa..a503cff223 100644 --- a/src/quick/items/qquickitemanimation_p.h +++ b/src/quick/items/qquickitemanimation_p.h @@ -124,6 +124,8 @@ protected: QObject *defaultTarget = 0) Q_DECL_OVERRIDE; }; +#if QT_CONFIG(quick_path) + class QQuickItem; class QQuickPath; class QQuickPathAnimationPrivate; @@ -199,10 +201,14 @@ Q_SIGNALS: void endRotationChanged(qreal); }; +#endif + QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickParentAnimation) QML_DECLARE_TYPE(QQuickAnchorAnimation) +#if QT_CONFIG(quick_path) QML_DECLARE_TYPE(QQuickPathAnimation) +#endif #endif // QQUICKITEMANIMATION_H diff --git a/src/quick/items/qquickitemanimation_p_p.h b/src/quick/items/qquickitemanimation_p_p.h index 5b18e4b0ae..92dd84e4a9 100644 --- a/src/quick/items/qquickitemanimation_p_p.h +++ b/src/quick/items/qquickitemanimation_p_p.h @@ -53,7 +53,9 @@ #include "qquickitemanimation_p.h" +#if QT_CONFIG(quick_path) #include +#endif #include QT_BEGIN_NAMESPACE @@ -84,6 +86,8 @@ public: QList targets; }; +#if QT_CONFIG(quick_path) + class QQuickPathAnimationUpdater : public QQuickBulkValueUpdater { public: @@ -153,6 +157,7 @@ public: QHash activeAnimations; }; +#endif QT_END_NAMESPACE diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index 6bb6cdddba..dffefa5869 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -57,10 +57,14 @@ #include "qquickflickable_p_p.h" #include "qquicklistview_p.h" #include "qquickgridview_p.h" +#if QT_CONFIG(quick_pathview) #include "qquickpathview_p.h" +#endif #include "qquickitemviewtransition_p.h" +#if QT_CONFIG(quick_path) #include #include +#endif #include "qquickpositioners_p.h" #include "qquickrepeater_p.h" #include "qquickloader_p.h" @@ -157,6 +161,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(uri,major,minor,"ListView"); qmlRegisterType(uri,major,minor,"Loader"); qmlRegisterType(uri,major,minor,"MouseArea"); +#if QT_CONFIG(quick_path) qmlRegisterType(uri,major,minor,"Path"); qmlRegisterType(uri,major,minor,"PathAttribute"); qmlRegisterType(uri,major,minor,"PathCubic"); @@ -166,7 +171,10 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType("QtQuick",2,0,"PathCurve"); qmlRegisterType("QtQuick",2,0,"PathArc"); qmlRegisterType("QtQuick",2,0,"PathSvg"); +#endif +#if QT_CONFIG(quick_pathview) qmlRegisterType(uri,major,minor,"PathView"); +#endif qmlRegisterUncreatableType(uri,major,minor,"Positioner", QStringLiteral("Positioner is an abstract type that is only available as an attached property.")); qmlRegisterType(uri,major,minor,"Rectangle"); @@ -191,8 +199,10 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); +#if QT_CONFIG(quick_path) qmlRegisterType(); qmlRegisterType(); +#endif qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); @@ -231,8 +241,10 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(); qmlRegisterType(uri, major, minor,"AnchorAnimation"); qmlRegisterType(uri, major, minor,"ParentAnimation"); +#if QT_CONFIG(quick_canvas) qmlRegisterType("QtQuick",2,0,"PathAnimation"); qmlRegisterType("QtQuick",2,0,"PathInterpolator"); +#endif #ifndef QT_NO_DRAGANDDROP qmlRegisterType("QtQuick", 2, 0, "DropArea"); @@ -293,7 +305,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(uri, 2, 7, "GridView"); qmlRegisterType(uri, 2, 7, "TextInput"); qmlRegisterType(uri, 2, 7, "TextEdit"); +#if QT_CONFIG(quick_pathview) qmlRegisterType(uri, 2, 7, "PathView"); +#endif qmlRegisterUncreatableType(uri, 2, 7, nullptr, QQuickMouseEvent::tr("MouseEvent is only available within handlers in MouseArea")); diff --git a/src/quick/items/qquickpathview_p.h b/src/quick/items/qquickpathview_p.h index bdd56b6311..a44d1be5c4 100644 --- a/src/quick/items/qquickpathview_p.h +++ b/src/quick/items/qquickpathview_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_pathview); + #include "qquickitem.h" #include diff --git a/src/quick/items/qquickpathview_p_p.h b/src/quick/items/qquickpathview_p_p.h index 0441603a4b..64abe3d1dc 100644 --- a/src/quick/items/qquickpathview_p_p.h +++ b/src/quick/items/qquickpathview_p_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_pathview); + #include "qquickpathview_p.h" #include "qquickitem_p.h" diff --git a/src/quick/util/qquickpath_p.h b/src/quick/util/qquickpath_p.h index fa6cbc668a..457f69d20f 100644 --- a/src/quick/util/qquickpath_p.h +++ b/src/quick/util/qquickpath_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_path); + #include #include diff --git a/src/quick/util/qquickpath_p_p.h b/src/quick/util/qquickpath_p_p.h index 3e4ccc7eb6..1dc3c1c47a 100644 --- a/src/quick/util/qquickpath_p_p.h +++ b/src/quick/util/qquickpath_p_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_path); + #include "qquickpath_p.h" #include diff --git a/src/quick/util/qquickpathinterpolator_p.h b/src/quick/util/qquickpathinterpolator_p.h index ce18190977..0fdb1a444f 100644 --- a/src/quick/util/qquickpathinterpolator_p.h +++ b/src/quick/util/qquickpathinterpolator_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_path); + #include #include diff --git a/src/quick/util/util.pri b/src/quick/util/util.pri index 66792536d7..1ef1018a31 100644 --- a/src/quick/util/util.pri +++ b/src/quick/util/util.pri @@ -17,8 +17,6 @@ SOURCES += \ $$PWD/qquickbehavior.cpp \ $$PWD/qquickfontloader.cpp \ $$PWD/qquickstyledtext.cpp \ - $$PWD/qquickpath.cpp \ - $$PWD/qquickpathinterpolator.cpp \ $$PWD/qquickimageprovider.cpp \ $$PWD/qquicksvgparser.cpp \ $$PWD/qquickvaluetypes.cpp \ @@ -55,9 +53,6 @@ HEADERS += \ $$PWD/qquickbehavior_p.h \ $$PWD/qquickfontloader_p.h \ $$PWD/qquickstyledtext_p.h \ - $$PWD/qquickpath_p.h \ - $$PWD/qquickpath_p_p.h \ - $$PWD/qquickpathinterpolator_p.h \ $$PWD/qquickimageprovider.h \ $$PWD/qquicksvgparser_p.h \ $$PWD/qquickvaluetypes_p.h \ @@ -70,3 +65,13 @@ HEADERS += \ $$PWD/qquicktextmetrics_p.h \ $$PWD/qquickshortcut_p.h \ $$PWD/qquickvalidator_p.h + +qtConfig(quick-path) { + SOURCES += \ + $$PWD/qquickpath.cpp \ + $$PWD/qquickpathinterpolator.cpp + HEADERS += \ + $$PWD/qquickpath_p.h \ + $$PWD/qquickpath_p_p.h \ + $$PWD/qquickpathinterpolator_p.h +} -- cgit v1.2.3 From fdf45e12ee626b99ee5aadf032a1bec109d37ead Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 16 Aug 2016 16:02:25 +0200 Subject: Make Flipable configurable Change-Id: Iaf060c6abefb8bfff9b9f3727bd477ae3c96b7a4 Reviewed-by: Oswald Buddenhagen Reviewed-by: Simon Hausmann --- src/quick/configure.json | 9 +++++++++ src/quick/items/items.pri | 9 +++++++-- src/quick/items/qquickflipable_p.h | 4 ++++ src/quick/items/qquickitemsmodule.cpp | 4 ++++ 4 files changed, 24 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/configure.json b/src/quick/configure.json index 8a0c6e3562..798e8c2f14 100644 --- a/src/quick/configure.json +++ b/src/quick/configure.json @@ -9,6 +9,7 @@ "options": { "d3d12": "boolean", "quick-canvas": "boolean", + "quick-flipable": "boolean", "quick-path": "boolean", "quick-pathview": "boolean" } @@ -38,6 +39,13 @@ "privateFeature" ] }, + "quick-flipable": { + "label": "Flipable item", + "purpose": "Provides the Qt Quick Flipable Item", + "output": [ + "privateFeature" + ] + }, "quick-path": { "label": "Path support", "purpose": "Provides Path elements in Qt Quick", @@ -61,6 +69,7 @@ "entries": [ "d3d12", "quick-canvas", + "quick-flipable", "quick-path", "quick-pathview" ] diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri index 703acaa9e8..fe3bed3b3a 100644 --- a/src/quick/items/items.pri +++ b/src/quick/items/items.pri @@ -51,7 +51,6 @@ HEADERS += \ $$PWD/qquickloader_p_p.h \ $$PWD/qquickanimatedimage_p.h \ $$PWD/qquickanimatedimage_p_p.h \ - $$PWD/qquickflipable_p.h \ $$PWD/qquicktranslate_p.h \ $$PWD/qquickclipnode_p.h \ $$PWD/qquickview.h \ @@ -115,7 +114,6 @@ SOURCES += \ $$PWD/qquickpositioners.cpp \ $$PWD/qquickloader.cpp \ $$PWD/qquickanimatedimage.cpp \ - $$PWD/qquickflipable.cpp \ $$PWD/qquicktranslate.cpp \ $$PWD/qquickclipnode.cpp \ $$PWD/qquickview.cpp \ @@ -151,6 +149,13 @@ qtConfig(quick-pathview) { $$PWD/qquickpathview.cpp } +qtConfig(quick-flipable) { + HEADERS += \ + $$PWD/qquickflipable_p.h + SOURCES += \ + $$PWD/qquickflipable.cpp +} + # Items that depend on OpenGL Renderer qtConfig(opengl(es1|es2)?) { SOURCES += \ diff --git a/src/quick/items/qquickflipable_p.h b/src/quick/items/qquickflipable_p.h index 189d94775a..17a74d1f7a 100644 --- a/src/quick/items/qquickflipable_p.h +++ b/src/quick/items/qquickflipable_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_flipable); + #include "qquickitem.h" #include diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index dffefa5869..ec21de1915 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -69,7 +69,9 @@ #include "qquickrepeater_p.h" #include "qquickloader_p.h" #include "qquickanimatedimage_p.h" +#if QT_CONFIG(quick_flipable) #include "qquickflipable_p.h" +#endif #include "qquicktranslate_p.h" #include "qquickstateoperations_p.h" #include "qquickitemanimation_p.h" @@ -148,7 +150,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(uri,major,minor,"BorderImage"); qmlRegisterType(uri,major,minor,"Column"); qmlRegisterType(uri,major,minor,"Flickable"); +#if QT_CONFIG(quick_flipable) qmlRegisterType(uri,major,minor,"Flipable"); +#endif qmlRegisterType(uri,major,minor,"Flow"); // qmlRegisterType(uri,major,minor,"FocusPanel"); qmlRegisterType(uri,major,minor,"FocusScope"); -- cgit v1.2.3 From a266bc967bb2d9069f4b882b208eed74bcd83dd1 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 16 Aug 2016 16:06:16 +0200 Subject: Make ListView item configurable Change-Id: Iaecae9a9e1bf5e073f94e76531e65d381e7fa01f Reviewed-by: Oswald Buddenhagen Reviewed-by: Simon Hausmann --- src/quick/configure.json | 9 +++++++++ src/quick/items/items.pri | 9 +++++++-- src/quick/items/qquickitemsmodule.cpp | 12 +++++++++++- src/quick/items/qquicklistview_p.h | 4 ++++ 4 files changed, 31 insertions(+), 3 deletions(-) (limited to 'src/quick') diff --git a/src/quick/configure.json b/src/quick/configure.json index 798e8c2f14..5602cf46a4 100644 --- a/src/quick/configure.json +++ b/src/quick/configure.json @@ -10,6 +10,7 @@ "d3d12": "boolean", "quick-canvas": "boolean", "quick-flipable": "boolean", + "quick-listview": "boolean", "quick-path": "boolean", "quick-pathview": "boolean" } @@ -46,6 +47,13 @@ "privateFeature" ] }, + "quick-listview": { + "label": "ListView item", + "purpose": "Provides the Qt Quick ListView item", + "output": [ + "privateFeature" + ] + }, "quick-path": { "label": "Path support", "purpose": "Provides Path elements in Qt Quick", @@ -70,6 +78,7 @@ "d3d12", "quick-canvas", "quick-flipable", + "quick-listview", "quick-path", "quick-pathview" ] diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri index fe3bed3b3a..5f13f65d6f 100644 --- a/src/quick/items/items.pri +++ b/src/quick/items/items.pri @@ -41,7 +41,6 @@ HEADERS += \ $$PWD/qquickflickable_p.h \ $$PWD/qquickflickable_p_p.h \ $$PWD/qquickflickablebehavior_p.h \ - $$PWD/qquicklistview_p.h \ $$PWD/qquickrepeater_p.h \ $$PWD/qquickrepeater_p_p.h \ $$PWD/qquickgridview_p.h \ @@ -108,7 +107,6 @@ SOURCES += \ $$PWD/qquickmousearea.cpp \ $$PWD/qquickpincharea.cpp \ $$PWD/qquickflickable.cpp \ - $$PWD/qquicklistview.cpp \ $$PWD/qquickrepeater.cpp \ $$PWD/qquickgridview.cpp \ $$PWD/qquickpositioners.cpp \ @@ -141,6 +139,13 @@ SOURCES += \ $$PWD/qquickspritesequence.cpp \ $$PWD/qquickanimatedsprite.cpp +qtConfig(quick-listview) { + HEADERS += \ + $$PWD/qquicklistview_p.h + SOURCES += \ + $$PWD/qquicklistview.cpp +} + qtConfig(quick-pathview) { HEADERS += \ $$PWD/qquickpathview_p.h \ diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index ec21de1915..7237476313 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -55,7 +55,9 @@ #include "qquickpincharea_p.h" #include "qquickflickable_p.h" #include "qquickflickable_p_p.h" +#if QT_CONFIG(quick_listview) #include "qquicklistview_p.h" +#endif #include "qquickgridview_p.h" #if QT_CONFIG(quick_pathview) #include "qquickpathview_p.h" @@ -162,7 +164,10 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(uri,major,minor,"GridView"); qmlRegisterType(uri,major,minor,"Image"); qmlRegisterType(uri,major,minor,"Item"); +#if QT_CONFIG(quick_listview) qmlRegisterType(uri,major,minor,"ListView"); + qmlRegisterType(uri,major,minor,"ViewSection"); +#endif qmlRegisterType(uri,major,minor,"Loader"); qmlRegisterType(uri,major,minor,"MouseArea"); #if QT_CONFIG(quick_path) @@ -194,7 +199,6 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(uri,major,minor,"TextInput"); qmlRegisterType(uri,2,2,"TextInput"); qmlRegisterType(uri,2,4,"TextInput"); - qmlRegisterType(uri,major,minor,"ViewSection"); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); @@ -269,7 +273,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(uri, 2, 1, "Grid"); qmlRegisterUncreatableType(uri, 2, 1, "ItemView", QQuickItemView::tr("ItemView is an abstract base class")); qmlRegisterUncreatableType(uri, 2, 3, "ItemView", QQuickItemView::tr("ItemView is an abstract base class")); +#if QT_CONFIG(quick_listview) qmlRegisterType(uri, 2, 1, "ListView"); +#endif qmlRegisterType(uri, 2, 1, "GridView"); qmlRegisterType(uri, 2, 1, "TextEdit"); @@ -281,7 +287,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(uri, 2, 3,"Image"); qmlRegisterType(uri, 2, 4, "Item"); +#if QT_CONFIG(quick_listview) qmlRegisterType(uri, 2, 4, "ListView"); +#endif qmlRegisterType(uri, 2, 4, "MouseArea"); qmlRegisterType(uri, 2, 4, "ShaderEffect"); @@ -305,7 +313,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) QQuickEnterKeyAttached::tr("EnterKey is only available via attached properties")); qmlRegisterType(uri, 2, 6, "ShaderEffectSource"); +#if QT_CONFIG(quick_listview) qmlRegisterType(uri, 2, 7, "ListView"); +#endif qmlRegisterType(uri, 2, 7, "GridView"); qmlRegisterType(uri, 2, 7, "TextInput"); qmlRegisterType(uri, 2, 7, "TextEdit"); diff --git a/src/quick/items/qquicklistview_p.h b/src/quick/items/qquicklistview_p.h index 5a5e8a55fe..8d0ad7f618 100644 --- a/src/quick/items/qquicklistview_p.h +++ b/src/quick/items/qquicklistview_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_listview); + #include "qquickitemview_p.h" #include -- cgit v1.2.3 From d6a4bd5938e763db419c64cc503f918a1f6d8f47 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 17 Aug 2016 09:31:46 +0200 Subject: Make AnimatedImage configurable Change-Id: I058292cef1b7236b0c5b735f7dacbc1f2aa6fcfd Reviewed-by: Oswald Buddenhagen Reviewed-by: Simon Hausmann --- src/quick/configure.json | 10 ++++++++++ src/quick/items/items.pri | 11 ++++++++--- src/quick/items/qquickanimatedimage.cpp | 4 ---- src/quick/items/qquickanimatedimage_p.h | 8 ++++---- src/quick/items/qquickanimatedimage_p_p.h | 8 ++++---- src/quick/items/qquickitemsmodule.cpp | 4 +++- 6 files changed, 29 insertions(+), 16 deletions(-) (limited to 'src/quick') diff --git a/src/quick/configure.json b/src/quick/configure.json index 5602cf46a4..066ee88b3a 100644 --- a/src/quick/configure.json +++ b/src/quick/configure.json @@ -8,6 +8,7 @@ "commandline": { "options": { "d3d12": "boolean", + "quick-animatedimage": "boolean", "quick-canvas": "boolean", "quick-flipable": "boolean", "quick-listview": "boolean", @@ -33,6 +34,14 @@ "privateFeature" ] }, + "quick-animatedimage": { + "label": "AnimatedImage item", + "purpose": "Provides the Qt Quick AnimatedImage Item", + "condition": "features.movie", + "output": [ + "privateFeature" + ] + }, "quick-canvas": { "label": "Canvas item", "purpose": "Provides the Qt Quick Canvas Item", @@ -76,6 +85,7 @@ "section": "Qt Quick", "entries": [ "d3d12", + "quick-animatedimage", "quick-canvas", "quick-flipable", "quick-listview", diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri index 5f13f65d6f..d537e4e091 100644 --- a/src/quick/items/items.pri +++ b/src/quick/items/items.pri @@ -48,8 +48,6 @@ HEADERS += \ $$PWD/qquickpositioners_p_p.h \ $$PWD/qquickloader_p.h \ $$PWD/qquickloader_p_p.h \ - $$PWD/qquickanimatedimage_p.h \ - $$PWD/qquickanimatedimage_p_p.h \ $$PWD/qquicktranslate_p.h \ $$PWD/qquickclipnode_p.h \ $$PWD/qquickview.h \ @@ -111,7 +109,6 @@ SOURCES += \ $$PWD/qquickgridview.cpp \ $$PWD/qquickpositioners.cpp \ $$PWD/qquickloader.cpp \ - $$PWD/qquickanimatedimage.cpp \ $$PWD/qquicktranslate.cpp \ $$PWD/qquickclipnode.cpp \ $$PWD/qquickview.cpp \ @@ -139,6 +136,14 @@ SOURCES += \ $$PWD/qquickspritesequence.cpp \ $$PWD/qquickanimatedsprite.cpp +qtConfig(quick-animatedimage) { + HEADERS += \ + $$PWD/qquickanimatedimage_p.h \ + $$PWD/qquickanimatedimage_p_p.h + SOURCES += \ + $$PWD/qquickanimatedimage.cpp +} + qtConfig(quick-listview) { HEADERS += \ $$PWD/qquicklistview_p.h diff --git a/src/quick/items/qquickanimatedimage.cpp b/src/quick/items/qquickanimatedimage.cpp index 85251330cb..81c649dbd5 100644 --- a/src/quick/items/qquickanimatedimage.cpp +++ b/src/quick/items/qquickanimatedimage.cpp @@ -40,8 +40,6 @@ #include "qquickanimatedimage_p.h" #include "qquickanimatedimage_p_p.h" -#ifndef QT_NO_MOVIE - #include #include #include @@ -493,5 +491,3 @@ void QQuickAnimatedImage::componentComplete() } QT_END_NAMESPACE - -#endif // QT_NO_MOVIE diff --git a/src/quick/items/qquickanimatedimage_p.h b/src/quick/items/qquickanimatedimage_p.h index 288a8379da..143fe8904d 100644 --- a/src/quick/items/qquickanimatedimage_p.h +++ b/src/quick/items/qquickanimatedimage_p.h @@ -51,9 +51,11 @@ // We mean it. // -#include "qquickimage_p.h" +#include + +QT_REQUIRE_CONFIG(quick_animatedimage); -#ifndef QT_NO_MOVIE +#include "qquickimage_p.h" QT_BEGIN_NAMESPACE @@ -116,6 +118,4 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QQuickAnimatedImage) -#endif // QT_NO_MOVIE - #endif // QQUICKANIMATEDIMAGE_P_H diff --git a/src/quick/items/qquickanimatedimage_p_p.h b/src/quick/items/qquickanimatedimage_p_p.h index 6d0600b331..9eff6a44e3 100644 --- a/src/quick/items/qquickanimatedimage_p_p.h +++ b/src/quick/items/qquickanimatedimage_p_p.h @@ -51,9 +51,11 @@ // We mean it. // -#include "qquickimage_p_p.h" +#include + +QT_REQUIRE_CONFIG(quick_animatedimage); -#ifndef QT_NO_MOVIE +#include "qquickimage_p_p.h" QT_BEGIN_NAMESPACE @@ -93,6 +95,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_MOVIE - #endif // QQUICKANIMATEDIMAGE_P_P_H diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index 7237476313..157ca3b030 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -70,7 +70,9 @@ #include "qquickpositioners_p.h" #include "qquickrepeater_p.h" #include "qquickloader_p.h" +#if QT_CONFIG(quick_animatedimage) #include "qquickanimatedimage_p.h" +#endif #if QT_CONFIG(quick_flipable) #include "qquickflipable_p.h" #endif @@ -144,7 +146,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) QQmlPrivate::RegisterAutoParent autoparent = { 0, &qquickitem_autoParent }; QQmlPrivate::qmlregister(QQmlPrivate::AutoParentRegistration, &autoparent); -#ifdef QT_NO_MOVIE +#if !QT_CONFIG(quick_animatedimage) qmlRegisterTypeNotAvailable(uri,major,minor,"AnimatedImage", QCoreApplication::translate("QQuickAnimatedImage","Qt was built without support for QMovie")); #else qmlRegisterType(uri,major,minor,"AnimatedImage"); -- cgit v1.2.3 From d64503bbdc62bb1839ddfe3e5f5813e406eafaaa Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 17 Aug 2016 09:43:21 +0200 Subject: Make Sprite a configurable feature Change-Id: Iab5c5261cb3cdce3d02fa6cd19ae6f594b6fc649 Reviewed-by: Oswald Buddenhagen Reviewed-by: Simon Hausmann --- src/quick/configure.json | 13 ++++++++-- src/quick/items/items.pri | 29 +++++++++++++--------- src/quick/items/qquickanimatedsprite_p.h | 4 +++ src/quick/items/qquickanimatedsprite_p_p.h | 4 +++ src/quick/items/qquickitemsmodule.cpp | 4 +++ src/quick/items/qquicksprite_p.h | 5 ++++ src/quick/items/qquickspriteengine_p.h | 4 +++ src/quick/items/qquickspritesequence_p.h | 4 +++ src/quick/items/qquickspritesequence_p_p.h | 4 +++ .../adaptations/software/qsgsoftwarecontext.cpp | 4 +++ .../adaptations/software/qsgsoftwarecontext_p.h | 2 ++ .../software/qsgsoftwarerenderablenode.cpp | 8 ++++++ .../software/qsgsoftwarerenderablenode_p.h | 4 +++ .../software/qsgsoftwarerenderablenodeupdater.cpp | 2 ++ .../software/qsgsoftwarerenderablenodeupdater_p.h | 2 ++ .../software/qsgsoftwarerenderlistbuilder.cpp | 2 ++ .../software/qsgsoftwarerenderlistbuilder_p.h | 2 ++ .../adaptations/software/qsgsoftwarespritenode_p.h | 4 +++ .../scenegraph/adaptations/software/software.pri | 9 +++++-- src/quick/scenegraph/qsgadaptationlayer_p.h | 6 +++++ src/quick/scenegraph/qsgcontext_p.h | 2 ++ src/quick/scenegraph/qsgdefaultcontext.cpp | 4 +++ src/quick/scenegraph/qsgdefaultcontext_p.h | 2 ++ src/quick/scenegraph/qsgdefaultspritenode_p.h | 4 +++ src/quick/scenegraph/scenegraph.pri | 9 +++++-- 25 files changed, 119 insertions(+), 18 deletions(-) (limited to 'src/quick') diff --git a/src/quick/configure.json b/src/quick/configure.json index 066ee88b3a..5d76ef1e48 100644 --- a/src/quick/configure.json +++ b/src/quick/configure.json @@ -13,7 +13,8 @@ "quick-flipable": "boolean", "quick-listview": "boolean", "quick-path": "boolean", - "quick-pathview": "boolean" + "quick-pathview": "boolean", + "quick-sprite": "boolean" } }, @@ -77,6 +78,13 @@ "output": [ "privateFeature" ] + }, + "quick-sprite": { + "label": "Sprite item", + "purpose": "Provides the Qt Quick Sprite Item", + "output": [ + "privateFeature" + ] } }, @@ -90,7 +98,8 @@ "quick-flipable", "quick-listview", "quick-path", - "quick-pathview" + "quick-pathview", + "quick-sprite" ] } ] diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri index d537e4e091..c74770093f 100644 --- a/src/quick/items/items.pri +++ b/src/quick/items/items.pri @@ -73,13 +73,7 @@ HEADERS += \ $$PWD/qquickrendercontrol.h \ $$PWD/qquickrendercontrol_p.h \ $$PWD/qquickgraphicsinfo_p.h \ - $$PWD/qquickitemgrabresult.h \ - $$PWD/qquickspriteengine_p.h \ - $$PWD/qquicksprite_p.h \ - $$PWD/qquickspritesequence_p.h \ - $$PWD/qquickanimatedsprite_p.h \ - $$PWD/qquickanimatedsprite_p_p.h \ - $$PWD/qquickspritesequence_p_p.h + $$PWD/qquickitemgrabresult.h SOURCES += \ $$PWD/qquickevents.cpp \ @@ -130,11 +124,7 @@ SOURCES += \ $$PWD/qquickgenericshadereffect.cpp \ $$PWD/qquickrendercontrol.cpp \ $$PWD/qquickgraphicsinfo.cpp \ - $$PWD/qquickitemgrabresult.cpp \ - $$PWD/qquickspriteengine.cpp \ - $$PWD/qquicksprite.cpp \ - $$PWD/qquickspritesequence.cpp \ - $$PWD/qquickanimatedsprite.cpp + $$PWD/qquickitemgrabresult.cpp qtConfig(quick-animatedimage) { HEADERS += \ @@ -166,6 +156,21 @@ qtConfig(quick-flipable) { $$PWD/qquickflipable.cpp } +qtConfig(quick-sprite) { + HEADERS += \ + $$PWD/qquickspriteengine_p.h \ + $$PWD/qquicksprite_p.h \ + $$PWD/qquickspritesequence_p.h \ + $$PWD/qquickanimatedsprite_p.h \ + $$PWD/qquickanimatedsprite_p_p.h \ + $$PWD/qquickspritesequence_p_p.h + SOURCES += \ + $$PWD/qquickspriteengine.cpp \ + $$PWD/qquicksprite.cpp \ + $$PWD/qquickspritesequence.cpp \ + $$PWD/qquickanimatedsprite.cpp +} + # Items that depend on OpenGL Renderer qtConfig(opengl(es1|es2)?) { SOURCES += \ diff --git a/src/quick/items/qquickanimatedsprite_p.h b/src/quick/items/qquickanimatedsprite_p.h index cbd6524c40..11cdfe11cc 100644 --- a/src/quick/items/qquickanimatedsprite_p.h +++ b/src/quick/items/qquickanimatedsprite_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_sprite); + #include #include #include diff --git a/src/quick/items/qquickanimatedsprite_p_p.h b/src/quick/items/qquickanimatedsprite_p_p.h index 0e4a1e9066..3610e58861 100644 --- a/src/quick/items/qquickanimatedsprite_p_p.h +++ b/src/quick/items/qquickanimatedsprite_p_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_sprite); + #include "qquickitem_p.h" #include "qquicksprite_p.h" diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index 157ca3b030..ce9ddcd633 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -86,9 +86,11 @@ #include #endif #include "qquickitemgrabresult.h" +#if QT_CONFIG(quick_sprite) #include "qquicksprite_p.h" #include "qquickspritesequence_p.h" #include "qquickanimatedsprite_p.h" +#endif #ifndef QT_NO_OPENGL # include "qquickopenglinfo_p.h" #endif @@ -242,9 +244,11 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType("QtQuick", 2, 0, "Canvas"); #endif +#if QT_CONFIG(quick_sprite) qmlRegisterType("QtQuick", 2, 0, "Sprite"); qmlRegisterType("QtQuick", 2, 0, "AnimatedSprite"); qmlRegisterType("QtQuick", 2, 0, "SpriteSequence"); +#endif qmlRegisterType(uri, major, minor,"ParentChange"); qmlRegisterType(uri, major, minor,"AnchorChanges"); diff --git a/src/quick/items/qquicksprite_p.h b/src/quick/items/qquicksprite_p.h index 684d432f39..d68a45ecc0 100644 --- a/src/quick/items/qquicksprite_p.h +++ b/src/quick/items/qquicksprite_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_sprite); + #include #include #include @@ -325,4 +329,5 @@ private: }; QT_END_NAMESPACE + #endif // QQUICKSPRITE_P_H diff --git a/src/quick/items/qquickspriteengine_p.h b/src/quick/items/qquickspriteengine_p.h index 485afc16e5..cf50cd2d84 100644 --- a/src/quick/items/qquickspriteengine_p.h +++ b/src/quick/items/qquickspriteengine_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_sprite); + #include #include #include diff --git a/src/quick/items/qquickspritesequence_p.h b/src/quick/items/qquickspritesequence_p.h index 34af110a98..b80a8348aa 100644 --- a/src/quick/items/qquickspritesequence_p.h +++ b/src/quick/items/qquickspritesequence_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_sprite); + #include #include diff --git a/src/quick/items/qquickspritesequence_p_p.h b/src/quick/items/qquickspritesequence_p_p.h index 4f352b5b69..3579833116 100644 --- a/src/quick/items/qquickspritesequence_p_p.h +++ b/src/quick/items/qquickspritesequence_p_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_sprite); + #include "qquickitem_p.h" #include "qquicksprite_p.h" diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp index 80112c1121..05d5daa686 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp @@ -47,7 +47,9 @@ #include "qsgsoftwarepublicnodes_p.h" #include "qsgsoftwarelayer_p.h" #include "qsgsoftwarerenderer_p.h" +#if QT_CONFIG(quick_sprite) #include "qsgsoftwarespritenode_p.h" +#endif #include #include @@ -184,10 +186,12 @@ QSGNinePatchNode *QSGSoftwareContext::createNinePatchNode() return new QSGSoftwareNinePatchNode; } +#if QT_CONFIG(quick_sprite) QSGSpriteNode *QSGSoftwareContext::createSpriteNode() { return new QSGSoftwareSpriteNode; } +#endif QSGRendererInterface::GraphicsApi QSGSoftwareContext::graphicsApi() const { diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h index dcc137b4b4..1f14717416 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h @@ -98,7 +98,9 @@ public: QSGRectangleNode *createRectangleNode() override; QSGImageNode *createImageNode() override; QSGNinePatchNode *createNinePatchNode() override; +#if QT_CONFIG(quick_sprite) QSGSpriteNode *createSpriteNode() override; +#endif GraphicsApi graphicsApi() const override; ShaderType shaderType() const override; diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp index 7b9e749532..59c47db0c4 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp @@ -45,7 +45,9 @@ #include "qsgsoftwarepublicnodes_p.h" #include "qsgsoftwarepainternode_p.h" #include "qsgsoftwarepixmaptexture_p.h" +#if QT_CONFIG(quick_sprite) #include "qsgsoftwarespritenode_p.h" +#endif #include #include @@ -91,9 +93,11 @@ QSGSoftwareRenderableNode::QSGSoftwareRenderableNode(NodeType type, QSGNode *nod case QSGSoftwareRenderableNode::SimpleImage: m_handle.simpleImageNode = static_cast(node); break; +#if QT_CONFIG(quick_sprite) case QSGSoftwareRenderableNode::SpriteNode: m_handle.spriteNode = static_cast(node); break; +#endif case QSGSoftwareRenderableNode::RenderNode: m_handle.renderNode = static_cast(node); break; @@ -182,10 +186,12 @@ void QSGSoftwareRenderableNode::update() boundingRect = m_handle.simpleImageNode->rect().toRect(); break; +#if QT_CONFIG(quick_sprite) case QSGSoftwareRenderableNode::SpriteNode: m_isOpaque = m_handle.spriteNode->isOpaque(); boundingRect = m_handle.spriteNode->rect().toRect(); break; +#endif case QSGSoftwareRenderableNode::RenderNode: if (m_handle.renderNode->flags().testFlag(QSGRenderNode::OpaqueRendering) && !m_transform.isRotating()) m_isOpaque = true; @@ -317,9 +323,11 @@ QRegion QSGSoftwareRenderableNode::renderNode(QPainter *painter, bool forceOpaqu case QSGSoftwareRenderableNode::SimpleImage: static_cast(m_handle.simpleImageNode)->paint(painter); break; +#if QT_CONFIG(quick_sprite) case QSGSoftwareRenderableNode::SpriteNode: static_cast(m_handle.spriteNode)->paint(painter); break; +#endif default: break; } diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h index 0626b1e657..473578c185 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode_p.h @@ -51,6 +51,8 @@ // We mean it. // +#include + #include #include #include @@ -84,7 +86,9 @@ public: NinePatch, SimpleRectangle, SimpleImage, +#if QT_CONFIG(quick_sprite) SpriteNode, +#endif RenderNode }; diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp index 12dbf63353..4937565aa9 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp @@ -181,6 +181,7 @@ void QSGSoftwareRenderableNodeUpdater::endVisit(QSGRootNode *) { } +#if QT_CONFIG(quick_sprite) bool QSGSoftwareRenderableNodeUpdater::visit(QSGSpriteNode *node) { return updateRenderableNode(QSGSoftwareRenderableNode::SpriteNode, node); @@ -190,6 +191,7 @@ void QSGSoftwareRenderableNodeUpdater::endVisit(QSGSpriteNode *) { } +#endif bool QSGSoftwareRenderableNodeUpdater::visit(QSGRenderNode *node) { diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater_p.h index f204867236..ca16f77c22 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater_p.h @@ -86,8 +86,10 @@ public: void endVisit(QSGGlyphNode *) override; bool visit(QSGRootNode *) override; void endVisit(QSGRootNode *) override; +#if QT_CONFIG(quick_sprite) bool visit(QSGSpriteNode *) override; void endVisit(QSGSpriteNode *) override; +#endif bool visit(QSGRenderNode *) override; void endVisit(QSGRenderNode *) override; diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderlistbuilder.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderlistbuilder.cpp index 4e34517dad..70dce71801 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderlistbuilder.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderlistbuilder.cpp @@ -141,6 +141,7 @@ void QSGSoftwareRenderListBuilder::endVisit(QSGRootNode *) { } +#if QT_CONFIG(quick_sprite) bool QSGSoftwareRenderListBuilder::visit(QSGSpriteNode *node) { return addRenderableNode(node); @@ -150,6 +151,7 @@ void QSGSoftwareRenderListBuilder::endVisit(QSGSpriteNode *) { } +#endif bool QSGSoftwareRenderListBuilder::visit(QSGRenderNode *node) { diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderlistbuilder_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderlistbuilder_p.h index 807cb7fdbe..f5db30269f 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderlistbuilder_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderlistbuilder_p.h @@ -80,8 +80,10 @@ public: void endVisit(QSGGlyphNode *) override; bool visit(QSGRootNode *) override; void endVisit(QSGRootNode *) override; +#if QT_CONFIG(quick_sprite) bool visit(QSGSpriteNode *) override; void endVisit(QSGSpriteNode *) override; +#endif bool visit(QSGRenderNode *) override; void endVisit(QSGRenderNode *) override; diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarespritenode_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwarespritenode_p.h index 284ed3dff5..577a30c051 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarespritenode_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarespritenode_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_sprite); + #include QT_BEGIN_NAMESPACE diff --git a/src/quick/scenegraph/adaptations/software/software.pri b/src/quick/scenegraph/adaptations/software/software.pri index 97644fc36a..de5f01cdee 100644 --- a/src/quick/scenegraph/adaptations/software/software.pri +++ b/src/quick/scenegraph/adaptations/software/software.pri @@ -19,7 +19,6 @@ SOURCES += \ $$PWD/qsgsoftwarerenderloop.cpp \ $$PWD/qsgsoftwarelayer.cpp \ $$PWD/qsgsoftwareadaptation.cpp \ - $$PWD/qsgsoftwarespritenode.cpp \ $$PWD/qsgsoftwarethreadedrenderloop.cpp HEADERS += \ @@ -39,5 +38,11 @@ HEADERS += \ $$PWD/qsgsoftwarerenderloop_p.h \ $$PWD/qsgsoftwarelayer_p.h \ $$PWD/qsgsoftwareadaptation_p.h \ - $$PWD/qsgsoftwarespritenode_p.h \ $$PWD/qsgsoftwarethreadedrenderloop_p.h + +qtConfig(quick-sprite) { + SOURCES += \ + $$PWD/qsgsoftwarespritenode.cpp + HEADERS += \ + $$PWD/qsgsoftwarespritenode_p.h +} diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h index a74b38dba8..5880c67af0 100644 --- a/src/quick/scenegraph/qsgadaptationlayer_p.h +++ b/src/quick/scenegraph/qsgadaptationlayer_p.h @@ -108,8 +108,10 @@ public: virtual void endVisit(QSGGlyphNode *) = 0; virtual bool visit(QSGRootNode *) = 0; virtual void endVisit(QSGRootNode *) = 0; +#if QT_CONFIG(quick_sprite) virtual bool visit(QSGSpriteNode *) = 0; virtual void endVisit(QSGSpriteNode *) = 0; +#endif virtual bool visit(QSGRenderNode *) = 0; virtual void endVisit(QSGRenderNode *) = 0; @@ -213,6 +215,8 @@ Q_SIGNALS: void scheduledUpdateCompleted(); }; +#if QT_CONFIG(quick_sprite) + class Q_QUICK_PRIVATE_EXPORT QSGSpriteNode : public QSGVisitableNode { public: @@ -230,6 +234,8 @@ public: virtual void accept(QSGNodeVisitorEx *visitor) { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); } }; +#endif + class Q_QUICK_PRIVATE_EXPORT QSGGuiThreadShaderEffectManager : public QObject { Q_OBJECT diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index 899278843e..6b9db105e7 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -178,7 +178,9 @@ public: virtual QSGGuiThreadShaderEffectManager *createGuiThreadShaderEffectManager(); virtual QSGShaderEffectNode *createShaderEffectNode(QSGRenderContext *renderContext, QSGGuiThreadShaderEffectManager *mgr); +#if QT_CONFIG(quick_sprite) virtual QSGSpriteNode *createSpriteNode() = 0; +#endif virtual QAnimationDriver *createAnimationDriver(QObject *parent); virtual QSize minimumFBOSize() const; diff --git a/src/quick/scenegraph/qsgdefaultcontext.cpp b/src/quick/scenegraph/qsgdefaultcontext.cpp index 6964b74dc8..405f1d86a4 100644 --- a/src/quick/scenegraph/qsgdefaultcontext.cpp +++ b/src/quick/scenegraph/qsgdefaultcontext.cpp @@ -52,7 +52,9 @@ #include #include #include +#if QT_CONFIG(quick_sprite) #include +#endif #include #include @@ -258,10 +260,12 @@ QSGNinePatchNode *QSGDefaultContext::createNinePatchNode() return new QSGDefaultNinePatchNode; } +#if QT_CONFIG(quick_sprite) QSGSpriteNode *QSGDefaultContext::createSpriteNode() { return new QSGDefaultSpriteNode; } +#endif QSGRendererInterface::GraphicsApi QSGDefaultContext::graphicsApi() const { diff --git a/src/quick/scenegraph/qsgdefaultcontext_p.h b/src/quick/scenegraph/qsgdefaultcontext_p.h index 88db5e1e9a..ab319502ef 100644 --- a/src/quick/scenegraph/qsgdefaultcontext_p.h +++ b/src/quick/scenegraph/qsgdefaultcontext_p.h @@ -76,7 +76,9 @@ public: QSGRectangleNode *createRectangleNode() override; QSGImageNode *createImageNode() override; QSGNinePatchNode *createNinePatchNode() override; +#if QT_CONFIG(quick_sprite) QSGSpriteNode *createSpriteNode() override; +#endif void setDistanceFieldEnabled(bool enabled); bool isDistanceFieldEnabled() const; diff --git a/src/quick/scenegraph/qsgdefaultspritenode_p.h b/src/quick/scenegraph/qsgdefaultspritenode_p.h index cb76bf8d83..78aa8cc0cf 100644 --- a/src/quick/scenegraph/qsgdefaultspritenode_p.h +++ b/src/quick/scenegraph/qsgdefaultspritenode_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_sprite); + #include QT_BEGIN_NAMESPACE diff --git a/src/quick/scenegraph/scenegraph.pri b/src/quick/scenegraph/scenegraph.pri index a659ca5e10..edf4aa08c5 100644 --- a/src/quick/scenegraph/scenegraph.pri +++ b/src/quick/scenegraph/scenegraph.pri @@ -113,7 +113,6 @@ qtConfig(opengl(es1|es2)?) { $$PWD/qsgdefaultinternalrectanglenode.cpp \ $$PWD/qsgdefaultrendercontext.cpp \ $$PWD/qsgdefaultcontext.cpp \ - $$PWD/qsgdefaultspritenode.cpp \ $$PWD/util/qsgdefaultpainternode.cpp \ $$PWD/util/qsgdefaultrectanglenode.cpp \ $$PWD/util/qsgdefaultimagenode.cpp \ @@ -129,7 +128,6 @@ qtConfig(opengl(es1|es2)?) { $$PWD/qsgdefaultglyphnode_p_p.h \ $$PWD/qsgdefaultinternalimagenode_p.h \ $$PWD/qsgdefaultinternalrectanglenode_p.h \ - $$PWD/qsgdefaultspritenode_p.h \ $$PWD/qsgdefaultrendercontext_p.h \ $$PWD/qsgdefaultcontext_p.h \ $$PWD/util/qsgdefaultpainternode_p.h \ @@ -139,6 +137,13 @@ qtConfig(opengl(es1|es2)?) { $$PWD/qsgdefaultlayer_p.h \ $$PWD/qsgthreadedrenderloop_p.h \ $$PWD/qsgwindowsrenderloop_p.h + + qtConfig(quick-sprite) { + SOURCES += \ + $$PWD/qsgdefaultspritenode.cpp + HEADERS += \ + $$PWD/qsgdefaultspritenode_p.h + } } # Built-in, non-plugin-based adaptations -- cgit v1.2.3 From 0f63a7d09605ca2ca8571edd4a27b3a035fd06a5 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 17 Aug 2016 10:56:30 +0200 Subject: Make shader effects configurable Change-Id: I4e7fd5e9781dec7ee6ed8807ca1a51c937f6f9f3 Reviewed-by: Oswald Buddenhagen Reviewed-by: Simon Hausmann --- src/quick/configure.json | 9 ++++ src/quick/designer/qquickdesignersupport.cpp | 3 ++ src/quick/items/items.pri | 54 ++++++++++++++---------- src/quick/items/qquickborderimage.cpp | 1 + src/quick/items/qquickframebufferobject.cpp | 2 + src/quick/items/qquickitem.cpp | 29 ++++++++++++- src/quick/items/qquickitem_p.h | 9 ++++ src/quick/items/qquickitemgrabresult.cpp | 4 ++ src/quick/items/qquickitemsmodule.cpp | 14 +++++- src/quick/items/qquickmousearea.cpp | 1 + src/quick/items/qquickopenglshadereffect_p.h | 4 ++ src/quick/items/qquickopenglshadereffectnode_p.h | 4 ++ src/quick/items/qquickpainteditem.cpp | 1 + src/quick/items/qquickrendercontrol.cpp | 4 +- src/quick/items/qquickshadereffect_p.h | 4 ++ src/quick/items/qquickshadereffectmesh_p.h | 4 ++ src/quick/items/qquickshadereffectsource_p.h | 4 ++ src/quick/scenegraph/qsgrenderloop.cpp | 4 +- src/quick/scenegraph/qsgthreadedrenderloop.cpp | 4 ++ src/quick/scenegraph/qsgwindowsrenderloop.cpp | 4 +- src/quick/util/qquickanimator.cpp | 3 +- src/quick/util/qquickanimator_p.h | 5 ++- src/quick/util/qquickanimatorjob.cpp | 8 +++- src/quick/util/qquickutilmodule.cpp | 2 +- 24 files changed, 147 insertions(+), 34 deletions(-) (limited to 'src/quick') diff --git a/src/quick/configure.json b/src/quick/configure.json index 5d76ef1e48..eb7119e6b2 100644 --- a/src/quick/configure.json +++ b/src/quick/configure.json @@ -14,6 +14,7 @@ "quick-listview": "boolean", "quick-path": "boolean", "quick-pathview": "boolean", + "quick-shadereffect": "boolean", "quick-sprite": "boolean" } }, @@ -79,6 +80,13 @@ "privateFeature" ] }, + "quick-shadereffect": { + "label": "ShaderEffect item", + "purpose": "Provides Shader effects in Qt Quick", + "output": [ + "privateFeature" + ] + }, "quick-sprite": { "label": "Sprite item", "purpose": "Provides the Qt Quick Sprite Item", @@ -99,6 +107,7 @@ "quick-listview", "quick-path", "quick-pathview", + "quick-shadereffect", "quick-sprite" ] } diff --git a/src/quick/designer/qquickdesignersupport.cpp b/src/quick/designer/qquickdesignersupport.cpp index 44be12bb78..3ff5a3ce96 100644 --- a/src/quick/designer/qquickdesignersupport.cpp +++ b/src/quick/designer/qquickdesignersupport.cpp @@ -40,7 +40,9 @@ #include "qquickdesignersupport_p.h" #include +#if QT_CONFIG(quick_shadereffect) #include +#endif #include #include #include @@ -51,6 +53,7 @@ #include #include #include +#include #include "qquickdesignerwindowmanager_p.h" diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri index c74770093f..297babb742 100644 --- a/src/quick/items/items.pri +++ b/src/quick/items/items.pri @@ -66,10 +66,6 @@ HEADERS += \ $$PWD/qquickscreen_p.h \ $$PWD/qquickwindowattached_p.h \ $$PWD/qquickwindowmodule_p.h \ - $$PWD/qquickshadereffectsource_p.h \ - $$PWD/qquickshadereffectmesh_p.h \ - $$PWD/qquickshadereffect_p.h \ - $$PWD/qquickgenericshadereffect_p.h \ $$PWD/qquickrendercontrol.h \ $$PWD/qquickrendercontrol_p.h \ $$PWD/qquickgraphicsinfo_p.h \ @@ -118,10 +114,6 @@ SOURCES += \ $$PWD/qquickwindowmodule.cpp \ $$PWD/qquickscreen.cpp \ $$PWD/qquickwindowattached.cpp \ - $$PWD/qquickshadereffectsource.cpp \ - $$PWD/qquickshadereffectmesh.cpp \ - $$PWD/qquickshadereffect.cpp \ - $$PWD/qquickgenericshadereffect.cpp \ $$PWD/qquickrendercontrol.cpp \ $$PWD/qquickgraphicsinfo.cpp \ $$PWD/qquickitemgrabresult.cpp @@ -156,6 +148,38 @@ qtConfig(quick-flipable) { $$PWD/qquickflipable.cpp } +qtConfig(quick-shadereffect) { + HEADERS += \ + $$PWD/qquickshadereffectsource_p.h \ + $$PWD/qquickshadereffectmesh_p.h \ + $$PWD/qquickshadereffect_p.h \ + $$PWD/qquickgenericshadereffect_p.h + SOURCES += \ + $$PWD/qquickshadereffectsource.cpp \ + $$PWD/qquickshadereffectmesh.cpp \ + $$PWD/qquickshadereffect.cpp \ + $$PWD/qquickgenericshadereffect.cpp + + qtConfig(opengl) { + SOURCES += \ + $$PWD/qquickopenglshadereffect.cpp \ + $$PWD/qquickopenglshadereffectnode.cpp + HEADERS += \ + $$PWD/qquickopenglshadereffect_p.h \ + $$PWD/qquickopenglshadereffectnode_p.h + + OTHER_FILES += \ + $$PWD/shaders/shadereffect.vert \ + $$PWD/shaders/shadereffect.frag \ + $$PWD/shaders/shadereffectfallback.vert \ + $$PWD/shaders/shadereffectfallback.frag \ + $$PWD/shaders/shadereffect_core.vert \ + $$PWD/shaders/shadereffect_core.frag \ + $$PWD/shaders/shadereffectfallback_core.vert \ + $$PWD/shaders/shadereffectfallback_core.frag + } +} + qtConfig(quick-sprite) { HEADERS += \ $$PWD/qquickspriteengine_p.h \ @@ -175,25 +199,11 @@ qtConfig(quick-sprite) { qtConfig(opengl(es1|es2)?) { SOURCES += \ $$PWD/qquickopenglinfo.cpp \ - $$PWD/qquickopenglshadereffect.cpp \ - $$PWD/qquickopenglshadereffectnode.cpp \ $$PWD/qquickframebufferobject.cpp HEADERS += \ $$PWD/qquickopenglinfo_p.h \ - $$PWD/qquickopenglshadereffect_p.h \ - $$PWD/qquickopenglshadereffectnode_p.h \ $$PWD/qquickframebufferobject.h - - OTHER_FILES += \ - $$PWD/shaders/shadereffect.vert \ - $$PWD/shaders/shadereffect.frag \ - $$PWD/shaders/shadereffectfallback.vert \ - $$PWD/shaders/shadereffectfallback.frag \ - $$PWD/shaders/shadereffect_core.vert \ - $$PWD/shaders/shadereffect_core.frag \ - $$PWD/shaders/shadereffectfallback_core.vert \ - $$PWD/shaders/shadereffectfallback_core.frag } RESOURCES += \ diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp index 2fb151b36f..67b99bfbc6 100644 --- a/src/quick/items/qquickborderimage.cpp +++ b/src/quick/items/qquickborderimage.cpp @@ -51,6 +51,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp index 857cd44b15..18a6a58467 100644 --- a/src/quick/items/qquickframebufferobject.cpp +++ b/src/quick/items/qquickframebufferobject.cpp @@ -42,6 +42,8 @@ #include #include #include +#include +#include #include #include diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index eaf26a5c9a..63d95f6032 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2344,7 +2344,9 @@ QQuickItem::~QQuickItem() if (d->extra.isAllocated()) { delete d->extra->contents; d->extra->contents = 0; +#if QT_CONFIG(quick_shadereffect) delete d->extra->layer; d->extra->layer = 0; +#endif } delete d->_anchors; d->_anchors = 0; @@ -4774,8 +4776,10 @@ void QQuickItem::classBegin() d->_stateGroup->classBegin(); if (d->_anchors) d->_anchors->classBegin(); +#if QT_CONFIG(quick_shadereffect) if (d->extra.isAllocated() && d->extra->layer) d->extra->layer->classBegin(); +#endif } /*! @@ -4795,8 +4799,10 @@ void QQuickItem::componentComplete() } if (d->extra.isAllocated()) { +#if QT_CONFIG(quick_shadereffect) if (d->extra->layer) d->extra->layer->componentComplete(); +#endif if (d->extra->keyHandler) d->extra->keyHandler->componentComplete(); @@ -4852,8 +4858,10 @@ QPointF QQuickItemPrivate::computeTransformOrigin() const void QQuickItemPrivate::transformChanged() { +#if QT_CONFIG(quick_shadereffect) if (extra.isAllocated() && extra->layer) extra->layer->updateMatrix(); +#endif } void QQuickItemPrivate::deliverKeyEvent(QKeyEvent *e) @@ -5235,8 +5243,10 @@ void QQuickItem::setZ(qreal v) emit zChanged(); +#if QT_CONFIG(quick_shadereffect) if (d->extra.isAllocated() && d->extra->layer) d->extra->layer->updateZ(); +#endif } /*! @@ -7647,9 +7657,13 @@ QDebug operator<<(QDebug debug, QQuickItem *item) bool QQuickItem::isTextureProvider() const { +#if QT_CONFIG(quick_shadereffect) Q_D(const QQuickItem); return d->extra.isAllocated() && d->extra->layer && d->extra->layer->effectSource() ? d->extra->layer->effectSource()->isTextureProvider() : false; +#else + return false; +#endif } /*! @@ -7663,9 +7677,13 @@ bool QQuickItem::isTextureProvider() const QSGTextureProvider *QQuickItem::textureProvider() const { +#if QT_CONFIG(quick_shadereffect) Q_D(const QQuickItem); return d->extra.isAllocated() && d->extra->layer && d->extra->layer->effectSource() ? d->extra->layer->effectSource()->textureProvider() : 0; +#else + return 0; +#endif } /*! @@ -7674,14 +7692,19 @@ QSGTextureProvider *QQuickItem::textureProvider() const */ QQuickItemLayer *QQuickItemPrivate::layer() const { +#if QT_CONFIG(quick_shadereffect) if (!extra.isAllocated() || !extra->layer) { extra.value().layer = new QQuickItemLayer(const_cast(q_func())); if (!componentComplete) extra->layer->classBegin(); } return extra->layer; +#else + return 0; +#endif } +#if QT_CONFIG(quick_shadereffect) QQuickItemLayer::QQuickItemLayer(QQuickItem *item) : m_item(item) , m_enabled(false) @@ -8169,12 +8192,16 @@ void QQuickItemLayer::updateMatrix() ld->extra.value().origin = QQuickItemPrivate::get(m_item)->origin(); ld->dirty(QQuickItemPrivate::Transform); } +#endif // quick_shadereffect QQuickItemPrivate::ExtraData::ExtraData() : z(0), scale(1), rotation(0), opacity(1), contents(0), screenAttached(0), layoutDirectionAttached(0), enterKeyAttached(0), - keyHandler(0), layer(0), + keyHandler(0), +#if QT_CONFIG(quick_shadereffect) + layer(0), +#endif effectRefCount(0), hideRefCount(0), opacityNode(0), clipNode(0), rootNode(0), acceptedMouseButtons(0), origin(QQuickItem::Center), diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index d1511285a9..3bb4b2835c 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -76,7 +76,9 @@ #include #include +#if QT_CONFIG(quick_shadereffect) #include +#endif QT_BEGIN_NAMESPACE @@ -135,6 +137,7 @@ public: QList items; }; +#if QT_CONFIG(quick_shadereffect) class QQuickItemLayer : public QObject, public QQuickItemChangeListener { @@ -236,6 +239,8 @@ private: QQuickShaderEffectSource::TextureMirroring m_textureMirroring; }; +#endif + class Q_QUICK_PRIVATE_EXPORT QQuickItemPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QQuickItem) @@ -338,7 +343,9 @@ public: QQuickLayoutMirroringAttached* layoutDirectionAttached; QQuickEnterKeyAttached *enterKeyAttached; QQuickItemKeyFilter *keyHandler; +#if QT_CONFIG(quick_shadereffect) mutable QQuickItemLayer *layer; +#endif #ifndef QT_NO_CURSOR QCursor cursor; #endif @@ -925,7 +932,9 @@ Q_DECLARE_TYPEINFO(QQuickItemPrivate::ChangeListener, Q_PRIMITIVE_TYPE); QT_END_NAMESPACE +#if QT_CONFIG(quick_shadereffect) QML_DECLARE_TYPE(QQuickItemLayer) +#endif QML_DECLARE_TYPE(QQuickKeysAttached) QML_DECLARE_TYPEINFO(QQuickKeysAttached, QML_HAS_ATTACHED_PROPERTIES) QML_DECLARE_TYPE(QQuickKeyNavigationAttached) diff --git a/src/quick/items/qquickitemgrabresult.cpp b/src/quick/items/qquickitemgrabresult.cpp index 0db5323863..1b0e1f07f6 100644 --- a/src/quick/items/qquickitemgrabresult.cpp +++ b/src/quick/items/qquickitemgrabresult.cpp @@ -37,17 +37,21 @@ ** ****************************************************************************/ +#include #include "qquickitemgrabresult.h" #include "qquickwindow.h" #include "qquickitem.h" +#if QT_CONFIG(quick_shadereffect) #include "qquickshadereffectsource_p.h" +#endif #include #include #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index ce9ddcd633..227da5cae3 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -79,7 +79,6 @@ #include "qquicktranslate_p.h" #include "qquickstateoperations_p.h" #include "qquickitemanimation_p.h" -#include //#include #if QT_CONFIG(quick_canvas) #include @@ -95,8 +94,11 @@ # include "qquickopenglinfo_p.h" #endif #include "qquickgraphicsinfo_p.h" +#if QT_CONFIG(quick_shadereffect) +#include #include "qquickshadereffect_p.h" #include "qquickshadereffectmesh_p.h" +#endif #include "qquickdrag_p.h" #include "qquickdroparea_p.h" #include "qquickmultipointtoucharea_p.h" @@ -204,7 +206,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(uri,2,2,"TextInput"); qmlRegisterType(uri,2,4,"TextInput"); qmlRegisterType(); +#if QT_CONFIG(quick_shadereffect) qmlRegisterType(); +#endif qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); @@ -233,10 +237,12 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(uri,major,minor,"Pinch"); qmlRegisterType(); +#if QT_CONFIG(quick_shadereffect) qmlRegisterType("QtQuick", 2, 0, "ShaderEffectSource"); qmlRegisterUncreatableType("QtQuick", 2, 0, "ShaderEffectMesh", QQuickShaderEffectMesh::tr("Cannot create instance of abstract class ShaderEffectMesh.")); qmlRegisterType("QtQuick", 2, 0, "GridMesh"); qmlRegisterType("QtQuick", 2, 0, "ShaderEffect"); +#endif qmlRegisterUncreatableType("QtQuick", 2, 0, "PaintedItem", QQuickPaintedItem::tr("Cannot create instance of abstract class PaintedItem")); @@ -297,7 +303,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(uri, 2, 4, "ListView"); #endif qmlRegisterType(uri, 2, 4, "MouseArea"); +#if QT_CONFIG(quick_shadereffect) qmlRegisterType(uri, 2, 4, "ShaderEffect"); +#endif #ifndef QT_NO_OPENGL qmlRegisterUncreatableType(uri, 2, 4,"OpenGLInfo", QQuickOpenGLInfo::tr("OpenGLInfo is only available via attached properties")); @@ -317,7 +325,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(uri, 2, 6, "Flow"); qmlRegisterUncreatableType(uri, 2, 6, "EnterKey", QQuickEnterKeyAttached::tr("EnterKey is only available via attached properties")); +#if QT_CONFIG(quick_shadereffect) qmlRegisterType(uri, 2, 6, "ShaderEffectSource"); +#endif #if QT_CONFIG(quick_listview) qmlRegisterType(uri, 2, 7, "ListView"); @@ -332,7 +342,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterUncreatableType(uri, 2, 7, nullptr, QQuickMouseEvent::tr("MouseEvent is only available within handlers in MouseArea")); qmlRegisterUncreatableType(uri, 2, 8,"GraphicsInfo", QQuickGraphicsInfo::tr("GraphicsInfo is only available via attached properties")); +#if QT_CONFIG(quick_shadereffect) qmlRegisterType("QtQuick", 2, 8, "BorderImageMesh"); +#endif } static void initResources() diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index 0118d882af..b377390535 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -43,6 +43,7 @@ #include "qquickdrag_p.h" #include +#include #include #include diff --git a/src/quick/items/qquickopenglshadereffect_p.h b/src/quick/items/qquickopenglshadereffect_p.h index ed56a76409..64e79a9343 100644 --- a/src/quick/items/qquickopenglshadereffect_p.h +++ b/src/quick/items/qquickopenglshadereffect_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_shadereffect); + #include #include diff --git a/src/quick/items/qquickopenglshadereffectnode_p.h b/src/quick/items/qquickopenglshadereffectnode_p.h index 5abe3ae3d0..aea28e6612 100644 --- a/src/quick/items/qquickopenglshadereffectnode_p.h +++ b/src/quick/items/qquickopenglshadereffectnode_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_shadereffect); + #include #include #include diff --git a/src/quick/items/qquickpainteditem.cpp b/src/quick/items/qquickpainteditem.cpp index d21eb93dbf..1ef8de753d 100644 --- a/src/quick/items/qquickpainteditem.cpp +++ b/src/quick/items/qquickpainteditem.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp index 8b69447002..74aa2da9e0 100644 --- a/src/quick/items/qquickrendercontrol.cpp +++ b/src/quick/items/qquickrendercontrol.cpp @@ -47,8 +47,10 @@ #ifndef QT_NO_OPENGL # include # include +#if QT_CONFIG(quick_shadereffect) # include #endif +#endif #include #include @@ -190,7 +192,7 @@ void QQuickRenderControlPrivate::windowDestroyed() delete QQuickWindowPrivate::get(window)->animationController; QQuickWindowPrivate::get(window)->animationController = 0; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache(); #endif diff --git a/src/quick/items/qquickshadereffect_p.h b/src/quick/items/qquickshadereffect_p.h index 17b009039a..2b7ff4cf6e 100644 --- a/src/quick/items/qquickshadereffect_p.h +++ b/src/quick/items/qquickshadereffect_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_shadereffect); + #include #include diff --git a/src/quick/items/qquickshadereffectmesh_p.h b/src/quick/items/qquickshadereffectmesh_p.h index c5f1d19866..cbf33b795f 100644 --- a/src/quick/items/qquickshadereffectmesh_p.h +++ b/src/quick/items/qquickshadereffectmesh_p.h @@ -37,6 +37,10 @@ ** ****************************************************************************/ +#include + +QT_REQUIRE_CONFIG(quick_shadereffect); + #include "qqmlparserstatus.h" #include diff --git a/src/quick/items/qquickshadereffectsource_p.h b/src/quick/items/qquickshadereffectsource_p.h index ee18bf195a..5e7e354feb 100644 --- a/src/quick/items/qquickshadereffectsource_p.h +++ b/src/quick/items/qquickshadereffectsource_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_shadereffect); + #include "qquickitem.h" #include #include diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index e99e8dfe2e..df7bbe6ceb 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -61,8 +61,10 @@ #ifndef QT_NO_OPENGL # include # include +#if QT_CONFIG(quick_shadereffect) # include #endif +#endif #ifdef Q_OS_WIN # include @@ -326,7 +328,7 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window) if (Q_UNLIKELY(!current)) qCDebug(QSG_LOG_RENDERLOOP) << "cleanup without an OpenGL context"; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache(); #endif diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 6b9c67b2bd..693012154e 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -63,7 +63,9 @@ #include #include +#if QT_CONFIG(quick_shadereffect) #include +#endif #include /* @@ -487,7 +489,9 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor, QQuickWindowPrivate *dd = QQuickWindowPrivate::get(window); +#if QT_CONFIG(quick_shadereffect) QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache(); +#endif // The canvas nodes must be cleaned up regardless if we are in the destructor.. if (wipeSG) { diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp index 743e524a36..941a7b3f3c 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp +++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp @@ -55,7 +55,7 @@ #include #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) #include #endif @@ -245,7 +245,7 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window) if (Q_UNLIKELY(!current)) qCDebug(QSG_LOG_RENDERLOOP) << "cleanup without an OpenGL context"; -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache(); #endif diff --git a/src/quick/util/qquickanimator.cpp b/src/quick/util/qquickanimator.cpp index 100b7bd402..5d2af0f940 100644 --- a/src/quick/util/qquickanimator.cpp +++ b/src/quick/util/qquickanimator.cpp @@ -502,7 +502,8 @@ QQuickRotationAnimator::RotationDirection QQuickRotationAnimator::direction() co Q_D(const QQuickRotationAnimator); return d->direction; } -#ifndef QT_NO_OPENGL + +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) /*! \qmltype UniformAnimator \instantiates QQuickUniformAnimator diff --git a/src/quick/util/qquickanimator_p.h b/src/quick/util/qquickanimator_p.h index f1e2d4e1d9..0fc900c5ac 100644 --- a/src/quick/util/qquickanimator_p.h +++ b/src/quick/util/qquickanimator_p.h @@ -169,7 +169,8 @@ protected: QQuickAnimatorJob *createJob() const; QString propertyName() const { return QStringLiteral("rotation"); } }; -#ifndef QT_NO_OPENGL + +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) class QQuickUniformAnimatorPrivate; class Q_QUICK_PRIVATE_EXPORT QQuickUniformAnimator : public QQuickAnimator { @@ -200,7 +201,7 @@ QML_DECLARE_TYPE(QQuickYAnimator) QML_DECLARE_TYPE(QQuickScaleAnimator) QML_DECLARE_TYPE(QQuickRotationAnimator) QML_DECLARE_TYPE(QQuickOpacityAnimator) -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) QML_DECLARE_TYPE(QQuickUniformAnimator) #endif #endif // QQUICKANIMATOR_P_H diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp index a0c787dae5..1176cf1ff7 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -43,7 +43,7 @@ #include "qquickanimator_p_p.h" #include #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) # include # include #endif @@ -329,11 +329,13 @@ void QQuickTransformAnimatorJob::Helper::sync() | QQuickItemPrivate::Size; QQuickItemPrivate *d = QQuickItemPrivate::get(item); +#if QT_CONFIG(quick_shadereffect) if (d->extra.isAllocated() && d->extra->layer && d->extra->layer->enabled()) { d = QQuickItemPrivate::get(d->extra->layer->m_effectSource); } +#endif quint32 dirty = mask & d->dirtyAttributes; @@ -423,11 +425,13 @@ void QQuickOpacityAnimatorJob::initialize(QQuickAnimatorController *controller) { QQuickAnimatorJob::initialize(controller); QQuickItemPrivate *d = QQuickItemPrivate::get(m_target); +#if QT_CONFIG(quick_shadereffect) if (d->extra.isAllocated() && d->extra->layer && d->extra->layer->enabled()) { d = QQuickItemPrivate::get(d->extra->layer->m_effectSource); } +#endif m_opacityNode = d->opacityNode(); if (!m_opacityNode) { @@ -543,7 +547,7 @@ void QQuickRotationAnimatorJob::writeBack() m_target->setRotation(value()); } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) QQuickUniformAnimatorJob::QQuickUniformAnimatorJob() : m_node(0) , m_uniformIndex(-1) diff --git a/src/quick/util/qquickutilmodule.cpp b/src/quick/util/qquickutilmodule.cpp index 66994e22ba..7e2973a78b 100644 --- a/src/quick/util/qquickutilmodule.cpp +++ b/src/quick/util/qquickutilmodule.cpp @@ -107,7 +107,7 @@ void QQuickUtilModule::defineModule() qmlRegisterType("QtQuick", 2, 2, "ScaleAnimator"); qmlRegisterType("QtQuick", 2, 2, "RotationAnimator"); qmlRegisterType("QtQuick", 2, 2, "OpacityAnimator"); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) qmlRegisterType("QtQuick", 2, 2, "UniformAnimator"); #endif qmlRegisterType(); -- cgit v1.2.3 From b9447812542a4315718cd0fad9a9fb10a25e114a Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 17 Aug 2016 14:12:06 +0200 Subject: Make itemviews and positioners configurable Change-Id: Ia26cbbdb2b2a0ed74398bfad7689db7289ad8c6a Reviewed-by: Oswald Buddenhagen Reviewed-by: Simon Hausmann --- src/quick/configure.json | 25 +++++++++++++++++++++++++ src/quick/items/items.pri | 31 +++++++++++++++++++++++-------- src/quick/items/qquickgridview_p.h | 5 ++++- src/quick/items/qquickitemsmodule.cpp | 28 +++++++++++++++++++++++----- src/quick/items/qquickitemview_p.h | 4 ++++ src/quick/items/qquickitemview_p_p.h | 4 ++++ src/quick/items/qquickpositioners_p.h | 4 ++++ src/quick/items/qquickpositioners_p_p.h | 4 ++++ 8 files changed, 91 insertions(+), 14 deletions(-) (limited to 'src/quick') diff --git a/src/quick/configure.json b/src/quick/configure.json index eb7119e6b2..87da6d3344 100644 --- a/src/quick/configure.json +++ b/src/quick/configure.json @@ -11,9 +11,11 @@ "quick-animatedimage": "boolean", "quick-canvas": "boolean", "quick-flipable": "boolean", + "quick-gridview": "boolean", "quick-listview": "boolean", "quick-path": "boolean", "quick-pathview": "boolean", + "quick-positioners": "boolean", "quick-shadereffect": "boolean", "quick-sprite": "boolean" } @@ -58,6 +60,20 @@ "privateFeature" ] }, + "quick-gridview": { + "label": "GridView item", + "purpose": "Provides the Qt Quick GridView item", + "output": [ + "privateFeature" + ] + }, + "quick-itemview": { + "label": "ItemView item", + "condition": "features.quick-gridview || features.quick-listview", + "output": [ + "privateFeature" + ] + }, "quick-listview": { "label": "ListView item", "purpose": "Provides the Qt Quick ListView item", @@ -80,6 +96,13 @@ "privateFeature" ] }, + "quick-positioners": { + "label": "Positioner items", + "purpose": "Provides Positioner items in Qt Quick", + "output": [ + "privateFeature" + ] + }, "quick-shadereffect": { "label": "ShaderEffect item", "purpose": "Provides Shader effects in Qt Quick", @@ -104,9 +127,11 @@ "quick-animatedimage", "quick-canvas", "quick-flipable", + "quick-gridview", "quick-listview", "quick-path", "quick-pathview", + "quick-positioners", "quick-shadereffect", "quick-sprite" ] diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri index 297babb742..37f3a138ad 100644 --- a/src/quick/items/items.pri +++ b/src/quick/items/items.pri @@ -43,9 +43,6 @@ HEADERS += \ $$PWD/qquickflickablebehavior_p.h \ $$PWD/qquickrepeater_p.h \ $$PWD/qquickrepeater_p_p.h \ - $$PWD/qquickgridview_p.h \ - $$PWD/qquickpositioners_p.h \ - $$PWD/qquickpositioners_p_p.h \ $$PWD/qquickloader_p.h \ $$PWD/qquickloader_p_p.h \ $$PWD/qquicktranslate_p.h \ @@ -60,8 +57,6 @@ HEADERS += \ $$PWD/qquickdrag_p.h \ $$PWD/qquickdroparea_p.h \ $$PWD/qquickmultipointtoucharea_p.h \ - $$PWD/qquickitemview_p.h \ - $$PWD/qquickitemview_p_p.h \ $$PWD/qquickitemviewtransition_p.h \ $$PWD/qquickscreen_p.h \ $$PWD/qquickwindowattached_p.h \ @@ -96,8 +91,6 @@ SOURCES += \ $$PWD/qquickpincharea.cpp \ $$PWD/qquickflickable.cpp \ $$PWD/qquickrepeater.cpp \ - $$PWD/qquickgridview.cpp \ - $$PWD/qquickpositioners.cpp \ $$PWD/qquickloader.cpp \ $$PWD/qquicktranslate.cpp \ $$PWD/qquickclipnode.cpp \ @@ -109,7 +102,6 @@ SOURCES += \ $$PWD/qquickdrag.cpp \ $$PWD/qquickdroparea.cpp \ $$PWD/qquickmultipointtoucharea.cpp \ - $$PWD/qquickitemview.cpp \ $$PWD/qquickitemviewtransition.cpp \ $$PWD/qquickwindowmodule.cpp \ $$PWD/qquickscreen.cpp \ @@ -126,6 +118,21 @@ qtConfig(quick-animatedimage) { $$PWD/qquickanimatedimage.cpp } +qtConfig(quick-gridview) { + HEADERS += \ + $$PWD/qquickgridview_p.h + SOURCES += \ + $$PWD/qquickgridview.cpp +} + +qtConfig(quick-itemview) { + HEADERS += \ + $$PWD/qquickitemview_p.h \ + $$PWD/qquickitemview_p_p.h + SOURCES += \ + $$PWD/qquickitemview.cpp +} + qtConfig(quick-listview) { HEADERS += \ $$PWD/qquicklistview_p.h @@ -141,6 +148,14 @@ qtConfig(quick-pathview) { $$PWD/qquickpathview.cpp } +qtConfig(quick-positioners) { + HEADERS += \ + $$PWD/qquickpositioners_p.h \ + $$PWD/qquickpositioners_p_p.h + SOURCES += \ + $$PWD/qquickpositioners.cpp +} + qtConfig(quick-flipable) { HEADERS += \ $$PWD/qquickflipable_p.h diff --git a/src/quick/items/qquickgridview_p.h b/src/quick/items/qquickgridview_p.h index 44bc8444f2..aaf6e4a75b 100644 --- a/src/quick/items/qquickgridview_p.h +++ b/src/quick/items/qquickgridview_p.h @@ -51,8 +51,11 @@ // We mean it. // -#include "qquickitemview_p.h" +#include + +QT_REQUIRE_CONFIG(quick_gridview); +#include "qquickitemview_p.h" QT_BEGIN_NAMESPACE diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index 227da5cae3..51ce18b23e 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -58,7 +58,9 @@ #if QT_CONFIG(quick_listview) #include "qquicklistview_p.h" #endif +#if QT_CONFIG(quick_gridview) #include "qquickgridview_p.h" +#endif #if QT_CONFIG(quick_pathview) #include "qquickpathview_p.h" #endif @@ -67,7 +69,9 @@ #include #include #endif +#if QT_CONFIG(quick_positioners) #include "qquickpositioners_p.h" +#endif #include "qquickrepeater_p.h" #include "qquickloader_p.h" #if QT_CONFIG(quick_animatedimage) @@ -156,18 +160,25 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(uri,major,minor,"AnimatedImage"); #endif qmlRegisterType(uri,major,minor,"BorderImage"); - qmlRegisterType(uri,major,minor,"Column"); qmlRegisterType(uri,major,minor,"Flickable"); #if QT_CONFIG(quick_flipable) qmlRegisterType(uri,major,minor,"Flipable"); #endif - qmlRegisterType(uri,major,minor,"Flow"); // qmlRegisterType(uri,major,minor,"FocusPanel"); qmlRegisterType(uri,major,minor,"FocusScope"); qmlRegisterType(uri,major,minor,"Gradient"); qmlRegisterType(uri,major,minor,"GradientStop"); +#if QT_CONFIG(quick_positioners) + qmlRegisterType(uri,major,minor,"Column"); + qmlRegisterType(uri,major,minor,"Flow"); qmlRegisterType(uri,major,minor,"Grid"); + qmlRegisterUncreatableType(uri,major,minor,"Positioner", + QStringLiteral("Positioner is an abstract type that is only available as an attached property.")); + qmlRegisterType(uri,major,minor,"Row"); +#endif +#if QT_CONFIG(quick_gridview) qmlRegisterType(uri,major,minor,"GridView"); +#endif qmlRegisterType(uri,major,minor,"Image"); qmlRegisterType(uri,major,minor,"Item"); #if QT_CONFIG(quick_listview) @@ -190,11 +201,8 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) #if QT_CONFIG(quick_pathview) qmlRegisterType(uri,major,minor,"PathView"); #endif - qmlRegisterUncreatableType(uri,major,minor,"Positioner", - QStringLiteral("Positioner is an abstract type that is only available as an attached property.")); qmlRegisterType(uri,major,minor,"Rectangle"); qmlRegisterType(uri,major,minor,"Repeater"); - qmlRegisterType(uri,major,minor,"Row"); qmlRegisterType(uri,major,minor,"Translate"); qmlRegisterType(uri,major,minor,"Rotation"); qmlRegisterType(uri,major,minor,"Scale"); @@ -282,13 +290,19 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) #endif qmlRegisterType(uri, 2, 1,"Item"); +#if QT_CONFIG(quick_positioners) qmlRegisterType(uri, 2, 1, "Grid"); +#endif +#if QT_CONFIG(quick_itemview) qmlRegisterUncreatableType(uri, 2, 1, "ItemView", QQuickItemView::tr("ItemView is an abstract base class")); qmlRegisterUncreatableType(uri, 2, 3, "ItemView", QQuickItemView::tr("ItemView is an abstract base class")); +#endif #if QT_CONFIG(quick_listview) qmlRegisterType(uri, 2, 1, "ListView"); #endif +#if QT_CONFIG(quick_gridview) qmlRegisterType(uri, 2, 1, "GridView"); +#endif qmlRegisterType(uri, 2, 1, "TextEdit"); qmlRegisterType(uri, 2, 2, "Text"); @@ -317,12 +331,14 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(uri, 2, 6, "Text"); qmlRegisterType(uri, 2, 6, "TextEdit"); qmlRegisterType(uri, 2, 6, "TextInput"); +#if QT_CONFIG(quick_positioners) qmlRegisterUncreatableType(uri, 2, 6, "Positioner", QStringLiteral("Positioner is an abstract type that is only available as an attached property.")); qmlRegisterType(uri, 2, 6, "Column"); qmlRegisterType(uri, 2, 6, "Row"); qmlRegisterType(uri, 2, 6, "Grid"); qmlRegisterType(uri, 2, 6, "Flow"); +#endif qmlRegisterUncreatableType(uri, 2, 6, "EnterKey", QQuickEnterKeyAttached::tr("EnterKey is only available via attached properties")); #if QT_CONFIG(quick_shadereffect) @@ -332,7 +348,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) #if QT_CONFIG(quick_listview) qmlRegisterType(uri, 2, 7, "ListView"); #endif +#if QT_CONFIG(quick_gridview) qmlRegisterType(uri, 2, 7, "GridView"); +#endif qmlRegisterType(uri, 2, 7, "TextInput"); qmlRegisterType(uri, 2, 7, "TextEdit"); #if QT_CONFIG(quick_pathview) diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h index 1a28fc212b..c289ace408 100644 --- a/src/quick/items/qquickitemview_p.h +++ b/src/quick/items/qquickitemview_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_itemview); + #include "qquickflickable_p.h" #include #include diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h index 0893d6e749..62851c9a89 100644 --- a/src/quick/items/qquickitemview_p_p.h +++ b/src/quick/items/qquickitemview_p_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_itemview); + #include "qquickitemview_p.h" #include "qquickitemviewtransition_p.h" #include "qquickflickable_p_p.h" diff --git a/src/quick/items/qquickpositioners_p.h b/src/quick/items/qquickpositioners_p.h index f6388f111d..c25ecd6dbc 100644 --- a/src/quick/items/qquickpositioners_p.h +++ b/src/quick/items/qquickpositioners_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_positioners); + #include "qquickimplicitsizeitem_p.h" #include "qquickitemviewtransition_p.h" diff --git a/src/quick/items/qquickpositioners_p_p.h b/src/quick/items/qquickpositioners_p_p.h index d18f9b3724..6dd84e6098 100644 --- a/src/quick/items/qquickpositioners_p_p.h +++ b/src/quick/items/qquickpositioners_p_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_positioners); + #include "qquickpositioners_p.h" #include "qquickimplicitsizeitem_p_p.h" -- cgit v1.2.3 From aa98a543cfb0e542a8a3e8416eb04cbae6e0e7c1 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 17 Aug 2016 14:20:45 +0200 Subject: Don't build view transitions if nobody uses them Change-Id: I162d2ff5e34aecf63f78c3ca49b99a84986c24ed Reviewed-by: Oswald Buddenhagen Reviewed-by: Simon Hausmann --- src/quick/configure.json | 7 +++++++ src/quick/items/items.pri | 9 +++++++-- src/quick/items/qquickitemsmodule.cpp | 4 ++++ src/quick/items/qquickitemviewtransition_p.h | 3 +++ 4 files changed, 21 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/configure.json b/src/quick/configure.json index 87da6d3344..21617c4fea 100644 --- a/src/quick/configure.json +++ b/src/quick/configure.json @@ -74,6 +74,13 @@ "privateFeature" ] }, + "quick-viewtransitions": { + "label": "Transitions required for ItemViews and Positioners", + "condition": "features.quick-itemview || features.quick-positioners", + "output": [ + "privateFeature" + ] + }, "quick-listview": { "label": "ListView item", "purpose": "Provides the Qt Quick ListView item", diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri index 37f3a138ad..0f8061b5ef 100644 --- a/src/quick/items/items.pri +++ b/src/quick/items/items.pri @@ -57,7 +57,6 @@ HEADERS += \ $$PWD/qquickdrag_p.h \ $$PWD/qquickdroparea_p.h \ $$PWD/qquickmultipointtoucharea_p.h \ - $$PWD/qquickitemviewtransition_p.h \ $$PWD/qquickscreen_p.h \ $$PWD/qquickwindowattached_p.h \ $$PWD/qquickwindowmodule_p.h \ @@ -102,7 +101,6 @@ SOURCES += \ $$PWD/qquickdrag.cpp \ $$PWD/qquickdroparea.cpp \ $$PWD/qquickmultipointtoucharea.cpp \ - $$PWD/qquickitemviewtransition.cpp \ $$PWD/qquickwindowmodule.cpp \ $$PWD/qquickscreen.cpp \ $$PWD/qquickwindowattached.cpp \ @@ -133,6 +131,13 @@ qtConfig(quick-itemview) { $$PWD/qquickitemview.cpp } +qtConfig(quick-viewtransitions) { + HEADERS += \ + $$PWD/qquickitemviewtransition_p.h + SOURCES += \ + $$PWD/qquickitemviewtransition.cpp +} + qtConfig(quick-listview) { HEADERS += \ $$PWD/qquicklistview_p.h diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index 51ce18b23e..944f24c4ad 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -64,7 +64,9 @@ #if QT_CONFIG(quick_pathview) #include "qquickpathview_p.h" #endif +#if QT_CONFIG(quick_viewtransitions) #include "qquickitemviewtransition_p.h" +#endif #if QT_CONFIG(quick_path) #include #include @@ -239,7 +241,9 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterUncreatableType(uri,major,minor,"KeyNavigation",QQuickKeyNavigationAttached::tr("KeyNavigation is only available via attached properties")); qmlRegisterUncreatableType(uri,major,minor,"Keys",QQuickKeysAttached::tr("Keys is only available via attached properties")); qmlRegisterUncreatableType(uri,major,minor,"LayoutMirroring", QQuickLayoutMirroringAttached::tr("LayoutMirroring is only available via attached properties")); +#if QT_CONFIG(quick_viewtransitions) qmlRegisterUncreatableType(uri,major,minor,"ViewTransition",QQuickViewTransitionAttached::tr("ViewTransition is only available via attached properties")); +#endif qmlRegisterType(uri,major,minor,"PinchArea"); qmlRegisterType(uri,major,minor,"Pinch"); diff --git a/src/quick/items/qquickitemviewtransition_p.h b/src/quick/items/qquickitemviewtransition_p.h index 6641dada29..ff0e82ac7b 100644 --- a/src/quick/items/qquickitemviewtransition_p.h +++ b/src/quick/items/qquickitemviewtransition_p.h @@ -52,6 +52,9 @@ // #include + +QT_REQUIRE_CONFIG(quick_viewtransitions); + #include #include #include -- cgit v1.2.3 From bae22adafc3a6f5ff7f920e71c1542dc25cf1bab Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 17 Aug 2016 14:34:51 +0200 Subject: Make the designer support configurable Change-Id: I2c6cb57fbd6add3afe465dcc02c651ee9e96fbc7 Reviewed-by: Oswald Buddenhagen Reviewed-by: Simon Hausmann --- src/quick/configure.json | 9 +++++++++ src/quick/quick.pro | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/configure.json b/src/quick/configure.json index 21617c4fea..3dbf653079 100644 --- a/src/quick/configure.json +++ b/src/quick/configure.json @@ -10,6 +10,7 @@ "d3d12": "boolean", "quick-animatedimage": "boolean", "quick-canvas": "boolean", + "quick-designer": "boolean", "quick-flipable": "boolean", "quick-gridview": "boolean", "quick-listview": "boolean", @@ -53,6 +54,13 @@ "privateFeature" ] }, + "quick-designer": { + "label": "Support for Quick Designer", + "purpose": "Provides support for the Qt Quick Designer in Qt Creator", + "output": [ + "privateFeature" + ] + }, "quick-flipable": { "label": "Flipable item", "purpose": "Provides the Qt Quick Flipable Item", @@ -133,6 +141,7 @@ "d3d12", "quick-animatedimage", "quick-canvas", + "quick-designer", "quick-flipable", "quick-gridview", "quick-listview", diff --git a/src/quick/quick.pro b/src/quick/quick.pro index 094791574f..8f4f9a8290 100644 --- a/src/quick/quick.pro +++ b/src/quick/quick.pro @@ -28,7 +28,8 @@ ANDROID_BUNDLED_FILES += \ include(util/util.pri) include(scenegraph/scenegraph.pri) include(items/items.pri) -include(designer/designer.pri) +qtConfig(quick-designer): \ + include(designer/designer.pri) qtConfig(accessibility) { include(accessible/accessible.pri) } -- cgit v1.2.3 From e27fa6e2b5376e68926bd5bdf70cdb0feba6e09e Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 11 Oct 2016 13:23:05 +0200 Subject: Use d3d12 feature in rendernode example Migrate the example away from config_d3d12 and make the feature public. Task-number: QTBUG-56327 Change-Id: I88809b8c41282cd75952d085cfd539a5d80f3f38 Reviewed-by: Lars Knoll --- src/quick/configure.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/configure.json b/src/quick/configure.json index 3dbf653079..373b383a06 100644 --- a/src/quick/configure.json +++ b/src/quick/configure.json @@ -36,7 +36,7 @@ "purpose": "Provides a Direct3D 12 backend for the Qt Quick Scenegraph", "condition": "tests.d3d12", "output": [ - "privateFeature" + "publicFeature" ] }, "quick-animatedimage": { -- cgit v1.2.3 From 6df6c10e1af827d06a387e7422176dd310cf83be Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 7 Oct 2016 09:57:01 +0200 Subject: Fix enums in QSGGeometry Minor fixes based on comments from the 5.8 API changes review: Revert to using Qt-style enum values (POSITION -> PositionAttribute). Use ByteType, FloatType, etc. instead of TypeByte, TypeFloat, ... Add comments about magic GL values. Add missing docs for Attribute::createWithAttributeType(). Change-Id: I1b8242efd3936f000ce8df6c11ff9ab7affb5713 Reviewed-by: Gunnar Sletta Reviewed-by: Shawn Rutledge --- src/quick/items/qquickshadereffectmesh.cpp | 2 +- src/quick/scenegraph/coreapi/qsggeometry.cpp | 73 ++++++++----- src/quick/scenegraph/coreapi/qsggeometry.h | 117 +++++++++++---------- src/quick/scenegraph/coreapi/qsgnode.cpp | 2 +- src/quick/scenegraph/qsgbasicinternalimagenode.cpp | 10 +- .../scenegraph/qsgbasicinternalrectanglenode.cpp | 6 +- src/quick/scenegraph/qsgdefaultspritenode.cpp | 4 +- 7 files changed, 117 insertions(+), 97 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickshadereffectmesh.cpp b/src/quick/items/qquickshadereffectmesh.cpp index 8616bf8022..b572feb5ee 100644 --- a/src/quick/items/qquickshadereffectmesh.cpp +++ b/src/quick/items/qquickshadereffectmesh.cpp @@ -140,7 +140,7 @@ QSGGeometry *QQuickGridMesh::updateGeometry(QSGGeometry *geometry, int attrCount ? QSGGeometry::defaultAttributes_Point2D() : QSGGeometry::defaultAttributes_TexturedPoint2D(), (vmesh + 1) * (hmesh + 1), vmesh * 2 * (hmesh + 2), - QSGGeometry::TypeUnsignedShort); + QSGGeometry::UnsignedShortType); } else { geometry->allocate((vmesh + 1) * (hmesh + 1), vmesh * 2 * (hmesh + 2)); diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index 239557d527..b43a2bc2ba 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -54,18 +54,18 @@ QT_BEGIN_NAMESPACE QSGGeometry::Attribute QSGGeometry::Attribute::create(int attributeIndex, int tupleSize, int primitiveType, bool isPrimitive) { - Attribute a = { attributeIndex, tupleSize, primitiveType, isPrimitive, UNKNOWN, 0 }; + Attribute a = { attributeIndex, tupleSize, primitiveType, isPrimitive, UnknownAttribute, 0 }; return a; } -QSGGeometry::Attribute QSGGeometry::Attribute::createWithSemantic(int pos, int tupleSize, int type, Semantic semantic) +QSGGeometry::Attribute QSGGeometry::Attribute::createWithAttributeType(int pos, int tupleSize, int primitiveType, AttributeType attributeType) { Attribute a; a.position = pos; a.tupleSize = tupleSize; - a.type = type; - a.isVertexCoordinate = semantic == POSITION; - a.semantic = semantic; + a.type = primitiveType; + a.isVertexCoordinate = attributeType == PositionAttribute; + a.attributeType = attributeType; a.reserved = 0; return a; } @@ -78,7 +78,7 @@ QSGGeometry::Attribute QSGGeometry::Attribute::createWithSemantic(int pos, int t const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_Point2D() { static Attribute data[] = { - Attribute::createWithSemantic(0, 2, TypeFloat, Attribute::POSITION) + Attribute::createWithAttributeType(0, 2, FloatType, PositionAttribute) }; static AttributeSet attrs = { 1, sizeof(float) * 2, data }; return attrs; @@ -91,8 +91,8 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_Point2D() const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_TexturedPoint2D() { static Attribute data[] = { - Attribute::createWithSemantic(0, 2, TypeFloat, Attribute::POSITION), - Attribute::createWithSemantic(1, 2, TypeFloat, Attribute::TEXCOORD) + Attribute::createWithAttributeType(0, 2, FloatType, PositionAttribute), + Attribute::createWithAttributeType(1, 2, FloatType, TexCoordAttribute) }; static AttributeSet attrs = { 2, sizeof(float) * 4, data }; return attrs; @@ -105,8 +105,8 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_TexturedPoint2D( const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D() { static Attribute data[] = { - Attribute::createWithSemantic(0, 2, TypeFloat, Attribute::POSITION), - Attribute::createWithSemantic(1, 4, TypeUnsignedByte, Attribute::COLOR) + Attribute::createWithAttributeType(0, 2, FloatType, PositionAttribute), + Attribute::createWithAttributeType(1, 4, UnsignedByteType, ColorAttribute) }; static AttributeSet attrs = { 2, 2 * sizeof(float) + 4 * sizeof(char), data }; return attrs; @@ -134,12 +134,31 @@ const QSGGeometry::AttributeSet &QSGGeometry::defaultAttributes_ColoredPoint2D() \fn QSGGeometry::Attribute QSGGeometry::Attribute::create(int pos, int tupleSize, int primitiveType, bool isPosition) Creates a new QSGGeometry::Attribute for attribute register \a pos with \a - tupleSize. The \a primitiveType can be any of the supported OpenGL types, - such as \c GL_FLOAT or \c GL_UNSIGNED_BYTE. + tupleSize. The \a primitiveType can be any of the supported types from + QSGGeometry::Type, such as QSGGeometry::FloatType or + QSGGeometry::UnsignedByteType. - If the attribute describes the position for the vertex, the \a isPosition hint - should be set to \c true. The scene graph renderer may use this information - to perform optimizations. + If the attribute describes the position for the vertex, the \a isPosition + hint should be set to \c true. The scene graph renderer may use this + information to perform optimizations. + + \note Scene graph backends for APIs other than OpenGL may require an + accurate description of attributes' usage, and therefore it is recommended + to use createWithAttributeType() instead. + + Use the create function to construct the attribute, rather than an + initialization list, to ensure that all fields are initialized. + */ + +/*! + \fn QSGGeometry::Attribute QSGGeometry::Attribute::createWithAttributeType(int pos, int tupleSize, int primitiveType, AttributeType attributeType) + + Creates a new QSGGeometry::Attribute for attribute register \a pos with \a + tupleSize. The \a primitiveType can be any of the supported types from + QSGGeometry::Type, such as QSGGeometry::FloatType or + QSGGeometry::UnsignedByteType. + + \a attributeType describes the intended use of the attribute. Use the create function to construct the attribute, rather than an initialization list, to ensure that all fields are initialized. @@ -430,9 +449,9 @@ QSGGeometry::QSGGeometry(const QSGGeometry::AttributeSet &attributes, "GL_UNSIGNED_INT is not supported, geometry will not render" ); #endif - if (indexType != TypeUnsignedByte - && indexType != TypeUnsignedShort - && indexType != TypeUnsignedInt) { + if (indexType != UnsignedByteType + && indexType != UnsignedShortType + && indexType != UnsignedIntType) { qFatal("QSGGeometry: Unsupported index type, %x.\n", indexType); } @@ -549,13 +568,13 @@ const void *QSGGeometry::indexData() const GL_UNSIGNED_BYTE, etc. QSGGeometry provies its own type in order to be able to provide the same API with non-OpenGL backends as well. - \value TypeByte - \value TypeUnsignedByte - \value TypeShort - \value TypeUnsignedShort - \value TypeInt - \value TypeUnsignedInt - \value TypeFloat + \value ByteType + \value UnsignedByteType + \value ShortType + \value UnsignedShortType + \value IntType + \value UnsignedIntType + \value FloatType */ /*! @@ -653,8 +672,8 @@ void QSGGeometry::allocate(int vertexCount, int indexCount) m_index_data_offset = -1; m_owns_data = false; } else { - Q_ASSERT(m_index_type == TypeUnsignedInt || m_index_type == TypeUnsignedShort); - int indexByteSize = indexCount * (m_index_type == TypeUnsignedShort ? sizeof(quint16) : sizeof(quint32)); + Q_ASSERT(m_index_type == UnsignedIntType || m_index_type == UnsignedShortType); + int indexByteSize = indexCount * (m_index_type == UnsignedShortType ? sizeof(quint16) : sizeof(quint32)); m_data = (void *) malloc(vertexByteSize + indexByteSize); m_index_data_offset = vertexByteSize; m_owns_data = true; diff --git a/src/quick/scenegraph/coreapi/qsggeometry.h b/src/quick/scenegraph/coreapi/qsggeometry.h index ae7b2f494c..7a916610e3 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.h +++ b/src/quick/scenegraph/coreapi/qsggeometry.h @@ -51,30 +51,60 @@ class QSGGeometryData; class Q_QUICK_EXPORT QSGGeometry { public: + enum AttributeType { + UnknownAttribute, + PositionAttribute, + ColorAttribute, + TexCoordAttribute, + TexCoord1Attribute, + TexCoord2Attribute + }; + + enum DataPattern { + AlwaysUploadPattern = 0, + StreamPattern = 1, + DynamicPattern = 2, + StaticPattern = 3 + }; + + // Equivalents to GL_* drawing modes. + // Keep in sync with GL headers. + enum DrawingMode { + DrawPoints = 0x0000, + DrawLines = 0x0001, + DrawLineLoop = 0x0002, + DrawLineStrip = 0x0003, + DrawTriangles = 0x0004, + DrawTriangleStrip = 0x0005, + DrawTriangleFan = 0x0006 + }; + + // Equivalents to GL_BYTE and similar type constants. + // Keep in sync with GL headers. + enum Type { + ByteType = 0x1400, + UnsignedByteType = 0x1401, + ShortType = 0x1402, + UnsignedShortType = 0x1403, + IntType = 0x1404, + UnsignedIntType = 0x1405, + FloatType = 0x1406 + }; struct Q_QUICK_EXPORT Attribute { - enum Semantic { - UNKNOWN, - POSITION, - COLOR, - TEXCOORD, - TEXCOORD1, - TEXCOORD2 - }; - int position; int tupleSize; int type; uint isVertexCoordinate : 1; - Semantic semantic : 4; + AttributeType attributeType : 4; uint reserved : 27; static Attribute create(int pos, int tupleSize, int primitiveType, bool isPosition = false); - static Attribute createWithSemantic(int pos, int tupleSize, int type, Semantic semantic); + static Attribute createWithAttributeType(int pos, int tupleSize, int primitiveType, AttributeType attributeType); }; struct AttributeSet { @@ -109,39 +139,10 @@ public: static const AttributeSet &defaultAttributes_TexturedPoint2D(); static const AttributeSet &defaultAttributes_ColoredPoint2D(); - enum DataPattern { - AlwaysUploadPattern = 0, - StreamPattern = 1, - DynamicPattern = 2, - StaticPattern = 3 - }; - - // Equivalents to GL_* drawing modes. - enum DrawingMode { - DrawPoints = 0x0000, - DrawLines = 0x0001, - DrawLineLoop = 0x0002, - DrawLineStrip = 0x0003, - DrawTriangles = 0x0004, - DrawTriangleStrip = 0x0005, - DrawTriangleFan = 0x0006 - }; - - // Equivalents to GL_BYTE and similar type constants. - enum Type { - TypeByte = 0x1400, - TypeUnsignedByte = 0x1401, - TypeShort = 0x1402, - TypeUnsignedShort = 0x1403, - TypeInt = 0x1404, - TypeUnsignedInt = 0x1405, - TypeFloat = 0x1406 - }; - QSGGeometry(const QSGGeometry::AttributeSet &attribs, int vertexCount, int indexCount = 0, - int indexType = TypeUnsignedShort); + int indexType = UnsignedShortType); virtual ~QSGGeometry(); // must use unsigned int to be compatible with the old GLenum to keep BC @@ -223,25 +224,25 @@ private: inline uint *QSGGeometry::indexDataAsUInt() { - Q_ASSERT(m_index_type == TypeUnsignedInt); + Q_ASSERT(m_index_type == UnsignedIntType); return static_cast(indexData()); } inline quint16 *QSGGeometry::indexDataAsUShort() { - Q_ASSERT(m_index_type == TypeUnsignedShort); + Q_ASSERT(m_index_type == UnsignedShortType); return static_cast(indexData()); } inline const uint *QSGGeometry::indexDataAsUInt() const { - Q_ASSERT(m_index_type == TypeUnsignedInt); + Q_ASSERT(m_index_type == UnsignedIntType); return static_cast(indexData()); } inline const quint16 *QSGGeometry::indexDataAsUShort() const { - Q_ASSERT(m_index_type == TypeUnsignedShort); + Q_ASSERT(m_index_type == UnsignedShortType); return static_cast(indexData()); } @@ -250,7 +251,7 @@ inline QSGGeometry::Point2D *QSGGeometry::vertexDataAsPoint2D() Q_ASSERT(m_attributes.count == 1); Q_ASSERT(m_attributes.stride == 2 * sizeof(float)); Q_ASSERT(m_attributes.attributes[0].tupleSize == 2); - Q_ASSERT(m_attributes.attributes[0].type == TypeFloat); + Q_ASSERT(m_attributes.attributes[0].type == FloatType); Q_ASSERT(m_attributes.attributes[0].position == 0); return static_cast(m_data); } @@ -261,10 +262,10 @@ inline QSGGeometry::TexturedPoint2D *QSGGeometry::vertexDataAsTexturedPoint2D() Q_ASSERT(m_attributes.stride == 4 * sizeof(float)); Q_ASSERT(m_attributes.attributes[0].position == 0); Q_ASSERT(m_attributes.attributes[0].tupleSize == 2); - Q_ASSERT(m_attributes.attributes[0].type == TypeFloat); + Q_ASSERT(m_attributes.attributes[0].type == FloatType); Q_ASSERT(m_attributes.attributes[1].position == 1); Q_ASSERT(m_attributes.attributes[1].tupleSize == 2); - Q_ASSERT(m_attributes.attributes[1].type == TypeFloat); + Q_ASSERT(m_attributes.attributes[1].type == FloatType); return static_cast(m_data); } @@ -274,10 +275,10 @@ inline QSGGeometry::ColoredPoint2D *QSGGeometry::vertexDataAsColoredPoint2D() Q_ASSERT(m_attributes.stride == 2 * sizeof(float) + 4 * sizeof(char)); Q_ASSERT(m_attributes.attributes[0].position == 0); Q_ASSERT(m_attributes.attributes[0].tupleSize == 2); - Q_ASSERT(m_attributes.attributes[0].type == TypeFloat); + Q_ASSERT(m_attributes.attributes[0].type == FloatType); Q_ASSERT(m_attributes.attributes[1].position == 1); Q_ASSERT(m_attributes.attributes[1].tupleSize == 4); - Q_ASSERT(m_attributes.attributes[1].type == TypeUnsignedByte); + Q_ASSERT(m_attributes.attributes[1].type == UnsignedByteType); return static_cast(m_data); } @@ -286,7 +287,7 @@ inline const QSGGeometry::Point2D *QSGGeometry::vertexDataAsPoint2D() const Q_ASSERT(m_attributes.count == 1); Q_ASSERT(m_attributes.stride == 2 * sizeof(float)); Q_ASSERT(m_attributes.attributes[0].tupleSize == 2); - Q_ASSERT(m_attributes.attributes[0].type == TypeFloat); + Q_ASSERT(m_attributes.attributes[0].type == FloatType); Q_ASSERT(m_attributes.attributes[0].position == 0); return static_cast(m_data); } @@ -297,10 +298,10 @@ inline const QSGGeometry::TexturedPoint2D *QSGGeometry::vertexDataAsTexturedPoin Q_ASSERT(m_attributes.stride == 4 * sizeof(float)); Q_ASSERT(m_attributes.attributes[0].position == 0); Q_ASSERT(m_attributes.attributes[0].tupleSize == 2); - Q_ASSERT(m_attributes.attributes[0].type == TypeFloat); + Q_ASSERT(m_attributes.attributes[0].type == FloatType); Q_ASSERT(m_attributes.attributes[1].position == 1); Q_ASSERT(m_attributes.attributes[1].tupleSize == 2); - Q_ASSERT(m_attributes.attributes[1].type == TypeFloat); + Q_ASSERT(m_attributes.attributes[1].type == FloatType); return static_cast(m_data); } @@ -310,18 +311,18 @@ inline const QSGGeometry::ColoredPoint2D *QSGGeometry::vertexDataAsColoredPoint2 Q_ASSERT(m_attributes.stride == 2 * sizeof(float) + 4 * sizeof(char)); Q_ASSERT(m_attributes.attributes[0].position == 0); Q_ASSERT(m_attributes.attributes[0].tupleSize == 2); - Q_ASSERT(m_attributes.attributes[0].type == TypeFloat); + Q_ASSERT(m_attributes.attributes[0].type == FloatType); Q_ASSERT(m_attributes.attributes[1].position == 1); Q_ASSERT(m_attributes.attributes[1].tupleSize == 4); - Q_ASSERT(m_attributes.attributes[1].type == TypeUnsignedByte); + Q_ASSERT(m_attributes.attributes[1].type == UnsignedByteType); return static_cast(m_data); } int QSGGeometry::sizeOfIndex() const { - if (m_index_type == TypeUnsignedShort) return 2; - else if (m_index_type == TypeUnsignedByte) return 1; - else if (m_index_type == TypeUnsignedInt) return 4; + if (m_index_type == UnsignedShortType) return 2; + else if (m_index_type == UnsignedByteType) return 1; + else if (m_index_type == UnsignedIntType) return 4; return 0; } diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index 2211f88973..a1e1ef8c27 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -1490,7 +1490,7 @@ QDebug operator<<(QDebug d, const QSGGeometryNode *n) d << "#V:" << g->vertexCount() << "#I:" << g->indexCount(); - if (g->attributeCount() > 0 && g->attributes()->type == QSGGeometry::TypeFloat) { + if (g->attributeCount() > 0 && g->attributes()->type == QSGGeometry::FloatType) { float x1 = 1e10, x2 = -1e10, y1=1e10, y2=-1e10; int stride = g->sizeOfVertex(); for (int i = 0; i < g->vertexCount(); ++i) { diff --git a/src/quick/scenegraph/qsgbasicinternalimagenode.cpp b/src/quick/scenegraph/qsgbasicinternalimagenode.cpp index 685a51550d..c8699218ba 100644 --- a/src/quick/scenegraph/qsgbasicinternalimagenode.cpp +++ b/src/quick/scenegraph/qsgbasicinternalimagenode.cpp @@ -55,10 +55,10 @@ namespace const QSGGeometry::AttributeSet &smoothAttributeSet() { static QSGGeometry::Attribute data[] = { - QSGGeometry::Attribute::createWithSemantic(0, 2, QSGGeometry::TypeFloat, QSGGeometry::Attribute::POSITION), - QSGGeometry::Attribute::createWithSemantic(1, 2, QSGGeometry::TypeFloat, QSGGeometry::Attribute::TEXCOORD), - QSGGeometry::Attribute::createWithSemantic(2, 2, QSGGeometry::TypeFloat, QSGGeometry::Attribute::TEXCOORD1), - QSGGeometry::Attribute::createWithSemantic(3, 2, QSGGeometry::TypeFloat, QSGGeometry::Attribute::TEXCOORD2) + QSGGeometry::Attribute::createWithAttributeType(0, 2, QSGGeometry::FloatType, QSGGeometry::PositionAttribute), + QSGGeometry::Attribute::createWithAttributeType(1, 2, QSGGeometry::FloatType, QSGGeometry::TexCoordAttribute), + QSGGeometry::Attribute::createWithAttributeType(2, 2, QSGGeometry::FloatType, QSGGeometry::TexCoord1Attribute), + QSGGeometry::Attribute::createWithAttributeType(3, 2, QSGGeometry::FloatType, QSGGeometry::TexCoord2Attribute) }; static QSGGeometry::AttributeSet attrs = { 4, sizeof(SmoothVertex), data }; return attrs; @@ -427,7 +427,7 @@ QSGGeometry *QSGBasicInternalImageNode::updateGeometry(const QRectF &targetRect, if (!geometry) { geometry = new QSGGeometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), hCells * vCells * 4, hCells * vCells * 6, - QSGGeometry::TypeUnsignedShort); + QSGGeometry::UnsignedShortType); } else { geometry->allocate(hCells * vCells * 4, hCells * vCells * 6); } diff --git a/src/quick/scenegraph/qsgbasicinternalrectanglenode.cpp b/src/quick/scenegraph/qsgbasicinternalrectanglenode.cpp index 8fc850b60c..df124cce35 100644 --- a/src/quick/scenegraph/qsgbasicinternalrectanglenode.cpp +++ b/src/quick/scenegraph/qsgbasicinternalrectanglenode.cpp @@ -87,9 +87,9 @@ namespace const QSGGeometry::AttributeSet &smoothAttributeSet() { static QSGGeometry::Attribute data[] = { - QSGGeometry::Attribute::createWithSemantic(0, 2, QSGGeometry::TypeFloat, QSGGeometry::Attribute::POSITION), - QSGGeometry::Attribute::createWithSemantic(1, 4, QSGGeometry::TypeUnsignedByte, QSGGeometry::Attribute::COLOR), - QSGGeometry::Attribute::createWithSemantic(2, 2, QSGGeometry::TypeFloat, QSGGeometry::Attribute::TEXCOORD) + QSGGeometry::Attribute::createWithAttributeType(0, 2, QSGGeometry::FloatType, QSGGeometry::PositionAttribute), + QSGGeometry::Attribute::createWithAttributeType(1, 4, QSGGeometry::UnsignedByteType, QSGGeometry::ColorAttribute), + QSGGeometry::Attribute::createWithAttributeType(2, 2, QSGGeometry::FloatType, QSGGeometry::TexCoordAttribute) }; static QSGGeometry::AttributeSet attrs = { 3, sizeof(SmoothVertex), data }; return attrs; diff --git a/src/quick/scenegraph/qsgdefaultspritenode.cpp b/src/quick/scenegraph/qsgdefaultspritenode.cpp index 89b26f8660..5eb8fb6e08 100644 --- a/src/quick/scenegraph/qsgdefaultspritenode.cpp +++ b/src/quick/scenegraph/qsgdefaultspritenode.cpp @@ -150,8 +150,8 @@ QSGMaterialShader *QQuickSpriteMaterial::createShader() const } static QSGGeometry::Attribute Sprite_Attributes[] = { - QSGGeometry::Attribute::create(0, 2, QSGGeometry::TypeFloat, true), // pos - QSGGeometry::Attribute::create(1, 2, QSGGeometry::TypeFloat), // tex + QSGGeometry::Attribute::create(0, 2, QSGGeometry::FloatType, true), // pos + QSGGeometry::Attribute::create(1, 2, QSGGeometry::FloatType), // tex }; static QSGGeometry::AttributeSet Sprite_AttributeSet = -- cgit v1.2.3 From 24d4c9b3cd609213fa276fb9c27aadcaff5ab817 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 13 Oct 2016 15:26:44 +0200 Subject: Temporarily provide old Type enums in QSGGeometry Unblock qt5.git integration of dependent modules like qtlocation. 6df6c10e1af827d06a387e7422176dd310cf83be changes the names of the new-in-5.8 type enums from TypeXxxx to XxxxType as per API review. However QtLocation already uses the TypeXxxx variants. So provide a temporary solution by offering both. Change-Id: Id23db0044f09654bd61b64f401b683a7944cf245 Reviewed-by: Andy Nichols --- src/quick/scenegraph/coreapi/qsggeometry.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/scenegraph/coreapi/qsggeometry.h b/src/quick/scenegraph/coreapi/qsggeometry.h index 7a916610e3..00acb51c8a 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.h +++ b/src/quick/scenegraph/coreapi/qsggeometry.h @@ -88,7 +88,15 @@ public: UnsignedShortType = 0x1403, IntType = 0x1404, UnsignedIntType = 0x1405, - FloatType = 0x1406 + FloatType = 0x1406, + + TypeByte = ByteType, + TypeUnsignedByte = UnsignedByteType, + TypeShort = ShortType, + TypeUnsignedShort = UnsignedShortType, + TypeInt = IntType, + TypeUnsignedInt = UnsignedIntType, + TypeFloat = FloatType }; struct Q_QUICK_EXPORT Attribute -- cgit v1.2.3 From 05a446bd64a828111f4bc888112f68e049ac22bc Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 13 Oct 2016 14:45:43 +0200 Subject: Search for configure tests in the correct directory Change-Id: I32a0c0357c1c83a889be7ac8f35844840084d8ae Reviewed-by: Laszlo Agocs --- src/quick/configure.json | 1 + 1 file changed, 1 insertion(+) (limited to 'src/quick') diff --git a/src/quick/configure.json b/src/quick/configure.json index 373b383a06..4ed11e8318 100644 --- a/src/quick/configure.json +++ b/src/quick/configure.json @@ -4,6 +4,7 @@ "qml-private", "gui-private" ], + "testDir": "../../config.tests", "commandline": { "options": { -- cgit v1.2.3