aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-13 09:04:09 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-13 19:06:06 +0200
commit4d2f743baaf6869693f4540df668e1b998154785 (patch)
treeba712b420e5d299be28faf641d30585ae8dce4e7 /src
parent0c5a9ff9876cb1af53317720d1de8baae003e21d (diff)
parent0932a59971f606f07b41da19f3974d51b7008180 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp Change-Id: I26d6435a29cac3840bb567ade5149c2562a94bf9
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/masm/wtf/MathExtras.h2
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.cpp5
-rw-r--r--src/imports/localstorage/plugin.cpp18
-rw-r--r--src/imports/statemachine/signaltransition.cpp29
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp8
-rw-r--r--src/qml/compiler/qv4codegen.cpp5
-rw-r--r--src/qml/jit/qv4regalloc.cpp1
-rw-r--r--src/qml/jsruntime/qv4engine.cpp8
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper_p.h2
-rw-r--r--src/qml/jsruntime/qv4scopedvalue_p.h2
-rw-r--r--src/qml/qml.pro5
-rw-r--r--src/qml/types/qqmllistmodel.cpp2
-rw-r--r--src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc6
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp10
-rw-r--r--src/quick/items/qquickflickable.cpp2
-rw-r--r--src/quick/items/qquickitem.cpp33
-rw-r--r--src/quick/items/qquickitemgrabresult.cpp5
-rw-r--r--src/quick/items/qquickmousearea.cpp21
-rw-r--r--src/quick/items/qquickmousearea_p_p.h1
-rw-r--r--src/quick/items/qquickpathview.cpp2
-rw-r--r--src/quick/items/qquicktextnodeengine.cpp5
-rw-r--r--src/quick/items/qquickwindow.cpp31
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.cpp6
23 files changed, 152 insertions, 57 deletions
diff --git a/src/3rdparty/masm/wtf/MathExtras.h b/src/3rdparty/masm/wtf/MathExtras.h
index 9ded0ab736..28a189b6e6 100644
--- a/src/3rdparty/masm/wtf/MathExtras.h
+++ b/src/3rdparty/masm/wtf/MathExtras.h
@@ -106,7 +106,7 @@ inline bool isinf(double x) { return !finite(x) && !isnand(x); }
#endif
-#if OS(OPENBSD)
+#if OS(OPENBSD) && __cplusplus < 201103L
namespace std {
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
index 66af37c40c..1c94fddecf 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
@@ -491,10 +491,11 @@ QUrl QQuickFolderListModel::parentFolder() const
return QUrl();
localFile = dir.path();
} else {
- const int pos = d->currentDir.path().lastIndexOf(QLatin1Char('/'));
+ const QString path = d->currentDir.path();
+ const int pos = path.lastIndexOf(QLatin1Char('/'));
if (pos <= 0)
return QUrl();
- localFile = d->currentDir.path().left(pos);
+ localFile = path.left(pos);
}
return QUrl::fromLocalFile(localFile);
}
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index 3fd36f3f0d..a619030100 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -270,6 +270,15 @@ static ReturnedValue qmlsqldatabase_rows_item(CallContext *ctx)
return qmlsqldatabase_rows_index(r, scope.engine, ctx->argc() ? ctx->args()[0].toUInt32() : 0);
}
+static QVariant toSqlVariant(QV4::ExecutionEngine *engine, const QV4::ScopedValue &value)
+{
+ // toVariant() maps a null JS value to QVariant(VoidStar), but the SQL module
+ // expects a null variant. (this is because of QTBUG-40880)
+ if (value->isNull())
+ return QVariant();
+ return engine->toVariant(value, /*typehint*/-1);
+}
+
static ReturnedValue qmlsqldatabase_executeSql(CallContext *ctx)
{
QV4::Scope scope(ctx);
@@ -300,8 +309,9 @@ static ReturnedValue qmlsqldatabase_executeSql(CallContext *ctx)
ScopedArrayObject array(scope, values);
quint32 size = array->getLength();
QV4::ScopedValue v(scope);
- for (quint32 ii = 0; ii < size; ++ii)
- query.bindValue(ii, scope.engine->toVariant((v = array->getIndexed(ii)), -1));
+ for (quint32 ii = 0; ii < size; ++ii) {
+ query.bindValue(ii, toSqlVariant(scope.engine, (v = array->getIndexed(ii))));
+ }
} else if (values->as<Object>()) {
ScopedObject object(scope, values);
ObjectIterator it(scope, object, ObjectIterator::WithProtoChain|ObjectIterator::EnumerableOnly);
@@ -311,7 +321,7 @@ static ReturnedValue qmlsqldatabase_executeSql(CallContext *ctx)
key = it.nextPropertyName(val);
if (key->isNull())
break;
- QVariant v = scope.engine->toVariant(val, -1);
+ QVariant v = toSqlVariant(scope.engine, val);
if (key->isString()) {
query.bindValue(key->stringValue()->toQString(), v);
} else {
@@ -320,7 +330,7 @@ static ReturnedValue qmlsqldatabase_executeSql(CallContext *ctx)
}
}
} else {
- query.bindValue(0, scope.engine->toVariant(values, -1));
+ query.bindValue(0, toSqlVariant(scope.engine, values));
}
}
if (query.exec()) {
diff --git a/src/imports/statemachine/signaltransition.cpp b/src/imports/statemachine/signaltransition.cpp
index 127494d8d3..2e6381fc08 100644
--- a/src/imports/statemachine/signaltransition.cpp
+++ b/src/imports/statemachine/signaltransition.cpp
@@ -78,8 +78,9 @@ bool SignalTransition::eventTest(QEvent *event)
// Set arguments as context properties
int count = e->arguments().count();
QMetaMethod metaMethod = e->sender()->metaObject()->method(e->signalIndex());
+ const auto parameterNames = metaMethod.parameterNames();
for (int i = 0; i < count; i++)
- context.setContextProperty(metaMethod.parameterNames()[i], QVariant::fromValue(e->arguments().at(i)));
+ context.setContextProperty(parameterNames[i], QVariant::fromValue(e->arguments().at(i)));
QQmlExpression expr(m_guard, &context, this);
QVariant result = expr.evaluate();
@@ -111,15 +112,27 @@ void SignalTransition::setSignal(const QJSValue &signal)
QV4::ExecutionEngine *jsEngine = QV8Engine::getV4(QQmlEngine::contextForObject(this)->engine());
QV4::Scope scope(jsEngine);
- QV4::Scoped<QV4::QObjectMethod> qobjectSignal(scope, QJSValuePrivate::convertedToValue(jsEngine, m_signal));
- Q_ASSERT(qobjectSignal);
-
- QObject *sender = qobjectSignal->object();
- Q_ASSERT(sender);
- QMetaMethod metaMethod = sender->metaObject()->method(qobjectSignal->methodIndex());
+ QObject *sender;
+ QMetaMethod signalMethod;
+
+ QV4::ScopedValue value(scope, QJSValuePrivate::convertedToValue(jsEngine, m_signal));
+
+ // Did we get the "slot" that can be used to invoke the signal?
+ if (QV4::QObjectMethod *signalSlot = value->as<QV4::QObjectMethod>()) {
+ sender = signalSlot->object();
+ Q_ASSERT(sender);
+ signalMethod = sender->metaObject()->method(signalSlot->methodIndex());
+ } else if (QV4::QmlSignalHandler *signalObject = value->as<QV4::QmlSignalHandler>()) { // or did we get the signal object (the one with the connect()/disconnect() functions) ?
+ sender = signalObject->object();
+ Q_ASSERT(sender);
+ signalMethod = sender->metaObject()->method(signalObject->signalIndex());
+ } else {
+ qmlInfo(this) << tr("Specified signal does not exist.");
+ return;
+ }
QSignalTransition::setSenderObject(sender);
- QSignalTransition::setSignal(metaMethod.methodSignature());
+ QSignalTransition::setSignal(signalMethod.methodSignature());
connectTriggered();
}
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
index a587188630..425543d27a 100644
--- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
@@ -434,20 +434,24 @@ void QQmlProfilerServiceImpl::messageReceived(const QByteArray &message)
void QQmlProfilerServiceImpl::flush()
{
QMutexLocker lock(&m_configMutex);
+ QList<QQmlAbstractProfilerAdapter *> reporting;
foreach (QQmlAbstractProfilerAdapter *profiler, m_engineProfilers) {
if (profiler->isRunning()) {
m_startTimes.insert(-1, profiler);
- profiler->reportData(m_useMessageTypes);
+ reporting.append(profiler);
}
}
foreach (QQmlAbstractProfilerAdapter *profiler, m_globalProfilers) {
if (profiler->isRunning()) {
m_startTimes.insert(-1, profiler);
- profiler->reportData(m_useMessageTypes);
+ reporting.append(profiler);
}
}
+
+ foreach (QQmlAbstractProfilerAdapter *profiler, reporting)
+ profiler->reportData(m_useMessageTypes);
}
QT_END_NAMESPACE
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index a5d4c6f122..8711bc049a 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -2724,6 +2724,9 @@ bool Codegen::visit(WithStatement *ast)
_function->hasWith = true;
+ const int withObject = _block->newTemp();
+ _block->MOVE(_block->TEMP(withObject), *expression(ast->expression));
+
// need an exception handler for with to cleanup the with scope
IR::BasicBlock *withExceptionHandler = _function->newBasicBlock(exceptionHandler());
withExceptionHandler->EXP(withExceptionHandler->CALL(withExceptionHandler->NAME(IR::Name::builtin_pop_scope, 0, 0), 0));
@@ -2738,8 +2741,6 @@ bool Codegen::visit(WithStatement *ast)
_block->JUMP(withBlock);
_block = withBlock;
- int withObject = _block->newTemp();
- _block->MOVE(_block->TEMP(withObject), *expression(ast->expression));
IR::ExprList *args = _function->New<IR::ExprList>();
args->init(_block->TEMP(withObject));
_block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_push_with_scope, 0, 0), args));
diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp
index 45c596985d..04b8b83b4a 100644
--- a/src/qml/jit/qv4regalloc.cpp
+++ b/src/qml/jit/qv4regalloc.cpp
@@ -840,6 +840,7 @@ public:
, _assignedSpillSlots(assignedSpillSlots)
, _intRegs(intRegs)
, _fpRegs(fpRegs)
+ , _currentStmt(0)
{
_unprocessed = unprocessed;
_liveAtStart.reserve(function->basicBlockCount());
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index d603a1982a..f560b3be4f 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -188,6 +188,10 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
/* writable */ true, /* executable */ false,
/* includesGuardPages */ true);
jsStackBase = (Value *)jsStack->base();
+#ifdef V4_USE_VALGRIND
+ VALGRIND_MAKE_MEM_UNDEFINED(jsStackBase, 2*JSStackLimit);
+#endif
+
jsStackTop = jsStackBase;
exceptionValue = jsAlloca(1);
@@ -197,10 +201,6 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
typedArrayCtors = static_cast<FunctionObject *>(jsAlloca(NTypedArrayTypes));
jsStrings = jsAlloca(NJSStrings);
-#ifdef V4_USE_VALGRIND
- VALGRIND_MAKE_MEM_UNDEFINED(jsStackBase, 2*JSStackLimit);
-#endif
-
// set up stack limits
jsStackLimit = jsStackBase + JSStackLimit/sizeof(Value);
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h
index 4d2b263e97..c384321f1c 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper_p.h
+++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h
@@ -222,7 +222,7 @@ private:
};
-struct QmlSignalHandler : public QV4::Object
+struct Q_QML_EXPORT QmlSignalHandler : public QV4::Object
{
V4_OBJECT2(QmlSignalHandler, QV4::Object)
V4_PROTOTYPE(signalHandlerPrototype)
diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h
index e01571c3d6..58797f5eda 100644
--- a/src/qml/jsruntime/qv4scopedvalue_p.h
+++ b/src/qml/jsruntime/qv4scopedvalue_p.h
@@ -88,7 +88,7 @@ struct Scope {
memset(mark, 0, (engine->jsStackTop - mark)*sizeof(Value));
#endif
#ifdef V4_USE_VALGRIND
- VALGRIND_MAKE_MEM_UNDEFINED(mark, engine->jsStackLimit - mark);
+ VALGRIND_MAKE_MEM_UNDEFINED(mark, (engine->jsStackLimit - mark) * sizeof(Value));
#endif
engine->jsStackTop = mark;
}
diff --git a/src/qml/qml.pro b/src/qml/qml.pro
index bae8f25efc..d9452a6257 100644
--- a/src/qml/qml.pro
+++ b/src/qml/qml.pro
@@ -22,6 +22,11 @@ exists("qqml_enable_gcov") {
LIBS_PRIVATE += -lgcov
}
+greaterThan(QT_GCC_MAJOR_VERSION, 5) {
+ # Our code is bad. Temporary workaround.
+ QMAKE_CXXFLAGS += -fno-delete-null-pointer-checks
+}
+
QMAKE_DOCS = $$PWD/doc/qtqml.qdocconf
# 2415: variable "xx" of static storage duration was declared but never referenced
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 8c676bcec0..f7fdbf0d80 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -398,6 +398,8 @@ void ListModel::updateCacheIndices()
QVariant ListModel::getProperty(int elementIndex, int roleIndex, const QQmlListModel *owner, QV4::ExecutionEngine *eng)
{
+ if (roleIndex >= m_layout->roleCount())
+ return QVariant();
ListElement *e = elements[elementIndex];
const ListLayout::Role &r = m_layout->getExistingRole(roleIndex);
return e->getProperty(r, owner, eng);
diff --git a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
index ea62603f06..7d0a0826a6 100644
--- a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
+++ b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
@@ -186,8 +186,8 @@ dedicated thread. Qt attempts to choose a suitable loop based on the
platform and possibly the graphics drivers in use. When this is not
satisfactory, or for testing purposes, the environment variable
\c QSG_RENDER_LOOP can be used to force the usage of a given loop. To
-verify which render loop is in use, launch the application with
-\c QSG_INFO set to \c 1.
+verify which render loop is in use, enable the \c qt.scenegraph.info
+\l {QLoggingCategory}{logging category}.
\note The \c threaded and \c windows render loops rely on the OpenGL
implementation for throttling by requesting a swap interval of 1. Some
@@ -220,7 +220,7 @@ user input. An event is posted to the render thread to initiate a new
frame.
\li The render thread prepares to draw a new frame and makes the
-OpenGL context current and initiates a blocks on the GUI thread.
+OpenGL context current and initiates a block on the GUI thread.
\li While the render thread is preparing the new frame, the GUI thread
calls QQuickItem::updatePolish() to do final touch-up of items before
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index 7ffb715346..b340d9bf94 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -679,10 +679,14 @@ void QQuickCanvasItem::itemChange(QQuickItem::ItemChange change, const QQuickIte
QSGRenderContext *context = QQuickWindowPrivate::get(d->window)->context;
// Rendering to FramebufferObject needs a valid OpenGL context.
- if (context != 0 && (d->renderTarget != FramebufferObject || context->isValid()))
- sceneGraphInitialized();
- else
+ if (context != 0 && (d->renderTarget != FramebufferObject || context->isValid())) {
+ // Defer the call. In some (arguably incorrect) cases we get here due
+ // to ItemSceneChange with the user-supplied property values not yet
+ // set. Work this around by a deferred invoke. (QTBUG-49692)
+ QMetaObject::invokeMethod(this, "sceneGraphInitialized", Qt::QueuedConnection);
+ } else {
connect(d->window, SIGNAL(sceneGraphInitialized()), SLOT(sceneGraphInitialized()));
+ }
}
void QQuickCanvasItem::updatePolish()
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 1853a1d948..1bcc3cc0f9 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -65,7 +65,9 @@ static const int FlickThreshold = 15;
// will ensure the Flickable retains the grab on consecutive flicks.
static const int RetainGrabVelocity = 100;
+#ifdef Q_OS_OSX
static const int MovementEndingTimerInterval = 100;
+#endif
static qreal EaseOvershoot(qreal t) {
return qAtan(t);
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 9a13198d7d..1bffaf92d0 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -423,21 +423,44 @@ void QQuickItemKeyFilter::componentComplete()
/*!
\qmlproperty Item QtQuick::KeyNavigation::left
+
+ This property holds the item to assign focus to
+ when the left cursor key is pressed.
+*/
+
+/*!
\qmlproperty Item QtQuick::KeyNavigation::right
+
+ This property holds the item to assign focus to
+ when the right cursor key is pressed.
+*/
+
+/*!
\qmlproperty Item QtQuick::KeyNavigation::up
+
+ This property holds the item to assign focus to
+ when the up cursor key is pressed.
+*/
+
+/*!
\qmlproperty Item QtQuick::KeyNavigation::down
- These properties hold the item to assign focus to
- when the left, right, up or down cursor keys
- are pressed.
+ This property holds the item to assign focus to
+ when the down cursor key is pressed.
*/
/*!
\qmlproperty Item QtQuick::KeyNavigation::tab
+
+ This property holds the item to assign focus to
+ when the Tab key is pressed.
+*/
+
+/*!
\qmlproperty Item QtQuick::KeyNavigation::backtab
- These properties hold the item to assign focus to
- when the Tab key or Shift+Tab key combination (Backtab) are pressed.
+ This property holds the item to assign focus to
+ when the Shift+Tab key combination (Backtab) is pressed.
*/
QQuickKeyNavigationAttached::QQuickKeyNavigationAttached(QObject *parent)
diff --git a/src/quick/items/qquickitemgrabresult.cpp b/src/quick/items/qquickitemgrabresult.cpp
index 019352c57a..0db5323863 100644
--- a/src/quick/items/qquickitemgrabresult.cpp
+++ b/src/quick/items/qquickitemgrabresult.cpp
@@ -299,7 +299,7 @@ QQuickItemGrabResult *QQuickItemGrabResultPrivate::create(QQuickItem *item, cons
* Use \a targetSize to specify the size of the target image. By default, the
* result will have the same size as item.
*
- * If the grab could not be initiated, the function returns a \c null.
+ * If the grab could not be initiated, the function returns \c null.
*
* \note This function will render the item to an offscreen surface and
* copy that surface from the GPU's memory into the CPU's memory, which can
@@ -326,7 +326,8 @@ QSharedPointer<QQuickItemGrabResult> QQuickItem::grabToImage(const QSize &target
* Grabs the item into an in-memory image.
*
* The grab happens asynchronously and the JavaScript function \a callback is
- * invoked when the grab is completed.
+ * invoked when the grab is completed. The callback takes one argument, which
+ * is the result of the grab operation; an \l ItemGrabResult object.
*
* Use \a targetSize to specify the size of the target image. By default, the result
* will have the same size as the item.
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index 66aff5c2f4..0219bc809f 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -57,7 +57,7 @@ DEFINE_BOOL_CONFIG_OPTION(qmlVisualTouchDebugging, QML_VISUAL_TOUCH_DEBUGGING)
QQuickMouseAreaPrivate::QQuickMouseAreaPrivate()
: enabled(true), scrollGestureEnabled(true), hovered(false), longPress(false),
moved(false), stealMouse(false), doubleClick(false), preventStealing(false),
- propagateComposedEvents(false), pressed(0)
+ propagateComposedEvents(false), overThreshold(false), pressed(0)
#ifndef QT_NO_DRAGANDDROP
, drag(0)
#endif
@@ -720,7 +720,7 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event)
curLocalPos = event->windowPos();
}
- if (keepMouseGrab() && d->stealMouse && !d->drag->active())
+ if (keepMouseGrab() && d->stealMouse && d->overThreshold && !d->drag->active())
d->drag->setActive(true);
QPointF startPos = d->drag->target()->parentItem()
@@ -746,16 +746,19 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event)
if (d->drag->active())
d->drag->target()->setPosition(dragPos);
- if (!keepMouseGrab()
- && (QQuickWindowPrivate::dragOverThreshold(dragPos.x() - startPos.x(), Qt::XAxis, event, d->drag->threshold())
- || QQuickWindowPrivate::dragOverThreshold(dragPos.y() - startPos.y(), Qt::YAxis, event, d->drag->threshold()))) {
- setKeepMouseGrab(true);
- d->stealMouse = true;
-
+ if (!d->overThreshold && (QQuickWindowPrivate::dragOverThreshold(dragPos.x() - startPos.x(), Qt::XAxis, event, d->drag->threshold())
+ || QQuickWindowPrivate::dragOverThreshold(dragPos.y() - startPos.y(), Qt::YAxis, event, d->drag->threshold())))
+ {
+ d->overThreshold = true;
if (d->drag->smoothed())
d->startScene = event->windowPos();
}
+ if (!keepMouseGrab() && d->overThreshold) {
+ setKeepMouseGrab(true);
+ d->stealMouse = true;
+ }
+
d->moved = true;
}
#endif
@@ -774,6 +777,7 @@ void QQuickMouseArea::mouseReleaseEvent(QMouseEvent *event)
{
Q_D(QQuickMouseArea);
d->stealMouse = false;
+ d->overThreshold = false;
if (!d->enabled && !d->pressed) {
QQuickItem::mouseReleaseEvent(event);
} else {
@@ -887,6 +891,7 @@ void QQuickMouseArea::ungrabMouse()
d->pressed = 0;
d->stealMouse = false;
d->doubleClick = false;
+ d->overThreshold = false;
setKeepMouseGrab(false);
#ifndef QT_NO_DRAGANDDROP
diff --git a/src/quick/items/qquickmousearea_p_p.h b/src/quick/items/qquickmousearea_p_p.h
index 794a8cc6ff..b59e02910f 100644
--- a/src/quick/items/qquickmousearea_p_p.h
+++ b/src/quick/items/qquickmousearea_p_p.h
@@ -93,6 +93,7 @@ public:
bool doubleClick : 1;
bool preventStealing : 1;
bool propagateComposedEvents : 1;
+ bool overThreshold : 1;
Qt::MouseButtons pressed;
#ifndef QT_NO_DRAGANDDROP
QQuickDrag *drag;
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index e3d218ff01..7bb52853bc 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -1026,7 +1026,7 @@ void QQuickPathView::setHighlightMoveDuration(int duration)
/*!
\qmlproperty real QtQuick::PathView::dragMargin
- This property holds the maximum distance from the path that initiate mouse dragging.
+ This property holds the maximum distance from the path that initiates mouse dragging.
By default the path can only be dragged by clicking on an item. If
dragMargin is greater than zero, a drag can be initiated by clicking
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp
index 98da3ca777..11249be8c6 100644
--- a/src/quick/items/qquicktextnodeengine.cpp
+++ b/src/quick/items/qquicktextnodeengine.cpp
@@ -642,9 +642,12 @@ void QQuickTextNodeEngine::addBorder(const QRectF &rect, qreal border,
void QQuickTextNodeEngine::addFrameDecorations(QTextDocument *document, QTextFrame *frame)
{
QTextDocumentLayout *documentLayout = qobject_cast<QTextDocumentLayout *>(document->documentLayout());
- QTextFrameFormat frameFormat = frame->format().toFrameFormat();
+ if (Q_UNLIKELY(!documentLayout))
+ return;
+ QTextFrameFormat frameFormat = frame->format().toFrameFormat();
QTextTable *table = qobject_cast<QTextTable *>(frame);
+
QRectF boundingRect = table == 0
? documentLayout->frameBoundingRect(frame)
: documentLayout->tableBoundingRect(table);
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index b3ca563f16..478e01388e 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -834,8 +834,10 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, Q
QQuickItemPrivate *scopePrivate = scope ? QQuickItemPrivate::get(scope) : 0;
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
+ QQuickItem *oldActiveFocusItem = 0;
QQuickItem *currentActiveFocusItem = activeFocusItem;
QQuickItem *newActiveFocusItem = 0;
+ bool sendFocusIn = false;
lastFocusReason = reason;
@@ -843,7 +845,6 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, Q
// Does this change the active focus?
if (item == contentItem || scopePrivate->activeFocus) {
- QQuickItem *oldActiveFocusItem = 0;
oldActiveFocusItem = activeFocusItem;
if (item->isEnabled()) {
newActiveFocusItem = item;
@@ -862,8 +863,6 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, Q
#endif
activeFocusItem = 0;
- QFocusEvent event(QEvent::FocusOut, reason);
- q->sendEvent(oldActiveFocusItem, &event);
QQuickItem *afi = oldActiveFocusItem;
while (afi && afi != scope) {
@@ -908,7 +907,19 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, Q
afi = afi->parentItem();
}
updateFocusItemTransform();
+ sendFocusIn = true;
+ }
+
+ // Now that all the state is changed, emit signals & events
+ // We must do this last, as this process may result in further changes to
+ // focus.
+ if (oldActiveFocusItem) {
+ QFocusEvent event(QEvent::FocusOut, reason);
+ q->sendEvent(oldActiveFocusItem, &event);
+ }
+ // Make sure that the FocusOut didn't result in another focus change.
+ if (sendFocusIn && activeFocusItem == newActiveFocusItem) {
QFocusEvent event(QEvent::FocusIn, reason);
q->sendEvent(newActiveFocusItem, &event);
}
@@ -961,9 +972,6 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item,
activeFocusItem = 0;
if (oldActiveFocusItem) {
- QFocusEvent event(QEvent::FocusOut, reason);
- q->sendEvent(oldActiveFocusItem, &event);
-
QQuickItem *afi = oldActiveFocusItem;
while (afi && afi != scope) {
if (QQuickItemPrivate::get(afi)->activeFocus) {
@@ -993,7 +1001,18 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item,
Q_ASSERT(newActiveFocusItem == scope);
activeFocusItem = scope;
updateFocusItemTransform();
+ }
+
+ // Now that all the state is changed, emit signals & events
+ // We must do this last, as this process may result in further changes to
+ // focus.
+ if (oldActiveFocusItem) {
+ QFocusEvent event(QEvent::FocusOut, reason);
+ q->sendEvent(oldActiveFocusItem, &event);
+ }
+ // Make sure that the FocusOut didn't result in another focus change.
+ if (newActiveFocusItem && activeFocusItem == newActiveFocusItem) {
QFocusEvent event(QEvent::FocusIn, reason);
q->sendEvent(newActiveFocusItem, &event);
}
diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp
index f5983fc00d..92f783d500 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.cpp
+++ b/src/quick/scenegraph/coreapi/qsgnode.cpp
@@ -337,12 +337,12 @@ QSGNode::~QSGNode()
to the scene graph and will cause the preprocess() function to be called
for every frame the node is rendered.
- The preprocess function is called before the update pass that propegates
+ The preprocess function is called before the update pass that propagates
opacity and transformations through the scene graph. That means that
functions like QSGOpacityNode::combinedOpacity() and
QSGTransformNode::combinedMatrix() will not contain up-to-date values.
If such values are changed during the preprocess, these changes will be
- propegated through the scene graph before it is rendered.
+ propagated through the scene graph before it is rendered.
\warning Beware of deleting nodes while they are being preprocessed. It is
possible, with a small performance hit, to delete a single node during its
@@ -1349,7 +1349,7 @@ const qreal OPACITY_THRESHOLD = 0.001;
Sets the opacity of this node to \a opacity.
Before rendering the graph, the renderer will do an update pass
- over the subtree to propegate the opacity to its children.
+ over the subtree to propagate the opacity to its children.
The value will be bounded to the range 0 to 1.
*/