From 6d290ae51ee928aecb87be57326504aab8d7f177 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 5 Aug 2010 08:52:33 +0200 Subject: Doc: nesting up orphant pages --- doc/src/overviews.qdoc | 1 + doc/src/widgets-and-layouts/widgets.qdoc | 1 + doc/src/windows-and-dialogs/dialogs.qdoc | 2 ++ 3 files changed, 4 insertions(+) diff --git a/doc/src/overviews.qdoc b/doc/src/overviews.qdoc index a1773a3..b72df98 100644 --- a/doc/src/overviews.qdoc +++ b/doc/src/overviews.qdoc @@ -29,6 +29,7 @@ \page overviews.html \title All Overviews and HOWTOs + \ingroup qt-basic-concepts \generatelist overviews */ diff --git a/doc/src/widgets-and-layouts/widgets.qdoc b/doc/src/widgets-and-layouts/widgets.qdoc index 18b8be1..f2475c2 100644 --- a/doc/src/widgets-and-layouts/widgets.qdoc +++ b/doc/src/widgets-and-layouts/widgets.qdoc @@ -29,6 +29,7 @@ \page widgets-and-layouts.html \title Widgets and Layouts \ingroup qt-gui-concepts + \ingroup qt-basic-concepts \brief The primary elements for designing user interfaces in Qt. \section1 Widgets diff --git a/doc/src/windows-and-dialogs/dialogs.qdoc b/doc/src/windows-and-dialogs/dialogs.qdoc index 6316dc9..74df2aa 100644 --- a/doc/src/windows-and-dialogs/dialogs.qdoc +++ b/doc/src/windows-and-dialogs/dialogs.qdoc @@ -27,11 +27,13 @@ /*! \group standard-dialogs + \ingroup qt-basic-concepts \title Standard Dialog Classes */ /*! \group dialog-classes + \ingroup qt-basic-concepts \title Classes for Building Dialogs */ -- cgit v0.12 From d524da81ee257a6bd67d32d0bc870280a7d5b8a4 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 5 Aug 2010 17:43:52 +1000 Subject: Fix link error when building Bearer application with Qt Mobility QtMobility uses the Qt header when compiling applications which link against Mobility's Bearer library. Therefore QNetworkConfiguration::bearerName() cannot be inline and refer to the new QNetworkConfiguration::bearerTypeName() function (which doesn't exist in Mobility) Task-number: QTBUG-12378 Reviewed-by: Rohan McGovern --- src/network/bearer/qnetworkconfiguration.cpp | 7 +++++++ src/network/bearer/qnetworkconfiguration.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index 3190a30..60851ac 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -406,6 +406,13 @@ QList QNetworkConfiguration::children() const This function is deprecated. It is equivalent to calling bearerTypeName(), however bearerType() should be used in preference. */ +QString QNetworkConfiguration::bearerName() const +{ + // This function cannot be inline as it would break Qt Mobility. + // Qt Mobility uses the Qt header as well and since the Mobility Bearer library + // does not provide bearerTypeName() we cannot use an inline function. + return bearerTypeName(); +} /*! Returns the type of bearer used by this network configuration. diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index d9d36fd..e4f762a 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -120,7 +120,7 @@ public: Purpose purpose() const; // Required to maintain source compatibility with Qt Mobility. - QT_DEPRECATED inline QString bearerName() const { return bearerTypeName(); } + QT_DEPRECATED QString bearerName() const; BearerType bearerType() const; QString bearerTypeName() const; -- cgit v0.12 From a6937c7d8d2253c0f230254eaa2b9c8042972b30 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 5 Aug 2010 10:00:24 +0200 Subject: Doc: Adding text to GS page --- doc/src/getting-started/gettingstarted.qdoc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/src/getting-started/gettingstarted.qdoc b/doc/src/getting-started/gettingstarted.qdoc index 145982b..e58305a 100644 --- a/doc/src/getting-started/gettingstarted.qdoc +++ b/doc/src/getting-started/gettingstarted.qdoc @@ -30,7 +30,13 @@ \group gettingStarted - Following is a list. + \section1 + Creating applications using Qt and QML is easy enough once you get started. + To get you started we have created two tutorials creating two similar applications, + but using diiferent approaches. One tutorial implements the user interface using + QML, while the other implements the whole application using traditional Qt. + + Please click on the links below to start the ride. \generatelist{related} */ -- cgit v0.12 From ab66b692dd2729f8b59410b65940934926e5ee04 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 5 Aug 2010 11:28:53 +0200 Subject: Doc: Editied version of QML GS --- doc/src/getting-started/gettingstartedqml.qdoc | 46 ++++++++++++-------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc index 2bfb71c..93f6f88 100644 --- a/doc/src/getting-started/gettingstartedqml.qdoc +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -32,27 +32,30 @@ \ingroup gettingStarted Welcome to the world of QML - the declarative UI language. In this Getting - Started guide, we will create a simple text editor application using QML. - After reading this guide, you should be ready to develop your own applications - using QML and Qt C++. + Started guide, we create a simple text editor application using QML. + After reading this guide, you should be ready to start developing your own + applications using QML and Qt C++. + \example tutorials/gettingStarted/gsQml + \section1 QML to Build User Interfaces - The application we are building is a simple text editor that will load, save, - and perform some text manipulation. This guide will consist of two parts. The - first part will involve designing the application layout and behaviors using - declarative language in QML. For the second part, file loading and saving will - be implemented using Qt C++. Using - \l {The Meta-Object System}{Qt's Meta-Object System}, we can expose C++ functions - as properties that QML elements can use. Utilizing QML and Qt C++, we can - efficiently decouple the interface logic from the application logic. + Here we are building is a simple text editor that con load, save, + and perform some text manipulation. This guide consists of two parts. The + first part involves designing the application layout and behaviors using + declarative language in QML. For the second part, file loading and saving is + implemented using Qt C++. + Using \l {The Meta-Object System}{Qt's Meta-Object System}, we can expose C++ + functions as properties that QML elements can use. By utilizing QML and Qt C++, + we can efficiently decouple the interface logic from the application logic. \image qml-texteditor5_editmenu.png - To run the QML example code, merely provide the included \l{QML Viewer}{qmlviewer} + To run the QML example code, we merely provide the included \l{QML Viewer}{qmlviewer} tool with the QML file as the argument. The C++ portion of this tutorial assumes that the reader possesses basic knowledge of Qt's compilation procedures. + \omit Tutorial chapters: \list 1 \o \l {Defining a Button and a Menu}{Defining a Button and a Menu} @@ -61,6 +64,7 @@ \o \l {Decorating the Text Editor}{Decorating the Text Editor} \o \l {Extending QML using Qt C++}{Extending QML using Qt C++} \endlist + \endomit \section1 Defining a Button and a Menu @@ -104,7 +108,7 @@ is called \c simplebutton. Anchors may bind to other items' anchors, allowing layout assignments simpler. - We shall save this code as \c SimpleButton.qml. Running qmlviewer with the file as the + We save this code as \c SimpleButton.qml. Running qmlviewer with the file as the argument will display the grey rectangle with a text label. \image qml-texteditor1_simplebutton.png @@ -407,13 +411,9 @@ \image qml-texteditor2_menubar.png - */ - - /*! - \page qml-textEditor3.html - \title Building a Text Editor + \section1 Building a Text Editor - \section1 Declaring a TextArea + \section2 Declaring a TextArea Our text editor is not a text editor if it didn't contain an editable text area. QML's \l {TextEdit}{TextEdit} element allows the declaration of a multi-line @@ -497,12 +497,8 @@ \image qml-texteditor3_texteditor.png - */ - - /*! - \page qml-textEditor4 - \title Decorating the Text Editor - \section1 Implementing a Drawer Interface + \section1 Decorating the Text Editor + \section2 Implementing a Drawer Interface Our text editor looks simple and we need to decorate it. Using QML, we can declare transitions and animate our text editor. Our menu bar is occupying one-third of the -- cgit v0.12 From 2faafdeda4c715a91297b56251773b21a0cac86b Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 5 Aug 2010 11:33:24 +0200 Subject: Doc: Images for QML GS --- doc/src/images/arrow.png | Bin 0 -> 583 bytes doc/src/images/qml-texteditor1_button.png | Bin 0 -> 1670 bytes doc/src/images/qml-texteditor1_editmenu.png | Bin 0 -> 7358 bytes doc/src/images/qml-texteditor1_filemenu.png | Bin 0 -> 7078 bytes doc/src/images/qml-texteditor1_simplebutton.png | Bin 0 -> 1055 bytes doc/src/images/qml-texteditor2_menubar.png | Bin 0 -> 7975 bytes doc/src/images/qml-texteditor3_textarea.png | Bin 0 -> 10417 bytes doc/src/images/qml-texteditor3_texteditor.png | Bin 0 -> 61353 bytes doc/src/images/qml-texteditor4_texteditor.png | Bin 0 -> 75600 bytes doc/src/images/qml-texteditor5_editmenu.png | Bin 0 -> 31834 bytes doc/src/images/qml-texteditor5_filemenu.png | Bin 0 -> 21688 bytes doc/src/images/qml-texteditor5_newfile.png | Bin 0 -> 92794 bytes 12 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 doc/src/images/arrow.png create mode 100644 doc/src/images/qml-texteditor1_button.png create mode 100644 doc/src/images/qml-texteditor1_editmenu.png create mode 100644 doc/src/images/qml-texteditor1_filemenu.png create mode 100644 doc/src/images/qml-texteditor1_simplebutton.png create mode 100644 doc/src/images/qml-texteditor2_menubar.png create mode 100644 doc/src/images/qml-texteditor3_textarea.png create mode 100644 doc/src/images/qml-texteditor3_texteditor.png create mode 100644 doc/src/images/qml-texteditor4_texteditor.png create mode 100644 doc/src/images/qml-texteditor5_editmenu.png create mode 100644 doc/src/images/qml-texteditor5_filemenu.png create mode 100644 doc/src/images/qml-texteditor5_newfile.png diff --git a/doc/src/images/arrow.png b/doc/src/images/arrow.png new file mode 100644 index 0000000..14978c2 Binary files /dev/null and b/doc/src/images/arrow.png differ diff --git a/doc/src/images/qml-texteditor1_button.png b/doc/src/images/qml-texteditor1_button.png new file mode 100644 index 0000000..aab64bc Binary files /dev/null and b/doc/src/images/qml-texteditor1_button.png differ diff --git a/doc/src/images/qml-texteditor1_editmenu.png b/doc/src/images/qml-texteditor1_editmenu.png new file mode 100644 index 0000000..af8028b Binary files /dev/null and b/doc/src/images/qml-texteditor1_editmenu.png differ diff --git a/doc/src/images/qml-texteditor1_filemenu.png b/doc/src/images/qml-texteditor1_filemenu.png new file mode 100644 index 0000000..ccc008c Binary files /dev/null and b/doc/src/images/qml-texteditor1_filemenu.png differ diff --git a/doc/src/images/qml-texteditor1_simplebutton.png b/doc/src/images/qml-texteditor1_simplebutton.png new file mode 100644 index 0000000..21ce509 Binary files /dev/null and b/doc/src/images/qml-texteditor1_simplebutton.png differ diff --git a/doc/src/images/qml-texteditor2_menubar.png b/doc/src/images/qml-texteditor2_menubar.png new file mode 100644 index 0000000..691a833 Binary files /dev/null and b/doc/src/images/qml-texteditor2_menubar.png differ diff --git a/doc/src/images/qml-texteditor3_textarea.png b/doc/src/images/qml-texteditor3_textarea.png new file mode 100644 index 0000000..95abcd6 Binary files /dev/null and b/doc/src/images/qml-texteditor3_textarea.png differ diff --git a/doc/src/images/qml-texteditor3_texteditor.png b/doc/src/images/qml-texteditor3_texteditor.png new file mode 100644 index 0000000..bdf6957 Binary files /dev/null and b/doc/src/images/qml-texteditor3_texteditor.png differ diff --git a/doc/src/images/qml-texteditor4_texteditor.png b/doc/src/images/qml-texteditor4_texteditor.png new file mode 100644 index 0000000..85d216b Binary files /dev/null and b/doc/src/images/qml-texteditor4_texteditor.png differ diff --git a/doc/src/images/qml-texteditor5_editmenu.png b/doc/src/images/qml-texteditor5_editmenu.png new file mode 100644 index 0000000..7365690 Binary files /dev/null and b/doc/src/images/qml-texteditor5_editmenu.png differ diff --git a/doc/src/images/qml-texteditor5_filemenu.png b/doc/src/images/qml-texteditor5_filemenu.png new file mode 100644 index 0000000..7078022 Binary files /dev/null and b/doc/src/images/qml-texteditor5_filemenu.png differ diff --git a/doc/src/images/qml-texteditor5_newfile.png b/doc/src/images/qml-texteditor5_newfile.png new file mode 100644 index 0000000..e493941 Binary files /dev/null and b/doc/src/images/qml-texteditor5_newfile.png differ -- cgit v0.12 From f13ebf52a0d091c6c72c97d2a13311e1e7c4a5cf Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 5 Aug 2010 11:46:12 +0200 Subject: Doc: Adding GS QML example files --- .../tutorials/gettingStarted/gsQml/TextEditor.qml | 129 ++++++++++++ .../tutorials/gettingStarted/gsQml/core/Button.qml | 110 ++++++++++ .../gettingStarted/gsQml/core/EditMenu.qml | 111 ++++++++++ .../gettingStarted/gsQml/core/FileDialog.qml | 170 +++++++++++++++ .../gettingStarted/gsQml/core/FileMenu.qml | 232 +++++++++++++++++++++ .../gettingStarted/gsQml/core/MenuBar.qml | 148 +++++++++++++ .../gettingStarted/gsQml/core/TextArea.qml | 86 ++++++++ .../tutorials/gettingStarted/gsQml/core/qmldir | 48 +++++ .../gettingStarted/gsQml/filedialog/cppPlugins.pro | 17 ++ .../gsQml/filedialog/dialogPlugin.cpp | 57 +++++ .../gettingStarted/gsQml/filedialog/dialogPlugin.h | 57 +++++ .../gettingStarted/gsQml/filedialog/directory.cpp | 219 +++++++++++++++++++ .../gettingStarted/gsQml/filedialog/directory.h | 108 ++++++++++ .../gettingStarted/gsQml/filedialog/file.cpp | 57 +++++ .../gettingStarted/gsQml/filedialog/file.h | 67 ++++++ .../gettingStarted/gsQml/filedialog/qmldir | 1 + .../gettingStarted/gsQml/images/arrow.png | Bin 0 -> 583 bytes .../gettingStarted/gsQml/images/qt-logo.png | Bin 0 -> 5149 bytes .../gsQml/pics/qml-texteditor5_editmenu.png | Bin 0 -> 65123 bytes .../gsQml/pics/qml-texteditor5_filemenu.png | Bin 0 -> 21367 bytes .../gsQml/pics/qml-texteditor5_newfile.png | Bin 0 -> 76693 bytes 21 files changed, 1617 insertions(+) create mode 100644 examples/tutorials/gettingStarted/gsQml/TextEditor.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/core/Button.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/core/EditMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/core/FileDialog.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/core/FileMenu.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/core/MenuBar.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/core/TextArea.qml create mode 100644 examples/tutorials/gettingStarted/gsQml/core/qmldir create mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/cppPlugins.pro create mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp create mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.h create mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp create mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/directory.h create mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp create mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/file.h create mode 100644 examples/tutorials/gettingStarted/gsQml/filedialog/qmldir create mode 100644 examples/tutorials/gettingStarted/gsQml/images/arrow.png create mode 100644 examples/tutorials/gettingStarted/gsQml/images/qt-logo.png create mode 100644 examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_editmenu.png create mode 100644 examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_filemenu.png create mode 100644 examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_newfile.png diff --git a/examples/tutorials/gettingStarted/gsQml/TextEditor.qml b/examples/tutorials/gettingStarted/gsQml/TextEditor.qml new file mode 100644 index 0000000..6ffdd6d --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/TextEditor.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 +import "core" + +Rectangle{ + id: screen + width: 1000; height: 1000 + property int partition: height/3 + border.width: 1 + border.color: "#DCDCCC" + 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/core/Button.qml b/examples/tutorials/gettingStarted/gsQml/core/Button.qml new file mode 100644 index 0000000..28ae4ec --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/core/Button.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 Qt 4.7 + +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} } + +} \ No newline at end of file diff --git a/examples/tutorials/gettingStarted/gsQml/core/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/core/EditMenu.qml new file mode 100644 index 0000000..be9f6a1 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/core/EditMenu.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +import Qt 4.7 + +Rectangle{ + 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) } + } + } + } + } + +} \ No newline at end of file diff --git a/examples/tutorials/gettingStarted/gsQml/core/FileDialog.qml b/examples/tutorials/gettingStarted/gsQml/core/FileDialog.qml new file mode 100644 index 0000000..9948a27 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/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 Qt 4.7 + +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" } + } + } +} \ No newline at end of file diff --git a/examples/tutorials/gettingStarted/gsQml/core/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/core/FileMenu.qml new file mode 100644 index 0000000..20d8fd6 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/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 Qt 4.7 + +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/core/MenuBar.qml b/examples/tutorials/gettingStarted/gsQml/core/MenuBar.qml new file mode 100644 index 0000000..c387f5f --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/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 Qt 4.7 + +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 + } + } +} \ No newline at end of file diff --git a/examples/tutorials/gettingStarted/gsQml/core/TextArea.qml b/examples/tutorials/gettingStarted/gsQml/core/TextArea.qml new file mode 100644 index 0000000..3953d9f --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/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 Qt 4.7 + +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 + } + } +} \ No newline at end of file diff --git a/examples/tutorials/gettingStarted/gsQml/core/qmldir b/examples/tutorials/gettingStarted/gsQml/core/qmldir new file mode 100644 index 0000000..1beb5ed --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/core/qmldir @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +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/filedialog/cppPlugins.pro b/examples/tutorials/gettingStarted/gsQml/filedialog/cppPlugins.pro new file mode 100644 index 0000000..6247747 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/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/filedialog/dialogPlugin.cpp b/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp new file mode 100644 index 0000000..c0132c0 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/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/filedialog/dialogPlugin.h b/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.h new file mode 100644 index 0000000..7f8d3ff --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/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/filedialog/directory.cpp b/examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp new file mode 100644 index 0000000..b3e0256 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/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/filedialog/directory.h b/examples/tutorials/gettingStarted/gsQml/filedialog/directory.h new file mode 100644 index 0000000..bef1a93 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/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/filedialog/file.cpp b/examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp new file mode 100644 index 0000000..39a7469 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/filedialog/file.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 "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/filedialog/file.h b/examples/tutorials/gettingStarted/gsQml/filedialog/file.h new file mode 100644 index 0000000..e4ba429 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/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/filedialog/qmldir b/examples/tutorials/gettingStarted/gsQml/filedialog/qmldir new file mode 100644 index 0000000..c2b27da --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQml/filedialog/qmldir @@ -0,0 +1 @@ +plugin FileDialog plugins diff --git a/examples/tutorials/gettingStarted/gsQml/images/arrow.png b/examples/tutorials/gettingStarted/gsQml/images/arrow.png new file mode 100644 index 0000000..14978c2 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/images/arrow.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/images/qt-logo.png b/examples/tutorials/gettingStarted/gsQml/images/qt-logo.png new file mode 100644 index 0000000..14ddf2a Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/images/qt-logo.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_editmenu.png b/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_editmenu.png new file mode 100644 index 0000000..27feed5 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_editmenu.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_filemenu.png b/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_filemenu.png new file mode 100644 index 0000000..4d8f9f2 Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_filemenu.png differ diff --git a/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_newfile.png b/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_newfile.png new file mode 100644 index 0000000..680acfe Binary files /dev/null and b/examples/tutorials/gettingStarted/gsQml/pics/qml-texteditor5_newfile.png differ -- cgit v0.12 From d4dceca5dcd9252e09a421b65b318a7178049cd1 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 5 Aug 2010 11:51:23 +0200 Subject: qdoc: Cleaned up the application option specification and use. The flags allowed on the command line are now: -online (default), -base, -assistant (same as -base), and -creator. If you don't specify one of these, you see a warning in the error output telling you that it didn't find an application flag and that it generated online docs by defualt. --- tools/qdoc3/config.h | 4 +- tools/qdoc3/ditaxmlgenerator.cpp | 1 - tools/qdoc3/htmlgenerator.cpp | 127 +++++++++++++++++++-------------------- tools/qdoc3/htmlgenerator.h | 9 ++- tools/qdoc3/main.cpp | 70 +++++++++------------ 5 files changed, 95 insertions(+), 116 deletions(-) diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index 7665f1a..335a0d6 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -143,9 +143,7 @@ class Config #define CONFIG_MACRO "macro" #define CONFIG_NATURALLANGUAGE "naturallanguage" #define CONFIG_OBSOLETELINKS "obsoletelinks" -#define CONFIG_ONLINE "online" -#define CONFIG_OFFLINE "offline" -#define CONFIG_CREATOR "creator" +#define CONFIG_APPLICATION "application" #define CONFIG_OUTPUTDIR "outputdir" #define CONFIG_OUTPUTENCODING "outputencoding" #define CONFIG_OUTPUTLANGUAGE "outputlanguage" diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 4789c67..816ab9f 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -440,7 +440,6 @@ void DitaXmlGenerator::initializeGenerator(const Config &config) DITAXMLGENERATOR_GENERATEMACREFS); project = config.getString(CONFIG_PROJECT); - offlineDocs = !config.getBool(CONFIG_ONLINE); projectDescription = config.getString(CONFIG_DESCRIPTION); if (projectDescription.isEmpty() && !project.isEmpty()) projectDescription = project + " Reference Documentation"; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 723f516..b1a8336 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -219,9 +219,7 @@ HtmlGenerator::HtmlGenerator() inTableHeader(false), numTableRows(0), threeColumnEnumValueTable(true), - offlineDocs(false), - onlineDocs(false), - creatorDocs(true), + application(Online), funcLeftParen("\\S(\\()"), myTree(0), slow(false), @@ -290,11 +288,17 @@ void HtmlGenerator::initializeGenerator(const Config &config) project = config.getString(CONFIG_PROJECT); - onlineDocs = config.getBool(CONFIG_ONLINE); - - offlineDocs = config.getBool(CONFIG_OFFLINE); - - creatorDocs = config.getBool(CONFIG_CREATOR); + QString app = config.getString(CONFIG_APPLICATION); + if (app == "online") + application = Online; + else if (app == "creator") + application = Creator; + else if (app == "assistant") + application = Assistant; + else if (app == "base") + application = Assistant; + else + application = Online; projectDescription = config.getString(CONFIG_DESCRIPTION); if (projectDescription.isEmpty() && !project.isEmpty()) @@ -1811,9 +1815,8 @@ void HtmlGenerator::generateHeader(const QString& title, // Setting some additional style sheet related details depending on configuration (e.g. online/offline) - - if(onlineDocs==true) // onlineDocs is for the web - { + switch (application) { + case Online: // Browser spec styles out() << " \n"; - out() << "\n"; - } - else if (offlineDocs == true) - { - out() << "\n"; - } - else if (creatorDocs == true) - { - out() << "\n"; - } - else - { - out() << "\n"; - } + + switch (application) { + case Online: + out() << " \n"; + out() << " \n"; + out() << "\n"; + break; + case Assistant: + out() << "\n"; + break; + case Creator: + out() << "\n"; + break; + default: + out() << "\n"; + } out() << "\n"; } diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index d92c349..ec79896 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -95,6 +95,11 @@ class HtmlGenerator : public PageGenerator LastSinceType }; + enum Application { + Online, + Assistant, + Creator}; + public: HtmlGenerator(); ~HtmlGenerator(); @@ -294,9 +299,7 @@ class HtmlGenerator : public PageGenerator bool inTableHeader; int numTableRows; bool threeColumnEnumValueTable; - bool onlineDocs; - bool offlineDocs; - bool creatorDocs; + Application application; QString link; QStringList sectionNumber; QRegExp funcLeftParen; diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 47a4b67..38b76a4 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -105,8 +105,7 @@ static bool showInternal = false; static bool obsoleteLinks = false; static QStringList defines; static QHash trees; -static QString application = "base"; //application -static bool applicationArg = 0; //if 1, then the argument is provided and it will override the qdocconf file +static QString appArg; // application /*! Find the Tree for language \a lang and return a pointer to it. @@ -194,36 +193,25 @@ static void processQdocconfFile(const QString &fileName) config.load(fileName); /* - Set the application to which qdoc will create the output. - The three applications are: - base: simple, basic html output. Best suited for offline viewing - creator: additional formatting. - online: full-featured online version with search and links to Qt topics - - Note: This will override the offline, online, creator defines. + Set the application to which qdoc will create the output. + The three applications are: + + base or assistant: simple, basic html output + for offline viewing in the Assistant application. + + creator: additional formatting for viewing in + the Creator application. + + online: full-featured online version with search and + links to Qt topics */ - if(applicationArg == false){ - - QString appConfig = config.getString(CONFIG_APPLICATION); - if (!appConfig.isEmpty()){ - application = appConfig; - } - } - if(application == "online"){ - config.setStringList(CONFIG_ONLINE, QStringList("true")); - config.setStringList(CONFIG_OFFLINE, QStringList("false")); - config.setStringList(CONFIG_CREATOR, QStringList("false")); - } - else if(application == "creator"){ - config.setStringList(CONFIG_ONLINE, QStringList("false")); - config.setStringList(CONFIG_OFFLINE, QStringList("true")); - config.setStringList(CONFIG_CREATOR, QStringList("false")); - } - else if(application == "base"){ - config.setStringList(CONFIG_ONLINE, QStringList("false")); - config.setStringList(CONFIG_OFFLINE, QStringList("false")); - config.setStringList(CONFIG_CREATOR, QStringList("true")); + if (appArg.isEmpty()) { + qDebug() << "Warning: Application flag not specified on" + << "command line. Options are -assistant, -creator," + << "and -online (default)."; + appArg = "online"; } + config.setStringList(CONFIG_APPLICATION, QStringList(appArg)); /* Add the defines to the configuration variables. @@ -496,18 +484,14 @@ int main(int argc, char **argv) else if (opt == "-obsoletelinks") { obsoleteLinks = true; } - else if (opt == "-base") { - application = "base"; - applicationArg = true; - } - else if (opt == "-creator") { - application = "creator"; - applicationArg = true; - } - else if (opt == "-online") { - application = "online"; - applicationArg = true; - } + else if (opt == "-base") + appArg = "base"; + else if (opt == "-assistant") + appArg = "assistant"; + else if (opt == "-creator") + appArg = "creator"; + else if (opt == "-online") + appArg = "online"; else { qdocFiles.append(opt); } @@ -522,7 +506,7 @@ int main(int argc, char **argv) Main loop. */ foreach (QString qf, qdocFiles) { - qDebug() << "PROCESSING:" << qf; + //qDebug() << "PROCESSING:" << qf; processQdocconfFile(qf); } -- cgit v0.12 From 7de8a0c487ce6a7f13c2028e93648807ef7d8e8b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 5 Aug 2010 12:09:01 +0200 Subject: qdoc: Removed three unused config variables. These no longer do anything in qdocconf files: online = false offline = false creator = true --- tools/qdoc3/test/assistant.qdocconf | 3 --- tools/qdoc3/test/designer.qdocconf | 3 --- tools/qdoc3/test/linguist.qdocconf | 3 --- tools/qdoc3/test/qdeclarative.qdocconf | 3 --- tools/qdoc3/test/qmake.qdocconf | 3 --- tools/qdoc3/test/qt-api-only.qdocconf | 3 --- tools/qdoc3/test/qt-build-docs.qdocconf | 3 --- tools/qdoc3/test/qt.qdocconf | 3 --- 8 files changed, 24 deletions(-) diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf index 119a676..8cf5722 100644 --- a/tools/qdoc3/test/assistant.qdocconf +++ b/tools/qdoc3/test/assistant.qdocconf @@ -7,9 +7,6 @@ include(qt-defines.qdocconf) project = Qt Assistant description = Qt Assistant Manual url = http://qt.nokia.com/doc/4.7 -online = false -offline = false -creator = true indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index diff --git a/tools/qdoc3/test/designer.qdocconf b/tools/qdoc3/test/designer.qdocconf index 0595417..b1f37dc 100644 --- a/tools/qdoc3/test/designer.qdocconf +++ b/tools/qdoc3/test/designer.qdocconf @@ -7,9 +7,6 @@ include(qt-defines.qdocconf) project = Qt Designer description = Qt Designer Manual url = http://qt.nokia.com/doc/4.7 -online = false -offline = false -creator = true indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf index 7dd57fb..26fb55c 100644 --- a/tools/qdoc3/test/linguist.qdocconf +++ b/tools/qdoc3/test/linguist.qdocconf @@ -7,9 +7,6 @@ include(qt-defines.qdocconf) project = Qt Linguist description = Qt Linguist Manual url = http://qt.nokia.com/doc/4.7 -online = false -offline = false -creator = true indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index diff --git a/tools/qdoc3/test/qdeclarative.qdocconf b/tools/qdoc3/test/qdeclarative.qdocconf index 7628519..80bca29 100644 --- a/tools/qdoc3/test/qdeclarative.qdocconf +++ b/tools/qdoc3/test/qdeclarative.qdocconf @@ -8,9 +8,6 @@ project = Qml description = Qml Reference Documentation url = http://qt.nokia.com/doc/4.7/ qmlonly = true -online = false -offline = false -creator = true edition.Console.modules = QtCore QtDBus QtNetwork QtScript QtSql QtXml \ QtXmlPatterns QtTest diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf index c666288..f069129 100644 --- a/tools/qdoc3/test/qmake.qdocconf +++ b/tools/qdoc3/test/qmake.qdocconf @@ -7,9 +7,6 @@ include(qt-defines.qdocconf) project = QMake description = QMake Manual url = http://qt.nokia.com/doc/4.7 -online = false -offline = false -creator = true indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index diff --git a/tools/qdoc3/test/qt-api-only.qdocconf b/tools/qdoc3/test/qt-api-only.qdocconf index 7387810..cdd7a7c 100644 --- a/tools/qdoc3/test/qt-api-only.qdocconf +++ b/tools/qdoc3/test/qt-api-only.qdocconf @@ -5,9 +5,6 @@ include(qt-build-docs.qdocconf) # qmake.qdocconf). url = ./ -online = false -offline = false -creator = true # Ensures that the documentation for the tools is not included in the generated # .qhp file. diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index 415457e..bb47b57 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -7,9 +7,6 @@ include(qt-defines.qdocconf) project = Qt description = Qt Reference Documentation url = http://qt.nokia.com/doc/4.7 -online = false -offline = false -creator = true sourceencoding = UTF-8 outputencoding = UTF-8 diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index a5e6578..f78bd38 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -9,9 +9,6 @@ versionsym = version = %VERSION% description = Qt Reference Documentation url = http://qt.nokia.com/doc/4.7 -online = true -offline = false -creator = false sourceencoding = UTF-8 outputencoding = UTF-8 -- cgit v0.12 From f3f95d4282ffbfb307e98d20a166ced4cc982061 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 22 Jun 2010 13:53:03 +0200 Subject: QXmlPatterns QAbstractDateTime: only parse 3 digits of time fraction the XML Schema dateTime type allows for an unlimited precision of fractial time values; this fails for 4 or more digits when creating a QTime. This patch takes only 3 digits of the time fraction into account, since we cannot store more in a QTime or QDateTime anyway. Reviewed-by: Olivier Goffart Task-number: QTBUG-11559 --- src/xmlpatterns/data/qabstractdatetime.cpp | 2 +- .../files/dateTime-with-microseconds.xml | 1 + .../files/dateTime-with-microseconds.xsd | 12 ++++++++++++ tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp | 6 ++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xml create mode 100644 tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xsd diff --git a/src/xmlpatterns/data/qabstractdatetime.cpp b/src/xmlpatterns/data/qabstractdatetime.cpp index 6329fbe..a298698 100644 --- a/src/xmlpatterns/data/qabstractdatetime.cpp +++ b/src/xmlpatterns/data/qabstractdatetime.cpp @@ -163,7 +163,7 @@ QDateTime AbstractDateTime::create(AtomicValue::Ptr &errorMessage, QString msecondsStr(getSafeCapt(mseconds)); if(!msecondsStr.isEmpty()) - msecondsStr = msecondsStr.leftJustified(3, QLatin1Char('0')); + msecondsStr = msecondsStr.leftJustified(3, QLatin1Char('0'), true); const MSecondProperty msecs = msecondsStr.toInt(); if(hour == 24) diff --git a/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xml b/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xml new file mode 100644 index 0000000..b17739a --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xml @@ -0,0 +1 @@ +2009-12-16T23:14:10.823218Z diff --git a/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xsd b/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xsd new file mode 100644 index 0000000..55557f1 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/dateTime-with-microseconds.xsd @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp index 3517b5a..092e966 100644 --- a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp +++ b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp @@ -216,6 +216,12 @@ void tst_XmlPatternsValidator::xsdSupport_data() const << 0 << (QStringList() << QLatin1String("files/complex-type-including-anonymous-type.xsd")) << QString(); + + QTest::newRow("QTBUG-11559 A schema and instance with a dateTime containing microseconds") + << 0 + << (QStringList() << QLatin1String("files/dateTime-with-microseconds.xml") + << QLatin1String("files/dateTime-with-microseconds.xsd")) + << QString(); } QTEST_MAIN(tst_XmlPatternsValidator) -- cgit v0.12 From 6ca2fe678740f4830de2388e9b2928813561373c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 5 Aug 2010 15:13:58 +0200 Subject: Designer: Prevent rich text from being copied into style sheets. Reviewed-by: Lasse Holmstedt Task-number: QTCREATORBUG-1952 --- tools/designer/src/lib/shared/stylesheeteditor.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/designer/src/lib/shared/stylesheeteditor.cpp b/tools/designer/src/lib/shared/stylesheeteditor.cpp index b76d700..e809447 100644 --- a/tools/designer/src/lib/shared/stylesheeteditor.cpp +++ b/tools/designer/src/lib/shared/stylesheeteditor.cpp @@ -79,6 +79,7 @@ StyleSheetEditor::StyleSheetEditor(QWidget *parent) : QTextEdit(parent) { setTabStopWidth(fontMetrics().width(QLatin1Char(' '))*4); + setAcceptRichText(false); new CssHighlighter(document()); } -- cgit v0.12 From 8155ee1db55893876165936f4e9d551b45c0f35a Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Thu, 5 Aug 2010 17:45:52 +0200 Subject: Move note on connectToBus() not actually being able to reconnect to connectToBus() documentation, where it belongs. This also fixes some bad English ("make be connected") by means of removing it. Merge-request: 2443 Reviewed-by: Oswald Buddenhagen --- src/dbus/qdbusconnection.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 5cbb8ca..055fead 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -173,6 +173,9 @@ void QDBusConnectionManager::setConnection(const QString &name, QDBusConnectionP The connection is then torn down using the disconnectFromBus() function. + Once disconnected, calling connectToBus() will not reestablish a + connection, you must create a new QDBusConnection instance. + As a convenience for the two most common connection types, the sessionBus() and systemBus() functions return open connections to the session server daemon and the system server daemon, @@ -853,10 +856,6 @@ QDBusConnectionInterface *QDBusConnection::interface() const /*! Returns true if this QDBusConnection object is connected. - - If it isn't connected, calling connectToBus() on the same - connection name will not make be connected. You need to call the - QDBusConnection constructor again. */ bool QDBusConnection::isConnected() const { -- cgit v0.12 From 0dfc5666d2b615b2c4c0c2f392771b001de9163b Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Thu, 5 Aug 2010 17:45:53 +0200 Subject: Remove useless QString::clear() from QSharedData example snippet. Merge-request: 2443 Reviewed-by: Oswald Buddenhagen --- doc/src/snippets/sharedemployee/employee.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/snippets/sharedemployee/employee.h b/doc/src/snippets/sharedemployee/employee.h index 18b47e0..2c9ba6f 100644 --- a/doc/src/snippets/sharedemployee/employee.h +++ b/doc/src/snippets/sharedemployee/employee.h @@ -48,7 +48,7 @@ class EmployeeData : public QSharedData { public: - EmployeeData() : id(-1) { name.clear(); } + EmployeeData() : id(-1) { } EmployeeData(const EmployeeData &other) : QSharedData(other), id(other.id), name(other.name) { } ~EmployeeData() { } -- cgit v0.12 From bbd444559359df3e211fedb28d40b175af778030 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 6 Aug 2010 10:55:23 +1000 Subject: Update def files for d524da81ee257a6bd67d32d0bc870280a7d5b8a4. --- src/s60installs/eabi/QtNetworku.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/eabi/QtNetworku.def b/src/s60installs/eabi/QtNetworku.def index 6b34a19..2442ee8 100644 --- a/src/s60installs/eabi/QtNetworku.def +++ b/src/s60installs/eabi/QtNetworku.def @@ -1131,7 +1131,7 @@ EXPORTS _ZNK21QNetworkAccessManager13configurationEv @ 1130 NONAME _ZNK21QNetworkAccessManager17networkAccessibleEv @ 1131 NONAME _ZNK21QNetworkAccessManager19activeConfigurationEv @ 1132 NONAME - _ZNK21QNetworkConfiguration10bearerNameEv @ 1133 NONAME ABSENT + _ZNK21QNetworkConfiguration10bearerNameEv @ 1133 NONAME _ZNK21QNetworkConfiguration10identifierEv @ 1134 NONAME _ZNK21QNetworkConfiguration18isRoamingAvailableEv @ 1135 NONAME _ZNK21QNetworkConfiguration4nameEv @ 1136 NONAME -- cgit v0.12