From 7f579703df80e54a61404702f854f91e2b33bb73 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 14 Oct 2010 09:46:38 +1000 Subject: Add new behavior example. --- .../declarative/animation/behaviors/wigglytext.qml | 108 +++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 examples/declarative/animation/behaviors/wigglytext.qml diff --git a/examples/declarative/animation/behaviors/wigglytext.qml b/examples/declarative/animation/behaviors/wigglytext.qml new file mode 100644 index 0000000..6cd93ab --- /dev/null +++ b/examples/declarative/animation/behaviors/wigglytext.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation 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 1.0 + +Rectangle { + id: container + + property string text: "Drag this text..." + property bool animated: true + + width: 640; height: 480; color: "#474747"; focus: true + + Keys.onPressed: { + if (event.key == Qt.Key_Delete || event.key == Qt.Key_Backspace) + container.remove() + else if (event.text != "") { + container.append(event.text) + } + } + + function append(text) { + container.animated = false + var lastLetter = container.children[container.children.length - 1] + var newLetter = letterComponent.createObject(container) + newLetter.text = text + newLetter.follow = lastLetter + container.animated = true + } + + function remove() { + if (container.children.length) + container.children[container.children.length - 1].destroy() + } + + function doLayout() { + var follow = null + for (var i = 0; i < container.text.length; ++i) { + var newLetter = letterComponent.createObject(container) + newLetter.text = container.text[i] + newLetter.follow = follow + follow = newLetter + } + } + + Component { + id: letterComponent + Text { + id: letter + property variant follow + + x: follow ? follow.x + follow.width : container.width / 3 + y: follow ? follow.y : container.height / 2 + + font.pixelSize: 40; font.bold: true + color: "#999999"; styleColor: "#222222"; style: Text.Raised + + MouseArea { + anchors.fill: parent + drag.target: letter; drag.axis: Drag.XandYAxis + onPressed: letter.color = "#dddddd" + onReleased: letter.color = "#999999" + } + + Behavior on x { enabled: container.animated; SpringAnimation { spring: 3; damping: 0.3; mass: 1.0 } } + Behavior on y { enabled: container.animated; SpringAnimation { spring: 3; damping: 0.3; mass: 1.0 } } + } + } + + Component.onCompleted: doLayout() +} -- cgit v0.12 From d2a8898e4d42fcf2c4cb51e9117690ae1616e350 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 14 Oct 2010 10:01:14 +1000 Subject: Make minehunt less cheerful An instance of failure being improperly shown as victory was rectified. Task-number: QT-3956 --- demos/declarative/minehunt/minehunt.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/demos/declarative/minehunt/minehunt.cpp b/demos/declarative/minehunt/minehunt.cpp index 9c82f30..709d945 100644 --- a/demos/declarative/minehunt/minehunt.cpp +++ b/demos/declarative/minehunt/minehunt.cpp @@ -195,6 +195,7 @@ bool MinehuntGame::flip(int row, int col) won = false; hasWonChanged(); setPlaying(false); + return true; } remaining--; @@ -202,6 +203,7 @@ bool MinehuntGame::flip(int row, int col) won = true; hasWonChanged(); setPlaying(false); + return true; } return true; } @@ -209,7 +211,7 @@ bool MinehuntGame::flip(int row, int col) bool MinehuntGame::flag(int row, int col) { TileData *t = tile(row, col); - if(!t) + if(!t || !playing) return false; t->setHasFlag(!t->hasFlag()); -- cgit v0.12 From 5dc99c2de83860c39abe56f4ad5d445508a25dd3 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 14 Oct 2010 10:08:57 +1000 Subject: Fix samegame tutorial js Turns out that subtraction is not commutative. Who knew? Task-number: QTBUG-13532 --- examples/declarative/tutorials/samegame/samegame4/content/samegame.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js index 79ff0c1..ccc3f9d 100755 --- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -145,7 +145,7 @@ function shuffleDown() { obj = board[index(column, row)]; if (obj == null) continue; - obj.x = (fallDist - column) * gameCanvas.blockSize; + obj.x = (column - fallDist) * gameCanvas.blockSize; board[index(column - fallDist, row)] = obj; board[index(column, row)] = null; } -- cgit v0.12 From 6fb13041677f00884746e7bc36e2c73f3fc5c991 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 14 Oct 2010 13:04:37 +1000 Subject: TextInput autoscroll now scrolls when the cursor moves Previously needed some actual text changes to scroll, which is incorrect Task-number: QTBUG-14230 --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 637dd77..0903427 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1464,6 +1464,7 @@ void QDeclarativeTextInputPrivate::init() void QDeclarativeTextInput::cursorPosChanged() { Q_D(QDeclarativeTextInput); + d->updateHorizontalScroll(); updateRect();//TODO: Only update rect between pos's updateMicroFocus(); emit cursorPositionChanged(); -- cgit v0.12 From 845aea67f6743c6bd095e68035985a31b56fb810 Mon Sep 17 00:00:00 2001 From: mread Date: Thu, 14 Oct 2010 13:48:29 +0100 Subject: Giving Qt a default app server when Avkon is removed Avkon provides a default app server when an app is started as a server app. This allows any app to be started as a server app. The Qt Avkon removal bypassed this, calling the base-class function instead, which prevented apps from starting as server app unless they explictly created a server. Now Qt also creates a default app server, which implements no services, so that any app can be started as a server app, even if Avkon is not present. This allows Symbian^4, configured with -no-s60, to boot. Task-number: QTBUG-14457 Reviewed-by: Jason Barron --- src/gui/s60framework/qs60mainapplication.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/s60framework/qs60mainapplication.cpp b/src/gui/s60framework/qs60mainapplication.cpp index 74432af..24d2496 100644 --- a/src/gui/s60framework/qs60mainapplication.cpp +++ b/src/gui/s60framework/qs60mainapplication.cpp @@ -47,6 +47,9 @@ #include "qs60mainapplication.h" #include #include +#ifndef Q_WS_S60 +# include +#endif QT_BEGIN_NAMESPACE @@ -152,7 +155,11 @@ CDictionaryStore *QS60MainApplication::OpenIniFileLC(RFs &aFs) const */ void QS60MainApplication::NewAppServerL(CApaAppServer *&aAppServer) { +#ifdef Q_WS_S60 QS60MainApplicationBase::NewAppServerL(aAppServer); +#else + aAppServer = new(ELeave) CEikAppServer; +#endif } QT_END_NAMESPACE -- cgit v0.12