From 96226ad15202770f72e257d1a75654be9582326c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 6 Oct 2010 16:43:06 +0200 Subject: Doc: Added missing examples and snippets. Task-number: QTBUG-14238 --- .../gettingStarted/gsQml/parts/part0/Button.qml | 55 +++++ .../gettingStarted/gsQml/parts/part1/Button.qml | 97 +++++++++ .../gettingStarted/gsQml/parts/part1/EditMenu.qml | 76 +++++++ .../gettingStarted/gsQml/parts/part1/FileMenu.qml | 91 ++++++++ .../gsQml/parts/part1/SimpleButton.qml | 73 +++++++ .../parts/part1/pics/qml-texteditor1_button.png | Bin 0 -> 1670 bytes .../parts/part1/pics/qml-texteditor1_editmenu.png | Bin 0 -> 6177 bytes .../parts/part1/pics/qml-texteditor1_filemenu.png | Bin 0 -> 6062 bytes .../part1/pics/qml-texteditor1_simplebutton.png | Bin 0 -> 1055 bytes .../gsQml/parts/part1/qml-texteditor.qmlproject | 16 ++ .../gettingStarted/gsQml/parts/part2/Button.qml | 99 +++++++++ .../gettingStarted/gsQml/parts/part2/EditMenu.qml | 77 +++++++ .../gettingStarted/gsQml/parts/part2/FileMenu.qml | 92 ++++++++ .../gettingStarted/gsQml/parts/part2/MenuBar.qml | 140 +++++++++++++ .../parts/part2/pics/qml-texteditor2_menubar.png | Bin 0 -> 6079 bytes .../gsQml/parts/part2/qml-texteditor2.qmlproject | 16 ++ .../gettingStarted/gsQml/parts/part3/Button.qml | 99 +++++++++ .../gettingStarted/gsQml/parts/part3/EditMenu.qml | 77 +++++++ .../gettingStarted/gsQml/parts/part3/FileMenu.qml | 92 ++++++++ .../gettingStarted/gsQml/parts/part3/MenuBar.qml | 140 +++++++++++++ .../gettingStarted/gsQml/parts/part3/TextArea.qml | 80 +++++++ .../gsQml/parts/part3/TextEditor.qml | 68 ++++++ .../gsQml/parts/part3/images/arrow.png | Bin 0 -> 583 bytes .../part3/pics/qml-texteditor3_texteditor.png | Bin 0 -> 59345 bytes .../gsQml/parts/part3/qml-texteditor3.qmlproject | 16 ++ .../gettingStarted/gsQml/parts/part4/Button.qml | 109 ++++++++++ .../gettingStarted/gsQml/parts/part4/EditMenu.qml | 81 +++++++ .../gettingStarted/gsQml/parts/part4/FileMenu.qml | 96 +++++++++ .../gettingStarted/gsQml/parts/part4/MenuBar.qml | 146 +++++++++++++ .../gsQml/parts/part4/SimpleButton.qml | 59 ++++++ .../gettingStarted/gsQml/parts/part4/TextArea.qml | 80 +++++++ .../gsQml/parts/part4/TextEditor.qml | 146 +++++++++++++ .../gsQml/parts/part4/images/arrow.png | Bin 0 -> 583 bytes .../part4/pics/qml-texteditor4_texteditor.png | Bin 0 -> 63629 bytes .../gsQml/parts/part4/qml-texteditor4.qmlproject | 16 ++ .../gsQml/parts/part5/TextEditor.qml | 127 +++++++++++ .../gsQml/parts/part5/core/Button.qml | 109 ++++++++++ .../gsQml/parts/part5/core/EditMenu.qml | 110 ++++++++++ .../gsQml/parts/part5/core/FileDialog.qml | 170 +++++++++++++++ .../gsQml/parts/part5/core/FileMenu.qml | 232 +++++++++++++++++++++ .../gsQml/parts/part5/core/MenuBar.qml | 148 +++++++++++++ .../gsQml/parts/part5/core/TextArea.qml | 86 ++++++++ .../gettingStarted/gsQml/parts/part5/core/qmldir | 13 ++ .../gsQml/parts/part5/filedialog/cppPlugins.pro | 17 ++ .../gsQml/parts/part5/filedialog/dialogPlugin.cpp | 57 +++++ .../gsQml/parts/part5/filedialog/dialogPlugin.h | 57 +++++ .../gsQml/parts/part5/filedialog/directory.cpp | 219 +++++++++++++++++++ .../gsQml/parts/part5/filedialog/directory.h | 108 ++++++++++ .../gsQml/parts/part5/filedialog/file.cpp | 56 +++++ .../gsQml/parts/part5/filedialog/file.h | 67 ++++++ .../gsQml/parts/part5/filedialog/qmldir | 1 + .../gsQml/parts/part5/images/arrow.png | Bin 0 -> 583 bytes .../parts/part5/pics/qml-texteditor5_editmenu.png | Bin 0 -> 65123 bytes .../parts/part5/pics/qml-texteditor5_filemenu.png | Bin 0 -> 21367 bytes .../parts/part5/pics/qml-texteditor5_newfile.png | Bin 0 -> 76693 bytes .../gsQml/parts/part5/qml-texteditor5.qmlproject | 18 ++ 56 files changed, 3732 insertions(+) create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part0/Button.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/Button.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.qmlproject create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/Button.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.qmlproject create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/Button.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.qmlproject create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/Button.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.qmlproject create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part0/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part0/Button.qml new file mode 100644 index 0000000..ffd4be4 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part0/Button.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +//! [document] +import QtQuick 1.0 + +Rectangle { + id: simplebutton + color: "grey" + width: 150; height: 75 + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: "button label" + } +} +//! [document] diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part1/Button.qml new file mode 100644 index 0000000..bb70cfd --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part1/Button.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + property string label: "button label" + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius: 10 + smooth: true + border{color: "white"; width: 3} + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml new file mode 100644 index 0000000..460f5e9 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part1/EditMenu.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml new file mode 100644 index 0000000..65de4f1 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part1/FileMenu.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml b/examples/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml new file mode 100644 index 0000000..5bb50f8 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part1/SimpleButton.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: simplebutton + + //the rectangle's fill color + color: "grey" + + //dimensions of the button + width: 150; height: 75 + + //A text element contains functionalities for creating texts + Text { + id: buttonLabel + + //center the text inside the parent + anchors.centerIn: parent + + //text property binds to the label displayed on the button + text: "button label" + } + + //define the clickable area to be the whole rectangle + MouseArea { + id: buttonMouseArea + anchors.fill: parent //anchor all sides of the mouse area to the rectangle's anchors + + //onClicked handles valid mouse button clicks + onClicked: console.log(buttonLabel.text + " clicked" ) + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png new file mode 100644 index 0000000..aab64bc Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_button.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png new file mode 100644 index 0000000..d3ff66f Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_editmenu.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png new file mode 100644 index 0000000..f2e2b0d Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_filemenu.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png new file mode 100644 index 0000000..21ce509 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part1/pics/qml-texteditor1_simplebutton.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.qmlproject b/examples/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part1/qml-texteditor.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/tutorials/gettingStarted/gsQml/parts/part2/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part2/Button.qml new file mode 100644 index 0000000..39ac591 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part2/Button.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + property string label: "button label" + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius:10 + smooth: true + border{color: "white"; width: 3} + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml new file mode 100644 index 0000000..fdd06d5 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part2/EditMenu.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml new file mode 100644 index 0000000..bd6669b --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part2/FileMenu.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml b/examples/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml new file mode 100644 index 0000000..8065804 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part2/MenuBar.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000 + height:300 + + property color fileColor: "thistle" + property color editColor: "powderblue" + + //container for the header and the buttons + Rectangle{ + + id: labelList + height:parent.height/10 + width: parent.width + color: "steelblue" + + //default z is 0, items with higher z values are shown on top of items with lower z values + z: 1 + + //row displays its children in a vertical row + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + height: 20 + width: 50 + label: "File" + id: fileButton + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + radius: 1 + + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: { + menuListView.currentIndex = 0 + } + } + Button{ + height: 20 + width: 50 + id: editButton + buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: { + menuListView.currentIndex = 1 + } + + + } + + + } + } + + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png b/examples/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png new file mode 100644 index 0000000..da959a3 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part2/pics/qml-texteditor2_menubar.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.qmlproject b/examples/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part2/qml-texteditor2.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/tutorials/gettingStarted/gsQml/parts/part3/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/Button.qml new file mode 100644 index 0000000..39ac591 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part3/Button.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + property string label: "button label" + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius:10 + smooth: true + border{color: "white"; width: 3} + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml new file mode 100644 index 0000000..fdd06d5 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part3/EditMenu.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml new file mode 100644 index 0000000..bd6669b --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part3/FileMenu.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml new file mode 100644 index 0000000..8065804 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part3/MenuBar.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000 + height:300 + + property color fileColor: "thistle" + property color editColor: "powderblue" + + //container for the header and the buttons + Rectangle{ + + id: labelList + height:parent.height/10 + width: parent.width + color: "steelblue" + + //default z is 0, items with higher z values are shown on top of items with lower z values + z: 1 + + //row displays its children in a vertical row + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + height: 20 + width: 50 + label: "File" + id: fileButton + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + radius: 1 + + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: { + menuListView.currentIndex = 0 + } + } + Button{ + height: 20 + width: 50 + id: editButton + buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: { + menuListView.currentIndex = 1 + } + + + } + + + } + } + + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml new file mode 100644 index 0000000..b0bf664 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part3/TextArea.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id:textArea + + width :400 + height:400 + color: "white" + + Flickable{ + id: flickArea + + width: parent.width + height: parent.height + anchors.fill:parent + + function ensureVisible(r){ + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + + TextEdit{ + id: textEditor + anchors.fill:parent + width:parent.width; height:parent.height + color:"midnightblue" + focus: true + + wrapMode: TextEdit.Wrap + + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml b/examples/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml new file mode 100644 index 0000000..7f0e650 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part3/TextEditor.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + + id: screen + width: 1000; height: 1000 + border.color:"black" + //the screen is partitioned into the MenuBar and TextArea. 1/3 of the screen is assigned to the MenuBar + property int partition: height/3 + + MenuBar{ + id:menuBar + height: partition + width:parent.width + z: 1 + } + + + TextArea{ + id:textArea + anchors.bottom:parent.bottom + y: partition + color: "azure" + height: partition*2 + width:parent.width + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png b/examples/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png new file mode 100644 index 0000000..14978c2 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part3/images/arrow.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png b/examples/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png new file mode 100644 index 0000000..d0623b5 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part3/pics/qml-texteditor3_texteditor.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.qmlproject b/examples/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part3/qml-texteditor3.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/tutorials/gettingStarted/gsQml/parts/part4/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/Button.qml new file mode 100644 index 0000000..36833f5 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/Button.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //attaches to the Text element's text content + property string label + property color textColor: buttonLabel.color + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius:10 + smooth: true + border.color: "white" + border.width: 3 + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label //"button label" //bind the text to the parent's text + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + //animate the color whenever the color property changes + Behavior on color { ColorAnimation{ duration: 55} } + + //scale the button when pressed + scale: buttonMouseArea.pressed ? 1.1 : 1.00 + //Animate the scale property change + Behavior on scale { NumberAnimation{ duration: 55} } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml new file mode 100644 index 0000000..f0a0e36 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/EditMenu.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6A6F70" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D67") } + } + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml new file mode 100644 index 0000000..d257d6a --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/FileMenu.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6C646A" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } + } + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml new file mode 100644 index 0000000..5b0dbf8 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/MenuBar.qml @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000 + height:300 + + property color fileColor: "plum" + property color editColor: "powderblue" + + //container for the header and the buttons + Rectangle{ + + id: labelList + height:parent.height/10 + width: parent.width + color: "beige" + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + + //default z is 0, items with higher z values are shown on top of items with lower z values + z: 1 + + //row displays its children in a vertical row + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + height: 20 + width: 50 + label: "File" + id: fileButton + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + radius: 1 + + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: { + menuListView.currentIndex = 0 + } + } + Button{ + height: 20 + width: 50 + id: editButton + buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: { + menuListView.currentIndex = 1 + } + + + } + + + } + } + + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml new file mode 100644 index 0000000..d360faa --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/SimpleButton.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: simplebutton + color: "grey" + width: 150; height: 75 + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: "button label" + } + + MouseArea{ + id: buttonMouseArea + anchors.fill: parent + onClicked: console.log(buttonLabel.text + " clicked" ) + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml new file mode 100644 index 0000000..4eedf34 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/TextArea.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id:textArea + + width :400 + height:400 + property color fontColor: "white" + + Flickable{ + id: flickArea + + width: parent.width + height: parent.height + anchors.fill:parent + + function ensureVisible(r){ + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + + TextEdit{ + id: textEditor + anchors.fill:parent + width:parent.width; height:parent.height + color:fontColor + focus: true + + wrapMode: TextEdit.Wrap + + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml b/examples/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml new file mode 100644 index 0000000..d218bba --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/TextEditor.qml @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: screen + width: 1000; height: 1000 + property int partition: height/3 + state: "DRAWER_CLOSED" + + + //Item 1: MenuBar on the top portion of the screen + MenuBar{ + id:menuBar + height: partition + //anchors.top:parent.top + width:parent.width + z:1 + } + + + //Item 2: The editable text area + TextArea{ + id:textArea + y:drawer.height + border.color: Qt.darker(color, 1.4) + border.width: 2 + color: "#3F3F3F" + fontColor: "#DCDCCC" + height: partition*2 + width:parent.width + } + + //Item 3: The drawer handle + Rectangle{ + id:drawer + height:15 + width: parent.width + border.color : "#6A6D6A" + border.width: 1 + + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.77; color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#6A6D6A" } + } + + Image{ + id: arrowIcon + source: "images/arrow.png" + anchors.horizontalCenter: parent.horizontalCenter + + Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} + } + + MouseArea{ + id: drawerMouseArea + anchors.fill:parent + onClicked:{ + if (screen.state == "DRAWER_CLOSED"){ + screen.state = "DRAWER_OPEN" + console.log("drawer OPEN") + } + else if (screen.state == "DRAWER_OPEN"){ + screen.state = "DRAWER_CLOSED" + console.log("drawer closed") + } + } + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = Qt.lighter("#6A6D6A") + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = "#6A6D6A" + } + + } + states:[ + State{ + name: "DRAWER_OPEN" + PropertyChanges { target: menuBar; y:0} + PropertyChanges { target: textArea; y: partition + drawer.height} + PropertyChanges { target: drawer; y: partition} + PropertyChanges { target: arrowIcon; rotation: 180} + }, + State{ + name: "DRAWER_CLOSED" + PropertyChanges { target: menuBar; y:-partition} + PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} + PropertyChanges { target: drawer; y: 0} + PropertyChanges { target: arrowIcon; rotation: 0} + } + + ] + transitions: [ + Transition{ + to: "*" + NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } + NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + } + + ] +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png b/examples/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png new file mode 100644 index 0000000..14978c2 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part4/images/arrow.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png b/examples/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png new file mode 100644 index 0000000..a195fb8 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part4/pics/qml-texteditor4_texteditor.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.qmlproject b/examples/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part4/qml-texteditor4.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/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml new file mode 100644 index 0000000..4adcf05 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/TextEditor.qml @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 +import "core" + +Rectangle { + id: screen + width: 1000; height: 1000 + property int partition: height/3 + state: "DRAWER_CLOSED" + + //Item 1: MenuBar on the top portion of the screen + MenuBar{ + id:menuBar + height: screen.partition; width: screen.width + z:1 + } + //Item 2: The editable text area + TextArea{ + id:textArea + y:drawer.height + color: "#3F3F3F" + fontColor: "#DCDCCC" + height: partition*2; width:parent.width + } + //Item 3: The drawer handle + Rectangle{ + id:drawer + height:15; width: parent.width + border.color : "#6A6D6A" + border.width: 1 + z:1 + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.77; color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#6A6D6A" } + } + Image{ + id: arrowIcon + source: "images/arrow.png" + anchors.horizontalCenter: parent.horizontalCenter + + Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} + } + + MouseArea{ + id: drawerMouseArea + anchors.fill:parent + hoverEnabled: true + onEntered: parent.border.color = Qt.lighter("#6A6D6A") + onExited: parent.border.color = "#6A6D6A" + onClicked:{ + if (screen.state == "DRAWER_CLOSED"){ + screen.state = "DRAWER_OPEN" + } + else if (screen.state == "DRAWER_OPEN"){ + screen.state = "DRAWER_CLOSED" + } + } + } + } + + states:[ + State{ + name: "DRAWER_OPEN" + PropertyChanges { target: menuBar; y: 0} + PropertyChanges { target: textArea; y: partition + drawer.height} + PropertyChanges { target: drawer; y: partition} + PropertyChanges { target: arrowIcon; rotation: 180} + }, + State{ + name: "DRAWER_CLOSED" + PropertyChanges { target: menuBar; y:-height; } + PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} + PropertyChanges { target: drawer; y: 0} + PropertyChanges { target: arrowIcon; rotation: 0} + } + ] + + transitions: [ + Transition{ + to: "*" + NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } + NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + } + ] +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml new file mode 100644 index 0000000..c0c1f77 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/Button.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + + //identifier of the item + id: button + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //attaches to the Text element's text content + property string label + property color textColor: buttonLabel.color + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "lightsteelblue" + property color borderColor: "transparent" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + property real labelSize: 14 + //set appearance properties + radius:6 + smooth: true + border.width: 2 + border.color: borderColor + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label //bind the text to the parent's text + color: "#DCDCCC" + font.pointSize: labelSize + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + //animate the color whenever the color property changes + Behavior on color { ColorAnimation{ duration: 55} } + + //scale the button when pressed + scale: buttonMouseArea.pressed ? 1.1 : 1.00 + //Animate the scale property change + Behavior on scale { NumberAnimation{ duration: 55} } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml new file mode 100644 index 0000000..4338d25 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/EditMenu.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: editMenu + height: 480; width:1000 + color: "powderblue" + property color buttonBorderColor: "#7A8182" + property color buttonFillColor: "#61BDCACD" + property string menuName:"Edit" + + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6A7570" } + GradientStop { position: 1.0; color: Qt.darker("#6A7570") } + } + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/9 + Button{ + id: loadButton + buttonColor: buttonFillColor + label: "Copy" + labelSize:16 + borderColor:buttonBorderColor + height: actionContainer.height + width: actionContainer.width/6 + onButtonClick:textArea.copy() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + + Button{ + id: saveButton + height: actionContainer.height + width: actionContainer.width/6 + buttonColor: buttonFillColor + label: "Paste" + borderColor:buttonBorderColor + labelSize:16 + onButtonClick:textArea.paste() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button{ + id: exitButton + label: "Select All" + height: actionContainer.height + width: actionContainer.width/6 + labelSize:16 + buttonColor: buttonFillColor + borderColor:buttonBorderColor + onButtonClick:textArea.selectAll() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + } + } + +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml new file mode 100644 index 0000000..af9d82c --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileDialog.qml @@ -0,0 +1,170 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id:dialog + height: 200 * partition; width: 200 + color: "transparent" + + signal selectChanged() + signal notifyRefresh() + onNotifyRefresh:dirView.model = directory.files + + property string selectedFile + property int selectedIndex: 0 + + Rectangle{ + id: dirBox + radius: 10 + anchors.centerIn:parent + height: parent.height -15; width: parent.width -30 + + Rectangle{ + id:header + height:parent.height*0.1 + width: parent.width + radius:3 + z:1 + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + Text{ + height: header.height + anchors.centerIn: header + text: "files:" + color: "lightblue" + font.weight: Font.Light + font.italic: true + } + } + GridView{ + id:dirView + width:parent.width + height:parent.height*.9 + anchors.top: header.bottom + cellWidth: 100 + cellHeight: 75 +// highlight: Rectangle { width:cellWidth; height: cellHeight; color: "lightsteelblue" ;radius: 13} + model: directory.files + delegate: dirDelegate + clip: true + highlightMoveDuration:40 + } + + Component{ + id:dirDelegate + + Rectangle{ + id:file + color: "transparent" + width: GridView.view.cellWidth; height: GridView.view.cellHeight + + Text{ + id:fileName + width: parent.width + anchors.centerIn:parent + text: name + color: "#BDCACD" + font.weight: GridView.view.currentIndex == index ? Font.DemiBold : Font.Normal + font.pointSize: GridView.view.currentIndex == index ? 12 : 10 + elide: Text.ElideMiddle + horizontalAlignment: Text.AlignHCenter + } + Rectangle{ + id:selection + width:parent.width; height:parent.height + anchors.centerIn: parent + radius: 10 + smooth: true + scale: GridView.view.currentIndex == index ? 1 : 0.5 + opacity: GridView.view.currentIndex == index ? 1 : 0 + Text{ + id:overlay + width: parent.width + anchors.centerIn:parent + text: name + color: "#696167" + font.weight: Font.DemiBold + font.pointSize: 12 + smooth:true + elide: Text.ElideMiddle + horizontalAlignment: Text.AlignHCenter + } + Behavior on opacity{ NumberAnimation{ duration: 45} } + Behavior on scale { NumberAnimation{ duration: 45} } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter("lightsteelblue",1.25) } + GradientStop { position: 0.67; color: Qt.darker("lightsteelblue",1.3) } + } + border.color:"lightsteelblue" + border.width:1 + } + MouseArea{ + id:fileMouseArea + anchors.fill:parent + hoverEnabled: true + + onClicked:{ + GridView.view.currentIndex = index + selectedFile = directory.files[index].name + selectChanged() + } + onEntered:{ + fileName.color = "lightsteelblue" + fileName.font.weight = Font.DemiBold + } + onExited: { + fileName.font.weight = Font.Normal + fileName.color = "#BDCACD" + } + } + } + } + gradient: Gradient{ + GradientStop { position: 0.0; color: "#A5333333" } + GradientStop { position: 1.0; color: "#03333333" } + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml new file mode 100644 index 0000000..1d671e4 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/FileMenu.qml @@ -0,0 +1,232 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: fileMenu + height: 480; width:1000 + property color buttonBorderColor: "#7F8487" + property color buttonFillColor: "#8FBDCACD" + property string fileContent:directory.fileContent + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //used to divide the screen into parts. + property real partition: 1/3 + + color: "#6C646A" + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6C646A" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } + } + + Directory{ + id:directory + filename: textInput.text + onDirectoryChanged:fileDialog.notifyRefresh() + } + + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.left: parent.left + + //the height is a good proportion that creates more space at the top of the column of buttons + width: fileMenu.width * partition; height: fileMenu.height + + Column{ + anchors.centerIn: parent + spacing: parent.height/32 + Button{ + id: saveButton + label: "Save" + borderColor: buttonBorderColor + buttonColor: buttonFillColor + width: actionContainer.width/ 1.3 + height:actionContainer.height / 8 + labelSize:24 + onButtonClick:{ + directory.fileContent = textArea.textContent + directory.filename = textInput.text + directory.saveFile() + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + + } + Button{ + id: loadButton + width: actionContainer.width/ 1.3 + height:actionContainer.height/ 8 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + label: "Load" + labelSize:24 + onButtonClick:{ + directory.filename = textInput.text + directory.loadFile() + textArea.textContent = directory.fileContent + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button{ + id: newButton + width: actionContainer.width/ 1.3 + height:actionContainer.height/ 8 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + label: "New" + labelSize:24 + onButtonClick:{ + textArea.textContent = "" + textInput.text = "" + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + + } + Rectangle{ + id: space + width: actionContainer.width/ 1.3 + height:actionContainer.height / 16 + color:"transparent" + } + Button{ + id: exitButton + width: actionContainer.width/ 1.3 + height:actionContainer.height/ 8 + label: "Exit" + labelSize:24 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + onButtonClick:Qt.quit() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + } + } + + Rectangle{ + id:dialogContainer + + width: 2*fileMenu.width * partition; height: fileMenu.height + anchors.right:parent.right + color:"transparent" + + Column { + anchors.centerIn: parent + spacing: parent.height /640 + FileDialog{ + id:fileDialog + height: 2*dialogContainer.height * partition; width: dialogContainer.width + onSelectChanged: textInput.text = selectedFile + } + + Rectangle{ + id:lowerPartition + height: dialogContainer.height * partition; width: dialogContainer.width + color: "transparent" + + Rectangle{ + id: nameField + gradient: Gradient{ + GradientStop { position: 0.0; color: "#806F6F6F" } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + + radius: 10 + anchors {centerIn:parent; leftMargin: 15; rightMargin: 15; topMargin: 15} + height: parent.height-15; width: parent.width -20 + border {color:"#4A4A4A"; width:1} + + TextInput{ + id: textInput + z:2 + anchors {bottom: parent.bottom; topMargin: 10; horizontalCenter:parent.horizontalCenter} + width: parent.width - 10 + height: parent.height -10 + font.pointSize: 40 + color:"lightsteelblue" + focus:true + } + Text{ + id: textInstruction + anchors.centerIn:parent + text: "Select file name and press save or load" + font {pointSize: 11; weight:Font.Light; italic: true} + color: "lightblue" + z:2 + opacity: (textInput.text == "") ? 1: 0 + } + Text{ + id:fieldLabel + anchors {top: parent.top; left: parent.left} + text: " file name: " + font {pointSize: 11; weight: Font.Light; italic: true} + color: "lightblue" + z:2 + } + MouseArea{ + anchors.centerIn:parent + width: nameField.width; height: nameField.height + onClicked:{ + textInput.text = "" + textInput.focus = true + textInput.forceFocus() + } + } + } + } + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml new file mode 100644 index 0000000..657e5dc --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/MenuBar.qml @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id: menuBar + width: 1000; height:300 + color:"transparent" + property color fileColor: "plum" + property color editColor: "powderblue" + + property real partition: 1/10 + + Column{ + anchors.fill: parent + //container for the header and the buttons + z: 1 + Rectangle{ + id: labelList + height:menuBar.height*partition + width: menuBar.width + color: "beige" + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + Text{ + height: parent.height + anchors {right: labelRow.left ; verticalCenter: parent.bottom} + text: "menu: " + color: "lightblue" + font {weight: Font.Light; italic: true} + smooth: true + } + + //row displays its children in a vertical row + Row{ + id: labelRow + anchors.centerIn: parent + spacing:40 + Button{ + id: fileButton + height: 20; width: 50 + label: "File" + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + labelSize: menuListView.currentIndex == 0? 16:12 + radius: 1 + smooth:true + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: menuListView.currentIndex = 0 + gradient: Gradient{ + GradientStop { position: 0.0; color: fileColor } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + } + Button{ + id: editButton + height: 20; width: 50 + buttonColor : menuListView.currentIndex == 1? Qt.darker(editColor, 1.5) : Qt.darker(editColor, 1.9) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + labelSize: menuListView.currentIndex == 1? 16:12 + smooth:true + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: menuListView.currentIndex = 1 + gradient: Gradient{ + GradientStop { position: 0.0; color: editColor } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + } + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + width:menuBar.width; height: 9*menuBar.height*partition + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + } + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + id:fileMenu + width: menuListView.width; height: menuListView.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width; height: menuListView.height + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml new file mode 100644 index 0000000..d58c159 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/TextArea.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** 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 QtQuick 1.0 + +Rectangle { + id:textArea + + function paste(){ textEdit.paste()} + function copy() { textEdit.copy() } + function selectAll() { textEdit.selectAll() } + + width :400; height:400 + + property color fontColor: "white" + property alias textContent: textEdit.text + Flickable{ + id: flickArea + width: parent.width; height: parent.height + anchors.fill:parent + + boundsBehavior: Flickable.StopAtBounds + flickableDirection: Flickable.HorizontalFlick + interactive: true + //Will move the text Edit area to make the area visible when scrolled with keyboard strokes + function ensureVisible(r){ + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + + TextEdit{ + id: textEdit + anchors.fill:parent + width:parent.width; height:parent.height + color:fontColor + focus: true + wrapMode: TextEdit.Wrap + font.pointSize:10 + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + selectByMouse: true + } + } +} diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir new file mode 100644 index 0000000..3f22778 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/core/qmldir @@ -0,0 +1,13 @@ + +Button ./Button.qml +FileDialog ./FileDialog.qml +TextArea ./TextArea.qml +TextEditor ./TextEditor.qml +EditMenu ./EditMenu.qml +MenuBar ./MenuBar.qml + +plugin FileDialog ../plugins + + + + diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro new file mode 100644 index 0000000..6247747 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro @@ -0,0 +1,17 @@ +TEMPLATE = lib +CONFIG += qt plugin +QT += declarative + +DESTDIR += ../plugins +OBJECTS_DIR = tmp +MOC_DIR = tmp + +TARGET = FileDialog + +HEADERS += directory.h \ + file.h \ + dialogPlugin.h + +SOURCES += directory.cpp \ + file.cpp \ + dialogPlugin.cpp diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp new file mode 100644 index 0000000..7ea44ce --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "dialogPlugin.h" +#include "directory.h" +#include "file.h" +#include + +void DialogPlugin::registerTypes(const char *uri){ + + //register the class Directory into QML as a "Directory" element version 1.0 + qmlRegisterType(uri, 1, 0, "Directory"); + qmlRegisterType(uri,1,0,"File"); + + //qRegisterMetaType > ("QDeclarativeListProperty"); + +} + +//FileDialog is the plugin name (same as the TARGET in the project file) and DialogPlugin is the plugin classs +Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin); \ No newline at end of file diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h new file mode 100644 index 0000000..188e070 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/dialogPlugin.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef DIALOGPLUGIN_H +#define DIALOGPLUGIN_H + +#include + +class DialogPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT + + public: + //registerTypes is inherited from QDeclarativeExtensionPlugin + void registerTypes(const char *uri); + +}; + +#endif + diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp new file mode 100644 index 0000000..cddfa03 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.cpp @@ -0,0 +1,219 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "directory.h" +#include + +/* +Directory constructor + +Initialize the saves directory and creates the file list +*/ +Directory::Directory(QObject *parent) : QObject(parent) +{ + + + m_dir.cd( QDir::currentPath()); + + //go to the saved directory. if not found, create save directory + m_saveDir = "saves"; + if (m_dir.cd(m_saveDir) == 0){ + m_dir.mkdir(m_saveDir); + m_dir.cd(m_saveDir); + } + m_filterList << "*.txt"; + + refresh(); +} + +/* +Directory::filesNumber +Return the number of Files +*/ +int Directory:: filesCount() const{ + return m_fileList.size(); +} + +/* +Function called to append data onto list property +*/ +void appendFiles(QDeclarativeListProperty * property, File * file){ + //Do nothing. can't add to a directory using this method +} + +/* +Function called to retrieve file in the list using an index +*/ +File* fileAt(QDeclarativeListProperty * property, int index){ + return static_cast< QList *>(property->data)->at(index); +} + +/* +Returns the number of files in the list +*/ +int filesSize(QDeclarativeListProperty * property){ + return static_cast< QList *>(property->data)->size(); +} + +/* +Function called to empty the list property contents +*/ +void clearFilesPtr(QDeclarativeListProperty *property){ + return static_cast< QList *>(property->data)->clear(); +} + +/* +Returns the list of files as a QDeclarativeListProperty. +*/ +QDeclarativeListProperty Directory::files(){ + + refresh(); +// return QDeclarativeListProperty(this,m_filePtrList); //not recommended in the docs + return QDeclarativeListProperty( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr ); +} + +/* +Return te name of the currently selected file +*/ +QString Directory::filename() const{ + return currentFile.name(); +} + +/* +Return the file's content as a string. +*/ +QString Directory::fileContent() const{ + return m_fileContent; +} + +/* +Set the file name of the current file +*/ +void Directory::setFilename(const QString &str){ + if(str != currentFile.name()){ + currentFile.setName(str); + emit filenameChanged(); + } +} + +/* +Set the content of the file as a string +*/ +void Directory::setFileContent(const QString &str){ + if(str != m_fileContent){ + m_fileContent = str; + emit fileContentChanged(); + } +} + +/* +Called from QML to save the file using the filename and file content. +Saving makes sure that the file has a .txt extension. +*/ +void Directory::saveFile(){ + + if(currentFile.name().size() == 0){ + qWarning()<< "Empty filename. no save"; + return; + } + + QString extendedName = currentFile.name(); + if(!currentFile.name().endsWith(".txt")){ + extendedName.append(".txt"); + } + + QFile file( m_dir.filePath(extendedName) ); + if (file.open(QFile::WriteOnly | QFile::Truncate)){ + QTextStream outStream(&file); + outStream << m_fileContent; + } + file.close(); + refresh(); + emit directoryChanged(); +} + +/* +Load the contents of a file. +Only loads files with a .txt extension +*/ +void Directory::loadFile(){ + + m_fileContent.clear(); + QString extendedName = currentFile.name(); + if(!currentFile.name().endsWith(".txt")){ + extendedName.append(".txt"); + } + + QFile file( m_dir.filePath(extendedName) ); + if (file.open(QFile::ReadOnly )){ + QTextStream inStream(&file); + + QString line; + do{ + line = inStream.read(75); + m_fileContent.append(line); + }while (!line .isNull()); + } + file.close(); +} + +/* +Reloads the content of the files list. This is to ensure that the newly +created files are added onto the list. +*/ +void Directory::refresh(){ + m_dirFiles = m_dir.entryList(m_filterList,QDir::Files,QDir::Name); + m_fileList.clear(); + + File * file; + for(int i = 0; i < m_dirFiles.size() ; i ++){ + + file = new File(); + + if(m_dirFiles.at(i).endsWith(".txt")){ + QString name = m_dirFiles.at(i); + file->setName( name.remove(".txt",Qt::CaseSensitive)); + } + else{ + file->setName(m_dirFiles.at(i)); + } + m_fileList.append(file); + } +} \ No newline at end of file diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h new file mode 100644 index 0000000..417df68 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/directory.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the 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$ +** +****************************************************************************/ + +#ifndef DIRECTORY_H +#define DIRECTORY_H + +#include "file.h" + +#include +#include +#include +#include +#include + +class Directory : public QObject{ + + Q_OBJECT + + //number of files in the directory + Q_PROPERTY(int filesCount READ filesCount) + + //list property containing file names as QString + Q_PROPERTY(QDeclarativeListProperty files READ files CONSTANT ) + + //file name of the text file to read/write + Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) + + //text content of the file + Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged) + + public: + Directory(QObject *parent = 0); + + //properties' read functions + int filesCount() const; + QString filename() const; + QString fileContent() const; + QDeclarativeListProperty files(); + + //properties' write functions + void setFilename(const QString &str); + void setFileContent(const QString &str); + + //accessible from QML + Q_INVOKABLE void saveFile(); + Q_INVOKABLE void loadFile(); + + signals: + void directoryChanged(); + void filenameChanged(); + void fileContentChanged(); + + private: + QDir m_dir; + QStringList m_dirFiles; + File currentFile; + QString m_saveDir; + QStringList m_filterList; + + //contains the file data in QString format + QString m_fileContent; + + //Registered to QML in a plugin. Accessible from QML as a property of Directory + QList m_fileList; + + //refresh content of the directory + void refresh(); +}; + + +#endif diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp new file mode 100644 index 0000000..f4a360a --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#include "file.h" + +File::File(QObject *parent) : QObject(parent) +{ + m_name = ""; +} + +QString File::name() const{ + return m_name; +} +void File::setName(const QString &str){ + if(str != m_name){ + m_name = str; + emit nameChanged(); + } +} \ No newline at end of file diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h new file mode 100644 index 0000000..b27a143 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/file.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef FILE_H +#define FILE_H + + +#include +#include + +class File : public QObject{ + + Q_OBJECT + + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + + public: + File(QObject *parent = 0); + + QString name() const; + void setName(const QString &str); + + signals: + void nameChanged(); + + private: + QString m_name; +}; + +#endif \ No newline at end of file diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir new file mode 100644 index 0000000..c2b27da --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/qmldir @@ -0,0 +1 @@ +plugin FileDialog plugins diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png b/examples/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png new file mode 100644 index 0000000..14978c2 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part5/images/arrow.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png b/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png new file mode 100644 index 0000000..27feed5 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_editmenu.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png b/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png new file mode 100644 index 0000000..4d8f9f2 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_filemenu.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png b/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png new file mode 100644 index 0000000..680acfe Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/parts/part5/pics/qml-texteditor5_newfile.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject b/examples/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject new file mode 100644 index 0000000..ed034df --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/qml-texteditor5.qmlproject @@ -0,0 +1,18 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + directory: "core" + directory: "filedialog" + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + importPaths: [ " ./plugins " ] +} -- cgit v0.12 From 9d1b4359fc602e85412d1b6d60243d2e65bc5f59 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 6 Oct 2010 16:45:10 +0200 Subject: Doc: Renamed a project file. Task-number: QTBUG-14238 --- .../gsQml/parts/part5/filedialog/cppPlugins.pro | 17 ----------------- .../gsQml/parts/part5/filedialog/filedialog.pro | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-) delete mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro create mode 100644 examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro deleted file mode 100644 index 6247747..0000000 --- a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/cppPlugins.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = lib -CONFIG += qt plugin -QT += declarative - -DESTDIR += ../plugins -OBJECTS_DIR = tmp -MOC_DIR = tmp - -TARGET = FileDialog - -HEADERS += directory.h \ - file.h \ - dialogPlugin.h - -SOURCES += directory.cpp \ - file.cpp \ - dialogPlugin.cpp diff --git a/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro new file mode 100644 index 0000000..6247747 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/parts/part5/filedialog/filedialog.pro @@ -0,0 +1,17 @@ +TEMPLATE = lib +CONFIG += qt plugin +QT += declarative + +DESTDIR += ../plugins +OBJECTS_DIR = tmp +MOC_DIR = tmp + +TARGET = FileDialog + +HEADERS += directory.h \ + file.h \ + dialogPlugin.h + +SOURCES += directory.cpp \ + file.cpp \ + dialogPlugin.cpp -- cgit v0.12 From 5ebb9bca00f401fc3657cc95a2cfafae5a14916e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 15:28:40 +0200 Subject: Doc: Marked some new properties as internal for now. --- src/gui/kernel/qgesture.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 5725a22..e3339c4 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -260,6 +260,27 @@ QGesture::GestureCancelPolicy QGesture::gestureCancelPolicy() const /*! \property QPanGesture::acceleration + \brief the acceleration in the motion of the touch point for this gesture +*/ + +/*! + \property QPanGesture::horizontalVelocity + \brief the horizontal component of the motion of the touch point for this + gesture + \since 4.7.1 + \internal + + \sa verticalVelocity, acceleration +*/ + +/*! + \property QPanGesture::verticalVelocity + \brief the vertical component of the motion of the touch point for this + gesture + \since 4.7.1 + \internal + + \sa horizontalVelocity, acceleration */ /*! @@ -633,6 +654,12 @@ void QPinchGesture::setRotationAngle(qreal value) */ /*! + \property QSwipeGesture::velocity + \since 4.7.1 + \internal +*/ + +/*! \internal */ QSwipeGesture::QSwipeGesture(QObject *parent) -- cgit v0.12 From 0ffaf436d3a90a2f8c6cd81e70ba94f47539f4d3 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 15:32:55 +0200 Subject: Doc: Re-added a link to the Qt site related to testing tools. --- doc/src/development/qtestlib.qdoc | 25 +++++++++++++------------ doc/src/qt-webpages.qdoc | 4 ++-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc index 23d6670..8e2089a 100644 --- a/doc/src/development/qtestlib.qdoc +++ b/doc/src/development/qtestlib.qdoc @@ -32,7 +32,7 @@ \ingroup frameworks-technologies \ingroup qt-basic-concepts - + \keyword qtestlib The QTestLib framework, provided by Nokia, is a tool for unit @@ -40,10 +40,6 @@ all the functionality commonly found in unit testing frameworks as well as extensions for testing graphical user interfaces. - Table of contents: - - \tableofcontents - \section1 QTestLib Features QTestLib is designed to ease the writing of unit tests for Qt @@ -88,6 +84,10 @@ \o Custom types can easily be added to the test data and test output. \endtable + \note For higher-level GUI and application testing needs, please + see the \l{Partner Directory} for Qt testing products provided by + Nokia partners. + \section1 QTestLib API @@ -213,17 +213,17 @@ \endlist \section2 Creating a Benchmark - + To create a benchmark, follow the instructions for creating a test and then add a QBENCHMARK macro to the test function that you want to benchmark. - + \snippet doc/src/snippets/code/doc_src_qtestlib.qdoc 12 - + The code inside the QBENCHMARK macro will be measured, and possibly also repeated several times in order to get an accurate measurement. This depends on the selected measurement back-end. Several back-ends are available. They can be selected on the command line: - + \target testlib-benchmarking-measurement \table @@ -243,7 +243,7 @@ \o -eventcounter \o All platforms \endtable - + In short, walltime is always available but requires many repetitions to get a useful result. Tick counters are usually available and can provide @@ -255,7 +255,7 @@ Event counting is available on all platforms and it provides the number of events that were received by the event loop before they are sent to their corresponding targets (this might include non-Qt events). - + \note Depending on the device configuration, Tick counters on the Windows CE platform may not be as fine-grained, compared to other platforms. Devices that do not support high-resolution timers default to @@ -334,7 +334,7 @@ The CPU tick counters used for benchmarking is licensed under the following license: (from src/testlib/3rdparty/cycle.h) - + \legalese Copyright (c) 2003, 2006 Matteo Frigo\br Copyright (c) 2003, 2006 Massachusetts Institute of Technology @@ -365,6 +365,7 @@ \brief A short introduction to testing with QTestLib. \contentspage QTestLib Manual \nextpage {Chapter 1: Writing a Unit Test}{Chapter 1} + \ingroup best-practices \title QTestLib Tutorial diff --git a/doc/src/qt-webpages.qdoc b/doc/src/qt-webpages.qdoc index 9947d7b..05817df 100644 --- a/doc/src/qt-webpages.qdoc +++ b/doc/src/qt-webpages.qdoc @@ -46,8 +46,8 @@ */ /*! - \externalpage http://qt.nokia.com/products/add-on-products/add-on-products/ - \title Third-Party Tools + \externalpage http://qt.nokia.com/services-partners/partners/partner-directory + \title Partner Directory */ /*! -- cgit v0.12 From 86d121aebedfa2dec1affa5879e4274780f2cc28 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 15:34:22 +0200 Subject: Doc: Fixed qdoc warnings. --- src/declarative/graphicsitems/qdeclarativepath.cpp | 2 +- src/declarative/qml/qdeclarativeinfo.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp index d526688..966c51b 100644 --- a/src/declarative/graphicsitems/qdeclarativepath.cpp +++ b/src/declarative/graphicsitems/qdeclarativepath.cpp @@ -871,7 +871,7 @@ void QDeclarativePathCubic::addToPath(QPainterPath &path) */ /*! - \qmlproperty real value + \qmlproperty real PathPercent::value The proporation of items that should be laid out up to this point. This value should always be higher than the last value specified diff --git a/src/declarative/qml/qdeclarativeinfo.cpp b/src/declarative/qml/qdeclarativeinfo.cpp index c6560dd..56c0599 100644 --- a/src/declarative/qml/qdeclarativeinfo.cpp +++ b/src/declarative/qml/qdeclarativeinfo.cpp @@ -55,7 +55,8 @@ QT_BEGIN_NAMESPACE \fn QDeclarativeInfo qmlInfo(const QObject *object) \relates QDeclarativeEngine - \brief Prints warnings messages that include the file and line number for QML types. + Prints warning messages that include the file and line number for the + specified QML \a object. When QML types display warning messages, it improves traceability if they include the QML file and line number on which the -- cgit v0.12 From 6a23ac7ea68bc87ebceb58c28c398d3f364a3a1f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 15:36:22 +0200 Subject: Doc: Fixed links to the online BSD license information. --- doc/src/getting-started/examples.qdoc | 3 ++- doc/src/legal/opensourceedition.qdoc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index 398eee8..aa0b695 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -53,7 +53,8 @@ deliberately show off Qt's features. You might want to look at these as well. - These examples are provided under the terms of the \l{BSD License}. + These examples are provided under the terms of the + \l{New and Modified BSD Licenses}{Modified BSD License}. \section1 Examples by Functional Area diff --git a/doc/src/legal/opensourceedition.qdoc b/doc/src/legal/opensourceedition.qdoc index e3a3e27..602e6d3 100644 --- a/doc/src/legal/opensourceedition.qdoc +++ b/doc/src/legal/opensourceedition.qdoc @@ -46,7 +46,7 @@ that are compatible with these free software licenses. Additionally, the \l{Qt Examples}{examples} included with Qt are provided under - the terms of the \l{BSD License}. + the terms of the \l{New and Modified BSD Licenses}{Modified BSD License}. The support of open source with the Open Source Versions of Qt has enabled large successful software projects like KDE to thrive, with thousands of developers -- cgit v0.12 From 509dedfe7b8af7bfb8b583dd3d672b5285b044f2 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 17:15:56 +0200 Subject: Doc: Fixed qdoc warnings. --- doc/src/classes/phonon-api.qdoc | 50 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/doc/src/classes/phonon-api.qdoc b/doc/src/classes/phonon-api.qdoc index a429e5a..6c9c8de 100644 --- a/doc/src/classes/phonon-api.qdoc +++ b/doc/src/classes/phonon-api.qdoc @@ -4114,7 +4114,7 @@ */ /*! - \fn Phonon::VideoWidget::snapshot() + \fn Phonon::VideoWidget::snapshot() const \since 4.7 Returns a snapshot of the current frame shown in the widget. @@ -4312,6 +4312,16 @@ */ /*! + \class Phonon::VideoWidgetInterface44 + \inmodule Phonon + \since 4.7 +*/ + +/*! + \fn Phonon::VideoWidgetInterface44::snapshot() const +*/ + +/*! \typedef Phonon::VideoWidgetInterfaceLatest \inmodule Phonon \since 4.7 @@ -5076,6 +5086,22 @@ */ /*! + \fn int Phonon::AudioDataOutput::sampleRate() const + + Returns the sample rate measured in Hertz, as reported by the backend. + If the backend is unavailable -1 is returned. +*/ + +/*! + \fn void Phonon::AudioDataOutput::endOfMedia(int remainingSamples) + + This signal is emitted before the final dataReady() signal is emitted for + a media. The \a remainingSamples value sent by the signal contains the + number of samples that will be sent in the final dataReady() signal for + the media. +*/ + +/*! \fn Phonon::AudioDataOutput::dataReady(const QMap > &data) This signal is emitted whenever there is data available to read. The @@ -5084,13 +5110,28 @@ */ /*! + \fn Phonon::AudioDataOutputPrivate::AudioDataOutputPrivate() + \internal +*/ + +/*! \fn Phonon::AudioDataOutputInterface::~AudioDataOutputInterface() Destroys the data interface. */ /*! - \fn Phonon::AudioDataOutputInterface::frontendObject() + \fn Phonon::AudioDataOutputInterface::frontendObject() const + \internal +*/ + +/*! + \fn Phonon::AudioDataOutputInterface::setFrontendObject(AudioDataOutput *) + \internal +*/ + +/*! + \fn Phonon::GlobalConfigPrivate::GlobalConfigPrivate() \internal */ @@ -5098,3 +5139,8 @@ \fn Phonon::GlobalConfigPrivate::~GlobalConfigPrivate() \internal */ + +/*! + \fn Phonon::SwiftSlider::~SwiftSlider() + \internal +*/ -- cgit v0.12 From ba7bec67c4ff68efa0abf3e204c39324fd6caf55 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 17:49:00 +0200 Subject: Doc: Renamed an external reference to work around an auto-linking issue. --- doc/src/external-resources.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc index 3041046..7d1b5bb 100644 --- a/doc/src/external-resources.qdoc +++ b/doc/src/external-resources.qdoc @@ -436,7 +436,7 @@ /*! \externalpage https://developer.mozilla.org/en/JavaScript - \title JavaScript + \title JavaScript Resources */ /*! -- cgit v0.12 From f447ae026637a75d565e9347eb19f33d09557039 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 19:07:06 +0200 Subject: Doc: Fixed warnings caused by an earlier change. Made docs consistent. Change b65a598e0c580585bd16babfd46967b0f4cf8931 broke some links. --- doc/src/platforms/emb-deployment.qdoc | 2 +- doc/src/platforms/emb-install.qdoc | 6 +++--- doc/src/platforms/emb-qvfb.qdoc | 4 ++-- doc/src/platforms/emb-running.qdoc | 2 +- doc/src/platforms/mac-differences.qdoc | 2 +- doc/src/platforms/qt-embedded-linux.qdoc | 2 +- doc/src/platforms/symbian-introduction.qdoc | 12 ++++++------ doc/src/platforms/wince-customization.qdoc | 2 +- doc/src/platforms/wince-introduction.qdoc | 6 +++--- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/doc/src/platforms/emb-deployment.qdoc b/doc/src/platforms/emb-deployment.qdoc index 6b22ba4..9a36097 100644 --- a/doc/src/platforms/emb-deployment.qdoc +++ b/doc/src/platforms/emb-deployment.qdoc @@ -58,7 +58,7 @@ directory relative to the path set using the \c -prefix parameter when running the \c configure script; ensure that this is a sensible path in the target device environment. See the - \l {Installing Qt on Embedded Linux#Step 3: Building the + \l {Installing Qt for Embedded Linux#Step 3: Building the Library}{installation} documentation for more details. \section1 Environment Variables diff --git a/doc/src/platforms/emb-install.qdoc b/doc/src/platforms/emb-install.qdoc index 11392b4..b5b408a 100644 --- a/doc/src/platforms/emb-install.qdoc +++ b/doc/src/platforms/emb-install.qdoc @@ -28,10 +28,10 @@ /*! \page qt-embedded-install.html - \title Installing Qt on Embedded Linux + \title Installing Qt for Embedded Linux \ingroup qt-embedded-linux \ingroup installation - \brief How to install Qt on Embedded Linux. + \brief How to install Qt for Embedded Linux. This document describes how to install \l{Qt for Embedded Linux} in your development environment: @@ -152,7 +152,7 @@ \endlist Note that the virtual framebuffer requires a Qt for X11 - installation. See \l {Installing Qt on X11 Platforms} for details. + installation. See \l {Installing Qt for X11 Platforms} for details. The Linux framebuffer, on the other hand, is enabled by default on all modern Linux distributions. For information on older versions, diff --git a/doc/src/platforms/emb-qvfb.qdoc b/doc/src/platforms/emb-qvfb.qdoc index 4be2f64..418d2d2 100644 --- a/doc/src/platforms/emb-qvfb.qdoc +++ b/doc/src/platforms/emb-qvfb.qdoc @@ -40,8 +40,8 @@ QVFb is an X11 application supplied with Qt for X11 that provides a virtual framebuffer for Qt for Embedded Linux to use. To use it, - you need to \l{Installing Qt on X11 Platforms}{configure and - install Qt on X11 platforms} appropriately. Further requirements + you need to \l{Installing Qt for X11 Platforms}{configure and + install Qt for X11 platforms} appropriately. Further requirements can be found in the \l{Qt for Embedded Linux Requirements} document. diff --git a/doc/src/platforms/emb-running.qdoc b/doc/src/platforms/emb-running.qdoc index 269f4f3..12222a6 100644 --- a/doc/src/platforms/emb-running.qdoc +++ b/doc/src/platforms/emb-running.qdoc @@ -63,7 +63,7 @@ \row \o Provided that the environment variables are adjusted properly - during the \l {Installing Qt on Embedded Linux}{installation process}, you + during the \l {Installing Qt for Embedded Linux}{installation process}, you should see the \l {Text Edit} demo appear. It might be that the hardware drivers must be specified explicitly diff --git a/doc/src/platforms/mac-differences.qdoc b/doc/src/platforms/mac-differences.qdoc index dfcecca..8436043 100644 --- a/doc/src/platforms/mac-differences.qdoc +++ b/doc/src/platforms/mac-differences.qdoc @@ -32,7 +32,7 @@ \ingroup platform-specific This file outlines known issues and possible workarounds when - using Qt on Mac OS X. Contact Qt's technical support team if you find + using Qt for Mac OS X. Contact Qt's technical support team if you find additional issues which are not covered here. (See also the document \l{qtmac-as-native.html} {Qt is Mac OS X Native}.) diff --git a/doc/src/platforms/qt-embedded-linux.qdoc b/doc/src/platforms/qt-embedded-linux.qdoc index 553c4b1..cd20917 100644 --- a/doc/src/platforms/qt-embedded-linux.qdoc +++ b/doc/src/platforms/qt-embedded-linux.qdoc @@ -67,7 +67,7 @@ \o \list \o \l {Qt for Embedded Linux Architecture}{Architecture Overview} - \o \l {Installing Qt on Embedded Linux}{Installation} + \o \l {Installing Qt for Embedded Linux}{Installation} \o \l {Running Qt for Embedded Linux Applications}{Running Applications} \o \l {Qt for Embedded Linux Examples}{Examples} \endlist diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index 8932747..7bc5303 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -29,7 +29,7 @@ \group qtsymbian \title Qt for the Symbian platform \ingroup qt-embedded - \brief Documents related to Qt on the Symbian platform + \brief Documents related to Qt for the Symbian platform Qt for Symbian is a C++ framework for GUI and application development for embedded devices running Symbian. Qt for Symbian provides all @@ -42,14 +42,14 @@ \o \list \o \l {Qt for the Symbian platform Requirements} - \o \l {Installing Qt on the Symbian platform from a Binary Package} - \o \l {Installing Qt on the Symbian platform} + \o \l {Installing Qt for the Symbian platform from a Binary Package} + \o \l {Installing Qt for the Symbian platform} \o \l {The Symbian platform - Introduction to Qt}{Introduction to using Qt} \endlist \o \list \o \l {Exception Safety with Symbian} - \o \l {Platform Notes - Symbian} {Qt for the Symbian platform - state of support} + \o \l {Platform and Compiler Notes - Symbian} {Qt for the Symbian platform - state of support} \o \l {qmake Platform Notes#Symbian platform} {Qt for Symbian extensions for qmake} \o \l {Symbian Platform Security Requirements} {Symbian Platform Security Requirements} \endlist @@ -93,10 +93,10 @@ \section1 Installing Qt and Running Demos - Follow the instructions found in \l{Installing Qt on the Symbian platform from a Binary Package} + Follow the instructions found in \l{Installing Qt for the Symbian platform from a Binary Package} to learn how to install Qt using a binary package and how to build and run Qt demos. - Follow the instructions found in \l{Installing Qt on the Symbian platform} to learn how to install Qt using + Follow the instructions found in \l{Installing Qt for the Symbian platform} to learn how to install Qt using using source package and how to build and run the Qt demos. \section1 Building Your Own Applications diff --git a/doc/src/platforms/wince-customization.qdoc b/doc/src/platforms/wince-customization.qdoc index a674350..b3b9170 100644 --- a/doc/src/platforms/wince-customization.qdoc +++ b/doc/src/platforms/wince-customization.qdoc @@ -33,7 +33,7 @@ When working with a custom SDK for Windows CE, Qt provides an easy way to add support for it to your development environment. The following is - a tutorial that covers how to create a specification for Qt on Windows + a tutorial that covers how to create a specification for Qt for Windows CE platforms. \tableofcontents diff --git a/doc/src/platforms/wince-introduction.qdoc b/doc/src/platforms/wince-introduction.qdoc index cd66242..2e9da59 100644 --- a/doc/src/platforms/wince-introduction.qdoc +++ b/doc/src/platforms/wince-introduction.qdoc @@ -29,7 +29,7 @@ \group qtce \title Qt for Windows CE \ingroup qt-embedded - \brief Documents related to Qt on Windows CE + \brief Documents related to Qt for Windows CE Qt for Windows CE is a C++ framework for GUI and application development for embedded devices running Windows CE. It runs on a variety of processors, @@ -41,7 +41,7 @@ \o \list \o \l {Qt for Windows CE Requirements} - \o \l {Installing Qt on Windows CE} + \o \l {Installing Qt for Windows CE} \o \l {Windows CE - Introduction to using Qt}{Introduction to using Qt} \endlist \o @@ -81,7 +81,7 @@ \section1 Installing Qt - Follow the instructions found in \l{Installing Qt on Windows CE}. + Follow the instructions found in \l{Installing Qt for Windows CE}. \section1 Building your own applications -- cgit v0.12 From 6b75ccad5829571eb6df9a0bbb05be2ac1480032 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 19:10:07 +0200 Subject: Doc: Fixed warnings caused by an earlier change. Made docs consistent. Related to change f447ae026637a75d565e9347eb19f33d09557039. --- doc/src/development/qtestlib.qdoc | 2 +- doc/src/getting-started/installation.qdoc | 8 ++++---- doc/src/qt4-intro.qdoc | 2 +- doc/src/sql-programming/sql-driver.qdoc | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc index 0379027..e53957f 100644 --- a/doc/src/development/qtestlib.qdoc +++ b/doc/src/development/qtestlib.qdoc @@ -320,7 +320,7 @@ host computer and the device. Thus header files and libraries are needed to compile cetest and QtRemote successfully. - Prior to \l{Installing Qt on Windows CE}{installation} of Qt, you need to set your + Prior to \l{Installing Qt for Windows CE}{installation} of Qt, you need to set your \c INCLUDE and \c LIB environment variables properly. A default installation of Windows Mobile 5 for Pocket PC can be obtained by: diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index c6e79d9..8f6f16a 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -40,7 +40,7 @@ for your platform from the following list. */ /*! \page install-x11.html -\title Installing Qt on X11 Platforms +\title Installing Qt for X11 Platforms \ingroup installation \brief How to install Qt on platforms with X11. \previouspage Installation @@ -151,7 +151,7 @@ for your platform from the following list. /*! \page install-win.html -\title Installing Qt on Windows +\title Installing Qt for Windows \ingroup installation \brief How to install Qt on Windows. \previouspage Installation @@ -269,7 +269,7 @@ for your platform from the following list. */ /*! \page install-mac.html -\title Installing Qt on Mac OS X +\title Installing Qt for Mac OS X \ingroup installation \brief How to install Qt on Mac OS X. \previouspage Installation @@ -563,7 +563,7 @@ in the \l{Qt for the Symbian platform Requirements} document. This document describes how to install and configure Qt for the Symbian platform from scratch. If you are using pre-built binaries, follow -the instructions given in the \l{Installing Qt on the Symbian platform from a +the instructions given in the \l{Installing Qt for the Symbian platform from a Binary Package} document. \section1 Step 1: Set Up the Development Environment diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index 7d55f82..2384051 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -157,7 +157,7 @@ \l{QtUiTools}{dynamic user interface building}. \o New \l{Proxy Models}{proxy models} to enable view-specific sorting and filtering of data displayed using item views. - \o Support for \l{Installing Qt on Mac OS X}{universal binaries} on Mac OS X. + \o Support for \l{Installing Qt for Mac OS X}{universal binaries} on Mac OS X. \o Additional features for developers using \l{QtOpenGL}{OpenGL}, such as support for pixel and sample buffers. \o A flexible \l{QSyntaxHighlighter}{syntax highlighting class} based on the diff --git a/doc/src/sql-programming/sql-driver.qdoc b/doc/src/sql-programming/sql-driver.qdoc index 21b106a..9c99ad2 100644 --- a/doc/src/sql-programming/sql-driver.qdoc +++ b/doc/src/sql-programming/sql-driver.qdoc @@ -153,7 +153,7 @@ \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 3 - After installing Qt, as described in the \l{Installing Qt on X11 + After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document, you also need to install the plugin in the standard location: @@ -478,7 +478,7 @@ \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 13 - After installing Qt, as described in the \l{Installing Qt on X11 Platforms} document, + After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document, you also need to install the plugin in the standard location: \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 14 @@ -565,7 +565,7 @@ \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 18 - After installing Qt, as described in the \l{Installing Qt on X11 Platforms} document, + After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document, you also need to install the plugin in the standard location: \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 19 @@ -638,7 +638,7 @@ \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 21 - After installing Qt, as described in the \l{Installing Qt on X11 Platforms} document, + After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document, you also need to install the plugin in the standard location: \snippet doc/src/snippets/code/doc_src_sql-driver.qdoc 22 -- cgit v0.12 From 2a4c0afc95d1cbed3161efd43bb781758bc7566d Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 19:15:59 +0200 Subject: Doc: Fixed snippet reference for the Getting Started QML guide. Related to change 96226ad15202770f72e257d1a75654be9582326c. --- doc/src/getting-started/gettingstartedqml.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc index 065628a..c555627 100644 --- a/doc/src/getting-started/gettingstartedqml.qdoc +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -81,7 +81,7 @@ In QML, the basic visual item is the \l {Rectangle}{Rectangle} element. The \c Rectangle element has properties to control the element's appearance and location. - \snippet examples/tutorials/gettingStarted/gsQml/core/Button.qml document + \snippet examples/tutorials/gettingStarted/gsQml/parts/part0/Button.qml document First, the \c { import QtQuick 1.0 } allows the qmlviewer tool to import the QML elements we will later use. This line must exist for every QML file. Notice that the version -- cgit v0.12 From 3973481089f9101668c20a9317b759e09a784070 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 7 Oct 2010 19:19:15 +0200 Subject: Doc: Fixed qdoc warnings. --- src/declarative/util/qlistmodelinterface.cpp | 8 ++------ src/plugins/accessible/widgets/simplewidgets.cpp | 6 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/declarative/util/qlistmodelinterface.cpp b/src/declarative/util/qlistmodelinterface.cpp index acf4dd6..1e2dfb7 100644 --- a/src/declarative/util/qlistmodelinterface.cpp +++ b/src/declarative/util/qlistmodelinterface.cpp @@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE /*! \internal \class QListModelInterface + \since 4.7 \brief The QListModelInterface class can be subclassed to provide C++ models to QDeclarativeGraphics Views This class is comprised primarily of pure virtual functions which @@ -70,15 +71,10 @@ QT_BEGIN_NAMESPACE Returns the number of data entries in the model. */ -/*! \fn QHash QListModelInterface::data(int index, const QList& roles) const +/*! \fn QVariant QListModelInterface::data(int index, int role) const Returns the data at the given \a index for the specified \a roles. */ -/*! \fn bool QListModelInterface::setData(int index, const QHash& values) - Sets the data at the given \a index. \a values is a mapping of - QVariant values to roles. Returns false. -*/ - /*! \fn QList QListModelInterface::roles() const Returns the list of roles for which the list model interface provides data. diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index f39d538..4a3acbb 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -602,7 +602,7 @@ int QAccessibleDisplay::navigate(RelationFlag rel, int entry, QAccessibleInterfa return QAccessibleWidgetEx::navigate(rel, entry, target); } -/*! \reimp */ +/*! \internal */ QString QAccessibleDisplay::imageDescription() { #ifndef QT_NO_TOOLTIP @@ -612,7 +612,7 @@ QString QAccessibleDisplay::imageDescription() #endif } -/*! \reimp */ +/*! \internal */ QSize QAccessibleDisplay::imageSize() { QLabel *label = qobject_cast(widget()); @@ -624,7 +624,7 @@ QSize QAccessibleDisplay::imageSize() return pixmap->size(); } -/*! \reimp */ +/*! \internal */ QRect QAccessibleDisplay::imagePosition(QAccessible2::CoordinateType coordType) { QLabel *label = qobject_cast(widget()); -- cgit v0.12 From 436d41eabc5c4953f578c9ca1cbfb065d6fe8612 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 8 Oct 2010 18:16:23 +0200 Subject: Doc: Fixed qdoc warnings. --- doc/src/examples/webkit-bridge-imageanalyzer.qdoc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/src/examples/webkit-bridge-imageanalyzer.qdoc b/doc/src/examples/webkit-bridge-imageanalyzer.qdoc index b8c42c6..cee2659 100644 --- a/doc/src/examples/webkit-bridge-imageanalyzer.qdoc +++ b/doc/src/examples/webkit-bridge-imageanalyzer.qdoc @@ -24,9 +24,10 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + /*! \example webkit/imageanalyzer - \startpage {index.html} {Qt Reference Documentation} + \startpage {index.html}{Qt Reference Documentation} \title The Webkit Bridge Tutorial - Hybrid Client Application In this example, we will show how to write a hybrid application using @@ -84,7 +85,7 @@ page's mainFrame with \c addToJavaScriptWindowObject(). \snippet examples/webkit/imageanalyzer/resources/index.html sample images - Clicking an image adds it to an images list. +Clicking an image adds it to an images list. \snippet examples/webkit/imageanalyzer/resources/index.html addImage -- cgit v0.12 From e8cbed0e9cb3f074405bdc67772d449e312a3b78 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 8 Oct 2010 18:37:15 +0200 Subject: Doc: Fixed documentation style and qdoc warnings. Task-number: QTBUG-12071 --- doc/src/frameworks-technologies/dnd.qdoc | 2 +- doc/src/frameworks-technologies/model-view-programming.qdoc | 12 ++++++------ src/corelib/kernel/qabstractitemmodel.cpp | 10 +++++----- src/gui/itemviews/qabstractitemview.cpp | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/src/frameworks-technologies/dnd.qdoc b/doc/src/frameworks-technologies/dnd.qdoc index 56b461e..356bf9b 100644 --- a/doc/src/frameworks-technologies/dnd.qdoc +++ b/doc/src/frameworks-technologies/dnd.qdoc @@ -44,7 +44,7 @@ outlines the approach used to enable it in custom widgets. Drag and drop operations are also supported by Qt's item views and by the graphics view framework. More information is available in - \l{Using drag & drop with item views} and \l{Graphics View + \l{Using drag and drop with item views} and \l{Graphics View Framework}. \section1 Drag and Drop Classes diff --git a/doc/src/frameworks-technologies/model-view-programming.qdoc b/doc/src/frameworks-technologies/model-view-programming.qdoc index 6de567c..cc98432 100644 --- a/doc/src/frameworks-technologies/model-view-programming.qdoc +++ b/doc/src/frameworks-technologies/model-view-programming.qdoc @@ -32,7 +32,7 @@ /*! \page model-view-programming.html - \ingroup qt-basic-concepts + \ingroup qt-basic-concepts \title Model/View Programming \brief A guide to Qt's extensible model/view architecture. @@ -1635,7 +1635,7 @@ contain the text given in the search string. This pattern can also be used in the list and table widgets. - \section1 Using drag & drop with item views + \section1 Using Drag and Drop with Item Views Qt's drag and drop infrastructure is fully supported by the model/view framework. Items in lists, tables, and trees can be dragged within the views, and data can be @@ -1715,7 +1715,7 @@ of QAbstractItemModel::removeRows(), either directly or by inheriting the implementation from its base class. - \section3 Enabling drag & drop for items + \section3 Enabling drag and drop for items Models indicate to views which items can be dragged, and which will accept drops, by reimplementing the QAbstractItemModel::flags() function to provide suitable @@ -2154,7 +2154,7 @@ models to supply some unique identifier to this function to ensure that the model index can be re-associated with its corresponding item later on. - \section2 Drag & drop support and MIME type handling + \section2 Drag and drop support and MIME type handling The model/view classes support drag and drop operations, providing default behavior that is sufficient for many applications. However, it is also possible to customize @@ -2283,7 +2283,7 @@ \endlist For more information about drag and drop with item views, refer to - \l{Using drag & drop with item views}. + \l{Using drag and drop with item views}. \section3 Convenience views @@ -2294,7 +2294,7 @@ the existing contents with the data being transferred, the underlying model will set the data of the target items rather than insert new rows and columns into the model. For more information on drag and drop in convenience views, - you can see \l{Using drag & drop with item views}. + you can see \l{Using drag and drop with item views}. \section2 Performance optimization for large amounts of data diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 6e37aee..a0f7893 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -1197,7 +1197,7 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, \l{QAbstractItemModel::}{endInsertRows()} must be called. \sa {Model Classes}, {Model Subclassing Reference}, QModelIndex, - QAbstractItemView, {Using drag & drop with item views}, + QAbstractItemView, {Using drag and drop with item views}, {Simple DOM Model Example}, {Simple Tree Model Example}, {Editable Tree Model Example}, {Fetch More Example} */ @@ -1760,7 +1760,7 @@ QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const where to place the data. This can occur in a tree when data is dropped on a parent. Models will usually append the data to the parent in this case. - \sa supportedDropActions(), {Using drag & drop with item views} + \sa supportedDropActions(), {Using drag and drop with item views} */ bool QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) @@ -1797,7 +1797,7 @@ bool QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction acti reimplement the dropMimeData() function to handle the additional operations. - \sa dropMimeData(), Qt::DropActions, {Using drag & drop with item + \sa dropMimeData(), Qt::DropActions, {Using drag and drop with item views} */ Qt::DropActions QAbstractItemModel::supportedDropActions() const @@ -1814,7 +1814,7 @@ Qt::DropActions QAbstractItemModel::supportedDropActions() const supportedDragActions() is used by QAbstractItemView::startDrag() as the default values when a drag occurs. - \sa Qt::DropActions, {Using drag & drop with item views} + \sa Qt::DropActions, {Using drag and drop with item views} */ Qt::DropActions QAbstractItemModel::supportedDragActions() const { @@ -1830,7 +1830,7 @@ Qt::DropActions QAbstractItemModel::supportedDragActions() const Sets the supported drag \a actions for the items in the model. - \sa supportedDragActions(), {Using drag & drop with item views} + \sa supportedDragActions(), {Using drag and drop with item views} */ void QAbstractItemModel::setSupportedDragActions(Qt::DropActions actions) { diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 4ffd284..95e92c9 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -1363,7 +1363,7 @@ bool QAbstractItemView::dragEnabled() const Note that the model used needs to provide support for drag and drop operations. - \sa setDragDropMode() {Using drag & drop with item views} + \sa setDragDropMode() {Using drag and drop with item views} */ /*! -- cgit v0.12 From 227416bd859bca799ca1361ea1cb9b9cf9aa6977 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 8 Oct 2010 18:39:09 +0200 Subject: Doc: Removed non-ASCII characters and reformatted the text. --- doc/src/platforms/emb-hardwareacceleration.qdocinc | 280 ++++++++++----------- 1 file changed, 140 insertions(+), 140 deletions(-) diff --git a/doc/src/platforms/emb-hardwareacceleration.qdocinc b/doc/src/platforms/emb-hardwareacceleration.qdocinc index fb00e09..83ecef5 100644 --- a/doc/src/platforms/emb-hardwareacceleration.qdocinc +++ b/doc/src/platforms/emb-hardwareacceleration.qdocinc @@ -1,140 +1,140 @@ - \section1 Hardware Acceleration - - When designing applications for embedded devices there is often a - compromise between graphics effects and performance. On most - devices, you cannot have both simply because the hardware needed - for such operations just is not there. With a growing number of - devices that use hardware dedicated to graphics operations there is - less need to compromise. - - In addition to enabling dynamic graphics effects, there are two - other benefits to using graphics acceleration. One is that graphics - acceleration hardware is more power efficient than using the CPU. - The reason for this is that the CPU might require a clock speed - that is up to 20 times higher than the GPU, achieving the same - results. E.g. a typical hardware accelerated mobile graphics unit - can rasterize one or two bilinear texture fetches in one cycle, - while a software implementation takes easily more than 20 cycles. - Typical \e {System-on-a-chip} (SoC) graphics hardware generally have - a much lower clock speed and memory bandwidth, and different level - of acceleration than desktop GPUs. One example is that many GPUs - leave out transformation and lighting from the graphics pipeline - and only implements rasterization. - - Another reason to use a GPU is to offload the main CPU, either for - power saving or to perform other operations in parallel. Often - drawing speed with a GPU is not that much faster than a CPU but - the clear benefit of using the GPU is to free up the CPU to perform - other tasks which can be used to create a more responsive use - experience. - - The key to writing good applications for devices is therefore to - limit the wow factor down to what the target hardware can handle, - and to take advantage of any graphics dedicated hardware. Qt - provides several ways to both render advanced effects on the screen - and speed up your application using hardware accelerated graphics. - - \tableofcontents - - \section2 Qt for Embedded Graphics pipeline - - Qt uses QPainter for all graphics operations. By using the same API - regardless of platform, the code can be reused on different devices. - QPainter use different paint engines implemented in the QPaintEngine API to - do the actual painting. - - The QPaintEngine API provides paint engines for each window system and - painting framework supported by Qt. In regards to Qt for Embedded, this - also includes implementations for OpenGL ES versions 1.1 and 2.0, as well - as OpenVG and DirectFB(Embedded Linux only). - - By using one of these paint engines, you will be able to improve the - graphics performance of your Qt application. However, if the graphics - operations used are not supported, this might as well be a trap, slowing - down your application significantly. This all depends on what kind of - graphics operations that are supported by the target devices hardware - configuration. - - \image platformHWAcc.png - - The paint engine will direct all graphics operations supported by the - devices hardware to the GPU, and from there they are sent to the - framebuffer. Unsupported graphics operations falls back to the - QRasterPaintEngine and are handled by the CPU before sent to the - framebuffer. In the end, the operating system sends the paint updates off - to the screen/display. The fallback operation is quite expensive in regards - to memory consumption, and should be avoided. - - \section2 Hardware configuration requirements - - Before implementing any application using hardware acceleration, it is wise - to get an overview of what kind of hardware accelerated graphics operations - that are available for the target device. - - \note On devices with no hardware acceleration, Qt will use - QRasterPaintEngine, which handles the acceleration using software. On - devices supporting OpenGL ES, OpenVG or DirectFB(not supported by Windows - CE), Qt will use the - respective paint engines to accelerate painting. However, hardware - configurations that only support a limited set of hardware acceleration - features, might slow the application graphics down rather than speeding it - up when using unsupported operations that must fall back to the raster - engine. - - \section3 Different architectures - - Based on the architecture used in a device we can make a recommendation on - which hardware acceleration techniques to use. There are mainly two - different architectures on embedded devices. These are devices with a - Unified Memory Architecture (UMA), and devices with dedicated graphics - memory. Generally, high-end devices will have dedicated graphics memory. - Low-end devices will just use system memory, sometimes reserving a memory - region and sometimes not. - - In addition to this, we can categorize the devices into five types based on - the different graphics operations supported by their hardware. - - \list 1 - \o No support for graphics acceleration. - \o Support for blitter and alpha blending. - \o Support for path based 2D vector graphics. - \o Support for fixed function 3D graphics. - \o Support for programmable 3D graphics. - \endlist - - Based on these characteristics the table below recommends which paint - engines to use with the different types of hardware configurations. - - \section3 Recommended use of hardware acceleration based on hardware - - \table - \header - \o Type - \o UMA - \o Non-UMA - \row - \o \bold {None} - \o Qt Raster Engine - \o Qt Raster Engine - \row - \o \bold {Blitter} - \o DirectFB - \o DirectFB - \row - \o \bold {2D Vector} - \o OpenVG - \o OpenVG - \row - \o \bold {Fixed 3D} - \o OpenGL (ES) 1.x - \o OpenGL (ES) 1.x - \row - \o \bold {Programmable 3D} - \o OpenGL (ES) 2.x - \o OpenGL (ES) 2.x - \endtable - - \note Since the DirectFB API is quite primitive, the raster paint engine - handles most of the operations. - - \note Blitter and Alpha blending is currently not supported on Windows CE. +\section1 Hardware Acceleration + +When designing applications for embedded devices there is often a +compromise between graphics effects and performance. On most +devices, you cannot have both simply because the hardware needed +for such operations just is not there. With a growing number of +devices that use hardware dedicated to graphics operations there is +less need to compromise. + +In addition to enabling dynamic graphics effects, there are two +other benefits to using graphics acceleration. One is that graphics +acceleration hardware is more power efficient than using the CPU. +The reason for this is that the CPU might require a clock speed +that is up to 20 times higher than the GPU, achieving the same +results. E.g. a typical hardware accelerated mobile graphics unit +can rasterize one or two bilinear texture fetches in one cycle, +while a software implementation takes easily more than 20 cycles. +Typical \e {System-on-a-chip} (SoC) graphics hardware generally have +a much lower clock speed and memory bandwidth, and different level +of acceleration than desktop GPUs. One example is that many GPUs +leave out transformation and lighting from the graphics pipeline +and only implements rasterization. + +Another reason to use a GPU is to offload the main CPU, either for +power saving or to perform other operations in parallel. Often +drawing speed with a GPU is not that much faster than a CPU but +the clear benefit of using the GPU is to free up the CPU to perform +other tasks which can be used to create a more responsive use +experience. + +The key to writing good applications for devices is therefore to +limit the wow factor down to what the target hardware can handle, +and to take advantage of any graphics dedicated hardware. Qt +provides several ways to both render advanced effects on the screen +and speed up your application using hardware accelerated graphics. + +\tableofcontents + +\section2 Qt for Embedded Graphics pipeline + +Qt uses QPainter for all graphics operations. By using the same API +regardless of platform, the code can be reused on different devices. +QPainter use different paint engines implemented in the QPaintEngine API to +do the actual painting. + +The QPaintEngine API provides paint engines for each window system and +painting framework supported by Qt. In regards to Qt for Embedded, this +also includes implementations for OpenGL ES versions 1.1 and 2.0, as well +as OpenVG and DirectFB(Embedded Linux only). + +By using one of these paint engines, you will be able to improve the +graphics performance of your Qt application. However, if the graphics +operations used are not supported, this might as well be a trap, slowing +down your application significantly. This all depends on what kind of +graphics operations that are supported by the target devices hardware +configuration. + +\image platformHWAcc.png + +The paint engine will direct all graphics operations supported by the +devices hardware to the GPU, and from there they are sent to the +framebuffer. Unsupported graphics operations falls back to the +QRasterPaintEngine and are handled by the CPU before sent to the +framebuffer. In the end, the operating system sends the paint updates off +to the screen/display. The fallback operation is quite expensive in regards +to memory consumption, and should be avoided. + +\section2 Hardware configuration requirements + +Before implementing any application using hardware acceleration, it is wise +to get an overview of what kind of hardware accelerated graphics operations +that are available for the target device. + +\note On devices with no hardware acceleration, Qt will use +QRasterPaintEngine, which handles the acceleration using software. On +devices supporting OpenGL ES, OpenVG or DirectFB(not supported by Windows +CE), Qt will use the +respective paint engines to accelerate painting. However, hardware +configurations that only support a limited set of hardware acceleration +features, might slow the application graphics down rather than speeding it +up when using unsupported operations that must fall back to the raster +engine. + +\section3 Different architectures + +Based on the architecture used in a device we can make a recommendation on +which hardware acceleration techniques to use. There are mainly two +different architectures on embedded devices. These are devices with a +Unified Memory Architecture (UMA), and devices with dedicated graphics +memory. Generally, high-end devices will have dedicated graphics memory. +Low-end devices will just use system memory, sometimes reserving a memory +region and sometimes not. + +In addition to this, we can categorize the devices into five types based on +the different graphics operations supported by their hardware. + +\list 1 + \o No support for graphics acceleration. + \o Support for blitter and alpha blending. + \o Support for path based 2D vector graphics. + \o Support for fixed function 3D graphics. + \o Support for programmable 3D graphics. +\endlist + +Based on these characteristics the table below recommends which paint +engines to use with the different types of hardware configurations. + +\section3 Recommended use of hardware acceleration based on hardware + +\table + \header + \o Type + \o UMA + \o Non-UMA + \row + \o \bold {None} + \o Qt Raster Engine + \o Qt Raster Engine + \row + \o \bold {Blitter} + \o DirectFB + \o DirectFB + \row + \o \bold {2D Vector} + \o OpenVG + \o OpenVG + \row + \o \bold {Fixed 3D} + \o OpenGL (ES) 1.x + \o OpenGL (ES) 1.x + \row + \o \bold {Programmable 3D} + \o OpenGL (ES) 2.x + \o OpenGL (ES) 2.x +\endtable + +\note Since the DirectFB API is quite primitive, the raster paint engine +handles most of the operations. + +\note Blitter and Alpha blending is currently not supported on Windows CE. -- cgit v0.12 From 740b794259eb41845e7529371de3f3e20235f7b4 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 8 Oct 2010 20:11:27 +0200 Subject: Doc: Reorganized the platform and compiler notes pages. Errors and omissions will be fixed in later commits. The idea here is to merge the compiler notes into the platform notes because the platform is usually fixed and the compiler is often determined by the platform. In addition, notes about compilers are not always applicable to multiple platforms, so collating notes by compiler does not save much space, and it only makes maintenance of the notes more difficult. --- doc/src/bughowto.qdoc | 2 +- doc/src/development/developing-with-qt.qdoc | 6 +- doc/src/platforms/compiler-notes.qdoc | 269 +-------------------- doc/src/platforms/platform-notes-rtos.qdoc | 8 +- doc/src/platforms/platform-notes.qdoc | 346 +++++++++++++++++++++++----- doc/src/platforms/supported-platforms.qdoc | 5 +- doc/src/platforms/winsystem.qdoc | 4 +- 7 files changed, 311 insertions(+), 329 deletions(-) diff --git a/doc/src/bughowto.qdoc b/doc/src/bughowto.qdoc index a7b5569..1793fce 100644 --- a/doc/src/bughowto.qdoc +++ b/doc/src/bughowto.qdoc @@ -34,7 +34,7 @@ about it so that we can fix it. Before reporting a bug, please check the \l{FAQs}, \l{Platform - Notes}, and the \l{Qt Bug Tracker} on the Qt website to see + and Compiler Notes}, and the \l{Qt Bug Tracker} on the Qt website to see if the issue is already known. The first thing you should do is to sign up for an account for diff --git a/doc/src/development/developing-with-qt.qdoc b/doc/src/development/developing-with-qt.qdoc index 3972b59..6793abd 100644 --- a/doc/src/development/developing-with-qt.qdoc +++ b/doc/src/development/developing-with-qt.qdoc @@ -81,8 +81,8 @@ \o \l {Compiler Notes} \o \l {Developing Qt Applications for Mac OS X} \o \l {Known Issues} - \o \l {Platform Notes} - \o \l {Platform Notes - Symbian} + \o \l {Platform and Compiler Notes} + \o \l {Platform and Compiler Notes - Symbian} \o \l {ActiveX in Qt} \o \l {Qt for Embedded Linux Classes} \o \l {Qt for Embedded Platforms} @@ -112,4 +112,4 @@ \endtable -*/ \ No newline at end of file +*/ diff --git a/doc/src/platforms/compiler-notes.qdoc b/doc/src/platforms/compiler-notes.qdoc index 5ff3112..fb534df 100644 --- a/doc/src/platforms/compiler-notes.qdoc +++ b/doc/src/platforms/compiler-notes.qdoc @@ -31,273 +31,14 @@ \title Compiler Notes \brief Information about the C++ compilers and tools used to build Qt. - This page contains information about the C++ compilers and tools used - to build Qt on various platforms. + This page used to contain information about the C++ compilers and tools + used to build Qt on various platforms. This information is now maintained + in the \l{Platform and Compiler Notes} for each platform. - \tableofcontents - - Please refer to the \l{Platform Notes} for information on the platforms - Qt is currently known to run on, and see the \l{Supported Platforms} - page for information about the status of each platform. + Please refer to the \l{Supported Platforms} page for information about the + status of each platform. If you have anything to add to this list or any of the platform or compiler-specific pages, please submit it via the \l{Bug Report Form} or through the \l{Public Qt Repository}. - - \section1 Supported Features - - Not all compilers used to build Qt are able to compile all modules. The following table - shows the compiler support for five modules that are not uniformly available for all - platforms and compilers. - - \table - \header \o Compiler \o{5,1} Features - \header \o \o Concurrent \o XmlPatterns \o WebKit(*) \o CLucene \o Phonon - \row \o g++ 3.3 \o \o \bold{X} \o \o \bold{X} \o \bold{X} - \row \o g++ 3.4 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \row - \row \o SunCC 5.5 \o \o \o \o \bold{X} \o \bold{X} - \row - \row \o aCC series 3 \o \o \o \o \bold{X} \o \bold{X} - \row \o aCC series 6 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \row \o xlC 6 \o \o \o \o \bold{X} \o \bold{X} - \row \o Intel CC 10 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \row - \row \o MSVC 2003 \o \bold{X} \o \bold{X} \o \o \bold{X} \o \bold{X} - \row \o MSVC 2005 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \endtable - - * WebKit is only supported as a dynamically built library. Static linkage is not supported. - - \target GCC - \section1 GCC - - \section2 GCC on Windows (MinGW) - - We have tested Qt with this compiler on Windows XP. - The minimal version of MinGW supported is: - - \list - \o GCC 3.4.2 - \o MinGW runtime 3.7 - \o win32api 3.2 - \o binutils 2.15.91 - \o mingw32-make 3.80.0-3 - \endlist - - \note For users of the MinGW binary package: This package is now - based on MinGW 4.4. The installer no longer offers to download - MinGW for you, but rather offers to use a version of MinGW that - you already have installed on your machine. You just tell the - installer which directory MinGW is installed in. If you don't - already have MinGW 4.4 installed, you can download a .zip archive - from our \l{ftp://ftp.trolltech.com/misc/MinGW-gcc440_1.zip} {ftp - site}. This archive provides fixes to MinGW and support for - missing API, See the _patches directory in the archive for - details. - - \note A MinGW installation is only needed to build against the - binary pacakge, not to run the pre-compiled binaries that are in - the package. - - \section2 GCC 4.0.0 - - The released package of the compiler has some bugs that lead to - miscompilations. We recommend using GCC 4.0.1 or later, or to use - a recent CVS snapshot of the GCC 4.0 branch. The version of GCC - 4.0.0 that is shipped with Mac OS X 10.4 "Tiger" is known to work - with Qt for Mac OS X. - - \section2 HP-UX - - The hpux-g++ platform is tested with GCC 3.4.4. - - \section2 Solaris - - Please use GCC 3.4.2 or later. - Please not that WebKit is not supported for Solaris, regardless of which compiler is used. - - \section2 Mac OS X - - Please use the latest GCC 3.3 from Apple or a later version of GCC 3. - The gcc 3.3 that is provided with Xcode 1.5 is known to generate bad code. - Use the November 2004 GCC 3.3 updater \l{http://connect.apple.com}{available from Apple}. - - \section2 GCC 3.4.6 (Debian 3.4.6-5) on AMD64 (x86_64) - - This compiler is known to miscompile some parts of Qt when doing a - release build. There are several workarounds: - - \list 1 - \o Use a debug build instead. - \o For each miscompilation encountered, recompile the file, removing the -O2 option. - \o Add -fno-gcse to the QMAKE_CXXFLAGS_RELEASE. - \endlist - - \section1 HP ANSI C++ (aCC) - - The hpux-acc-32 and hpux-acc-64 platforms are tested with aCC A.03.57. The - hpuxi-acc-32 and hpuxi-acc-64 platforms are tested with aCC A.06.10. - - \section1 Intel C++ Compiler - - Qt supports the Intel C++ compiler on both Windows and Linux. - However, there are a few issues on Linux (see the following - section). - - \section2 Intel C++ Compiler for Linux - - Nokia currently tests the following compilers: - - \list - - \o Intel(R) C++ Compiler for applications running on IA-32, - Version 10.1 Build 20080602 Package ID: l_cc_p_10.1.017 - - \o Intel(R) C++ Compiler for applications running on Intel(R) 64, - Version 10.1 Build 20080602 Package ID: l_cc_p_10.1.017 - - \endlist - - We do not currently test the IA-64 (Itanium) compiler. - - \section2 Known Issues with Intel C++ Compiler for Linux - - \list - - \o Precompiled header support does not work in version 10.0.025 - and older. For these compilers, you should configure Qt with - -no-pch. Precompiled header support works properly in version - 10.0.026 and later. - \o Version 10.0.026 for Intel 64 is known to miscompile qmake when - building in release mode. For now, configure Qt with - -debug. Version 10.1.008 and later can compile qmake in release - mode. - \o Versions 10.1.008 to 10.1.015 for both IA-32 and Intel 64 are - known crash with "(0): internal error: 0_47021" when compiling - QtXmlPatterns, QtWebKit, and Designer in release mode. Version - 10.1.017 compiles these modules correctly in release mode. - \endlist - - \section2 Intel C++ Compiler (Windows, Altix) - - Qt 4 has been tested successfully with: - - \list - \o Windows - Intel(R) C++ Compiler for 32-bit applications, - Version 9.1.040. - \o Altix - Intel(R) C++ Itanium(R) Compiler for Itanium(R)-based - applications Version 8.1 Build 20050406 Package ID: l_cc_pc_8.1.030 - \endlist - - We currently only test the Intel compiler on 32-bit Windows versions. - - \section1 MIPSpro (IRIX) - - \bold{IRIX is an unsupported platform. See the \l{Supported Platforms} page - and Qt's Software's online \l{Platform Support Policy} page for details.} - - Qt 4.4.x requires MIPSpro version 7.4.2m. - - Note that MIPSpro version 7.4.4m is currently not supported, since it has - introduced a number of problems that have not yet been resolved. - We recommend using 7.4.2m for Qt development. However, please note the - unsupported status of this platform. - - \target Sun Studio - \section1 Forte Developer / Sun Studio (Solaris) - - \section2 Sun Studio - - Qt is tested using Sun Studio 12 (Sun CC 5.9). Go to - \l{Sun Studio Patches} page on Sun's Web site to download - the latest patches for your Sun compiler. - - Please note that Qt 4.6 is stricter in its STL requirements and - that the default STL implementation used by Sun CC does not pass - those requirements. This does not affect binary compatibility and - you can continue to use STL in your own code, but Qt's - STL-compatibility functions will be disabled. - - Sun CC ships with a secondary STL implementation (called stlport4) - which is standards-compliant and can be used by Qt. You can enable - it by passing the -library=stlport4 option to the compiler. Note - that this does not affect Qt's binary compatibility, but it may - affect that of other libraries and programs that use STL. - - \section2 Sun WorkShop 5.0 - - Sun WorkShop 5.0 is not supported with Qt 4. - - \section1 Visual Studio (Windows) - - We do most of our Windows development on Windows XP, using Microsoft - Visual Studio .NET 2005 and Visual Studio 2008 (both the 32- and 64-bit - versions). - - Qt works with the Standard Edition, the Professional Edition and Team - System Edition of Visual Studio 2005. - - In order to use Qt with the Visual Studio 2005/2008 Express Edition you need - to download and install the platform SDK. Due to limitations in the - Express Edition it is not possible for us to install the Qt Visual - Studio Integration. You will need to use our command line tools to - build Qt applications with this edition. - - The Visual C++ Linker doesn't understand filenames with spaces (as in - \c{C:\Program files\Qt\}) so you will have to move it to another place, - or explicitly set the path yourself; for example: - - \snippet doc/src/snippets/code/doc_src_compiler-notes.qdoc 0 - - If you are experiencing strange problems with using special flags that - modify the alignment of structure and union members (such as \c{/Zp2}) - then you will need to recompile Qt with the flags set for the - application as well. - - If you're using Visual Studio .NET (2002) Standard Edition, you should be - using the Qt binary package provided, and not the source package. - As the Standard Edition does not optimize compiled code, your compiled - version of Qt would perform suboptimally with respect to speed. - - With Visual Studio 2005 Service Pack 1 a bug was introduced which - causes Qt not to compile, this has been fixed with a hotfix available - from Microsoft. See this - \l{http://qt.nokia.com/developer/faqs/faq.2006-12-18.3281869860}{Knowledge Base entry} - for more information. - - There currently is a problem when compiling Qt with Visual Studio 2010 for 64-bit. - Its optimizer causes trouble and generates code that crashes for the release builds. - To avoid the crashes, You need to apply the hotfix in the following article - http://support.microsoft.com/kb/2280741. - - \section1 IBM xlC (AIX) - - The makeC++SharedLib utility must be in your PATH and be up to date to - build shared libraries. From IBM's - \l{http://www.redbooks.ibm.com/abstracts/sg245674.html}{C and C++ Application Development on AIX} - Redbook: - - \list - \o "The second step is to use the makeC++SharedLib command to create the - shared object. The command has many optional arguments, but in its - simplest form, can be used as follows:" - \snippet doc/src/snippets/code/doc_src_compiler-notes.qdoc 1 - \o "The full path name to the command is not required; however, to avoid - this, you will have to add the directory in which it is located to - your PATH environment variable. The command is located in the - /usr/vacpp/bin directory with the VisualAge C++ Professional for AIX, - Version 5 compiler." - \endlist - - \section2 VisualAge C++ for AIX, Version 6.0 - - Make sure you have the - \l{http://www-1.ibm.com/support/search.wss?rs=32&tc=SSEP5D&dc=D400}{latest upgrades} - installed. - - \section2 GCCE (Symbian) - - GCCE cannot be used to compile Qt libaries for the Symbian platform, but GCCE is supported - when compiling Qt applications for Symbian platform. */ diff --git a/doc/src/platforms/platform-notes-rtos.qdoc b/doc/src/platforms/platform-notes-rtos.qdoc index 4a34ece..8c30701 100644 --- a/doc/src/platforms/platform-notes-rtos.qdoc +++ b/doc/src/platforms/platform-notes-rtos.qdoc @@ -27,8 +27,8 @@ /*! \page platform-notes-vxworks.html - \title Platform Notes - VxWorks - \contentspage Platform Notes + \title Platform and Compiler Notes - VxWorks + \contentspage Platform and Compiler Notes \target VxWorks \note VxWorks is a community supported platform. See the @@ -143,8 +143,8 @@ /*! \page platform-notes-qnx.html - \title Platform Notes - QNX - \contentspage Platform Notes + \title Platform and Compiler Notes - QNX + \contentspage Platform and Compiler Notes \target QNX \note QNX is a community supported platform. See the diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index dff1b5b..dbedc1d 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -39,35 +39,91 @@ /*! \page platform-notes.html \ingroup platform-specific - \title Platform Notes + \title Platform and Compiler Notes \brief Information about the platforms on which Qt can be used. This page contains information about the platforms Qt is currently known to run on, with links to platform-specific notes, including any known bugs or incompatibilities. + Information about the combinations of platforms and compilers + supported by Qt can be found on the \l{Supported Platforms} page. + \list - \o \l{Platform Notes - X11} - \tableofcontents{1 Platform Notes - X11} - \o \l{Platform Notes - Windows} - \tableofcontents{1 Platform Notes - Windows} - \o \l{Platform Notes - Mac OS X} - \tableofcontents{1 Platform Notes - Mac OS X} - \o \l{Platform Notes - Symbian} - \tableofcontents{1 Platform Notes - Symbian} - \o \l{Platform Notes - Embedded Linux} - \tableofcontents{1 Platform Notes - Embedded Linux} - \o \l{Platform Notes - Windows CE} - \tableofcontents{1 Platform Notes - Windows CE} - \o \l{Platform Notes - QNX} - \tableofcontents{1 Platform Notes - QNX} - \o \l{Platform Notes - VxWorks} - \tableofcontents{1 Platform Notes - VxWorks} + \o \l{Platform and Compiler Notes - X11} + \tableofcontents{1 Platform and Compiler Notes - X11} + \o \l{Platform and Compiler Notes - Windows} + \tableofcontents{1 Platform and Compiler Notes - Windows} + \o \l{Platform and Compiler Notes - Mac OS X} + \tableofcontents{1 Platform and Compiler Notes - Mac OS X} + \o \l{Platform and Compiler Notes - Symbian} + \tableofcontents{1 Platform and Compiler Notes - Symbian} + \o \l{Platform and Compiler Notes - Embedded Linux} + \tableofcontents{1 Platform and Compiler Notes - Embedded Linux} + \o \l{Platform and Compiler Notes - Windows CE} + \tableofcontents{1 Platform and Compiler Notes - Windows CE} + \o \l{Platform and Compiler Notes - QNX} + \tableofcontents{1 Platform and Compiler Notes - QNX} + \o \l{Platform and Compiler Notes - VxWorks} + \tableofcontents{1 Platform and Compiler Notes - VxWorks} \endlist - See also the \l{Compiler Notes} for information about compiler-specific - build issues. Information about the combinations of platforms and compilers - supported by Qt can be found on the \l{Supported Platforms} page. + \section1 General Compiler Notes + + \section2 Supported Features + + Not all compilers used to build Qt are able to compile all modules. The following table + shows the compiler support for five modules that are not uniformly available for all + platforms and compilers. + + \table + \header \o Compiler \o{5,1} Features + \header \o \o Concurrent \o XmlPatterns \o WebKit(*) \o CLucene \o Phonon + \row \o g++ 3.3 \o \o \bold{X} \o \o \bold{X} \o \bold{X} + \row \o g++ 3.4 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} + \row + \row \o SunCC 5.5 \o \o \o \o \bold{X} \o \bold{X} + \row + \row \o aCC series 3 \o \o \o \o \bold{X} \o \bold{X} + \row \o aCC series 6 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} + \row \o xlC 6 \o \o \o \o \bold{X} \o \bold{X} + \row \o Intel CC 10 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} + \row + \row \o MSVC 2003 \o \bold{X} \o \bold{X} \o \o \bold{X} \o \bold{X} + \row \o MSVC 2005 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} + \endtable + + * WebKit is only supported as a dynamically built library. Static linkage is not supported. + + \section2 GCC 3.4.6 (Debian 3.4.6-5) on AMD64 (x86_64) + + This compiler is known to miscompile some parts of Qt when doing a + release build. There are several workarounds: + + \list 1 + \o Use a debug build instead. + \o For each miscompilation encountered, recompile the file, removing the \c{-O2} option. + \o Add \c{-fno-gcse} to the + \l{qmake Variable Reference#QMAKE_CXXFLAGS_RELEASE}{QMAKE_CXXFLAGS_RELEASE} qmake + variable. + \endlist + + \section2 GCC 4.0.0 + + The released package of the compiler has some bugs that lead to + miscompilations. We recommend using GCC 4.0.1 or later, or to use + a recent CVS snapshot of the GCC 4.0 branch. The version of GCC + 4.0.0 that is shipped with Mac OS X 10.4 "Tiger" is known to work + with Qt for Mac OS X. + + \section2 Intel C++ Compiler + + Qt supports the Intel C++ compiler on both Windows and Linux. + However, there are a few issues on Linux; see + \l{Platform and Compiler Notes - X11#Intel C++ Compiler for Linux}{Intel C++ Compiler for Linux} + for details. + + \section1 Feedback and Corrections If you have anything to add to this list or any of the platform or compiler-specific pages, please submit it via the \l{Bug Report Form} @@ -76,8 +132,8 @@ /*! \page platform-notes-x11.html - \title Platform Notes - X11 - \contentspage Platform Notes + \title Platform and Compiler Notes - X11 + \contentspage Platform and Compiler Notes This page contains information about the X11 platforms Qt is currently known to run on, with links to platform-specific notes. More information @@ -89,8 +145,7 @@ \target AIX \section1 AIX - 5.2 - Qt has been tested on AIX 5.2, using the - \l{Compiler Notes#IBM xlC (AIX)}{xlC} compiler. + Qt has been tested on AIX 5.2, using the xlC compiler. \table \header \o Compiler \o Notes @@ -113,13 +168,38 @@ either \c{-no-stl} or \c{-no-largefile}. \endtable + \section2 IBM xlC + + The makeC++SharedLib utility must be in your PATH and be up to date to + build shared libraries. From IBM's + \l{http://www.redbooks.ibm.com/abstracts/sg245674.html}{C and C++ Application Development on AIX} + Redbook: + + \list + \o "The second step is to use the makeC++SharedLib command to create the + shared object. The command has many optional arguments, but in its + simplest form, can be used as follows:" + \snippet doc/src/snippets/code/doc_src_compiler-notes.qdoc 1 + \o "The full path name to the command is not required; however, to avoid + this, you will have to add the directory in which it is located to + your PATH environment variable. The command is located in the + /usr/vacpp/bin directory with the VisualAge C++ Professional for AIX, + Version 5 compiler." + \endlist + + \section2 VisualAge C++ for AIX, Version 6.0 + + Make sure you have the + \l{http://www-1.ibm.com/support/search.wss?rs=32&tc=SSEP5D&dc=D400}{latest upgrades} + installed. + \target FreeBSD \section1 FreeBSD - 6.0-RELEASE \note FreeBSD is a community supported platform. See the \l{Supported Platforms} page for more information. - The system compiler on FreeBSD 4.x is gcc 2.95.4, which is not + The system compiler on FreeBSD 4.x is GCC 2.95.4, which is not officially supported by Qt 4. We develop using and recommend ports/lang/gcc34. You will need to run configure with the \c{-platform freebsd-g++34} arguments. Optionally, you may use @@ -132,7 +212,6 @@ Note that we do not actively test FreeBSD 4.x and 5.x. Our developers migrated to 6.x after the Qt 4 launch. FreeBSD-CURRENT is not supported. - \target HP-UX \section1 HP-UX Qt supports HP-UX on both PA-RISC and the Itanium (IA64) architectures. @@ -140,17 +219,26 @@ \section2 PA-RISC - B.11.11 or later You can configure Qt for aCC in 32 and 64 bit mode (hpux-acc-64 or - hpux-acc-32), or gcc in 32 bit mode (hpux-g++). The default platform is + hpux-acc-32), or GCC in 32 bit mode (hpux-g++). The default platform is hpux-acc-32. The minimum required version for aCC (HP ANSI C++) on PA-RISC - is A.03.57. The supported gcc compiler is gcc 3.4.3. + is A.03.57. The supported GCC compiler is GCC 3.4.3. \section2 Itanium - B.11.23 or later You can configure Qt for aCC in 32 and 64 bit mode (hpuxi-acc-64 or - hpuxi-acc-32). gcc is currently unsupported. The default platform is + hpuxi-acc-32). GCC is currently unsupported. The default platform is hpuxi-acc-64. The minimum required version for aCC (HP ANSI C++) on Itanium is A.06.12. + \section2 HP ANSI C++ (aCC) + + The hpux-acc-32 and hpux-acc-64 platforms are tested with aCC A.03.57. The + hpuxi-acc-32 and hpuxi-acc-64 platforms are tested with aCC A.06.10. + + \section2 GCC + + The hpux-g++ platform is tested with GCC 3.4.4. + \section2 OpenGL Support Qt's \l{QtOpenGL}{OpenGL} module requires GLX 1.3 or later to be installed. @@ -161,20 +249,29 @@ \target IRIX \section1 IRIX - 6.5.x - \bold{IRIX is an unsupported platform - please see Qt's online - \l{Platform Support Policy} for details.} + \bold{IRIX is an unsupported platform. See the \l{Supported Platforms} page + and Qt's Software's online \l{Platform Support Policy} page for details.} Unpackaging and IRIX tar: Because of long filenames some files will be cut off incorrectly with IRIX tar. Please use GNU tar to unpack Qt packages. + \section2 MIPSpro + + Qt 4.4.x requires MIPSpro version 7.4.2m. + + Note that MIPSpro version 7.4.4m is currently not supported, since it has + introduced a number of problems that have not yet been resolved. + We recommend using 7.4.2m for Qt development. However, please note the + unsupported status of this platform. + \section1 Linux There are no known problems with using Qt on production versions of Linux/x86, Linux/ppc, Linux/amd64 and Linux/ia64 (including Altix(R)). - For the gcc/g++ compiler, please also see the relevant - \l{Compiler Notes#GCC}{compiler page}. + For the GCC compiler, please also see the relevant + \l{Platform and Compiler Notes#General Compiler Notes}{General Compiler Notes}. \section2 Installation problems @@ -198,6 +295,40 @@ "Failed Dependency". Use the \c{--nodeps} option to \c rpm to workaround this problem. + \section2 Intel C++ Compiler for Linux + + Nokia currently tests the following compilers: + + \list + + \o Intel(R) C++ Compiler for applications running on IA-32, + Version 10.1 Build 20080602 Package ID: l_cc_p_10.1.017 + + \o Intel(R) C++ Compiler for applications running on Intel(R) 64, + Version 10.1 Build 20080602 Package ID: l_cc_p_10.1.017 + + \endlist + + We do not currently test the IA-64 (Itanium) compiler. + + \section2 Known Issues with Intel C++ Compiler for Linux + + \list + + \o Precompiled header support does not work in version 10.0.025 + and older. For these compilers, you should configure Qt with + -no-pch. Precompiled header support works properly in version + 10.0.026 and later. + \o Version 10.0.026 for Intel 64 is known to miscompile qmake when + building in release mode. For now, configure Qt with + -debug. Version 10.1.008 and later can compile qmake in release + mode. + \o Versions 10.1.008 to 10.1.015 for both IA-32 and Intel 64 are + known crash with "(0): internal error: 0_47021" when compiling + QtXmlPatterns, QtWebKit, and Designer in release mode. Version + 10.1.017 compiles these modules correctly in release mode. + \endlist + \target Solaris \section1 Solaris - 9 or later @@ -207,25 +338,50 @@ to truncate long filenames. We recommend using star instead (http://star.berlios.de). - \section2 CC on Solaris + Please note that WebKit is not supported for Solaris, regardless of + which compiler is used. + + \section2 CC - Be sure to check our \l{Compiler Notes#Sun Studio}{Forte Developer / Sun Studio} - notes. + See the notes for \l{Forte Developer / Sun Studio}. - \section2 GCC on Solaris + \section2 GCC + + Please use GCC 3.4.2 or later. - Be sure to check the installation notes for \l{GCC on Solaris}. Do not use GCC with Sun's assembler/linker, this will result in link-time errors in shared libraries. Use GNU binutils instead. GCC 3.2.* is known to miscompile Qt due to an optimizer bug that will - cause the resulting binaries to hang. Please use GCC 3.4.2 or later. + cause the resulting binaries to hang. + + \section2 Forte Developer / Sun Studio + + Qt is tested using Sun Studio 12 (Sun CC 5.9). Go to + \l{Sun Studio Patches} page on Sun's Web site to download + the latest patches for your Sun compiler. + + Please note that Qt 4.6 is stricter in its STL requirements and + that the default STL implementation used by Sun CC does not pass + those requirements. This does not affect binary compatibility and + you can continue to use STL in your own code, but Qt's + STL-compatibility functions will be disabled. + + Sun CC ships with a secondary STL implementation (called stlport4) + which is standards-compliant and can be used by Qt. You can enable + it by passing the -library=stlport4 option to the compiler. Note + that this does not affect Qt's binary compatibility, but it may + affect that of other libraries and programs that use STL. + + \section2 Sun WorkShop 5.0 + + Sun WorkShop 5.0 is not supported with Qt 4. */ /*! \page platform-notes-windows.html - \title Platform Notes - Windows - \contentspage Platform Notes + \title Platform and Compiler Notes - Windows + \contentspage Platform and Compiler Notes This page contains information about the Windows platforms Qt is currently known to run on, with links to platform-specific notes. More information @@ -255,12 +411,87 @@ and other applications that require screen grabbing while direct rendering is enabled. Other GL-applications may not work as expected, unless direct rendering is disabled. + + \section2 GCC (MinGW) + + We have tested Qt with this compiler on Windows XP. + The minimal version of MinGW supported is GCC 4.4. + + \note For users of the MinGW binary package: This package is now + based on MinGW 4.4. The installer no longer offers to download + MinGW for you, but rather offers to use a version of MinGW that + you already have installed on your machine. You just tell the + installer which directory MinGW is installed in. If you don't + already have MinGW 4.4 installed, you can download a .zip archive + from our \l{ftp://ftp.trolltech.com/misc/MinGW-gcc440_1.zip}{FTP + site}. This archive provides fixes to MinGW and support for + missing API, See the _patches directory in the archive for + details. + + \note A MinGW installation is only needed to build against the + binary pacakge, not to run the pre-compiled binaries that are in + the package. + + \section2 Intel C++ Compiler (Windows, Altix) + + Qt 4 has been tested successfully with: + + \list + \o Windows - Intel(R) C++ Compiler for 32-bit applications, + Version 9.1.040. + \o Altix - Intel(R) C++ Itanium(R) Compiler for Itanium(R)-based + applications Version 8.1 Build 20050406 Package ID: l_cc_pc_8.1.030 + \endlist + + We currently only test the Intel compiler on 32-bit Windows versions. + + \section2 Visual Studio (Windows) + + We do most of our Windows development on Windows XP, using Microsoft + Visual Studio .NET 2005 and Visual Studio 2008 (both the 32- and 64-bit + versions). + + Qt works with the Standard Edition, the Professional Edition and Team + System Edition of Visual Studio 2005. + + In order to use Qt with the Visual Studio 2005/2008 Express Edition you need + to download and install the platform SDK. Due to limitations in the + Express Edition it is not possible for us to install the Qt Visual + Studio Integration. You will need to use our command line tools to + build Qt applications with this edition. + + The Visual C++ Linker doesn't understand filenames with spaces (as in + \c{C:\Program files\Qt\}) so you will have to move it to another place, + or explicitly set the path yourself; for example: + + \snippet doc/src/snippets/code/doc_src_compiler-notes.qdoc 0 + + If you are experiencing strange problems with using special flags that + modify the alignment of structure and union members (such as \c{/Zp2}) + then you will need to recompile Qt with the flags set for the + application as well. + + If you're using Visual Studio .NET (2002) Standard Edition, you should be + using the Qt binary package provided, and not the source package. + As the Standard Edition does not optimize compiled code, your compiled + version of Qt would perform suboptimally with respect to speed. + + With Visual Studio 2005 Service Pack 1 a bug was introduced which + causes Qt not to compile, this has been fixed with a hotfix available + from Microsoft. See this + \l{http://qt.nokia.com/developer/faqs/faq.2006-12-18.3281869860}{Knowledge Base entry} + for more information. + + There currently is a problem when compiling Qt with Visual Studio 2010 for 64-bit. + Its optimizer causes trouble and generates code that crashes for the release builds. + To avoid the crashes, You need to apply the hotfix in the following article + http://support.microsoft.com/kb/2280741. */ /*! \page platform-notes-mac.html - \title Platform Notes - Mac OS X - \contentspage Platform Notes + \title Platform and Compiler Notes - Mac OS X + \contentspage Platform and Compiler Notes This page contains information about the Mac OS X versions Qt is currently known to run on, with links to platform-specific notes. More information @@ -287,11 +518,15 @@ \section2 Required GCC version - Apple's gcc 4 that is shipped with the Xcode Tools for both Mac OS X 10.4 - and 10.5 will compile Qt. There is preliminary support for gcc 4.2 which + Apple's GCC 4 that is shipped with the Xcode Tools for both Mac OS X 10.4 + and 10.5 will compile Qt. There is preliminary support for GCC 4.2 which is included with Xcode Tools 3.1+ (configurable with \c{-platform macx-g++42}). + Please use the latest GCC 3.3 from Apple or a later version of GCC 3. + The GCC 3.3 that is provided with Xcode 1.5 is known to generate bad code. + Use the November 2004 GCC 3.3 updater \l{http://connect.apple.com}{available from Apple}. + \section2 Binary Package The binary package requires that you have your .qt-license file in your @@ -300,7 +535,7 @@ this file in the email they receive. The binary package was built on Mac OS X 10.4 with Xcode Tools 2.1 - (gcc 4.0.0) for Qt 4.1.0, Xcode Tools 2.2 (gcc 4.0.1) for Qt 4.1.1-4.1.4 + (GCC 4.0.0) for Qt 4.1.0, Xcode Tools 2.2 (GCC 4.0.1) for Qt 4.1.1-4.1.4 and Xcode Tools 2.3 for 4.2.0. It will only link executables built against 10.4 (or a 10.4 SDK). You should be able to run applications linked against these frameworks on Mac OS X 10.3.9 and Mac OS X 10.4+. @@ -374,8 +609,8 @@ /*! \page platform-notes-windows-ce.html - \title Platform Notes - Windows CE - \contentspage Platform Notes + \title Platform and Compiler Notes - Windows CE + \contentspage Platform and Compiler Notes This page contains information about the Windows CE and Windows Mobile platforms Qt is currently known to run on, with links to platform-specific @@ -385,8 +620,8 @@ /*! \page platform-notes-symbian.html - \title Platform Notes - Symbian - \contentspage Platform Notes + \title Platform and Compiler Notes - Symbian + \contentspage Platform and Compiler Notes \ingroup platform-specific \brief Information about the state of support for the Symbian platform. @@ -468,6 +703,13 @@ for Phonon. \endtable + \section1 Compiler Notes + + \section2 GCCE (Symbian) + + GCCE cannot be used to compile Qt libaries for the Symbian platform, but GCCE is supported + when compiling Qt applications for the Symbian platform. + \section1 Known Issues Known issues can be found by visiting the @@ -580,8 +822,8 @@ /*! \page platform-notes-embedded-linux.html - \title Platform Notes - Embedded Linux - \contentspage Platform Notes + \title Platform and Compiler Notes - Embedded Linux + \contentspage Platform and Compiler Notes This page contains information about the Embedded Linux platforms Qt is currently known to run on, with links to platform-specific notes. More diff --git a/doc/src/platforms/supported-platforms.qdoc b/doc/src/platforms/supported-platforms.qdoc index 31866c4..4918e18 100644 --- a/doc/src/platforms/supported-platforms.qdoc +++ b/doc/src/platforms/supported-platforms.qdoc @@ -44,9 +44,8 @@ \tableofcontents - Information about the specific platforms Qt runs on can be found on the - \l{Platform Notes} page. Information about the compilers used on each platform - can be found on the \l{Compiler Notes} page. + Information about the specific platforms Qt runs on, and the compilers used + on each platform, can be found on the \l{Platform and Compiler Notes} page. \section1 Tier 1 Platforms diff --git a/doc/src/platforms/winsystem.qdoc b/doc/src/platforms/winsystem.qdoc index 2919bb7..64e35c5 100644 --- a/doc/src/platforms/winsystem.qdoc +++ b/doc/src/platforms/winsystem.qdoc @@ -44,8 +44,8 @@ \tableofcontents For information about which platforms are supported by Qt, see the - \l{Platform Notes}. For information on distributing Qt applications, see - \l{Deploying Qt Applications}. + \l{Platform and Compiler Notes}. For information on distributing Qt + applications, see \l{Deploying Qt Applications}. \target x11 \section1 Qt for X11 -- cgit v0.12 From 6594e39808aecde42c1310f1ad800ffa4d7f0768 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 12 Oct 2010 14:33:27 +0200 Subject: Doc: Fixed minor documentation issues. --- src/corelib/tools/qstring.cpp | 2 +- src/gui/widgets/qdatetimeedit.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index d8dab43..bfbdb73 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -567,7 +567,7 @@ const QString::Null QString::null = { }; strings from a string list that contain a particular substring or that match a particular QRegExp using the QStringList::filter() function. -: + \section1 Querying String Data If you want to see if a QString starts or ends with a particular diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp index bd6c577..8043747 100644 --- a/src/gui/widgets/qdatetimeedit.cpp +++ b/src/gui/widgets/qdatetimeedit.cpp @@ -832,11 +832,11 @@ QString QDateTimeEdit::sectionText(Section section) const This format is the same as the one used described in QDateTime::toString() and QDateTime::fromString() - Example format strings(assuming that the date is 2nd of July 1969): + Example format strings (assuming that the date is 2nd of July 1969): \table \header \i Format \i Result - \row \i dd.MM.yyyy \i 02.07.1969 + \row \i dd.MM.yyyy \i 02.07.1969 \row \i MMM d yy \i Jul 2 69 \row \i MMMM d yy \i July 2 69 \endtable -- cgit v0.12 From 17ff53f665ad5de15ce7b073edd1b10b2b397b05 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 14 Oct 2010 17:57:34 +0200 Subject: Doc: Made Qt::TextLongestVariant internal again. This undoes change 43e6ec9f01693044f7bc1. This enum value is internal and not generally supported by Qt. Reviewed-by: Olivier Goffart --- src/corelib/global/qnamespace.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 1c41eca..73f28d6 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -470,9 +470,9 @@ text; otherwise this width is excluded. \value TextIncludeTrailingSpaces Same as IncludeTrailingSpaces \value TextJustificationForced Ensures that text lines are justified. - \value TextLongestVariant Ensures that the longest variant is always used - when computing the size of a multi-variant string. + \omitvalue TextLongestVariant Ensures that the longest variant is always used + when computing the size of a multi-variant string. (Internal) \omitvalue TextBypassShaping \omitvalue BreakAnywhere \omitvalue DontClip -- cgit v0.12 From 2ebbfad45ca02ee4e623e592621231d33f1032e5 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 20 Oct 2010 18:11:57 +0200 Subject: Fixed case of a library file name to enable MinGW builds on Fedora. Task-number: QTBUG-14484 Reviewed-by: Marius Storm-Olsen --- examples/network/bearermonitor/bearermonitor.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/network/bearermonitor/bearermonitor.pro b/examples/network/bearermonitor/bearermonitor.pro index 42100bc..4b2c35b 100644 --- a/examples/network/bearermonitor/bearermonitor.pro +++ b/examples/network/bearermonitor/bearermonitor.pro @@ -17,8 +17,8 @@ maemo5|maemo6 { sessionwidget.ui } -win32:!wince*:LIBS += -lWs2_32 -wince*:LIBS += -lWs2 +win32:!wince*:LIBS += -lws2_32 +wince*:LIBS += -lws2 CONFIG += console -- cgit v0.12 From 7eb4eb076531c3190af0452c865b928c60b225bb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 21 Oct 2010 18:25:17 +0200 Subject: add autotest for QString::setRawData() ... and improve the one for fromRawData() marginally Reviewed-by: olivier --- tests/auto/qstring/tst_qstring.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp index ef82769..9df2a4d 100644 --- a/tests/auto/qstring/tst_qstring.cpp +++ b/tests/auto/qstring/tst_qstring.cpp @@ -76,6 +76,7 @@ private slots: void check_QTextStream(); void check_QDataStream(); void fromRawData(); + void setRawData(); void endsWith(); void startsWith(); void setNum(); @@ -2999,7 +3000,9 @@ void tst_QString::fromRawData() { const QChar ptr[] = { 0x1234, 0x0000 }; QString cstr = QString::fromRawData(ptr, 1); + QVERIFY(cstr.isDetached()); QVERIFY(cstr.constData() == ptr); + QVERIFY(cstr == QString(ptr, 1)); cstr.squeeze(); QVERIFY(cstr.constData() == ptr); cstr.detach(); @@ -3010,6 +3013,41 @@ void tst_QString::fromRawData() QVERIFY(cstr.constData()[1] == QChar(0x0000)); } +void tst_QString::setRawData() +{ + const QChar ptr[] = { 0x1234, 0x0000 }; + const QChar ptr2[] = { 0x4321, 0x0000 }; + QString cstr; + + // This just tests the fromRawData() fallback + QVERIFY(!cstr.isDetached()); + cstr.setRawData(ptr, 1); + QVERIFY(cstr.isDetached()); + QVERIFY(cstr.constData() == ptr); + QVERIFY(cstr == QString(ptr, 1)); + + // This actually tests the recycling of the shared data object + QString::DataPtr csd = cstr.data_ptr(); + cstr.setRawData(ptr2, 1); + QVERIFY(cstr.isDetached()); + QVERIFY(cstr.constData() == ptr2); + QVERIFY(cstr == QString(ptr2, 1)); + QVERIFY(cstr.data_ptr() == csd); + + // This tests the discarding of the shared data object + cstr = "foo"; + QVERIFY(cstr.isDetached()); + QVERIFY(cstr.constData() != ptr2); + + // Another test of the fallback + csd = cstr.data_ptr(); + cstr.setRawData(ptr2, 1); + QVERIFY(cstr.isDetached()); + QVERIFY(cstr.constData() == ptr2); + QVERIFY(cstr == QString(ptr2, 1)); + QVERIFY(cstr.data_ptr() != csd); +} + void tst_QString::fromStdString() { #ifdef Q_CC_HPACC -- cgit v0.12