aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-08-12 10:03:53 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-08-12 10:04:33 +0200
commit61f72d32b4fddc6e87f21d0243d9f0a32ca61987 (patch)
treeb166541b885e33666bc3dffbde937b5dc0e93bc5 /src
parent430853836f9c17154ef3ee4cac6b03b90ee493a9 (diff)
parent01c6af3fc940378e8eee41a9fb8273420ef5a7e1 (diff)
Merge remote-tracking branch 'origin/5.3' into 5.4
Conflicts: src/qml/jsruntime/qv4include.cpp src/quick/items/qquickrendercontrol.cpp src/quick/items/qquickrendercontrol_p.h src/quickwidgets/qquickwidget.cpp Change-Id: Ib2dc0051a38cd283a37a7665eb4a76f6f7ec8b15
Diffstat (limited to 'src')
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp14
-rw-r--r--src/qml/jsruntime/qv4include.cpp24
-rw-r--r--src/qml/qml/qqmlcomponent.cpp9
-rw-r--r--src/qml/qml/qqmlincubator.cpp7
-rw-r--r--src/quick/items/qquickframebufferobject.cpp11
-rw-r--r--src/quick/items/qquickimagebase.cpp4
-rw-r--r--src/quick/items/qquickimagebase_p.h2
-rw-r--r--src/quick/items/qquickpathview.cpp17
-rw-r--r--src/quick/items/qquickpathview_p_p.h1
-rw-r--r--src/quick/util/qquickanimatorjob.cpp6
10 files changed, 57 insertions, 38 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index b8ada7ceaf..a4130cb45f 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -536,12 +536,14 @@ bool QQmlPropertyCacheCreator::buildMetaObjectRecursively(int objectIndex, int r
Q_ASSERT(baseTypeCache);
}
- if (needVMEMetaObject) {
- if (!createMetaObject(objectIndex, obj, baseTypeCache))
- return false;
- } else if (baseTypeCache) {
- propertyCaches[objectIndex] = baseTypeCache;
- baseTypeCache->addref();
+ if (baseTypeCache) {
+ if (needVMEMetaObject) {
+ if (!createMetaObject(objectIndex, obj, baseTypeCache))
+ return false;
+ } else {
+ propertyCaches[objectIndex] = baseTypeCache;
+ baseTypeCache->addref();
+ }
}
if (propertyCaches.at(objectIndex)) {
diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp
index b9576e1bee..ece0cfa8b3 100644
--- a/src/qml/jsruntime/qv4include.cpp
+++ b/src/qml/jsruntime/qv4include.cpp
@@ -209,20 +209,28 @@ QV4::ReturnedValue QV4Include::method_include(QV4::CallContext *ctx)
result = i->result();
} else {
+ QScopedPointer<QV4::Script> script;
- QFile f(localFile);
+ if (const QQmlPrivate::CachedQmlUnit *cachedUnit = QQmlMetaType::findCachedCompilationUnit(url)) {
+ QV4::CompiledData::CompilationUnit *jsUnit = cachedUnit->createCompilationUnit();
+ script.reset(new QV4::Script(scope.engine, qmlcontextobject, jsUnit));
+ } else {
+ QFile f(localFile);
- if (f.open(QIODevice::ReadOnly)) {
- QByteArray data = f.readAll();
- QString code = QString::fromUtf8(data);
- QmlIR::Document::removeScriptPragmas(code);
+ if (f.open(QIODevice::ReadOnly)) {
+ QByteArray data = f.readAll();
+ QString code = QString::fromUtf8(data);
+ QmlIR::Document::removeScriptPragmas(code);
- QV4::Script script(scope.engine, qmlcontextobject, code, url.toString());
+ script.reset(new QV4::Script(scope.engine, qmlcontextobject, code, url.toString()));
+ }
+ }
+ if (!script.isNull()) {
QV4::ExecutionContext *ctx = scope.engine->currentContext();
- script.parse();
+ script->parse();
if (!scope.engine->hasException)
- script.run();
+ script->run();
if (scope.engine->hasException) {
QV4::ScopedValue ex(scope, ctx->catchException());
result = resultValue(scope.engine, Exception);
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index e087785901..84ceefccba 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -265,7 +265,7 @@ V8_DEFINE_EXTENSION(QQmlComponentExtension, componentExtension);
/*!
\qmlattachedsignal Component::completed()
- Emitted after component "startup" has completed. This can be used to
+ Emitted after the object has been instantiated. This can be used to
execute script code at startup, once the full QML environment has been
established.
@@ -286,14 +286,13 @@ V8_DEFINE_EXTENSION(QQmlComponentExtension, componentExtension);
/*!
\qmlattachedsignal Component::destruction()
- Emitted as the component begins destruction. This can be used to undo
+ Emitted as the object begins destruction. This can be used to undo
work done in response to the \l {completed}{completed()} signal, or other
imperative code in your application.
The corresponding handler is \c onDestruction. It can be declared on
- any object. However, it applies to the destruction of the component as
- a whole, and not the destruction of the specific object. The order of
- running the \c onDestruction handlers is undefined.
+ any object. The order of running the \c onDestruction handlers is
+ undefined.
\qml
Rectangle {
diff --git a/src/qml/qml/qqmlincubator.cpp b/src/qml/qml/qqmlincubator.cpp
index 0665a4ac1a..c342d8b080 100644
--- a/src/qml/qml/qqmlincubator.cpp
+++ b/src/qml/qml/qqmlincubator.cpp
@@ -292,10 +292,7 @@ void QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt &i)
QQmlEngine *engine = compiledData->engine;
QQmlEnginePrivate *enginePriv = QQmlEnginePrivate::get(engine);
- bool guardOk = vmeGuard.isOK();
- vmeGuard.clear();
-
- if (!guardOk) {
+ if (!vmeGuard.isOK()) {
QQmlError error;
error.setUrl(compiledData->url());
error.setDescription(QQmlComponent::tr("Object destroyed during incubation"));
@@ -305,6 +302,8 @@ void QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt &i)
goto finishIncubate;
}
+ vmeGuard.clear();
+
if (progress == QQmlIncubatorPrivate::Execute) {
enginePriv->referenceScarceResources();
QObject *tresult = 0;
diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp
index 0a8ad36476..fea6aadc23 100644
--- a/src/quick/items/qquickframebufferobject.cpp
+++ b/src/quick/items/qquickframebufferobject.cpp
@@ -235,8 +235,12 @@ QSGNode *QQuickFramebufferObject::updatePaintNode(QSGNode *node, UpdatePaintNode
n->renderer->synchronize(this);
+ QSize minFboSize = d->sceneGraphContext()->minimumFBOSize();
+ QSize desiredFboSize(qMax<int>(minFboSize.width(), width()),
+ qMax<int>(minFboSize.height(), height()));
+
if (n->fbo && (d->followsItemSize || n->invalidatePending)) {
- if (n->fbo->width() != width() || n->fbo->height() != height()) {
+ if (n->fbo->size() != desiredFboSize) {
delete n->fbo;
n->fbo = 0;
delete n->msDisplayFbo;
@@ -245,10 +249,7 @@ QSGNode *QQuickFramebufferObject::updatePaintNode(QSGNode *node, UpdatePaintNode
}
if (!n->fbo) {
- QSize minFboSize = d->sceneGraphContext()->minimumFBOSize();
- QSize fboSize(qMax<int>(minFboSize.width(), width()),
- qMax<int>(minFboSize.height(), height()));
- n->fbo = n->renderer->createFramebufferObject(fboSize);
+ n->fbo = n->renderer->createFramebufferObject(desiredFboSize);
GLuint displayTexture = n->fbo->texture();
diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp
index bf67cbef26..738430dc89 100644
--- a/src/quick/items/qquickimagebase.cpp
+++ b/src/quick/items/qquickimagebase.cpp
@@ -292,10 +292,10 @@ void QQuickImageBase::handleWindowChanged(QQuickWindow* window)
connect(window, SIGNAL(screenChanged(QScreen*)), this, SLOT(handleScreenChanged(QScreen*)));
}
-void QQuickImageBase::handleScreenChanged(QScreen*)
+void QQuickImageBase::handleScreenChanged(QScreen* screen)
{
// Screen DPI might have changed, reload images on screen change.
- if (isComponentComplete())
+ if (screen && isComponentComplete())
load();
}
diff --git a/src/quick/items/qquickimagebase_p.h b/src/quick/items/qquickimagebase_p.h
index 67f1e81cae..a3d9e3ace2 100644
--- a/src/quick/items/qquickimagebase_p.h
+++ b/src/quick/items/qquickimagebase_p.h
@@ -107,7 +107,7 @@ private Q_SLOTS:
virtual void requestFinished();
void requestProgress(qint64,qint64);
void handleWindowChanged(QQuickWindow *window);
- void handleScreenChanged(QScreen *);
+ void handleScreenChanged(QScreen *screen);
private:
Q_DISABLE_COPY(QQuickImageBase)
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index efce244f7d..216b7cc7c1 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -1599,6 +1599,7 @@ void QQuickPathViewPrivate::handleMousePressEvent(QMouseEvent *event)
return;
startPoint = pointNear(event->localPos(), &startPc);
+ startPos = event->localPos();
if (idx == items.count()) {
qreal distance = qAbs(event->localPos().x() - startPoint.x()) + qAbs(event->localPos().y() - startPoint.y());
if (distance > dragMargin)
@@ -1621,8 +1622,6 @@ void QQuickPathView::mouseMoveEvent(QMouseEvent *event)
Q_D(QQuickPathView);
if (d->interactive) {
d->handleMouseMoveEvent(event);
- if (d->stealMouse)
- setKeepMouseGrab(true);
event->accept();
} else {
QQuickItem::mouseMoveEvent(event);
@@ -1639,9 +1638,17 @@ void QQuickPathViewPrivate::handleMouseMoveEvent(QMouseEvent *event)
qreal newPc;
QPointF pathPoint = pointNear(event->localPos(), &newPc);
if (!stealMouse) {
- QPointF delta = pathPoint - startPoint;
- if (qAbs(delta.x()) > qApp->styleHints()->startDragDistance() || qAbs(delta.y()) > qApp->styleHints()->startDragDistance()) {
- stealMouse = true;
+ QPointF posDelta = event->localPos() - startPos;
+ if (QQuickWindowPrivate::dragOverThreshold(posDelta.y(), Qt::YAxis, event) || QQuickWindowPrivate::dragOverThreshold(posDelta.x(), Qt::XAxis, event)) {
+ // The touch has exceeded the threshold. If the movement along the path is close to the drag threshold
+ // then we'll assume that this gesture targets the PathView. This ensures PathView gesture grabbing
+ // is in sync with other items.
+ QPointF pathDelta = pathPoint - startPoint;
+ if (qAbs(pathDelta.x()) > qApp->styleHints()->startDragDistance() * 0.8
+ || qAbs(pathDelta.y()) > qApp->styleHints()->startDragDistance() * 0.8) {
+ stealMouse = true;
+ q->setKeepMouseGrab(true);
+ }
}
} else {
moveReason = QQuickPathViewPrivate::Mouse;
diff --git a/src/quick/items/qquickpathview_p_p.h b/src/quick/items/qquickpathview_p_p.h
index e21f3757e6..59a7ac231b 100644
--- a/src/quick/items/qquickpathview_p_p.h
+++ b/src/quick/items/qquickpathview_p_p.h
@@ -135,6 +135,7 @@ public:
qreal currentItemOffset;
qreal startPc;
QPointF startPoint;
+ QPointF startPos;
qreal offset;
qreal offsetAdj;
qreal mappedRange;
diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp
index e7535be1d4..9639129583 100644
--- a/src/quick/util/qquickanimatorjob.cpp
+++ b/src/quick/util/qquickanimatorjob.cpp
@@ -97,9 +97,11 @@ QQuickAnimatorProxyJob::~QQuickAnimatorProxyJob()
void QQuickAnimatorProxyJob::deleteJob()
{
if (m_job) {
- if (m_controller && m_internalState != State_Starting)
+ // If we have a controller, we might have posted the job to be started
+ // so delete it through the controller to clean up properly.
+ if (m_controller)
m_controller->deleteJob(m_job);
- else if (m_internalState == State_Starting)
+ else
delete m_job;
m_job = 0;
}