From a1b6db4765d89b0081788e98dcdfdba5ed7fa121 Mon Sep 17 00:00:00 2001 From: Alberto Mardegan Date: Tue, 28 Jan 2014 14:03:44 +0200 Subject: V4: Array.push() on QStringList should invoke putIndexed() Wrapped sequence types should cause putIndexed() method to be called when Array.push() is used. Fix suggested by Simon Hausmann. [ChangeLog][QtQml] Fix JavaScript Array.push() not working on QStringList properties. Task-number: QTBUG-36491 Change-Id: Id04409dd7466a943d8ea8d57cd0514e8de732480 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4arrayobject.cpp | 2 +- tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp index 296471692c..d4829e587e 100644 --- a/src/qml/jsruntime/qv4arrayobject.cpp +++ b/src/qml/jsruntime/qv4arrayobject.cpp @@ -308,7 +308,7 @@ ReturnedValue ArrayPrototype::method_push(CallContext *ctx) return Encode(newLen); } - if (!instance->protoHasArray() && instance->arrayDataLen <= len) { + if (!instance->protoHasArray() && instance->arrayDataLen <= len && (instance->flags & SimpleArray)) { for (int i = 0; i < ctx->callData->argc; ++i) { if (!instance->sparseArray) { if (len >= instance->arrayAlloc) diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml index 8d08cc5559..8847055a70 100644 --- a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml +++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml @@ -141,6 +141,15 @@ Item { expected = 7; if (poppedVal != expected) success = false; + // push + msco.stringListProperty = [ "one", "two" ] + msco.stringListProperty.push("three") + expected = [ "one", "two", "three" ] + if (msco.stringListProperty.toString() != expected.toString()) success = false; + msco.stringListProperty.push("four", "five") + expected = [ "one", "two", "three", "four", "five" ] + if (msco.stringListProperty.toString() != expected.toString()) success = false; + // concat msco.stringListProperty = [ "one", "two" ] stringList = [ "hello", "world" ] -- cgit v1.2.3 From e13547c595913c58e6bd6a5ed80fdc729fae7d47 Mon Sep 17 00:00:00 2001 From: Alex Montgomery Date: Wed, 18 Dec 2013 15:25:36 -0800 Subject: Fix leak-on-exit of QSGRenderLoop::s_instance s_instance is created with new and never deleted which causes several destructors to never be called. Task-number: QTBUG-35731 Change-Id: Icccb19186958f8bb74c5fd2b4b41165255debc46 Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/qsgrenderloop.cpp | 21 +++++++++++---------- src/quick/scenegraph/qsgrenderloop_p.h | 3 --- .../auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp | 1 + tests/auto/quick/nodes/tst_nodestest.cpp | 1 - 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index ac1bdb7841..219f877bec 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -45,6 +45,7 @@ #include #include +#include #include #include @@ -76,7 +77,7 @@ extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_ DEFINE_BOOL_CONFIG_OPTION(qmlNoThreadedRenderer, QML_BAD_GUI_RENDER_LOOP); DEFINE_BOOL_CONFIG_OPTION(qmlForceThreadedRenderer, QML_FORCE_THREADED_RENDERER); // Might trigger graphics driver threading bugs, use at own risk -QSGRenderLoop *QSGRenderLoop::s_instance = 0; +Q_GLOBAL_STATIC(QScopedPointer, s_renderLoopInstance); QSGRenderLoop::~QSGRenderLoop() { @@ -142,8 +143,8 @@ bool QSGRenderLoop::useConsistentTiming() QSGRenderLoop *QSGRenderLoop::instance() { - if (!s_instance) { - s_instance = QSGContext::createWindowManager(); + if (s_renderLoopInstance->isNull()) { + s_renderLoopInstance->reset(QSGContext::createWindowManager()); bool info = qEnvironmentVariableIsSet("QSG_INFO"); @@ -153,7 +154,7 @@ QSGRenderLoop *QSGRenderLoop::instance() qDebug() << "QSG: using fixed animation steps"; } - if (!s_instance) { + if (s_renderLoopInstance->isNull()) { enum RenderLoopType { BasicRenderLoop, @@ -185,26 +186,26 @@ QSGRenderLoop *QSGRenderLoop::instance() switch (loopType) { case ThreadedRenderLoop: if (info) qDebug() << "QSG: threaded render loop"; - s_instance = new QSGThreadedRenderLoop(); + s_renderLoopInstance->reset(new QSGThreadedRenderLoop()); break; case WindowsRenderLoop: if (info) qDebug() << "QSG: windows render loop"; - s_instance = new QSGWindowsRenderLoop(); + s_renderLoopInstance->reset(new QSGWindowsRenderLoop()); break; default: if (info) qDebug() << "QSG: basic render loop"; - s_instance = new QSGGuiThreadRenderLoop(); + s_renderLoopInstance->reset(new QSGGuiThreadRenderLoop()); break; } } } - return s_instance; + return s_renderLoopInstance->data(); } void QSGRenderLoop::setInstance(QSGRenderLoop *instance) { - Q_ASSERT(!s_instance); - s_instance = instance; + Q_ASSERT(!s_renderLoopInstance); + s_renderLoopInstance->reset(instance); } QSGGuiThreadRenderLoop::QSGGuiThreadRenderLoop() diff --git a/src/quick/scenegraph/qsgrenderloop_p.h b/src/quick/scenegraph/qsgrenderloop_p.h index 72bad16c63..46edd77eda 100644 --- a/src/quick/scenegraph/qsgrenderloop_p.h +++ b/src/quick/scenegraph/qsgrenderloop_p.h @@ -88,9 +88,6 @@ public: Q_SIGNALS: void timeToIncubate(); - -private: - static QSGRenderLoop *s_instance; }; QT_END_NAMESPACE diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp index e44d5aa8d5..95ca8b5c94 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp @@ -67,6 +67,7 @@ void tst_QQMLTypeLoader::testLoadComplete() QTRY_VERIFY(rootObject != 0); QTRY_COMPARE(rootObject->property("created").toInt(), 2); QTRY_COMPARE(rootObject->property("loaded").toInt(), 2); + delete window; } QTEST_MAIN(tst_QQMLTypeLoader) diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp index 7c84cdb5cf..662e78ef6c 100644 --- a/tests/auto/quick/nodes/tst_nodestest.cpp +++ b/tests/auto/quick/nodes/tst_nodestest.cpp @@ -98,7 +98,6 @@ void NodesTest::initTestCase() void NodesTest::cleanupTestCase() { renderContext->invalidate(); - delete renderContext; context->doneCurrent(); delete context; delete surface; -- cgit v1.2.3 From d2f21f427fa85ef7b2655b375b7a521a5c4b25c1 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 17 Jan 2014 13:41:27 +0100 Subject: Docs: add a working example to Text::fontSizeMode docs It's easy to miss the maximum bound specified by either the font.pointSize or font.pixelSize properties. Task-number: QTBUG-30005 Change-Id: If1dadebd6673f0e945a1ca95b64521f27d30f5a9 Reviewed-by: Alan Alpert --- src/quick/items/qquicktext.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 038025856c..c9dee9a986 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -2345,6 +2345,10 @@ void QQuickText::setLineHeightMode(LineHeightMode mode) minimumPointSize or minimumPixelSize property and maximum bound specified by either the \l font.pointSize or \l font.pixelSize properties. + \qml + Text { text: "Hello"; fontSizeMode: Text.Fit; minimumPixelSize: 10; font.pixelSize: 72 } + \endqml + If the text does not fit within the item bounds with the minimum font size the text will be elided as per the \l elide property. */ -- cgit v1.2.3 From 4eb6f67f10da3431e5a68db2bf4b0fed804b01e7 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 27 Jan 2014 15:09:12 +0100 Subject: V4: remove unused field. Change-Id: Id1edc073db349cfc7e4b5a9dca045760016ebacf Reviewed-by: Simon Hausmann Reviewed-by: Fawzi Mohamed --- src/qml/compiler/qv4ssa.cpp | 8 +++----- src/qml/compiler/qv4ssa_p.h | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 6b4d7e7434..44c93df4c9 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -3811,7 +3811,6 @@ void Optimizer::convertOutOfSSA() { // There should be no critical edges at this point. foreach (BasicBlock *bb, function->basicBlocks) { - const int id = bb->statements.last()->id; MoveMapping moves; foreach (BasicBlock *successor, bb->out) { @@ -3820,7 +3819,7 @@ void Optimizer::convertOutOfSSA() { foreach (Stmt *s, successor->statements) { if (Phi *phi = s->asPhi()) { moves.add(clone(phi->d->incoming[inIdx], function), - clone(phi->targetTemp, function)->asTemp(), id); + clone(phi->targetTemp, function)->asTemp()); } else { break; } @@ -3946,7 +3945,7 @@ MoveMapping::Moves MoveMapping::sourceUsages(Expr *e, const Moves &moves) return usages; } -void MoveMapping::add(Expr *from, Temp *to, int id) { +void MoveMapping::add(Expr *from, Temp *to) { if (Temp *t = from->asTemp()) { if (overlappingStorage(*t, *to)) { // assignments like fp1 = fp1 or var{&1} = double{&1} can safely be skipped. @@ -3962,7 +3961,7 @@ void MoveMapping::add(Expr *from, Temp *to, int id) { } } - Move m(from, to, id); + Move m(from, to); if (_moves.contains(m)) return; _moves.append(m); @@ -3995,7 +3994,6 @@ void MoveMapping::insertMoves(BasicBlock *bb, Function *function, bool atEnd) co foreach (const Move &m, _moves) { V4IR::Move *move = function->New(); move->init(m.to, m.from); - move->id = m.id; move->swap = m.needsSwap; bb->statements.insert(insertionPoint++, move); } diff --git a/src/qml/compiler/qv4ssa_p.h b/src/qml/compiler/qv4ssa_p.h index 65d4f0834a..2ec81b9577 100644 --- a/src/qml/compiler/qv4ssa_p.h +++ b/src/qml/compiler/qv4ssa_p.h @@ -170,11 +170,10 @@ class MoveMapping struct Move { Expr *from; Temp *to; - int id; bool needsSwap; - Move(Expr *from, Temp *to, int id) - : from(from), to(to), id(id), needsSwap(false) + Move(Expr *from, Temp *to) + : from(from), to(to), needsSwap(false) {} bool operator==(const Move &other) const @@ -187,7 +186,7 @@ class MoveMapping static Moves sourceUsages(Expr *e, const Moves &moves); public: - void add(Expr *from, Temp *to, int id = 0); + void add(Expr *from, Temp *to); void order(); void insertMoves(BasicBlock *bb, Function *function, bool atEnd) const; -- cgit v1.2.3 From fc218a91ce03187f51058deba9d5cdde9c3e6d05 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 28 Jan 2014 08:59:59 -0600 Subject: Fix crash in header when regenerating view. Unregister for geometry changes before reparenting, as reparenting may trigger those changes. Task-number: QTBUG-36481 Change-Id: Ia94f1f88880b232dd583b7e63e5da73fb338f7c6 Reviewed-by: Martin Jones --- src/quick/items/qquickitemview.cpp | 1 + tests/auto/quick/qquicklistview/data/headerCrash.qml | 20 ++++++++++++++++++++ .../auto/quick/qquicklistview/tst_qquicklistview.cpp | 11 +++++++++++ 3 files changed, 32 insertions(+) create mode 100644 tests/auto/quick/qquicklistview/data/headerCrash.qml diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index d7b984788e..5d6fc534b4 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -66,6 +66,7 @@ FxViewItem::~FxViewItem() { delete transitionableItem; if (ownItem && item) { + trackGeometry(false); item->setParentItem(0); item->deleteLater(); item = 0; diff --git a/tests/auto/quick/qquicklistview/data/headerCrash.qml b/tests/auto/quick/qquicklistview/data/headerCrash.qml new file mode 100644 index 0000000000..124fa894f2 --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/headerCrash.qml @@ -0,0 +1,20 @@ +import QtQuick 2.0 + +ListView { + id: myList + + width: 400; height: 400 + model: 10 + + header: Item { + height: parent ? 20 : 10 + width: 400 + } + + delegate: Rectangle { + width: parent.width; height: 20 + color: index % 2 ? "green" : "red" + } + + Component.onCompleted: myList.verticalLayoutDirection = ListView.BottomToTop +} diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index a0045a244f..4b52ad0071 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -218,6 +218,8 @@ private slots: void highlightItemGeometryChanges(); + void QTBUG_36481(); + private: template void items(const QUrl &source); template void changed(const QUrl &source); @@ -7058,6 +7060,15 @@ void tst_QQuickListView::highlightItemGeometryChanges() } } +void tst_QQuickListView::QTBUG_36481() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("headerCrash.qml")); + + // just testing that we don't crash when creating + QScopedPointer object(component.create()); +} + QTEST_MAIN(tst_QQuickListView) #include "tst_qquicklistview.moc" -- cgit v1.2.3 From 2d95e67ff4f00260d491255ed0b2af454235a047 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 27 Jan 2014 13:00:20 +0100 Subject: V4 JIT: save/restore ebx (GOT ptr) on linux/x86. On linux/x86, ebx is used to store the global offset table. When using this register for temporary values, we have to save it at the entry of a generated function, and restore it before doing calls and at the end. Task-number: QTBUG-36289 Change-Id: I30194be3ce44f58b793ee52f6201906bcb68d46a Reviewed-by: Albert Astals Cid Reviewed-by: Simon Hausmann Reviewed-by: Lars Knoll --- src/qml/compiler/qv4isel_masm.cpp | 2 +- src/qml/compiler/qv4isel_masm_p.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp index 0cfb684e93..0fcd770584 100644 --- a/src/qml/compiler/qv4isel_masm.cpp +++ b/src/qml/compiler/qv4isel_masm.cpp @@ -122,7 +122,7 @@ static const Assembler::RegisterID calleeSavedRegisters[] = { #if CPU(X86) static const Assembler::RegisterID calleeSavedRegisters[] = { - // Not used: JSC::X86Registers::ebx, + JSC::X86Registers::ebx, // temporary register JSC::X86Registers::esi, // ContextRegister JSC::X86Registers::edi // LocalsRegister }; diff --git a/src/qml/compiler/qv4isel_masm_p.h b/src/qml/compiler/qv4isel_masm_p.h index a146220015..7dfe6a820a 100644 --- a/src/qml/compiler/qv4isel_masm_p.h +++ b/src/qml/compiler/qv4isel_masm_p.h @@ -981,6 +981,10 @@ public: prepareRelativeCall(function, this); loadArgumentOnStackOrRegister<0>(arg1); +#if OS(LINUX) && CPU(X86) && (defined(__PIC__) || defined(__PIE__)) + load32(Address(StackFrameRegister, -sizeof(void*)), JSC::X86Registers::ebx); // restore the GOT ptr +#endif + callAbsolute(functionName, function); if (stackSpaceNeeded) -- cgit v1.2.3 From 445c15c3e52192d64b28a3d22ee4aeedbe715ba0 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 30 Jan 2014 13:15:52 +0100 Subject: V4: fix range sorting When a life-time interval is split from another interval, it has to come before an interval that starts at the same position but is not split. This also means that a means that the all ranges in a split interval are uses, which is important for allocation: all incoming parameters for an operation need to be allocated before allocating a register for the result as the result will only start its life "at the end" of the operation. This patch fixes a problem register allocation is done in a function where register pressure is high (e.g. on platforms that have few registers to start with). Specifically, crypto.js on x86 triggered it. Change-Id: Iee3e5d82a887b8de573dfc23513844143d0c8073 Reviewed-by: Albert Astals Cid Reviewed-by: Simon Hausmann Reviewed-by: Fawzi Mohamed Reviewed-by: Lars Knoll --- src/qml/compiler/qv4ssa.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 44c93df4c9..594c38d109 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -3705,9 +3705,12 @@ void LifeTimeInterval::dump(QTextStream &out) const { } bool LifeTimeInterval::lessThan(const LifeTimeInterval &r1, const LifeTimeInterval &r2) { - if (r1._ranges.first().start == r2._ranges.first().start) - return r1._ranges.last().end < r2._ranges.last().end; - else + if (r1._ranges.first().start == r2._ranges.first().start) { + if (r1.isSplitFromInterval() == r2.isSplitFromInterval()) + return r1._ranges.last().end < r2._ranges.last().end; + else + return r1.isSplitFromInterval(); + } else return r1._ranges.first().start < r2._ranges.first().start; } -- cgit v1.2.3 From 95809584e20df61b7ec99061162d53604f13a7ec Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 30 Jan 2014 13:48:31 +0100 Subject: V4 regalloc: fix interval splitting when register pressure is high. When a register is needed for an interval, but none is available, one of the used registers will be chosen and spilled to the stack (meaning it will be split) before the current position. However, if a register is used at the current position for an incoming parameter, its interval has to be split after the current position. This patch adds/fixes the latter case. This fixes crypto.js on x86. The specific problem there was that the result of an operation needed a register, and chose the one from one of the incoming parameters (which then should get spilled/split). However, this interval was already split, and started exactly at that the current position. So splitting before the current position did nothing, resulting in it staying alive and using the same register as the result. So any subsequent use of would have the invalid value. Task-number: QTBUG-36430 Change-Id: I228fc210b009aa0b16b08a374fc955fabfbb6d12 Reviewed-by: Albert Astals Cid Reviewed-by: Simon Hausmann Reviewed-by: Fawzi Mohamed Reviewed-by: Lars Knoll --- src/qml/compiler/qv4regalloc.cpp | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/qml/compiler/qv4regalloc.cpp b/src/qml/compiler/qv4regalloc.cpp index a3255f26f7..ea2338acad 100644 --- a/src/qml/compiler/qv4regalloc.cpp +++ b/src/qml/compiler/qv4regalloc.cpp @@ -111,6 +111,13 @@ public: return false; } + bool isUsedAt(const Temp &t, int position) { + foreach (const Use &use, uses(t)) + if (use.pos == position) + return true; + return false; + } + int def(const Temp &t) const { Q_ASSERT(_defs[t].isValid()); return _defs[t].defStmt; @@ -743,17 +750,17 @@ private: os << "Intervals live at the start of L" << bb->index << ":" << endl; if (_liveAtStart[bb].isEmpty()) os << "\t(none)" << endl; - foreach (const LifeTimeInterval &i, _liveAtStart[bb]) { + foreach (const LifeTimeInterval *i, _liveAtStart[bb]) { os << "\t"; - i.dump(os); + i->dump(os); os << endl; } os << "Intervals live at the end of L" << bb->index << ":" << endl; if (_liveAtEnd[bb].isEmpty()) os << "\t(none)" << endl; - foreach (const LifeTimeInterval &i, _liveAtEnd[bb]) { + foreach (const LifeTimeInterval *i, _liveAtEnd[bb]) { os << "\t"; - i.dump(os); + i->dump(os); os << endl; } #endif @@ -1066,6 +1073,8 @@ RegisterAllocator::RegisterAllocator(const QVector &normalRegisters, const : _normalRegisters(normalRegisters) , _fpRegisters(fpRegisters) { + Q_ASSERT(normalRegisters.size() >= 2); + Q_ASSERT(fpRegisters.size() >= 2); } RegisterAllocator::~RegisterAllocator() @@ -1413,9 +1422,20 @@ void RegisterAllocator::allocateBlockedReg(LifeTimeInterval ¤t, const int #endif // DEBUG_REGALLOC current.setReg(reg); _lastAssignedRegister.insert(current.temp(), reg); - Q_ASSERT(nextUseRangeForReg[reg]); - Q_ASSERT(!nextUseRangeForReg[reg]->isFixedInterval()); - split(*nextUseRangeForReg[reg], position); + LifeTimeInterval *nextUse = nextUseRangeForReg[reg]; + Q_ASSERT(nextUse); + Q_ASSERT(!nextUse->isFixedInterval()); + + if (_info->isUsedAt(nextUse->temp(), position)) { + Q_ASSERT(!_info->isUsedAt(current.temp(), position)); + // the register is used (as an incoming parameter) at the current position, so split + // the interval immediately after the (use at the) current position + split(*nextUse, position + 1); + } else { + // the register was used before the current position + split(*nextUse, position); + } + splitInactiveAtEndOfLifetimeHole(reg, needsFPReg, position); // make sure that current does not intersect with the fixed interval for reg -- cgit v1.2.3 From 7c1e3dea8ba66f9eedee4f3d66dba55d7f7556b8 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 27 Jan 2014 14:51:56 +0100 Subject: Revert "Skip unstable test" This reverts commit 8e0c5b59f57b51a0dc80d3d8274202776c6e03df. This test doesn't fail any more. Task-number: QTBUG-23976 Change-Id: I77704e7811c4c335cb5836ba7645a8804c13e12d Reviewed-by: Gabriel de Dietrich --- tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 31b323af5d..d0a1c18885 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -933,7 +933,6 @@ void tst_QQuickMouseArea::preventStealing() void tst_QQuickMouseArea::clickThrough() { - QSKIP("QTBUG-23976 Unstable"); //With no handlers defined click, doubleClick and PressAndHold should propagate to those with handlers QScopedPointer window(new QQuickView); QByteArray errorMessage; -- cgit v1.2.3 From d781cc7d99fa1a1f34440ce319bacadfa4326673 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 30 Jan 2014 19:18:16 +0100 Subject: Fix backend API, broken since 5.2.0 Without this change, it is not possible to implement a custom context without also implementing a renderloop. Change-Id: Iac2aa732251cdf7221b28f665394cdd336a3d846 Reviewed-by: Michael Brasser --- src/quick/scenegraph/qsgcontext.cpp | 5 +++++ src/quick/scenegraph/qsgcontext_p.h | 1 + src/quick/scenegraph/qsgrenderloop.cpp | 2 +- src/quick/scenegraph/qsgthreadedrenderloop.cpp | 2 +- src/quick/scenegraph/qsgwindowsrenderloop.cpp | 2 +- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index 829d33a0d7..f9bc615f5c 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -174,6 +174,11 @@ QSGContext::~QSGContext() { } +QSGRenderContext *QSGContext::createRenderContext() +{ + return new QSGRenderContext(this); +} + /*! * This function is used by the Qt WebEngine to set up context sharing * across multiple windows. Do not use it for any other purpose. diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index c1bf78a018..8378fe99b6 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -155,6 +155,7 @@ public: virtual void renderContextInitialized(QSGRenderContext *renderContext); virtual void renderContextInvalidated(QSGRenderContext *renderContext); + virtual QSGRenderContext *createRenderContext(); virtual QSGRectangleNode *createRectangleNode(); virtual QSGImageNode *createImageNode(); diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 219f877bec..f0ac725f22 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -213,7 +213,7 @@ QSGGuiThreadRenderLoop::QSGGuiThreadRenderLoop() , eventPending(false) { sg = QSGContext::createDefaultContext(); - rc = new QSGRenderContext(sg); + rc = sg->createRenderContext(); } QSGGuiThreadRenderLoop::~QSGGuiThreadRenderLoop() diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index d8fe947122..207a4915e1 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -709,7 +709,7 @@ QSGThreadedRenderLoop::QSGThreadedRenderLoop() QSGRenderContext *QSGThreadedRenderLoop::createRenderContext(QSGContext *sg) const { - return new QSGRenderContext(sg); + return sg->createRenderContext(); } void QSGThreadedRenderLoop::maybePostPolishRequest(Window *w) diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp index 5d9583cafb..6a6a6ab570 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp +++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp @@ -85,7 +85,7 @@ QSGWindowsRenderLoop::QSGWindowsRenderLoop() qsg_debug_timer.start(); #endif - m_rc = new QSGRenderContext(m_sg); + m_rc = m_sg->createRenderContext(); m_animationDriver = m_sg->createAnimationDriver(m_sg); m_animationDriver->install(); -- cgit v1.2.3 From 44b16b06983ac3661f485ccfb3ffe88ba586d557 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 4 Feb 2014 14:02:16 +0100 Subject: Avoid out-of-bound accesses in Qt Quick example code Task-number: QTBUG-36197 Change-Id: I5545c36a1ce9ea6c2451c92e0e79f65e5ab26c68 Reviewed-by: Mitch Curtis --- examples/quick/scenegraph/graph/linenode.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/examples/quick/scenegraph/graph/linenode.cpp b/examples/quick/scenegraph/graph/linenode.cpp index 0d1229cf1d..015aa4f0ee 100644 --- a/examples/quick/scenegraph/graph/linenode.cpp +++ b/examples/quick/scenegraph/graph/linenode.cpp @@ -58,17 +58,14 @@ class LineShader : public QSGSimpleMaterialShader QSG_DECLARE_SIMPLE_SHADER(LineShader, LineMaterial) public: - const char *vertexShader() const { - QResource r(":/scenegraph/graph/shaders/line.vsh"); - Q_ASSERT(r.isValid()); - return (const char *) r.data(); - } + LineShader() + : vsh(readResource(":/scenegraph/graph/shaders/line.vsh")), + fsh(readResource(":/scenegraph/graph/shaders/line.fsh")) + {} - const char *fragmentShader() const { - QResource r(":/scenegraph/graph/shaders/line.fsh"); - Q_ASSERT(r.isValid()); - return (const char *) r.data(); - } + const char *vertexShader() const { return vsh.constData(); } + + const char *fragmentShader() const { return fsh.constData(); } QList attributes() const { return QList() << "pos" << "t"; } @@ -84,7 +81,15 @@ public: id_color = program()->uniformLocation("color"); } + static QByteArray readResource(const char *path) { + QResource r(path); + Q_ASSERT(r.isValid()); + return QByteArray((const char *)r.data(), r.size()); + } + private: + QByteArray vsh; + QByteArray fsh; int id_color; int id_spread; int id_size; -- cgit v1.2.3 From 5dc7649f5ad7dca6e13707e827d001c3f118a6ef Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 28 Jan 2014 14:04:58 +0100 Subject: [Regression] Fix lazy binding evaluation Commit 04774bb14c81688f86a2b31b8624bde8ebf59062 long time ago introduced the concept of fixed order binding initialization with lazy evaluation, where a bit is reserved for each binding that indicates whether it's been initialized the first time or not. When reading a property on a QObject, we'd check if the corresponding binding for the property has been initialized or not and flush (i.e. execute) the binding if necessary. As part of the V4/V8 clean-up, commit 1eb41200948ab414f1c47d93123b41c547a993df removed the StoreV8Binding instruction, which made the call for setting the this-binding-is-not-evaluated-yet bit. Nowadays we only use StoreBinding, for which this optimization was never implemented (and not needed really). Now that we have a unified JS code path, we need to set the pending binding bit and also make sure that we call flushPendingBinding for any JS side property access (accelerated or not). Also flushPendingBindingImpl had two bugs: * In an attempt of trying to find the binding to flush, it could happen that we'd try to flush a previously destroyed binding (m_mePtr is null), so the b variable would remain the first binding in the object and we'd flush the wrong one (instead of none). Added a missing check to verify that the property index matches. * Also resetting the mePtr must be done through clear(), to ensure that the pointer in bindValues in the VME is also cleared, to avoid re-enabling the same binding again in complete(); Task-number: QTBUG-36441 Change-Id: Icdb0c8fb036051fd5d6c4d33b10cd0c0ed9a9d5c Reviewed-by: Lars Knoll --- src/qml/jsruntime/qv4qobjectwrapper.cpp | 3 ++- src/qml/qml/qqmlengine.cpp | 4 ++-- src/qml/qml/qqmlvme.cpp | 6 ++++++ .../auto/qml/qqmlecmascript/data/LazyBindingComponent.qml | 13 +++++++++++++ .../qml/qqmlecmascript/data/lazyBindingEvaluation.qml | 6 ++++++ tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 15 ++++++++++++++- 6 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 tests/auto/qml/qqmlecmascript/data/LazyBindingComponent.qml create mode 100644 tests/auto/qml/qqmlecmascript/data/lazyBindingEvaluation.qml diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 61f92a0f5c..cd0c81846c 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -317,7 +317,6 @@ ReturnedValue QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextD return QV4::Object::get(this, name, hasProperty); } - QQmlData::flushPendingBinding(m_object, result->coreIndex); QQmlData *ddata = QQmlData::get(m_object, false); if (revisionMode == QV4::QObjectWrapper::CheckRevision && result->hasRevision()) { @@ -338,6 +337,8 @@ ReturnedValue QObjectWrapper::getProperty(QObject *object, ExecutionContext *ctx { QV4::Scope scope(ctx); + QQmlData::flushPendingBinding(object, property->coreIndex); + if (property->isFunction() && !property->isVarProperty()) { if (property->isVMEFunction()) { QQmlVMEMetaObject *vmemo = QQmlVMEMetaObject::get(object); diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index f8e5ad5874..acc66c8ce5 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -777,8 +777,8 @@ void QQmlData::flushPendingBindingImpl(int coreIndex) while (b && *b->m_mePtr && b->propertyIndex() != coreIndex) b = b->nextBinding(); - if (b) { - b->m_mePtr = 0; + if (b && b->propertyIndex() == coreIndex) { + b->clear(); b->setEnabled(true, QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding); } diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index 1881b554ed..dfc184b9f7 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -881,6 +881,12 @@ QObject *QQmlVME::run(QList *errors, CLEAN_PROPERTY(target, QDPP::bindingIndex(instr.property)); bind->addToObject(); + + if (!instr.property.isValueTypeVirtual()) { + QQmlData *data = QQmlData::get(target); + Q_ASSERT(data); + data->setPendingBindingBit(target, instr.property.coreIndex); + } } QML_END_INSTR(StoreBinding) diff --git a/tests/auto/qml/qqmlecmascript/data/LazyBindingComponent.qml b/tests/auto/qml/qqmlecmascript/data/LazyBindingComponent.qml new file mode 100644 index 0000000000..81cb56f0e5 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/LazyBindingComponent.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 + +Item +{ + property int someInt: 4 + property var variantArray: [1, 2] + property int arrayLength: 0 + + onSomeIntChanged: + { + arrayLength = variantArray.length + } +} diff --git a/tests/auto/qml/qqmlecmascript/data/lazyBindingEvaluation.qml b/tests/auto/qml/qqmlecmascript/data/lazyBindingEvaluation.qml new file mode 100644 index 0000000000..2f55ff0709 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/lazyBindingEvaluation.qml @@ -0,0 +1,6 @@ +import QtQuick 2.1 + +LazyBindingComponent +{ + someInt: 5 +} diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index c45750caac..3f412ee6d4 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -321,6 +321,7 @@ private slots: void qtbug_34792(); void noCaptureWhenWritingProperty(); void singletonWithEnum(); + void lazyBindingEvaluation(); private: // static void propertyVarWeakRefCallback(v8::Persistent object, void* parameter); @@ -667,7 +668,7 @@ void tst_qqmlecmascript::methods() void tst_qqmlecmascript::bindingLoop() { QQmlComponent component(&engine, testFileUrl("bindingLoop.qml")); - QString warning = component.url().toString() + ":5:9: QML MyQmlObject: Binding loop detected for property \"stringProperty\""; + QString warning = component.url().toString() + ":9:9: QML MyQmlObject: Binding loop detected for property \"stringProperty\""; QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); QObject *object = component.create(); QVERIFY(object != 0); @@ -7520,6 +7521,18 @@ void tst_qqmlecmascript::singletonWithEnum() QCOMPARE(prop.toInt(), int(SingletonWithEnum::TestValue)); } +void tst_qqmlecmascript::lazyBindingEvaluation() +{ + QQmlComponent component(&engine, testFileUrl("lazyBindingEvaluation.qml")); + QScopedPointer obj(component.create()); + if (obj.isNull()) + qDebug() << component.errors().first().toString(); + QVERIFY(!obj.isNull()); + QVariant prop = obj->property("arrayLength"); + QVERIFY(prop.type() == QVariant::Int); + QCOMPARE(prop.toInt(), 2); +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" -- cgit v1.2.3 From 3c2b337c7e0b5587b25f95622fd3fd49fa29c9a9 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 6 Feb 2014 10:20:36 +0100 Subject: Improve Scene Graph - Simple Material example documentation. Change-Id: I5b77f7590c9f2cea9305014b8a9d4ab3a387eaa3 Reviewed-by: Gunnar Sletta --- .../simplematerial/doc/src/simplematerial.qdoc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc b/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc index 5d83b9fa5f..5960fac8cb 100644 --- a/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc +++ b/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc @@ -40,11 +40,11 @@ QSGMaterial, \l QSGMaterialShader and \l QSGMaterialType classes directly. - A simple material consists of two parts, the material state and + A simple material consists of two parts: the material state and the material shader. The material shader has one instance per scene graph and contains the actual OpenGL shader program and information about which attributes and uniforms it uses. The - material state is what we assign to each individual node, in this + material state is what we assign to each individual node; in this case to give them different colors. \snippet scenegraph/simplematerial/simplematerial.cpp 1 @@ -66,7 +66,7 @@ be compared. It would have been possible to remove the \c State::compare() function and instead declare the shader with \l QSG_DECLARE_SIMPLE_SHADER(), but this could then reduce performance - in certain usecases. + in certain use cases. The state struct is used as a template parameter to automatically generate a \l QSGMaterialType for us, so it is @@ -84,14 +84,14 @@ \snippet scenegraph/simplematerial/simplematerial.cpp 4 We reimplement the \c attributes function to return the name of - the \c aVertex and \c aTexCoord attribute names. These attributes + the \c aVertex and \c aTexCoord attributes. These attributes will be mapped to attribute indices 0 and 1 in the node's geometry. \snippet scenegraph/simplematerial/simplematerial.cpp 6 Uniforms can be accessed either by name or by index, where index - is faster than name, so we reimplement the \c resolveUniforms() + is faster than name. We reimplement the \c resolveUniforms() function to find the index of the \c color uniform. We do not have to worry about resolving \c qt_Opacity or \c qt_Matrix as these are handled by the baseclass. @@ -112,12 +112,12 @@ Since our shader expects both a position and a texture coordinate, we use the default attribute set \l - QSGGeometry::defaultAttributes_TexturedPoint2D() and define that + QSGGeometry::defaultAttributes_TexturedPoint2D() and declare that the geometry consists of a total of four vertices. To avoid the allocation, we make the QSGGeometry a member of the QSGGeometryNode. - When used the macro \l QSG_DECLARE_SIMPLE_COMPARABLE_SHADER() above, + When we used the macro \l QSG_DECLARE_SIMPLE_COMPARABLE_SHADER() above, it defined the \c createMaterial() function which we use to instantiate materials for our \c State struct. @@ -127,7 +127,7 @@ the node or to reorder the drawing of the node. Finally, we tell the node to take ownership of the material, so we - do not have to explicitly memorymanage it. + do not have to explicitly memory-manage it. \snippet scenegraph/simplematerial/simplematerial.cpp 8 @@ -143,11 +143,11 @@ GUI thread and \l QQuickItem::updatePaintNode() is one of the few places where it is safe to access properties of the QML object. Any interaction with the scene graph from a custom \l - QQuickItem should be contained to this function. The function is + QQuickItem should be contained within this function. The function is called on the rendering thread while the GUI thread is blocked. The first time this function is called for an \c Item instance, - the node will be 0 and we create a new one. For every consecutive + the node will be 0, and so we create a new one. For every consecutive call, the node will be what we returned previously. There are scenarios where the scene graph will be removed and rebuilt from scratch however, so one should always check the node and recreate @@ -170,7 +170,7 @@ \snippet scenegraph/simplematerial/main.qml 2 - Then we create a column of three instances of our custom item, + Then we create a column containing three instances of our custom item, each with a different color. \snippet scenegraph/simplematerial/main.qml 3 -- cgit v1.2.3 From 4e835a592901364599da364cfe2006f99e34a6c9 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Thu, 6 Feb 2014 10:42:00 +0200 Subject: Fix alignment exception in newCallContext on ARM CallContext::locals was not at multiple of 8, which caused an alignment exception on ARM. Size for the context is also increased. Change-Id: I136418f89945cd3fec74463659107c6dab7cad0a Reviewed-by: aavit Reviewed-by: Lars Knoll --- src/qml/jsruntime/qv4context.cpp | 2 +- src/qml/jsruntime/qv4context_p.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp index c2c9aefd5f..8c6d75d1de 100644 --- a/src/qml/jsruntime/qv4context.cpp +++ b/src/qml/jsruntime/qv4context.cpp @@ -91,7 +91,7 @@ CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData c->lookups = c->compilationUnit->runtimeLookups; } - c->locals = (SafeValue *)(c + 1); + c->locals = (SafeValue *)((quintptr(c + 1) + 7) & ~7); if (function->varCount) std::fill(c->locals, c->locals + function->varCount, Primitive::undefinedValue()); diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index 334d033193..9f905df15c 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -241,7 +241,7 @@ struct ExecutionContextSaver /* Function *f, int argc */ #define requiredMemoryForExecutionContect(f, argc) \ - sizeof(CallContext) + sizeof(Value) * (f->varCount + qMax((uint)argc, f->formalParameterCount)) + sizeof(CallData) + ((sizeof(CallContext) + 7) & ~7) + sizeof(Value) * (f->varCount + qMax((uint)argc, f->formalParameterCount)) + sizeof(CallData) } // namespace QV4 -- cgit v1.2.3 From b70ab35b21665510a7af85c549964ebe6d39b115 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 28 Jan 2014 20:53:01 +0100 Subject: Avoid renderlist rebuilds in the scene graph renderer. Transform, material, opacity and geometry changes all used to trigger full rebuilds, which meant that very little geometry could be retained between frames. For instance, a rotating spinner on top of a gridview this would cause a full rebuild where nothing is retained. This change introduces new concept to the renderer: partial rebuilding based on render order ranges. Since the render order of nodes is strictly defined by their position in the tree and nothing else, we should use that for the majority of rebuilds. When a change comes in for a node, we invalidate its batch and all batches which it has overlapping render orders with. Render order rebuilds only happen when nodes are added and removed. Change-Id: Ib4cb284164892b409e3fff5c492a54d60a5de2d7 Reviewed-by: Michael Brasser --- src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 67 +++++++++++++---------- src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h | 5 +- 2 files changed, 42 insertions(+), 30 deletions(-) diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 52a293871c..42a6c23982 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Jolla Ltd, author: ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtQuick module of the Qt Toolkit. @@ -316,7 +317,7 @@ void Updater::updateStates(QSGNode *n) void Updater::visitNode(Node *n) { - if (m_added == 0 && n->dirtyState == 0 && m_force_update == 0 && m_transformChange == 0) + if (m_added == 0 && n->dirtyState == 0 && m_force_update == 0 && m_transformChange == 0 && m_opacityChange == 0) return; int count = m_added; @@ -393,13 +394,10 @@ void Updater::visitOpacityNode(Node *n) if (was != is) { renderer->m_rebuild = Renderer::FullRebuild; n->isOpaque = is; - } else if (!is) { - renderer->invalidateAlphaBatchesForRoot(m_roots.last()); - renderer->m_rebuild |= Renderer::BuildBatches; } - ++m_force_update; + ++m_opacityChange; SHADOWNODE_TRAVERSE(n) visitNode(*child); - --m_force_update; + --m_opacityChange; } else { if (m_added > 0) n->isOpaque = on->opacity() > OPAQUE_LIMIT; @@ -490,9 +488,16 @@ void Updater::visitGeometryNode(Node *n) } else { renderer->m_rebuild |= Renderer::FullRebuild; } - } else if (m_transformChange) { - Element *e = n->element(); - e->translateOnlyToRoot = QMatrix4x4_Accessor::isTranslate(*gn->matrix()); + } else { + if (m_transformChange) { + Element *e = n->element(); + e->translateOnlyToRoot = QMatrix4x4_Accessor::isTranslate(*gn->matrix()); + } + if (m_opacityChange) { + Element *e = n->element(); + if (e->batch) + renderer->invalidateBatchAndOverlappingRenderOrders(e->batch); + } } SHADOWNODE_TRAVERSE(n) visitNode(*child); @@ -969,12 +974,7 @@ void Renderer::nodeWasTransformed(Node *node, int *vertexCount) e->boundsComputed = false; if (e->batch) { if (!e->batch->isOpaque) { - if (e->root) { - m_taggedRoots << e->root; - m_rebuild |= BuildRenderListsForTaggedRoots; - } else { - m_rebuild |= FullRebuild; - } + invalidateBatchAndOverlappingRenderOrders(e->batch); } else if (e->batch->merged) { e->batch->needsUpload = true; } @@ -1174,15 +1174,8 @@ void Renderer::nodeChanged(QSGNode *node, QSGNode::DirtyState state) e->boundsComputed = false; Batch *b = e->batch; if (b) { - if (!e->batch->geometryWasChanged(gn)) { - m_rebuild |= Renderer::FullRebuild; - } else if (!b->isOpaque) { - if (e->root) { - m_taggedRoots << e->root; - m_rebuild |= BuildRenderListsForTaggedRoots; - } else { - m_rebuild |= FullRebuild; - } + if (!e->batch->geometryWasChanged(gn) || !e->batch->isOpaque) { + invalidateBatchAndOverlappingRenderOrders(e->batch); } else { b->needsUpload = true; } @@ -1195,7 +1188,7 @@ void Renderer::nodeChanged(QSGNode *node, QSGNode::DirtyState state) if (e) { if (e->batch) { if (!e->batch->isMaterialCompatible(e)) - m_rebuild = Renderer::FullRebuild; + invalidateBatchAndOverlappingRenderOrders(e->batch); } else { m_rebuild |= Renderer::BuildBatches; } @@ -1425,13 +1418,26 @@ void Renderer::buildRenderListsFromScratch() buildRenderLists(rootNode()); } -void Renderer::invalidateAlphaBatchesForRoot(Node *root) +void Renderer::invalidateBatchAndOverlappingRenderOrders(Batch *batch) { + Q_ASSERT(batch); + Q_ASSERT(batch->first); + + int first = batch->first->order; + int last = batch->lastOrderInBatch; + batch->invalidate(); + for (int i=0; iroot == root || root == 0) - b->invalidate(); + if (b->first) { + int bf = b->first->order; + int bl = b->lastOrderInBatch; + if (bl > first && bf < last) + b->invalidate(); + } } + + m_rebuild |= BuildBatches; } /* Clean up batches by making it a consecutive list of "valid" @@ -1491,6 +1497,8 @@ void Renderer::prepareOpaqueBatches() next = ej; } } + + batch->lastOrderInBatch = next->order; } } @@ -1593,6 +1601,8 @@ void Renderer::prepareAlphaBatches() overlapBounds |= ej->bounds; } } + + batch->lastOrderInBatch = next->order; } @@ -2325,7 +2335,6 @@ void Renderer::render() type += " batches"; } - qDebug() << "Renderer::render()" << this << type; } diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h index 0aa84da185..379c0ee00e 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h @@ -264,6 +264,8 @@ struct Batch int vertexCount; int indexCount; + int lastOrderInBatch; + uint isOpaque : 1; uint needsUpload : 1; uint merged : 1; @@ -351,6 +353,7 @@ private: int m_added; int m_transformChange; + int m_opacityChange; QMatrix4x4 m_identityMatrix; }; @@ -422,7 +425,7 @@ private: void prepareOpaqueBatches(); bool checkOverlap(int first, int last, const Rect &bounds); void prepareAlphaBatches(); - void invalidateAlphaBatchesForRoot(Node *root); + void invalidateBatchAndOverlappingRenderOrders(Batch *batch); void uploadBatch(Batch *b); void uploadMergedElement(Element *e, int vaOffset, char **vertexData, char **zData, char **indexData, quint16 *iBase, int *indexCount); -- cgit v1.2.3 From c160190a6faed125d7ada130a28583b7d5861441 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Thu, 6 Feb 2014 22:09:03 +0800 Subject: Doc: Merge duplicated example directories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit examples/quick/customitems contains all the examples found in examples/quick/ui-components, plus 2 more (maskedmousearea and painteditem). There are some very minor differences between the duplicated files, regarding the "smooth" property. Apart from that, the examples are identical. The only file that is unique to examples/quick/ui-components is example-slideswitch.qdoc. Moving it does not change the generated HTML filename. The other examples do not produce any documentation. Change-Id: I507d9064a60fd1f3a1469c1e423d4c0a72c7dc41 Reviewed-by: Topi Reiniö --- .../slideswitch/doc/src/example-slideswitch.qdoc | 132 ++++ examples/quick/quick.pro | 1 - .../ui-components/dialcontrol/content/Dial.qml | 87 --- .../dialcontrol/content/QuitButton.qml | 52 -- .../dialcontrol/content/background.png | Bin 35876 -> 0 bytes .../ui-components/dialcontrol/content/needle.png | Bin 342 -> 0 bytes .../dialcontrol/content/needle_shadow.png | Bin 632 -> 0 bytes .../ui-components/dialcontrol/content/overlay.png | Bin 3564 -> 0 bytes .../ui-components/dialcontrol/content/quit.png | Bin 583 -> 0 bytes .../ui-components/dialcontrol/dialcontrol.qml | 100 --- .../ui-components/flipable/content/5_heart.png | Bin 3872 -> 0 bytes .../ui-components/flipable/content/9_club.png | Bin 6135 -> 0 bytes .../quick/ui-components/flipable/content/Card.qml | 80 -- .../quick/ui-components/flipable/content/back.png | Bin 1418 -> 0 bytes examples/quick/ui-components/flipable/flipable.qml | 55 -- .../progressbar/content/ProgressBar.qml | 83 -- .../progressbar/content/background.png | Bin 426 -> 0 bytes examples/quick/ui-components/progressbar/main.qml | 73 -- .../quick/ui-components/scrollbar/ScrollBar.qml | 74 -- examples/quick/ui-components/scrollbar/main.qml | 93 --- .../ui-components/scrollbar/pics/niagara_falls.jpg | Bin 142510 -> 0 bytes .../ui-components/scrollbar/scrollbar.qmlproject | 16 - .../quick/ui-components/searchbox/SearchBox.qml | 109 --- .../quick/ui-components/searchbox/images/clear.png | Bin 429 -> 0 bytes .../searchbox/images/lineedit-bg-focus.png | Bin 526 -> 0 bytes .../ui-components/searchbox/images/lineedit-bg.png | Bin 426 -> 0 bytes examples/quick/ui-components/searchbox/main.qml | 60 -- .../ui-components/searchbox/searchbox.qmlproject | 16 - .../ui-components/slideswitch/content/Switch.qml | 117 --- .../slideswitch/content/background.png | Bin 3091 -> 0 bytes .../slideswitch/content/background.svg | 23 - .../ui-components/slideswitch/content/knob.png | Bin 3101 -> 0 bytes .../ui-components/slideswitch/content/knob.svg | 867 --------------------- .../slideswitch/doc/src/example-slideswitch.qdoc | 132 ---- .../ui-components/slideswitch/slideswitch.qml | 51 -- .../ui-components/spinner/content/Spinner.qml | 70 -- .../ui-components/spinner/content/spinner-bg.png | Bin 345 -> 0 bytes .../spinner/content/spinner-select.png | Bin 320 -> 0 bytes examples/quick/ui-components/spinner/main.qml | 61 -- .../quick/ui-components/spinner/spinner.qmlproject | 16 - .../quick/ui-components/tabwidget/TabWidget.qml | 102 --- examples/quick/ui-components/tabwidget/main.qml | 99 --- examples/quick/ui-components/tabwidget/tab.png | Bin 507 -> 0 bytes .../ui-components/tabwidget/tabwidget.qmlproject | 16 - .../qmllanguageref/syntax/objectattributes.qdoc | 2 +- src/quick/items/qquickflickable.cpp | 2 +- src/quick/items/qquickflipable.cpp | 2 +- src/quick/items/qquicktranslate.cpp | 2 +- 48 files changed, 136 insertions(+), 2457 deletions(-) create mode 100644 examples/quick/customitems/slideswitch/doc/src/example-slideswitch.qdoc delete mode 100644 examples/quick/ui-components/dialcontrol/content/Dial.qml delete mode 100644 examples/quick/ui-components/dialcontrol/content/QuitButton.qml delete mode 100644 examples/quick/ui-components/dialcontrol/content/background.png delete mode 100644 examples/quick/ui-components/dialcontrol/content/needle.png delete mode 100644 examples/quick/ui-components/dialcontrol/content/needle_shadow.png delete mode 100644 examples/quick/ui-components/dialcontrol/content/overlay.png delete mode 100644 examples/quick/ui-components/dialcontrol/content/quit.png delete mode 100644 examples/quick/ui-components/dialcontrol/dialcontrol.qml delete mode 100644 examples/quick/ui-components/flipable/content/5_heart.png delete mode 100644 examples/quick/ui-components/flipable/content/9_club.png delete mode 100644 examples/quick/ui-components/flipable/content/Card.qml delete mode 100644 examples/quick/ui-components/flipable/content/back.png delete mode 100644 examples/quick/ui-components/flipable/flipable.qml delete mode 100644 examples/quick/ui-components/progressbar/content/ProgressBar.qml delete mode 100644 examples/quick/ui-components/progressbar/content/background.png delete mode 100644 examples/quick/ui-components/progressbar/main.qml delete mode 100644 examples/quick/ui-components/scrollbar/ScrollBar.qml delete mode 100644 examples/quick/ui-components/scrollbar/main.qml delete mode 100644 examples/quick/ui-components/scrollbar/pics/niagara_falls.jpg delete mode 100644 examples/quick/ui-components/scrollbar/scrollbar.qmlproject delete mode 100644 examples/quick/ui-components/searchbox/SearchBox.qml delete mode 100644 examples/quick/ui-components/searchbox/images/clear.png delete mode 100644 examples/quick/ui-components/searchbox/images/lineedit-bg-focus.png delete mode 100644 examples/quick/ui-components/searchbox/images/lineedit-bg.png delete mode 100644 examples/quick/ui-components/searchbox/main.qml delete mode 100644 examples/quick/ui-components/searchbox/searchbox.qmlproject delete mode 100644 examples/quick/ui-components/slideswitch/content/Switch.qml delete mode 100644 examples/quick/ui-components/slideswitch/content/background.png delete mode 100644 examples/quick/ui-components/slideswitch/content/background.svg delete mode 100644 examples/quick/ui-components/slideswitch/content/knob.png delete mode 100644 examples/quick/ui-components/slideswitch/content/knob.svg delete mode 100644 examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc delete mode 100644 examples/quick/ui-components/slideswitch/slideswitch.qml delete mode 100644 examples/quick/ui-components/spinner/content/Spinner.qml delete mode 100644 examples/quick/ui-components/spinner/content/spinner-bg.png delete mode 100644 examples/quick/ui-components/spinner/content/spinner-select.png delete mode 100644 examples/quick/ui-components/spinner/main.qml delete mode 100644 examples/quick/ui-components/spinner/spinner.qmlproject delete mode 100644 examples/quick/ui-components/tabwidget/TabWidget.qml delete mode 100644 examples/quick/ui-components/tabwidget/main.qml delete mode 100644 examples/quick/ui-components/tabwidget/tab.png delete mode 100644 examples/quick/ui-components/tabwidget/tabwidget.qmlproject diff --git a/examples/quick/customitems/slideswitch/doc/src/example-slideswitch.qdoc b/examples/quick/customitems/slideswitch/doc/src/example-slideswitch.qdoc new file mode 100644 index 0000000000..13df390ef5 --- /dev/null +++ b/examples/quick/customitems/slideswitch/doc/src/example-slideswitch.qdoc @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +/*! +\page qmlexampletoggleswitch.html tutorial +\title Qt Quick Examples - Toggle Switch +\brief A reusable switch component made in QML + \ingroup qtquickexamples + +This example shows how to create a reusable switch component in QML. + +The code for this example can be found in the \c examples/quick/customitems/slideswitch directory. + +The objects that compose the switch are: + +\list +\li a \c on property (the interface to interact with the switch), +\li two images (the background image and the knob), +\li two mouse regions for user interation (on the background image and on the knob), +\li two states (an \e on state and an \e off state), +\li two functions or slots to react to the user interation (\c toggle() and \c dorelease()), +\li and a transition that describe how to go from one state to the other. +\endlist + +\section1 Switch.qml +\snippet customitems/slideswitch/content/Switch.qml 0 + +\section1 Walkthrough + +\section2 Interface +\snippet customitems/slideswitch/content/Switch.qml 1 + +This property is the interface of the switch. By default, the switch is off and this property is \c false. +It can be used to activate/disactivate the switch or to query its current state. + +In this example: + +\qml +Item { + Switch { + id: mySwitch + on: true + } + Text { + text: "The switch is on" + visible: mySwitch.on == true + } +} +\endqml + +the text will only be visible when the switch is on. + +\section2 Images and user interaction +\snippet customitems/slideswitch/content/Switch.qml 4 + +First, we create the background image of the switch. +In order for the switch to toggle when the user clicks on the background, we add a \l{MouseArea} as a child item of the image. +A \c MouseArea has a \c onClicked property that is triggered when the item is clicked. For the moment we will just call a +\c toggle() function. We will see what this function does in a moment. + +\snippet customitems/slideswitch/content/Switch.qml 5 + +Then, we place the image of the knob on top of the background. +The interaction here is a little more complex. We want the knob to move with the finger when it is clicked. That is what the \c drag +property of the \c MouseArea is for. We also want to toggle the switch if the knob is released between state. We handle this case +in the \c dorelease() function that is called in the \c onReleased property. + +\section2 States +\snippet customitems/slideswitch/content/Switch.qml 6 + +We define the two states of the switch: +\list +\li In the \e on state the knob is on the right (\c x position is 78) and the \c on property is \c true. +\li In the \e off state the knob is on the left (\c x position is 1) and the \c on property is \c false. +\endlist + +For more information on states see \l{Qt Quick States}. + +\section2 Functions + +We add two JavaScript functions to our switch: + +\snippet customitems/slideswitch/content/Switch.qml 2 + +This first function is called when the background image or the knob are clicked. We simply want the switch to toggle between the two +states (\e on and \e off). + + +\snippet customitems/slideswitch/content/Switch.qml 3 + +This second function is called when the knob is released and we want to make sure that the knob does not end up between states +(neither \e on nor \e off). If it is the case call the \c toggle() function otherwise we do nothing. + +For more information on scripts see \l{JavaScript Expressions in QML Documents}. + +\section2 Transition +\snippet customitems/slideswitch/content/Switch.qml 7 + +At this point, when the switch toggles between the two states the knob will instantly change its \c x position between 1 and 78. +In order for the knob to move smoothly we add a transition that will animate the \c x property with an easing curve for a duration of 200ms. + +For more information on transitions see \l{Animation and Transitions in Qt Quick}. + +\section1 Usage +The switch can be used in a QML file, like this: +\snippet customitems/slideswitch/slideswitch.qml 0 +*/ diff --git a/examples/quick/quick.pro b/examples/quick/quick.pro index c6b7ee1c34..027faaa4c9 100644 --- a/examples/quick/quick.pro +++ b/examples/quick/quick.pro @@ -31,5 +31,4 @@ qtHaveModule(widgets) { } EXAMPLE_FILES = \ - ui-components \ shared diff --git a/examples/quick/ui-components/dialcontrol/content/Dial.qml b/examples/quick/ui-components/dialcontrol/content/Dial.qml deleted file mode 100644 index 2ae0833c28..0000000000 --- a/examples/quick/ui-components/dialcontrol/content/Dial.qml +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - id: root - property real value : 0 - - width: 210; height: 210 - - Image { source: "background.png" } - -//! [needle_shadow] - Image { - x: 96 - y: 35 - source: "needle_shadow.png" - transform: Rotation { - origin.x: 9; origin.y: 67 - angle: needleRotation.angle - } - } -//! [needle_shadow] -//! [needle] - Image { - id: needle - x: 98; y: 33 - smooth: true - source: "needle.png" - transform: Rotation { - id: needleRotation - origin.x: 5; origin.y: 65 - //! [needle angle] - angle: Math.min(Math.max(-130, root.value*2.6 - 130), 133) - Behavior on angle { - SpringAnimation { - spring: 1.4 - damping: .15 - } - } - //! [needle angle] - } - } -//! [needle] -//! [overlay] - Image { x: 21; y: 18; source: "overlay.png" } -//! [overlay] -} diff --git a/examples/quick/ui-components/dialcontrol/content/QuitButton.qml b/examples/quick/ui-components/dialcontrol/content/QuitButton.qml deleted file mode 100644 index b284caa5a5..0000000000 --- a/examples/quick/ui-components/dialcontrol/content/QuitButton.qml +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -Image { - source: "quit.png" - scale: quitMouse.pressed ? 0.8 : 1.0 - smooth: quitMouse.pressed - MouseArea { - id: quitMouse - anchors.fill: parent - anchors.margins: -10 - onClicked: Qt.quit() - } -} diff --git a/examples/quick/ui-components/dialcontrol/content/background.png b/examples/quick/ui-components/dialcontrol/content/background.png deleted file mode 100644 index 75d555d7ab..0000000000 Binary files a/examples/quick/ui-components/dialcontrol/content/background.png and /dev/null differ diff --git a/examples/quick/ui-components/dialcontrol/content/needle.png b/examples/quick/ui-components/dialcontrol/content/needle.png deleted file mode 100644 index 2d19f75039..0000000000 Binary files a/examples/quick/ui-components/dialcontrol/content/needle.png and /dev/null differ diff --git a/examples/quick/ui-components/dialcontrol/content/needle_shadow.png b/examples/quick/ui-components/dialcontrol/content/needle_shadow.png deleted file mode 100644 index 8d8a928cc5..0000000000 Binary files a/examples/quick/ui-components/dialcontrol/content/needle_shadow.png and /dev/null differ diff --git a/examples/quick/ui-components/dialcontrol/content/overlay.png b/examples/quick/ui-components/dialcontrol/content/overlay.png deleted file mode 100644 index 3860a7b590..0000000000 Binary files a/examples/quick/ui-components/dialcontrol/content/overlay.png and /dev/null differ diff --git a/examples/quick/ui-components/dialcontrol/content/quit.png b/examples/quick/ui-components/dialcontrol/content/quit.png deleted file mode 100644 index b822057d4e..0000000000 Binary files a/examples/quick/ui-components/dialcontrol/content/quit.png and /dev/null differ diff --git a/examples/quick/ui-components/dialcontrol/dialcontrol.qml b/examples/quick/ui-components/dialcontrol/dialcontrol.qml deleted file mode 100644 index 4a3e6dc78d..0000000000 --- a/examples/quick/ui-components/dialcontrol/dialcontrol.qml +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [imports] -import QtQuick 2.0 -import "content" -//! [imports] - -//! [0] -Rectangle { - color: "#545454" - width: 300; height: 300 - - //! [the dial in use] - // Dial with a slider to adjust it - Dial { - id: dial - anchors.centerIn: parent - value: slider.x * 100 / (container.width - 34) - } - //! [the dial in use] - - Rectangle { - id: container - anchors { bottom: parent.bottom; left: parent.left - right: parent.right; leftMargin: 20; rightMargin: 20 - bottomMargin: 10 - } - height: 16 - - radius: 8 - opacity: 0.7 - smooth: true - gradient: Gradient { - GradientStop { position: 0.0; color: "gray" } - GradientStop { position: 1.0; color: "white" } - } - - Rectangle { - id: slider - x: 1; y: 1; width: 30; height: 14 - radius: 6 - smooth: true - gradient: Gradient { - GradientStop { position: 0.0; color: "#424242" } - GradientStop { position: 1.0; color: "black" } - } - - MouseArea { - anchors.fill: parent - anchors.margins: -16 // Increase mouse area a lot outside the slider - drag.target: parent; drag.axis: Drag.XAxis - drag.minimumX: 2; drag.maximumX: container.width - 32 - } - } - } - QuitButton { - anchors.right: parent.right - anchors.top: parent.top - anchors.margins: 10 - } -} -//! [0] diff --git a/examples/quick/ui-components/flipable/content/5_heart.png b/examples/quick/ui-components/flipable/content/5_heart.png deleted file mode 100644 index fb59d81453..0000000000 Binary files a/examples/quick/ui-components/flipable/content/5_heart.png and /dev/null differ diff --git a/examples/quick/ui-components/flipable/content/9_club.png b/examples/quick/ui-components/flipable/content/9_club.png deleted file mode 100644 index 2545001904..0000000000 Binary files a/examples/quick/ui-components/flipable/content/9_club.png and /dev/null differ diff --git a/examples/quick/ui-components/flipable/content/Card.qml b/examples/quick/ui-components/flipable/content/Card.qml deleted file mode 100644 index 0c13a8485b..0000000000 --- a/examples/quick/ui-components/flipable/content/Card.qml +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Flipable { - id: container - - property alias source: frontImage.source - property bool flipped: true - property int xAxis: 0 - property int yAxis: 0 - property int angle: 0 - - width: front.width; height: front.height - - front: Image { id: frontImage; smooth: true } - back: Image { source: "back.png"; smooth: true } - - state: "back" - - MouseArea { anchors.fill: parent; onClicked: container.flipped = !container.flipped } - - transform: Rotation { - id: rotation; origin.x: container.width / 2; origin.y: container.height / 2 - axis.x: container.xAxis; axis.y: container.yAxis; axis.z: 0 - } - - states: State { - name: "back"; when: container.flipped - PropertyChanges { target: rotation; angle: container.angle } - } - - transitions: Transition { - ParallelAnimation { - NumberAnimation { target: rotation; properties: "angle"; duration: 600 } - SequentialAnimation { - NumberAnimation { target: container; property: "scale"; to: 0.75; duration: 300 } - NumberAnimation { target: container; property: "scale"; to: 1.0; duration: 300 } - } - } - } -} diff --git a/examples/quick/ui-components/flipable/content/back.png b/examples/quick/ui-components/flipable/content/back.png deleted file mode 100644 index f715d7487e..0000000000 Binary files a/examples/quick/ui-components/flipable/content/back.png and /dev/null differ diff --git a/examples/quick/ui-components/flipable/flipable.qml b/examples/quick/ui-components/flipable/flipable.qml deleted file mode 100644 index 5e809c2085..0000000000 --- a/examples/quick/ui-components/flipable/flipable.qml +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "content" - -Rectangle { - id: window - - width: 480; height: 320 - color: "darkgreen" - - Row { - anchors.centerIn: parent; spacing: 30 - Card { source: "content/9_club.png"; angle: 180; yAxis: 1 } - Card { source: "content/5_heart.png"; angle: 540; xAxis: 1 } - } -} diff --git a/examples/quick/ui-components/progressbar/content/ProgressBar.qml b/examples/quick/ui-components/progressbar/content/ProgressBar.qml deleted file mode 100644 index 4272e626ba..0000000000 --- a/examples/quick/ui-components/progressbar/content/ProgressBar.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - id: progressbar - - property int minimum: 0 - property int maximum: 100 - property int value: 0 - property alias color: gradient1.color - property alias secondColor: gradient2.color - - width: 250; height: 23 - clip: true - - BorderImage { - source: "background.png" - width: parent.width; height: parent.height - border { left: 4; top: 4; right: 4; bottom: 4 } - } - - Rectangle { - id: highlight - - property int widthDest: ((progressbar.width * (value - minimum)) / (maximum - minimum) - 6) - - width: highlight.widthDest - Behavior on width { SmoothedAnimation { velocity: 1200 } } - - anchors { left: parent.left; top: parent.top; bottom: parent.bottom; margins: 3 } - radius: 1 - gradient: Gradient { - GradientStop { id: gradient1; position: 0.0 } - GradientStop { id: gradient2; position: 1.0 } - } - - } - Text { - anchors { right: highlight.right; rightMargin: 6; verticalCenter: parent.verticalCenter } - color: "white" - font.bold: true - text: Math.floor((value - minimum) / (maximum - minimum) * 100) + '%' - } -} diff --git a/examples/quick/ui-components/progressbar/content/background.png b/examples/quick/ui-components/progressbar/content/background.png deleted file mode 100644 index 9044226f85..0000000000 Binary files a/examples/quick/ui-components/progressbar/content/background.png and /dev/null differ diff --git a/examples/quick/ui-components/progressbar/main.qml b/examples/quick/ui-components/progressbar/main.qml deleted file mode 100644 index 3d002d5493..0000000000 --- a/examples/quick/ui-components/progressbar/main.qml +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "content" - -Rectangle { - id: main - - width: 600; height: 405 - color: "#edecec" - - Flickable { - anchors.fill: parent - contentHeight: column.height + 20 - - Column { - id: column - x: 10; y: 10 - spacing: 10 - - Repeater { - model: 25 - - ProgressBar { - property int r: Math.floor(Math.random() * 5000 + 1000) - width: main.width - 20 - - NumberAnimation on value { duration: r; from: 0; to: 100; loops: Animation.Infinite } - ColorAnimation on color { duration: r; from: "lightsteelblue"; to: "thistle"; loops: Animation.Infinite } - ColorAnimation on secondColor { duration: r; from: "steelblue"; to: "#CD96CD"; loops: Animation.Infinite } - } - } - } - } -} diff --git a/examples/quick/ui-components/scrollbar/ScrollBar.qml b/examples/quick/ui-components/scrollbar/ScrollBar.qml deleted file mode 100644 index 114e4c3902..0000000000 --- a/examples/quick/ui-components/scrollbar/ScrollBar.qml +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - id: scrollBar - - // The properties that define the scrollbar's state. - // position and pageSize are in the range 0.0 - 1.0. They are relative to the - // height of the page, i.e. a pageSize of 0.5 means that you can see 50% - // of the height of the view. - // orientation can be either Qt.Vertical or Qt.Horizontal - property real position - property real pageSize - property variant orientation : Qt.Vertical - - // A light, semi-transparent background - Rectangle { - id: background - anchors.fill: parent - radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1) - color: "white" - opacity: 0.3 - } - - // Size the bar to the required size, depending upon the orientation. - Rectangle { - x: orientation == Qt.Vertical ? 1 : (scrollBar.position * (scrollBar.width-2) + 1) - y: orientation == Qt.Vertical ? (scrollBar.position * (scrollBar.height-2) + 1) : 1 - width: orientation == Qt.Vertical ? (parent.width-2) : (scrollBar.pageSize * (scrollBar.width-2)) - height: orientation == Qt.Vertical ? (scrollBar.pageSize * (scrollBar.height-2)) : (parent.height-2) - radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1) - color: "black" - opacity: 0.7 - } -} diff --git a/examples/quick/ui-components/scrollbar/main.qml b/examples/quick/ui-components/scrollbar/main.qml deleted file mode 100644 index a61ad266fc..0000000000 --- a/examples/quick/ui-components/scrollbar/main.qml +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Rectangle { - width: 640 - height: 480 - - // Create a flickable to view a large image. - Flickable { - id: view - anchors.fill: parent - contentWidth: picture.width - contentHeight: picture.height - - Image { - id: picture - source: "pics/niagara_falls.jpg" - asynchronous: true - } - - // Only show the scrollbars when the view is moving. - states: State { - name: "ShowBars" - when: view.movingVertically || view.movingHorizontally - PropertyChanges { target: verticalScrollBar; opacity: 1 } - PropertyChanges { target: horizontalScrollBar; opacity: 1 } - } - - transitions: Transition { - NumberAnimation { properties: "opacity"; duration: 400 } - } - } - - // Attach scrollbars to the right and bottom edges of the view. - ScrollBar { - id: verticalScrollBar - width: 12; height: view.height-12 - anchors.right: view.right - opacity: 0 - orientation: Qt.Vertical - position: view.visibleArea.yPosition - pageSize: view.visibleArea.heightRatio - } - - ScrollBar { - id: horizontalScrollBar - width: view.width-12; height: 12 - anchors.bottom: view.bottom - opacity: 0 - orientation: Qt.Horizontal - position: view.visibleArea.xPosition - pageSize: view.visibleArea.widthRatio - } -} diff --git a/examples/quick/ui-components/scrollbar/pics/niagara_falls.jpg b/examples/quick/ui-components/scrollbar/pics/niagara_falls.jpg deleted file mode 100644 index e625c0d3e6..0000000000 Binary files a/examples/quick/ui-components/scrollbar/pics/niagara_falls.jpg and /dev/null differ diff --git a/examples/quick/ui-components/scrollbar/scrollbar.qmlproject b/examples/quick/ui-components/scrollbar/scrollbar.qmlproject deleted file mode 100644 index e5a8bf02ca..0000000000 --- a/examples/quick/ui-components/scrollbar/scrollbar.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/ui-components/searchbox/SearchBox.qml b/examples/quick/ui-components/searchbox/SearchBox.qml deleted file mode 100644 index 57640eec54..0000000000 --- a/examples/quick/ui-components/searchbox/SearchBox.qml +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -FocusScope { - id: focusScope - width: 250; height: 28 - - BorderImage { - source: "images/lineedit-bg.png" - width: parent.width; height: parent.height - border { left: 4; top: 4; right: 4; bottom: 4 } - } - - BorderImage { - source: "images/lineedit-bg-focus.png" - width: parent.width; height: parent.height - border { left: 4; top: 4; right: 4; bottom: 4 } - visible: parent.activeFocus ? true : false - } - - Text { - id: typeSomething - anchors.fill: parent; anchors.leftMargin: 8 - verticalAlignment: Text.AlignVCenter - text: "Type something..." - color: "gray" - font.italic: true - } - - MouseArea { - anchors.fill: parent - onClicked: { focusScope.focus = true; textInput.openSoftwareInputPanel(); } - } - - TextInput { - id: textInput - anchors { left: parent.left; leftMargin: 8; right: clear.left; rightMargin: 8; verticalCenter: parent.verticalCenter } - focus: true - selectByMouse: true - } - - Image { - id: clear - anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter } - source: "images/clear.png" - opacity: 0 - - MouseArea { - anchors.fill: parent - onClicked: { textInput.text = ''; focusScope.focus = true; textInput.openSoftwareInputPanel(); } - } - } - - states: State { - name: "hasText"; when: textInput.text != '' - PropertyChanges { target: typeSomething; opacity: 0 } - PropertyChanges { target: clear; opacity: 1 } - } - - transitions: [ - Transition { - from: ""; to: "hasText" - NumberAnimation { exclude: typeSomething; properties: "opacity" } - }, - Transition { - from: "hasText"; to: "" - NumberAnimation { properties: "opacity" } - } - ] -} diff --git a/examples/quick/ui-components/searchbox/images/clear.png b/examples/quick/ui-components/searchbox/images/clear.png deleted file mode 100644 index 91eb270695..0000000000 Binary files a/examples/quick/ui-components/searchbox/images/clear.png and /dev/null differ diff --git a/examples/quick/ui-components/searchbox/images/lineedit-bg-focus.png b/examples/quick/ui-components/searchbox/images/lineedit-bg-focus.png deleted file mode 100644 index bbfac38d2d..0000000000 Binary files a/examples/quick/ui-components/searchbox/images/lineedit-bg-focus.png and /dev/null differ diff --git a/examples/quick/ui-components/searchbox/images/lineedit-bg.png b/examples/quick/ui-components/searchbox/images/lineedit-bg.png deleted file mode 100644 index 9044226f85..0000000000 Binary files a/examples/quick/ui-components/searchbox/images/lineedit-bg.png and /dev/null differ diff --git a/examples/quick/ui-components/searchbox/main.qml b/examples/quick/ui-components/searchbox/main.qml deleted file mode 100644 index 7478b2351c..0000000000 --- a/examples/quick/ui-components/searchbox/main.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Rectangle { - id: page - width: 500; height: 250 - color: "#edecec" - - MouseArea { - anchors.fill: parent - onClicked: page.focus = false; - } - Column { - anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter } - spacing: 10 - - SearchBox { id: search1; KeyNavigation.tab: search2; KeyNavigation.backtab: search3; focus: true } - SearchBox { id: search2; KeyNavigation.tab: search3; KeyNavigation.backtab: search1 } - SearchBox { id: search3; KeyNavigation.tab: search1; KeyNavigation.backtab: search2 } - } -} diff --git a/examples/quick/ui-components/searchbox/searchbox.qmlproject b/examples/quick/ui-components/searchbox/searchbox.qmlproject deleted file mode 100644 index e5a8bf02ca..0000000000 --- a/examples/quick/ui-components/searchbox/searchbox.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/ui-components/slideswitch/content/Switch.qml b/examples/quick/ui-components/slideswitch/content/Switch.qml deleted file mode 100644 index 51b7185b72..0000000000 --- a/examples/quick/ui-components/slideswitch/content/Switch.qml +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//![0] -import QtQuick 2.0 - -Item { - id: toggleswitch - width: background.width; height: background.height - -//![1] - property bool on: false -//![1] - -//![2] - function toggle() { - if (toggleswitch.state == "on") - toggleswitch.state = "off"; - else - toggleswitch.state = "on"; - } -//![2] - -//![3] - function releaseSwitch() { - if (knob.x == 1) { - if (toggleswitch.state == "off") return; - } - if (knob.x == 78) { - if (toggleswitch.state == "on") return; - } - toggle(); - } -//![3] - -//![4] - Image { - id: background - source: "background.png" - MouseArea { anchors.fill: parent; onClicked: toggle() } - } -//![4] - -//![5] - Image { - id: knob - x: 1; y: 2 - source: "knob.png" - - MouseArea { - anchors.fill: parent - drag.target: knob; drag.axis: Drag.XAxis; drag.minimumX: 1; drag.maximumX: 78 - onClicked: toggle() - onReleased: releaseSwitch() - } - } -//![5] - -//![6] - states: [ - State { - name: "on" - PropertyChanges { target: knob; x: 78 } - PropertyChanges { target: toggleswitch; on: true } - }, - State { - name: "off" - PropertyChanges { target: knob; x: 1 } - PropertyChanges { target: toggleswitch; on: false } - } - ] -//![6] - -//![7] - transitions: Transition { - NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad; duration: 200 } - } -//![7] -} -//![0] diff --git a/examples/quick/ui-components/slideswitch/content/background.png b/examples/quick/ui-components/slideswitch/content/background.png deleted file mode 100644 index d736815870..0000000000 Binary files a/examples/quick/ui-components/slideswitch/content/background.png and /dev/null differ diff --git a/examples/quick/ui-components/slideswitch/content/background.svg b/examples/quick/ui-components/slideswitch/content/background.svg deleted file mode 100644 index d82fd8fb83..0000000000 --- a/examples/quick/ui-components/slideswitch/content/background.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - -]> - - - - - - - - - - - - - - diff --git a/examples/quick/ui-components/slideswitch/content/knob.png b/examples/quick/ui-components/slideswitch/content/knob.png deleted file mode 100644 index ee0a436f84..0000000000 Binary files a/examples/quick/ui-components/slideswitch/content/knob.png and /dev/null differ diff --git a/examples/quick/ui-components/slideswitch/content/knob.svg b/examples/quick/ui-components/slideswitch/content/knob.svg deleted file mode 100644 index a14019298d..0000000000 --- a/examples/quick/ui-components/slideswitch/content/knob.svg +++ /dev/null @@ -1,867 +0,0 @@ - - -image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc b/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc deleted file mode 100644 index 8b0f103f0c..0000000000 --- a/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -/*! -\page qmlexampletoggleswitch.html tutorial -\title Qt Quick Examples - Toggle Switch -\brief A reusable switch component made in QML - \ingroup qtquickexamples - -This example shows how to create a reusable switch component in QML. - -The code for this example can be found in the \c examples/quick/ui-components/slideswitch directory. - -The objects that compose the switch are: - -\list -\li a \c on property (the interface to interact with the switch), -\li two images (the background image and the knob), -\li two mouse regions for user interation (on the background image and on the knob), -\li two states (an \e on state and an \e off state), -\li two functions or slots to react to the user interation (\c toggle() and \c dorelease()), -\li and a transition that describe how to go from one state to the other. -\endlist - -\section1 Switch.qml -\snippet ui-components/slideswitch/content/Switch.qml 0 - -\section1 Walkthrough - -\section2 Interface -\snippet ui-components/slideswitch/content/Switch.qml 1 - -This property is the interface of the switch. By default, the switch is off and this property is \c false. -It can be used to activate/disactivate the switch or to query its current state. - -In this example: - -\qml -Item { - Switch { - id: mySwitch - on: true - } - Text { - text: "The switch is on" - visible: mySwitch.on == true - } -} -\endqml - -the text will only be visible when the switch is on. - -\section2 Images and user interaction -\snippet ui-components/slideswitch/content/Switch.qml 4 - -First, we create the background image of the switch. -In order for the switch to toggle when the user clicks on the background, we add a \l{MouseArea} as a child item of the image. -A \c MouseArea has a \c onClicked property that is triggered when the item is clicked. For the moment we will just call a -\c toggle() function. We will see what this function does in a moment. - -\snippet ui-components/slideswitch/content/Switch.qml 5 - -Then, we place the image of the knob on top of the background. -The interaction here is a little more complex. We want the knob to move with the finger when it is clicked. That is what the \c drag -property of the \c MouseArea is for. We also want to toggle the switch if the knob is released between state. We handle this case -in the \c dorelease() function that is called in the \c onReleased property. - -\section2 States -\snippet ui-components/slideswitch/content/Switch.qml 6 - -We define the two states of the switch: -\list -\li In the \e on state the knob is on the right (\c x position is 78) and the \c on property is \c true. -\li In the \e off state the knob is on the left (\c x position is 1) and the \c on property is \c false. -\endlist - -For more information on states see \l{Qt Quick States}. - -\section2 Functions - -We add two JavaScript functions to our switch: - -\snippet ui-components/slideswitch/content/Switch.qml 2 - -This first function is called when the background image or the knob are clicked. We simply want the switch to toggle between the two -states (\e on and \e off). - - -\snippet ui-components/slideswitch/content/Switch.qml 3 - -This second function is called when the knob is released and we want to make sure that the knob does not end up between states -(neither \e on nor \e off). If it is the case call the \c toggle() function otherwise we do nothing. - -For more information on scripts see \l{JavaScript Expressions in QML Documents}. - -\section2 Transition -\snippet ui-components/slideswitch/content/Switch.qml 7 - -At this point, when the switch toggles between the two states the knob will instantly change its \c x position between 1 and 78. -In order for the knob to move smoothly we add a transition that will animate the \c x property with an easing curve for a duration of 200ms. - -For more information on transitions see \l{Animation and Transitions in Qt Quick}. - -\section1 Usage -The switch can be used in a QML file, like this: -\snippet ui-components/slideswitch/slideswitch.qml 0 -*/ diff --git a/examples/quick/ui-components/slideswitch/slideswitch.qml b/examples/quick/ui-components/slideswitch/slideswitch.qml deleted file mode 100644 index 491df1a6e7..0000000000 --- a/examples/quick/ui-components/slideswitch/slideswitch.qml +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "content" - -Rectangle { - color: "white" - width: 400; height: 250 - -//![0] - Switch { anchors.centerIn: parent; on: false } -//![0] -} diff --git a/examples/quick/ui-components/spinner/content/Spinner.qml b/examples/quick/ui-components/spinner/content/Spinner.qml deleted file mode 100644 index ceea3bed03..0000000000 --- a/examples/quick/ui-components/spinner/content/Spinner.qml +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Image { - property alias model: view.model - property alias delegate: view.delegate - property alias currentIndex: view.currentIndex - property real itemHeight: 30 - - source: "spinner-bg.png" - clip: true - - PathView { - id: view - anchors.fill: parent - - pathItemCount: height/itemHeight - preferredHighlightBegin: 0.5 - preferredHighlightEnd: 0.5 - highlight: Image { source: "spinner-select.png"; width: view.width; height: itemHeight+4 } - dragMargin: view.width/2 - - path: Path { - startX: view.width/2; startY: -itemHeight/2 - PathLine { x: view.width/2; y: view.pathItemCount*itemHeight + itemHeight } - } - } - - Keys.onDownPressed: view.incrementCurrentIndex() - Keys.onUpPressed: view.decrementCurrentIndex() -} diff --git a/examples/quick/ui-components/spinner/content/spinner-bg.png b/examples/quick/ui-components/spinner/content/spinner-bg.png deleted file mode 100644 index b3556f1f9f..0000000000 Binary files a/examples/quick/ui-components/spinner/content/spinner-bg.png and /dev/null differ diff --git a/examples/quick/ui-components/spinner/content/spinner-select.png b/examples/quick/ui-components/spinner/content/spinner-select.png deleted file mode 100644 index 95a17a1fe2..0000000000 Binary files a/examples/quick/ui-components/spinner/content/spinner-select.png and /dev/null differ diff --git a/examples/quick/ui-components/spinner/main.qml b/examples/quick/ui-components/spinner/main.qml deleted file mode 100644 index c2b26953e7..0000000000 --- a/examples/quick/ui-components/spinner/main.qml +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import "content" - -Rectangle { - width: 240; height: 320 - - Column { - y: 20; x: 20; spacing: 20 - - Spinner { - id: spinner - width: 200; height: 240 - focus: true - model: 20 - itemHeight: 30 - delegate: Text { font.pixelSize: 25; text: index; height: 30 } - } - - Text { text: "Current item index: " + spinner.currentIndex } - } -} diff --git a/examples/quick/ui-components/spinner/spinner.qmlproject b/examples/quick/ui-components/spinner/spinner.qmlproject deleted file mode 100644 index e5a8bf02ca..0000000000 --- a/examples/quick/ui-components/spinner/spinner.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/ui-components/tabwidget/TabWidget.qml b/examples/quick/ui-components/tabwidget/TabWidget.qml deleted file mode 100644 index 9400ba7d75..0000000000 --- a/examples/quick/ui-components/tabwidget/TabWidget.qml +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - id: tabWidget - - // Setting the default property to stack.children means any child items - // of the TabWidget are actually added to the 'stack' item's children. - // See the "Property Binding" - // documentation for details on default properties. - default property alias content: stack.children - - property int current: 0 - - onCurrentChanged: setOpacities() - Component.onCompleted: setOpacities() - - function setOpacities() { - for (var i = 0; i < stack.children.length; ++i) { - stack.children[i].opacity = (i == current ? 1 : 0) - } - } - - Row { - id: header - - Repeater { - model: stack.children.length - delegate: Rectangle { - width: tabWidget.width / stack.children.length; height: 36 - - Rectangle { - width: parent.width; height: 1 - anchors { bottom: parent.bottom; bottomMargin: 1 } - color: "#acb2c2" - } - BorderImage { - anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 } - border { left: 7; right: 7 } - source: "tab.png" - visible: tabWidget.current == index - } - Text { - horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter - anchors.fill: parent - text: stack.children[index].title - elide: Text.ElideRight - font.bold: tabWidget.current == index - } - MouseArea { - anchors.fill: parent - onClicked: tabWidget.current = index - } - } - } - } - - Item { - id: stack - width: tabWidget.width - anchors.top: header.bottom; anchors.bottom: tabWidget.bottom - } -} diff --git a/examples/quick/ui-components/tabwidget/main.qml b/examples/quick/ui-components/tabwidget/main.qml deleted file mode 100644 index 1ad8d44d8b..0000000000 --- a/examples/quick/ui-components/tabwidget/main.qml +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -TabWidget { - id: tabs - width: 640; height: 480 - - Rectangle { - property string title: "Red" - anchors.fill: parent - color: "#e3e3e3" - - Rectangle { - anchors.fill: parent; anchors.margins: 20 - color: "#ff7f7f" - Text { - width: parent.width - 20 - anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter - text: "Roses are red" - font.pixelSize: 20 - wrapMode: Text.WordWrap - } - } - } - - Rectangle { - property string title: "Green" - anchors.fill: parent - color: "#e3e3e3" - - Rectangle { - anchors.fill: parent; anchors.margins: 20 - color: "#7fff7f" - Text { - width: parent.width - 20 - anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter - text: "Flower stems are green" - font.pixelSize: 20 - wrapMode: Text.WordWrap - } - } - } - - Rectangle { - property string title: "Blue" - anchors.fill: parent; color: "#e3e3e3" - - Rectangle { - anchors.fill: parent; anchors.margins: 20 - color: "#7f7fff" - Text { - width: parent.width - 20 - anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter - text: "Violets are blue" - font.pixelSize: 20 - wrapMode: Text.WordWrap - } - } - } -} diff --git a/examples/quick/ui-components/tabwidget/tab.png b/examples/quick/ui-components/tabwidget/tab.png deleted file mode 100644 index ad8021605f..0000000000 Binary files a/examples/quick/ui-components/tabwidget/tab.png and /dev/null differ diff --git a/examples/quick/ui-components/tabwidget/tabwidget.qmlproject b/examples/quick/ui-components/tabwidget/tabwidget.qmlproject deleted file mode 100644 index e5a8bf02ca..0000000000 --- a/examples/quick/ui-components/tabwidget/tabwidget.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc index f336d14b14..2a9c94d22e 100644 --- a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc +++ b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc @@ -568,7 +568,7 @@ any items added to this list for an \l Item are automatically added to its list of \l {Item::children}{children}. Default properties can be useful for reassigning the children of an item. See -the \l{declarative/ui-components/tabwidget}{TabWidget example}, which uses a +the \l{declarative/customitems/tabwidget}{TabWidget example}, which uses a default property to automatically reassign children of the TabWidget as children of an inner ListView. diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index ec199a5a9b..789d1952c0 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -665,7 +665,7 @@ is finished. \dots 8 \snippet qml/flickableScrollbar.qml 1 - \sa {declarative/ui-components/scrollbar}{scrollbar example} + \sa {declarative/customitems/scrollbar}{scrollbar example} */ QQuickFlickable::QQuickFlickable(QQuickItem *parent) : QQuickItem(*(new QQuickFlickablePrivate), parent) diff --git a/src/quick/items/qquickflipable.cpp b/src/quick/items/qquickflipable.cpp index 15ebf776aa..1ea5e57656 100644 --- a/src/quick/items/qquickflipable.cpp +++ b/src/quick/items/qquickflipable.cpp @@ -127,7 +127,7 @@ public: state, and \l {Animation and Transitions in Qt Quick} for more information on how animations work within transitions. - \sa {declarative/ui-components/flipable}{Flipable example} + \sa {declarative/customitems/flipable}{Flipable example} */ QQuickFlipable::QQuickFlipable(QQuickItem *parent) : QQuickItem(*(new QQuickFlipablePrivate), parent) diff --git a/src/quick/items/qquicktranslate.cpp b/src/quick/items/qquicktranslate.cpp index f1b716cf5b..20eb1dce5b 100644 --- a/src/quick/items/qquicktranslate.cpp +++ b/src/quick/items/qquicktranslate.cpp @@ -336,7 +336,7 @@ public: \image axisrotation.png - \sa {declarative/ui-components/dialcontrol}{Dial Control example}, {Qt Quick Demo - Clocks} + \sa {declarative/customitems/dialcontrol}{Dial Control example}, {Qt Quick Demo - Clocks} */ QQuickRotation::QQuickRotation(QObject *parent) : QQuickTransform(*new QQuickRotationPrivate, parent) -- cgit v1.2.3 From a8a90519cb35481e96fe8889846bfaa424e13e8a Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 5 Feb 2014 15:55:23 -0600 Subject: Fix scenegraph backend API for material shaders. Without this change, it is not possible to implement a custom renderer (it has no way to compile or initialize material shaders). Change-Id: Ie8778f739f3551f88f0d44ccb9769063a87ff276 Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/coreapi/qsgmaterial.h | 2 +- src/quick/scenegraph/qsgcontext.cpp | 14 ++++++++++++++ src/quick/scenegraph/qsgcontext_p.h | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.h b/src/quick/scenegraph/coreapi/qsgmaterial.h index bfe570ca02..98f4d8aecf 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterial.h +++ b/src/quick/scenegraph/coreapi/qsgmaterial.h @@ -103,7 +103,7 @@ protected: Q_DECLARE_PRIVATE(QSGMaterialShader) QSGMaterialShader(QSGMaterialShaderPrivate &dd); - friend class QSGContext; + friend class QSGRenderContext; friend class QSGBatchRenderer::ShaderManager; void setShaderSourceFile(QOpenGLShader::ShaderType type, const QString &sourceFile); diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index f9bc615f5c..5135cc629c 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -445,6 +445,20 @@ void QSGRenderContext::registerFontengineForCleanup(QFontEngine *engine) m_fontEnginesToClean << engine; } +/*! + compile/initialize are protected member functions of QSGMaterialShader. + We expose them here for custom renderers. + */ +void QSGRenderContext::compileShader(QSGMaterialShader *shader) +{ + shader->compile(); +} + +void QSGRenderContext::initializeShader(QSGMaterialShader *shader) +{ + shader->initialize(); +} + /*! Initializes the scene graph render context with the GL context \a context. This also emits the ready() signal so that the QML graph can start building scene graph nodes. diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index 8378fe99b6..ef67dcceba 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -112,6 +112,9 @@ public: bool hasBrokenIndexBufferObjects() const { return m_brokenIBOs; } + void compileShader(QSGMaterialShader *shader); + void initializeShader(QSGMaterialShader *shader); + Q_SIGNALS: void initialized(); void invalidated(); -- cgit v1.2.3 From 5f6436e474624997b284547e4ee117fb49d29e79 Mon Sep 17 00:00:00 2001 From: Anders Gunnarsson Date: Tue, 12 Nov 2013 14:58:44 +0100 Subject: Updated documentation for QML Locale.measurementSystem Added documentation for ImperialUSSystem and ImperialUKSystem. Change-Id: I1a628121dce4a7566bd8769843c487e28f3dd6fe Reviewed-by: Jerome Pasion --- src/qml/qml/qqmllocale.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp index 36e0da5b60..14b5471317 100644 --- a/src/qml/qml/qqmllocale.cpp +++ b/src/qml/qml/qqmllocale.cpp @@ -1118,9 +1118,12 @@ QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::CallContext *ctx) \list \li Locale.MetricSystem This value indicates metric units, such as meters, centimeters and millimeters. - \li Locale.ImperialSystem This value indicates imperial units, such as inches and - miles. There are several distinct imperial systems in the world; this - value stands for the official United States imperial units. + \li Locale.ImperialUSSystem This value indicates imperial units, such as + inches and miles as they are used in the United States. + \li Locale.ImperialUKSystem This value indicates imperial units, such as + inches and miles as they are used in the United Kingdom. + \li Locale.ImperialSystem Provided for compatibility. The same as + Locale.ImperialUSSystem. \endlist */ -- cgit v1.2.3 From 7f0faa7fb56435ab515a6178892c420b595a899f Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 7 Feb 2014 12:23:17 +0100 Subject: Fix exception thrown in slot without Qml Engine Don't crash when an exception is thrown in a JS slot but we don't have a Qml engine. Change-Id: I1530d5c1c8cb9b9b33b9fdd0d45639fd4a0516f7 Reviewed-by: Karsten Heimrich Reviewed-by: Lars Knoll --- src/qml/jsruntime/qv4qobjectwrapper.cpp | 12 +++++++----- tests/auto/qml/qjsengine/tst_qjsengine.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index cd0c81846c..e40875dff3 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -778,11 +778,13 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase } f->call(callData); - if (scope.hasException()) { - QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx); - if (error.description().isEmpty()) - error.setDescription(QString(QLatin1String("Unknown exception occurred during evaluation of connected function: %1")).arg(f->name->toQString())); - QQmlEnginePrivate::get(v4->v8Engine->engine())->warning(error); + if (scope.hasException() && v4->v8Engine) { + if (QQmlEngine *qmlEngine = v4->v8Engine->engine()) { + QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx); + if (error.description().isEmpty()) + error.setDescription(QString(QLatin1String("Unknown exception occurred during evaluation of connected function: %1")).arg(f->name->toQString())); + QQmlEnginePrivate::get(qmlEngine)->warning(error); + } } } break; diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index ba99b34935..44c113ba13 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #ifdef Q_CC_MSVC @@ -87,6 +88,7 @@ private slots: void newQObject(); void newQObject_ownership(); void newQObject_deletedEngine(); + void exceptionInSlot(); void globalObjectProperties(); void globalObjectEquals(); void globalObjectProperties_enumerate(); @@ -150,6 +152,9 @@ private slots: void arrayPop_QTBUG_35979(); void regexpLastMatch(); + +signals: + void testSignal(); }; tst_QJSEngine::tst_QJSEngine() @@ -512,6 +517,25 @@ void tst_QJSEngine::newQObject_deletedEngine() QTRY_VERIFY(spy.count()); } +void tst_QJSEngine::exceptionInSlot() +{ + QJSEngine engine; + QJSValue wrappedThis = engine.newQObject(this); + QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); + engine.globalObject().setProperty("testCase", wrappedThis); + engine.evaluate( + "var called = false\n" + "function throwingSlot() {\n" + " called = true\n" + " throw 42;\n" + "}\n" + "testCase.testSignal.connect(throwingSlot)\n" + ); + QCOMPARE(engine.globalObject().property("called").toBool(), false); + emit testSignal(); + QCOMPARE(engine.globalObject().property("called").toBool(), true); +} + void tst_QJSEngine::globalObjectProperties() { // See ECMA-262 Section 15.1, "The Global Object". -- cgit v1.2.3 From 04fad1fc554efcf3cfb92cf1d6c223169d6a9342 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 21 Jan 2014 16:05:27 +0100 Subject: Doc: note about visible and enabled in PropertyChanges Change-Id: I0928737f1651fa98213a84dc4f8b5225d5239502 Reviewed-by: Jens Bache-Wiig --- src/quick/util/qquickpropertychanges.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp index 148c55bbcb..9eb6ec70c3 100644 --- a/src/quick/util/qquickpropertychanges.cpp +++ b/src/quick/util/qquickpropertychanges.cpp @@ -127,6 +127,11 @@ QT_BEGIN_NAMESPACE See the PropertyAction documentation for more details. + \note The \l{Item::}{visible} and \l{Item::}{enabled} properties of \l Item do not behave + exactly the same as other properties in PropertyChanges. Since these properties can be + changed implicitly through their parent's state, they should be set explicitly in all PropertyChanges. + An item will still not be enabled/visible if one of its parents is not enabled or visible. + \sa {declarative/animation/states}{states example}, {Qt Quick States}{Qt Quick States}, {Qt QML} */ -- cgit v1.2.3 From 8efc7c190b7cd57c3285ba8fcb9e17ea8f4717c2 Mon Sep 17 00:00:00 2001 From: John Brooks Date: Sun, 9 Feb 2014 02:34:25 -0700 Subject: Fix origin for short reversed item views Reversed (BottomToTop and RightToLeft) item views would report an impossible positive value for origin when contentHeight < height. The correct value will be effectively equivalent to the position of the footer, and always negative. Match other logic using lastPosition() by negating its value for reversed views. This fixes a bug with content disappearing in a Controls ScrollView on a BottomToTop view. Change-Id: Ieedbb64ce8fc7c0fb36e5256e437ddeb3e757761 Reviewed-by: Martin Jones --- src/quick/items/qquickitemview.cpp | 4 ++-- .../quick/qquicklistview/tst_qquicklistview.cpp | 28 +++++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index 5d6fc534b4..e5b2ee822c 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -1381,7 +1381,7 @@ qreal QQuickItemView::originX() const if (d->layoutOrientation() == Qt::Horizontal && effectiveLayoutDirection() == Qt::RightToLeft && contentWidth() < width()) { - return d->lastPosition() - d->footerSize(); + return -d->lastPosition() - d->footerSize(); } return QQuickFlickable::originX(); } @@ -1392,7 +1392,7 @@ qreal QQuickItemView::originY() const if (d->layoutOrientation() == Qt::Vertical && d->verticalLayoutDirection == QQuickItemView::BottomToTop && contentHeight() < height()) { - return d->lastPosition() - d->footerSize(); + return -d->lastPosition() - d->footerSize(); } return QQuickFlickable::originY(); } diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 4b52ad0071..97259e9fca 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -3919,7 +3919,8 @@ void tst_QQuickListView::extents() QFETCH(QPointF, minPos); QFETCH(QPointF, maxPos); QFETCH(QPointF, origin_empty); - QFETCH(QPointF, origin_nonEmpty); + QFETCH(QPointF, origin_short); + QFETCH(QPointF, origin_long); QQuickView *window = getView(); @@ -3956,12 +3957,20 @@ void tst_QQuickListView::extents() QCOMPARE(listview->originX(), origin_empty.x()); QCOMPARE(listview->originY(), origin_empty.y()); - for (int i=0; i<30; i++) + + for (int i=0; i<3; i++) + model.addItem("Item" + QString::number(i), ""); + listview->forceLayout(); + QTRY_COMPARE(listview->count(), model.count()); + QCOMPARE(listview->originX(), origin_short.x()); + QCOMPARE(listview->originY(), origin_short.y()); + + for (int i=3; i<30; i++) model.addItem("Item" + QString::number(i), ""); listview->forceLayout(); QTRY_COMPARE(listview->count(), model.count()); - QCOMPARE(listview->originX(), origin_nonEmpty.x()); - QCOMPARE(listview->originY(), origin_nonEmpty.y()); + QCOMPARE(listview->originX(), origin_long.x()); + QCOMPARE(listview->originY(), origin_long.y()); releaseView(window); } @@ -3976,7 +3985,8 @@ void tst_QQuickListView::extents_data() QTest::addColumn("minPos"); QTest::addColumn("maxPos"); QTest::addColumn("origin_empty"); - QTest::addColumn("origin_nonEmpty"); + QTest::addColumn("origin_short"); + QTest::addColumn("origin_long"); // header is 240x20 (or 20x320 in Horizontal orientation) // footer is 240x30 (or 30x320 in Horizontal orientation) @@ -3985,25 +3995,25 @@ void tst_QQuickListView::extents_data() << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::TopToBottom << QPointF(0, -20) << QPointF(0, 0) << QPointF(0, 20) << QPointF(240, 20) - << QPointF(0, -20) << QPointF(0, -20); + << QPointF(0, -20) << QPointF(0, -20) << QPointF(0, -20); QTest::newRow("Vertical, BottomToTop") << QQuickListView::Vertical << Qt::LeftToRight << QQuickItemView::BottomToTop << QPointF(0, 0) << QPointF(0, -30) << QPointF(0, 320 - 20) << QPointF(240, 320 - 20) // content flow is reversed - << QPointF(0, -30) << QPointF(0, (-30.0 * 30) - 30); + << QPointF(0, -30) << QPointF(0, (-30.0 * 3) - 30) << QPointF(0, (-30.0 * 30) - 30); QTest::newRow("Horizontal, LeftToRight") << QQuickListView::Horizontal << Qt::LeftToRight << QQuickItemView::TopToBottom << QPointF(-20, 0) << QPointF(0, 0) << QPointF(20, 0) << QPointF(20, 320) - << QPointF(-20, 0) << QPointF(-20, 0); + << QPointF(-20, 0) << QPointF(-20, 0) << QPointF(-20, 0); QTest::newRow("Horizontal, RightToLeft") << QQuickListView::Horizontal << Qt::RightToLeft << QQuickItemView::TopToBottom << QPointF(0, 0) << QPointF(-30, 0) << QPointF(240 - 20, 0) << QPointF(240 - 20, 320) // content flow is reversed - << QPointF(-30, 0) << QPointF((-240.0 * 30) - 30, 0); + << QPointF(-30, 0) << QPointF((-240.0 * 3) - 30, 0) << QPointF((-240.0 * 30) - 30, 0); } void tst_QQuickListView::resetModel_headerFooter() -- cgit v1.2.3 From 024c81a58dfe8b476c4cc181d6357cbab55c70c4 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 10 Feb 2014 10:59:17 +0100 Subject: Fix memory leak in test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I026ce85a6e593d5eccecdf032ee2f0763a2bef87 Reviewed-by: Jan Arve Sæther --- tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp index 0ff378e86f..4bf568745b 100644 --- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp +++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp @@ -378,11 +378,11 @@ void tst_QQuickAccessible::hitTest() void tst_QQuickAccessible::checkableTest() { - QQuickView *window = new QQuickView(); + QScopedPointer window(new QQuickView()); window->setSource(testFileUrl("checkbuttons.qml")); window->show(); - QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(window); + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(window.data()); QVERIFY(iface); QAccessibleInterface *root = iface->child(0); -- cgit v1.2.3 From 6c840c70d61c3ae277b60a024a086215c743e5b3 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 29 Jan 2014 17:23:23 +0100 Subject: Warn when attaching Keys to an invalid item Using Window { Keys.onPressed: ... } does not work because window is not a QQuickItem. Warn at least. Change-Id: Ibd472f7b551ff2089cbc39ba43da27e6f8e0e97f Reviewed-by: Mitch Curtis Reviewed-by: Caroline Chao Reviewed-by: Jens Bache-Wiig --- src/quick/items/qquickitem.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 5739d6874e..88ffc7bba3 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -1202,6 +1202,8 @@ QQuickKeysAttached::QQuickKeysAttached(QObject *parent) Q_D(QQuickKeysAttached); m_processPost = false; d->item = qmlobject_cast(parent); + if (d->item != parent) + qWarning() << "Could not attach Keys property to: " << parent << " is not an Item"; } QQuickKeysAttached::~QQuickKeysAttached() -- cgit v1.2.3