diff options
46 files changed, 409 insertions, 139 deletions
diff --git a/examples/quick/customitems/dialcontrol/doc/src/dialcontrol.qdoc b/examples/quick/customitems/dialcontrol/doc/src/dialcontrol.qdoc index 064dba51ef..9bc6a61716 100644 --- a/examples/quick/customitems/dialcontrol/doc/src/dialcontrol.qdoc +++ b/examples/quick/customitems/dialcontrol/doc/src/dialcontrol.qdoc @@ -42,6 +42,7 @@ /*! \title UI Components: Dial Control Example \example customitems/dialcontrol + \brief The Dial Control Example shows how to create a speedometer-type dial. This example shows how to create a dial-type control. It combines \l Image elements with \l Rotation transforms and \l SpringAnimation behaviors diff --git a/examples/quick/customitems/flipable/doc/src/flipable.qdoc b/examples/quick/customitems/flipable/doc/src/flipable.qdoc index b492f2c147..c4b7969b7e 100644 --- a/examples/quick/customitems/flipable/doc/src/flipable.qdoc +++ b/examples/quick/customitems/flipable/doc/src/flipable.qdoc @@ -41,6 +41,7 @@ /*! \title UI Components: Flipable Example \example customitems/flipable + \brief The Flipable Example shows an item that flips whenever clicked, rotating around the y-axis. This example shows how to use the \l Flipable element. diff --git a/examples/quick/customitems/scrollbar/doc/src/scrollbar.qdoc b/examples/quick/customitems/scrollbar/doc/src/scrollbar.qdoc index 7adb3beb94..e5a4b11742 100644 --- a/examples/quick/customitems/scrollbar/doc/src/scrollbar.qdoc +++ b/examples/quick/customitems/scrollbar/doc/src/scrollbar.qdoc @@ -27,6 +27,7 @@ /*! \title UI Components: Scroll Bar Example \example customitems/scrollbar + \brief The Scroll Bar Example shows how to use scroll bars on a flickable element. This example shows how to create scroll bars for a \l Flickable element using the \l {Flickable::visibleArea.xPosition}{Flickable::visibleArea} diff --git a/examples/quick/customitems/tabwidget/doc/src/tabwidget.qdoc b/examples/quick/customitems/tabwidget/doc/src/tabwidget.qdoc index dbda19384b..862c527d9f 100644 --- a/examples/quick/customitems/tabwidget/doc/src/tabwidget.qdoc +++ b/examples/quick/customitems/tabwidget/doc/src/tabwidget.qdoc @@ -28,6 +28,8 @@ /*! \title TabWidget Example \example customitems/tabwidget + \brief The TabWidget example shows how to create a tabwidget using property aliases + and QML Object default properties This example shows how to create a tab widget. It also demonstrates how \l {Property aliases}{property aliases} and diff --git a/examples/quick/threading/threadedlistmodel/doc/src/threadedlistmodel.qdoc b/examples/quick/threading/threadedlistmodel/doc/src/threadedlistmodel.qdoc index 68f0db9629..7e0a46139a 100644 --- a/examples/quick/threading/threadedlistmodel/doc/src/threadedlistmodel.qdoc +++ b/examples/quick/threading/threadedlistmodel/doc/src/threadedlistmodel.qdoc @@ -28,6 +28,8 @@ /*! \title Threaded ListModel Example \example threading/threadedlistmodel + \brief The Threaded ListModel example shows how to use a ListModel from multiple + threads using WorkerScript. This example shows how to use a ListModel from multiple threads using WorkerScript. diff --git a/qtdeclarative.pro b/qtdeclarative.pro index 9ecfad6f75..0e746c3c65 100644 --- a/qtdeclarative.pro +++ b/qtdeclarative.pro @@ -1,3 +1,10 @@ CONFIG += tests_need_tools examples_need_tools load(qt_parts) +!python_available { + py_out = $$system('python -c "print(1)"') + !equals(py_out, 1): error("Building QtQml requires Python version 2.") + tmp = python_available + CONFIG += $$tmp + cache(CONFIG, add, tmp) +} diff --git a/src/particles/qquickparticlesystem.cpp b/src/particles/qquickparticlesystem.cpp index 617c33d6e5..401d40e275 100644 --- a/src/particles/qquickparticlesystem.cpp +++ b/src/particles/qquickparticlesystem.cpp @@ -143,8 +143,8 @@ DEFINE_BOOL_CONFIG_OPTION(qmlParticlesDebug, QML_PARTICLES_DEBUG) with stochastic state transitions. Each QtQuick::Sprite in this list is interpreted as corresponding to the particle group - with ths same name. Any transitions defined in these sprites will take effect on the particle - groups as well. Additionally TrailEmitters, Affectors and ParticlePainters definined + with the same name. Any transitions defined in these sprites will take effect on the particle + groups as well. Additionally TrailEmitters, Affectors and ParticlePainters defined inside one of these sprites are automatically associated with the corresponding particle group. */ diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h index a12aa495c3..e6c832b9bc 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h @@ -93,10 +93,10 @@ public: void engineAboutToBeRemoved(QJSEngine *) Q_DECL_OVERRIDE; void objectCreated(QJSEngine *, QObject *) Q_DECL_OVERRIDE; - void setStatesDelegate(QQmlDebugStatesDelegate *); + void setStatesDelegate(QQmlDebugStatesDelegate *) Q_DECL_OVERRIDE; protected: - virtual void messageReceived(const QByteArray &); + virtual void messageReceived(const QByteArray &) Q_DECL_OVERRIDE; private Q_SLOTS: void processMessage(const QByteArray &msg); diff --git a/src/qml/compiler/qv4jsir.cpp b/src/qml/compiler/qv4jsir.cpp index a991666b28..f8cfe7da2c 100644 --- a/src/qml/compiler/qv4jsir.cpp +++ b/src/qml/compiler/qv4jsir.cpp @@ -175,8 +175,8 @@ struct RemoveSharedExpressions: IR::StmtVisitor, IR::ExprVisitor } } - template <typename _Expr> - _Expr *cleanup(_Expr *expr) + template <typename Expr_> + Expr_ *cleanup(Expr_ *expr) { std::vector<Expr *>::iterator it = std::lower_bound(subexpressions.begin(), subexpressions.end(), expr); if (it == subexpressions.end() || *it != expr) { @@ -185,7 +185,7 @@ struct RemoveSharedExpressions: IR::StmtVisitor, IR::ExprVisitor qSwap(uniqueExpr, e); expr->accept(this); qSwap(uniqueExpr, e); - return static_cast<_Expr *>(e); + return static_cast<Expr_ *>(e); } // the cloned expression is unique by definition diff --git a/src/qml/compiler/qv4jsir_p.h b/src/qml/compiler/qv4jsir_p.h index 568ded5337..80869dd3e3 100644 --- a/src/qml/compiler/qv4jsir_p.h +++ b/src/qml/compiler/qv4jsir_p.h @@ -53,6 +53,7 @@ #include <QtCore/QString> #include <QtCore/QBitArray> #include <QtCore/qurl.h> +#include <QtCore/QVarLengthArray> #include <qglobal.h> #if defined(CONST) && defined(Q_OS_WIN) @@ -114,6 +115,23 @@ struct CJump; struct Ret; struct Phi; +template<class T, int Prealloc> +class VarLengthArray: public QVarLengthArray<T, Prealloc> +{ +public: + bool removeOne(const T &element) + { + for (int i = 0; i < this->size(); ++i) { + if (this->at(i) == element) { + this->remove(i); + return true; + } + } + + return false; + } +}; + // Flag pointer: // * The first flag indicates whether the meta object is final. // If final, then none of its properties themselves need to @@ -366,18 +384,18 @@ struct Q_AUTOTEST_EXPORT Temp: Expr { StackSlot }; - // Used when temp is used as base in member expression - MemberExpressionResolver *memberResolver; - unsigned index : 28; unsigned isReadOnly : 1; unsigned kind : 3; + // Used when temp is used as base in member expression + MemberExpressionResolver *memberResolver; + Temp() - : memberResolver(0) - , index((1 << 28) - 1) + : index((1 << 28) - 1) , isReadOnly(0) , kind(Invalid) + , memberResolver(0) {} void init(unsigned kind, unsigned index) @@ -771,10 +789,13 @@ private: Q_DISABLE_COPY(BasicBlock) public: + typedef VarLengthArray<BasicBlock *, 4> IncomingEdges; + typedef VarLengthArray<BasicBlock *, 2> OutgoingEdges; + Function *function; BasicBlock *catchBlock; - QVector<BasicBlock *> in; - QVector<BasicBlock *> out; + IncomingEdges in; + OutgoingEdges out; QQmlJS::AST::SourceLocation nextLocation; BasicBlock(Function *function, BasicBlock *catcher) @@ -785,10 +806,7 @@ public: , _isExceptionHandler(false) , _groupStart(false) , _isRemoved(false) - { - in.reserve(2); - out.reserve(2); - } + {} ~BasicBlock(); const QVector<Stmt *> &statements() const diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 28437a1d3c..de4ab8dae5 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -477,7 +477,7 @@ class DominatorTree d->vertex[d->N] = n; d->parent[n] = todo.parent; ++d->N; - const QVector<BasicBlock *> &out = function->basicBlock(n)->out; + const BasicBlock::OutgoingEdges &out = function->basicBlock(n)->out; for (int i = out.size() - 1; i > 0; --i) worklist.push_back(DFSTodo(out[i]->index(), n)); diff --git a/src/qml/jit/qv4assembler.cpp b/src/qml/jit/qv4assembler.cpp index c949c424ea..929726f4b7 100644 --- a/src/qml/jit/qv4assembler.cpp +++ b/src/qml/jit/qv4assembler.cpp @@ -327,7 +327,7 @@ Assembler::Jump Assembler::genTryDoubleConversion(IR::Expr *src, Assembler::FPRe // check if it's an int32: Assembler::Jump isNoInt = branch32(Assembler::NotEqual, Assembler::ScratchRegister, - Assembler::TrustedImm32(Value::_Integer_Type)); + Assembler::TrustedImm32(Value::Integer_Type_Internal)); convertInt32ToDouble(toInt32Register(src, Assembler::ScratchRegister), dest); Assembler::Jump intDone = jump(); diff --git a/src/qml/jit/qv4assembler_p.h b/src/qml/jit/qv4assembler_p.h index 80e71ef13c..532a3114f2 100644 --- a/src/qml/jit/qv4assembler_p.h +++ b/src/qml/jit/qv4assembler_p.h @@ -1146,7 +1146,7 @@ public: Pointer tagAddr = addr; tagAddr.offset += 4; load32(tagAddr, scratchReg); - Jump inIntRange = branch32(Equal, scratchReg, TrustedImm32(QV4::Value::_Integer_Type)); + Jump inIntRange = branch32(Equal, scratchReg, TrustedImm32(QV4::Value::Integer_Type_Internal)); // it's not in signed int range, so load it as a double, and truncate it down loadDouble(addr, FPGpr0); diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp index 6de6524615..b6df5fb08c 100644 --- a/src/qml/jit/qv4isel_masm.cpp +++ b/src/qml/jit/qv4isel_masm.cpp @@ -959,10 +959,10 @@ void InstructionSelection::swapValues(IR::Expr *source, IR::Expr *target) quint32 tag; switch (regTemp->type) { case IR::BoolType: - tag = QV4::Value::_Boolean_Type; + tag = QV4::Value::Boolean_Type_Internal; break; case IR::SInt32Type: - tag = QV4::Value::_Integer_Type; + tag = QV4::Value::Integer_Type_Internal; break; default: tag = QV4::Value::Undefined_Type; @@ -1096,7 +1096,7 @@ void InstructionSelection::convertTypeToDouble(IR::Expr *source, IR::Expr *targe // check if it's an int32: Assembler::Jump isNoInt = _as->branch32(Assembler::NotEqual, Assembler::ScratchRegister, - Assembler::TrustedImm32(Value::_Integer_Type)); + Assembler::TrustedImm32(Value::Integer_Type_Internal)); convertIntToDouble(source, target); Assembler::Jump intDone = _as->jump(); @@ -1219,7 +1219,7 @@ void InstructionSelection::convertTypeToSInt32(IR::Expr *source, IR::Expr *targe Assembler::Pointer targetAddr = _as->loadAddress(Assembler::ScratchRegister, target); _as->store32(Assembler::ReturnValueRegister, targetAddr); targetAddr.offset += 4; - _as->store32(Assembler::TrustedImm32(Value::_Integer_Type), targetAddr); + _as->store32(Assembler::TrustedImm32(Value::Integer_Type_Internal), targetAddr); } else { _as->storeInt32(Assembler::ReturnValueRegister, target); } @@ -1232,14 +1232,14 @@ void InstructionSelection::convertTypeToSInt32(IR::Expr *source, IR::Expr *targe // check if it's an int32: Assembler::Jump fallback = _as->branch32(Assembler::NotEqual, Assembler::ReturnValueRegister, - Assembler::TrustedImm32(Value::_Integer_Type)); + Assembler::TrustedImm32(Value::Integer_Type_Internal)); IR::Temp *targetTemp = target->asTemp(); if (!targetTemp || targetTemp->kind == IR::Temp::StackSlot) { _as->load32(addr, Assembler::ReturnValueRegister); Assembler::Pointer targetAddr = _as->loadAddress(Assembler::ScratchRegister, target); _as->store32(Assembler::ReturnValueRegister, targetAddr); targetAddr.offset += 4; - _as->store32(Assembler::TrustedImm32(Value::_Integer_Type), targetAddr); + _as->store32(Assembler::TrustedImm32(Value::Integer_Type_Internal), targetAddr); } else { _as->load32(addr, (Assembler::RegisterID) targetTemp->index); } @@ -1296,7 +1296,7 @@ void InstructionSelection::convertTypeToUInt32(IR::Expr *source, IR::Expr *targe // check if it's an int32: Assembler::Jump isNoInt = _as->branch32(Assembler::NotEqual, Assembler::ScratchRegister, - Assembler::TrustedImm32(Value::_Integer_Type)); + Assembler::TrustedImm32(Value::Integer_Type_Internal)); Assembler::Pointer addr = _as->loadAddress(Assembler::ScratchRegister, source); _as->storeUInt32(_as->toInt32Register(addr, Assembler::ScratchRegister), target); Assembler::Jump intDone = _as->jump(); @@ -1518,16 +1518,16 @@ void InstructionSelection::visitRet(IR::Ret *s) Assembler::Jump done = _as->jump(); intRange.link(_as); _as->move(srcReg, lowReg); - _as->move(Assembler::TrustedImm32(QV4::Value::_Integer_Type), highReg); + _as->move(Assembler::TrustedImm32(QV4::Value::Integer_Type_Internal), highReg); done.link(_as); } break; case IR::SInt32Type: _as->move((Assembler::RegisterID) t->index, lowReg); - _as->move(Assembler::TrustedImm32(QV4::Value::_Integer_Type), highReg); + _as->move(Assembler::TrustedImm32(QV4::Value::Integer_Type_Internal), highReg); break; case IR::BoolType: _as->move((Assembler::RegisterID) t->index, lowReg); - _as->move(Assembler::TrustedImm32(QV4::Value::_Boolean_Type), highReg); + _as->move(Assembler::TrustedImm32(QV4::Value::Boolean_Type_Internal), highReg); break; default: Q_UNREACHABLE(); @@ -1556,7 +1556,7 @@ void InstructionSelection::visitRet(IR::Ret *s) Assembler::Jump done = _as->jump(); intRange.link(_as); _as->zeroExtend32ToPtr(srcReg, Assembler::ReturnValueRegister); - quint64 tag = QV4::Value::_Integer_Type; + quint64 tag = QV4::Value::Integer_Type_Internal; _as->or64(Assembler::TrustedImm64(tag << 32), Assembler::ReturnValueRegister); done.link(_as); @@ -1565,10 +1565,10 @@ void InstructionSelection::visitRet(IR::Ret *s) quint64 tag; switch (t->type) { case IR::SInt32Type: - tag = QV4::Value::_Integer_Type; + tag = QV4::Value::Integer_Type_Internal; break; case IR::BoolType: - tag = QV4::Value::_Boolean_Type; + tag = QV4::Value::Boolean_Type_Internal; break; default: tag = QV4::Value::Undefined_Type; @@ -1657,7 +1657,7 @@ int InstructionSelection::prepareCallData(IR::ExprList* args, IR::Expr *thisObje } Pointer p = _as->stackLayout().callDataAddress(qOffsetOf(CallData, tag)); - _as->store32(Assembler::TrustedImm32(QV4::Value::_Integer_Type), p); + _as->store32(Assembler::TrustedImm32(QV4::Value::Integer_Type_Internal), p); p = _as->stackLayout().callDataAddress(qOffsetOf(CallData, argc)); _as->store32(Assembler::TrustedImm32(argc), p); p = _as->stackLayout().callDataAddress(qOffsetOf(CallData, thisObject)); @@ -1836,7 +1836,7 @@ bool InstructionSelection::visitCJumpStrictNullUndefined(IR::Type nullOrUndef, I Assembler::RelationalCondition cond = binop->op == IR::OpStrictEqual ? Assembler::Equal : Assembler::NotEqual; - const Assembler::TrustedImm32 tag(nullOrUndef == IR::NullType ? int(QV4::Value::_Null_Type) + const Assembler::TrustedImm32 tag(nullOrUndef == IR::NullType ? int(QV4::Value::Null_Type_Internal) : int(QV4::Value::Undefined_Type)); _as->generateCJumpOnCompare(cond, tagReg, tag, _block, trueBlock, falseBlock); return true; @@ -1878,7 +1878,7 @@ bool InstructionSelection::visitCJumpStrictBool(IR::Binop *binop, IR::BasicBlock // check if the tag of the var operand is indicates 'boolean' _as->load32(otherAddr, Assembler::ScratchRegister); Assembler::Jump noBool = _as->branch32(Assembler::NotEqual, Assembler::ScratchRegister, - Assembler::TrustedImm32(QV4::Value::_Boolean_Type)); + Assembler::TrustedImm32(QV4::Value::Boolean_Type_Internal)); if (binop->op == IR::OpStrictEqual) _as->addPatch(falseBlock, noBool); else @@ -1927,7 +1927,7 @@ bool InstructionSelection::visitCJumpNullUndefined(IR::Type nullOrUndef, IR::Bin if (binop->op == IR::OpNotEqual) qSwap(trueBlock, falseBlock); - Assembler::Jump isNull = _as->branch32(Assembler::Equal, tagReg, Assembler::TrustedImm32(int(QV4::Value::_Null_Type))); + Assembler::Jump isNull = _as->branch32(Assembler::Equal, tagReg, Assembler::TrustedImm32(int(QV4::Value::Null_Type_Internal))); Assembler::Jump isUndefined = _as->branch32(Assembler::Equal, tagReg, Assembler::TrustedImm32(int(QV4::Value::Undefined_Type))); _as->addPatch(trueBlock, isNull); _as->addPatch(trueBlock, isUndefined); diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp index 5e836f06f1..d1d97c8f84 100644 --- a/src/qml/jit/qv4regalloc.cpp +++ b/src/qml/jit/qv4regalloc.cpp @@ -946,7 +946,7 @@ private: return; while (!_unprocessed.isEmpty()) { - const LifeTimeInterval *i = _unprocessed.first(); + const LifeTimeInterval *i = _unprocessed.constFirst(); if (i->start() > position) break; diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index e31d9b1481..2560f065cf 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -536,7 +536,7 @@ void ExecutionEngine::initRootContext() Scoped<GlobalContext> r(scope, memoryManager->allocManaged<GlobalContext>(sizeof(GlobalContext::Data) + sizeof(CallData))); new (r->d()) GlobalContext::Data(this); r->d()->callData = reinterpret_cast<CallData *>(r->d() + 1); - r->d()->callData->tag = QV4::Value::_Integer_Type; + r->d()->callData->tag = QV4::Value::Integer_Type_Internal; r->d()->callData->argc = 0; r->d()->callData->thisObject = globalObject; r->d()->callData->args[0] = Encode::undefined(); @@ -1102,7 +1102,7 @@ QQmlError ExecutionEngine::catchExceptionAsQmlError() QV4::ScopedValue exception(scope, catchException(&trace)); QQmlError error; if (!trace.isEmpty()) { - QV4::StackFrame frame = trace.first(); + QV4::StackFrame frame = trace.constFirst(); error.setUrl(QUrl(frame.source)); error.setLine(frame.line); error.setColumn(frame.column); diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index be09a58fc9..1194033872 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -522,9 +522,7 @@ ReturnedValue SimpleScriptFunction::construct(const Managed *that, CallData *cal callData->thisObject = v4->newObject(ic, proto); CallContext::Data ctx(v4); -#ifndef QT_NO_DEBUG - ctx.mm_data = 0; // make sure we don't run into the assertion in setVTable when allocating a context on the stack -#endif + ctx.mm_data = 0; ctx.setVtable(CallContext::staticVTable()); ctx.strictMode = f->strictMode(); ctx.callData = callData; @@ -561,9 +559,7 @@ ReturnedValue SimpleScriptFunction::call(const Managed *that, CallData *callData Scoped<SimpleScriptFunction> f(scope, static_cast<const SimpleScriptFunction *>(that)); CallContext::Data ctx(v4); -#ifndef QT_NO_DEBUG - ctx.mm_data = 0; // make sure we don't run into the assertion in setVTable when allocating a context on the stack -#endif + ctx.mm_data = 0; ctx.setVtable(CallContext::staticVTable()); ctx.strictMode = f->strictMode(); ctx.callData = callData; @@ -621,9 +617,7 @@ ReturnedValue BuiltinFunction::call(const Managed *that, CallData *callData) ExecutionContextSaver ctxSaver(scope); CallContext::Data ctx(v4); -#ifndef QT_NO_DEBUG - ctx.mm_data = 0; // make sure we don't run into the assertion in setVTable when allocating a context on the stack -#endif + ctx.mm_data = 0; ctx.setVtable(CallContext::staticVTable()); ctx.strictMode = f->scope()->strictMode; // ### needed? scope or parent context? ctx.callData = callData; @@ -645,9 +639,7 @@ ReturnedValue IndexedBuiltinFunction::call(const Managed *that, CallData *callDa ExecutionContextSaver ctxSaver(scope); CallContext::Data ctx(v4); -#ifndef QT_NO_DEBUG - ctx.mm_data = 0; // make sure we don't run into the assertion in setVTable when allocating a context on the stack -#endif + ctx.mm_data = 0; ctx.setVtable(CallContext::staticVTable()); ctx.strictMode = f->scope()->strictMode; // ### needed? scope or parent context? ctx.callData = callData; diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h index 94df30944b..6a1bd7a9a4 100644 --- a/src/qml/jsruntime/qv4managed_p.h +++ b/src/qml/jsruntime/qv4managed_p.h @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE namespace QV4 { #define Q_MANAGED_CHECK \ - template <typename _T> inline void qt_check_for_QMANAGED_macro(const _T *_q_argument) const \ + template <typename Type> inline void qt_check_for_QMANAGED_macro(const Type *_q_argument) const \ { int i = qYouForgotTheQ_MANAGED_Macro(this, _q_argument); i = i + 1; } template <typename T> diff --git a/src/qml/jsruntime/qv4persistent.cpp b/src/qml/jsruntime/qv4persistent.cpp index 032ad0d00a..4a0f84b685 100644 --- a/src/qml/jsruntime/qv4persistent.cpp +++ b/src/qml/jsruntime/qv4persistent.cpp @@ -34,7 +34,6 @@ #include "qv4persistent_p.h" #include <private/qv4mm_p.h> #include "qv4object_p.h" -#include "qv4qobjectwrapper_p.h" #include "PageAllocation.h" using namespace QV4; @@ -205,12 +204,6 @@ void PersistentValueStorage::free(Value *v) Page *p = getPage(v); - // Keep track of QObjectWrapper to release its resources later in MemoryManager::sweep() - if (p->header.engine) { - if (QObjectWrapper *qobjectWrapper = v->as<QObjectWrapper>()) - p->header.engine->memoryManager->m_pendingDestroyedObjectWrappers.push_back(qobjectWrapper->d()); - } - v->setTag(QV4::Value::Empty_Type); v->setInt_32(p->header.freeList); p->header.freeList = v - p->values; diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 594df67f44..ee294b3678 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -1019,11 +1019,6 @@ void QObjectWrapper::markObjects(Heap::Base *that, QV4::ExecutionEngine *e) void QObjectWrapper::destroyObject(bool lastCall) { Heap::QObjectWrapper *h = d(); - destroyObject(h, lastCall); -} - -void QObjectWrapper::destroyObject(Heap::QObjectWrapper *h, bool lastCall) -{ if (!h->internalClass) return; // destroyObject already got called diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h index 29e1263f2d..1126013806 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper_p.h +++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h @@ -120,7 +120,6 @@ struct Q_QML_EXPORT QObjectWrapper : public Object void setProperty(ExecutionEngine *engine, int propertyIndex, const Value &value); void destroyObject(bool lastCall); - static void destroyObject(Heap::QObjectWrapper *h, bool lastCall); protected: static bool isEqualTo(Managed *that, Managed *o); diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h index f6361681a5..d7fd44e1d6 100644 --- a/src/qml/jsruntime/qv4scopedvalue_p.h +++ b/src/qml/jsruntime/qv4scopedvalue_p.h @@ -182,7 +182,7 @@ struct ScopedValue template<typename T> struct Scoped { - enum _Convert { Convert }; + enum ConvertType { Convert }; inline void setPointer(const Managed *p) { ptr->setM(p ? p->m() : 0); @@ -218,7 +218,7 @@ struct Scoped setPointer(v.ptr->as<T>()); } - Scoped(const Scope &scope, const Value &v, _Convert) + Scoped(const Scope &scope, const Value &v, ConvertType) { ptr = scope.engine->jsStackTop++; ptr->setRawValue(value_convert<T>(scope.engine, v)); @@ -246,7 +246,7 @@ struct Scoped ptr = scope.engine->jsStackTop++; setPointer(QV4::Value::fromReturnedValue(v).as<T>()); } - Scoped(const Scope &scope, const ReturnedValue &v, _Convert) + Scoped(const Scope &scope, const ReturnedValue &v, ConvertType) { ptr = scope.engine->jsStackTop++; ptr->setRawValue(value_convert<T>(scope.engine, QV4::Value::fromReturnedValue(v))); diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index 5e38873b49..089b2bbd34 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -149,9 +149,9 @@ struct Q_QML_PRIVATE_EXPORT Value }; enum ValueTypeInternal { - _Null_Type = Null_Type | ConvertibleToInt, - _Boolean_Type = Boolean_Type | ConvertibleToInt, - _Integer_Type = Integer_Type | ConvertibleToInt, + Null_Type_Internal = Null_Type | ConvertibleToInt, + Boolean_Type_Internal = Boolean_Type | ConvertibleToInt, + Integer_Type_Internal = Integer_Type | ConvertibleToInt, }; #else @@ -189,9 +189,9 @@ struct Q_QML_PRIVATE_EXPORT Value enum ValueTypeInternal { - _Null_Type = Null_Type, - _Boolean_Type = Boolean_Type, - _Integer_Type = Integer_Type + Null_Type_Internal = Null_Type, + Boolean_Type_Internal = Boolean_Type, + Integer_Type_Internal = Integer_Type }; #endif @@ -203,8 +203,8 @@ struct Q_QML_PRIVATE_EXPORT Value inline bool isEmpty() const { return tag() == Empty_Type; } inline bool isUndefined() const { return tag() == Undefined_Type; } - inline bool isNull() const { return tag() == _Null_Type; } - inline bool isBoolean() const { return tag ()== _Boolean_Type; } + inline bool isNull() const { return tag() == Null_Type_Internal; } + inline bool isBoolean() const { return tag ()== Boolean_Type_Internal; } #ifdef QV4_USE_64_BIT_VALUE_ENCODING inline bool isInteger() const { return (_val >> IsNumber_Shift) == 1; } inline bool isDouble() const { return (_val >> IsDouble_Shift); } @@ -220,9 +220,9 @@ struct Q_QML_PRIVATE_EXPORT Value } inline bool isNaN() const { return (tag() & 0x7fff8000) == 0x00078000; } #else - inline bool isInteger() const { return tag() == _Integer_Type; } + inline bool isInteger() const { return tag() == Integer_Type_Internal; } inline bool isDouble() const { return (tag() & NotDouble_Mask) != NotDouble_Mask; } - inline bool isNumber() const { return tag() == _Integer_Type || (tag() & NotDouble_Mask) != NotDouble_Mask; } + inline bool isNumber() const { return tag() == Integer_Type_Internal || (tag() & NotDouble_Mask) != NotDouble_Mask; } inline bool isManaged() const { return tag() == Managed_Type; } inline bool isNullOrUndefined() const { return (tag() & IsNullOrUndefined_Mask) == Undefined_Type; } inline bool integerCompatible() const { return (tag() & ConvertibleToInt) == ConvertibleToInt; } @@ -254,21 +254,21 @@ struct Q_QML_PRIVATE_EXPORT Value inline bool isString() const; inline bool isObject() const; inline bool isInt32() { - if (tag() == _Integer_Type) + if (tag() == Integer_Type_Internal) return true; if (isDouble()) { double d = doubleValue(); int i = (int)d; if (i == d) { setInt_32(i); - setTag(_Integer_Type); + setTag(Integer_Type_Internal); return true; } } return false; } double asDouble() const { - if (tag() == _Integer_Type) + if (tag() == Integer_Type_Internal) return int_32(); return doubleValue(); } @@ -329,7 +329,7 @@ struct Q_QML_PRIVATE_EXPORT Value inline bool tryIntegerConversion() { bool b = integerCompatible(); if (b) - setTag(_Integer_Type); + setTag(Integer_Type_Internal); return b; } @@ -501,9 +501,9 @@ inline Primitive Primitive::nullValue() { Primitive v; #ifndef QV4_USE_64_BIT_VALUE_ENCODING - v.setRawValue(quint64(_Null_Type) << Tag_Shift); + v.setRawValue(quint64(Null_Type_Internal) << Tag_Shift); #else - v.setTagValue(_Null_Type, 0); + v.setTagValue(Null_Type_Internal, 0); #endif return v; } @@ -511,7 +511,7 @@ inline Primitive Primitive::nullValue() inline Primitive Primitive::fromBoolean(bool b) { Primitive v; - v.setTagValue(_Boolean_Type, b); + v.setTagValue(Boolean_Type_Internal, b); return v; } @@ -525,7 +525,7 @@ inline Primitive Primitive::fromDouble(double d) inline Primitive Primitive::fromInt32(int i) { Primitive v; - v.setTagValue(_Integer_Type, 0); // For mingw482, because it complains, and for VS9, because of internal compiler errors. + v.setTagValue(Integer_Type_Internal, 0); // For mingw482, because it complains, and for VS9, because of internal compiler errors. v.setInt_32(i); return v; } @@ -534,7 +534,7 @@ inline Primitive Primitive::fromUInt32(uint i) { Primitive v; if (i < INT_MAX) { - v.setTagValue(_Integer_Type, 0); // For mingw482, because it complains, and for VS9, because of internal compiler errors. + v.setTagValue(Integer_Type_Internal, 0); // For mingw482, because it complains, and for VS9, because of internal compiler errors. v.setInt_32((int)i); } else { v.setDouble(i); @@ -547,11 +547,11 @@ struct Encode { return quint64(Value::Undefined_Type) << Value::Tag_Shift; } static ReturnedValue null() { - return quint64(Value::_Null_Type) << Value::Tag_Shift; + return quint64(Value::Null_Type_Internal) << Value::Tag_Shift; } Encode(bool b) { - val = (quint64(Value::_Boolean_Type) << Value::Tag_Shift) | (uint)b; + val = (quint64(Value::Boolean_Type_Internal) << Value::Tag_Shift) | (uint)b; } Encode(double d) { Value v; @@ -559,11 +559,11 @@ struct Encode { val = v.rawValue(); } Encode(int i) { - val = (quint64(Value::_Integer_Type) << Value::Tag_Shift) | (uint)i; + val = (quint64(Value::Integer_Type_Internal) << Value::Tag_Shift) | (uint)i; } Encode(uint i) { if (i <= INT_MAX) { - val = (quint64(Value::_Integer_Type) << Value::Tag_Shift) | i; + val = (quint64(Value::Integer_Type_Internal) << Value::Tag_Shift) | i; } else { Value v; v.setDouble(i); diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp index 053dfb856c..5181bf912b 100644 --- a/src/qml/memory/qv4mm.cpp +++ b/src/qml/memory/qv4mm.cpp @@ -41,6 +41,8 @@ #include "StdLibExtras.h" #include <QTime> +#include <QVector> +#include <QVector> #include <QMap> #include <iostream> @@ -435,15 +437,6 @@ void MemoryManager::sweep(bool lastSweep) (*it) = Primitive::undefinedValue(); } - // Some QV4::QObjectWrapper objects will be removed from PersistentValueStorage in WeakValue::~WeakValue() - // before MemoryManager::sweep() is being called, in this case we will never have a chance to call detroyObject() - // on those QV4::QObjectWrapper objects. Here we call detroyObject() for each pending destroyed Heap::QObjectWrapper - // object on the heap to make sure that we can release all the resources held by them - for (QVector<Heap::QObjectWrapper *>::const_iterator it = m_pendingDestroyedObjectWrappers.constBegin(); - it != m_pendingDestroyedObjectWrappers.constEnd(); ++it) - QObjectWrapper::destroyObject(*it, lastSweep); - m_pendingDestroyedObjectWrappers.clear(); - if (MultiplyWrappedQObjectMap *multiplyWrappedQObjects = engine->m_multiplyWrappedQObjects) { for (MultiplyWrappedQObjectMap::Iterator it = multiplyWrappedQObjects->begin(); it != multiplyWrappedQObjects->end();) { if (!it.value().isNullOrUndefined()) diff --git a/src/qml/memory/qv4mm_p.h b/src/qml/memory/qv4mm_p.h index 69aae1c5bf..3543da0907 100644 --- a/src/qml/memory/qv4mm_p.h +++ b/src/qml/memory/qv4mm_p.h @@ -49,7 +49,6 @@ #include <private/qv4value_p.h> #include <private/qv4scopedvalue_p.h> #include <private/qv4object_p.h> -#include <QVector> //#define DETAILED_MM_STATS @@ -328,7 +327,6 @@ public: QScopedPointer<Data> m_d; PersistentValueStorage *m_persistentValues; PersistentValueStorage *m_weakValues; - QVector<Heap::QObjectWrapper *> m_pendingDestroyedObjectWrappers; }; } diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h index fa6b5d2488..3987f6093a 100644 --- a/src/qml/parser/qqmljsast_p.h +++ b/src/qml/parser/qqmljsast_p.h @@ -103,11 +103,11 @@ namespace QQmlJS { namespace AST { -template <typename _T1, typename _T2> -_T1 cast(_T2 *ast) +template <typename T1, typename T2> +T1 cast(T2 *ast) { - if (ast && ast->kind == static_cast<_T1>(0)->K) - return static_cast<_T1>(ast); + if (ast && ast->kind == static_cast<T1>(0)->K) + return static_cast<T1>(ast); return 0; } diff --git a/src/qml/parser/qqmljsmemorypool_p.h b/src/qml/parser/qqmljsmemorypool_p.h index c7ac5919bd..ae9f1d8257 100644 --- a/src/qml/parser/qqmljsmemorypool_p.h +++ b/src/qml/parser/qqmljsmemorypool_p.h @@ -102,7 +102,7 @@ public: _ptr = _end = 0; } - template <typename _Tp> _Tp *New() { return new (this->allocate(sizeof(_Tp))) _Tp(); } + template <typename Tp> Tp *New() { return new (this->allocate(sizeof(Tp))) Tp(); } private: void *allocate_helper(size_t size) diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index 00ecf813ce..cd73fa028e 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -731,8 +731,8 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void * if (!v) { *(md->data() + id) = cache->engine->newVariantObject(QVariant()); v = (md->data() + id)->as<QV4::VariantObject>(); + QQml_valueTypeProvider()->initValueType(t, v->d()->data); } - QQml_valueTypeProvider()->initValueType(t, v->d()->data); needActivate = !QQml_valueTypeProvider()->equalValueType(t, a[0], v->d()->data); QQml_valueTypeProvider()->writeValueType(t, a[0], v->d()->data); } diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index ea1f18ab8e..e86956d3b2 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -856,6 +856,7 @@ ReturnedValue Document::load(ExecutionEngine *v4, const QByteArray &data) } ScopedObject instance(scope, v4->memoryManager->allocObject<Node>(document)); + document->release(); // the GC should own the NodeImpl via Node now ScopedObject p(scope); instance->setPrototype((p = Document::prototype(v4))); return instance.asReturnedValue(); diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 4b0aa47c63..a4c0f7043f 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -2277,9 +2277,6 @@ QQmlV4Handle QQmlListModel::get(int index) const } else { QObject *object = m_listModel->getOrCreateModelObject(const_cast<QQmlListModel *>(this), index); result = scope.engine->memoryManager->allocObject<QV4::ModelObject>(object, const_cast<QQmlListModel *>(this), index); - // Keep track of the QObjectWrapper in persistent value storage - QV4::Value *val = scope.engine->memoryManager->m_weakValues->allocate(); - *val = result; } } diff --git a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc index 187085a5d8..443d189f58 100644 --- a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc +++ b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc @@ -164,9 +164,9 @@ a rectangular geometry with a texture material. \section1 Scene Graph and Rendering The rendering of the scene graph happens internally in the -QQuickWindow class, and there is no public API to access it. There are +QQuickWindow class, and there is no public API to access it. There are, however, a few places in the rendering pipeline where the user can -attach application code. This can be to add custom scene graph +attach application code. This can be used to add custom scene graph content or render raw OpenGL content. The integration points are defined by the render loop. diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp index b582433800..e1b33b4660 100644 --- a/src/quick/items/qquickdroparea.cpp +++ b/src/quick/items/qquickdroparea.cpp @@ -34,10 +34,8 @@ #include "qquickdroparea_p.h" #include "qquickdrag_p.h" #include "qquickitem_p.h" -#include "qquickwindow.h" #include <private/qv4arraybuffer_p.h> -#include <private/qqmlengine_p.h> #ifndef QT_NO_DRAGANDDROP diff --git a/src/quick/items/qquickdroparea_p.h b/src/quick/items/qquickdroparea_p.h index 127b3bd4a3..a1a58af7fc 100644 --- a/src/quick/items/qquickdroparea_p.h +++ b/src/quick/items/qquickdroparea_p.h @@ -47,9 +47,6 @@ #include "qquickitem.h" -#include <private/qqmlguard_p.h> -#include <private/qv8engine_p.h> - #include <QtGui/qevent.h> #ifndef QT_NO_DRAGANDDROP diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 092d4afdd9..43405db40d 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -435,12 +435,12 @@ void QQuickFlickablePrivate::clearTimeline() void QQuickFlickablePrivate::fixup(AxisData &data, qreal minExtent, qreal maxExtent) { - if (data.move.value() > minExtent || maxExtent > minExtent) { + if (data.move.value() >= minExtent || maxExtent > minExtent) { resetTimeline(data); if (data.move.value() != minExtent) { adjustContentPos(data, minExtent); } - } else if (data.move.value() < maxExtent) { + } else if (data.move.value() <= maxExtent) { resetTimeline(data); adjustContentPos(data, maxExtent); } else if (-qRound(-data.move.value()) != data.move.value()) { diff --git a/src/quick/items/qquickflipable.cpp b/src/quick/items/qquickflipable.cpp index 4fd146f0e4..b0bacf0eb6 100644 --- a/src/quick/items/qquickflipable.cpp +++ b/src/quick/items/qquickflipable.cpp @@ -152,8 +152,10 @@ void QQuickFlipable::setFront(QQuickItem *front) } d->front = front; d->front->setParentItem(this); - if (Back == d->current) + if (Back == d->current) { d->front->setOpacity(0.); + d->front->setEnabled(false); + } emit frontChanged(); } @@ -178,8 +180,11 @@ void QQuickFlipable::setBack(QQuickItem *back) d->backTransform = new QQuickLocalTransform(d->back); d->backTransform->prependToItem(d->back); - if (Front == d->current) + if (Front == d->current) { d->back->setOpacity(0.); + d->back->setEnabled(false); + } + connect(back, SIGNAL(widthChanged()), this, SLOT(retransformBack())); connect(back, SIGNAL(heightChanged()), @@ -271,10 +276,14 @@ void QQuickFlipablePrivate::updateSide() current = newSide; if (current == QQuickFlipable::Back && back) setBackTransform(); - if (front) + if (front) { front->setOpacity((current==QQuickFlipable::Front)?1.:0.); - if (back) + front->setEnabled((current==QQuickFlipable::Front)?true:false); + } + if (back) { back->setOpacity((current==QQuickFlipable::Back)?1.:0.); + back->setEnabled((current==QQuickFlipable::Back)?true:false); + } emit q->sideChanged(); } } diff --git a/src/quick/items/qquickpainteditem.cpp b/src/quick/items/qquickpainteditem.cpp index c9b5d34cc9..ad8d94d240 100644 --- a/src/quick/items/qquickpainteditem.cpp +++ b/src/quick/items/qquickpainteditem.cpp @@ -638,6 +638,13 @@ bool QQuickPaintedItem::isTextureProvider() const */ QSGTextureProvider *QQuickPaintedItem::textureProvider() const { + // When Item::layer::enabled == true, QQuickItem will be a texture + // provider. In this case we should prefer to return the layer rather + // than the image itself. The layer will include any children and any + // the image's wrap and fill mode. + if (QQuickItem::isTextureProvider()) + return QQuickItem::textureProvider(); + Q_D(const QQuickPaintedItem); QQuickWindow *w = window(); if (!w || !w->openglContext() || QThread::currentThread() != w->openglContext()->thread()) { diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp index 09b504b742..30fd98a63c 100644 --- a/src/quick/items/qquickrepeater.cpp +++ b/src/quick/items/qquickrepeater.cpp @@ -200,11 +200,12 @@ void QQuickRepeater::setModel(const QVariant &m) clear(); if (d->model) { - disconnect(d->model, SIGNAL(modelUpdated(QQmlChangeSet,bool)), - this, SLOT(modelUpdated(QQmlChangeSet,bool))); - disconnect(d->model, SIGNAL(createdItem(int,QObject*)), this, SLOT(createdItem(int,QObject*))); - disconnect(d->model, SIGNAL(initItem(int,QObject*)), this, SLOT(initItem(int,QObject*))); -// disconnect(d->model, SIGNAL(destroyingItem(QObject*)), this, SLOT(destroyingItem(QObject*))); + qmlobject_disconnect(d->model, QQmlInstanceModel, SIGNAL(modelUpdated(QQmlChangeSet,bool)), + this, QQuickRepeater, SLOT(modelUpdated(QQmlChangeSet,bool))); + qmlobject_disconnect(d->model, QQmlInstanceModel, SIGNAL(createdItem(int,QObject*)), + this, QQuickRepeater, SLOT(createdItem(int,QObject*))); + qmlobject_disconnect(d->model, QQmlInstanceModel, SIGNAL(initItem(int,QObject*)), + this, QQuickRepeater, SLOT(initItem(int,QObject*))); } d->dataSource = model; QObject *object = qvariant_cast<QObject*>(model); @@ -228,11 +229,12 @@ void QQuickRepeater::setModel(const QVariant &m) dataModel->setModel(model); } if (d->model) { - connect(d->model, SIGNAL(modelUpdated(QQmlChangeSet,bool)), - this, SLOT(modelUpdated(QQmlChangeSet,bool))); - connect(d->model, SIGNAL(createdItem(int,QObject*)), this, SLOT(createdItem(int,QObject*))); - connect(d->model, SIGNAL(initItem(int,QObject*)), this, SLOT(initItem(int,QObject*))); -// connect(d->model, SIGNAL(destroyingItem(QObject*)), this, SLOT(destroyingItem(QObject*))); + qmlobject_connect(d->model, QQmlInstanceModel, SIGNAL(modelUpdated(QQmlChangeSet,bool)), + this, QQuickRepeater, SLOT(modelUpdated(QQmlChangeSet,bool))); + qmlobject_connect(d->model, QQmlInstanceModel, SIGNAL(createdItem(int,QObject*)), + this, QQuickRepeater, SLOT(createdItem(int,QObject*))); + qmlobject_connect(d->model, QQmlInstanceModel, SIGNAL(initItem(int,QObject*)), + this, QQuickRepeater, SLOT(initItem(int,QObject*))); regenerate(); } emit modelChanged(); diff --git a/src/quick/scenegraph/util/qsgtextureprovider.cpp b/src/quick/scenegraph/util/qsgtextureprovider.cpp index 2d05e736fe..f2c8eaa54e 100644 --- a/src/quick/scenegraph/util/qsgtextureprovider.cpp +++ b/src/quick/scenegraph/util/qsgtextureprovider.cpp @@ -45,12 +45,12 @@ QT_BEGIN_NAMESPACE \sa {Scene Graph - Two Texture Providers} */ /*! - \fn QSGTexture *QSGTextureProvider::texture(); + \fn QSGTexture *QSGTextureProvider::texture() const Returns a pointer to the texture object. */ /*! - \fn void QSGTextureProvider::textureChanged(); + \fn void QSGTextureProvider::textureChanged() This signal is emitted when the texture changes. */ diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp index d0330398e5..a57d7ba6a1 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -161,6 +161,8 @@ void QQuickAnimatorProxyJob::setWindow(QQuickWindow *window) // Upon leaving a window, we reset the controller. This means that // animators will only enter the Starting phase and won't be making // calls to QQuickAnimatorController::startjob(). + if (m_controller) + m_controller->proxyWasDestroyed(this); m_controller = 0; } else if (!m_controller && m_job) { diff --git a/tests/auto/cmake/test_plugins/CMakeLists.txt b/tests/auto/cmake/test_plugins/CMakeLists.txt index 9cbfbb657e..a23f9c332c 100644 --- a/tests/auto/cmake/test_plugins/CMakeLists.txt +++ b/tests/auto/cmake/test_plugins/CMakeLists.txt @@ -1,7 +1,9 @@ project(test_plugins) cmake_minimum_required(VERSION 2.8) -cmake_policy(SET CMP0056 NEW) +if (POLICY CMP0056) + cmake_policy(SET CMP0056 NEW) +endif() find_package(Qt5Qml REQUIRED) diff --git a/tests/auto/qml/qqmlvaluetypeproviders/data/changedSignal.qml b/tests/auto/qml/qqmlvaluetypeproviders/data/changedSignal.qml new file mode 100644 index 0000000000..fed4cf4cbc --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypeproviders/data/changedSignal.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2016 basysKom GmbH, opensource@basyskom.com. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + property bool success: false + property bool complete: false + + property vector2d v2: Qt.vector2d(-2, 0) + property vector3d v3: Qt.vector3d(-2, 0, 0) + property vector4d v4: Qt.vector4d(-2, 0, 0, 0) + + property int v2ChangedSignalCount; + property int v3ChangedSignalCount; + property int v4ChangedSignalCount; + + onV2Changed: v2ChangedSignalCount++ + onV3Changed: v3ChangedSignalCount++ + onV4Changed: v4ChangedSignalCount++ + + Component.onCompleted: { + complete = false; + success = true; + + // storing the initial value causes a signal emission + if (v2ChangedSignalCount !== 1) success = false + v2 = Qt.vector2d(-2, 0); + // setting the same value again must not emit a signal + if (v2ChangedSignalCount !== 1) success = false + v2.x++ + if (v2ChangedSignalCount !== 2) success = false + v2.x++ // cycle through 0, 0 which is the default value + if (v2ChangedSignalCount !== 3) success = false + v2.x++ + if (v2ChangedSignalCount !== 4) success = false + + // storing the initial value causes a signal emission + if (v3ChangedSignalCount !== 1) success = false + v3 = Qt.vector3d(-2, 0, 0); + // setting the same value again must not emit a signal + if (v3ChangedSignalCount !== 1) success = false + v3.x++ + if (v3ChangedSignalCount !== 2) success = false + v3.x++ // cycle through 0, 0, 0 which is the default value + if (v3ChangedSignalCount !== 3) success = false + v3.x++ + if (v3ChangedSignalCount !== 4) success = false + + // storing the initial value causes a signal emission + if (v4ChangedSignalCount !== 1) success = false + v4 = Qt.vector4d(-2, 0, 0, 0); + // setting the same value again must not emit a signal + if (v4ChangedSignalCount !== 1) success = false + v4.x++ + if (v4ChangedSignalCount !== 2) success = false + v4.x++ // cycle through 0, 0, 0 which is the default value + if (v4ChangedSignalCount !== 3) success = false + v4.x++ + if (v4ChangedSignalCount !== 4) success = false + + complete = true; + } +} diff --git a/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp b/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp index 58fca2d9d9..a38dff21fa 100644 --- a/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp +++ b/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp @@ -36,6 +36,7 @@ #include <QQmlComponent> #include <QQmlContext> #include <QDebug> +#include <QScopedPointer> #include <private/qqmlglobal_p.h> #include <private/qquickvaluetypes_p.h> #include "../../shared/util.h" @@ -66,6 +67,7 @@ private slots: void jsObjectConversion(); void invokableFunctions(); void userType(); + void changedSignal(); }; void tst_qqmlvaluetypeproviders::initTestCase() @@ -291,6 +293,18 @@ void tst_qqmlvaluetypeproviders::userType() QCOMPARE(obj->property("success").toBool(), true); } +void tst_qqmlvaluetypeproviders::changedSignal() +{ + QQmlEngine e; + QQmlComponent component(&e, testFileUrl("changedSignal.qml")); + QVERIFY(!component.isError()); + QVERIFY(component.errors().isEmpty()); + QScopedPointer<QObject> object(component.create()); + QVERIFY(object != 0); + QVERIFY(object->property("complete").toBool()); + QVERIFY(object->property("success").toBool()); +} + QTEST_MAIN(tst_qqmlvaluetypeproviders) #include "tst_qqmlvaluetypeproviders.moc" diff --git a/tests/auto/quick/qquicklistview/data/qtbug50105.qml b/tests/auto/quick/qquicklistview/data/qtbug50105.qml new file mode 100644 index 0000000000..a48a881a21 --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/qtbug50105.qml @@ -0,0 +1,130 @@ +import QtQuick 2.4 +import QtQuick.Window 2.2 + +Window { + id : mainWindow + visible: true + width: 800 + height: 480 + + property real gridListWidth : (width * 0.60) + property real gridListHeight : (height * 0.50) + + property real gridCellSpacing : (height * 0.004) + property real gridCellHeight : (height * 0.039) + property real gridCellWidth : (width * 0.20) + + Rectangle { + id : rectBackground + anchors.fill: parent + color : "white" + + ListView { + id : ls + width: mainWindow.gridListWidth + height: mainWindow.gridListHeight + clip : true + headerPositioning: ListView.OverlayHeader + spacing : mainWindow.gridCellSpacing + + model: ListModel { + ListElement { + name: "Bill Smith" + number: "555 3264" + hairColor: "red" + } + ListElement { + name: "John Brown" + number: "484 7789" + hairColor: "blue" + } + ListElement { + name: "Sam Wise" + number: "284 1547" + hairColor: "yellow" + } + } + + header : Row { + spacing : mainWindow.gridCellSpacing + + Rectangle { + width : mainWindow.gridCellWidth + height : mainWindow.gridCellHeight + color : "blue" + + Text { + anchors.centerIn: parent + color : "white" + text: "Name" + } + } + + Rectangle { + width : mainWindow.gridCellWidth + height : mainWindow.gridCellHeight + color : "blue" + + Text { + anchors.centerIn: parent + color : "white" + text: "Number" + } + + } + + Rectangle { + width : mainWindow.gridCellWidth + height : mainWindow.gridCellHeight + color : "blue" + + Text { + anchors.centerIn: parent + color : "white" + text: "Hair Color" + } + } + } + + delegate: Row { + spacing : mainWindow.gridCellSpacing + + Rectangle { + width : mainWindow.gridCellWidth + height : mainWindow.gridCellHeight + color : "red" + + Text { + anchors.centerIn: parent + color : "white" + text: name + } + } + + Rectangle { + width : mainWindow.gridCellWidth + height : mainWindow.gridCellHeight + color : "red" + + Text { + anchors.centerIn: parent + color : "white" + text: number + } + } + + Rectangle { + width : mainWindow.gridCellWidth + height : mainWindow.gridCellHeight + color : "red" + + Text { + anchors.centerIn: parent + color : "white" + text: hairColor + } + } + } + } + } +} diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 86add7435c..c50559fcc3 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -252,6 +252,7 @@ private slots: void QTBUG_48044_currentItemNotVisibleAfterTransition(); void QTBUG_48870_fastModelUpdates(); + void QTBUG_50105(); void keyNavigationEnabled(); private: @@ -8505,6 +8506,18 @@ void tst_QQuickListView::QTBUG_48870_fastModelUpdates() delete window; } +// infinite loop in overlay header positioning due to undesired rounding in QQuickFlickablePrivate::fixup() +void tst_QQuickListView::QTBUG_50105() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.loadUrl(testFileUrl("qtbug50105.qml")); + + QScopedPointer<QQuickWindow> window(qobject_cast<QQuickWindow *>(component.create())); + QVERIFY(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); +} + QTEST_MAIN(tst_QQuickListView) #include "tst_qquicklistview.moc" diff --git a/tests/auto/quick/qquicktextedit/qquicktextedit.pro b/tests/auto/quick/qquicktextedit/qquicktextedit.pro index a61f46cb49..ea6e8bc60d 100644 --- a/tests/auto/quick/qquicktextedit/qquicktextedit.pro +++ b/tests/auto/quick/qquicktextedit/qquicktextedit.pro @@ -13,3 +13,4 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private network-private testlib +osx: LIBS += -framework AppKit diff --git a/tests/auto/quick/qquicktextinput/qquicktextinput.pro b/tests/auto/quick/qquicktextinput/qquicktextinput.pro index 205ee4f672..7868b60d1b 100644 --- a/tests/auto/quick/qquicktextinput/qquicktextinput.pro +++ b/tests/auto/quick/qquicktextinput/qquicktextinput.pro @@ -13,3 +13,4 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private testlib +osx: LIBS += -framework AppKit |