diff options
189 files changed, 1488 insertions, 436 deletions
diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml index da144d4..c7e1a53 100644 --- a/demos/declarative/flickr/mobile/TitleBar.qml +++ b/demos/declarative/flickr/mobile/TitleBar.qml @@ -118,7 +118,7 @@ Item { name: "Tags" PropertyChanges { target: container; x: -tagButton.x + 5 } PropertyChanges { target: tagButton; text: "OK" } - PropertyChanges { target: lineEdit; focus: true } + PropertyChanges { target: editor; focus: true } } transitions: Transition { diff --git a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml index e15adbc..6109535 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml @@ -77,6 +77,6 @@ Item { MouseArea { anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 } - onClicked: textInput.forceFocus() + onClicked: { textInput.forceFocus(); textInput.openSoftwareInputPanel(); } } } diff --git a/demos/declarative/samegame/SamegameCore/Dialog.qml b/demos/declarative/samegame/SamegameCore/Dialog.qml index 8dd12f6..c71a4b3 100644 --- a/demos/declarative/samegame/SamegameCore/Dialog.qml +++ b/demos/declarative/samegame/SamegameCore/Dialog.qml @@ -47,13 +47,14 @@ Rectangle { property Item text: dialogText signal closed - + signal opened function forceClose() { page.closed(); page.opacity = 0; } function show(txt) { + page.opened(); dialogText.text = txt; page.opacity = 1; } @@ -62,7 +63,7 @@ Rectangle { color: "white" border.width: 1 opacity: 0 - + visible: opacity > 0 Behavior on opacity { NumberAnimation { duration: 1000 } } diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index 54c18d6..9a721da 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -90,17 +90,31 @@ Rectangle { enabled: initialWidth != 0 } + onOpened: nameInputText.focus = true; + onClosed: { + nameInputText.focus = false; + if (nameInputText.text != "") + Logic.saveHighScore(nameInputText.text); + } Text { id: dialogText anchors { left: nameInputDialog.left; leftMargin: 20; verticalCenter: parent.verticalCenter } text: "You won! Please enter your name: " } + MouseArea { + anchors.fill: parent + onClicked: { + if (nameInputText.text == "") + nameInputText.openSoftwareInputPanel(); + else + nameInputDialog.forceClose(); + } + } TextInput { id: nameInputText anchors { verticalCenter: parent.verticalCenter; left: dialogText.right } - focus: true - + focus: false onTextChanged: { var newWidth = nameInputText.width + dialogText.width + 40; if ( (newWidth > nameInputDialog.width && newWidth < screen.width) @@ -108,8 +122,6 @@ Rectangle { nameInputDialog.width = newWidth; } onAccepted: { - if (nameInputDialog.opacity == 1 && nameInputText.text != "") - Logic.saveHighScore(nameInputText.text); nameInputDialog.forceClose(); } } diff --git a/demos/declarative/snake/content/HighScoreModel.qml b/demos/declarative/snake/content/HighScoreModel.qml index 99799c8..42482f8 100644 --- a/demos/declarative/snake/content/HighScoreModel.qml +++ b/demos/declarative/snake/content/HighScoreModel.qml @@ -106,7 +106,7 @@ ListModel { } if (rs.rows.length > maxScores) tx.executeSql("DELETE FROM HighScores WHERE game=? AND score <= ?", - [rs.rows.item(maxScores).score]); + [game, rs.rows.item(maxScores).score]); } } ) diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js index 6f78b33..4d05e33 100644 --- a/demos/declarative/snake/content/snake.js +++ b/demos/declarative/snake/content/snake.js @@ -37,6 +37,7 @@ function startNewGame() startNewGameTimer.running = true; return; } + numRows = numRowsAvailable; numColumns = numColumnsAvailable; board = new Array(numRows * numColumns); diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 565e92c..46114f5 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -86,7 +86,7 @@ Rectangle { onTriggered: { Logic.moveSkull() } } Timer { - + id: startNewGameTimer; interval: 700; onTriggered: { Logic.startNewGame(); } } @@ -177,7 +177,6 @@ Rectangle { id: progressIndicator color: "#221edd"; width: 0; - Behavior on width { NumberAnimation { duration: startHeartbeatTimer.running ? 1000 : 0}} height: 30; } } @@ -227,4 +226,13 @@ Rectangle { } ] + transitions: [ + Transition { + from: "*" + to: "starting" + NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 } + + } + ] + } diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml index 3828a40..52164ed 100644 --- a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml @@ -148,7 +148,7 @@ Item { PropertyChanges { target: tagButton; text: "OK" } PropertyChanges { target: tagButton; width: 28 } PropertyChanges { target: tagButton; height: 24 } - PropertyChanges { target: txtEdit; focus: true } + PropertyChanges { target: editor; focus: true } } ] transitions: [ diff --git a/demos/declarative/twitter/TwitterCore/TitleBar.qml b/demos/declarative/twitter/TwitterCore/TitleBar.qml index 0cf79a3..6cd0a50 100644 --- a/demos/declarative/twitter/TwitterCore/TitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/TitleBar.qml @@ -107,7 +107,7 @@ Item { name: "Tags" PropertyChanges { target: container; x: -tagButton.x + 5 } PropertyChanges { target: tagButton; text: "OK" } - PropertyChanges { target: lineEdit; focus: true } + PropertyChanges { target: editor; focus: true } } transitions: Transition { diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index aa216cc..08cecb0 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -70,6 +70,11 @@ Item { Image { source: "TwitterCore/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } + MouseArea { + anchors.fill: parent + onClicked: screen.focus = false; + } + Twitter.RssModel { id: rssModel } Twitter.Loading { anchors.centerIn: parent; visible: rssModel.status==XmlListModel.Loading && state!='unauthed'} Text { diff --git a/demos/declarative/webbrowser/content/UrlInput.qml b/demos/declarative/webbrowser/content/UrlInput.qml index 9ea1904..b57fae6 100644 --- a/demos/declarative/webbrowser/content/UrlInput.qml +++ b/demos/declarative/webbrowser/content/UrlInput.qml @@ -73,6 +73,10 @@ Item { urlText.text = webView.url webView.focus = true } + Keys.onEnterPressed: { + container.urlEntered(urlText.text) + webView.focus = true + } Keys.onReturnPressed: { container.urlEntered(urlText.text) webView.focus = true diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index 1199b26..7a49d0a 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -118,6 +118,7 @@ application or to build completely new applications. QML is fully \l \o \l {QML Security} \o \l {QtDeclarative Module} \o \l {Debugging QML} +\o \l {QML Performance} \o \l {QML Coding Conventions} \endlist */ diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index 8f39685..cc67664 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -79,6 +79,7 @@ For example, from your build directory, run: \section2 Image Elements \list \o \l{declarative/imageelements/borderimage}{BorderImage} +\o \l{declarative/imageelements/image}{Image} \endlist \section2 Positioners diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 574b0b2..173fb6d 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -896,9 +896,13 @@ in other projects without the use of C++. Components can also help to reduce duplication inside one project by limiting the need for large numbers of copy-and-pasted blocks. -Any snippet of QML code can become a component, just by placing it in the file -"<Name>.qml" where <Name> is the new element name, and begins with an uppercase -letter. These QML files automatically become available as new QML element types +Any snippet of QML code can become a component, just by placing it in the file "<Name>.qml" +where <Name> is the new element name, and begins with an uppercase letter. Note that +the case of all characters in the <Name> are significant on some filesystems, notably +UNIX filesystems. It is recommended that the case of the filename matches the case of +the component name in QML exactly, regardless of the platform the QML will be deployed to. + +These QML files automatically become available as new QML element types to other QML components and applications in the same directory. For example, here we show how a component named "Box" is defined and used diff --git a/doc/src/declarative/qdeclarativedocument.qdoc b/doc/src/declarative/qdeclarativedocument.qdoc index bc099ce..8336512 100644 --- a/doc/src/declarative/qdeclarativedocument.qdoc +++ b/doc/src/declarative/qdeclarativedocument.qdoc @@ -96,9 +96,6 @@ Once created, instances are not dependent on the component that created them, so operate on independent data. Here is an example of a simple "Button" component that is instantiated four times, each with a different value for its \c text property. -\table -\row -\o \raw HTML <table><tr><td> \endraw @@ -125,10 +122,19 @@ BorderImage { \raw HTML </td> </tr> </table> \endraw -\endtable -In addition to the top-level component that all QML documents define, documents may also -include additional \e inline components. Inline components are declared using the +Any snippet of QML code can become a component, just by placing it in the file "<Name>.qml" +where <Name> is the new element name, and begins with an uppercase letter. Note that +the case of all characters in the <Name> are significant on some filesystems, notably +UNIX filesystems. It is recommended that the case of the filename matches the case of +the component name in QML exactly, regardless of the platform the QML will be deployed to. + +These QML files automatically become available as new QML element types +to other QML components and applications in the same directory. + +In addition to the top-level component that all QML documents define, and any reusable +components placed in separate files, documents may also +include \e inline components. Inline components are declared using the \l Component element, as can be seen in the first example above. Inline components share all the characteristics of regular top-level components and use the same \c import list as their containing QML document. Components are one of the most basic building blocks in QML, and are diff --git a/doc/src/declarative/qdeclarativeperformance.qdoc b/doc/src/declarative/qdeclarativeperformance.qdoc new file mode 100644 index 0000000..b535e4b --- /dev/null +++ b/doc/src/declarative/qdeclarativeperformance.qdoc @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** 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 documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qdeclarativeperformance.html +\title QML Performance + +\section1 Opaque Items + +Items hidden behind an opaque item incur a cost. If an item will be enitrely +obscured by an opaque item, set its opacity to 0. One common example of +this is when a "details" page is shown over the main application view. + +\section1 Clipping + +\e clip is set to false by default. Enable clipping only when necessary. + +\section1 Anchors vs. Binding + +It is more efficient to use anchors rather than bindings to position items +relative to each other. Consider this use of bindings to position rect2 +relative to rect1: + +\code +Rectangle { + id: rect1 + x: 20 + width: 200; height: 200 +} +Rectange { + id: rect2 + x: rect1.x + y: rect1.y + rect1.height + width: rect1.width - 20 + height: 200 +} +\endcode + +This is achieved more efficiently using anchors: + +\code +Rectangle { + id: rect1 + x: 20 + width: 200; height: 200 +} +Rectange { + id: rect2 + height: 200 + anchors.left: rect1.left + anchors.top: rect1.bottom + anchors.right: rect1.right + anchors.rightMargin: 20 +} +\endcode + +\section1 Images + +Images consume a great deal of memory and may also be costly to load. In order +to deal with large images efficiently it is recommended that the Image::sourceSize +property be set to a size no greater than that necessary to render it. Beware that +changing the sourceSize will cause the image to be reloaded. + +Images on the local filesystem are usually loaded synchronously. This is usually +the desired behavior for user interface elements, however for large images that +do not necessarily need to be visible immediately, set the Image::asynchronous +property to true. This will load the image in a low priority thread. + +\section1 View Delegates + +Delegates must be created quickly as the view is flicked. There are two important +aspects to maintaining a smooth view: + +\list +\o Small delegates - keep the amount of QML to a minimum. Have just enough +QML in the delegate to display the necessary information. Any additional functionality +that is only needed when the delegate is clicked, for example, should be created by +a Loader as needed. +\o Fast data access - ensure the data model is as fast as possible. +\endlist + +*/ diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc index cef5e63..66b4b2b 100644 --- a/doc/src/declarative/qmlruntime.qdoc +++ b/doc/src/declarative/qmlruntime.qdoc @@ -152,7 +152,7 @@ \section2 Runtime Object - All applications using the launcher will have access to the 'runtime' + All applications using the launcher will have access to the \c runtime property on the root context. This property contains several pieces of information about the runtime environment of the application. @@ -160,11 +160,19 @@ A special piece of dummy data which is integrated into the launcher is a simple orientation property. The orientation can be set via the - settings menu in the application, or by pressing Ctrl+T to toggle it. + settings menu in the application, or by pressing Ctrl+T to rotate it. - To use this from within your QML file, access runtime.orientation, - which can be either Orientation.Landscape or Orientation.Portrait and which can be bound to in your - application. An example is below: + To use this from within your QML file, access \c runtime.orientation, + which can be one of the following values: + + \list + \o \c Orientation.Portrait + \o \c Orientation.Landscape + \o \c Orientation.PortraitInverted (Portrait orientation, upside-down) + \o \c Orientation.LandscapeInverted (Landscape orientation, upside-down) + \endlist + + These values can be bound to in your application. For example: \code Item { @@ -172,13 +180,13 @@ } \endcode - This allows your application to respond to the orientation of the screen changing. The launcher + This allows your application to respond to changes in the screen's orientation. The launcher will automatically update this on some platforms (currently the N900 only) to match the physical screen's orientation. On other plaforms orientation changes will only happen when explictly asked for. \section3 Window Active - The runtime.isActiveWindow property tells whether the main window of the launcher is currently active + The \c runtime.isActiveWindow property tells whether the main window of the launcher is currently active or not. This is especially useful for embedded devices when you want to pause parts of your application, including animations, when your application loses focus or goes to the background. diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 035628e..9dbf853 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -75,6 +75,15 @@ */ /*! + \title Image Elements: Image + \example declarative/imageelements/image + + This example shows how to use the Image element and its \l{Image::fillMode}{fillModes}. + + \image qml-image-example.png +*/ + +/*! \page declarative-cppextensions-reference.html \title C++ Extensions: Reference examples diff --git a/doc/src/images/qml-image-example.png b/doc/src/images/qml-image-example.png Binary files differnew file mode 100644 index 0000000..c1951c0 --- /dev/null +++ b/doc/src/images/qml-image-example.png diff --git a/examples/declarative/imageelements/image/ImageCell.qml b/examples/declarative/imageelements/image/ImageCell.qml new file mode 100644 index 0000000..bd232b9 --- /dev/null +++ b/examples/declarative/imageelements/image/ImageCell.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** 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 QtDeclarative module 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 Qt 4.7 + +Item { + property alias mode: image.fillMode + property alias caption: captionItem.text + + width: parent.cellWidth; height: parent.cellHeight + + Image { + id: image + width: parent.width; height: parent.height - captionItem.height + source: "face-smile.png" + clip: true // only makes a difference if mode is PreserveAspectCrop + smooth: true + } + + Text { + id: captionItem + anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom + } +} diff --git a/examples/declarative/imageelements/image/face-smile.png b/examples/declarative/imageelements/image/face-smile.png Binary files differnew file mode 100644 index 0000000..3d66d72 --- /dev/null +++ b/examples/declarative/imageelements/image/face-smile.png diff --git a/examples/declarative/imageelements/image/image.qml b/examples/declarative/imageelements/image/image.qml new file mode 100644 index 0000000..bc5ae37 --- /dev/null +++ b/examples/declarative/imageelements/image/image.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** 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 QtDeclarative module 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 Qt 4.7 + +Rectangle { + width: 490 + height: 285 + + Grid { + property int cellWidth: (width - (spacing * (columns - 1))) / columns + property int cellHeight: (height - (spacing * (rows - 1))) / rows + + anchors.fill: parent + anchors.margins: 30 + + columns: 3 + rows: 2 + spacing: 30 + + ImageCell { mode: Image.Stretch; caption: "Stretch" } + ImageCell { mode: Image.PreserveAspectFit; caption: "PreserveAspectFit" } + ImageCell { mode: Image.PreserveAspectCrop; caption: "PreserveAspectCrop" } + + ImageCell { mode: Image.Tile; caption: "Tile" } + ImageCell { mode: Image.TileHorizontally; caption: "TileHorizontally" } + ImageCell { mode: Image.TileVertically; caption: "TileVertically" } + } +} diff --git a/examples/declarative/imageelements/image/image.qmlproject b/examples/declarative/imageelements/image/image.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/imageelements/image/image.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/modelviews/listview/dynamic.qml b/examples/declarative/modelviews/listview/dynamic.qml index cf0e387..df2e094 100644 --- a/examples/declarative/modelviews/listview/dynamic.qml +++ b/examples/declarative/modelviews/listview/dynamic.qml @@ -95,6 +95,7 @@ Rectangle { id: fruitDelegate Item { + id: wrapper width: container.width; height: 55 Column { @@ -169,6 +170,38 @@ Rectangle { MouseArea { anchors.fill:parent; onClicked: fruitModel.remove(index) } } + + // Animate adding and removing items + ListView.delayRemove: true // so that the item is not destroyed immediately + ListView.onAdd: state = "add" + ListView.onRemove: state = "remove" + states: [ + State { + name: "add" + PropertyChanges { target: wrapper; height: 55; clip: true } + }, + State { + name: "remove" + PropertyChanges { target: wrapper; height: 0; clip: true } + } + ] + transitions: [ + Transition { + to: "add" + SequentialAnimation { + NumberAnimation { properties: "height"; from: 0; to: 55 } + PropertyAction { target: wrapper; property: "state"; value: "" } + } + }, + Transition { + to: "remove" + SequentialAnimation { + NumberAnimation { properties: "height" } + // Make sure delayRemove is set back to false so that the item can be destroyed + PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false } + } + } + ] } } diff --git a/examples/declarative/text/edit/edit.qml b/examples/declarative/text/edit/edit.qml index 0be42e9..4668ab2 100644 --- a/examples/declarative/text/edit/edit.qml +++ b/examples/declarative/text/edit/edit.qml @@ -121,6 +121,9 @@ Rectangle { onClicked: { if (editor.state == "") { edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y); + if (!edit.focus) + edit.focus = true; + edit.openSoftwareInputPanel(); } } function hitHandle(h,x,y) { return x>=h.x+flick.contentX && x<h.x+flick.contentX+h.width && y>=h.y+flick.contentY && y<h.y+flick.contentY+h.height } diff --git a/examples/declarative/toys/corkboards/Day.qml b/examples/declarative/toys/corkboards/Day.qml index f9c901f..cc297b1 100644 --- a/examples/declarative/toys/corkboards/Day.qml +++ b/examples/declarative/toys/corkboards/Day.qml @@ -49,6 +49,11 @@ Component { Image { source: "cork.jpg" } + MouseArea { + anchors.fill: parent + onClicked: page.focus = false; + } + Text { text: name; x: 15; y: 8; height: 40; width: 370 font.pixelSize: 18; font.bold: true; color: "white" @@ -106,7 +111,7 @@ Component { drag.maximumY: page.height - 80 drag.minimumX: 100 drag.maximumX: page.width - 140 - onClicked: { myText.focus = true } + onClicked: { myText.focus = true; myText.openSoftwareInputPanel(); } } } } diff --git a/examples/declarative/toys/dynamicscene/dynamicscene.qml b/examples/declarative/toys/dynamicscene/dynamicscene.qml index 659a257..1edb841 100644 --- a/examples/declarative/toys/dynamicscene/dynamicscene.qml +++ b/examples/declarative/toys/dynamicscene/dynamicscene.qml @@ -50,7 +50,12 @@ Item { //This is a desktop-sized example width: 800; height: 480 - + + MouseArea { + anchors.fill: parent + onClicked: window.focus = false; + } + //This is the message box that pops up when there's an error Rectangle { id: dialog diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml index d235d35..c216c08 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml @@ -58,10 +58,12 @@ Rectangle { function showWithInput(text) { show(text); textInput.opacity = 1; + textInput.focus = true; textInput.text = "" } function hide() { + textInput.focus = false; container.opacity = 0; container.closed(); } @@ -70,6 +72,7 @@ Rectangle { width: dialogText.width + textInput.width + 20 height: dialogText.height + 20 opacity: 0 + visible: opacity > 0 Text { id: dialogText @@ -82,7 +85,6 @@ Rectangle { id: textInput anchors { verticalCenter: parent.verticalCenter; left: dialogText.right } width: 80 - focus: true text: "" onAccepted: container.hide() // close dialog when Enter is pressed @@ -91,7 +93,13 @@ Rectangle { MouseArea { anchors.fill: parent - onClicked: hide(); + + onClicked: { + if (textInput.text == "" && textInput.opacity > 0) + textInput.openSoftwareInputPanel(); + else + hide(); + } } //![3] diff --git a/examples/declarative/ui-components/searchbox/SearchBox.qml b/examples/declarative/ui-components/searchbox/SearchBox.qml index c022626..eaa6b6b 100644 --- a/examples/declarative/ui-components/searchbox/SearchBox.qml +++ b/examples/declarative/ui-components/searchbox/SearchBox.qml @@ -66,7 +66,7 @@ FocusScope { font.italic: true } - MouseArea { anchors.fill: parent; onClicked: focusScope.focus = true } + MouseArea { anchors.fill: parent; onClicked: { focusScope.focus = true; textInput.openSoftwareInputPanel(); } } TextInput { id: textInput @@ -82,7 +82,7 @@ FocusScope { MouseArea { anchors.fill: parent - onClicked: { textInput.text = ''; focusScope.focus = true } + onClicked: { textInput.text = ''; focusScope.focus = true; textInput.openSoftwareInputPanel(); } } } diff --git a/examples/declarative/ui-components/searchbox/main.qml b/examples/declarative/ui-components/searchbox/main.qml index 0508d5a..bf3bed8 100644 --- a/examples/declarative/ui-components/searchbox/main.qml +++ b/examples/declarative/ui-components/searchbox/main.qml @@ -41,9 +41,14 @@ import Qt 4.7 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 diff --git a/src/declarative/3rdparty/3rdparty.pri b/src/declarative/3rdparty/3rdparty.pri deleted file mode 100644 index fbdcc11..0000000 --- a/src/declarative/3rdparty/3rdparty.pri +++ /dev/null @@ -1,7 +0,0 @@ -INCLUDEPATH += $$PWD - -HEADERS += \ - $$PWD/qlistmodelinterface_p.h\ - -SOURCES += \ - $$PWD/qlistmodelinterface.cpp \ diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro index 8037a16..510e7a5 100644 --- a/src/declarative/declarative.pro +++ b/src/declarative/declarative.pro @@ -20,7 +20,6 @@ include(../qbase.pri) #DESTDIR=. #modules -include(3rdparty/3rdparty.pri) include(util/util.pri) include(graphicsitems/graphicsitems.pri) include(qml/qml.pri) diff --git a/src/declarative/graphicsitems/qdeclarativeanchors.cpp b/src/declarative/graphicsitems/qdeclarativeanchors.cpp index aa53aba..6796977 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanchors.cpp @@ -53,6 +53,30 @@ QT_BEGIN_NAMESPACE //TODO: should we cache relationships, so we don't have to check each time (parent-child or sibling)? //TODO: support non-parent, non-sibling (need to find lowest common ancestor) +static qreal hcenter(QGraphicsItem *i) +{ + QGraphicsItemPrivate *item = QGraphicsItemPrivate::get(i); + + qreal width = item->width(); + int iw = width; + if (iw % 2) + return (width + 1) / 2; + else + return width / 2; +} + +static qreal vcenter(QGraphicsItem *i) +{ + QGraphicsItemPrivate *item = QGraphicsItemPrivate::get(i); + + qreal height = item->height(); + int ih = height; + if (ih % 2) + return (height + 1) / 2; + else + return height / 2; +} + //### const item? //local position static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine) @@ -73,10 +97,10 @@ static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine ret = item->y() + d->height(); break; case QDeclarativeAnchorLine::HCenter: - ret = item->x() + d->width()/2; + ret = item->x() + hcenter(item); break; case QDeclarativeAnchorLine::VCenter: - ret = item->y() + d->height()/2; + ret = item->y() + vcenter(item); break; case QDeclarativeAnchorLine::Baseline: if (d->isDeclarativeItem) @@ -108,10 +132,10 @@ static qreal adjustedPosition(QGraphicsObject *item, QDeclarativeAnchorLine::Anc ret = d->height(); break; case QDeclarativeAnchorLine::HCenter: - ret = d->width()/2; + ret = hcenter(item); break; case QDeclarativeAnchorLine::VCenter: - ret = d->height()/2; + ret = vcenter(item); break; case QDeclarativeAnchorLine::Baseline: if (d->isDeclarativeItem) @@ -192,14 +216,14 @@ void QDeclarativeAnchorsPrivate::centerInChanged() QGraphicsItemPrivate *itemPrivate = QGraphicsItemPrivate::get(item); if (centerIn == item->parentItem()) { QGraphicsItemPrivate *parentPrivate = QGraphicsItemPrivate::get(item->parentItem()); - QPointF p((parentPrivate->width() - itemPrivate->width()) / 2. + hCenterOffset, - (parentPrivate->height() - itemPrivate->height()) / 2. + vCenterOffset); + QPointF p(hcenter(item->parentItem()) - hcenter(item) + hCenterOffset, + vcenter(item->parentItem()) - vcenter(item) + vCenterOffset); setItemPos(p); } else if (centerIn->parentItem() == item->parentItem()) { QGraphicsItemPrivate *centerPrivate = QGraphicsItemPrivate::get(centerIn); - QPointF p(centerIn->x() + (centerPrivate->width() - itemPrivate->width()) / 2. + hCenterOffset, - centerIn->y() + (centerPrivate->height() - itemPrivate->height()) / 2. + vCenterOffset); + QPointF p(centerIn->x() + hcenter(centerIn) - hcenter(item) + hCenterOffset, + centerIn->y() + vcenter(centerIn) - vcenter(item) + vCenterOffset); setItemPos(p); } @@ -535,9 +559,9 @@ void QDeclarativeAnchorsPrivate::updateVerticalAnchors() //Handle vCenter if (vCenter.item == item->parentItem()) { setItemY(adjustedPosition(vCenter.item, vCenter.anchorLine) - - itemPrivate->height()/2 + vCenterOffset); + - vcenter(item) + vCenterOffset); } else if (vCenter.item->parentItem() == item->parentItem()) { - setItemY(position(vCenter.item, vCenter.anchorLine) - itemPrivate->height()/2 + vCenterOffset); + setItemY(position(vCenter.item, vCenter.anchorLine) - vcenter(item) + vCenterOffset); } } else if (usedAnchors & QDeclarativeAnchors::BaselineAnchor) { //Handle baseline @@ -604,9 +628,9 @@ void QDeclarativeAnchorsPrivate::updateHorizontalAnchors() } else if (usedAnchors & QDeclarativeAnchors::HCenterAnchor) { //Handle hCenter if (hCenter.item == item->parentItem()) { - setItemX(adjustedPosition(hCenter.item, hCenter.anchorLine) - itemPrivate->width()/2 + hCenterOffset); + setItemX(adjustedPosition(hCenter.item, hCenter.anchorLine) - hcenter(item) + hCenterOffset); } else if (hCenter.item->parentItem() == item->parentItem()) { - setItemX(position(hCenter.item, hCenter.anchorLine) - itemPrivate->width()/2 + hCenterOffset); + setItemX(position(hCenter.item, hCenter.anchorLine) - hcenter(item) + hCenterOffset); } } diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index ffffc2f..82c69a0 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -108,6 +108,7 @@ public: , highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightXAnimator(0), highlightYAnimator(0) , highlightMoveDuration(150) + , footerComponent(0), footer(0), headerComponent(0), header(0) , bufferMode(BufferBefore | BufferAfter), snapMode(QDeclarativeGridView::NoSnap) , ownModel(false), wrap(false), autoHighlight(true) , fixCurrentVisibility(false), lazyRelease(false), layoutScheduled(false) @@ -128,6 +129,8 @@ public: void createHighlight(); void updateHighlight(); void updateCurrent(int modelIndex); + void updateHeader(); + void updateFooter(); void fixupPosition(); FxGridItem *visibleItem(int modelIndex) const { @@ -230,6 +233,18 @@ public: return visibleItems.count() ? visibleItems.first() : 0; } + int lastVisibleIndex() const { + int lastIndex = -1; + for (int i = visibleItems.count()-1; i >= 0; --i) { + FxGridItem *gridItem = visibleItems.at(i); + if (gridItem->index != -1) { + lastIndex = gridItem->index; + break; + } + } + return lastIndex; + } + // Map a model index to visibleItems list index. // These may differ if removed items are still present in the visible list, // e.g. doing a removal animation @@ -283,6 +298,9 @@ public: scheduleLayout(); } } + } else if ((header && header->item == item) || (footer && footer->item == item)) { + updateHeader(); + updateFooter(); } } @@ -330,6 +348,10 @@ public: QSmoothedAnimation *highlightXAnimator; QSmoothedAnimation *highlightYAnimator; int highlightMoveDuration; + QDeclarativeComponent *footerComponent; + FxGridItem *footer; + QDeclarativeComponent *headerComponent; + FxGridItem *header; enum BufferMode { NoBuffer = 0x00, BufferBefore = 0x01, BufferAfter = 0x02 }; int bufferMode; QDeclarativeGridView::SnapMode snapMode; @@ -412,7 +434,6 @@ void QDeclarativeGridViewPrivate::refill(qreal from, qreal to, bool doBuffer) Q_Q(QDeclarativeGridView); if (!isValid() || !q->isComponentComplete()) return; - itemCount = model->count(); qreal bufferFrom = from - buffer; qreal bufferTo = to + buffer; @@ -522,6 +543,10 @@ void QDeclarativeGridViewPrivate::refill(qreal from, qreal to, bool doBuffer) deferredRelease = true; } if (changed) { + if (header) + updateHeader(); + if (footer) + updateFooter(); if (flow == QDeclarativeGridView::LeftToRight) q->setContentHeight(endPosition() - startPosition()); else @@ -579,6 +604,10 @@ void QDeclarativeGridViewPrivate::layout() item->setPosition(colPos, rowPos); } } + if (header) + updateHeader(); + if (footer) + updateFooter(); q->refill(); updateHighlight(); moveReason = Other; @@ -742,6 +771,94 @@ void QDeclarativeGridViewPrivate::updateCurrent(int modelIndex) releaseItem(oldCurrentItem); } +void QDeclarativeGridViewPrivate::updateFooter() +{ + Q_Q(QDeclarativeGridView); + if (!footer && footerComponent) { + QDeclarativeItem *item = 0; + QDeclarativeContext *context = new QDeclarativeContext(qmlContext(q)); + QObject *nobj = footerComponent->create(context); + if (nobj) { + QDeclarative_setParent_noEvent(context, nobj); + item = qobject_cast<QDeclarativeItem *>(nobj); + if (!item) + delete nobj; + } else { + delete context; + } + if (item) { + QDeclarative_setParent_noEvent(item, q->viewport()); + item->setParentItem(q->viewport()); + item->setZValue(1); + QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item)); + itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); + footer = new FxGridItem(item, q); + } + } + if (footer) { + if (visibleItems.count()) { + qreal endPos = endPosition(); + if (lastVisibleIndex() == model->count()-1) { + footer->setPosition(0, endPos); + } else { + qreal visiblePos = position() + q->height(); + if (endPos <= visiblePos || footer->endRowPos() < endPos) + footer->setPosition(0, endPos); + } + } else { + qreal endPos = 0; + if (header) { + endPos += flow == QDeclarativeGridView::LeftToRight + ? header->item->height() + : header->item->width(); + } + footer->setPosition(0, endPos); + } + } +} + +void QDeclarativeGridViewPrivate::updateHeader() +{ + Q_Q(QDeclarativeGridView); + if (!header && headerComponent) { + QDeclarativeItem *item = 0; + QDeclarativeContext *context = new QDeclarativeContext(qmlContext(q)); + QObject *nobj = headerComponent->create(context); + if (nobj) { + QDeclarative_setParent_noEvent(context, nobj); + item = qobject_cast<QDeclarativeItem *>(nobj); + if (!item) + delete nobj; + } else { + delete context; + } + if (item) { + QDeclarative_setParent_noEvent(item, q->viewport()); + item->setParentItem(q->viewport()); + item->setZValue(1); + QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item)); + itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); + header = new FxGridItem(item, q); + } + } + if (header) { + if (visibleItems.count()) { + qreal startPos = startPosition(); + qreal headerSize = flow == QDeclarativeGridView::LeftToRight + ? header->item->height() + : header->item->width(); + if (visibleIndex == 0) { + header->setPosition(0, startPos - headerSize); + } else { + if (position() <= startPos || header->rowPos() > startPos - headerSize) + header->setPosition(0, startPos - headerSize); + } + } else { + header->setPosition(0, 0); + } + } +} + void QDeclarativeGridViewPrivate::fixupPosition() { moveReason = Other; @@ -958,6 +1075,8 @@ QDeclarativeGridView::~QDeclarativeGridView() d->clear(); if (d->ownModel) delete d->model; + delete d->header; + delete d->footer; } /*! @@ -1524,6 +1643,67 @@ void QDeclarativeGridView::setSnapMode(SnapMode mode) } } +/*! + \qmlproperty Component GridView::footer + This property holds the component to use as the footer. + + An instance of the footer component is created for each view. The + footer is positioned at the end of the view, after any items. + + \sa header +*/ +QDeclarativeComponent *QDeclarativeGridView::footer() const +{ + Q_D(const QDeclarativeGridView); + return d->footerComponent; +} + +void QDeclarativeGridView::setFooter(QDeclarativeComponent *footer) +{ + Q_D(QDeclarativeGridView); + if (d->footerComponent != footer) { + if (d->footer) { + delete d->footer; + d->footer = 0; + } + d->footerComponent = footer; + d->updateFooter(); + d->updateGrid(); + emit footerChanged(); + } +} + +/*! + \qmlproperty Component GridView::header + This property holds the component to use as the header. + + An instance of the header component is created for each view. The + header is positioned at the beginning of the view, before any items. + + \sa footer +*/ +QDeclarativeComponent *QDeclarativeGridView::header() const +{ + Q_D(const QDeclarativeGridView); + return d->headerComponent; +} + +void QDeclarativeGridView::setHeader(QDeclarativeComponent *header) +{ + Q_D(QDeclarativeGridView); + if (d->headerComponent != header) { + if (d->header) { + delete d->header; + d->header = 0; + } + d->headerComponent = header; + d->updateHeader(); + d->updateFooter(); + d->updateGrid(); + emit headerChanged(); + } +} + bool QDeclarativeGridView::event(QEvent *event) { Q_D(QDeclarativeGridView); @@ -1590,6 +1770,8 @@ qreal QDeclarativeGridView::minYExtent() const if (d->flow == QDeclarativeGridView::TopToBottom) return QDeclarativeFlickable::minYExtent(); qreal extent = -d->startPosition(); + if (d->header && d->visibleItems.count()) + extent += d->header->item->height(); if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { extent += d->highlightRangeStart; extent = qMax(extent, -(d->rowPosAt(0) + d->rowSize() - d->highlightRangeEnd)); @@ -1610,6 +1792,8 @@ qreal QDeclarativeGridView::maxYExtent() const } else { extent = -(d->endPosition() - height()); } + if (d->footer) + extent -= d->footer->item->height(); const qreal minY = minYExtent(); if (extent > minY) extent = minY; @@ -1622,6 +1806,8 @@ qreal QDeclarativeGridView::minXExtent() const if (d->flow == QDeclarativeGridView::LeftToRight) return QDeclarativeFlickable::minXExtent(); qreal extent = -d->startPosition(); + if (d->header && d->visibleItems.count()) + extent += d->header->item->width(); if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { extent += d->highlightRangeStart; extent = qMax(extent, -(d->rowPosAt(0) + d->rowSize() - d->highlightRangeEnd)); @@ -1642,6 +1828,8 @@ qreal QDeclarativeGridView::maxXExtent() const } else { extent = -(d->endPosition() - height()); } + if (d->footer) + extent -= d->footer->item->width(); const qreal minX = minXExtent(); if (extent > minX) extent = minX; diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index 2bf154c..021aad9 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -80,6 +80,9 @@ class Q_DECLARATIVE_EXPORT QDeclarativeGridView : public QDeclarativeFlickable Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged) + Q_PROPERTY(QDeclarativeComponent *header READ header WRITE setHeader NOTIFY headerChanged) + Q_PROPERTY(QDeclarativeComponent *footer READ footer WRITE setFooter NOTIFY footerChanged) + Q_ENUMS(HighlightRangeMode) Q_ENUMS(SnapMode) Q_ENUMS(Flow) @@ -142,6 +145,12 @@ public: SnapMode snapMode() const; void setSnapMode(SnapMode mode); + QDeclarativeComponent *footer() const; + void setFooter(QDeclarativeComponent *); + + QDeclarativeComponent *header() const; + void setHeader(QDeclarativeComponent *); + enum PositionMode { Beginning, Center, End, Visible, Contain }; Q_INVOKABLE void positionViewAtIndex(int index, int mode); @@ -172,6 +181,8 @@ Q_SIGNALS: void keyNavigationWrapsChanged(); void cacheBufferChanged(); void snapModeChanged(); + void headerChanged(); + void footerChanged(); protected: virtual bool event(QEvent *event); diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 9949e65..bef09bb 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1633,7 +1633,7 @@ void QDeclarativeItemPrivate::data_append(QDeclarativeListProperty<QObject> *pro QObject *QDeclarativeItemPrivate::resources_at(QDeclarativeListProperty<QObject> *prop, int index) { - QObjectList children = prop->object->children(); + const QObjectList children = prop->object->children(); if (index < children.count()) return children.at(index); else @@ -2391,6 +2391,28 @@ void QDeclarativeItem::forceFocus() } } + +/*! + \qmlmethod Item::childAt(real x, real y) + + Returns the visible child item at point (\a x, \a y), which is in this + item's coordinate system, or \c null if there is no such item. + */ +QDeclarativeItem *QDeclarativeItem::childAt(qreal x, qreal y) const +{ + const QList<QGraphicsItem *> children = childItems(); + for (int i = children.count()-1; i >= 0; --i) { + if (QDeclarativeItem *child = qobject_cast<QDeclarativeItem *>(children.at(i))) { + if (child->isVisible() && child->x() <= x + && child->x() + child->width() >= x + && child->y() <= y + && child->y() + child->height() >= y) + return child; + } + } + return 0; +} + void QDeclarativeItemPrivate::focusChanged(bool flag) { Q_Q(QDeclarativeItem); diff --git a/src/declarative/graphicsitems/qdeclarativeitem.h b/src/declarative/graphicsitems/qdeclarativeitem.h index 77e316b..4f420f8 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.h +++ b/src/declarative/graphicsitems/qdeclarativeitem.h @@ -148,6 +148,7 @@ public: Q_INVOKABLE QScriptValue mapFromItem(const QScriptValue &item, qreal x, qreal y) const; Q_INVOKABLE QScriptValue mapToItem(const QScriptValue &item, qreal x, qreal y) const; Q_INVOKABLE void forceFocus(); + Q_INVOKABLE QDeclarativeItem *childAt(qreal x, qreal y) const; Q_SIGNALS: void childrenChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index dbd1976..f2cc971 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -427,6 +427,10 @@ public: scheduleLayout(); } } + if ((header && header->item == item) || (footer && footer->item == item)) { + updateHeader(); + updateFooter(); + } if (currentItem && currentItem->item == item) updateHighlight(); if (trackedItem && trackedItem->item == item) @@ -1045,6 +1049,8 @@ void QDeclarativeListViewPrivate::updateFooter() QDeclarative_setParent_noEvent(item, q->viewport()); item->setParentItem(q->viewport()); item->setZValue(1); + QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item)); + itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); footer = new FxListItem(item, q); } } @@ -1083,6 +1089,8 @@ void QDeclarativeListViewPrivate::updateHeader() QDeclarative_setParent_noEvent(item, q->viewport()); item->setParentItem(q->viewport()); item->setZValue(1); + QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item)); + itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); header = new FxListItem(item, q); if (visibleItems.isEmpty()) visiblePos = header->size(); @@ -2074,6 +2082,15 @@ void QDeclarativeListView::setSnapMode(SnapMode mode) } } +/*! + \qmlproperty Component ListView::footer + This property holds the component to use as the footer. + + An instance of the footer component is created for each view. The + footer is positioned at the end of the view, after any items. + + \sa header +*/ QDeclarativeComponent *QDeclarativeListView::footer() const { Q_D(const QDeclarativeListView); @@ -2097,6 +2114,15 @@ void QDeclarativeListView::setFooter(QDeclarativeComponent *footer) } } +/*! + \qmlproperty Component ListView::header + This property holds the component to use as the header. + + An instance of the header component is created for each view. The + header is positioned at the beginning of the view, before any items. + + \sa footer +*/ QDeclarativeComponent *QDeclarativeListView::header() const { Q_D(const QDeclarativeListView); diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index 20cc46b..18618ab 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -219,6 +219,7 @@ void QDeclarativeBasePositioner::prePositioning() QDeclarativeItem *child = qobject_cast<QDeclarativeItem *>(children.at(ii)); if (!child) continue; + QDeclarativeItemPrivate *childPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(child)); PositionedItem *item = 0; PositionedItem posItem(child); int wIdx = oldItems.find(posItem); @@ -227,11 +228,13 @@ void QDeclarativeBasePositioner::prePositioning() positionedItems.append(posItem); item = &positionedItems[positionedItems.count()-1]; item->isNew = true; - if (child->opacity() <= 0.0 || !child->isVisible()) + if (child->opacity() <= 0.0 || childPrivate->explicitlyHidden) item->isVisible = false; } else { item = &oldItems[wIdx]; - if (child->opacity() <= 0.0 || !child->isVisible()) { + // Items are only omitted from positioning if they are explicitly hidden + // i.e. their positioning is not affected if an ancestor is hidden. + if (child->opacity() <= 0.0 || childPrivate->explicitlyHidden) { item->isVisible = false; } else if (!item->isVisible) { item->isVisible = true; @@ -299,6 +302,12 @@ void QDeclarativeBasePositioner::finishApplyTransitions() d->moveActions.clear(); } +static inline bool isInvisible(QDeclarativeItem *child) +{ + QDeclarativeItemPrivate *childPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(child)); + return child->opacity() == 0.0 || childPrivate->explicitlyHidden || !child->width() || !child->height(); +} + /*! \qmlclass Column QDeclarativeColumn \since 4.7 @@ -416,11 +425,6 @@ QDeclarativeColumn::QDeclarativeColumn(QDeclarativeItem *parent) { } -static inline bool isInvisible(QDeclarativeItem *child) -{ - return child->opacity() == 0.0 || !child->isVisible() || !child->width() || !child->height(); -} - void QDeclarativeColumn::doPositioning(QSizeF *contentSize) { int voffset = 0; diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h index 04f0181..822079b 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h @@ -100,18 +100,23 @@ public: bool doingPositioning : 1; bool anchorConflict : 1; - virtual void itemSiblingOrderChanged(QDeclarativeItem* other) + void schedulePositioning() { Q_Q(QDeclarativeBasePositioner); - Q_UNUSED(other); if(!queuedPositioning){ - //Delay is due to many children often being reordered at once - //And we only want to reposition them all once QTimer::singleShot(0,q,SLOT(prePositioning())); queuedPositioning = true; } } + virtual void itemSiblingOrderChanged(QDeclarativeItem* other) + { + Q_UNUSED(other); + //Delay is due to many children often being reordered at once + //And we only want to reposition them all once + schedulePositioning(); + } + void itemGeometryChanged(QDeclarativeItem *, const QRectF &newGeometry, const QRectF &oldGeometry) { Q_Q(QDeclarativeBasePositioner); @@ -120,8 +125,7 @@ public: } virtual void itemVisibilityChanged(QDeclarativeItem *) { - Q_Q(QDeclarativeBasePositioner); - q->prePositioning(); + schedulePositioning(); } virtual void itemOpacityChanged(QDeclarativeItem *) { diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 94973f2..c086851 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -1391,9 +1391,9 @@ void QDeclarativeTextEditPrivate::updateDefaultTextOption() your application. By default the opening of input panels follows the platform style. On Symbian^1 and - Symbian^3 -based devices the panels are opened by clicking TextEdit and need to be - manually closed by the user. On other platforms the panels are automatically opened - when TextEdit element gains focus and closed when the focus is lost. + Symbian^3 -based devices the panels are opened by clicking TextEdit. On other platforms + the panels are automatically opened when TextEdit element gains focus. Input panels are + always closed if no editor owns focus. . You can disable the automatic behavior by setting the property \c focusOnPress to false and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement @@ -1415,9 +1415,9 @@ void QDeclarativeTextEditPrivate::updateDefaultTextOption() textEdit.openSoftwareInputPanel(); } else { textEdit.focus = false; - textEdit.closeSoftwareInputPanel(); } } + onPressAndHold: textEdit.closeSoftwareInputPanel(); } } \endcode @@ -1442,9 +1442,9 @@ void QDeclarativeTextEdit::openSoftwareInputPanel() your application. By default the opening of input panels follows the platform style. On Symbian^1 and - Symbian^3 -based devices the panels are opened by clicking TextEdit and need to be - manually closed by the user. On other platforms the panels are automatically opened - when TextEdit element gains focus and closed when the focus is lost. + Symbian^3 -based devices the panels are opened by clicking TextEdit. On other platforms + the panels are automatically opened when TextEdit element gains focus. Input panels are + always closed if no editor owns focus. . You can disable the automatic behavior by setting the property \c focusOnPress to false and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement @@ -1466,9 +1466,9 @@ void QDeclarativeTextEdit::openSoftwareInputPanel() textEdit.openSoftwareInputPanel(); } else { textEdit.focus = false; - textEdit.closeSoftwareInputPanel(); } } + onPressAndHold: textEdit.closeSoftwareInputPanel(); } } \endcode @@ -1489,22 +1489,11 @@ void QDeclarativeTextEdit::focusInEvent(QFocusEvent *event) { Q_D(const QDeclarativeTextEdit); if (d->showInputPanelOnFocus) { - if (d->focusOnPress && !isReadOnly() && event->reason() != Qt::ActiveWindowFocusReason) { + if (d->focusOnPress && !isReadOnly()) { openSoftwareInputPanel(); } } QDeclarativePaintedItem::focusInEvent(event); } -void QDeclarativeTextEdit::focusOutEvent(QFocusEvent *event) -{ - Q_D(const QDeclarativeTextEdit); - if (d->showInputPanelOnFocus) { - if (d->focusOnPress && !isReadOnly()) { - closeSoftwareInputPanel(); - } - } - QDeclarativePaintedItem::focusOutEvent(event); -} - QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 0ecb2f3..d08f607 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -247,7 +247,6 @@ protected: void keyPressEvent(QKeyEvent *); void keyReleaseEvent(QKeyEvent *); void focusInEvent(QFocusEvent *event); - void focusOutEvent(QFocusEvent *event); // mouse filter? void mousePressEvent(QGraphicsSceneMouseEvent *event); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 1202101..b877c50 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1234,9 +1234,9 @@ void QDeclarativeTextInput::moveCursorSelection(int position) your application. By default the opening of input panels follows the platform style. On Symbian^1 and - Symbian^3 -based devices the panels are opened by clicking TextInput and need to be - manually closed by the user. On other platforms the panels are automatically opened - when TextInput element gains focus and closed when the focus is lost. + Symbian^3 -based devices the panels are opened by clicking TextInput. On other platforms + the panels are automatically opened when TextInput element gains focus. Input panels are + always closed if no editor owns focus. . You can disable the automatic behavior by setting the property \c focusOnPress to false and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement @@ -1258,9 +1258,9 @@ void QDeclarativeTextInput::moveCursorSelection(int position) textInput.openSoftwareInputPanel(); } else { textInput.focus = false; - textInput.closeSoftwareInputPanel(); } } + onPressAndHold: textInput.closeSoftwareInputPanel(); } } \endqml @@ -1285,9 +1285,9 @@ void QDeclarativeTextInput::openSoftwareInputPanel() your application. By default the opening of input panels follows the platform style. On Symbian^1 and - Symbian^3 -based devices the panels are opened by clicking TextInput and need to be - manually closed by the user. On other platforms the panels are automatically opened - when TextInput element gains focus and closed when the focus is lost. + Symbian^3 -based devices the panels are opened by clicking TextInput. On other platforms + the panels are automatically opened when TextInput element gains focus. Input panels are + always closed if no editor owns focus. . You can disable the automatic behavior by setting the property \c focusOnPress to false and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement @@ -1309,9 +1309,9 @@ void QDeclarativeTextInput::openSoftwareInputPanel() textInput.openSoftwareInputPanel(); } else { textInput.focus = false; - textInput.closeSoftwareInputPanel(); } } + onPressAndHold: textInput.closeSoftwareInputPanel(); } } \endqml @@ -1333,24 +1333,13 @@ void QDeclarativeTextInput::focusInEvent(QFocusEvent *event) { Q_D(const QDeclarativeTextInput); if (d->showInputPanelOnFocus) { - if (d->focusOnPress && !isReadOnly() && event->reason() != Qt::ActiveWindowFocusReason) { + if (d->focusOnPress && !isReadOnly()) { openSoftwareInputPanel(); } } QDeclarativePaintedItem::focusInEvent(event); } -void QDeclarativeTextInput::focusOutEvent(QFocusEvent *event) -{ - Q_D(const QDeclarativeTextInput); - if (d->showInputPanelOnFocus) { - if (d->focusOnPress && !isReadOnly()) { - closeSoftwareInputPanel(); - } - } - QDeclarativePaintedItem::focusOutEvent(event); -} - void QDeclarativeTextInputPrivate::init() { Q_Q(QDeclarativeTextInput); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index e34634a..c539bd3 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -224,7 +224,6 @@ protected: void keyPressEvent(QKeyEvent* ev); bool event(QEvent *e); void focusInEvent(QFocusEvent *event); - void focusOutEvent(QFocusEvent *event); public Q_SLOTS: void selectAll(); diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp index dbc25bb..c17ec95 100644 --- a/src/declarative/qml/qdeclarativevaluetype.cpp +++ b/src/declarative/qml/qdeclarativevaluetype.cpp @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE +Q_DECL_IMPORT extern int qt_defaultDpi(); + template<typename T> int qmlRegisterValueTypeEnums(const char *qmlName) { @@ -909,6 +911,11 @@ void QDeclarativeFontValueType::setStrikeout(bool b) qreal QDeclarativeFontValueType::pointSize() const { + if (font.pointSizeF() == -1) { + if (dpi.isNull) + dpi = qt_defaultDpi(); + return font.pixelSize() * qreal(72.) / qreal(dpi); + } return font.pointSizeF(); } @@ -929,6 +936,11 @@ void QDeclarativeFontValueType::setPointSize(qreal size) int QDeclarativeFontValueType::pixelSize() const { + if (font.pixelSize() == -1) { + if (dpi.isNull) + dpi = qt_defaultDpi(); + return (font.pointSizeF() * dpi) / qreal(72.); + } return font.pixelSize(); } diff --git a/src/declarative/qml/qdeclarativevaluetype_p.h b/src/declarative/qml/qdeclarativevaluetype_p.h index 3eaecc1..4b1bbd6 100644 --- a/src/declarative/qml/qdeclarativevaluetype_p.h +++ b/src/declarative/qml/qdeclarativevaluetype_p.h @@ -55,6 +55,7 @@ #include "qdeclarativeproperty.h" #include "private/qdeclarativeproperty_p.h" +#include "private/qdeclarativenullablevalue_p_p.h" #include <QtCore/qobject.h> #include <QtCore/qrect.h> @@ -547,6 +548,7 @@ private: QFont font; bool pixelSizeSet; bool pointSizeSet; + mutable QDeclarativeNullableValue<int> dpi; }; QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 0eae136..1447532 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -2132,52 +2132,39 @@ QAbstractAnimation *QDeclarativePropertyAnimation::qtAnimation() return d->va; } -struct PropertyUpdater : public QDeclarativeBulkValueUpdater +void QDeclarativeAnimationPropertyUpdater::setValue(qreal v) { - QDeclarativeStateActions actions; - int interpolatorType; //for Number/ColorAnimation - int prevInterpolatorType; //for generic - QVariantAnimation::Interpolator interpolator; - bool reverse; - bool fromSourced; - bool fromDefined; - bool *wasDeleted; - PropertyUpdater() : prevInterpolatorType(0), wasDeleted(0) {} - ~PropertyUpdater() { if (wasDeleted) *wasDeleted = true; } - void setValue(qreal v) - { - bool deleted = false; - wasDeleted = &deleted; - if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1 - v = 1 - v; - for (int ii = 0; ii < actions.count(); ++ii) { - QDeclarativeAction &action = actions[ii]; - - if (v == 1.) - QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); - else { - if (!fromSourced && !fromDefined) { - action.fromValue = action.property.read(); - if (interpolatorType) - QDeclarativePropertyAnimationPrivate::convertVariant(action.fromValue, interpolatorType); - } - if (!interpolatorType) { - int propType = action.property.propertyType(); - if (!prevInterpolatorType || prevInterpolatorType != propType) { - prevInterpolatorType = propType; - interpolator = QVariantAnimationPrivate::getInterpolator(prevInterpolatorType); - } + bool deleted = false; + wasDeleted = &deleted; + if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1 + v = 1 - v; + for (int ii = 0; ii < actions.count(); ++ii) { + QDeclarativeAction &action = actions[ii]; + + if (v == 1.) + QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); + else { + if (!fromSourced && !fromDefined) { + action.fromValue = action.property.read(); + if (interpolatorType) + QDeclarativePropertyAnimationPrivate::convertVariant(action.fromValue, interpolatorType); + } + if (!interpolatorType) { + int propType = action.property.propertyType(); + if (!prevInterpolatorType || prevInterpolatorType != propType) { + prevInterpolatorType = propType; + interpolator = QVariantAnimationPrivate::getInterpolator(prevInterpolatorType); } - if (interpolator) - QDeclarativePropertyPrivate::write(action.property, interpolator(action.fromValue.constData(), action.toValue.constData(), v), QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } - if (deleted) - return; + if (interpolator) + QDeclarativePropertyPrivate::write(action.property, interpolator(action.fromValue.constData(), action.toValue.constData(), v), QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } - wasDeleted = 0; - fromSourced = true; + if (deleted) + return; } -}; + wasDeleted = 0; + fromSourced = true; +} void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions, QDeclarativeProperties &modified, @@ -2207,7 +2194,7 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions props << d->defaultProperties.split(QLatin1Char(',')); } - PropertyUpdater *data = new PropertyUpdater; + QDeclarativeAnimationPropertyUpdater *data = new QDeclarativeAnimationPropertyUpdater; data->interpolatorType = d->interpolatorType; data->interpolator = d->interpolator; data->reverse = direction == Backward ? true : false; @@ -2786,7 +2773,7 @@ void QDeclarativeAnchorAnimation::transition(QDeclarativeStateActions &actions, { Q_UNUSED(modified); Q_D(QDeclarativeAnchorAnimation); - PropertyUpdater *data = new PropertyUpdater; + QDeclarativeAnimationPropertyUpdater *data = new QDeclarativeAnimationPropertyUpdater; data->interpolatorType = QMetaType::QReal; data->interpolator = d->interpolator; diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h index e7cd8a8..3f8fbdd 100644 --- a/src/declarative/util/qdeclarativeanimation_p.h +++ b/src/declarative/util/qdeclarativeanimation_p.h @@ -384,7 +384,7 @@ Q_SIGNALS: }; class QDeclarativeAnimationGroupPrivate; -class QDeclarativeAnimationGroup : public QDeclarativeAbstractAnimation +class Q_AUTOTEST_EXPORT QDeclarativeAnimationGroup : public QDeclarativeAbstractAnimation { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeAnimationGroup) diff --git a/src/declarative/util/qdeclarativeanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h index 3b0f52e..b6d6bbb 100644 --- a/src/declarative/util/qdeclarativeanimation_p_p.h +++ b/src/declarative/util/qdeclarativeanimation_p_p.h @@ -96,7 +96,7 @@ private: }; //performs an action of type QAbstractAnimationAction -class QActionAnimation : public QAbstractAnimation +class Q_AUTOTEST_EXPORT QActionAnimation : public QAbstractAnimation { Q_OBJECT public: @@ -143,7 +143,7 @@ public: }; //animates QDeclarativeBulkValueUpdater (assumes start and end values will be reals or compatible) -class QDeclarativeBulkValueAnimator : public QVariantAnimation +class Q_AUTOTEST_EXPORT QDeclarativeBulkValueAnimator : public QVariantAnimation { Q_OBJECT public: @@ -378,6 +378,22 @@ public: QList<QDeclarativeItem*> targets; }; +class Q_AUTOTEST_EXPORT QDeclarativeAnimationPropertyUpdater : public QDeclarativeBulkValueUpdater +{ +public: + QDeclarativeStateActions actions; + int interpolatorType; //for Number/ColorAnimation + int prevInterpolatorType; //for generic + QVariantAnimation::Interpolator interpolator; + bool reverse; + bool fromSourced; + bool fromDefined; + bool *wasDeleted; + QDeclarativeAnimationPropertyUpdater() : prevInterpolatorType(0), wasDeleted(0) {} + ~QDeclarativeAnimationPropertyUpdater() { if (wasDeleted) *wasDeleted = true; } + void setValue(qreal v); +}; + QT_END_NAMESPACE #endif // QDECLARATIVEANIMATION_P_H diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index dc2b2cc..eca90a4 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -187,6 +187,13 @@ void QDeclarativeState::setName(const QString &n) { Q_D(QDeclarativeState); d->name = n; + d->named = true; +} + +bool QDeclarativeState::isNamed() const +{ + Q_D(const QDeclarativeState); + return d->named; } bool QDeclarativeState::isWhenKnown() const diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h index 37b24cb..2e2ce7b 100644 --- a/src/declarative/util/qdeclarativestate_p.h +++ b/src/declarative/util/qdeclarativestate_p.h @@ -146,6 +146,7 @@ public: QString name() const; void setName(const QString &); + bool isNamed() const; /*'when' is a QDeclarativeBinding to limit state changes oscillation due to the unpredictable order of evaluation of bound expressions*/ diff --git a/src/declarative/util/qdeclarativestate_p_p.h b/src/declarative/util/qdeclarativestate_p_p.h index 4a2af0f..2ef9bb0 100644 --- a/src/declarative/util/qdeclarativestate_p_p.h +++ b/src/declarative/util/qdeclarativestate_p_p.h @@ -101,12 +101,13 @@ class QDeclarativeStatePrivate : public QObjectPrivate public: QDeclarativeStatePrivate() - : when(0), inState(false), group(0) {} + : when(0), named(false), inState(false), group(0) {} typedef QList<QDeclarativeSimpleAction> SimpleActionList; QString name; QDeclarativeBinding *when; + bool named; struct OperationGuard : public QDeclarativeGuard<QDeclarativeStateOperation> { diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp index 9b042d7..1e530a1 100644 --- a/src/declarative/util/qdeclarativestategroup.cpp +++ b/src/declarative/util/qdeclarativestategroup.cpp @@ -263,7 +263,7 @@ void QDeclarativeStateGroup::componentComplete() for (int ii = 0; ii < d->states.count(); ++ii) { QDeclarativeState *state = d->states.at(ii); - if (state->name().isEmpty()) + if (!state->isNamed()) state->setName(QLatin1String("anonymousState") % QString::number(++d->unnamedCount)); } @@ -295,7 +295,7 @@ bool QDeclarativeStateGroupPrivate::updateAutoState() for (int ii = 0; ii < states.count(); ++ii) { QDeclarativeState *state = states.at(ii); if (state->isWhenKnown()) { - if (!state->name().isEmpty()) { + if (state->isNamed()) { if (state->when() && state->when()->evaluate().toBool()) { if (stateChangeDebug()) qWarning() << "Setting auto state due to:" diff --git a/src/declarative/3rdparty/qlistmodelinterface.cpp b/src/declarative/util/qlistmodelinterface.cpp index 98d6a5b..98d6a5b 100644 --- a/src/declarative/3rdparty/qlistmodelinterface.cpp +++ b/src/declarative/util/qlistmodelinterface.cpp diff --git a/src/declarative/3rdparty/qlistmodelinterface_p.h b/src/declarative/util/qlistmodelinterface_p.h index 07592ad..07592ad 100644 --- a/src/declarative/3rdparty/qlistmodelinterface_p.h +++ b/src/declarative/util/qlistmodelinterface_p.h diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri index f20bba1..04cfc68 100644 --- a/src/declarative/util/util.pri +++ b/src/declarative/util/util.pri @@ -27,7 +27,8 @@ SOURCES += \ $$PWD/qdeclarativebehavior.cpp \ $$PWD/qdeclarativefontloader.cpp \ $$PWD/qdeclarativestyledtext.cpp \ - $$PWD/qdeclarativelistmodelworkeragent.cpp + $$PWD/qdeclarativelistmodelworkeragent.cpp \ + $$PWD/qlistmodelinterface.cpp HEADERS += \ $$PWD/qdeclarativeutilmodule_p.h\ @@ -61,7 +62,8 @@ HEADERS += \ $$PWD/qdeclarativebehavior_p.h \ $$PWD/qdeclarativefontloader_p.h \ $$PWD/qdeclarativestyledtext_p.h \ - $$PWD/qdeclarativelistmodelworkeragent_p.h + $$PWD/qdeclarativelistmodelworkeragent_p.h \ + $$PWD/qlistmodelinterface_p.h contains(QT_CONFIG, xmlpatterns) { QT+=xmlpatterns diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index d6ac3aa..3db66ce 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -2437,6 +2437,9 @@ void QTextCursor::beginEditBlock() if (!d || !d->priv) return; + if (d->priv->editBlock == 0) // we are the initial edit block, store current cursor position for undo + d->priv->editBlockCursorPosition = d->position; + d->priv->beginEditBlock(); } diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index e2bca04..f3cd481 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -192,6 +192,7 @@ QTextDocumentPrivate::QTextDocumentPrivate() initialBlockCharFormatIndex(-1) // set correctly later in init() { editBlock = 0; + editBlockCursorPosition = -1; docChangeFrom = -1; undoState = 0; @@ -967,6 +968,10 @@ int QTextDocumentPrivate::undoRedo(bool undo) editPos = -1; break; } + case QTextUndoCommand::CursorMoved: + editPos = c.pos; + editLength = 0; + break; case QTextUndoCommand::Custom: resetBlockRevision = -1; // ## TODO if (undo) @@ -1046,6 +1051,18 @@ void QTextDocumentPrivate::appendUndoItem(const QTextUndoCommand &c) if (undoState < undoStack.size()) clearUndoRedoStacks(QTextDocument::RedoStack); + if (editBlock != 0 && editBlockCursorPosition >= 0) { // we had a beginEditBlock() with a cursor position + if (c.pos != (quint32) editBlockCursorPosition) { // and that cursor position is different from the command + // generate a CursorMoved undo item + QT_INIT_TEXTUNDOCOMMAND(cc, QTextUndoCommand::CursorMoved, true, QTextUndoCommand::MoveCursor, + 0, 0, editBlockCursorPosition, 0, 0); + undoStack.append(cc); + undoState++; + editBlockCursorPosition = -1; + } + } + + if (!undoStack.isEmpty() && modified) { QTextUndoCommand &last = undoStack[undoState - 1]; @@ -1167,6 +1184,8 @@ void QTextDocumentPrivate::endEditBlock() } } + editBlockCursorPosition = -1; + finishEdit(); } diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h index ac5ed3c..d1bd698 100644 --- a/src/gui/text/qtextdocument_p.h +++ b/src/gui/text/qtextdocument_p.h @@ -132,6 +132,7 @@ public: BlockAdded = 6, BlockDeleted = 7, GroupFormatChange = 8, + CursorMoved = 9, Custom = 256 }; enum Operation { @@ -315,6 +316,7 @@ private: bool modified; int editBlock; + int editBlockCursorPosition; int docChangeFrom; int docChangeOldLength; int docChangeLength; diff --git a/src/imports/particles/qdeclarativeparticles.cpp b/src/imports/particles/qdeclarativeparticles.cpp index ecc6604..630c068 100644 --- a/src/imports/particles/qdeclarativeparticles.cpp +++ b/src/imports/particles/qdeclarativeparticles.cpp @@ -241,11 +241,13 @@ void QDeclarativeParticleMotionGravity::setAcceleration(qreal accel) void QDeclarativeParticleMotionGravity::advance(QDeclarativeParticle &p, int interval) { - qreal xdiff = p.x - _xAttr; - qreal ydiff = p.y - _yAttr; + qreal xdiff = _xAttr - p.x; + qreal ydiff = _yAttr - p.y; + qreal absXdiff = qAbs(xdiff); + qreal absYdiff = qAbs(ydiff); - qreal xcomp = xdiff / (xdiff + ydiff); - qreal ycomp = ydiff / (xdiff + ydiff); + qreal xcomp = xdiff / (absXdiff + absYdiff); + qreal ycomp = ydiff / (absXdiff + absYdiff); p.x_velocity += xcomp * _accel * interval; p.y_velocity += ycomp * _accel * interval; @@ -1284,11 +1286,7 @@ void QDeclarativeParticlesPainter::paint(QPainter *p, const QStyleOptionGraphics const int myX = x() + parentItem()->x(); const int myY = y() + parentItem()->y(); -#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) QVarLengthArray<QPainter::PixmapFragment, 256> pixmapData; -#else - QVarLengthArray<QDrawPixmaps::Data, 256> pixmapData; -#endif pixmapData.resize(d->particles.count()); const QRectF sourceRect = d->image.rect(); @@ -1296,32 +1294,20 @@ void QDeclarativeParticlesPainter::paint(QPainter *p, const QStyleOptionGraphics qreal halfPHeight = sourceRect.height()/2.; for (int i = 0; i < d->particles.count(); ++i) { const QDeclarativeParticle &particle = d->particles.at(i); -#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) pixmapData[i].x = particle.x - myX + halfPWidth; pixmapData[i].y = particle.y - myY + halfPHeight; -#else - pixmapData[i].point = QPointF(particle.x - myX + halfPWidth, particle.y - myY + halfPHeight); -#endif pixmapData[i].opacity = particle.opacity; //these never change pixmapData[i].rotation = 0; pixmapData[i].scaleX = 1; pixmapData[i].scaleY = 1; -#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) pixmapData[i].sourceLeft = sourceRect.left(); pixmapData[i].sourceTop = sourceRect.top(); pixmapData[i].width = sourceRect.width(); pixmapData[i].height = sourceRect.height(); -#else - pixmapData[i].source = sourceRect; -#endif } -#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) p->drawPixmapFragments(pixmapData.data(), d->particles.count(), d->image); -#else - qDrawPixmaps(p, pixmapData.data(), d->particles.count(), d->image); -#endif } void QDeclarativeParticles::componentComplete() diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 484fbef..3d2dbf0 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -1,12 +1,12 @@ TEMPLATE = subdirs !symbian: { SUBDIRS += \ - examples \ qdeclarativemetatype \ qmetaobjectbuilder } SUBDIRS += \ + examples \ parserstress \ qdeclarativeanchors \ qdeclarativeanimatedimage \ diff --git a/tests/auto/declarative/examples/examples.pro b/tests/auto/declarative/examples/examples.pro index 92a16f1..2e243b4 100644 --- a/tests/auto/declarative/examples/examples.pro +++ b/tests/auto/declarative/examples/examples.pro @@ -7,9 +7,8 @@ SOURCES += tst_examples.cpp include(../../../../tools/qml/qml.pri) symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 605345e..da115a7 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -47,6 +47,11 @@ #include <QDeclarativeView> #include <QDeclarativeError> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_examples : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/parserstress/parserstress.pro b/tests/auto/declarative/parserstress/parserstress.pro index 3a675e4..bb1d69f 100644 --- a/tests/auto/declarative/parserstress/parserstress.pro +++ b/tests/auto/declarative/parserstress/parserstress.pro @@ -5,9 +5,8 @@ macx:CONFIG -= app_bundle SOURCES += tst_parserstress.cpp symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = ..\\..\\qscriptjstestsuite\\tests - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp index c86908b..522a63a 100644 --- a/tests/auto/declarative/parserstress/tst_parserstress.cpp +++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp @@ -46,6 +46,11 @@ #include <QDir> #include <QFile> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_parserstress : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro index 452ad55..9798bb6 100644 --- a/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro +++ b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro @@ -4,9 +4,8 @@ SOURCES += tst_qdeclarativeanchors.cpp macx:CONFIG -= app_bundle symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index 22f7966..97b77d0 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -50,6 +50,11 @@ #include <QtDeclarative/private/qdeclarativeanchors_p_p.h> #include <QtDeclarative/private/qdeclarativeitem_p.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + Q_DECLARE_METATYPE(QDeclarativeAnchors::Anchor) Q_DECLARE_METATYPE(QDeclarativeAnchorLine::AnchorLine) diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro index 7213abd..0a2f0f2 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro +++ b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro @@ -5,9 +5,8 @@ SOURCES += tst_qdeclarativeanimatedimage.cpp ../shared/testhttpserver.cpp macx:CONFIG -= app_bundle symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp index 237a436..1001278 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp +++ b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp @@ -48,6 +48,11 @@ #include "../shared/testhttpserver.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + #define TRY_WAIT(expr) \ do { \ for (int ii = 0; ii < 6; ++ii) { \ diff --git a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro index f7ed371..ed47dca 100644 --- a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro +++ b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro @@ -4,9 +4,8 @@ SOURCES += tst_qdeclarativeanimations.cpp macx:CONFIG -= app_bundle symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index ed7e506..5cf4c23 100644 --- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -48,6 +48,11 @@ #include <QVariantAnimation> #include <QEasingCurve> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativeanimations : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro index 7137af1..cfb59ef 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro +++ b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro @@ -4,9 +4,8 @@ SOURCES += tst_qdeclarativebehaviors.cpp macx:CONFIG -= app_bundle symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index 45e5304..70739fb 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -49,6 +49,11 @@ #include <private/qdeclarativeitem_p.h> #include "../../../shared/util.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativebehaviors : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro index 04535db..a7ba2a8 100644 --- a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro +++ b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativebinding.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp index 8ab7b0b..653b34a 100644 --- a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp +++ b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp @@ -45,6 +45,11 @@ #include <private/qdeclarativerectangle_p.h> #include "../../../shared/util.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativebinding : public QObject { diff --git a/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro index 3aa2197..a21761b 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro +++ b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro @@ -5,11 +5,9 @@ macx:CONFIG -= app_bundle HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativeborderimage.cpp ../shared/testhttpserver.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp index 69b4a89..1b73cf7 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -54,6 +54,10 @@ #include "../shared/testhttpserver.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif #define SERVER_PORT 14446 #define SERVER_ADDR "http://127.0.0.1:14446" diff --git a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro index 98c38ad..4124f94 100644 --- a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro +++ b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro @@ -5,9 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativecomponent.cpp -symbian: { - DEFINES += SRCDIR=\".\" -} else { +!symbian: { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp index faa1c21..8a19b8b 100644 --- a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp +++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp @@ -45,6 +45,11 @@ #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecomponent.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativecomponent : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro index bbf8630..d06ce4f 100644 --- a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro +++ b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeconnection.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp index 00e97ca..d384372 100644 --- a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp +++ b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp @@ -46,6 +46,11 @@ #include "../../../shared/util.h" #include <QtDeclarative/qdeclarativescriptstring.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativeconnection : public QObject { diff --git a/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro index 0e1a5b1..74bb78c 100644 --- a/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro +++ b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro @@ -3,9 +3,7 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativecontext.cpp macx:CONFIG -= app_bundle -symbian: { - DEFINES += SRCDIR=\".\" -} else { +!symbian: { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp index 7f0e6c0..605cf8e 100644 --- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp +++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp @@ -46,6 +46,11 @@ #include <QDeclarativeComponent> #include <QDeclarativeExpression> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativecontext : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro index 9f1e50c..415d4e2 100644 --- a/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro +++ b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro @@ -5,9 +5,8 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativedom.cpp symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index 6c19566..13960b1 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -46,6 +46,11 @@ #include <QtCore/QDebug> #include <QtCore/QFile> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativedom : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro index c907be5..58cad34 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro +++ b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro @@ -12,7 +12,13 @@ INCLUDEPATH += ../shared # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + importFiles.sources = data + importFiles.path = . + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index e75abac..16e7ec5 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -53,6 +53,11 @@ #include "testtypes.h" #include "testhttpserver.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + /* This test covers evaluation of ECMAScript expressions and bindings from within QML. This does not include static QML language issues. diff --git a/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro b/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro index 23afd07..7119ad9 100644 --- a/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro +++ b/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro @@ -4,10 +4,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeengine.cpp -# Define SRCDIR equal to test's source directory -symbian: { - DEFINES += SRCDIR=\".\" -} else { +!symbian: { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp index 0aebea1..56ebd73 100644 --- a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp +++ b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp @@ -50,6 +50,11 @@ #include <QDeclarativeComponent> #include <QDeclarativeNetworkAccessManagerFactory> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativeengine : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro b/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro index fae11f9..29b7149 100644 --- a/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro +++ b/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro @@ -3,9 +3,7 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativeerror.cpp macx:CONFIG -= app_bundle -symbian: { - DEFINES += SRCDIR=\".\" -} else { +!symbian: { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp b/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp index ba1ebae..0279953 100644 --- a/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp +++ b/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp @@ -43,6 +43,11 @@ #include <QDeclarativeError> #include <QDebug> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativeerror : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro index 7a70109..be0ba6c 100644 --- a/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro +++ b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeflickable.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index 2c6890e..2ba5574 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -46,6 +46,11 @@ #include <private/qdeclarativevaluetype_p.h> #include <math.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativeflickable : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro index 9b4fbc9..759e80b 100644 --- a/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro +++ b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeflipable.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp b/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp index f32cdbd..f56c032 100644 --- a/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp +++ b/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp @@ -48,6 +48,11 @@ #include <private/qdeclarativerectangle_p.h> #include <math.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativeflipable : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro b/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro index c021fcf..24749c6 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro +++ b/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro @@ -4,9 +4,8 @@ SOURCES += tst_qdeclarativefocusscope.cpp macx:CONFIG -= app_bundle symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp index 04bb1c5..7732e6d 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp +++ b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp @@ -48,6 +48,10 @@ #include <private/qdeclarativetext_p.h> #include <QtDeclarative/private/qdeclarativefocusscope_p.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif class tst_qdeclarativefocusscope : public QObject { diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro b/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro index 487d0e1..91bf4a7 100644 --- a/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro +++ b/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativefolderlistmodel.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp index 3cf9613..b2e3a5b 100644 --- a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp +++ b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp @@ -48,6 +48,11 @@ #include <QtCore/qabstractitemmodel.h> #include <QDebug> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + // From qdeclarastivefolderlistmodel.h const int FileNameRole = Qt::UserRole+1; const int FilePathRole = Qt::UserRole+2; diff --git a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro index dbe0dcb..01dca26 100644 --- a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro +++ b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro @@ -5,11 +5,9 @@ macx:CONFIG -= app_bundle HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativefontloader.cpp ../shared/testhttpserver.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp index 36908d9..ae23017 100644 --- a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp +++ b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp @@ -47,6 +47,11 @@ #define SERVER_PORT 14448 +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativefontloader : public QObject { diff --git a/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro index 033e20e..a99a1b9 100644 --- a/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro +++ b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativegridview.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 2db3ee6..9b7c261 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -52,6 +52,11 @@ #include <QtDeclarative/private/qdeclarativelistmodel_p.h> #include "../../../shared/util.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_QDeclarativeGridView : public QObject { Q_OBJECT @@ -833,21 +838,34 @@ void tst_QDeclarativeGridView::componentChanges() QSignalSpy highlightSpy(gridView, SIGNAL(highlightChanged())); QSignalSpy delegateSpy(gridView, SIGNAL(delegateChanged())); + QSignalSpy headerSpy(gridView, SIGNAL(headerChanged())); + QSignalSpy footerSpy(gridView, SIGNAL(footerChanged())); gridView->setHighlight(&component); gridView->setDelegate(&delegateComponent); + gridView->setHeader(&component); + gridView->setFooter(&component); QTRY_COMPARE(gridView->highlight(), &component); QTRY_COMPARE(gridView->delegate(), &delegateComponent); + QTRY_COMPARE(gridView->header(), &component); + QTRY_COMPARE(gridView->footer(), &component); QTRY_COMPARE(highlightSpy.count(),1); QTRY_COMPARE(delegateSpy.count(),1); + QTRY_COMPARE(headerSpy.count(),1); + QTRY_COMPARE(footerSpy.count(),1); gridView->setHighlight(&component); gridView->setDelegate(&delegateComponent); + gridView->setHeader(&component); + gridView->setFooter(&component); QTRY_COMPARE(highlightSpy.count(),1); QTRY_COMPARE(delegateSpy.count(),1); + QTRY_COMPARE(headerSpy.count(),1); + QTRY_COMPARE(footerSpy.count(),1); + delete canvas; } diff --git a/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro index a8b8eca..244a1e1 100644 --- a/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro +++ b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro @@ -5,11 +5,9 @@ macx:CONFIG -= app_bundle HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativeimage.cpp ../shared/testhttpserver.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 720702a..c09f7fc 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -55,6 +55,10 @@ #include "../shared/testhttpserver.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif #define SERVER_PORT 14451 #define SERVER_ADDR "http://127.0.0.1:14451" diff --git a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro index 1b828a5..bdb6423 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro +++ b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro @@ -8,11 +8,9 @@ SOURCES += tst_qdeclarativeimageprovider.cpp # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index cc4ec20..4185790 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -45,6 +45,11 @@ #include <private/qdeclarativeimage_p.h> #include <QImageReader> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + // QDeclarativeImageProvider::request() is run in an idle thread where possible // Be generous in our timeout. #define TRY_WAIT(expr) \ diff --git a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro index c6719c0..2c20e7e 100644 --- a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro +++ b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro @@ -5,9 +5,8 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeinfo.cpp symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp index 36db448..03df71f 100644 --- a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp +++ b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp @@ -46,6 +46,11 @@ #include <QDeclarativeContext> #include <qdeclarativeinfo.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativeinfo : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro index 350f6c6..c8a48c9 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro +++ b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro @@ -3,9 +3,7 @@ contains(QT_CONFIG,declarative): QT += declarative script SOURCES += tst_qdeclarativeinstruction.cpp macx:CONFIG -= app_bundle -symbian: { - DEFINES += SRCDIR=\".\" -} else { +!symbian: { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp index 1e88255..d5a911a 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp +++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp @@ -42,6 +42,11 @@ #include <qtest.h> #include <private/qdeclarativecompiler_p.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativeinstruction : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro index f494ef1..f4901c4 100644 --- a/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro +++ b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro @@ -5,9 +5,8 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeitem.cpp symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index ecc813e..c2d3660 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -47,6 +47,11 @@ #include <QtDeclarative/qdeclarativeitem.h> #include "../../../shared/util.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_QDeclarativeItem : public QObject { diff --git a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro index 2b7eb1c..43c451f 100644 --- a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro +++ b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro @@ -12,9 +12,8 @@ HEADERS += ../shared/testhttpserver.h SOURCES += ../shared/testhttpserver.cpp symbian: { - DEFINES += SRCDIR=\".\"\"\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 011870c..413843a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -55,6 +55,11 @@ #include "../../../shared/util.h" #include "testhttpserver.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + DEFINE_BOOL_CONFIG_OPTION(qmlCheckTypes, QML_CHECK_TYPES) diff --git a/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro b/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro index 79954fe..5076e51 100644 --- a/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro +++ b/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro @@ -4,12 +4,10 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativelayoutitem.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" -}
\ No newline at end of file +} diff --git a/tests/auto/declarative/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp b/tests/auto/declarative/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp index c0c5abc..bbdba74 100644 --- a/tests/auto/declarative/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp +++ b/tests/auto/declarative/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp @@ -49,6 +49,11 @@ #include <qgraphicslinearlayout.h> #include "../../../shared/util.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativelayoutitem : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro index 53bb9ec..e90db49 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro +++ b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro @@ -5,11 +5,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativelistmodel.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index be4ffe8..b3b6c20 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -51,6 +51,11 @@ #include "../../../shared/util.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativelistmodel : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro index b406fde..2c5a859 100644 --- a/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro +++ b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativelistview.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 2aef9bb..7376c00 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -52,6 +52,11 @@ #include <QtDeclarative/private/qlistmodelinterface_p.h> #include "../../../shared/util.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_QDeclarativeListView : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro index 9334928..b07bf9e 100644 --- a/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro +++ b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro @@ -8,9 +8,8 @@ SOURCES += tst_qdeclarativeloader.cpp \ ../shared/testhttpserver.cpp symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index 11cc61b..d047a2a 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -50,6 +50,11 @@ #define SERVER_PORT 14450 +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + inline QUrl TEST_FILE(const QString &filename) { return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); diff --git a/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro b/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro index 0d32ab8..f13250e 100644 --- a/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro +++ b/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro @@ -3,9 +3,7 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativemetatype.cpp macx:CONFIG -= app_bundle -symbian: { - DEFINES += SRCDIR=\".\" -} else { +!symbian: { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp index 76e86c9..8964f8a 100644 --- a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp +++ b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp @@ -54,6 +54,11 @@ #include <private/qdeclarativemetatype_p.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativemetatype : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp index 6d17acc..2081f0e 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp +++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp @@ -56,6 +56,11 @@ private slots: void importsPlugin(); }; +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + #define VERIFY_ERRORS(errorfile) \ if (!errorfile) { \ if (qgetenv("DEBUG") != "" && !component.errors().isEmpty()) \ diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro index 29a1009..fb3630f 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro +++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro @@ -2,10 +2,10 @@ load(qttest_p4) SOURCES = tst_qdeclarativemoduleplugin.cpp QT += declarative CONFIG -= app_bundle + symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro index 6f9c98c..3d39aa8 100644 --- a/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro +++ b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro @@ -5,11 +5,9 @@ macx:CONFIG -= app_bundle HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativemousearea.cpp ../shared/testhttpserver.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp index ff3bf45..5a10372 100644 --- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp +++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp @@ -46,6 +46,11 @@ #include <QtDeclarative/qdeclarativeview.h> #include <QtDeclarative/qdeclarativecontext.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_QDeclarativeMouseArea: public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro index 31172a9..f9ca90f 100644 --- a/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro +++ b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeparticles.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeparticles/tst_qdeclarativeparticles.cpp b/tests/auto/declarative/qdeclarativeparticles/tst_qdeclarativeparticles.cpp index 093190c..caf69fc 100644 --- a/tests/auto/declarative/qdeclarativeparticles/tst_qdeclarativeparticles.cpp +++ b/tests/auto/declarative/qdeclarativeparticles/tst_qdeclarativeparticles.cpp @@ -43,6 +43,11 @@ #include <qdeclarativeview.h> #include <QGraphicsObject> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_QDeclarativeParticles : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro index 6bef61c..04fd26b 100644 --- a/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro +++ b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativepathview.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index dffc7ac..bf1e13a 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -57,6 +57,11 @@ #include "../../../shared/util.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_QDeclarativePathView : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro index 99a94bc..3130364 100644 --- a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro +++ b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro @@ -10,9 +10,8 @@ HEADERS += ../shared/testhttpserver.h SOURCES += ../shared/testhttpserver.cpp symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp index 0cc13ad..f1018b2 100644 --- a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp +++ b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp @@ -49,6 +49,11 @@ // These don't let normal people run tests! //#include "../network-settings.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativepixmapcache : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro index 2c5b473..5dc7bb8 100644 --- a/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro +++ b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro @@ -3,11 +3,9 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativepositioners.cpp macx:CONFIG -= app_bundle -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index e639014..62ec707 100644 --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -48,6 +48,11 @@ #include <qdeclarativeexpression.h> #include "../../../shared/util.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_QDeclarativePositioners : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro index f37d952..4121a33 100644 --- a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro +++ b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro @@ -5,9 +5,8 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeproperty.cpp symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp index 53614fe..0ca0e03 100644 --- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp +++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp @@ -48,6 +48,11 @@ #include <QtCore/qfileinfo.h> #include <QtCore/qdir.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + inline QUrl TEST_FILE(const QString &filename) { QFileInfo fileInfo(__FILE__); diff --git a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro index b381a9b..6af6500 100644 --- a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro +++ b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro @@ -4,9 +4,8 @@ SOURCES += tst_qdeclarativeqt.cpp macx:CONFIG -= app_bundle symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index 5095be8..06561fa 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -51,6 +51,11 @@ #include <QCryptographicHash> #include <QDeclarativeItem> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativeqt : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro index 51667af..f3ff9ed 100644 --- a/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro +++ b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativerepeater.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp index e6b2fdd..3cc68f4 100644 --- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp +++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp @@ -48,6 +48,11 @@ #include <private/qdeclarativerepeater_p.h> #include <private/qdeclarativetext_p.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + inline QUrl TEST_FILE(const QString &filename) { return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro index 6b98f1e..872aeb9 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesmoothedanimation.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp b/tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp index 7cf318a..d9164f6 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp @@ -46,6 +46,11 @@ #include <private/qdeclarativevaluetype_p.h> #include "../../../shared/util.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativesmoothedanimation : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro b/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro index eb7d793..dff4922 100644 --- a/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro +++ b/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesmoothedfollow.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/tst_qdeclarativesmoothedfollow.cpp b/tests/auto/declarative/qdeclarativesmoothedfollow/tst_qdeclarativesmoothedfollow.cpp index ac750d9..b9ac23f 100644 --- a/tests/auto/declarative/qdeclarativesmoothedfollow/tst_qdeclarativesmoothedfollow.cpp +++ b/tests/auto/declarative/qdeclarativesmoothedfollow/tst_qdeclarativesmoothedfollow.cpp @@ -48,6 +48,11 @@ #include <private/qdeclarativevaluetype_p.h> #include "../../../shared/util.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativesmoothedfollow : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro b/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro index 6ed8924..1c17ba0 100644 --- a/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro +++ b/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativespringfollow.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativespringfollow/tst_qdeclarativespringfollow.cpp b/tests/auto/declarative/qdeclarativespringfollow/tst_qdeclarativespringfollow.cpp index 8a07d6b..e0e2892 100644 --- a/tests/auto/declarative/qdeclarativespringfollow/tst_qdeclarativespringfollow.cpp +++ b/tests/auto/declarative/qdeclarativespringfollow/tst_qdeclarativespringfollow.cpp @@ -45,6 +45,11 @@ #include <private/qdeclarativevaluetype_p.h> #include "../../../shared/util.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativespringfollow : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro b/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro index 9cdb884..1462c9a 100644 --- a/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro +++ b/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro @@ -5,11 +5,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesqldatabase.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp b/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp index 7486a4b..f92d7e8 100644 --- a/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp +++ b/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp @@ -53,6 +53,11 @@ #include <QtCore/qdir.h> #include <QtCore/qfile.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativesqldatabase : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativestates/data/attachedPropertyChanges.qml b/tests/auto/declarative/qdeclarativestates/data/attachedPropertyChanges.qml new file mode 100644 index 0000000..e17823b --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/attachedPropertyChanges.qml @@ -0,0 +1,20 @@ +import Qt.test 1.0 +import Qt 4.7 + +Item { + id: item + width: 100; height: 100 + MyRectangle.foo: 0 + + states: State { + name: "foo1" + PropertyChanges { + target: item + MyRectangle.foo: 1 + width: 50 + } + } + + Component.onCompleted: item.state = "foo1" +} + diff --git a/tests/auto/declarative/qdeclarativestates/data/returnToBase.qml b/tests/auto/declarative/qdeclarativestates/data/returnToBase.qml new file mode 100644 index 0000000..e342331 --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/returnToBase.qml @@ -0,0 +1,21 @@ +import Qt 4.7 + +Rectangle { + id: theRect + property bool triggerState: false + property string stateString: "" + states: [ State { + when: triggerState + PropertyChanges { + target: theRect + stateString: "inState" + } + }, + State { + name: "" + PropertyChanges { + target: theRect + stateString: "originalState" + } + }] +} diff --git a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro index 6f4ecb3..2bae041 100644 --- a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro +++ b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativestates.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index ea074a4..2913ddd 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -49,6 +49,24 @@ #include <private/qdeclarativestategroup_p.h> #include <private/qdeclarativeitem_p.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + +class MyAttached : public QObject +{ + Q_OBJECT + Q_PROPERTY(int foo READ foo WRITE setFoo) +public: + MyAttached(QObject *parent) : QObject(parent), m_foo(13) {} + + int foo() const { return m_foo; } + void setFoo(int f) { m_foo = f; } + +private: + int m_foo; +}; class MyRect : public QDeclarativeRectangle { @@ -61,6 +79,10 @@ public: int propertyWithNotify() const { return m_prop; } void setPropertyWithNotify(int i) { m_prop = i; emit oddlyNamedNotifySignal(); } + + static MyAttached *qmlAttachedProperties(QObject *o) { + return new MyAttached(o); + } Q_SIGNALS: void didSomething(); void oddlyNamedNotifySignal(); @@ -69,6 +91,8 @@ private: int m_prop; }; +QML_DECLARE_TYPE(MyRect) +QML_DECLARE_TYPEINFO(MyRect, QML_HAS_ATTACHED_PROPERTIES) class tst_qdeclarativestates : public QObject { @@ -83,6 +107,7 @@ private slots: void initTestCase(); void basicChanges(); + void attachedPropertyChanges(); void basicExtension(); void basicBinding(); void signalOverride(); @@ -112,6 +137,7 @@ private slots: void whenOrdering(); void urlResolution(); void unnamedWhen(); + void returnToBase(); }; void tst_qdeclarativestates::initTestCase() @@ -219,6 +245,28 @@ void tst_qdeclarativestates::basicChanges() } } +void tst_qdeclarativestates::attachedPropertyChanges() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent component(&engine, SRCDIR "/data/attachedPropertyChanges.qml"); + QVERIFY(component.isReady()); + + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item != 0); + QCOMPARE(item->width(), 50.0); + + // Ensure attached property has been changed + QObject *attObj = qmlAttachedPropertiesObject<MyRect>(item, false); + QVERIFY(attObj); + + MyAttached *att = qobject_cast<MyAttached*>(attObj); + QVERIFY(att); + + QEXPECT_FAIL("", "QTBUG-11283", Abort); + QCOMPARE(att->foo(), 1); +} + void tst_qdeclarativestates::basicExtension() { QDeclarativeEngine engine; @@ -1085,6 +1133,26 @@ void tst_qdeclarativestates::unnamedWhen() QCOMPARE(rect->property("stateString").toString(), QLatin1String("")); } +void tst_qdeclarativestates::returnToBase() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/returnToBase.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect != 0); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + + QCOMPARE(rectPrivate->state(), QLatin1String("")); + QCOMPARE(rect->property("stateString").toString(), QLatin1String("")); + rect->setProperty("triggerState", true); + QCOMPARE(rectPrivate->state(), QLatin1String("anonymousState1")); + QCOMPARE(rect->property("stateString").toString(), QLatin1String("inState")); + rect->setProperty("triggerState", false); + QCOMPARE(rectPrivate->state(), QLatin1String("")); + QCOMPARE(rect->property("stateString").toString(), QLatin1String("originalState")); +} + + QTEST_MAIN(tst_qdeclarativestates) #include "tst_qdeclarativestates.moc" diff --git a/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro b/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro index 786bc1b..0062688 100644 --- a/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro +++ b/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro @@ -4,10 +4,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesystempalette.cpp -# Define SRCDIR equal to test's source directory -symbian: { - DEFINES += SRCDIR=\".\" -} else { +!symbian: { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp b/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp index 7927d97..dd1fd7a 100644 --- a/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp +++ b/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp @@ -47,6 +47,11 @@ #include <qpalette.h> #include "../../../shared/util.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativesystempalette : public QObject { diff --git a/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro index 51c7f43..c1a36fd 100644 --- a/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro +++ b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro @@ -10,9 +10,8 @@ HEADERS += ../shared/testhttpserver.h SOURCES += ../shared/testhttpserver.cpp symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 551e17b..01120b1 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -51,6 +51,11 @@ #include "../../../shared/util.h" #include "testhttpserver.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativetext : public QObject { diff --git a/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro b/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro index 2adb2b8..4b6bd49 100644 --- a/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro +++ b/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro @@ -5,11 +5,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativetextedit.cpp ../shared/testhttpserver.cpp HEADERS += ../shared/testhttpserver.h -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index fbab30e..f7ba7a1 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -56,6 +56,11 @@ #include <QStyle> #include <QInputContext> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativetextedit : public QObject { @@ -862,6 +867,7 @@ void tst_qdeclarativetextedit::openInputPanelOnClick() edit.setFocus(false); edit.setFocus(true); edit.setFocus(false); + QApplication::processEvents(); QCOMPARE(ic.openInputPanelReceived, false); QCOMPARE(ic.closeInputPanelReceived, false); } @@ -887,6 +893,7 @@ void tst_qdeclarativetextedit::openInputPanelOnFocus() QDeclarativeTextEditPrivate *editPrivate = static_cast<QDeclarativeTextEditPrivate*>(pri); editPrivate->showInputPanelOnFocus = true; + // test default values QVERIFY(edit.focusOnPress()); QCOMPARE(ic.openInputPanelReceived, false); QCOMPARE(ic.closeInputPanelReceived, false); @@ -896,76 +903,94 @@ void tst_qdeclarativetextedit::openInputPanelOnFocus() QApplication::processEvents(); QVERIFY(edit.hasFocus()); QCOMPARE(ic.openInputPanelReceived, true); - QCOMPARE(ic.closeInputPanelReceived, false); ic.openInputPanelReceived = false; // no events on release QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); QCOMPARE(ic.openInputPanelReceived, false); - QCOMPARE(ic.closeInputPanelReceived, false); ic.openInputPanelReceived = false; - // Even with focus already gained, user needs - // to be able to open panel by pressing on the editor + // if already focused, input panel can be opened on press + QVERIFY(edit.hasFocus()); QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); QApplication::processEvents(); QCOMPARE(ic.openInputPanelReceived, true); - QCOMPARE(ic.closeInputPanelReceived, false); ic.openInputPanelReceived = false; - // input panel closed on focus lost - edit.setFocus(false); + // input method should stay enabled if focus + // is lost to an item that also accepts inputs + QDeclarativeTextEdit anotherEdit; + scene.addItem(&anotherEdit); + anotherEdit.setFocus(true); + QApplication::processEvents(); + QCOMPARE(ic.openInputPanelReceived, true); + ic.openInputPanelReceived = false; + QCOMPARE(view.inputContext(), &ic); + QVERIFY(view.testAttribute(Qt::WA_InputMethodEnabled)); + + // input method should be disabled if focus + // is lost to an item that doesn't accept inputs + QDeclarativeItem item; + scene.addItem(&item); + item.setFocus(true); QApplication::processEvents(); QCOMPARE(ic.openInputPanelReceived, false); - QCOMPARE(ic.closeInputPanelReceived, true); - ic.closeInputPanelReceived = false; + QVERIFY(view.inputContext() == 0); + QVERIFY(!view.testAttribute(Qt::WA_InputMethodEnabled)); - // no automatic input panel events if focusOnPress is false + // no automatic input panel events should + // be sent if focusOnPress is false + edit.setFocusOnPress(false); + QCOMPARE(focusOnPressSpy.count(),1); edit.setFocusOnPress(false); QCOMPARE(focusOnPressSpy.count(),1); - QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); - QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); edit.setFocus(false); edit.setFocus(true); + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); + QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); + QApplication::processEvents(); QCOMPARE(ic.openInputPanelReceived, false); QCOMPARE(ic.closeInputPanelReceived, false); - edit.setFocusOnPress(false); - QCOMPARE(focusOnPressSpy.count(),1); - - // one show input panel event when openSoftwareInputPanel is called + // one show input panel event should + // be set when openSoftwareInputPanel is called edit.openSoftwareInputPanel(); QCOMPARE(ic.openInputPanelReceived, true); QCOMPARE(ic.closeInputPanelReceived, false); ic.openInputPanelReceived = false; - // one close input panel event when closeSoftwareInputPanel is called + // one close input panel event should + // be sent when closeSoftwareInputPanel is called edit.closeSoftwareInputPanel(); QCOMPARE(ic.openInputPanelReceived, false); QCOMPARE(ic.closeInputPanelReceived, true); - ic.openInputPanelReceived = false; + ic.closeInputPanelReceived = false; // set focusOnPress back to true edit.setFocusOnPress(true); QCOMPARE(focusOnPressSpy.count(),2); - edit.setFocus(false); - QCOMPARE(ic.openInputPanelReceived, false); - QCOMPARE(ic.closeInputPanelReceived, true); - ic.closeInputPanelReceived = false; - edit.setFocusOnPress(true); QCOMPARE(focusOnPressSpy.count(),2); - - // active window focus reason should not cause input panel to open - QGraphicsObject * editObject = qobject_cast<QGraphicsObject*>(&edit); - editObject->setFocus(Qt::ActiveWindowFocusReason); + edit.setFocus(false); + QApplication::processEvents(); QCOMPARE(ic.openInputPanelReceived, false); QCOMPARE(ic.closeInputPanelReceived, false); + ic.closeInputPanelReceived = false; - // and input panel should not open if focus has already been set + // input panel should not re-open + // if focus has already been set + edit.setFocus(true); + QCOMPARE(ic.openInputPanelReceived, true); + ic.openInputPanelReceived = false; edit.setFocus(true); QCOMPARE(ic.openInputPanelReceived, false); - QCOMPARE(ic.closeInputPanelReceived, false); + + // input method should be disabled + // if TextEdit loses focus + edit.setFocus(false); + QApplication::processEvents(); + QVERIFY(view.inputContext() == 0); + QVERIFY(!view.testAttribute(Qt::WA_InputMethodEnabled)); } void tst_qdeclarativetextedit::geometrySignals() diff --git a/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro index 2953567..8f42448 100644 --- a/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro +++ b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativetextinput.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 3cb4da0..3143580 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -50,6 +50,11 @@ #include <QStyle> #include <QInputContext> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativetextinput : public QObject { @@ -833,6 +838,7 @@ void tst_qdeclarativetextinput::openInputPanelOnFocus() QDeclarativeTextInputPrivate *inputPrivate = static_cast<QDeclarativeTextInputPrivate*>(pri); inputPrivate->showInputPanelOnFocus = true; + // test default values QVERIFY(input.focusOnPress()); QCOMPARE(ic.openInputPanelReceived, false); QCOMPARE(ic.closeInputPanelReceived, false); @@ -842,76 +848,94 @@ void tst_qdeclarativetextinput::openInputPanelOnFocus() QApplication::processEvents(); QVERIFY(input.hasFocus()); QCOMPARE(ic.openInputPanelReceived, true); - QCOMPARE(ic.closeInputPanelReceived, false); ic.openInputPanelReceived = false; // no events on release QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); QCOMPARE(ic.openInputPanelReceived, false); - QCOMPARE(ic.closeInputPanelReceived, false); ic.openInputPanelReceived = false; - // Even with focus already gained, user needs - // to be able to open panel by pressing on the editor + // if already focused, input panel can be opened on press + QVERIFY(input.hasFocus()); QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); QApplication::processEvents(); QCOMPARE(ic.openInputPanelReceived, true); - QCOMPARE(ic.closeInputPanelReceived, false); ic.openInputPanelReceived = false; - // input panel closed on focus lost - input.setFocus(false); + // input method should stay enabled if focus + // is lost to an item that also accepts inputs + QDeclarativeTextInput anotherInput; + scene.addItem(&anotherInput); + anotherInput.setFocus(true); + QApplication::processEvents(); + QCOMPARE(ic.openInputPanelReceived, true); + ic.openInputPanelReceived = false; + QCOMPARE(view.inputContext(), &ic); + QVERIFY(view.testAttribute(Qt::WA_InputMethodEnabled)); + + // input method should be disabled if focus + // is lost to an item that doesn't accept inputs + QDeclarativeItem item; + scene.addItem(&item); + item.setFocus(true); QApplication::processEvents(); QCOMPARE(ic.openInputPanelReceived, false); - QCOMPARE(ic.closeInputPanelReceived, true); - ic.closeInputPanelReceived = false; + QVERIFY(view.inputContext() == 0); + QVERIFY(!view.testAttribute(Qt::WA_InputMethodEnabled)); - // no automatic input panel events if focusOnPress is false + // no automatic input panel events should + // be sent if focusOnPress is false + input.setFocusOnPress(false); + QCOMPARE(focusOnPressSpy.count(),1); input.setFocusOnPress(false); QCOMPARE(focusOnPressSpy.count(),1); - QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); - QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); input.setFocus(false); input.setFocus(true); + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + QApplication::processEvents(); QCOMPARE(ic.openInputPanelReceived, false); QCOMPARE(ic.closeInputPanelReceived, false); - input.setFocusOnPress(false); - QCOMPARE(focusOnPressSpy.count(),1); - - // one show input panel event when openSoftwareInputPanel is called + // one show input panel event should + // be set when openSoftwareInputPanel is called input.openSoftwareInputPanel(); QCOMPARE(ic.openInputPanelReceived, true); QCOMPARE(ic.closeInputPanelReceived, false); ic.openInputPanelReceived = false; - // one close input panel event when closeSoftwareInputPanel is called + // one close input panel event should + // be sent when closeSoftwareInputPanel is called input.closeSoftwareInputPanel(); QCOMPARE(ic.openInputPanelReceived, false); QCOMPARE(ic.closeInputPanelReceived, true); - ic.openInputPanelReceived = false; + ic.closeInputPanelReceived = false; // set focusOnPress back to true input.setFocusOnPress(true); QCOMPARE(focusOnPressSpy.count(),2); - input.setFocus(false); - QCOMPARE(ic.openInputPanelReceived, false); - QCOMPARE(ic.closeInputPanelReceived, true); - ic.closeInputPanelReceived = false; - input.setFocusOnPress(true); QCOMPARE(focusOnPressSpy.count(),2); - - // active window focus reason should not cause input panel to open - QGraphicsObject * inputObject = qobject_cast<QGraphicsObject*>(&input); - inputObject->setFocus(Qt::ActiveWindowFocusReason); + input.setFocus(false); + QApplication::processEvents(); QCOMPARE(ic.openInputPanelReceived, false); QCOMPARE(ic.closeInputPanelReceived, false); + ic.closeInputPanelReceived = false; - // and input panel should not open if focus has already been set + // input panel should not re-open + // if focus has already been set + input.setFocus(true); + QCOMPARE(ic.openInputPanelReceived, true); + ic.openInputPanelReceived = false; input.setFocus(true); QCOMPARE(ic.openInputPanelReceived, false); - QCOMPARE(ic.closeInputPanelReceived, false); + + // input method should be disabled + // if TextEdit loses focus + input.setFocus(false); + QApplication::processEvents(); + QVERIFY(view.inputContext() == 0); + QVERIFY(!view.testAttribute(Qt::WA_InputMethodEnabled)); } class MyTextInput : public QDeclarativeTextInput diff --git a/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro b/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro index d95165c..398139a 100644 --- a/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro +++ b/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro @@ -4,9 +4,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativetimer.cpp -symbian: { - DEFINES += SRCDIR=\".\" -} else { +!symbian: { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp index da2d173..f49cbd0 100644 --- a/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp +++ b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp @@ -46,6 +46,11 @@ #include <QtDeclarative/qdeclarativeitem.h> #include <QDebug> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativetimer : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro index 02c480c..90e46d3 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro +++ b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro @@ -8,9 +8,8 @@ SOURCES += tst_qdeclarativevaluetypes.cpp \ testtypes.cpp symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index 53fd68c..237d020 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -46,6 +46,13 @@ #include <private/qdeclarativevaluetype_p.h> #include "testtypes.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + +extern int qt_defaultDpi(); + class tst_qdeclarativevaluetypes : public QObject { Q_OBJECT @@ -464,7 +471,7 @@ void tst_qdeclarativevaluetypes::font() QCOMPARE(object->property("f_overline").toBool(), object->font().overline()); QCOMPARE(object->property("f_strikeout").toBool(), object->font().strikeOut()); QCOMPARE(object->property("f_pointSize").toDouble(), object->font().pointSizeF()); - QCOMPARE(object->property("f_pixelSize").toInt(), object->font().pixelSize()); + QCOMPARE(object->property("f_pixelSize").toInt(), int((object->font().pointSizeF() * qt_defaultDpi()) / qreal(72.))); QCOMPARE(object->property("f_capitalization").toInt(), (int)object->font().capitalization()); QCOMPARE(object->property("f_letterSpacing").toDouble(), object->font().letterSpacing()); QCOMPARE(object->property("f_wordSpacing").toDouble(), object->font().wordSpacing()); diff --git a/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro index ad54713..21a9195 100644 --- a/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro +++ b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro @@ -5,9 +5,8 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeview.cpp symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp index b183105..cc48bd0 100644 --- a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp +++ b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp @@ -47,6 +47,11 @@ #include <QtGui/qgraphicswidget.h> #include "../../../shared/util.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_QDeclarativeView : public QObject { diff --git a/tests/auto/declarative/qdeclarativeviewer/data/orientation.qml b/tests/auto/declarative/qdeclarativeviewer/data/orientation.qml index be911a3..57db82d 100644 --- a/tests/auto/declarative/qdeclarativeviewer/data/orientation.qml +++ b/tests/auto/declarative/qdeclarativeviewer/data/orientation.qml @@ -1,18 +1,18 @@ import Qt 4.7 Rectangle { color: "black" - width: (runtime.orientation == Orientation.RightUp || runtime.orientation == Orientation.LeftUp) ? 300 : 200 - height: (runtime.orientation == Orientation.RightUp || runtime.orientation == Orientation.LeftUp) ? 200 : 300 + width: (runtime.orientation == Orientation.Landscape || runtime.orientation == Orientation.LandscapeInverted) ? 300 : 200 + height: (runtime.orientation == Orientation.Landscape || runtime.orientation == Orientation.LandscapeInverted) ? 200 : 300 Text { text: { - if (runtime.orientation == Orientation.TopUp) - return "TopUp" - if (runtime.orientation == Orientation.TopDown) - return "TopDown" - if (runtime.orientation == Orientation.LeftUp) - return "LeftUp" - if (runtime.orientation == Orientation.RightUp) - return "RightUp" + if (runtime.orientation == Orientation.Portrait) + return "Portrait" + if (runtime.orientation == Orientation.PortraitInverted) + return "PortraitInverted" + if (runtime.orientation == Orientation.Landscape) + return "Landscape" + if (runtime.orientation == Orientation.LandscapeInverted) + return "LandscapeInverted" } color: "white" } diff --git a/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro b/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro index 9bb6161..6189916 100644 --- a/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro +++ b/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro @@ -7,9 +7,8 @@ include(../../../../tools/qml/qml.pri) SOURCES += tst_qdeclarativeviewer.cpp symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp index f296d9e..49273ea 100644 --- a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp +++ b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp @@ -45,6 +45,11 @@ #include <QtDeclarative/qdeclarativeitem.h> #include "qmlruntime.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_QDeclarativeViewer : public QObject { diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro b/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro index c87171b..92e5f60 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro @@ -5,9 +5,8 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativevisualdatamodel.cpp symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp index 8f3fb16..90c9c6f 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp @@ -52,6 +52,11 @@ #include <private/qdeclarativevaluetype_p.h> #include <math.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + static void initStandardTreeModel(QStandardItemModel *model) { QStandardItem *item; diff --git a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro index 8caa393..562a9fb 100644 --- a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro +++ b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro @@ -5,11 +5,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativewebview.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp index beabf86..f33e5a4 100644 --- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -50,6 +50,11 @@ #include <QtCore/qfile.h> #include <QtGui/qpainter.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativewebview : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro index 36b3449..2f8f23d 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro +++ b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro @@ -4,11 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeworkerscript.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index 7a4315a..52c11e9 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -53,6 +53,11 @@ Q_DECLARE_METATYPE(QScriptValue) +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_QDeclarativeWorkerScript : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro index b54f670..619b239 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro @@ -8,11 +8,9 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativexmlhttprequest.cpp \ ../shared/testhttpserver.cpp -# Define SRCDIR equal to test's source directory symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp index 1d26f2c..8141fcb 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp @@ -48,6 +48,11 @@ #define SERVER_PORT 14445 +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + class tst_qdeclarativexmlhttprequest : public QObject { Q_OBJECT diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro index 7c006f1..472cffb 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro +++ b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro @@ -9,9 +9,8 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativexmllistmodel.cpp symbian: { - DEFINES += SRCDIR=\".\" importFiles.sources = data - importFiles.path = + importFiles.path = . DEPLOYMENT = importFiles } else { DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp index 35790e4..bd19bd3 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp +++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp @@ -50,6 +50,11 @@ #include <private/qdeclarativexmllistmodel_p.h> #include "../../../shared/util.h" +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + typedef QPair<int, int> QDeclarativeXmlListRange; typedef QList<QVariantList> QDeclarativeXmlModelData; diff --git a/tests/auto/declarative/qmlvisual/qmlvisual.pro b/tests/auto/declarative/qmlvisual/qmlvisual.pro index dca9b04..cb7e5d7 100644 --- a/tests/auto/declarative/qmlvisual/qmlvisual.pro +++ b/tests/auto/declarative/qmlvisual/qmlvisual.pro @@ -5,7 +5,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_qmlvisual.cpp symbian: { - importFiles.path = + importFiles.path = . importFiles.sources = animation \ fillmode \ focusscope \ @@ -28,8 +28,6 @@ symbian: { selftest_noimages \ webview DEPLOYMENT = importFiles - - DEFINES += QT_TEST_SOURCE_DIR=\".\" } else { DEFINES += QT_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\" } diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp index 71dc451..a2d3273 100644 --- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp +++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp @@ -47,6 +47,11 @@ #include <QProcess> #include <QFile> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define QT_TEST_SOURCE_DIR "." +#endif + enum Mode { Record, RecordNoVisuals, RecordSnapshot, Play, TestVisuals, RemoveVisuals, UpdateVisuals, UpdatePlatformVisuals, Test }; static QString testdir; diff --git a/tests/auto/qtextcursor/tst_qtextcursor.cpp b/tests/auto/qtextcursor/tst_qtextcursor.cpp index 99babac..41835bb 100644 --- a/tests/auto/qtextcursor/tst_qtextcursor.cpp +++ b/tests/auto/qtextcursor/tst_qtextcursor.cpp @@ -151,6 +151,7 @@ private slots: void cursorPositionWithBlockUndoAndRedo(); void cursorPositionWithBlockUndoAndRedo2(); + void cursorPositionWithBlockUndoAndRedo3(); private: int blockCount(); @@ -1756,9 +1757,9 @@ void tst_QTextCursor::adjustCursorsOnInsert() void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo() { cursor.insertText("AAAABBBBCCCCDDDD"); - cursor.beginEditBlock(); cursor.setPosition(12); int cursorPositionBefore = cursor.position(); + cursor.beginEditBlock(); cursor.insertText("*"); cursor.setPosition(8); cursor.insertText("*"); @@ -1814,5 +1815,20 @@ void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo2() QCOMPARE(cursor.position(), cursorPositionBefore); } +void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo3() +{ + // verify that it's the position of the beginEditBlock that counts, and not the last edit position + cursor.insertText("AAAABBBB"); + int cursorPositionBefore = cursor.position(); + cursor.beginEditBlock(); + cursor.setPosition(4); + QVERIFY(cursor.position() != cursorPositionBefore); + cursor.insertText("*"); + cursor.endEditBlock(); + QCOMPARE(cursor.position(), 5); + doc->undo(&cursor); + QCOMPARE(cursor.position(), cursorPositionBefore); +} + QTEST_MAIN(tst_QTextCursor) #include "tst_qtextcursor.moc" diff --git a/tools/qml/deviceorientation.cpp b/tools/qml/deviceorientation.cpp index a13b912..e7c70d5 100644 --- a/tools/qml/deviceorientation.cpp +++ b/tools/qml/deviceorientation.cpp @@ -47,7 +47,7 @@ class DefaultDeviceOrientation : public DeviceOrientation { Q_OBJECT public: - DefaultDeviceOrientation() : DeviceOrientation(), m_orientation(DeviceOrientation::TopUp) {} + DefaultDeviceOrientation() : DeviceOrientation(), m_orientation(DeviceOrientation::Portrait) {} Orientation orientation() const { return m_orientation; diff --git a/tools/qml/deviceorientation.h b/tools/qml/deviceorientation.h index fe73868..817bfc8 100644 --- a/tools/qml/deviceorientation.h +++ b/tools/qml/deviceorientation.h @@ -54,10 +54,10 @@ class DeviceOrientation : public QObject public: enum Orientation { UnknownOrientation, - TopUp, - TopDown, - LeftUp, - RightUp + Portrait, + Landscape, + PortraitInverted, + LandscapeInverted }; virtual Orientation orientation() const = 0; diff --git a/tools/qml/deviceorientation_maemo.cpp b/tools/qml/deviceorientation_maemo.cpp index 501ff79..7948e2a 100644 --- a/tools/qml/deviceorientation_maemo.cpp +++ b/tools/qml/deviceorientation_maemo.cpp @@ -48,11 +48,11 @@ class MaemoOrientation : public DeviceOrientation Q_OBJECT public: MaemoOrientation() - : DeviceOrientation(),m_current(TopUp), m_lastSeen(TopUp), m_lastSeenCount(0) + : DeviceOrientation(),m_current(Portrait), m_lastSeen(Portrait), m_lastSeenCount(0) { m_current = get(); if (m_current == UnknownOrientation) - m_current = TopUp; + m_current = Portrait; startTimer(100); } @@ -101,13 +101,13 @@ private: if (abs(az) > 850) { o = UnknownOrientation; } else if (ax < -750) { - o = LeftUp; + o = Portrait; } else if (ax > 750) { - o = RightUp; + o = PortraitInverted; } else if (ay < -750) { - o = TopUp; + o = Landscape; } else if (ay > 750) { - o = TopDown; + o = LandscapeInverted; } return o; diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index f681303..d95bec2 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -281,7 +281,12 @@ public: ret << httpProxy; return ret; } +#ifdef Q_OS_WIN + // systemProxyForQuery can take insanely long on Windows (QTBUG-10106) + return QNetworkProxyFactory::proxyForQuery(query); +#else return QNetworkProxyFactory::systemProxyForQuery(query); +#endif } void setHttpProxy (QNetworkProxy proxy) { @@ -581,10 +586,10 @@ void QDeclarativeViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) orientation->setExclusive(true); connect(orientation, SIGNAL(triggered(QAction*)), this, SLOT(changeOrientation(QAction*))); - orientation->addAction(tr("orientation: TopUp")); - orientation->addAction(tr("orientation: LeftUp")); - orientation->addAction(tr("orientation: TopDown")); - orientation->addAction(tr("orientation: RightUp")); + orientation->addAction(tr("orientation: Portrait")); + orientation->addAction(tr("orientation: Landscape")); + orientation->addAction(tr("orientation: Portrait (Inverted)")); + orientation->addAction(tr("orientation: Landscape (Inverted)")); QList<QAction *> actions = orientation->actions(); for (int i=0; i<actions.count(); i++) { propertiesMenu->addAction(actions[i]); @@ -1177,14 +1182,14 @@ void QDeclarativeViewer::changeOrientation(QAction *action) action->setChecked(true); QString o = action->text().split(QLatin1Char(':')).value(1).trimmed(); - if (o == QLatin1String("TopUp")) - DeviceOrientation::instance()->setOrientation(DeviceOrientation::TopUp); - else if (o == QLatin1String("TopDown")) - DeviceOrientation::instance()->setOrientation(DeviceOrientation::TopDown); - else if (o == QLatin1String("LeftUp")) - DeviceOrientation::instance()->setOrientation(DeviceOrientation::LeftUp); - else if (o == QLatin1String("RightUp")) - DeviceOrientation::instance()->setOrientation(DeviceOrientation::RightUp); + if (o == QLatin1String("Portrait")) + DeviceOrientation::instance()->setOrientation(DeviceOrientation::Portrait); + else if (o == QLatin1String("Landscape")) + DeviceOrientation::instance()->setOrientation(DeviceOrientation::Landscape); + else if (o == QLatin1String("Portrait (Inverted)")) + DeviceOrientation::instance()->setOrientation(DeviceOrientation::PortraitInverted); + else if (o == QLatin1String("Landscape (Inverted)")) + DeviceOrientation::instance()->setOrientation(DeviceOrientation::LandscapeInverted); } void QDeclarativeViewer::orientationChanged() |