From 12ebf6c45428e303e0f238d59f144f3b4816ec3b Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 17 Aug 2010 15:15:41 +0200 Subject: Doc: Added a small note about using .pro files in SUBDIRS. Details: Found while trying to fix example .pro files. Reviewed-by: Trust Me --- doc/src/development/qmake-manual.qdoc | 109 +++++++++++++++++----------------- 1 file changed, 55 insertions(+), 54 deletions(-) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index baa30fc..44658bc 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1079,27 +1079,27 @@ \target BLD_INF_RULES \section1 BLD_INF_RULES - + \e {This is only used on the Symbian platform.} - + Generic \c bld.inf file content can be specified with \c BLD_INF_RULES variables. The section of \c bld.inf file where each rule goes is appended to \c BLD_INF_RULES with a dot. - + For example: - + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 146 - + This will add the specified statements to the \c prj_exports section of the generated \c bld.inf file. - + It is also possible to add multiple rows in a single block. Each double quoted string will be placed on a new row in the generated \c bld.inf file. - + For example: - + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 143 - + Any rules you define will be added after automatically generated rules in each section. @@ -1274,7 +1274,7 @@ the contents of the \l{#QMAKE_BUNDLE_DATA}{QMAKE_BUNDLE_DATA} variable. These options only have an effect on the Symbian platform: - + \table 95% \header \o Option \o Description \row \o stdbinary \o Builds an Open C binary (i.e. STDDLL, STDEXE, or STDLIB, @@ -1286,7 +1286,7 @@ Note that this only affects automatically generated bld.inf content; the content added via \c BLD_INF_RULES variable is not affected. \endtable - + These options have an effect on Linux/Unix platforms: \table 95% @@ -1353,7 +1353,7 @@ The default deployment target path for Windows CE is \c{%CSIDL_PROGRAM_FILES%\target}, which usually gets expanded to \c{\Program Files\target}. For the Symbian platform, the default target -is the application private directory on the drive it is installed to. + is the application private directory on the drive it is installed to. It is also possible to specify multiple \c sources to be deployed on target \c paths. In addition, different variables can be used for @@ -1366,7 +1366,7 @@ is the application private directory on the drive it is installed to. \note In Windows CE all linked Qt libraries will be deployed to the path specified by \c{myFiles.path}. On Symbian platform all libraries and executables will always be deployed to the \\sys\\bin of the installation drive. - + Since the Symbian platform build system automatically moves binaries to certain directories under the epoc32 directory, custom plugins, executables or dynamically loadable libraries need special handling. When deploying @@ -1389,7 +1389,7 @@ is the application private directory on the drive it is installed to. \c pkg_postrules or \c pkg_prerules are not parsed by qmake, so they should be in a format understood by Symbian package generation tools. Please consult the Symbian platform documentation for correct syntax. - + For example, to deploy DLL and add a new dependency: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 140 @@ -1397,7 +1397,7 @@ is the application private directory on the drive it is installed to. Please note that \c pkg_prerules can also replace default statements in pkg file. If no pkg_prerules is defined, qmake makes sure that PKG file syntax is correct and it contains all mandatory statements such as: - + \list \o languages, for example \BR &EN,FR @@ -1407,7 +1407,7 @@ is the application private directory on the drive it is installed to. %{"Vendor-EN", ..., "Vendor-FR"} :"Unique vendor name" \endlist - + If you decide to override any of these statements, you need to pay attention that also other statements stay valid. For example if you override languages statement, you must override also package-header @@ -1419,7 +1419,7 @@ is the application private directory on the drive it is installed to. - e.g. if a specific device is required to run the application or more languages need to be supported by the package file. The supported \c default_deployment rules that can be disabled are: - + \list \o pkg_depends_qt \o pkg_depends_webkit @@ -1427,9 +1427,9 @@ is the application private directory on the drive it is installed to. \endlist For example: - + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 141 - + On the Symbian platform, you can use \c{DEPLOYMENT.installer_header} variable to generate smart installer wrapper for your application. If you specify just UID of the installer package as the value, then @@ -1454,10 +1454,10 @@ is the application private directory on the drive it is installed to. \note In Windows CE, No plugins will be deployed automatically. If the application depends on plugins, these plugins have to be specified manually. - + \note On the Symbian platform, all plugins supported by this variable -will be deployed by default with Qt libraries, so generally using this -variable is not needed. + will be deployed by default with Qt libraries, so generally using this + variable is not needed. For example: @@ -1561,14 +1561,14 @@ variable is not needed. \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 34 See also \l{#SOURCES}{SOURCES}. - + \target ICON \section1 ICON - + This variable is used only in MAC and the Symbian platform to set the application icon. Please see \l{Setting the Application Icon}{the application icon documentation} for more information. - + \target INCLUDEPATH \section1 INCLUDEPATH @@ -1657,7 +1657,7 @@ variable is not needed. file name suffix. \bold{Note:} On the Symbian platform, the build system makes a -distinction between shared and + distinction between shared and static libraries. In most cases, qmake will figure out which library you are refering to, but in some cases you may have to specify it explicitly to get the expected behavior. This typically happens if you are building a @@ -1702,28 +1702,28 @@ distinction between shared and \target MMP_RULES \section1 MMP_RULES - + \e {This is only used on the Symbian platform.} - + Generic MMP file content can be specified with this variable. - + For example: - + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 137 - + This will add the specified statement to the end of the generated MMP file. - + It is also possible to add multiple rows in a single block. Each double quoted string will be placed on a new row in the generated MMP file. - + For example: - + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 138 - + If you need to include a hash (\c{#}) character inside the \c MMP_RULES statement, it can be done with the variable \c LITERAL_HASH as follows: - + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 139 There is also a convenience function for adding conditional rules @@ -2031,8 +2031,8 @@ distinction between shared and respectively. \bold{Note:} On the Symbian platform, this variable can be used to pass -architecture specific options to each compiler in the Symbian build system. -For example: + architecture specific options to each compiler in the Symbian build system. + For example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 131 @@ -2374,10 +2374,10 @@ For example: \section1 QMAKE_LFLAGS_RPATH \e {This is used on Unix platforms only.} - + Library paths in this definition are added to the executable at link time so that the added paths will be preferentially searched at runtime. - + \section1 QMAKE_LFLAGS_QT_DLL This variable contains link flags when building programs that @@ -2716,7 +2716,7 @@ For example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 45 \section1 QMAKE_RPATH - + \e {This is used on Unix platforms only.} Is equivalent to \l QMAKE_LFLAGS_RPATH. @@ -2870,30 +2870,30 @@ For example: This variable contains the name of the resource file for the application. The value of this variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. - + \target RSS_RULES \section1 RSS_RULES - + \e {This is only used on the Symbian platform.} - + Generic RSS file content can be specified with this variable. The syntax is similar to \c MMP_RULES and \c BLD_INF_RULES. - + For example: - + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 144 - + This will add the specified statement to the end of the \c APP_REGISTRATION_INFO resource struct in the generated registration resource file. As an impact of this statement, the application will not be visible in application shell. - + It is also possible to add multiple rows in a single block. Each double quoted string will be placed on a new row in the registration resource file. - + For example: - + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 145 - + This example will install the application to MyFolder in the Symbian platform application shell. In addition it will make the application to be launched in background. @@ -2933,7 +2933,7 @@ For example: \section1 S60_VERSION \e {This is only used on the Symbian platform.} - + Contains the version number of the underlying S60 SDK; e.g. "5.0". \target SIGNATURE_FILE @@ -2969,8 +2969,9 @@ For example: \section1 SUBDIRS This variable, when used with the \l{#TEMPLATE}{\c subdirs template} - contains the names of all subdirectories that contain parts of the project - that need be built. Each subdirectory must contain its own project file. + contains the names of all subdirectories or project files that contain + parts of the project that need be built. Each subdirectory specified + using this variable must contain its own project file. For example: -- cgit v0.12 From 86c3fed122b8a6e47904d958f8c50fa19e668434 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 17 Aug 2010 15:31:48 +0200 Subject: Doc: Started work to tidy up existing QML docs. Reviewed-by: Trust Me --- doc/src/declarative/qml-intro.qdoc | 38 +++++----------- .../snippets/declarative/qml-intro/anchors1.qml | 14 ++++++ .../snippets/declarative/qml-intro/anchors2.qml | 16 +++++++ .../snippets/declarative/qml-intro/anchors3.qml | 25 +++++++++++ .../declarative/qml-intro/basic-syntax.qml | 8 ++++ .../declarative/qml-intro/hello-world1.qml | 11 +++++ .../declarative/qml-intro/hello-world2.qml | 16 +++++++ .../declarative/qml-intro/hello-world3.qml | 17 +++++++ .../declarative/qml-intro/hello-world4.qml | 21 +++++++++ .../declarative/qml-intro/hello-world5.qml | 23 ++++++++++ .../declarative/qml-intro/number-animation1.qml | 22 +++++++++ .../declarative/qml-intro/number-animation2.qml | 24 ++++++++++ .../snippets/declarative/qml-intro/rectangle.qml | 8 ++++ .../qml-intro/sequential-animation1.qml | 23 ++++++++++ .../qml-intro/sequential-animation2.qml | 33 ++++++++++++++ .../qml-intro/sequential-animation3.qml | 46 +++++++++++++++++++ doc/src/snippets/declarative/qml-intro/states1.qml | 52 ++++++++++++++++++++++ .../declarative/qml-intro/transformations1.qml | 38 ++++++++++++++++ 18 files changed, 409 insertions(+), 26 deletions(-) create mode 100644 doc/src/snippets/declarative/qml-intro/anchors1.qml create mode 100644 doc/src/snippets/declarative/qml-intro/anchors2.qml create mode 100644 doc/src/snippets/declarative/qml-intro/anchors3.qml create mode 100644 doc/src/snippets/declarative/qml-intro/basic-syntax.qml create mode 100644 doc/src/snippets/declarative/qml-intro/hello-world1.qml create mode 100644 doc/src/snippets/declarative/qml-intro/hello-world2.qml create mode 100644 doc/src/snippets/declarative/qml-intro/hello-world3.qml create mode 100644 doc/src/snippets/declarative/qml-intro/hello-world4.qml create mode 100644 doc/src/snippets/declarative/qml-intro/hello-world5.qml create mode 100644 doc/src/snippets/declarative/qml-intro/number-animation1.qml create mode 100644 doc/src/snippets/declarative/qml-intro/number-animation2.qml create mode 100644 doc/src/snippets/declarative/qml-intro/rectangle.qml create mode 100644 doc/src/snippets/declarative/qml-intro/sequential-animation1.qml create mode 100644 doc/src/snippets/declarative/qml-intro/sequential-animation2.qml create mode 100644 doc/src/snippets/declarative/qml-intro/sequential-animation3.qml create mode 100644 doc/src/snippets/declarative/qml-intro/states1.qml create mode 100644 doc/src/snippets/declarative/qml-intro/transformations1.qml diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc index 69dd500..13c8e4f 100644 --- a/doc/src/declarative/qml-intro.qdoc +++ b/doc/src/declarative/qml-intro.qdoc @@ -320,7 +320,7 @@ from \l Item. The rotation property is a real number that specifies the angle in a clockwise direction for the rotation of the object. Here is the code for our animated rotating image. -\quotefile doc/src/snippets/declarative/number-animation1.qml +\quotefile doc/src/snippets/declarative/qml-intro/number-animation1.qml The \c {transformOrigin: Item.Center} is redundant since this is the default axis of rotation anyway. But if you change \c Center to \c BottomRight you @@ -333,7 +333,7 @@ combination. For example, if the task had been to animate the rotation about the y-axis passing through the center of the image then the following code would do it. -\quotefile doc/src/snippets/declarative/number-animation2.qml +\quotefile doc/src/snippets/declarative/qml-intro/number-animation2.qml Here there is a rectangle 600 by 400 pixels. Placed within that rectangle is an image 100 by 100 pixels. It is rotated about the center of the image @@ -362,7 +362,7 @@ will be animating the position and the size of the image. First create two images -\quotefile doc/src/snippets/declarative/sequential-animation1.qml +\quotefile doc/src/snippets/declarative/qml-intro/sequential-animation1.qml We will add to 'image1' a SequentialAnimation from x = 20 to the target of x = 450. The 'from' values will be used because we will be repeating the @@ -375,7 +375,7 @@ between the x values and over a given duration. After the NumberAnimation there will be a PauseAnimation that will pause the animation for 500 milliseconds (half a second) simply for the visual effect. -\snippet doc/src/snippets/declarative/sequential-animation2.qml adding a sequential animation +\snippet doc/src/snippets/declarative/qml-intro/sequential-animation2.qml adding a sequential animation A similar block of code is written for the animation of the 'y' value of the position. @@ -390,7 +390,7 @@ and image1 to 1 and image2 to 2 then image2 will be in the foreground and image1 in the background. When image1 passes image2 it will pass behind it. The completed code looks like -\quotefile doc/src/snippets/declarative/sequential-animation3.qml +\quotefile doc/src/snippets/declarative/qml-intro/sequential-animation3.qml The \c {easing.type} has many options, expressed as a string. It specifies the kind of equation that describes the acceleration of the property value, not @@ -439,9 +439,6 @@ delivers some of the best examples that illustrate these new elements. \endtable - - - \section1 Using States A state is a defined set of values in the configuration of an object and @@ -471,7 +468,7 @@ will be the default state. We will just go to 'night' by clicking and holding the left mouse button down, releasing the mouse button will reverse the process -\quotefile doc/src/snippets/declarative/states1.qml +\quotefile doc/src/snippets/declarative/qml-intro/states1.qml Several new things appear in this sample. Firstly, we use a \l MouseArea element to detect mouse clicks in the \e mainRectangle. Secondly, we use @@ -549,15 +546,15 @@ needle_shadow have the same default \e x and \e y values but the rotation origin for the needle is slightly different so that a shadow will be evident as the needle moves. -\snippet ../../examples/declarative/ui-components/dialcontrol/content/Dial.qml needle_shadow +\snippet examples/declarative/ui-components/dialcontrol/content/Dial.qml needle_shadow And the needle -\snippet ../../examples/declarative/ui-components/dialcontrol/content/Dial.qml needle +\snippet examples/declarative/ui-components/dialcontrol/content/Dial.qml needle The final image is the overlay which simply has a position defined. -\snippet ../../examples/declarative/ui-components/dialcontrol/content/Dial.qml overlay +\snippet examples/declarative/ui-components/dialcontrol/content/Dial.qml overlay \e {dialcontrol.qml} in the \e {examples/declarative/ui-components/dialcontrol} directory is the main file of the example. It defines the visual environment that the Dial @@ -565,17 +562,14 @@ will fit into. Because the \e Dial component and the images live in the \e content sub-directory we will have to import this into \e dialcontrol.qml. So the start of the file looks like - \code - import Qt 4.7 - import "content" - \endcode +\snippet examples/declarative/ui-components/dialcontrol/dialcontrol.qml imports The visual space is bound by a 300 by 300 pixel \l Rectangle which is given a gray color. Inside this rectangle is our component \e Dial and a \l Rectangle. Inside the rectangle called 'container' is another rectangle with the interesting name 'slider'. -\snippet ../../examples/declarative/ui-components/dialcontrol/dialcontrol.qml 0 +\snippet examples/declarative/ui-components/dialcontrol/dialcontrol.qml 0 The Dial component, named 'dial, is \e anchored to the center of the main rectangle. The \c value attribute of 'dial' is set to a value based on the @@ -584,15 +578,7 @@ rectangle. The \c value attribute of 'dial' is set to a value based on the the rotation of the needle image. Notice this piece of code in Dial where the change in \c value modifies the position of the needle. - \code - angle: Math.min(Math.max(-130, root.value*2.6 - 130), 133) - Behavior on angle { - SpringAnimation { - spring: 1.4 - damping: .15 - } - } - \endcode +\snippet examples/declarative/ui-components/dialcontrol/Dial.qml needle angle This is part of the \c needleRotation that rotates the needle and causes the rotation of its shadow. \l SpringAnimation is an element that modifies the value diff --git a/doc/src/snippets/declarative/qml-intro/anchors1.qml b/doc/src/snippets/declarative/qml-intro/anchors1.qml new file mode 100644 index 0000000..320d0e7 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/anchors1.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +Rectangle { + id: myWin + width: 500 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + width: 150; height: 150 + anchors.bottom: myWin.bottom + } +} diff --git a/doc/src/snippets/declarative/qml-intro/anchors2.qml b/doc/src/snippets/declarative/qml-intro/anchors2.qml new file mode 100644 index 0000000..bb9ed75 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/anchors2.qml @@ -0,0 +1,16 @@ +import Qt 4.7 + +Rectangle { + id: myWin + width: 500 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + width: 150; height: 150 + anchors.bottom: myWin.bottom + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 10 + } +} diff --git a/doc/src/snippets/declarative/qml-intro/anchors3.qml b/doc/src/snippets/declarative/qml-intro/anchors3.qml new file mode 100644 index 0000000..99d2ceb --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/anchors3.qml @@ -0,0 +1,25 @@ +import Qt 4.7 + +Rectangle { + id: myWin + width: 500 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + width: 150; height: 150 + anchors.bottom: myWin.bottom + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 10 + } + +//! [adding some text] + Text { + text: "

The Qt Logo

" + anchors.bottom: image1.top + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 15 + } +//! [adding some text] +} diff --git a/doc/src/snippets/declarative/qml-intro/basic-syntax.qml b/doc/src/snippets/declarative/qml-intro/basic-syntax.qml new file mode 100644 index 0000000..b241500 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/basic-syntax.qml @@ -0,0 +1,8 @@ +// Note: this file is not intended to be run. + +//! [basic syntax] +SomeElement { + id: myObject + ... some other things here ... +} +//! [basic syntax] diff --git a/doc/src/snippets/declarative/qml-intro/hello-world1.qml b/doc/src/snippets/declarative/qml-intro/hello-world1.qml new file mode 100644 index 0000000..244175c --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/hello-world1.qml @@ -0,0 +1,11 @@ +import Qt 4.7 + +Rectangle { + id: myRectangle + width: 500 + height: 400 + + Text { text: "Hello World!" } + + color: "lightgray" +} diff --git a/doc/src/snippets/declarative/qml-intro/hello-world2.qml b/doc/src/snippets/declarative/qml-intro/hello-world2.qml new file mode 100644 index 0000000..73b2f8c --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/hello-world2.qml @@ -0,0 +1,16 @@ +import Qt 4.7 + +Rectangle { + id: myRectangle + width: 500 + height: 400 + +//! [updated text] + Text { + text: "

Hello World

"; color: "darkgreen" + x: 100; y:100 + } +//! [updated text] + + color: "lightgray" +} diff --git a/doc/src/snippets/declarative/qml-intro/hello-world3.qml b/doc/src/snippets/declarative/qml-intro/hello-world3.qml new file mode 100644 index 0000000..112f775 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/hello-world3.qml @@ -0,0 +1,17 @@ +import Qt 4.7 + +Rectangle { + id: myRectangle + width: 500 + height: 400 + +//! [updated text] + Text { + text: "

Hello world again

" + color: "#002288" + x: 100; y: 100 + } +//! [updated text] + + color: "lightgray" +} diff --git a/doc/src/snippets/declarative/qml-intro/hello-world4.qml b/doc/src/snippets/declarative/qml-intro/hello-world4.qml new file mode 100644 index 0000000..c97334e --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/hello-world4.qml @@ -0,0 +1,21 @@ +import Qt 4.7 + +Rectangle { + id: myRectangle + width: 500 + height: 400 + + Text { + text: "

Hello world again

" + color: "#002288" + x: 100; y: 100 + } + +//! [added an image] + Image { + source: "images/qt-logo.png" + } +//! [added an image] + + color: "lightgray" +} diff --git a/doc/src/snippets/declarative/qml-intro/hello-world5.qml b/doc/src/snippets/declarative/qml-intro/hello-world5.qml new file mode 100644 index 0000000..74a612a --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/hello-world5.qml @@ -0,0 +1,23 @@ +import Qt 4.7 + +Rectangle { + id: myRectangle + width: 500 + height: 400 + + Text { + text: "

Hello world again

" + color: "#002288" + x: 100; y: 100 + } + +//! [positioning the image] + Image { + source: "images/qt-logo.png" + x: 100; y: 150 + width: 150; height: 150 + } +//! [positioning the image] + + color: "lightgray" +} diff --git a/doc/src/snippets/declarative/qml-intro/number-animation1.qml b/doc/src/snippets/declarative/qml-intro/number-animation1.qml new file mode 100644 index 0000000..d80a8dc --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/number-animation1.qml @@ -0,0 +1,22 @@ +import Qt 4.7 + +Rectangle { + id: mainRec + width: 600 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + x: 200; y: 100 + width: 100; height: 100 + + // Animate a rotation + transformOrigin: Item.Center + NumberAnimation on rotation { + from: 0; to: 360 + duration: 2000 + loops: Animation.Infinite + } + } +} diff --git a/doc/src/snippets/declarative/qml-intro/number-animation2.qml b/doc/src/snippets/declarative/qml-intro/number-animation2.qml new file mode 100644 index 0000000..beb3114 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/number-animation2.qml @@ -0,0 +1,24 @@ +import Qt 4.7 + +Rectangle { + id: mainRec + width: 600 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + x: 200; y: 100 + width: 100; height: 100 + + // Animate a rotation + transform: Rotation { + origin.x: 50; origin.y: 50; axis {x:0; y:1; z:0} angle:0 + NumberAnimation on angle { + from: 0; to: 360; + duration: 3000; + loops: Animation.Infinite + } + } + } +} diff --git a/doc/src/snippets/declarative/qml-intro/rectangle.qml b/doc/src/snippets/declarative/qml-intro/rectangle.qml new file mode 100644 index 0000000..7235e9b --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/rectangle.qml @@ -0,0 +1,8 @@ +import Qt 4.7 + +// This is a comment. And below myRectangle is defined. +Rectangle { + id: myRectangle + width: 500 + height: 400 +} diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml new file mode 100644 index 0000000..125f99f --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml @@ -0,0 +1,23 @@ +import Qt 4.7 + +Rectangle { + id: mainRec + width: 600 + height: 400 + z: 0 + + Image { + id: image1 + source: "images/qt-logo.png" + x: 20; y: 20 ; z: 1 + width: 100; height: 100 + } + + Image { + id: image2 + source: "images/qt-logo.png" + width: 100; height: 100 + x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 + z: 2 + } +} diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml new file mode 100644 index 0000000..08c598b --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml @@ -0,0 +1,33 @@ +import Qt 4.7 + +Rectangle { + id: mainRec + width: 600 + height: 400 + z: 0 + +//! [adding a sequential animation] + Image { + id: image1 + source: "images/qt-logo.png" + width: 100; height: 100 + + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { + from: 20; to: 450; easing.type: "InOutQuad"; + duration: 2000 + } + PauseAnimation { duration: 500 } + } + } +//! [adding a sequential animation] + + Image { + id: image2 + source: "images/qt-logo.png" + width: 100; height: 100 + x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 + z: 2 + } +} diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml new file mode 100644 index 0000000..5e7b400 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml @@ -0,0 +1,46 @@ +Rectangle { + id: mainRec + width: 600 + height: 400 + z: 0 + + Image { + id: image2 + source: "images/qt-logo.png" + width: 100; height: 100 + x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 + z: 2 + } + + Image { + id: image1 + source: "images/qt-logo.png" + x: 20; y: 20 ; z: 1 + width: 100; height: 100 + + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { + from: 20; to: 450 + easing.type: "InOutQuad"; duration: 2000 + } + PauseAnimation { duration: 500 } + } + + SequentialAnimation on y { + loops: Animation.Infinite + NumberAnimation { + from: 20; to: 250 + easing.type: "InOutQuad"; duration: 2000 + } + PauseAnimation { duration: 500 } + } + + SequentialAnimation on scale { + loops: Animation.Infinite + NumberAnimation { from: 1; to: 0.5; duration: 1000 } + NumberAnimation { from: 0.5; to: 1; duration: 1000 } + PauseAnimation { duration: 500 } + } + } +} diff --git a/doc/src/snippets/declarative/qml-intro/states1.qml b/doc/src/snippets/declarative/qml-intro/states1.qml new file mode 100644 index 0000000..fcd3f53 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/states1.qml @@ -0,0 +1,52 @@ +import Qt 4.7 + +Rectangle { + id: mainRectangle + width: 600 + height: 400 + color: "black" + + Rectangle { + id: sky + width: 600 + height: 200 + y: 0 + color: "lightblue" + } + + Rectangle { + id: ground + width: 600; height: 200 + y: 200 + color: "green" + } + + MouseArea { + id: mousearea + anchors.fill: mainRectangle + } + + states: [ State { + name: "night" + when: mousearea.pressed == true + PropertyChanges { target: sky; color: "darkblue" } + PropertyChanges { target: ground; color: "black" } + }, + State { + name: "daylight" + when: mousearea.pressed == false + PropertyChanges { target: sky; color: "lightblue" } + PropertyChanges { target: ground; color: "green" } + } + ] + + transitions: [ Transition { + from: "daylight"; to: "night" + ColorAnimation { duration: 1000 } + }, + Transition { + from: "night"; to: "daylight" + ColorAnimation { duration: 500 } + } + ] +} diff --git a/doc/src/snippets/declarative/qml-intro/transformations1.qml b/doc/src/snippets/declarative/qml-intro/transformations1.qml new file mode 100644 index 0000000..1504729 --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/transformations1.qml @@ -0,0 +1,38 @@ +import Qt 4.7 + +Rectangle { + id: myWin + width: 500 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + width: 150; height: 150 + anchors.bottom: myWin.bottom + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 10 + + transform: Rotation { + origin.x: 75; origin.y: 75 + axis{ x: 0; y: 0; z:1 } angle: -90 + } + + } + + Text { + text: "

The Qt Logo -- taking it easy

" + anchors.bottom: image1.top + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 15 + + transform: [ + Scale { xScale: 1.5; yScale: 1.2 } , + + Rotation { + origin.x: 75; origin.y: 75 + axis{ x: 0; y: 0; z:1 } angle: -45 + } + ] + } +} -- cgit v0.12 From cd1b5d933575fb801ad3014f3d7fd7c268a362d1 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 17 Aug 2010 15:49:01 +0200 Subject: Doc: Reworded a brief description for clarity. Reviewed-by: Trust Me --- src/gui/graphicsview/qgraphicsitem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 0b3b164..882def7 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -10918,8 +10918,8 @@ QVariant QGraphicsSimpleTextItem::extension(const QVariant &variant) const /*! \class QGraphicsItemGroup - \brief The QGraphicsItemGroup class provides treating a group of items as - one. + \brief The QGraphicsItemGroup class provides a container that treats + a group of items as a single item. \since 4.2 \ingroup graphicsview-api -- cgit v0.12 From 1b802532809a430cb994e1c05bd5f62fdd2ab2b0 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 23 Aug 2010 13:43:06 +0200 Subject: Doc: Made more improvements to the QML documentation. --- doc/src/images/qml-borderimage-normal-image.png | Bin 0 -> 5282 bytes doc/src/images/qml-borderimage-scaled.png | Bin 0 -> 5580 bytes doc/src/images/qml-borderimage-tiled.png | Bin 0 -> 5889 bytes doc/src/snippets/declarative/animatedimage.qml | 61 +++++++++++++++ doc/src/snippets/declarative/borderimage.qml | 69 ----------------- .../declarative/borderimage/borderimage-scaled.qml | 81 ++++++++++++++++++++ .../declarative/borderimage/borderimage-tiled.qml | 81 ++++++++++++++++++++ .../declarative/borderimage/normal-image.qml | 77 +++++++++++++++++++ .../declarative/borderimage/pics/borderframe.png | Bin 0 -> 3411 bytes .../declarative/borderimage/pics/borderframe.svg | 82 +++++++++++++++++++++ doc/src/snippets/declarative/image.qml | 45 +++++++++++ doc/src/snippets/declarative/pics/qtlogo.png | Bin 0 -> 2991 bytes .../declarative/qml-documents/inline-component.qml | 57 ++++++++++++++ .../qml-documents/inline-text-component.qml | 55 ++++++++++++++ .../declarative/qml-documents/non-trivial.qml | 62 ++++++++++++++++ .../declarative/qml-documents/qmldocuments.qml | 66 +++++++++++++++++ doc/src/snippets/declarative/qmldocuments.qml | 66 ----------------- 17 files changed, 667 insertions(+), 135 deletions(-) create mode 100644 doc/src/images/qml-borderimage-normal-image.png create mode 100644 doc/src/images/qml-borderimage-scaled.png create mode 100644 doc/src/images/qml-borderimage-tiled.png create mode 100644 doc/src/snippets/declarative/animatedimage.qml delete mode 100644 doc/src/snippets/declarative/borderimage.qml create mode 100644 doc/src/snippets/declarative/borderimage/borderimage-scaled.qml create mode 100644 doc/src/snippets/declarative/borderimage/borderimage-tiled.qml create mode 100644 doc/src/snippets/declarative/borderimage/normal-image.qml create mode 100644 doc/src/snippets/declarative/borderimage/pics/borderframe.png create mode 100644 doc/src/snippets/declarative/borderimage/pics/borderframe.svg create mode 100644 doc/src/snippets/declarative/image.qml create mode 100644 doc/src/snippets/declarative/pics/qtlogo.png create mode 100644 doc/src/snippets/declarative/qml-documents/inline-component.qml create mode 100644 doc/src/snippets/declarative/qml-documents/inline-text-component.qml create mode 100644 doc/src/snippets/declarative/qml-documents/non-trivial.qml create mode 100644 doc/src/snippets/declarative/qml-documents/qmldocuments.qml delete mode 100644 doc/src/snippets/declarative/qmldocuments.qml diff --git a/doc/src/images/qml-borderimage-normal-image.png b/doc/src/images/qml-borderimage-normal-image.png new file mode 100644 index 0000000..ae7460a Binary files /dev/null and b/doc/src/images/qml-borderimage-normal-image.png differ diff --git a/doc/src/images/qml-borderimage-scaled.png b/doc/src/images/qml-borderimage-scaled.png new file mode 100644 index 0000000..8035c79 Binary files /dev/null and b/doc/src/images/qml-borderimage-scaled.png differ diff --git a/doc/src/images/qml-borderimage-tiled.png b/doc/src/images/qml-borderimage-tiled.png new file mode 100644 index 0000000..14883d0 Binary files /dev/null and b/doc/src/images/qml-borderimage-tiled.png differ diff --git a/doc/src/snippets/declarative/animatedimage.qml b/doc/src/snippets/declarative/animatedimage.qml new file mode 100644 index 0000000..bf5d611 --- /dev/null +++ b/doc/src/snippets/declarative/animatedimage.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +// This snippet should be turned into an example and put in +// examples/declarative/imageelements/animatedimage + +//! [document] +import Qt 4.7 + +Rectangle { + width: animation.width; height: animation.height + 8 + + AnimatedImage { id: animation; source: "animation.gif" } + + Rectangle { + property int frames: animation.frameCount + + width: 4; height: 8 + x: (animation.width - width) * animation.currentFrame / frames + y: animation.height + color: "red" + } +} +//! [document] diff --git a/doc/src/snippets/declarative/borderimage.qml b/doc/src/snippets/declarative/borderimage.qml deleted file mode 100644 index 447ad92..0000000 --- a/doc/src/snippets/declarative/borderimage.qml +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** 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: page - color: "white" - width: 520; height: 280 - - Row { - anchors.centerIn: parent - spacing: 50 -//! [0] -BorderImage { - width: 180; height: 180 - border { left: 30; top: 30; right: 30; bottom: 30 } - horizontalTileMode: BorderImage.Stretch - verticalTileMode: BorderImage.Stretch - source: "content/colors.png" -} - -BorderImage { - width: 180; height: 180 - border { left: 30; top: 30; right: 30; bottom: 30 } - horizontalTileMode: BorderImage.Round - verticalTileMode: BorderImage.Round - source: "content/colors.png" -} -//! [0] - } -} diff --git a/doc/src/snippets/declarative/borderimage/borderimage-scaled.qml b/doc/src/snippets/declarative/borderimage/borderimage-scaled.qml new file mode 100644 index 0000000..cc3ae2f --- /dev/null +++ b/doc/src/snippets/declarative/borderimage/borderimage-scaled.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + id: page + color: "white" + width: 180; height: 180 + +//! [scaled border image] +BorderImage { + width: 180; height: 180 + border { left: 30; top: 30; right: 30; bottom: 30 } + horizontalTileMode: BorderImage.Stretch + verticalTileMode: BorderImage.Stretch + source: "pics/borderframe.png" +} +//! [scaled border image] + + Rectangle { + x: 30; y: 0 + width: 1; height: 180 + color: "gray" + } + + Rectangle { + x: 150; y: 0 + width: 1; height: 180 + color: "gray" + } + + Rectangle { + x: 0; y: 30 + width: 180; height: 1 + color: "gray" + } + + Rectangle { + x: 0; y: 150 + width: 180; height: 1 + color: "gray" + } +} diff --git a/doc/src/snippets/declarative/borderimage/borderimage-tiled.qml b/doc/src/snippets/declarative/borderimage/borderimage-tiled.qml new file mode 100644 index 0000000..575e9fd --- /dev/null +++ b/doc/src/snippets/declarative/borderimage/borderimage-tiled.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + id: page + color: "white" + width: 180; height: 180 + +//! [scaled border image] +BorderImage { + width: 180; height: 180 + border { left: 30; top: 30; right: 30; bottom: 30 } + horizontalTileMode: BorderImage.Round + verticalTileMode: BorderImage.Round + source: "pics/borderframe.png" +} +//! [scaled border image] + + Rectangle { + x: 30; y: 0 + width: 1; height: 180 + color: "gray" + } + + Rectangle { + x: 150; y: 0 + width: 1; height: 180 + color: "gray" + } + + Rectangle { + x: 0; y: 30 + width: 180; height: 1 + color: "gray" + } + + Rectangle { + x: 0; y: 150 + width: 180; height: 1 + color: "gray" + } +} diff --git a/doc/src/snippets/declarative/borderimage/normal-image.qml b/doc/src/snippets/declarative/borderimage/normal-image.qml new file mode 100644 index 0000000..adac4f3 --- /dev/null +++ b/doc/src/snippets/declarative/borderimage/normal-image.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + id: page + color: "white" + width: 120; height: 120 + +//! [scaled border image] +Image { + source: "pics/borderframe.png" +} +//! [scaled border image] + + Rectangle { + x: 30; y: 0 + width: 1; height: 120 + color: "gray" + } + + Rectangle { + x: 90; y: 0 + width: 1; height: 120 + color: "gray" + } + + Rectangle { + x: 0; y: 30 + width: 200; height: 1 + color: "gray" + } + + Rectangle { + x: 0; y: 90 + width: 200; height: 1 + color: "gray" + } +} diff --git a/doc/src/snippets/declarative/borderimage/pics/borderframe.png b/doc/src/snippets/declarative/borderimage/pics/borderframe.png new file mode 100644 index 0000000..97a9452 Binary files /dev/null and b/doc/src/snippets/declarative/borderimage/pics/borderframe.png differ diff --git a/doc/src/snippets/declarative/borderimage/pics/borderframe.svg b/doc/src/snippets/declarative/borderimage/pics/borderframe.svg new file mode 100644 index 0000000..9286c82 --- /dev/null +++ b/doc/src/snippets/declarative/borderimage/pics/borderframe.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/doc/src/snippets/declarative/image.qml b/doc/src/snippets/declarative/image.qml new file mode 100644 index 0000000..b84cbcb --- /dev/null +++ b/doc/src/snippets/declarative/image.qml @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** 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 + +Image { + source: "qtlogo.png" +} diff --git a/doc/src/snippets/declarative/pics/qtlogo.png b/doc/src/snippets/declarative/pics/qtlogo.png new file mode 100644 index 0000000..4f68e16 Binary files /dev/null and b/doc/src/snippets/declarative/pics/qtlogo.png differ diff --git a/doc/src/snippets/declarative/qml-documents/inline-component.qml b/doc/src/snippets/declarative/qml-documents/inline-component.qml new file mode 100644 index 0000000..9233bbf --- /dev/null +++ b/doc/src/snippets/declarative/qml-documents/inline-component.qml @@ -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$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + width: 240; height: 320; + + ListView { + anchors.fill: parent + model: contactModel + delegate: Component { + Text { + text: modelData.firstName + " " + modelData.lastName + } + } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-documents/inline-text-component.qml b/doc/src/snippets/declarative/qml-documents/inline-text-component.qml new file mode 100644 index 0000000..83ba213 --- /dev/null +++ b/doc/src/snippets/declarative/qml-documents/inline-text-component.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + width: 240; height: 320; + + ListView { + anchors.fill: parent + model: contactModel + delegate: Text { + text: modelData.firstName + " " + modelData.lastName + } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-documents/non-trivial.qml b/doc/src/snippets/declarative/qml-documents/non-trivial.qml new file mode 100644 index 0000000..eb2364b --- /dev/null +++ b/doc/src/snippets/declarative/qml-documents/non-trivial.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + width: 240; height: 320; + + resources: [ + Component { + id: contactDelegate + Text { + text: modelData.firstName + " " + modelData.lastName + } + } + ] + + ListView { + anchors.fill: parent + model: contactModel + delegate: contactDelegate + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-documents/qmldocuments.qml b/doc/src/snippets/declarative/qml-documents/qmldocuments.qml new file mode 100644 index 0000000..cd0a1f7 --- /dev/null +++ b/doc/src/snippets/declarative/qml-documents/qmldocuments.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + property alias text: textItem.text + + width: 100; height: 30 + border.width: 1 + radius: 5 + smooth: true + + gradient: Gradient { + GradientStop { position: 0.0; color: "darkGray" } + GradientStop { position: 0.5; color: "black" } + GradientStop { position: 1.0; color: "darkGray" } + } + + Text { + id: textItem + anchors.centerIn: parent + font.pointSize: 20 + color: "white" + } + +} +//! [document] diff --git a/doc/src/snippets/declarative/qmldocuments.qml b/doc/src/snippets/declarative/qmldocuments.qml deleted file mode 100644 index c19a658..0000000 --- a/doc/src/snippets/declarative/qmldocuments.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** 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:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -//![0] -import Qt 4.7 - -Rectangle { - property alias text: textItem.text - - width: 100; height: 30 - border.width: 1 - radius: 5 - smooth: true - - gradient: Gradient { - GradientStop { position: 0.0; color: "darkGray" } - GradientStop { position: 0.5; color: "black" } - GradientStop { position: 1.0; color: "darkGray" } - } - - Text { - id: textItem - anchors.centerIn: parent - font.pointSize: 20 - color: "white" - } - -} -//![0] -- cgit v0.12 From bdabeaf6e35d6b7602e944ee78e59c57313b80cd Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 23 Aug 2010 13:45:43 +0200 Subject: Doc: Updated licenses to the three clause BSD license. --- doc/src/snippets/declarative/anchorchanges.qml | 53 ++++++++++---------- doc/src/snippets/declarative/behavior.qml | 57 +++++++++++----------- doc/src/snippets/declarative/coloranimation.qml | 57 +++++++++++----------- doc/src/snippets/declarative/component.qml | 57 +++++++++++----------- doc/src/snippets/declarative/listmodel-modify.qml | 53 ++++++++++---------- doc/src/snippets/declarative/listmodel-nested.qml | 53 ++++++++++---------- doc/src/snippets/declarative/listmodel-simple.qml | 53 ++++++++++---------- doc/src/snippets/declarative/numberanimation.qml | 57 +++++++++++----------- doc/src/snippets/declarative/parallelanimation.qml | 57 +++++++++++----------- doc/src/snippets/declarative/parentanimation.qml | 53 ++++++++++---------- doc/src/snippets/declarative/parentchange.qml | 53 ++++++++++---------- doc/src/snippets/declarative/propertyaction.qml | 53 ++++++++++---------- doc/src/snippets/declarative/propertyanimation.qml | 53 ++++++++++---------- doc/src/snippets/declarative/propertychanges.qml | 53 ++++++++++---------- doc/src/snippets/declarative/qtobject.qml | 57 +++++++++++----------- doc/src/snippets/declarative/rotationanimation.qml | 53 ++++++++++---------- .../snippets/declarative/sequentialanimation.qml | 57 +++++++++++----------- doc/src/snippets/declarative/state-when.qml | 57 +++++++++++----------- doc/src/snippets/declarative/state.qml | 57 +++++++++++----------- doc/src/snippets/declarative/states.qml | 57 +++++++++++----------- doc/src/snippets/declarative/systempalette.qml | 57 +++++++++++----------- .../snippets/declarative/transition-from-to.qml | 57 +++++++++++----------- .../snippets/declarative/transition-reversible.qml | 53 ++++++++++---------- doc/src/snippets/declarative/transition.qml | 57 +++++++++++----------- doc/src/snippets/declarative/visualdatamodel.qml | 53 ++++++++++---------- .../declarative/visualdatamodel_rootindex/main.cpp | 57 +++++++++++----------- 26 files changed, 704 insertions(+), 730 deletions(-) diff --git a/doc/src/snippets/declarative/anchorchanges.qml b/doc/src/snippets/declarative/anchorchanges.qml index 993618b..3f11421 100644 --- a/doc/src/snippets/declarative/anchorchanges.qml +++ b/doc/src/snippets/declarative/anchorchanges.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/behavior.qml b/doc/src/snippets/declarative/behavior.qml index 420dfc4..4260e38 100644 --- a/doc/src/snippets/declarative/behavior.qml +++ b/doc/src/snippets/declarative/behavior.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/coloranimation.qml b/doc/src/snippets/declarative/coloranimation.qml index 4e35f22..7e8e9fe 100644 --- a/doc/src/snippets/declarative/coloranimation.qml +++ b/doc/src/snippets/declarative/coloranimation.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/component.qml b/doc/src/snippets/declarative/component.qml index 09c4aa2..a0ab28c 100644 --- a/doc/src/snippets/declarative/component.qml +++ b/doc/src/snippets/declarative/component.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/listmodel-modify.qml b/doc/src/snippets/declarative/listmodel-modify.qml index 03fb314..8f381f7 100644 --- a/doc/src/snippets/declarative/listmodel-modify.qml +++ b/doc/src/snippets/declarative/listmodel-modify.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/listmodel-nested.qml b/doc/src/snippets/declarative/listmodel-nested.qml index 4ae43ff..3d876a3 100644 --- a/doc/src/snippets/declarative/listmodel-nested.qml +++ b/doc/src/snippets/declarative/listmodel-nested.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/listmodel-simple.qml b/doc/src/snippets/declarative/listmodel-simple.qml index 00b8cb0..382fd13 100644 --- a/doc/src/snippets/declarative/listmodel-simple.qml +++ b/doc/src/snippets/declarative/listmodel-simple.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/numberanimation.qml b/doc/src/snippets/declarative/numberanimation.qml index 57d23b1..0a1d5a4 100644 --- a/doc/src/snippets/declarative/numberanimation.qml +++ b/doc/src/snippets/declarative/numberanimation.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/parallelanimation.qml b/doc/src/snippets/declarative/parallelanimation.qml index d823b4f..a8e80cd 100644 --- a/doc/src/snippets/declarative/parallelanimation.qml +++ b/doc/src/snippets/declarative/parallelanimation.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/parentanimation.qml b/doc/src/snippets/declarative/parentanimation.qml index 7f11a43..506eff4 100644 --- a/doc/src/snippets/declarative/parentanimation.qml +++ b/doc/src/snippets/declarative/parentanimation.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/parentchange.qml b/doc/src/snippets/declarative/parentchange.qml index ea50832..c704f12 100644 --- a/doc/src/snippets/declarative/parentchange.qml +++ b/doc/src/snippets/declarative/parentchange.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/propertyaction.qml b/doc/src/snippets/declarative/propertyaction.qml index 1a15469..ff299f1 100644 --- a/doc/src/snippets/declarative/propertyaction.qml +++ b/doc/src/snippets/declarative/propertyaction.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/propertyanimation.qml b/doc/src/snippets/declarative/propertyanimation.qml index 059cde5..55ea9f6 100644 --- a/doc/src/snippets/declarative/propertyanimation.qml +++ b/doc/src/snippets/declarative/propertyanimation.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/propertychanges.qml b/doc/src/snippets/declarative/propertychanges.qml index 9f119bf..5959e54 100644 --- a/doc/src/snippets/declarative/propertychanges.qml +++ b/doc/src/snippets/declarative/propertychanges.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/qtobject.qml b/doc/src/snippets/declarative/qtobject.qml index 970fa16..bd48390 100644 --- a/doc/src/snippets/declarative/qtobject.qml +++ b/doc/src/snippets/declarative/qtobject.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/rotationanimation.qml b/doc/src/snippets/declarative/rotationanimation.qml index b56cb3f..a0f6354 100644 --- a/doc/src/snippets/declarative/rotationanimation.qml +++ b/doc/src/snippets/declarative/rotationanimation.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/sequentialanimation.qml b/doc/src/snippets/declarative/sequentialanimation.qml index a15f7f3..bf73be5 100644 --- a/doc/src/snippets/declarative/sequentialanimation.qml +++ b/doc/src/snippets/declarative/sequentialanimation.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/state-when.qml b/doc/src/snippets/declarative/state-when.qml index 6d3bb75..8e38f82 100644 --- a/doc/src/snippets/declarative/state-when.qml +++ b/doc/src/snippets/declarative/state-when.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/state.qml b/doc/src/snippets/declarative/state.qml index ce2653b..5f43947 100644 --- a/doc/src/snippets/declarative/state.qml +++ b/doc/src/snippets/declarative/state.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/states.qml b/doc/src/snippets/declarative/states.qml index 127e3a7..1f9dc2c 100644 --- a/doc/src/snippets/declarative/states.qml +++ b/doc/src/snippets/declarative/states.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/systempalette.qml b/doc/src/snippets/declarative/systempalette.qml index 98b333e..cf5c902 100644 --- a/doc/src/snippets/declarative/systempalette.qml +++ b/doc/src/snippets/declarative/systempalette.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/transition-from-to.qml b/doc/src/snippets/declarative/transition-from-to.qml index 615de17..09949fc 100644 --- a/doc/src/snippets/declarative/transition-from-to.qml +++ b/doc/src/snippets/declarative/transition-from-to.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/transition-reversible.qml b/doc/src/snippets/declarative/transition-reversible.qml index 8a7b69a..367ad49 100644 --- a/doc/src/snippets/declarative/transition-reversible.qml +++ b/doc/src/snippets/declarative/transition-reversible.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/transition.qml b/doc/src/snippets/declarative/transition.qml index 098d509..a79e483 100644 --- a/doc/src/snippets/declarative/transition.qml +++ b/doc/src/snippets/declarative/transition.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/visualdatamodel.qml b/doc/src/snippets/declarative/visualdatamodel.qml index cdde513..231e4dd 100644 --- a/doc/src/snippets/declarative/visualdatamodel.qml +++ b/doc/src/snippets/declarative/visualdatamodel.qml @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ diff --git a/doc/src/snippets/declarative/visualdatamodel_rootindex/main.cpp b/doc/src/snippets/declarative/visualdatamodel_rootindex/main.cpp index 174adee..8d8004d 100644 --- a/doc/src/snippets/declarative/visualdatamodel_rootindex/main.cpp +++ b/doc/src/snippets/declarative/visualdatamodel_rootindex/main.cpp @@ -6,35 +6,34 @@ ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** +** $QT_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$ ** ****************************************************************************/ -- cgit v0.12 From 6c9e0053d86311741d3e737882cdb6ff882d89ef Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 23 Aug 2010 14:59:25 +0200 Subject: Doc: Updated QML snippets. --- doc/src/snippets/declarative/borderimage/borderimage-tiled.qml | 8 ++++---- doc/src/snippets/declarative/image.qml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/src/snippets/declarative/borderimage/borderimage-tiled.qml b/doc/src/snippets/declarative/borderimage/borderimage-tiled.qml index 575e9fd..e792814 100644 --- a/doc/src/snippets/declarative/borderimage/borderimage-tiled.qml +++ b/doc/src/snippets/declarative/borderimage/borderimage-tiled.qml @@ -45,15 +45,15 @@ Rectangle { color: "white" width: 180; height: 180 -//! [scaled border image] +//! [tiled border image] BorderImage { width: 180; height: 180 border { left: 30; top: 30; right: 30; bottom: 30 } - horizontalTileMode: BorderImage.Round - verticalTileMode: BorderImage.Round + horizontalTileMode: BorderImage.Repeat + verticalTileMode: BorderImage.Repeat source: "pics/borderframe.png" } -//! [scaled border image] +//! [tiled border image] Rectangle { x: 30; y: 0 diff --git a/doc/src/snippets/declarative/image.qml b/doc/src/snippets/declarative/image.qml index b84cbcb..b0ae032 100644 --- a/doc/src/snippets/declarative/image.qml +++ b/doc/src/snippets/declarative/image.qml @@ -41,5 +41,5 @@ import Qt 4.7 Image { - source: "qtlogo.png" + source: "pics/qtlogo.png" } -- cgit v0.12 From 338c408970212211228882e0adc305add694a2d6 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 23 Aug 2010 15:00:09 +0200 Subject: Doc: Used snippets for the Beginning QML document. License update. --- doc/src/declarative/qml-intro.qdoc | 26 +++++++------- .../snippets/declarative/qml-intro/anchors1.qml | 42 ++++++++++++++++++++++ .../snippets/declarative/qml-intro/anchors2.qml | 42 ++++++++++++++++++++++ .../snippets/declarative/qml-intro/anchors3.qml | 40 +++++++++++++++++++++ .../declarative/qml-intro/basic-syntax.qml | 40 +++++++++++++++++++++ .../declarative/qml-intro/hello-world1.qml | 42 ++++++++++++++++++++++ .../declarative/qml-intro/hello-world2.qml | 40 +++++++++++++++++++++ .../declarative/qml-intro/hello-world3.qml | 40 +++++++++++++++++++++ .../declarative/qml-intro/hello-world4.qml | 40 +++++++++++++++++++++ .../declarative/qml-intro/hello-world5.qml | 42 ++++++++++++++++++++++ .../declarative/qml-intro/number-animation1.qml | 42 ++++++++++++++++++++++ .../declarative/qml-intro/number-animation2.qml | 42 ++++++++++++++++++++++ .../snippets/declarative/qml-intro/rectangle.qml | 42 ++++++++++++++++++++++ .../qml-intro/sequential-animation1.qml | 42 ++++++++++++++++++++++ .../qml-intro/sequential-animation2.qml | 40 +++++++++++++++++++++ .../qml-intro/sequential-animation3.qml | 42 ++++++++++++++++++++++ doc/src/snippets/declarative/qml-intro/states1.qml | 42 ++++++++++++++++++++++ .../declarative/qml-intro/transformations1.qml | 42 ++++++++++++++++++++++ 18 files changed, 715 insertions(+), 13 deletions(-) diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc index 13c8e4f..63d6825 100644 --- a/doc/src/declarative/qml-intro.qdoc +++ b/doc/src/declarative/qml-intro.qdoc @@ -47,7 +47,7 @@ Javascript is easier to learn than C++ and can be embedded into the QML files or imported from a separate file. \bold{In QML the types of various 'objects' are referred to as \l {QML -Elements}{ elements}}. +Elements}{elements}}. An element usually has various \e properties that help define the element. For example, if we created an element called Circle then the radius of the circle @@ -56,7 +56,7 @@ would be a property. \section1 A First Look -The basic syntax of an \l {QML Elements}{element} is +The basic syntax of an \l{QML Elements}{element} is \snippet doc/src/snippets/declarative/qml-intro/basic-syntax.qml basic syntax @@ -82,7 +82,7 @@ want a rectangle that is 500 pixels by 400 pixels in the x and y directions We can implement this \l Rectangle with these properties this way -\quotefile doc/src/snippets/declarative/qml-intro/rectangle.qml +\snippet doc/src/snippets/declarative/qml-intro/rectangle.qml document This is a valid QML script. To run it, copy it and save it to a file, say myexample.qml, and on the command line run the following command: @@ -113,7 +113,7 @@ Text is handled by a different element called \l Text. We need to create a property to "Hello World!". So to set the text to "Hello world" and the background colour to light gray, -\quotefile doc/src/snippets/declarative/qml-intro/hello-world1.qml +\snippet doc/src/snippets/declarative/qml-intro/hello-world1.qml document \section1 Hello World Again @@ -172,7 +172,7 @@ text, also make it 150 by 150 pixels in size, Adding the Hello World example, with the text and the image example we can write a simple piece of QML that starts to look a bit better. -\quotefile doc/src/snippets/declarative/qml-intro/hello-world5.qml +\snippet doc/src/snippets/declarative/qml-intro/hello-world5.qml document The result is still quite simple @@ -203,7 +203,7 @@ If we want to position an image at the bottom of the rectangle it is inside. I have to specify that the bottom of the image is also at the bottom of the rectangle -\quotefile doc/src/snippets/declarative/qml-intro/anchors1.qml +\snippet doc/src/snippets/declarative/qml-intro/anchors1.qml document This places the logo at the bottom left of the window. @@ -222,7 +222,7 @@ the bottomMargin property is used. So the new actions for the script are Encoded into QML the script becomes -\quotefile doc/src/snippets/declarative/qml-intro/anchors2.qml +\snippet doc/src/snippets/declarative/qml-intro/anchors2.qml document Run this and resize the window. You will see that now the position of the image adjusts during the resize. @@ -282,7 +282,7 @@ vertically by a factor of 1.5 and by 1.2 horizontally. Using the example above as the basis for this we have, -\quotefile doc/src/snippets/declarative/qml-intro/transformations1.qml +\snippet doc/src/snippets/declarative/qml-intro/transformations1.qml document The code block in \c image1 starting with \c transform specifies that the \l {Item::transform}{transform} property will be a Rotation through -90 @@ -320,7 +320,7 @@ from \l Item. The rotation property is a real number that specifies the angle in a clockwise direction for the rotation of the object. Here is the code for our animated rotating image. -\quotefile doc/src/snippets/declarative/qml-intro/number-animation1.qml +\snippet doc/src/snippets/declarative/qml-intro/number-animation1.qml document The \c {transformOrigin: Item.Center} is redundant since this is the default axis of rotation anyway. But if you change \c Center to \c BottomRight you @@ -333,7 +333,7 @@ combination. For example, if the task had been to animate the rotation about the y-axis passing through the center of the image then the following code would do it. -\quotefile doc/src/snippets/declarative/qml-intro/number-animation2.qml +\snippet doc/src/snippets/declarative/qml-intro/number-animation2.qml document Here there is a rectangle 600 by 400 pixels. Placed within that rectangle is an image 100 by 100 pixels. It is rotated about the center of the image @@ -362,7 +362,7 @@ will be animating the position and the size of the image. First create two images -\quotefile doc/src/snippets/declarative/qml-intro/sequential-animation1.qml +\snippet doc/src/snippets/declarative/qml-intro/sequential-animation1.qml document We will add to 'image1' a SequentialAnimation from x = 20 to the target of x = 450. The 'from' values will be used because we will be repeating the @@ -390,7 +390,7 @@ and image1 to 1 and image2 to 2 then image2 will be in the foreground and image1 in the background. When image1 passes image2 it will pass behind it. The completed code looks like -\quotefile doc/src/snippets/declarative/qml-intro/sequential-animation3.qml +\snippet doc/src/snippets/declarative/qml-intro/sequential-animation3.qml document The \c {easing.type} has many options, expressed as a string. It specifies the kind of equation that describes the acceleration of the property value, not @@ -468,7 +468,7 @@ will be the default state. We will just go to 'night' by clicking and holding the left mouse button down, releasing the mouse button will reverse the process -\quotefile doc/src/snippets/declarative/qml-intro/states1.qml +\snippet doc/src/snippets/declarative/qml-intro/states1.qml document Several new things appear in this sample. Firstly, we use a \l MouseArea element to detect mouse clicks in the \e mainRectangle. Secondly, we use diff --git a/doc/src/snippets/declarative/qml-intro/anchors1.qml b/doc/src/snippets/declarative/qml-intro/anchors1.qml index 320d0e7..09ef3b2 100644 --- a/doc/src/snippets/declarative/qml-intro/anchors1.qml +++ b/doc/src/snippets/declarative/qml-intro/anchors1.qml @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] import Qt 4.7 Rectangle { @@ -12,3 +53,4 @@ Rectangle { anchors.bottom: myWin.bottom } } +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/anchors2.qml b/doc/src/snippets/declarative/qml-intro/anchors2.qml index bb9ed75..ef0ec1f 100644 --- a/doc/src/snippets/declarative/qml-intro/anchors2.qml +++ b/doc/src/snippets/declarative/qml-intro/anchors2.qml @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] import Qt 4.7 Rectangle { @@ -14,3 +55,4 @@ Rectangle { anchors.bottomMargin: 10 } } +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/anchors3.qml b/doc/src/snippets/declarative/qml-intro/anchors3.qml index 99d2ceb..008ad1a 100644 --- a/doc/src/snippets/declarative/qml-intro/anchors3.qml +++ b/doc/src/snippets/declarative/qml-intro/anchors3.qml @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** 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 { diff --git a/doc/src/snippets/declarative/qml-intro/basic-syntax.qml b/doc/src/snippets/declarative/qml-intro/basic-syntax.qml index b241500..686a927 100644 --- a/doc/src/snippets/declarative/qml-intro/basic-syntax.qml +++ b/doc/src/snippets/declarative/qml-intro/basic-syntax.qml @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + // Note: this file is not intended to be run. //! [basic syntax] diff --git a/doc/src/snippets/declarative/qml-intro/hello-world1.qml b/doc/src/snippets/declarative/qml-intro/hello-world1.qml index 244175c..9b91049 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world1.qml +++ b/doc/src/snippets/declarative/qml-intro/hello-world1.qml @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] import Qt 4.7 Rectangle { @@ -9,3 +50,4 @@ Rectangle { color: "lightgray" } +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/hello-world2.qml b/doc/src/snippets/declarative/qml-intro/hello-world2.qml index 73b2f8c..ddc1017 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world2.qml +++ b/doc/src/snippets/declarative/qml-intro/hello-world2.qml @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** 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 { diff --git a/doc/src/snippets/declarative/qml-intro/hello-world3.qml b/doc/src/snippets/declarative/qml-intro/hello-world3.qml index 112f775..f1102c2 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world3.qml +++ b/doc/src/snippets/declarative/qml-intro/hello-world3.qml @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** 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 { diff --git a/doc/src/snippets/declarative/qml-intro/hello-world4.qml b/doc/src/snippets/declarative/qml-intro/hello-world4.qml index c97334e..c18fe15 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world4.qml +++ b/doc/src/snippets/declarative/qml-intro/hello-world4.qml @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** 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 { diff --git a/doc/src/snippets/declarative/qml-intro/hello-world5.qml b/doc/src/snippets/declarative/qml-intro/hello-world5.qml index 74a612a..bde8dc3 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world5.qml +++ b/doc/src/snippets/declarative/qml-intro/hello-world5.qml @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] import Qt 4.7 Rectangle { @@ -21,3 +62,4 @@ Rectangle { color: "lightgray" } +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/number-animation1.qml b/doc/src/snippets/declarative/qml-intro/number-animation1.qml index d80a8dc..8d8d747 100644 --- a/doc/src/snippets/declarative/qml-intro/number-animation1.qml +++ b/doc/src/snippets/declarative/qml-intro/number-animation1.qml @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] import Qt 4.7 Rectangle { @@ -20,3 +61,4 @@ Rectangle { } } } +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/number-animation2.qml b/doc/src/snippets/declarative/qml-intro/number-animation2.qml index beb3114..d556c21 100644 --- a/doc/src/snippets/declarative/qml-intro/number-animation2.qml +++ b/doc/src/snippets/declarative/qml-intro/number-animation2.qml @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] import Qt 4.7 Rectangle { @@ -22,3 +63,4 @@ Rectangle { } } } +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/rectangle.qml b/doc/src/snippets/declarative/qml-intro/rectangle.qml index 7235e9b..0078813 100644 --- a/doc/src/snippets/declarative/qml-intro/rectangle.qml +++ b/doc/src/snippets/declarative/qml-intro/rectangle.qml @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] import Qt 4.7 // This is a comment. And below myRectangle is defined. @@ -6,3 +47,4 @@ Rectangle { width: 500 height: 400 } +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml index 125f99f..e68de20 100644 --- a/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] import Qt 4.7 Rectangle { @@ -21,3 +62,4 @@ Rectangle { z: 2 } } +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml index 08c598b..31835a1 100644 --- a/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** 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 { diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml index 5e7b400..f83a966 100644 --- a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] Rectangle { id: mainRec width: 600 @@ -44,3 +85,4 @@ Rectangle { } } } +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/states1.qml b/doc/src/snippets/declarative/qml-intro/states1.qml index fcd3f53..9619eb7 100644 --- a/doc/src/snippets/declarative/qml-intro/states1.qml +++ b/doc/src/snippets/declarative/qml-intro/states1.qml @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] import Qt 4.7 Rectangle { @@ -50,3 +91,4 @@ Rectangle { } ] } +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/transformations1.qml b/doc/src/snippets/declarative/qml-intro/transformations1.qml index 1504729..af39e69 100644 --- a/doc/src/snippets/declarative/qml-intro/transformations1.qml +++ b/doc/src/snippets/declarative/qml-intro/transformations1.qml @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] import Qt 4.7 Rectangle { @@ -36,3 +77,4 @@ Rectangle { ] } } +//! [document] -- cgit v0.12 From ee7e17bb48c7f6ca0c74f1df3e146e99f56f2060 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 23 Aug 2010 15:01:38 +0200 Subject: Doc: Started to reorganize the QML documentation structure. --- doc/src/declarative/declarativeui.qdoc | 97 +++++++++++++++++++++++----------- 1 file changed, 67 insertions(+), 30 deletions(-) diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index ed8b734..506d774 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -32,28 +32,36 @@ \brief Qt Quick provides a declarative framework for building highly dynamic, custom user interfaces. -Qt Quick provides a declarative framework for building highly dynamic, -custom user interfaces from a rich set of \l{QML Elements}{QML elements}. -Qt Quick helps programmers and designers collaborate to -build the fluid user interfaces that are becoming common in portable -consumer devices, such as mobile phones, media players, set-top boxes -and netbooks. Qt Quick consists of the QtDeclarative C++ module, QML, and -the integration of both of these into the Qt Creator IDE. Using the QtDeclarative -C++ module, you can load and interact with QML files from your Qt application. - -QML is an extension to \l{About JavaScript}{JavaScript}, that provides -a mechanism to declaratively build an object tree of -\l{QML Elements}{QML elements}. QML improves the integration between -JavaScript and Qt's existing QObject-based type system, adds support for -automatic \l{Property Binding}{property bindings} and provides +\section1 Introduction + +Qt Quick is a collection of technologies that are designed to help +developers create the kind of intuitive, modern-looking, fluid user +interfaces that are increasingly used on mobile phones, media players, +set-top boxes and other portable devices. + +Qt Quick consists of a rich set of user interface elements, a declarative +language for describing user interfaces and a language runtime. A collection +of C++ APIs is used to integrate these high level features with classic +Qt applications. + +\section2 QML, Elements and the QtDeclarative Module + +User interfaces and their behavior are described using QML, an extension to +\l{About JavaScript}{JavaScript} that lets developers and designers +use a declarative syntax to specify each user interface in terms of +\l{QML Elements}{QML elements}. These elements are a sophisticated set of +graphical and behavioral building blocks that can be combined together in +\l{QML Documents}{QML documents} to build components ranging in complexity +from simple buttons and sliders, to complete Internet-enabled applications. + +QML improves the integration between JavaScript and Qt's existing +QObject-based type system, adds support for automatic +\l{Property Binding}{property bindings} and provides \l{Network Transparency}{network transparency} at the language level. -The \l{QML Elements}{QML elements} are a sophisticated set of -graphical and behavioral building blocks. These different elements -are combined together in \l{QML Documents}{QML documents} to build -components ranging in complexity from simple buttons and sliders, to -complete Internet-enabled applications like a photo browser for the -popular \l{http://www.flickr.com}{Flickr} photo-sharing site. +The QtDeclarative module implements the interface between the QML language +and the elements available to it. It also provides a C++ API that can be +used to load and interact with QML files from within Qt applications. Qt Quick builds on \l{QML for Qt programmers}{Qt's existing strengths}. QML can be be used to incrementally extend an existing application or @@ -65,33 +73,53 @@ Module. \list \o \l{Introduction to the QML language} -\o \l{QML Tutorial}{Tutorial: 'Hello World'} -\o \l{QML Advanced Tutorial}{Tutorial: 'Same Game'} -\o \l{QML Examples and Demos} \o \l{QML for Qt Programmers} \o \l{Getting Started Programming with QML} \o \l{Beginning Qt Quick} \endlist -\section1 Core QML Features +\list +\o \l{QML Tutorial}{Tutorial: "Hello World"} +\o \l{QML Advanced Tutorial}{Tutorial: "Same Game"} +\o \l{QML Examples and Demos} +\endlist + +\section1 QML Concepts + \list \o \l{QML Documents} \o \l{Property Binding} -\o \l{Network Transparency} \o \l{QML Scope} -\o \l{Integrating JavaScript} -\o \l{Data Models} +\o \l{QML Modules} \o \l{Anchor-based Layout in QML} +\endlist + +\section1 User Interaction + +\list +\o \l{Keyboard Focus in QML} \o \l{QML States} \o \l{QML Animation} -\o \l{Keyboard Focus in QML} -\o \l{QML Modules} +\endlist + +\section1 Handling Data + +\list +\o \l{Data Models} +\o \l{Network Transparency} +\endlist + +\section1 Architecture + +\list +\o \l{Qt Declarative UI Runtime} +\o \l{Integrating JavaScript} \o \l{Extending types from QML} \o \l{Dynamic Object Management in QML} -\o \l{Qt Declarative UI Runtime} \endlist \section1 Using QML with C++ + \list \o \l{Using QML in C++ Applications} \o \l{Integrating QML with existing Qt UI code} @@ -100,6 +128,7 @@ Module. \endlist \section1 Reference + \list \o \l{QML Elements} \o \l{QML Global Object} @@ -111,4 +140,12 @@ Module. \o \l{QML Performance} \o \l{QML Coding Conventions} \endlist + +\section1 Online Examples + +\list +\o Forum Nokia: +\l{http://wiki.forum.nokia.com/index.php/Qt_Quick_examples_for_porting}{Qt Quick +examples for porting} +\endlist */ -- cgit v0.12 From 74833a2377a7570a910d970c272b846043ae3206 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 23 Aug 2010 15:03:31 +0200 Subject: Doc: Moved the inline code into snippet files. --- doc/src/declarative/qdeclarativedocument.qdoc | 67 ++++----------------------- 1 file changed, 10 insertions(+), 57 deletions(-) diff --git a/doc/src/declarative/qdeclarativedocument.qdoc b/doc/src/declarative/qdeclarativedocument.qdoc index 068297a..4aed63f 100644 --- a/doc/src/declarative/qdeclarativedocument.qdoc +++ b/doc/src/declarative/qdeclarativedocument.qdoc @@ -28,34 +28,17 @@ /*! \page qdeclarativedocuments.html \title QML Documents +\brief A description of QML documents and the kind of content they contain. -A QML document is a block of QML source code. QML documents generally correspond to files -stored on a disk or network resource, but can also be constructed directly from text data. +\section1 Introduction -Here is a simple QML document: +A QML document is a block of QML source code. QML documents generally correspond to files +stored on a disk or at a location on a network, but they can also be constructed directly +from text data. -\code -import Qt 4.7 +Here is a simple QML document: -Rectangle { - width: 240; height: 320; - - resources: [ - Component { - id: contactDelegate - Text { - text: modelData.firstName + " " + modelData.lastName - } - } - ] - - ListView { - anchors.fill: parent - model: contactModel - delegate: contactDelegate - } -} -\endcode +\snippet doc/src/snippets/declarative/qml-documents/non-trivial.qml document QML documents are always encoded in UTF-8 format. @@ -96,7 +79,7 @@ Each instance is created with a different value for its \c text property: \o application.qml \row -\o \snippet doc/src/snippets/declarative/qmldocuments.qml 0 +\o \snippet doc/src/snippets/declarative/qmldocuments.qml document \o \qml import Qt 4.7 @@ -153,39 +136,9 @@ These final two examples are behaviorally identical to the original document. \table \row \o -\code -import Qt 4.7 - -Rectangle { - width: 240; height: 320; - - ListView { - anchors.fill: parent - model: contactModel - delegate: Component { - Text { - text: modelData.firstName + " " + modelData.lastName - } - } - } -} -\endcode +\snippet doc/src/snippets/declarative/qml-documents/inline-component.qml document \o -\code -import Qt 4.7 - -Rectangle { - width: 240; height: 320; - - ListView { - anchors.fill: parent - model: contactModel - delegate: Text { - text: modelData.firstName + " " + modelData.lastName - } - } -} -\endcode +\snippet doc/src/snippets/declarative/qml-documents/inline-text-component.qml document \endtable \sa QDeclarativeComponent -- cgit v0.12 From 23737d8df57ee77127c4b891e25339a3f73d0fca Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 23 Aug 2010 15:05:48 +0200 Subject: Doc: Started to improve QML reference documentation. --- .../declarative/borderimage/normal-image.qml | 4 +- .../graphicsitems/qdeclarativeanimatedimage.cpp | 57 +++++------ .../graphicsitems/qdeclarativeborderimage.cpp | 108 ++++++++++++++++++--- .../graphicsitems/qdeclarativeimage.cpp | 46 +++++---- 4 files changed, 152 insertions(+), 63 deletions(-) diff --git a/doc/src/snippets/declarative/borderimage/normal-image.qml b/doc/src/snippets/declarative/borderimage/normal-image.qml index adac4f3..76ec6e2 100644 --- a/doc/src/snippets/declarative/borderimage/normal-image.qml +++ b/doc/src/snippets/declarative/borderimage/normal-image.qml @@ -45,11 +45,11 @@ Rectangle { color: "white" width: 120; height: 120 -//! [scaled border image] +//! [normal image] Image { source: "pics/borderframe.png" } -//! [scaled border image] +//! [normal image] Rectangle { x: 30; y: 0 diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index e0a2149..16d1777 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -63,35 +63,32 @@ QT_BEGIN_NAMESPACE \inherits Image \since 4.7 \ingroup basic-visual-elements - - The AnimatedImage element provides for playing animations stored as images containing a series of frames, - such as GIF files. - + + The AnimatedImage element extends the features of the \l Image element, providing + a way to play animations stored as images containing a series of frames, + such as those stored in GIF files. + + Information about the current frame and totla length of the animation can be + obtained using the \l currentFrame and \l frameCount properties. You can + start, pause and stop the animation by changing the values of the \l playing + and \l paused properties. + The full list of supported formats can be determined with QMovie::supportedFormats(). - \table - \row - \o \image animatedimageitem.gif - \o - \qml - import Qt 4.7 + \section1 Example Usage - Rectangle { - width: animation.width; height: animation.height + 8 + \beginfloatleft + \image animatedimageitem.gif + \endfloat - AnimatedImage { id: animation; source: "animation.gif" } + The following QML shows how to display an animated image and obtain information + about its state, such as the current frame and total number of frames. + The result is an animated image with a simple progress indicator underneath it. - Rectangle { - property int frames: animation.frameCount + \clearfloat + \snippet doc/src/snippets/declarative/animatedimage.qml document - width: 4; height: 8 - x: (animation.width - width) * animation.currentFrame / frames - y: animation.height - color: "red" - } - } - \endqml - \endtable + \sa BorderImage, Image */ QDeclarativeAnimatedImage::QDeclarativeAnimatedImage(QDeclarativeItem *parent) @@ -109,7 +106,8 @@ QDeclarativeAnimatedImage::~QDeclarativeAnimatedImage() \qmlproperty bool AnimatedImage::paused This property holds whether the animated image is paused. - Defaults to false, and can be set to true when you want to pause. + By default, this property is false. Set it to true when you want to pause + the animation. */ bool QDeclarativeAnimatedImage::isPaused() const { @@ -133,7 +131,8 @@ void QDeclarativeAnimatedImage::setPaused(bool pause) \qmlproperty bool AnimatedImage::playing This property holds whether the animated image is playing. - Defaults to true, so as to start playing immediately. + By defaults, this property is true, meaning that the animation + will start playing immediately. */ bool QDeclarativeAnimatedImage::isPlaying() const { @@ -161,9 +160,11 @@ void QDeclarativeAnimatedImage::setPlaying(bool play) \qmlproperty int AnimatedImage::currentFrame \qmlproperty int AnimatedImage::frameCount - currentFrame is the frame that is currently visible. Watching when this changes can - allow other things to animate at the same time as the image. frameCount is the number - of frames in the animation. For some animation formats, frameCount is unknown and set to zero. + currentFrame is the frame that is currently visible. By monitoring this property + for changes, you can animate other items at the same time as the image. + + frameCount is the number of frames in the animation. For some animation formats, + frameCount is unknown and has a value of zero. */ int QDeclarativeAnimatedImage::currentFrame() const { diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index e0c7fc2..5a9a18d 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -56,27 +56,97 @@ QT_BEGIN_NAMESPACE \brief The BorderImage element provides an image that can be used as a border. \inherits Item \since 4.7 - \ingroup qm-basic-visual-elements + \ingroup qml-basic-visual-elements - A BorderImage breaks an image into 9 sections, as shown below: + The BorderImage element is used to create borders out of images by scaling or tiling + parts of each image. + + A BorderImage element breaks a source image, specified using the \l url property, + into 9 regions, as shown below: \image declarative-scalegrid.png - When the image is scaled: + When the image is scaled, regions of the source image are scaled or tiled to + create the displayed border image in the following way: + \list - \i the corners (sections 1, 3, 7, and 9) are not scaled at all - \i sections 2 and 8 are scaled according to \l{BorderImage::horizontalTileMode}{horizontalTileMode} - \i sections 4 and 6 are scaled according to \l{BorderImage::verticalTileMode}{verticalTileMode} - \i the middle (section 5) is scaled according to both \l{BorderImage::horizontalTileMode}{horizontalTileMode} and \l{BorderImage::verticalTileMode}{verticalTileMode} + \i The corners (regions 1, 3, 7, and 9) are not scaled at all. + \i Regions 2 and 8 are scaled according to + \l{BorderImage::horizontalTileMode}{horizontalTileMode}. + \i Regions 4 and 6 are scaled according to + \l{BorderImage::verticalTileMode}{verticalTileMode}. + \i The middle (region 5) is scaled according to both + \l{BorderImage::horizontalTileMode}{horizontalTileMode} and + \l{BorderImage::verticalTileMode}{verticalTileMode}. \endlist - Examples: - \snippet snippets/declarative/borderimage.qml 0 + The regions of the image are defined using the \l border property group, which + describes the distance from each edge of the source image to use as a border. + + \section1 Example Usage + + The following examples show the effects of the different modes on an image. + Guide lines are overlaid onto the image to show the different regions of the + image as described above. + + \beginfloatleft + \image qml-borderimage-normal-image.png + \endfloat + + An unscaled image is displayed using an Image element. The \l border property is + used to determine the parts of the image that will lie inside the unscaled corner + areas and the parts that will be stretched horizontally and vertically. + + \snippet doc/src/snippets/declarative/borderimage/normal-image.qml normal image + + \clearfloat + \beginfloatleft + \image qml-borderimage-scaled.png + \endfloat + + A BorderImage element is used to display the image, and it is given a size that is + larger than the original image. Since the \l horizontalTileMode property is set to + \l{BorderImage::horizontalTileMode}{BorderImage.Stretch}, the parts of image in + regions 2 and 8 are stretched horizontally. Since the \l verticalTileMode property + is set to \l{BorderImage::verticalTileMode}{BorderImage.Stretch}, the parts of image + in regions 4 and 6 are stretched vertically. + + \snippet doc/src/snippets/declarative/borderimage/borderimage-scaled.qml scaled border image - \image BorderImage.png + \clearfloat + \beginfloatleft + \image qml-borderimage-tiled.png + \endfloat - The \l{declarative/imageelements/borderimage}{BorderImage example} shows how a BorderImage can be used to simulate a shadow effect on a - rectangular item. + Again, a large BorderImage element is used to display the image. With the + \l horizontalTileMode property set to \l{BorderImage::horizontalTileMode}{BorderImage.Repeat}, + the parts of image in regions 2 and 8 are tiled so that they fill the space at the + top and bottom of the element. Similarly, the \l verticalTileMode property is set to + \l{BorderImage::verticalTileMode}{BorderImage.Repeat}, the parts of image in regions + 4 and 6 are tiled so that they fill the space at the left and right of the element. + + \snippet doc/src/snippets/declarative/borderimage/borderimage-tiled.qml tiled border image + + \clearfloat + In some situations, the width of regions 2 and 8 may not be an exact multiple of the width + of the corresponding regions in the source image. Similarly, the height of regions 4 and 6 + may not be an exact multiple of the height of the corresponding regions. It can be useful + to use \l{BorderImage::horizontalTileMode}{BorderImage.Round} instead of + \l{BorderImage::horizontalTileMode}{BorderImage.Repeat} in cases like these. + + The \l{declarative/imageelements/borderimage}{BorderImage example} shows how a BorderImage + can be used to simulate a shadow effect on a rectangular item. + + \section1 Quality and Performance + + By default, any scaled regions of the image are rendered without smoothing to improve + rendering speed. Setting the \l smooth property improves rendering quality of scaled + regions, but may slow down rendering. + + The source image may not be loaded instantaneously, depending on its original location. + Loading progress can be monitored with the \l progress property. + + \sa Image, AnimatedImage */ /*! @@ -127,6 +197,8 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() the image is displayed at its natural size, this property has no visual or performance effect. + By default, this property is set to false. + \note Generally scaling artifacts are only visible if the image is stationary on the screen. A common pattern when animating an image is to disable smooth filtering at the beginning of the animation and reenable it at the conclusion. @@ -251,17 +323,21 @@ void QDeclarativeBorderImage::load() \qmlproperty int BorderImage::border.top \qmlproperty int BorderImage::border.bottom - The 4 border lines (2 horizontal and 2 vertical) break the image into 9 sections, as shown below: + The 4 border lines (2 horizontal and 2 vertical) break the image into 9 sections, + as shown below: \image declarative-scalegrid.png - Each border line (left, right, top, and bottom) specifies an offset in pixels from the respective side. + Each border line (left, right, top, and bottom) specifies an offset in pixels + from the respective edge of the source image. By default, each border line has + a value of 0. + + For example, the following definition sets the bottom line 10 pixels up from + the bottom of the image: - For example: \qml border.bottom: 10 \endqml - sets the bottom line 10 pixels up from the bottom of the image. The border lines can also be specified using a \l {BorderImage::source}{.sci file}. diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 47a410c..eb8b00e 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -51,34 +51,46 @@ QT_BEGIN_NAMESPACE /*! \qmlclass Image QDeclarativeImage \since 4.7 - \ingroup qml-vasic-visual-elements - - \brief The Image element allows you to add bitmaps to a scene. + \ingroup qml-basic-visual-elements + \brief The Image element displays an image in a declarative user interface \inherits Item - An Image element displays a specified \l source image: + The Image element is used to display images in a declarative user interface. - \table - \row - \o \image declarative-qtlogo.png - \o \qml - import Qt 4.7 + The source of the image is specified as a URL using the \l source property. + Images can be supplied in any of the standard image formats supported by Qt, + including bitmap formats such as PNG and JPEG, and vector graphics formats + such as SVG. If you need to display animated images, use the \l AnimatedImage + element. - Image { source: "qtlogo.png" } - \endqml - \endtable + If the \l{Item::width}{width} and \l{Item::height}{height} properties are not + specified, the Image element automatically uses the size of the loaded image. + By default, specifying the width and height of the element causes the image + to be scaled to that size. This behavior can be changed by setting the + \l fillMode property, allowing the image to be stretched and tiled instead. + + \section1 Example Usage + + The following example shows the simplest usage of the Image element. + + \snippet doc/src/snippets/declarative/image.qml + + \beginfloatleft + \image declarative-qtlogo.png + \endfloat + + \clearfloat - If the \l {Item::width}{width} and \l{Item::height}{height} properties are not specified, - the Image element is automatically sized to the loaded image. Image elements can be - stretched and tiled using the \l fillMode property. + \section1 Performance By default, locally available images are loaded immediately, and the user interface is blocked until loading is complete. If a large image is to be loaded, it may be preferable to load the image in a low priority thread, by enabling the \l asynchronous property. - If the image is from a network rather than a local resource, it is automatically loaded - asynchronously, and the \l progress and \l status properties are updated as appropriate. + If the image is obtained from a network rather than a local resource, it is + automatically loaded asynchronously, and the \l progress and \l status properties + are updated as appropriate. Images are cached and shared internally, so if several Image elements have the same \l source, only one copy of the image will be loaded. -- cgit v0.12 From 8785254d4e2b245106ef169fa0bc3d793f1d6507 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 23 Aug 2010 15:06:51 +0200 Subject: Doc: Fixed incorrect use of commands to mark documentation. --- src/declarative/graphicsitems/qdeclarativetext.cpp | 1 - src/declarative/graphicsitems/qdeclarativetextedit.cpp | 1 - src/declarative/util/qdeclarativelistmodel.cpp | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index fcd112e..51d6e8f 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -194,7 +194,6 @@ QSet QTextDocumentWithImageResources::errors; /*! \internal \class QDeclarativeText - \qmlclass Text \brief The QDeclarativeText class provides a formatted text item that you can add to a QDeclarativeView. diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index b8e8726..acc8589 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -106,7 +106,6 @@ TextEdit { /*! \internal \class QDeclarativeTextEdit - \qmlclass TextEdit \brief The QDeclarativeTextEdit class provides an editable formatted text item that you can add to a QDeclarativeView. diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 1f66f0f..8f9b725 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -769,7 +769,7 @@ bool QDeclarativeListModelParser::definesEmptyList(const QString &s) } /*! - \qmlclass ListElement + \qmlclass ListElement QDeclarativeListElement \ingroup qml-working-with-data \since 4.7 \brief The ListElement element defines a data item in a ListModel. -- cgit v0.12 From ef9cc109f1a6fe84ca27a6c8a53f1783b8bdf14d Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 24 Aug 2010 14:11:06 +0200 Subject: Doc: Minor improvements and fixes. --- doc/src/declarative/elements.qdoc | 9 +++++---- doc/src/declarative/extending-tutorial.qdoc | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 94abe10..252b964 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -29,12 +29,13 @@ \page qdeclarativeelements.html \target elements \title QML Elements + \brief A dictionary of standard QML elements. - This is a dictionary of all the QML elements available in the \l - {QtDeclarative} {Qt Declarative} module. + This is a dictionary of all standard QML elements made available + in the QtDeclarative module. - To see the QML elements listed by - functional area, \l{Groups Of Related QML Elements} {look here}. + To see the QML elements listed by functional area, see the + \l{Groups Of Related QML Elements} page. \generatelist qmlclasses diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc index d128d0f..349ac30 100644 --- a/doc/src/declarative/extending-tutorial.qdoc +++ b/doc/src/declarative/extending-tutorial.qdoc @@ -26,7 +26,6 @@ ****************************************************************************/ /*! - \page qml-extending-tutorial-index.html \title Tutorial: Writing QML extensions with C++ -- cgit v0.12 From 1a75b369797c41d37f92950f7527c1eb989f1215 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 27 Aug 2010 18:23:37 +0200 Subject: Doc: More work on the QML documentation. --- doc/src/declarative/anchor-layout.qdoc | 2 +- doc/src/declarative/codingconventions.qdoc | 2 +- doc/src/declarative/declarativeui.qdoc | 3 +- doc/src/declarative/pics/spacing_a.png | Bin 547 -> 0 bytes doc/src/declarative/pics/spacing_b.png | Bin 560 -> 0 bytes doc/src/declarative/qdeclarativemodels.qdoc | 2 +- doc/src/examples/qml-examples.qdoc | 2 +- doc/src/images/qml-flow-snippet.png | Bin 0 -> 10385 bytes doc/src/images/qml-grid-no-spacing.png | Bin 0 -> 416 bytes doc/src/images/qml-grid-spacing.png | Bin 0 -> 421 bytes doc/src/images/qml-repeater-grid-index.png | Bin 0 -> 17964 bytes doc/src/images/qml-row.png | Bin 0 -> 3090 bytes doc/src/snippets/declarative/anchoranimation.qml | 1 + doc/src/snippets/declarative/column/column.qml | 67 ++++ .../column/vertical-positioner-transition.qml | 61 +++ .../declarative/column/vertical-positioner.qml | 50 +++ doc/src/snippets/declarative/flow.qml | 62 +++ doc/src/snippets/declarative/grid/grid-items.qml | 58 +++ .../snippets/declarative/grid/grid-no-spacing.qml | 57 +++ doc/src/snippets/declarative/grid/grid-spacing.qml | 58 +++ doc/src/snippets/declarative/grid/grid.qml | 53 +++ doc/src/snippets/declarative/repeater.qml | 89 ----- .../declarative/repeaters/repeater-grid-index.qml | 61 +++ .../snippets/declarative/repeaters/repeater.qml | 89 +++++ doc/src/snippets/declarative/row.qml | 62 +++ doc/src/snippets/declarative/row/row.qml | 50 +++ doc/src/snippets/declarative/~image-fillmode.qml | 46 +++ .../graphicsitems/qdeclarativeborderimage.cpp | 21 +- .../graphicsitems/qdeclarativepositioners.cpp | 436 ++++++++++++--------- .../graphicsitems/qdeclarativerepeater.cpp | 10 +- 30 files changed, 1044 insertions(+), 298 deletions(-) delete mode 100644 doc/src/declarative/pics/spacing_a.png delete mode 100644 doc/src/declarative/pics/spacing_b.png create mode 100644 doc/src/images/qml-flow-snippet.png create mode 100644 doc/src/images/qml-grid-no-spacing.png create mode 100644 doc/src/images/qml-grid-spacing.png create mode 100644 doc/src/images/qml-repeater-grid-index.png create mode 100644 doc/src/images/qml-row.png create mode 100644 doc/src/snippets/declarative/column/column.qml create mode 100644 doc/src/snippets/declarative/column/vertical-positioner-transition.qml create mode 100644 doc/src/snippets/declarative/column/vertical-positioner.qml create mode 100644 doc/src/snippets/declarative/flow.qml create mode 100644 doc/src/snippets/declarative/grid/grid-items.qml create mode 100644 doc/src/snippets/declarative/grid/grid-no-spacing.qml create mode 100644 doc/src/snippets/declarative/grid/grid-spacing.qml create mode 100644 doc/src/snippets/declarative/grid/grid.qml delete mode 100644 doc/src/snippets/declarative/repeater.qml create mode 100644 doc/src/snippets/declarative/repeaters/repeater-grid-index.qml create mode 100644 doc/src/snippets/declarative/repeaters/repeater.qml create mode 100644 doc/src/snippets/declarative/row.qml create mode 100644 doc/src/snippets/declarative/row/row.qml create mode 100644 doc/src/snippets/declarative/~image-fillmode.qml diff --git a/doc/src/declarative/anchor-layout.qdoc b/doc/src/declarative/anchor-layout.qdoc index 5c025e5..99f7777 100644 --- a/doc/src/declarative/anchor-layout.qdoc +++ b/doc/src/declarative/anchor-layout.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! -\page anchor-layout.html +\page qml-anchor-layout.html \target anchor-layout \title Anchor-based Layout in QML diff --git a/doc/src/declarative/codingconventions.qdoc b/doc/src/declarative/codingconventions.qdoc index 9403920..aa4feef 100644 --- a/doc/src/declarative/codingconventions.qdoc +++ b/doc/src/declarative/codingconventions.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! -\page codingconventions.html +\page qml-coding-conventions.html \title QML Coding Conventions This document contains the QML coding conventions that we follow in our documentation and examples and recommend that others follow. diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index 9609954..ae64e2a 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -107,7 +107,8 @@ Module. \section1 Handling Data \list -\o \l{Data Models} +\o \l{Using QML Positioner and Repeater Items} +\o \l{QML Data Models} \o \l{Network Transparency} \endlist diff --git a/doc/src/declarative/pics/spacing_a.png b/doc/src/declarative/pics/spacing_a.png deleted file mode 100644 index c0fe895..0000000 Binary files a/doc/src/declarative/pics/spacing_a.png and /dev/null differ diff --git a/doc/src/declarative/pics/spacing_b.png b/doc/src/declarative/pics/spacing_b.png deleted file mode 100644 index 24cf640..0000000 Binary files a/doc/src/declarative/pics/spacing_b.png and /dev/null differ diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 173002a..ace0465 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -28,7 +28,7 @@ /*! \page qdeclarativemodels.html \target qmlmodels -\title Data Models +\title QML Data Models QML items such as ListView, GridView and \l Repeater require Data Models that provide the data to be displayed. diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 0d191c9..03bf7bb 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -229,7 +229,7 @@ */ /*! - \title Internationlization Example + \title Internationalization Example \example declarative/i18n This example shows how to enable text translation in QML. diff --git a/doc/src/images/qml-flow-snippet.png b/doc/src/images/qml-flow-snippet.png new file mode 100644 index 0000000..1a2af4b Binary files /dev/null and b/doc/src/images/qml-flow-snippet.png differ diff --git a/doc/src/images/qml-grid-no-spacing.png b/doc/src/images/qml-grid-no-spacing.png new file mode 100644 index 0000000..c2092e0 Binary files /dev/null and b/doc/src/images/qml-grid-no-spacing.png differ diff --git a/doc/src/images/qml-grid-spacing.png b/doc/src/images/qml-grid-spacing.png new file mode 100644 index 0000000..1083bee Binary files /dev/null and b/doc/src/images/qml-grid-spacing.png differ diff --git a/doc/src/images/qml-repeater-grid-index.png b/doc/src/images/qml-repeater-grid-index.png new file mode 100644 index 0000000..44aed24 Binary files /dev/null and b/doc/src/images/qml-repeater-grid-index.png differ diff --git a/doc/src/images/qml-row.png b/doc/src/images/qml-row.png new file mode 100644 index 0000000..30d9caa Binary files /dev/null and b/doc/src/images/qml-row.png differ diff --git a/doc/src/snippets/declarative/anchoranimation.qml b/doc/src/snippets/declarative/anchoranimation.qml index 6c7aaf6..9a7b8ff 100644 --- a/doc/src/snippets/declarative/anchoranimation.qml +++ b/doc/src/snippets/declarative/anchoranimation.qml @@ -37,6 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + //![0] import Qt 4.7 diff --git a/doc/src/snippets/declarative/column/column.qml b/doc/src/snippets/declarative/column/column.qml new file mode 100644 index 0000000..e372cfd --- /dev/null +++ b/doc/src/snippets/declarative/column/column.qml @@ -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$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Item { + width: 310; height: 170 + + Column { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + + spacing: 5 + + Rectangle { color: "lightblue"; radius: 10.0 + width: 300; height: 50 + Text { anchors.fill: parent + font.pointSize: 32; text: "Books" } } + Rectangle { color: "gold"; radius: 10.0 + width: 300; height: 50 + Text { anchors.fill: parent + font.pointSize: 32; text: "Music" } } + Rectangle { color: "lightgreen"; radius: 10.0 + width: 300; height: 50 + Text { anchors.fill: parent + font.pointSize: 32; text: "Movies" } } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/column/vertical-positioner-transition.qml b/doc/src/snippets/declarative/column/vertical-positioner-transition.qml new file mode 100644 index 0000000..7785776 --- /dev/null +++ b/doc/src/snippets/declarative/column/vertical-positioner-transition.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE: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 + +//! [document] +Column { + spacing: 2 + Rectangle { color: "red"; width: 50; height: 50 } + Rectangle { id: rect1; color: "green"; width: 20; height: 50 } + Rectangle { color: "blue"; width: 50; height: 20 } + + //![transitions] + add: Transition { + NumberAnimation { properties: "opacity"; duration: 1000 } + } + //![transitions] + + MouseArea { + anchors.fill: parent + onClicked: rect1.opacity = 0 + } +} +//! [document] diff --git a/doc/src/snippets/declarative/column/vertical-positioner.qml b/doc/src/snippets/declarative/column/vertical-positioner.qml new file mode 100644 index 0000000..27b09c1 --- /dev/null +++ b/doc/src/snippets/declarative/column/vertical-positioner.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** 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 + +//! [document] +Column { + spacing: 2 + Rectangle { color: "red"; width: 50; height: 50 } + Rectangle { color: "green"; width: 20; height: 50 } + Rectangle { color: "blue"; width: 50; height: 20 } +} +//! [document] diff --git a/doc/src/snippets/declarative/flow.qml b/doc/src/snippets/declarative/flow.qml new file mode 100644 index 0000000..c5fbc90 --- /dev/null +++ b/doc/src/snippets/declarative/flow.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** 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 { + color: "lightblue" + width: 300; height: 200 + +//! [flow item] + Flow { + anchors.fill: parent + anchors.margins: 4 + spacing: 10 + + Text { text: "Text"; font.pixelSize: 40 } + Text { text: "items"; font.pixelSize: 40 } + Text { text: "flowing"; font.pixelSize: 40 } + Text { text: "in"; font.pixelSize: 40 } + Text { text: "a"; font.pixelSize: 40 } + Text { text: "Flow"; font.pixelSize: 40 } + Text { text: "item"; font.pixelSize: 40 } + } +//! [flow item] +} diff --git a/doc/src/snippets/declarative/grid/grid-items.qml b/doc/src/snippets/declarative/grid/grid-items.qml new file mode 100644 index 0000000..5099758 --- /dev/null +++ b/doc/src/snippets/declarative/grid/grid-items.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + width: 112; height: 112 + color: "#303030" + + Grid { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + columns: 2 + spacing: 6 + + Rectangle { color: "#aa6666"; width: 50; height: 50 } + Rectangle { color: "#aaaa66"; width: 50; height: 50 } + Rectangle { color: "#9999aa"; width: 50; height: 50 } + Rectangle { color: "#6666aa"; width: 50; height: 50 } + } +} diff --git a/doc/src/snippets/declarative/grid/grid-no-spacing.qml b/doc/src/snippets/declarative/grid/grid-no-spacing.qml new file mode 100644 index 0000000..f04c242 --- /dev/null +++ b/doc/src/snippets/declarative/grid/grid-no-spacing.qml @@ -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$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + width: 112; height: 112 + color: "#303030" + + Grid { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + columns: 2 + + Rectangle { color: "#aa6666"; width: 50; height: 50 } + Rectangle { color: "#aaaa66"; width: 50; height: 50 } + Rectangle { color: "#9999aa"; width: 50; height: 50 } + Rectangle { color: "#6666aa"; width: 50; height: 50 } + } +} diff --git a/doc/src/snippets/declarative/grid/grid-spacing.qml b/doc/src/snippets/declarative/grid/grid-spacing.qml new file mode 100644 index 0000000..5099758 --- /dev/null +++ b/doc/src/snippets/declarative/grid/grid-spacing.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + width: 112; height: 112 + color: "#303030" + + Grid { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + columns: 2 + spacing: 6 + + Rectangle { color: "#aa6666"; width: 50; height: 50 } + Rectangle { color: "#aaaa66"; width: 50; height: 50 } + Rectangle { color: "#9999aa"; width: 50; height: 50 } + Rectangle { color: "#6666aa"; width: 50; height: 50 } + } +} diff --git a/doc/src/snippets/declarative/grid/grid.qml b/doc/src/snippets/declarative/grid/grid.qml new file mode 100644 index 0000000..d57b4b2 --- /dev/null +++ b/doc/src/snippets/declarative/grid/grid.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Grid { + columns: 3 + spacing: 2 + Rectangle { color: "red"; width: 50; height: 50 } + Rectangle { color: "green"; width: 20; height: 50 } + Rectangle { color: "blue"; width: 50; height: 20 } + Rectangle { color: "cyan"; width: 50; height: 50 } + Rectangle { color: "magenta"; width: 10; height: 10 } +} +//! [document] diff --git a/doc/src/snippets/declarative/repeater.qml b/doc/src/snippets/declarative/repeater.qml deleted file mode 100644 index d71fd29..0000000 --- a/doc/src/snippets/declarative/repeater.qml +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** 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] -import Qt 4.7 -//! [import] - -Row { - -//! [simple] -Row { - Repeater { - model: 3 - Rectangle { - width: 100; height: 40 - border.width: 1 - color: "yellow" - } - } -} -//! [simple] - -//! [index] -Column { - Repeater { - model: 10 - Text { text: "I'm item " + index } - } -} -//! [index] - -//! [modeldata] -Column { - Repeater { - model: ["apples", "oranges", "pears"] - Text { text: "Data: " + modelData } - } -} -//! [modeldata] - -//! [layout] -Row { - Rectangle { width: 10; height: 20; color: "red" } - Repeater { - model: 10 - Rectangle { width: 20; height: 20; radius: 10; color: "green" } - } - Rectangle { width: 10; height: 20; color: "blue" } -} -//! [layout] - -} diff --git a/doc/src/snippets/declarative/repeaters/repeater-grid-index.qml b/doc/src/snippets/declarative/repeaters/repeater-grid-index.qml new file mode 100644 index 0000000..106550e --- /dev/null +++ b/doc/src/snippets/declarative/repeaters/repeater-grid-index.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + width: 400; height: 400; color: "black" + + Grid { + x: 5; y: 5 + rows: 5; columns: 5; spacing: 10 + + Repeater { model: 24 + Rectangle { width: 70; height: 70 + color: "lightgreen" + + Text { text: index + font.pointSize: 30 + anchors.centerIn: parent } } + } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/repeaters/repeater.qml b/doc/src/snippets/declarative/repeaters/repeater.qml new file mode 100644 index 0000000..d71fd29 --- /dev/null +++ b/doc/src/snippets/declarative/repeaters/repeater.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** 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] +import Qt 4.7 +//! [import] + +Row { + +//! [simple] +Row { + Repeater { + model: 3 + Rectangle { + width: 100; height: 40 + border.width: 1 + color: "yellow" + } + } +} +//! [simple] + +//! [index] +Column { + Repeater { + model: 10 + Text { text: "I'm item " + index } + } +} +//! [index] + +//! [modeldata] +Column { + Repeater { + model: ["apples", "oranges", "pears"] + Text { text: "Data: " + modelData } + } +} +//! [modeldata] + +//! [layout] +Row { + Rectangle { width: 10; height: 20; color: "red" } + Repeater { + model: 10 + Rectangle { width: 20; height: 20; radius: 10; color: "green" } + } + Rectangle { width: 10; height: 20; color: "blue" } +} +//! [layout] + +} diff --git a/doc/src/snippets/declarative/row.qml b/doc/src/snippets/declarative/row.qml new file mode 100644 index 0000000..bd2db16 --- /dev/null +++ b/doc/src/snippets/declarative/row.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Rectangle { + width: 320; height: 110 + color: "#c0c0c0" + + Row { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + + spacing: 5 + + Rectangle { width: 100; height: 100; radius: 20.0 + color: "#024c1c" } + Rectangle { width: 100; height: 100; radius: 20.0 + color: "#42a51c" } + Rectangle { width: 100; height: 100; radius: 20.0 + color: "white" } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/row/row.qml b/doc/src/snippets/declarative/row/row.qml new file mode 100644 index 0000000..c863243 --- /dev/null +++ b/doc/src/snippets/declarative/row/row.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Row { + spacing: 2 + Rectangle { color: "red"; width: 50; height: 50 } + Rectangle { color: "green"; width: 20; height: 50 } + Rectangle { color: "blue"; width: 50; height: 20 } +} +//! [document] diff --git a/doc/src/snippets/declarative/~image-fillmode.qml b/doc/src/snippets/declarative/~image-fillmode.qml new file mode 100644 index 0000000..cee26c4 --- /dev/null +++ b/doc/src/snippets/declarative/~image-fillmode.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** 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 + +Image { + source: "pics/qtlogo.png" + width: 20; height: 20 +} diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 5a9a18d..832e1cd 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -169,7 +169,8 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() /*! \qmlproperty enumeration BorderImage::status - This property holds the status of image loading. It can be one of: + This property describes the status of image loading. It can be one of: + \list \o BorderImage.Null - no image has been set \o BorderImage.Ready - the image has been loaded @@ -201,18 +202,24 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() \note Generally scaling artifacts are only visible if the image is stationary on the screen. A common pattern when animating an image is to disable smooth - filtering at the beginning of the animation and reenable it at the conclusion. + filtering at the beginning of the animation and enable it at the conclusion. */ /*! \qmlproperty url BorderImage::source - BorderImage can handle any image format supported by Qt, loaded from any URL scheme supported by Qt. + This property holds the URL that refers to the source image. + + BorderImage can handle any image format supported by Qt, loaded from any + URL scheme supported by Qt. + + It can also handle .sci files, which are a QML-specific format. A .sci + file uses a simple text-based format that specifies the borders, the + image file and the tile rules. - It can also handle .sci files, which are a QML-specific format. A .sci file uses a simple text-based format that specifies - the borders, the image file and the tile rules. + The following .sci file sets the borders to 10 on each side for the + image \c picture.png: - The following .sci file sets the borders to 10 on each side for the image \c picture.png: \qml border.left: 10 border.top: 10 @@ -356,7 +363,7 @@ QDeclarativeScaleGrid *QDeclarativeBorderImage::border() This property describes how to repeat or stretch the middle parts of the border image. \list - \o BorderImage.Stretch - Scale the image to fit to the available area. + \o BorderImage.Stretch - Scales the image to fit to the available area. \o BorderImage.Repeat - Tile the image until there is no more space. May crop the last image. \o BorderImage.Round - Like Repeat, but scales the images down to ensure that the last image is not cropped. \endlist diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index 4ceb5d9..b653282 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -330,58 +330,65 @@ static inline bool isInvisible(QGraphicsObject *child) /*! \qmlclass Column QDeclarativeColumn - \ingroup qml-positioning-elements - \since 4.7 + \ingroup qml-positioning-elements + \since 4.7 \brief The Column item arranges its children vertically. \inherits Item The Column item positions its child items so that they are vertically - aligned and not overlapping. Spacing between items can be added. + aligned and not overlapping. - The below example positions differently shaped rectangles using a Column. - \table - \row - \o \image verticalpositioner_example.png - \o - \qml -Column { - spacing: 2 - Rectangle { color: "red"; width: 50; height: 50 } - Rectangle { color: "green"; width: 20; height: 50 } - Rectangle { color: "blue"; width: 50; height: 20 } -} - \endqml - \endtable + Spacing between items can be added using the \l spacing property. + Transitions can be used for cases where items managed by a Column are + added or moved. These are stored in the \l add and \l move properties + respectively. + + See \l{Using QML Positioner and Repeater Items} for more details about this item and other + related items. + + \section1 Example Usage + + The following example positions differently shaped rectangles using a Column + item. + + \image verticalpositioner_example.png + + \snippet doc/src/snippets/declarative/column/vertical-positioner.qml document + + \section1 Using Transitions + + Transitions can be used to animate items that are added to, moved within, + or removed from a Column item. The \l add and \l move properties can be set to + the transitions that will be applied when items are added to, removed from, + or re-positioned within a Column item. + + The use of transitions with positioners is described in more detail in the + \l{Using QML Positioner and Repeater Items#Using Transitions}{Using QML + Positioner and Repeater Items} document. - Column also provides for transitions to be set when items are added, moved, - or removed in the positioner. Adding and removing apply both to items which are deleted - or have their position in the document changed so as to no longer be children of the positioner, - as well as to items which have their opacity set to or from zero so as to appear or disappear. + \image verticalpositioner_transition.gif - \table - \row - \o \image verticalpositioner_transition.gif - \o \qml -Column { - spacing: 2 - add: ... - move: ... - ... -} + Column { + spacing: 2 + add: ... + move: ... + ... + } \endqml - \endtable + + \section1 Limitations Note that the positioner assumes that the x and y positions of its children will not change. If you manually change the x or y properties in script, bind the x or y properties, use anchors on a child of a positioner, or have the height of a child depend on the position of a child, then the - positioner may exhibit strange behaviour. If you need to perform any of these + positioner may exhibit strange behavior. If you need to perform any of these actions, consider positioning the items without the use of a Column. Items with a width or height of 0 will not be positioned. - \sa Row, {declarative/positioners}{Positioners example} + \sa Row, Grid, Flow, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition Column::add @@ -389,55 +396,47 @@ Column { This property holds the transition to be applied when adding an item to the positioner. The transition will only be applied to the added item(s). Positioner transitions will only affect the - position (x,y) of items. - - Added can mean that either the object has been created or - reparented, and thus is now a child or the positioner, or that the - object has had its opacity increased from zero, and thus is now - visible. + position (x, y) of items. + For a positioner, adding an item can mean that either the object + has been created or reparented, and thus is now a child or the + positioner, or that the object has had its opacity increased from + zero, and thus is now visible. + \sa move */ /*! \qmlproperty Transition Column::move This property holds the transition to apply when moving an item within the positioner. Positioner transitions will only affect - the position (x,y) of items. + the position (x, y) of items. + + This transition can be performed when other items are added or removed + from the positioner, or when items resize themselves. - This can happen when other items are added or removed from the - positioner, or when items resize themselves. + \image positioner-move.gif - \table - \row - \o \image positioner-move.gif - \o \qml -Column { - move: Transition { - NumberAnimation { - properties: "y" - easing.type: Easing.OutBounce + Column { + move: Transition { + NumberAnimation { + properties: "y" + easing.type: Easing.OutBounce + } } } -} \endqml - \endtable + + \sa add, {declarative/positioners}{Positioners example} */ /*! \qmlproperty int Column::spacing - spacing is the amount in pixels left empty between each adjacent - item, and defaults to 0. - - The below example places a \l Grid containing a red, a blue and a - green rectangle on a gray background. The area the grid positioner - occupies is colored white. The top positioner has the default of no spacing, - and the bottom positioner has its spacing set to 2. - - \image spacing_a.png - \image spacing_b.png + The spacing is the amount in pixels left empty between adjacent + items. The default spacing is 0. + \sa Grid::spacing */ /*! \internal @@ -496,29 +495,38 @@ void QDeclarativeColumn::reportConflictingAnchors() /*! \qmlclass Row QDeclarativeRow - \ingroup qml-positioning-elements + \ingroup qml-positioning-elements \since 4.7 \brief The Row item arranges its children horizontally. \inherits Item - The Row item positions its child items so that they are - horizontally aligned and not overlapping. + The Row item positions its child items so that they are horizontally + aligned and not overlapping. Use \l spacing to set the spacing between items in a Row, and use the \l add and \l move properties to set the transitions that should be applied when items are added to, removed from, or re-positioned within the Row. - The below example lays out differently shaped rectangles using a Row. - \qml -Row { - spacing: 2 - Rectangle { color: "red"; width: 50; height: 50 } - Rectangle { color: "green"; width: 20; height: 50 } - Rectangle { color: "blue"; width: 50; height: 20 } -} - \endqml + See \l{Using QML Positioner and Repeater Items} for more details about this item and other + related items. + + \section1 Example Usage + + The following example lays out differently shaped rectangles using a Row. + \image horizontalpositioner_example.png + \snippet doc/src/snippets/declarative/row/row.qml document + + \section1 Using Transitions + + Transitions can be used to animate items that are added to, moved within, + or removed from a Grid item. The \l add and \l move properties can be set to + the transitions that will be applied when items are added to, removed from, + or re-positioned within a Row item. + + \section1 Limitations + Note that the positioner assumes that the x and y positions of its children will not change. If you manually change the x or y properties in script, bind the x or y properties, use anchors on a child of a positioner, or have the @@ -528,56 +536,54 @@ Row { Items with a width or height of 0 will not be positioned. - \sa Column, {declarative/positioners}{Positioners example} + \sa Column, Grid, Flow, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition Row::add - This property holds the transition to apply when adding an item to the positioner. - The transition will only be applied to the added item(s). - Positioner transitions will only affect the position (x,y) of items. - - An object is considered to be added to the positioner if it has been - created or reparented and thus is now a child or the positioner, or if the - object has had its opacity increased from zero, and thus is now - visible. + + This property holds the transition to be applied when adding an + item to the positioner. The transition will only be applied to the + added item(s). Positioner transitions will only affect the + position (x, y) of items. + + For a positioner, adding an item can mean that either the object + has been created or reparented, and thus is now a child or the + positioner, or that the object has had its opacity increased from + zero, and thus is now visible. + + \sa move */ /*! \qmlproperty Transition Row::move - This property holds the transition to apply when moving an item - within the positioner. Positioner transitions will only affect - the position (x,y) of items. + This property holds the transition to be applied when moving an + item within the positioner. Positioner transitions will only affect + the position (x, y) of items. - This can happen when other items are added or removed from the - positioner, or when items resize themselves. + This transition can be performed when other items are added or removed + from the positioner, or when items resize themselves. \qml -Row { - id: positioner - move: Transition { - NumberAnimation { - properties: "x" - ease: "easeOutBounce" + Row { + id: positioner + move: Transition { + NumberAnimation { + properties: "x" + ease: "easeOutBounce" + } } } -} \endqml + \sa add, {declarative/positioners}{Positioners example} */ /*! \qmlproperty int Row::spacing - spacing is the amount in pixels left empty between each adjacent - item, and defaults to 0. - - The below example places a \l Grid containing a red, a blue and a - green rectangle on a gray background. The area the grid positioner - occupies is colored white. The top positioner has the default of no spacing, - and the bottom positioner has its spacing set to 2. - - \image spacing_a.png - \image spacing_b.png + The spacing is the amount in pixels left empty between adjacent + items. The default spacing is 0. + \sa Grid::spacing */ /*! \internal @@ -635,47 +641,45 @@ void QDeclarativeRow::reportConflictingAnchors() /*! \qmlclass Grid QDeclarativeGrid - \ingroup qml-positioning-elements + \ingroup qml-positioning-elements \since 4.7 \brief The Grid item positions its children in a grid. \inherits Item The Grid item positions its child items so that they are aligned in a grid and are not overlapping. - - Spacing can be added - between child items. It also provides for transitions to be set when items are - added, moved, or removed in the positioner. Adding and removing apply - both to items which are deleted or have their position in the - document changed so as to no longer be children of the positioner, as - well as to items which have their opacity set to or from zero so - as to appear or disappear. - - A Grid defaults to four columns, and as many rows as - are necessary to fit all child items. The number of rows - and/or the number of columns can be constrained by setting the \l rows - or \l columns properties. The grid positioner calculates a grid with - rectangular cells of sufficient size to hold all items, and then - places the items in the cells, going across then down, and - positioning each item at the (0,0) corner of the cell. The below - example demonstrates this. - - \table - \row - \o \image gridLayout_example.png - \o - \qml -Grid { - columns: 3 - spacing: 2 - Rectangle { color: "red"; width: 50; height: 50 } - Rectangle { color: "green"; width: 20; height: 50 } - Rectangle { color: "blue"; width: 50; height: 20 } - Rectangle { color: "cyan"; width: 50; height: 50 } - Rectangle { color: "magenta"; width: 10; height: 10 } -} - \endqml - \endtable + + A Grid defaults to four columns, and as many rows as are necessary to + fit all child items. The number of rows and columns can be constrained + by setting the \l rows and \l columns properties. The grid positioner + calculates a grid of rectangular cells of sufficient size to hold all + items, placing the items in the cells, from left to right and top to + bottom. Each item is positioned in the top-left corner of its cell + with position (0, 0). + + Spacing can be added between child items by setting the \l spacing + property. The amount of spacing applied will be the same in the + horizontal and vertical directions. + + See \l{Using QML Positioner and Repeater Items} for more details about this item and other + related items. + + \section1 Example Usage + + The following example demonstrates this. + + \image gridLayout_example.png + + \snippet doc/src/snippets/declarative/grid/grid.qml document + + \section1 Using Transitions + + Transitions can be used to animate items that are added to, moved within, + or removed from a Grid item. The \l add and \l move properties can be set to + the transitions that will be applied when items are added to, removed from, + or re-positioned within a Grid item. + + \section1 Limitations Note that the positioner assumes that the x and y positions of its children will not change. If you manually change the x or y properties in script, bind @@ -686,55 +690,62 @@ Grid { Items with a width or height of 0 will not be positioned. - \sa Flow, {declarative/positioners}{Positioners example} + \sa Flow, Row, Column, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition Grid::add - This property holds the transition to apply when adding an item to the positioner. - The transition is only applied to the added item(s). - Positioner transitions will only affect the position (x,y) of items, - as that is all the positioners affect. To animate other property change - you will have to do so based on how you have changed those properties. - - An object is considered to be added to the positioner if it has been - created or reparented and thus is now a child or the positioner, or if the - object has had its opacity increased from zero, and thus is now - visible. + + This property holds the transition to be applied when adding an + item to the positioner. The transition will only be applied to the + added item(s). Positioner transitions will only affect the + position (x, y) of items. + + For a positioner, adding an item can mean that either the object + has been created or reparented, and thus is now a child or the + positioner, or that the object has had its opacity increased from + zero, and thus is now visible. + + \sa move */ /*! \qmlproperty Transition Grid::move - This property holds the transition to apply when moving an item within the positioner. - Positioner transitions will only affect the position (x,y) of items. - This can happen when other items are added or removed from the positioner, or - when items resize themselves. + This property holds the transition to be applied when moving an + item within the positioner. Positioner transitions will only affect + the position (x, y) of items. + + This transition can be performed when other items are added or removed + from the positioner, or when items resize themselves. \qml -Grid { - move: Transition { - NumberAnimation { - properties: "x,y" - ease: "easeOutBounce" + Grid { + move: Transition { + NumberAnimation { + properties: "x,y" + ease: "easeOutBounce" + } } } -} \endqml + \sa add, {declarative/positioners}{Positioners example} */ /*! \qmlproperty int Grid::spacing - spacing is the amount in pixels left empty between each adjacent - item, and defaults to 0. + The spacing is the amount in pixels left empty between adjacent + items. The default spacing is 0. The below example places a Grid containing a red, a blue and a green rectangle on a gray background. The area the grid positioner - occupies is colored white. The top positioner has the default of no spacing, - and the bottom positioner has its spacing set to 2. + occupies is colored white. The positioner on the left has the + no spacing (the default), and the positioner on the right has + a spacing of 6. - \image spacing_a.png - \image spacing_b.png + \inlineimage qml-grid-no-spacing.png + \inlineimage qml-grid-spacing.png + \sa rows, columns */ /*! \internal @@ -748,7 +759,9 @@ QDeclarativeGrid::QDeclarativeGrid(QDeclarativeItem *parent) : /*! \qmlproperty int Grid::columns - This property holds the number of columns in the grid. + + This property holds the number of columns in the grid. The default + number of columns is 4. If the grid does not have enough items to fill the specified number of columns, some columns will be of zero width. @@ -930,13 +943,43 @@ void QDeclarativeGrid::reportConflictingAnchors() /*! \qmlclass Flow QDeclarativeFlow - \ingroup qml-positioning-elements + \ingroup qml-positioning-elements \since 4.7 \brief The Flow item arranges its children side by side, wrapping as necessary. \inherits Item - The Flow item positions its child items so that they are side by side and are - not overlapping. + The Flow item positions its child items like words on a page, wrapping them + to create rows or columns of items that do not overlap. + + Spacing between items can be added using the \l spacing property. + Transitions can be used for cases where items managed by a Column are + added or moved. These are stored in the \l add and \l move properties + respectively. + + See \l{Using QML Positioner and Repeater Items} for more details about this item and other + related items. + + \section1 Example Usage + + The following example positions \l Text items within a parent item using + a Flow item. + + \image qml-flow-snippet.png + + \snippet doc/src/snippets/declarative/flow.qml flow item + + \section1 Using Transitions + + Transitions can be used to animate items that are added to, moved within, + or removed from a Flow item. The \l add and \l move properties can be set to + the transitions that will be applied when items are added to, removed from, + or re-positioned within a Flow item. + + The use of transitions with positioners is described in more detail in the + \l{Using QML Positioner and Repeater Items#Using Transitions}{Using QML + Positioner and Repeater Items} document. + + \section1 Limitations Note that the positioner assumes that the x and y positions of its children will not change. If you manually change the x or y properties in script, bind @@ -947,38 +990,46 @@ void QDeclarativeGrid::reportConflictingAnchors() Items with a width or height of 0 will not be positioned. - \sa Grid, {declarative/positioners}{Positioners example} + \sa Column, Row, Grid, {declarative/positioners}{Positioners example} */ /*! \qmlproperty Transition Flow::add - This property holds the transition to apply when adding an item to the positioner. - The transition will only be applied to the added item(s). - Positioner transitions will only affect the position (x,y) of items. - - An object is considered to be added to the positioner if it has been - created or reparented and thus is now a child or the positioner, or if the - object has had its opacity increased from zero, and thus is now - visible. + + This property holds the transition to be applied when adding an + item to the positioner. The transition will only be applied to the + added item(s). Positioner transitions will only affect the + position (x, y) of items. + + For a positioner, adding an item can mean that either the object + has been created or reparented, and thus is now a child or the + positioner, or that the object has had its opacity increased from + zero, and thus is now visible. + + \sa move */ /*! \qmlproperty Transition Flow::move - This property holds the transition to apply when moving an item within the positioner. - Positioner transitions will only affect the position (x,y) of items. - This can happen when other items are added or removed from the positioner, or when items resize themselves. + This property holds the transition to be applied when moving an + item within the positioner. Positioner transitions will only affect + the position (x, y) of items. + + This transition can be performed when other items are added or removed + from the positioner, or when items resize themselves. \qml -Flow { - id: positioner - move: Transition { - NumberAnimation { - properties: "x,y" - ease: "easeOutBounce" + Flow { + id: positioner + move: Transition { + NumberAnimation { + properties: "x,y" + ease: "easeOutBounce" + } } } -} \endqml + \sa add, {declarative/positioners}{Positioners example} */ /*! \qmlproperty int Flow::spacing @@ -986,6 +1037,7 @@ Flow { spacing is the amount in pixels left empty between each adjacent item, and defaults to 0. + \sa Grid::spacing */ class QDeclarativeFlowPrivate : public QDeclarativeBasePositionerPrivate diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index 4a951a2..c4052bb 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -78,9 +78,9 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() The following Repeater creates three instances of a \l Rectangle item within a \l Row: - \snippet doc/src/snippets/declarative/repeater.qml import + \snippet doc/src/snippets/declarative/repeaters/repeater.qml import \codeline - \snippet doc/src/snippets/declarative/repeater.qml simple + \snippet doc/src/snippets/declarative/repeaters/repeater.qml simple \image repeater-simple.png @@ -92,7 +92,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() a Repeater to be used inside a layout. For example, the following Repeater's items are stacked between a red rectangle and a blue rectangle: - \snippet doc/src/snippets/declarative/repeater.qml layout + \snippet doc/src/snippets/declarative/repeaters/repeater.qml layout \image repeater.png @@ -106,7 +106,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() \table \row - \o \snippet doc/src/snippets/declarative/repeater.qml index + \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml index \o \image repeater-index.png \endtable @@ -115,7 +115,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() \table \row - \o \snippet doc/src/snippets/declarative/repeater.qml modeldata + \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml modeldata \o \image repeater-modeldata.png \endtable -- cgit v0.12 From 2cac8ca88c9b5b2f9d3040b1543d88ecee52da99 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 27 Aug 2010 18:27:50 +0200 Subject: Doc: Fixed links and markup. --- doc/src/getting-started/gettingstartedqml.qdoc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc index a19d281..771f92e 100644 --- a/doc/src/getting-started/gettingstartedqml.qdoc +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -820,11 +820,11 @@ The \c files list property is a list of all the filtered files in a directory. The \c Directory class is implemented to filter out invalid text files; only - files with a \c .txt extension are valid. Further, \l {QLists}{QLists} can be - used in QML files by declaring them as a \c QDeclarativeListProperty in C++. - The templated object needs to inherit from a \l {QObject}{QObject}, therefore, - the \c File class must also inherit from \c QObject. In the \c Directory class, - the list of \c File objects is stored in a \c QList called \c m_fileList. + files with a \c .txt extension are valid. Further, \l{QList}s can be + used in QML files by declaring them as a QDeclarativeListProperty in C++. + The templated object needs to inherit from a QObject, therefore, + the \c File class must also inherit from QObject. In the \c Directory class, + the list of \c File objects is stored in a QList called \c m_fileList. \code class File : public QObject{ -- cgit v0.12 From 2e8419e43ce4d5be64bddf1b5b5f5ea9e28c55de Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Sep 2010 12:32:07 +0200 Subject: Doc: More work on QML documentation and snippets. --- doc/src/images/qml-flow-snippet.png | Bin 10385 -> 11465 bytes doc/src/images/qml-flow-text1.png | Bin 0 -> 9647 bytes doc/src/images/qml-flow-text2.png | Bin 0 -> 10870 bytes doc/src/snippets/declarative/flow-diagram.qml | 75 +++++++++++++++++++++ doc/src/snippets/declarative/flow.qml | 4 +- doc/src/snippets/declarative/grid/grid-spacing.qml | 2 + .../graphicsitems/qdeclarativepositioners.cpp | 11 +-- 7 files changed, 86 insertions(+), 6 deletions(-) create mode 100644 doc/src/images/qml-flow-text1.png create mode 100644 doc/src/images/qml-flow-text2.png create mode 100644 doc/src/snippets/declarative/flow-diagram.qml diff --git a/doc/src/images/qml-flow-snippet.png b/doc/src/images/qml-flow-snippet.png index 1a2af4b..af873d1 100644 Binary files a/doc/src/images/qml-flow-snippet.png and b/doc/src/images/qml-flow-snippet.png differ diff --git a/doc/src/images/qml-flow-text1.png b/doc/src/images/qml-flow-text1.png new file mode 100644 index 0000000..99ce752 Binary files /dev/null and b/doc/src/images/qml-flow-text1.png differ diff --git a/doc/src/images/qml-flow-text2.png b/doc/src/images/qml-flow-text2.png new file mode 100644 index 0000000..844e0de Binary files /dev/null and b/doc/src/images/qml-flow-text2.png differ diff --git a/doc/src/snippets/declarative/flow-diagram.qml b/doc/src/snippets/declarative/flow-diagram.qml new file mode 100644 index 0000000..80506b9 --- /dev/null +++ b/doc/src/snippets/declarative/flow-diagram.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** 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 { + color: "lightblue" + width: 300; height: 200 + +//! [flow item] + Flow { + anchors.fill: parent + anchors.margins: 4 + spacing: 10 + + Repeater { + id: repeater + model: { + var strings = ["Text", "items", "flowing", "inside", "a", + "Flow", "item"]; + strings; + } + + Rectangle { + color: "white" + width: textItem.width + 4 + height: textItem.height + 4 + Text { + id: textItem + anchors.horizontalCenter: parent.horizontalCenter + text: repeater.model[index] + font.pixelSize: 40 + } + } + } + } +//! [flow item] +} diff --git a/doc/src/snippets/declarative/flow.qml b/doc/src/snippets/declarative/flow.qml index c5fbc90..77db683 100644 --- a/doc/src/snippets/declarative/flow.qml +++ b/doc/src/snippets/declarative/flow.qml @@ -38,6 +38,7 @@ ** ****************************************************************************/ +//! [document] import Qt 4.7 Rectangle { @@ -53,10 +54,11 @@ Rectangle { Text { text: "Text"; font.pixelSize: 40 } Text { text: "items"; font.pixelSize: 40 } Text { text: "flowing"; font.pixelSize: 40 } - Text { text: "in"; font.pixelSize: 40 } + Text { text: "inside"; font.pixelSize: 40 } Text { text: "a"; font.pixelSize: 40 } Text { text: "Flow"; font.pixelSize: 40 } Text { text: "item"; font.pixelSize: 40 } } //! [flow item] } +//! [document] diff --git a/doc/src/snippets/declarative/grid/grid-spacing.qml b/doc/src/snippets/declarative/grid/grid-spacing.qml index 5099758..8715977 100644 --- a/doc/src/snippets/declarative/grid/grid-spacing.qml +++ b/doc/src/snippets/declarative/grid/grid-spacing.qml @@ -38,6 +38,7 @@ ** ****************************************************************************/ +//! [document] import Qt 4.7 Rectangle { @@ -56,3 +57,4 @@ Rectangle { Rectangle { color: "#6666aa"; width: 50; height: 50 } } } +//! [document] diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index b653282..149e822 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -649,13 +649,14 @@ void QDeclarativeRow::reportConflictingAnchors() The Grid item positions its child items so that they are aligned in a grid and are not overlapping. + The grid positioner calculates a grid of rectangular cells of sufficient + size to hold all items, placing the items in the cells, from left to right + and top to bottom. Each item is positioned in the top-left corner of its + cell with position (0, 0). + A Grid defaults to four columns, and as many rows as are necessary to fit all child items. The number of rows and columns can be constrained - by setting the \l rows and \l columns properties. The grid positioner - calculates a grid of rectangular cells of sufficient size to hold all - items, placing the items in the cells, from left to right and top to - bottom. Each item is positioned in the top-left corner of its cell - with position (0, 0). + by setting the \l rows and \l columns properties. Spacing can be added between child items by setting the \l spacing property. The amount of spacing applied will be the same in the -- cgit v0.12 From 431cde6aa40a017abc1bfd52b2340e5b1d62d36c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Sep 2010 18:39:29 +0200 Subject: Doc: Fixed autotest breakage caused by snippets. --- .../snippets/declarative/qml-intro/anchors1.qml | 2 +- .../snippets/declarative/qml-intro/anchors2.qml | 2 +- .../snippets/declarative/qml-intro/anchors3.qml | 2 +- .../declarative/qml-intro/basic-syntax.qml | 6 +- .../declarative/qml-intro/hello-world4.qml | 2 +- .../declarative/qml-intro/hello-world5.qml | 2 +- .../declarative/qml-intro/images/qt-logo.svg | 104 +++++++++++++++++++++ .../declarative/qml-intro/number-animation1.qml | 2 +- .../declarative/qml-intro/number-animation2.qml | 2 +- .../qml-intro/sequential-animation1.qml | 4 +- .../qml-intro/sequential-animation2.qml | 4 +- .../qml-intro/sequential-animation3.qml | 6 +- .../declarative/qml-intro/transformations1.qml | 2 +- 13 files changed, 124 insertions(+), 16 deletions(-) create mode 100644 doc/src/snippets/declarative/qml-intro/images/qt-logo.svg diff --git a/doc/src/snippets/declarative/qml-intro/anchors1.qml b/doc/src/snippets/declarative/qml-intro/anchors1.qml index 09ef3b2..c1158b8 100644 --- a/doc/src/snippets/declarative/qml-intro/anchors1.qml +++ b/doc/src/snippets/declarative/qml-intro/anchors1.qml @@ -48,7 +48,7 @@ Rectangle { Image { id: image1 - source: "images/qt-logo.png" + source: "images/qt-logo.svg" width: 150; height: 150 anchors.bottom: myWin.bottom } diff --git a/doc/src/snippets/declarative/qml-intro/anchors2.qml b/doc/src/snippets/declarative/qml-intro/anchors2.qml index ef0ec1f..a7d4922 100644 --- a/doc/src/snippets/declarative/qml-intro/anchors2.qml +++ b/doc/src/snippets/declarative/qml-intro/anchors2.qml @@ -48,7 +48,7 @@ Rectangle { Image { id: image1 - source: "images/qt-logo.png" + source: "images/qt-logo.svg" width: 150; height: 150 anchors.bottom: myWin.bottom anchors.horizontalCenter: myWin.horizontalCenter diff --git a/doc/src/snippets/declarative/qml-intro/anchors3.qml b/doc/src/snippets/declarative/qml-intro/anchors3.qml index 008ad1a..a2e0f03 100644 --- a/doc/src/snippets/declarative/qml-intro/anchors3.qml +++ b/doc/src/snippets/declarative/qml-intro/anchors3.qml @@ -47,7 +47,7 @@ Rectangle { Image { id: image1 - source: "images/qt-logo.png" + source: "images/qt-logo.svg" width: 150; height: 150 anchors.bottom: myWin.bottom anchors.horizontalCenter: myWin.horizontalCenter diff --git a/doc/src/snippets/declarative/qml-intro/basic-syntax.qml b/doc/src/snippets/declarative/qml-intro/basic-syntax.qml index 686a927..0a7d5f8 100644 --- a/doc/src/snippets/declarative/qml-intro/basic-syntax.qml +++ b/doc/src/snippets/declarative/qml-intro/basic-syntax.qml @@ -40,9 +40,11 @@ // Note: this file is not intended to be run. +import Qt 4.7 + //! [basic syntax] -SomeElement { +Item { id: myObject - ... some other things here ... + // ... some other things here ... } //! [basic syntax] diff --git a/doc/src/snippets/declarative/qml-intro/hello-world4.qml b/doc/src/snippets/declarative/qml-intro/hello-world4.qml index c18fe15..9656ff8 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world4.qml +++ b/doc/src/snippets/declarative/qml-intro/hello-world4.qml @@ -53,7 +53,7 @@ Rectangle { //! [added an image] Image { - source: "images/qt-logo.png" + source: "images/qt-logo.svg" } //! [added an image] diff --git a/doc/src/snippets/declarative/qml-intro/hello-world5.qml b/doc/src/snippets/declarative/qml-intro/hello-world5.qml index bde8dc3..b816e09 100644 --- a/doc/src/snippets/declarative/qml-intro/hello-world5.qml +++ b/doc/src/snippets/declarative/qml-intro/hello-world5.qml @@ -54,7 +54,7 @@ Rectangle { //! [positioning the image] Image { - source: "images/qt-logo.png" + source: "images/qt-logo.svg" x: 100; y: 150 width: 150; height: 150 } diff --git a/doc/src/snippets/declarative/qml-intro/images/qt-logo.svg b/doc/src/snippets/declarative/qml-intro/images/qt-logo.svg new file mode 100644 index 0000000..8c018be --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/images/qt-logo.svg @@ -0,0 +1,104 @@ + + + + + + image/svg+xml + + + + + + SVG generated by Lineform + + + + + + + + + + + + + + + diff --git a/doc/src/snippets/declarative/qml-intro/number-animation1.qml b/doc/src/snippets/declarative/qml-intro/number-animation1.qml index 8d8d747..7b405e4 100644 --- a/doc/src/snippets/declarative/qml-intro/number-animation1.qml +++ b/doc/src/snippets/declarative/qml-intro/number-animation1.qml @@ -48,7 +48,7 @@ Rectangle { Image { id: image1 - source: "images/qt-logo.png" + source: "images/qt-logo.svg" x: 200; y: 100 width: 100; height: 100 diff --git a/doc/src/snippets/declarative/qml-intro/number-animation2.qml b/doc/src/snippets/declarative/qml-intro/number-animation2.qml index d556c21..f109f76 100644 --- a/doc/src/snippets/declarative/qml-intro/number-animation2.qml +++ b/doc/src/snippets/declarative/qml-intro/number-animation2.qml @@ -48,7 +48,7 @@ Rectangle { Image { id: image1 - source: "images/qt-logo.png" + source: "images/qt-logo.svg" x: 200; y: 100 width: 100; height: 100 diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml index e68de20..7ae2fde 100644 --- a/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation1.qml @@ -49,14 +49,14 @@ Rectangle { Image { id: image1 - source: "images/qt-logo.png" + source: "images/qt-logo.svg" x: 20; y: 20 ; z: 1 width: 100; height: 100 } Image { id: image2 - source: "images/qt-logo.png" + source: "images/qt-logo.svg" width: 100; height: 100 x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 z: 2 diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml index 31835a1..ac0f3f5 100644 --- a/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation2.qml @@ -49,7 +49,7 @@ Rectangle { //! [adding a sequential animation] Image { id: image1 - source: "images/qt-logo.png" + source: "images/qt-logo.svg" width: 100; height: 100 SequentialAnimation on x { @@ -65,7 +65,7 @@ Rectangle { Image { id: image2 - source: "images/qt-logo.png" + source: "images/qt-logo.svg" width: 100; height: 100 x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 z: 2 diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml index f83a966..1037b79 100644 --- a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml +++ b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml @@ -38,6 +38,8 @@ ** ****************************************************************************/ +import Qt 4.7 + //! [document] Rectangle { id: mainRec @@ -47,7 +49,7 @@ Rectangle { Image { id: image2 - source: "images/qt-logo.png" + source: "images/qt-logo.svg" width: 100; height: 100 x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 z: 2 @@ -55,7 +57,7 @@ Rectangle { Image { id: image1 - source: "images/qt-logo.png" + source: "images/qt-logo.svg" x: 20; y: 20 ; z: 1 width: 100; height: 100 diff --git a/doc/src/snippets/declarative/qml-intro/transformations1.qml b/doc/src/snippets/declarative/qml-intro/transformations1.qml index af39e69..b4a1692 100644 --- a/doc/src/snippets/declarative/qml-intro/transformations1.qml +++ b/doc/src/snippets/declarative/qml-intro/transformations1.qml @@ -48,7 +48,7 @@ Rectangle { Image { id: image1 - source: "images/qt-logo.png" + source: "images/qt-logo.svg" width: 150; height: 150 anchors.bottom: myWin.bottom anchors.horizontalCenter: myWin.horizontalCenter -- cgit v0.12 From b38fa28a246bd039593bff732ea7c195dc7e5af9 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Sep 2010 19:00:45 +0200 Subject: Doc: Added types to method and signal documentation; other fixes. --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 74 +++++++++++----------- .../graphicsitems/qdeclarativemousearea.cpp | 10 +-- src/declarative/graphicsitems/qdeclarativetext.cpp | 2 +- .../graphicsitems/qdeclarativetextedit.cpp | 4 +- src/declarative/qml/qdeclarativecomponent.cpp | 2 +- src/declarative/qml/qdeclarativeengine.cpp | 4 +- src/declarative/qml/qdeclarativeinclude.cpp | 2 +- src/declarative/qml/qdeclarativetypeloader.cpp | 9 +++ 8 files changed, 58 insertions(+), 49 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index aca2bb7..11f9179 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -830,259 +830,259 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event, bool post) */ /*! - \qmlsignal Keys::onPressed(event) + \qmlsignal Keys::onPressed(KeyEvent event) This handler is called when a key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onReleased(event) + \qmlsignal Keys::onReleased(KeyEvent event) This handler is called when a key has been released. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit0Pressed(event) + \qmlsignal Keys::onDigit0Pressed(KeyEvent event) This handler is called when the digit '0' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit1Pressed(event) + \qmlsignal Keys::onDigit1Pressed(KeyEvent event) This handler is called when the digit '1' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit2Pressed(event) + \qmlsignal Keys::onDigit2Pressed(KeyEvent event) This handler is called when the digit '2' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit3Pressed(event) + \qmlsignal Keys::onDigit3Pressed(KeyEvent event) This handler is called when the digit '3' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit4Pressed(event) + \qmlsignal Keys::onDigit4Pressed(KeyEvent event) This handler is called when the digit '4' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit5Pressed(event) + \qmlsignal Keys::onDigit5Pressed(KeyEvent event) This handler is called when the digit '5' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit6Pressed(event) + \qmlsignal Keys::onDigit6Pressed(KeyEvent event) This handler is called when the digit '6' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit7Pressed(event) + \qmlsignal Keys::onDigit7Pressed(KeyEvent event) This handler is called when the digit '7' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit8Pressed(event) + \qmlsignal Keys::onDigit8Pressed(KeyEvent event) This handler is called when the digit '8' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDigit9Pressed(event) + \qmlsignal Keys::onDigit9Pressed(KeyEvent event) This handler is called when the digit '9' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onLeftPressed(event) + \qmlsignal Keys::onLeftPressed(KeyEvent event) This handler is called when the Left arrow has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onRightPressed(event) + \qmlsignal Keys::onRightPressed(KeyEvent event) This handler is called when the Right arrow has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onUpPressed(event) + \qmlsignal Keys::onUpPressed(KeyEvent event) This handler is called when the Up arrow has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDownPressed(event) + \qmlsignal Keys::onDownPressed(KeyEvent event) This handler is called when the Down arrow has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onAsteriskPressed(event) + \qmlsignal Keys::onAsteriskPressed(KeyEvent event) This handler is called when the Asterisk '*' has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onEscapePressed(event) + \qmlsignal Keys::onEscapePressed(KeyEvent event) This handler is called when the Escape key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onReturnPressed(event) + \qmlsignal Keys::onReturnPressed(KeyEvent event) This handler is called when the Return key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onEnterPressed(event) + \qmlsignal Keys::onEnterPressed(KeyEvent event) This handler is called when the Enter key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onDeletePressed(event) + \qmlsignal Keys::onDeletePressed(KeyEvent event) This handler is called when the Delete key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onSpacePressed(event) + \qmlsignal Keys::onSpacePressed(KeyEvent event) This handler is called when the Space key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onBackPressed(event) + \qmlsignal Keys::onBackPressed(KeyEvent event) This handler is called when the Back key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onCancelPressed(event) + \qmlsignal Keys::onCancelPressed(KeyEvent event) This handler is called when the Cancel key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onSelectPressed(event) + \qmlsignal Keys::onSelectPressed(KeyEvent event) This handler is called when the Select key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onYesPressed(event) + \qmlsignal Keys::onYesPressed(KeyEvent event) This handler is called when the Yes key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onNoPressed(event) + \qmlsignal Keys::onNoPressed(KeyEvent event) This handler is called when the No key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onContext1Pressed(event) + \qmlsignal Keys::onContext1Pressed(KeyEvent event) This handler is called when the Context1 key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onContext2Pressed(event) + \qmlsignal Keys::onContext2Pressed(KeyEvent event) This handler is called when the Context2 key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onContext3Pressed(event) + \qmlsignal Keys::onContext3Pressed(KeyEvent event) This handler is called when the Context3 key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onContext4Pressed(event) + \qmlsignal Keys::onContext4Pressed(KeyEvent event) This handler is called when the Context4 key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onCallPressed(event) + \qmlsignal Keys::onCallPressed(KeyEvent event) This handler is called when the Call key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onHangupPressed(event) + \qmlsignal Keys::onHangupPressed(KeyEvent event) This handler is called when the Hangup key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onFlipPressed(event) + \qmlsignal Keys::onFlipPressed(KeyEvent event) This handler is called when the Flip key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onMenuPressed(event) + \qmlsignal Keys::onMenuPressed(KeyEvent event) This handler is called when the Menu key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onVolumeUpPressed(event) + \qmlsignal Keys::onVolumeUpPressed(KeyEvent event) This handler is called when the VolumeUp key has been pressed. The \a event parameter provides information about the event. */ /*! - \qmlsignal Keys::onVolumeDownPressed(event) + \qmlsignal Keys::onVolumeDownPressed(KeyEvent event) This handler is called when the VolumeDown key has been pressed. The \a event parameter provides information about the event. diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index ec01549..5516611 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -250,7 +250,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() */ /*! - \qmlsignal MouseArea::onClicked(mouse) + \qmlsignal MouseArea::onClicked(MouseEvent mouse) This handler is called when there is a click. A click is defined as a press followed by a release, both inside the MouseArea (pressing, moving outside the MouseArea, and then moving back inside and @@ -263,7 +263,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() */ /*! - \qmlsignal MouseArea::onPressed(mouse) + \qmlsignal MouseArea::onPressed(MouseEvent mouse) This handler is called when there is a press. The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y @@ -277,7 +277,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() */ /*! - \qmlsignal MouseArea::onReleased(mouse) + \qmlsignal MouseArea::onReleased(MouseEvent mouse) This handler is called when there is a release. The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y @@ -287,7 +287,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() */ /*! - \qmlsignal MouseArea::onPressAndHold(mouse) + \qmlsignal MouseArea::onPressAndHold(MouseEvent mouse) This handler is called when there is a long press (currently 800ms). The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y @@ -297,7 +297,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() */ /*! - \qmlsignal MouseArea::onDoubleClicked(mouse) + \qmlsignal MouseArea::onDoubleClicked(MouseEvent mouse) This handler is called when there is a double-click (a press followed by a release followed by a press). The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index f16af88..fd3a1f7 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -1205,7 +1205,7 @@ void QDeclarativeText::mousePressEvent(QGraphicsSceneMouseEvent *event) } /*! - \qmlsignal Text::onLinkActivated(link) + \qmlsignal Text::onLinkActivated(string link) This handler is called when the user clicks on a link embedded in the text. */ diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index b1c0fcd..3ac095c 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -555,7 +555,7 @@ QRectF QDeclarativeTextEdit::positionToRectangle(int pos) const } /*! - \qmlmethod int TextEdit::positionAt(x,y) + \qmlmethod int TextEdit::positionAt(int x, int y) Returns the text position closest to pixel position (\a x, \a y). @@ -1018,7 +1018,7 @@ void QDeclarativeTextEdit::selectWord() } /*! - \qmlmethod void TextEdit::select(start,end) + \qmlmethod void TextEdit::select(int start, int end) Causes the text from \a start to \a end to be selected. diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 75bb5db..73d4d2e 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -573,7 +573,7 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q } /*! - \qmlmethod object Component::createObject(parent) + \qmlmethod object Component::createObject(Item parent) Creates and returns an object instance of this component that will have the given \a parent. Returns null if object creation fails. diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 8461368..82188df 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -272,8 +272,8 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e) } /*! - \qmlmethod url Qt::resolvedUrl(url) - Returns \c url resolved relative to the URL of the caller. + \qmlmethod url Qt::resolvedUrl(url url) + Returns \a url resolved relative to the URL of the caller. */ QUrl QDeclarativeScriptEngine::resolvedUrl(QScriptContext *context, const QUrl& url) { diff --git a/src/declarative/qml/qdeclarativeinclude.cpp b/src/declarative/qml/qdeclarativeinclude.cpp index f26b54f..1e240d7 100644 --- a/src/declarative/qml/qdeclarativeinclude.cpp +++ b/src/declarative/qml/qdeclarativeinclude.cpp @@ -173,7 +173,7 @@ void QDeclarativeInclude::callback(QScriptEngine *engine, QScriptValue &callback } /*! -\qmlmethod object Qt::include(url, callback) +\qmlmethod object Qt::include(string url, jsobject callback) Include another JavaScript file. This method can only be used from within JavaScript files, and not regular QML files. diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp index 8c291f2..ed41314 100644 --- a/src/declarative/qml/qdeclarativetypeloader.cpp +++ b/src/declarative/qml/qdeclarativetypeloader.cpp @@ -65,6 +65,9 @@ The QDeclarativeDataLoader invokes callbacks on the QDeclarativeDataBlob as data /*! \enum QDeclarativeDataBlob::Status +This enum describes the status of the data blob. + +\list \o Null The blob has not yet been loaded by a QDeclarativeDataLoader \o Loading The blob is loading network data. The QDeclarativeDataBlob::setData() callback has not yet been invoked or has not yet returned. @@ -73,13 +76,19 @@ only occurs after the QDeclarativeDataBlob::setData() callback has been made, an dependencies. \o Complete The blob's data has been loaded and all dependencies are done. \o Error An error has been set on this blob. +\endlist */ /*! \enum QDeclarativeDataBlob::Type + +This enum describes the type of the data blob. + +\list \o QmlFile This is a QDeclarativeTypeData \o JavaScriptFile This is a QDeclarativeScriptData \o QmldirFile This is a QDeclarativeQmldirData +\endlist */ /*! -- cgit v0.12 From aacf7c5a8b98f0dd4039d7f7a9d0471c32034a3b Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 2 Sep 2010 19:12:27 +0200 Subject: Doc: qdoc fixes. --- doc/src/getting-started/gettingstartedqml.qdoc | 4 ++-- src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp | 8 ++++---- src/declarative/graphicsitems/qdeclarativelistview.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc index 771f92e..9e6471e 100644 --- a/doc/src/getting-started/gettingstartedqml.qdoc +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -296,8 +296,8 @@ \section2 Using Data Models and Views - QML has different \l {Data Models}{data views} that display - \l {Data Models}{data models}. Our menu bar will display the menus in a list, + QML has different \l{QML Data Models}{data views} that display + \l{QML Data Models}{data models}. Our menu bar will display the menus in a list, with a header that displays a row of menu names. The list of menus are declared inside a \c VisualItemModel. The \l{VisualItemModel}{\c VisualItemModel} element contains items that already have views such as \c Rectangle elements diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp index c1ca23d..1538133 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -389,7 +389,7 @@ void QDeclarativeWebView::setPreferredHeight(int height) } /*! - \qmlmethod bool WebView::evaluateJavaScript(string) + \qmlmethod bool WebView::evaluateJavaScript(string scriptSource) Evaluates the \a scriptSource JavaScript inside the context of the main web frame, and returns the result of the last executed statement. @@ -513,14 +513,14 @@ void QDeclarativeWebView::setRenderingEnabled(bool enabled) } /*! - \qmlsignal WebView::onDoubleClick(clickx, clicky) + \qmlsignal WebView::onDoubleClick(int clickx, int clicky) The WebView does not pass double-click events to the web engine, but rather emits this signals. */ /*! - \qmlmethod bool WebView::heuristicZoom(clickX,clickY,maxzoom) + \qmlmethod bool WebView::heuristicZoom(int clickX, int clickY, real maxzoom) Finds a zoom that: \list @@ -976,7 +976,7 @@ QString QDeclarativeWebPage::chooseFile(QWebFrame* originatingFrame, const QStri } /*! - \qmlsignal WebView::onAlert(message) + \qmlsignal WebView::onAlert(string message) The handler is called when the web engine sends a JavaScript alert. The \a message is the text to be displayed in the alert to the user. diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index ef28ab2..412a5f7 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1405,7 +1405,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m to set \e {clip: true} in order to have the out of view items clipped nicely. - \sa {Data Models}, GridView, {declarative/modelviews/listview}{ListView examples} + \sa {QML Data Models}, GridView, {declarative/modelviews/listview}{ListView examples} */ QDeclarativeListView::QDeclarativeListView(QDeclarativeItem *parent) -- cgit v0.12 From 5cfc65d04858563e53987b224f36ee71356aa73c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 6 Sep 2010 13:22:39 +0200 Subject: Doc: Worked on two more elements, replacing an image. --- doc/src/declarative/pics/flipable.gif | Bin 80659 -> 131710 bytes doc/src/declarative/qml-intro.qdoc | 4 +- doc/src/snippets/declarative/flipable.qml | 77 ----------------- doc/src/snippets/declarative/flipable/flipable.qml | 77 +++++++++++++++++ .../graphicsitems/qdeclarativeflipable.cpp | 29 ++++--- .../qdeclarativefolderlistmodel.cpp | 96 +++++++++++++++------ 6 files changed, 170 insertions(+), 113 deletions(-) delete mode 100644 doc/src/snippets/declarative/flipable.qml create mode 100644 doc/src/snippets/declarative/flipable/flipable.qml diff --git a/doc/src/declarative/pics/flipable.gif b/doc/src/declarative/pics/flipable.gif index 6386f06..da37b2b 100644 Binary files a/doc/src/declarative/pics/flipable.gif and b/doc/src/declarative/pics/flipable.gif differ diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc index 9130be0..d735042 100644 --- a/doc/src/declarative/qml-intro.qdoc +++ b/doc/src/declarative/qml-intro.qdoc @@ -58,12 +58,12 @@ would be a property. The basic syntax of an \l{QML Elements}{element} is -\code +\qml SomeElement { id: myObject ... some other things here ... } -\endcode +\endqml Here we are defining a new object. We specify its 'type' first as SomeElement. Then within matching braces { ... } we specify the various parts of our diff --git a/doc/src/snippets/declarative/flipable.qml b/doc/src/snippets/declarative/flipable.qml deleted file mode 100644 index c2ecbbe..0000000 --- a/doc/src/snippets/declarative/flipable.qml +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ - -//! [0] -import Qt 4.7 - -Flipable { - id: flipable - width: 240 - height: 240 - - property int angle: 0 - property bool flipped: false - - front: Image { source: "front.png" } - back: Image { source: "back.png" } - - transform: Rotation { - origin.x: flipable.width/2; origin.y: flipable.height/2 - axis.x: 0; axis.y: 1; axis.z: 0 // rotate around y-axis - angle: flipable.angle - } - - states: State { - name: "back" - PropertyChanges { target: flipable; angle: 180 } - when: flipable.flipped - } - - transitions: Transition { - NumberAnimation { properties: "angle"; duration: 1000 } - } - - MouseArea { - anchors.fill: parent - onClicked: flipable.flipped = !flipable.flipped - } -} -//! [0] - diff --git a/doc/src/snippets/declarative/flipable/flipable.qml b/doc/src/snippets/declarative/flipable/flipable.qml new file mode 100644 index 0000000..c2ecbbe --- /dev/null +++ b/doc/src/snippets/declarative/flipable/flipable.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +import Qt 4.7 + +Flipable { + id: flipable + width: 240 + height: 240 + + property int angle: 0 + property bool flipped: false + + front: Image { source: "front.png" } + back: Image { source: "back.png" } + + transform: Rotation { + origin.x: flipable.width/2; origin.y: flipable.height/2 + axis.x: 0; axis.y: 1; axis.z: 0 // rotate around y-axis + angle: flipable.angle + } + + states: State { + name: "back" + PropertyChanges { target: flipable; angle: 180 } + when: flipable.flipped + } + + transitions: Transition { + NumberAnimation { properties: "angle"; duration: 1000 } + } + + MouseArea { + anchors.fill: parent + onClicked: flipable.flipped = !flipable.flipped + } +} +//! [0] + diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index 69dd66a..4ecf87b 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -71,31 +71,40 @@ public: \qmlclass Flipable QDeclarativeFlipable \since 4.7 \ingroup qml-basic-interaction-elements - \brief The Flipable item provides a surface that can be flipped. \inherits Item Flipable is an item that can be visibly "flipped" between its front and - back sides. It is used together with \l Rotation and \l {State}/\l {Transition} to - produce a flipping effect. + back sides, like a card. It is used together with \l Rotation, \l State + and \l Transition elements to produce a flipping effect. + + The \l front and \l back properties are used to hold the items that are + shown respectively on the front and back sides of the flipable item. - Here is a Flipable that flips whenever it is clicked: + \section1 Example Usage - \snippet doc/src/snippets/declarative/flipable.qml 0 + \beginfloatright + \inlineimage flipable.gif + \endfloat - \image flipable.gif + The following example shows a Flipable item that flips whenever it is + clicked, rotating about the y-axis. The \l Rotation element is used to specify the angle and axis of the flip. - When \c flipped is \c true, the item changes to the "back" state, where + When \c flipped is true, the item changes to the "back" state, where the angle is changed to 180 degrees to produce the flipping effect. - Finally, the \l Transition creates the animation that changes the - angle over one second: when the item changes between its "back" and + + \clearfloat + \snippet doc/src/snippets/declarative/flipable/flipable-snippet.qml 0 + + The \l Transition creates the animation that changes the angle over the + duration of one second. When the item changes between its "back" and default states, the NumberAnimation animates the angle between its old and new values. See the \l {QML States} and \l {QML Animation} documentation for more details on state changes and how animations work within transitions. - + \sa {declarative/ui-components/flipable}{Flipable example} */ diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp index 6c38911..4983840 100644 --- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp +++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp @@ -95,30 +95,61 @@ public: /*! \qmlclass FolderListModel QDeclarativeFolderListModel \ingroup qml-working-with-data - \brief The FolderListModel provides a model of the contents of a folder in a filesystem. + \brief The FolderListModel provides a model of the contents of a file system folder. - FolderListModel provides access to the local filesystem. The \e folder property - specifies the folder to list. + FolderListModel provides access to information about the contents of a folder + in the local file system, exposing a list of files to views and other data components. - Qt uses "/" as a universal directory separator in the same way that "/" is - used as a path separator in URLs. If you always use "/" as a directory - separator, Qt will translate your paths to conform to the underlying - operating system. - - This type is made available by importing the \c Qt.labs.folderlistmodel module. - \e {Elements in the Qt.labs module are not guaranteed to remain compatible + \note This type is made available by importing the \c Qt.labs.folderlistmodel module. + \e{Elements in the Qt.labs module are not guaranteed to remain compatible in future versions.} \bold{import Qt.labs.folderlistmodel 1.0} - The roles available are: + The \l folder property specifies the folder to access. Information about the + files and directories in the folder is supplied via the model's interface. + Components access names and paths via the following roles: + \list \o fileName \o filePath \endlist - Additionally a file entry can be differentiated from a folder entry - via the \l isFolder() method. + Additionally a file entry can be differentiated from a folder entry via the + isFolder() method. + + \section1 Filtering + + Various properties can be set to filter the number of files and directories + exposed by the model. + + The \l nameFilters property can be set to contain a list of wildcard filters + that are applied to names of files and directories, causing only those that + match the filters to be exposed. + + Directories can be included or excluded using the \l showDirs property, and + navigation directories can also be excluded by setting the \l showDotAndDotDot + property to false. + + It is sometimes useful to limit the files and directories exposed to those + that the user can access. The \l showOnlyReadable property can be set to + enable this feature. + + \section1 Example Usage + + The following example shows a FolderListModel being used to provide a list + of QML files in a \l ListView: + + \snippet doc/src/snippets/declarative/folderlistmodel.qml 0 + + \section1 Path Separators + + Qt uses "/" as a universal directory separator in the same way that "/" is + used as a path separator in URLs. If you always use "/" as a directory + separator, Qt will translate your paths to conform to the underlying + operating system. + + \sa {QML Data Models} */ QDeclarativeFolderListModel::QDeclarativeFolderListModel(QObject *parent) @@ -168,9 +199,13 @@ int QDeclarativeFolderListModel::rowCount(const QModelIndex &parent) const /*! \qmlproperty string FolderListModel::folder - The \a folder property holds the folder the model is currently providing. + The \a folder property holds a URL for the folder that the model is + currently providing. - It is a URL, but must be a file: or qrc: URL (or relative to such a URL). + The value is a URL expressed as a string, and must be a \c file: or \c qrc: + URL, or a relative URL. + + By default, the value is an invalid URL. */ QUrl QDeclarativeFolderListModel::folder() const { @@ -214,16 +249,18 @@ QUrl QDeclarativeFolderListModel::parentFolder() const /*! \qmlproperty list FolderListModel::nameFilters - The \a nameFilters property contains a list of filename filters. + The \a nameFilters property contains a list of file name filters. The filters may include the ? and * wildcards. The example below filters on PNG and JPEG files: - \code + \qml FolderListModel { nameFilters: [ "*.png", "*.jpg" ] } - \endcode + \endqml + + \note Directories are not excluded by filters. */ QStringList QDeclarativeFolderListModel::nameFilters() const { @@ -335,9 +372,14 @@ void QDeclarativeFolderListModel::dataChanged(const QModelIndex &start, const QM /*! \qmlproperty bool FolderListModel::showDirs - If true (the default), directories are included in the model. + If true, directories are included in the model; otherwise only files + are included. + + By default, this property is true. - Note that the nameFilters are ignored for directories. + Note that the nameFilters are not applied to directories. + + \sa showDotAndDotDot */ bool QDeclarativeFolderListModel::showDirs() const { @@ -357,9 +399,12 @@ void QDeclarativeFolderListModel::setShowDirs(bool on) /*! \qmlproperty bool FolderListModel::showDotAndDotDot - If true, the "." and ".." directories are included in the model. + If true, the "." and ".." directories are included in the model; otherwise + they are excluded. + + By default, this property is false. - The default is false. + \sa showDirs */ bool QDeclarativeFolderListModel::showDotAndDotDot() const { @@ -379,9 +424,12 @@ void QDeclarativeFolderListModel::setShowDotAndDotDot(bool on) /*! \qmlproperty bool FolderListModel::showOnlyReadable - If true, only readable files and directories are shown. + If true, only readable files and directories are shown; otherwise all files + and directories are shown. + + By default, this property is false. - The default is false. + \sa showDirs */ bool QDeclarativeFolderListModel::showOnlyReadable() const { -- cgit v0.12 From 5d4b7c1d3f7e8fb1ef84ffa102123ca267cb7eef Mon Sep 17 00:00:00 2001 From: Petri Kiiskinen Date: Wed, 4 Aug 2010 11:02:41 +0300 Subject: resolving method name does not work for Symbian so need to use ordinal instead Merge-request: 768 Signed-off-by: axis --- src/gui/kernel/qapplication.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 3d3a749..82dd83a 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -809,6 +809,12 @@ void QApplicationPrivate::construct( if (testLib.load()) { typedef void (*TasInitialize)(void); TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init"); +#ifdef Q_OS_SYMBIAN + // resolving method by name does not work on Symbian OS so need to use ordinal + if(!initFunction) { + initFunction = (TasInitialize)testLib.resolve("1"); + } +#endif if (initFunction) { initFunction(); } else { -- cgit v0.12 From 5360be909d8d5e8b3a3b6e391e80b86027d7f2a2 Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Tue, 7 Sep 2010 10:49:28 +0200 Subject: Make compile on gcce instead of friend use static to avoid gcce saying a formerly extern declaration turned into a static declaration. Reviewed-by: axis --- src/gui/image/qpixmap_s60.cpp | 11 +++++++---- src/gui/image/qpixmap_s60_p.h | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index dbdf0bc..68179d7 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -66,9 +66,10 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, static bool cleanup_function_registered = false; static QS60PixmapData *firstPixmap = 0; -static void qt_symbian_register_pixmap(QS60PixmapData *pd) +// static +void QS60PixmapData::qt_symbian_register_pixmap(QS60PixmapData *pd) { - if(!cleanup_function_registered) { + if (!cleanup_function_registered) { qAddPostRoutine(qt_symbian_release_pixmaps); cleanup_function_registered = true; } @@ -80,7 +81,8 @@ static void qt_symbian_register_pixmap(QS60PixmapData *pd) firstPixmap = pd; } -static void qt_symbian_unregister_pixmap(QS60PixmapData *pd) +// static +void QS60PixmapData::qt_symbian_unregister_pixmap(QS60PixmapData *pd) { if (pd->next) pd->next->prev = pd->prev; @@ -90,7 +92,8 @@ static void qt_symbian_unregister_pixmap(QS60PixmapData *pd) firstPixmap = pd->next; } -static void qt_symbian_release_pixmaps() +// static +void QS60PixmapData::qt_symbian_release_pixmaps() { // Scan all QS60PixmapData objects in the system and destroy them. QS60PixmapData *pd = firstPixmap; diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h index a82f5c2..12885ec 100644 --- a/src/gui/image/qpixmap_s60_p.h +++ b/src/gui/image/qpixmap_s60_p.h @@ -128,9 +128,9 @@ private: QS60PixmapData *next; QS60PixmapData *prev; - friend void qt_symbian_register_pixmap(QS60PixmapData *pd); - friend void qt_symbian_unregister_pixmap(QS60PixmapData *pd); - friend void qt_symbian_release_pixmaps(); + static void qt_symbian_register_pixmap(QS60PixmapData *pd); + static void qt_symbian_unregister_pixmap(QS60PixmapData *pd); + static void qt_symbian_release_pixmaps(); friend class QPixmap; friend class QS60WindowSurface; -- cgit v0.12 From cd8118835421d30ef37a29df5c2286282fb2f8ed Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Tue, 7 Sep 2010 10:51:55 +0200 Subject: Remove unused variable Reviewed-by: axis --- src/gui/image/qpixmap_s60.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 68179d7..47249d9 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -831,7 +831,6 @@ void* QS60PixmapData::toNativeType(NativeType type) bool convertToArgb32 = false; bool needsCopy = false; - QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion(); if (!(S60->supportsPremultipliedAlpha)) { // Convert argb32_premultiplied to argb32 since Symbian 9.2 does // not support premultipied format. -- cgit v0.12 From cd3b942217b5b1f13d5f666b0a7ac43d14b35950 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 7 Sep 2010 13:38:08 +0200 Subject: explicitly remove qt_webkit_version.pri when building with -no-webkit otherwise it would stay around from a possible previous build with webkit and confuse the heck out of the build system. Task-number: QTBUG-13459 --- configure | 1 + tools/configure/configureapp.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/configure b/configure index f2b6455..b796de9 100755 --- a/configure +++ b/configure @@ -7184,6 +7184,7 @@ if [ "$CFG_WEBKIT" = "yes" ]; then # The reason we set CFG_WEBKIT, is such that the printed overview of what will be enabled, shows correctly. CFG_WEBKIT="yes" else + rm -f "$outpath/mkspecs/modules/qt_webkit_version.pri" CFG_WEBKIT="no" QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_WEBKIT" fi diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 0d0729b..6e66742 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2681,11 +2681,11 @@ void Configure::generateOutputVars() qtConfig += "audio-backend"; } + QString dst = buildPath + "/mkspecs/modules/qt_webkit_version.pri"; + QFile::remove(dst); if (dictionary["WEBKIT"] == "yes") { // This include takes care of adding "webkit" to QT_CONFIG. QString src = sourcePath + "/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri"; - QString dst = buildPath + "/mkspecs/modules/qt_webkit_version.pri"; - QFile::remove(dst); QFile::copy(src, dst); } -- cgit v0.12 From 5c2f4332728904e86dca1c0846bab5a2fc429058 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 24 Aug 2010 14:47:41 +0200 Subject: Move QFileInfoPrivate methods to QFileInfoPrivate::Data (1st Round) Reviewed-by: Joao --- src/corelib/io/qfileinfo.cpp | 154 ++++++++++++++++++++++--------------------- src/corelib/io/qfileinfo_p.h | 25 ++++--- 2 files changed, 90 insertions(+), 89 deletions(-) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 61f7180..4671d8c 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -64,46 +64,45 @@ QFileInfoPrivate::~QFileInfoPrivate() data = 0; } -void QFileInfoPrivate::initFileEngine(const QString &file) +void QFileInfoPrivate::Data::initFileEngine(const QString &file) { - detach(); - delete data->fileEngine; - data->fileEngine = 0; - data->clear(); - data->fileEngine = QAbstractFileEngine::create(file); - data->fileName = file; + delete fileEngine; + fileEngine = 0; + clear(); + fileEngine = QAbstractFileEngine::create(file); + fileName = file; } -void QFileInfoPrivate::detach() +void QFileInfoPrivate::Data::detach(QFileInfoPrivate::Data *&data) { qAtomicDetach(data); } -QString QFileInfoPrivate::getFileName(QAbstractFileEngine::FileName name) const +QString QFileInfoPrivate::Data::getFileName(QAbstractFileEngine::FileName name) const { - if (data->cache_enabled && !data->fileNames[(int)name].isNull()) - return data->fileNames[(int)name]; - QString ret = data->fileEngine->fileName(name); + if (cache_enabled && !fileNames[(int)name].isNull()) + return fileNames[(int)name]; + QString ret = fileEngine->fileName(name); if (ret.isNull()) ret = QLatin1String(""); - if (data->cache_enabled) - data->fileNames[(int)name] = ret; + if (cache_enabled) + fileNames[(int)name] = ret; return ret; } -QString QFileInfoPrivate::getFileOwner(QAbstractFileEngine::FileOwner own) const +QString QFileInfoPrivate::Data::getFileOwner(QAbstractFileEngine::FileOwner own) const { - if (data->cache_enabled && !data->fileOwners[(int)own].isNull()) - return data->fileOwners[(int)own]; - QString ret = data->fileEngine->owner(own); + if (cache_enabled && !fileOwners[(int)own].isNull()) + return fileOwners[(int)own]; + QString ret = fileEngine->owner(own); if (ret.isNull()) ret = QLatin1String(""); - if (data->cache_enabled) - data->fileOwners[(int)own] = ret; + if (cache_enabled) + fileOwners[(int)own] = ret; return ret; } -uint QFileInfoPrivate::getFileFlags(QAbstractFileEngine::FileFlags request) const +uint QFileInfoPrivate::Data::getFileFlags(QAbstractFileEngine::FileFlags request) const { // We split the testing into tests for for LinkType, BundleType, PermsMask // and the rest. @@ -118,7 +117,7 @@ uint QFileInfoPrivate::getFileFlags(QAbstractFileEngine::FileFlags request) cons uint cachedFlags = 0; if (request & (QAbstractFileEngine::FlagsMask | QAbstractFileEngine::TypesMask)) { - if (!data->getCachedFlag(CachedFileFlags)) { + if (!getCachedFlag(CachedFileFlags)) { req |= QAbstractFileEngine::FlagsMask; req |= QAbstractFileEngine::TypesMask; req &= (~QAbstractFileEngine::LinkType); @@ -128,14 +127,14 @@ uint QFileInfoPrivate::getFileFlags(QAbstractFileEngine::FileFlags request) cons } if (request & QAbstractFileEngine::LinkType) { - if (!data->getCachedFlag(CachedLinkTypeFlag)) { + if (!getCachedFlag(CachedLinkTypeFlag)) { req |= QAbstractFileEngine::LinkType; cachedFlags |= CachedLinkTypeFlag; } } if (request & QAbstractFileEngine::BundleType) { - if (!data->getCachedFlag(CachedBundleTypeFlag)) { + if (!getCachedFlag(CachedBundleTypeFlag)) { req |= QAbstractFileEngine::BundleType; cachedFlags |= CachedBundleTypeFlag; } @@ -143,30 +142,30 @@ uint QFileInfoPrivate::getFileFlags(QAbstractFileEngine::FileFlags request) cons } if (request & QAbstractFileEngine::PermsMask) { - if (!data->getCachedFlag(CachedPerms)) { + if (!getCachedFlag(CachedPerms)) { req |= QAbstractFileEngine::PermsMask; cachedFlags |= CachedPerms; } } if (req) { - if (data->cache_enabled) + if (cache_enabled) req &= (~QAbstractFileEngine::Refresh); else req |= QAbstractFileEngine::Refresh; - QAbstractFileEngine::FileFlags flags = data->fileEngine->fileFlags(req); - data->fileFlags |= uint(flags); - data->setCachedFlag(cachedFlags); + QAbstractFileEngine::FileFlags flags = fileEngine->fileFlags(req); + fileFlags |= uint(flags); + setCachedFlag(cachedFlags); } - return data->fileFlags & request; + return fileFlags & request; } -QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request) const +QDateTime &QFileInfoPrivate::Data::getFileTime(QAbstractFileEngine::FileTime request) const { - if (!data->cache_enabled) - data->clearFlags(); + if (!cache_enabled) + clearFlags(); uint cf; if (request == QAbstractFileEngine::CreationTime) cf = CachedCTime; @@ -174,11 +173,11 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request) cf = CachedMTime; else cf = CachedATime; - if (!data->getCachedFlag(cf)) { - data->fileTimes[request] = data->fileEngine->fileTime(request); - data->setCachedFlag(cf); + if (!getCachedFlag(cf)) { + fileTimes[request] = fileEngine->fileTime(request); + setCachedFlag(cf); } - return data->fileTimes[request]; + return fileTimes[request]; } //************* QFileInfo @@ -287,7 +286,8 @@ QFileInfo::QFileInfo() : d_ptr(new QFileInfoPrivate()) */ QFileInfo::QFileInfo(const QString &file) : d_ptr(new QFileInfoPrivate()) { - d_ptr->initFileEngine(file); + QFileInfoPrivate::Data::detach(d_ptr->data); + d_ptr->data->initFileEngine(file); } /*! @@ -301,7 +301,8 @@ QFileInfo::QFileInfo(const QString &file) : d_ptr(new QFileInfoPrivate()) */ QFileInfo::QFileInfo(const QFile &file) : d_ptr(new QFileInfoPrivate()) { - d_ptr->initFileEngine(file.fileName()); + QFileInfoPrivate::Data::detach(d_ptr->data); + d_ptr->data->initFileEngine(file.fileName()); } /*! @@ -318,7 +319,8 @@ QFileInfo::QFileInfo(const QFile &file) : d_ptr(new QFileInfoPrivate()) */ QFileInfo::QFileInfo(const QDir &dir, const QString &file) : d_ptr(new QFileInfoPrivate()) { - d_ptr->initFileEngine(dir.filePath(file)); + QFileInfoPrivate::Data::detach(d_ptr->data); + d_ptr->data->initFileEngine(dir.filePath(file)); } /*! @@ -490,7 +492,7 @@ QString QFileInfo::absoluteFilePath() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QLatin1String(""); - return d->getFileName(QAbstractFileEngine::AbsoluteName); + return d->data->getFileName(QAbstractFileEngine::AbsoluteName); } /*! @@ -507,7 +509,7 @@ QString QFileInfo::canonicalFilePath() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QLatin1String(""); - return d->getFileName(QAbstractFileEngine::CanonicalName); + return d->data->getFileName(QAbstractFileEngine::CanonicalName); } @@ -538,7 +540,7 @@ QString QFileInfo::absolutePath() const qWarning("QFileInfo::absolutePath: Constructed with empty filename"); return QLatin1String(""); } - return d->getFileName(QAbstractFileEngine::AbsolutePathName); + return d->data->getFileName(QAbstractFileEngine::AbsolutePathName); } /*! @@ -554,7 +556,7 @@ QString QFileInfo::canonicalPath() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QLatin1String(""); - return d->getFileName(QAbstractFileEngine::CanonicalPathName); + return d->data->getFileName(QAbstractFileEngine::CanonicalPathName); } /*! @@ -571,7 +573,7 @@ QString QFileInfo::path() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QLatin1String(""); - return d->getFileName(QAbstractFileEngine::PathName); + return d->data->getFileName(QAbstractFileEngine::PathName); } /*! @@ -610,8 +612,9 @@ bool QFileInfo::makeAbsolute() Q_D(QFileInfo); if (!d->data->fileEngine || !d->data->fileEngine->isRelativePath()) return false; - QString absFileName = d->getFileName(QAbstractFileEngine::AbsoluteName); - d->initFileEngine(absFileName); + QString absFileName = d->data->getFileName(QAbstractFileEngine::AbsoluteName); + QFileInfoPrivate::Data::detach(d_ptr->data); + d->data->initFileEngine(absFileName); return true; } @@ -626,7 +629,7 @@ bool QFileInfo::exists() const Q_D(const QFileInfo); if (!d->data->fileEngine) return false; - return d->getFileFlags(QAbstractFileEngine::ExistsFlag); + return d->data->getFileFlags(QAbstractFileEngine::ExistsFlag); } /*! @@ -639,7 +642,8 @@ bool QFileInfo::exists() const void QFileInfo::refresh() { Q_D(QFileInfo); - d->reset(); + QFileInfoPrivate::Data::detach(d->data); + d->data->clear(); } /*! @@ -653,7 +657,7 @@ QString QFileInfo::filePath() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QLatin1String(""); - return d->getFileName(QAbstractFileEngine::DefaultName); + return d->data->getFileName(QAbstractFileEngine::DefaultName); } /*! @@ -672,7 +676,7 @@ QString QFileInfo::fileName() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QLatin1String(""); - return d->getFileName(QAbstractFileEngine::BaseName); + return d->data->getFileName(QAbstractFileEngine::BaseName); } /*! @@ -692,7 +696,7 @@ QString QFileInfo::bundleName() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QLatin1String(""); - return d->getFileName(QAbstractFileEngine::BundleName); + return d->data->getFileName(QAbstractFileEngine::BundleName); } /*! @@ -716,7 +720,7 @@ QString QFileInfo::baseName() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QLatin1String(""); - return d->getFileName(QAbstractFileEngine::BaseName).section(QLatin1Char('.'), 0, 0); + return d->data->getFileName(QAbstractFileEngine::BaseName).section(QLatin1Char('.'), 0, 0); } /*! @@ -735,7 +739,7 @@ QString QFileInfo::completeBaseName() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QLatin1String(""); - QString name = d->getFileName(QAbstractFileEngine::BaseName); + QString name = d->data->getFileName(QAbstractFileEngine::BaseName); int index = name.lastIndexOf(QLatin1Char('.')); return (index == -1) ? name : name.left(index); } @@ -756,7 +760,7 @@ QString QFileInfo::completeSuffix() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QLatin1String(""); - QString fileName = d->getFileName(QAbstractFileEngine::BaseName); + QString fileName = d->data->getFileName(QAbstractFileEngine::BaseName); int firstDot = fileName.indexOf(QLatin1Char('.')); if (firstDot == -1) return QLatin1String(""); @@ -783,7 +787,7 @@ QString QFileInfo::suffix() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QLatin1String(""); - QString fileName = d->getFileName(QAbstractFileEngine::BaseName); + QString fileName = d->data->getFileName(QAbstractFileEngine::BaseName); int lastDot = fileName.lastIndexOf(QLatin1Char('.')); if (lastDot == -1) return QLatin1String(""); @@ -848,7 +852,7 @@ bool QFileInfo::isReadable() const Q_D(const QFileInfo); if (!d->data->fileEngine) return false; - return d->getFileFlags(QAbstractFileEngine::ReadUserPerm); + return d->data->getFileFlags(QAbstractFileEngine::ReadUserPerm); } /*! @@ -861,7 +865,7 @@ bool QFileInfo::isWritable() const Q_D(const QFileInfo); if (!d->data->fileEngine) return false; - return d->getFileFlags(QAbstractFileEngine::WriteUserPerm); + return d->data->getFileFlags(QAbstractFileEngine::WriteUserPerm); } /*! @@ -874,7 +878,7 @@ bool QFileInfo::isExecutable() const Q_D(const QFileInfo); if (!d->data->fileEngine) return false; - return d->getFileFlags(QAbstractFileEngine::ExeUserPerm); + return d->data->getFileFlags(QAbstractFileEngine::ExeUserPerm); } /*! @@ -888,7 +892,7 @@ bool QFileInfo::isHidden() const Q_D(const QFileInfo); if (!d->data->fileEngine) return false; - return d->getFileFlags(QAbstractFileEngine::HiddenFlag); + return d->data->getFileFlags(QAbstractFileEngine::HiddenFlag); } /*! @@ -903,7 +907,7 @@ bool QFileInfo::isFile() const Q_D(const QFileInfo); if (!d->data->fileEngine) return false; - return d->getFileFlags(QAbstractFileEngine::FileType); + return d->data->getFileFlags(QAbstractFileEngine::FileType); } /*! @@ -917,7 +921,7 @@ bool QFileInfo::isDir() const Q_D(const QFileInfo); if (!d->data->fileEngine) return false; - return d->getFileFlags(QAbstractFileEngine::DirectoryType); + return d->data->getFileFlags(QAbstractFileEngine::DirectoryType); } @@ -933,7 +937,7 @@ bool QFileInfo::isBundle() const Q_D(const QFileInfo); if (!d->data->fileEngine) return false; - return d->getFileFlags(QAbstractFileEngine::BundleType); + return d->data->getFileFlags(QAbstractFileEngine::BundleType); } /*! @@ -958,7 +962,7 @@ bool QFileInfo::isSymLink() const Q_D(const QFileInfo); if (!d->data->fileEngine) return false; - return d->getFileFlags(QAbstractFileEngine::LinkType); + return d->data->getFileFlags(QAbstractFileEngine::LinkType); } /*! @@ -971,7 +975,7 @@ bool QFileInfo::isRoot() const Q_D(const QFileInfo); if (!d->data->fileEngine) return true; - return d->getFileFlags(QAbstractFileEngine::RootFlag); + return d->data->getFileFlags(QAbstractFileEngine::RootFlag); } /*! @@ -999,7 +1003,7 @@ QString QFileInfo::readLink() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QLatin1String(""); - return d->getFileName(QAbstractFileEngine::LinkName); + return d->data->getFileName(QAbstractFileEngine::LinkName); } /*! @@ -1017,7 +1021,7 @@ QString QFileInfo::owner() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QLatin1String(""); - return d->getFileOwner(QAbstractFileEngine::OwnerUser); + return d->data->getFileOwner(QAbstractFileEngine::OwnerUser); } /*! @@ -1051,7 +1055,7 @@ QString QFileInfo::group() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QLatin1String(""); - return d->getFileOwner(QAbstractFileEngine::OwnerGroup); + return d->data->getFileOwner(QAbstractFileEngine::OwnerGroup); } /*! @@ -1088,7 +1092,7 @@ bool QFileInfo::permission(QFile::Permissions permissions) const Q_D(const QFileInfo); if (!d->data->fileEngine) return false; - return d->getFileFlags(QAbstractFileEngine::FileFlags((int)permissions)) == (uint)permissions; + return d->data->getFileFlags(QAbstractFileEngine::FileFlags((int)permissions)) == (uint)permissions; } /*! @@ -1100,7 +1104,7 @@ QFile::Permissions QFileInfo::permissions() const Q_D(const QFileInfo); if (!d->data->fileEngine) return 0; - return QFile::Permissions(d->getFileFlags(QAbstractFileEngine::PermsMask) & QAbstractFileEngine::PermsMask); + return QFile::Permissions(d->data->getFileFlags(QAbstractFileEngine::PermsMask) & QAbstractFileEngine::PermsMask); } @@ -1140,7 +1144,7 @@ QDateTime QFileInfo::created() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QDateTime(); - return d->getFileTime(QAbstractFileEngine::CreationTime); + return d->data->getFileTime(QAbstractFileEngine::CreationTime); } /*! @@ -1153,7 +1157,7 @@ QDateTime QFileInfo::lastModified() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QDateTime(); - return d->getFileTime(QAbstractFileEngine::ModificationTime); + return d->data->getFileTime(QAbstractFileEngine::ModificationTime); } /*! @@ -1169,7 +1173,7 @@ QDateTime QFileInfo::lastRead() const Q_D(const QFileInfo); if (!d->data->fileEngine) return QDateTime(); - return d->getFileTime(QAbstractFileEngine::AccessTime); + return d->data->getFileTime(QAbstractFileEngine::AccessTime); } /*! \internal @@ -1178,7 +1182,7 @@ QDateTime QFileInfo::lastRead() const void QFileInfo::detach() { Q_D(QFileInfo); - d->detach(); + QFileInfoPrivate::Data::detach(d->data); } /*! @@ -1207,7 +1211,7 @@ bool QFileInfo::caching() const void QFileInfo::setCaching(bool enable) { Q_D(QFileInfo); - detach(); + QFileInfoPrivate::Data::detach(d->data); d->data->cache_enabled = enable; } diff --git a/src/corelib/io/qfileinfo_p.h b/src/corelib/io/qfileinfo_p.h index 306ffe1..a1f5419 100644 --- a/src/corelib/io/qfileinfo_p.h +++ b/src/corelib/io/qfileinfo_p.h @@ -66,13 +66,6 @@ public: QFileInfoPrivate(const QFileInfo *copy=0); ~QFileInfoPrivate(); - void initFileEngine(const QString &); - - uint getFileFlags(QAbstractFileEngine::FileFlags) const; - QDateTime &getFileTime(QAbstractFileEngine::FileTime) const; - QString getFileName(QAbstractFileEngine::FileName) const; - QString getFileOwner(QAbstractFileEngine::FileOwner own) const; - enum { CachedFileFlags=0x01, CachedLinkTypeFlag=0x02, CachedBundleTypeFlag=0x04, CachedMTime=0x10, CachedCTime=0x20, CachedATime=0x40, CachedSize =0x08, CachedPerms=0x80 }; @@ -87,7 +80,7 @@ public: cachedFlags(0), cache_enabled(copy.cache_enabled), fileFlags(0), fileSize(0) {} inline ~Data() { delete fileEngine; } - inline void clearFlags() { + inline void clearFlags() const { fileFlags = 0; cachedFlags = 0; if (fileEngine) @@ -100,6 +93,15 @@ public: fileOwners[1].clear(); fileOwners[0].clear(); } + void initFileEngine(const QString &); + + uint getFileFlags(QAbstractFileEngine::FileFlags) const; + QDateTime &getFileTime(QAbstractFileEngine::FileTime) const; + QString getFileName(QAbstractFileEngine::FileName) const; + QString getFileOwner(QAbstractFileEngine::FileOwner own) const; + + static void detach(QFileInfoPrivate::Data *&data); + mutable QAtomicInt ref; QAbstractFileEngine *fileEngine; @@ -114,14 +116,9 @@ public: mutable QDateTime fileTimes[3]; inline bool getCachedFlag(uint c) const { return cache_enabled ? (cachedFlags & c) : 0; } - inline void setCachedFlag(uint c) + inline void setCachedFlag(uint c) const { if (cache_enabled) cachedFlags |= c; } } *data; - inline void reset() { - detach(); - data->clear(); - } - void detach(); }; QT_END_NAMESPACE -- cgit v0.12 From 960444ea8973fa7ca68108d253516df3abfd5f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 24 Aug 2010 14:32:43 +0200 Subject: Refactoring QDirPrivate::Data There was an unnecessary split of QDir's private data between QDirPrivate and QDirPrivate::Data. As a stepping stone towards merging the two, this moves everything into QDirPrivate::Data. Reviewed-by: Thomas Zander --- src/corelib/io/qdir.cpp | 182 ++++++++++++++++++++++++++---------------------- 1 file changed, 98 insertions(+), 84 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index e54d95e..0644675 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -89,46 +89,73 @@ public: QDirPrivate(const QDir *copy = 0); ~QDirPrivate(); - void updateFileLists() const; - void sortFileList(QDir::SortFlags, QFileInfoList &, QStringList *, QFileInfoList *) const; - -#ifdef QT3_SUPPORT - QChar filterSepChar; - bool matchAllDirs; -#endif - static inline QChar getFilterSepChar(const QString &nameFilter) - { - QChar sep(QLatin1Char(';')); - int i = nameFilter.indexOf(sep, 0); - if (i == -1 && nameFilter.indexOf(QLatin1Char(' '), 0) != -1) - sep = QChar(QLatin1Char(' ')); - return sep; - } - static inline QStringList splitFilters(const QString &nameFilter, QChar sep = 0) { - if (sep == 0) - sep = getFilterSepChar(nameFilter); - QStringList ret = nameFilter.split(sep); - for (int i = 0; i < ret.count(); ++i) - ret[i] = ret[i].trimmed(); - return ret; - } - struct Data { inline Data() - : ref(1), fileEngine(0), listsDirty(1) + : ref(1), +#ifdef QT3_SUPPORT + filterSepChar(0), matchAllDirs(false), +#endif + fileEngine(0), listsDirty(1) {} inline Data(const Data ©) : ref(1), path(copy.path), nameFilters(copy.nameFilters), sort(copy.sort), - filters(copy.filters), fileEngine(0), listsDirty(1) + filters(copy.filters), +#ifdef QT3_SUPPORT + filterSepChar(copy.filterSepChar), matchAllDirs(copy.matchAllDirs), +#endif + fileEngine(0), listsDirty(1) {} inline ~Data() { delete fileEngine; } + void updateFileLists() const; + static void sortFileList(QDir::SortFlags, QFileInfoList &, QStringList *, QFileInfoList *); + + static inline QChar getFilterSepChar(const QString &nameFilter) + { + QChar sep(QLatin1Char(';')); + int i = nameFilter.indexOf(sep, 0); + if (i == -1 && nameFilter.indexOf(QLatin1Char(' '), 0) != -1) + sep = QChar(QLatin1Char(' ')); + return sep; + } + + static inline QStringList splitFilters(const QString &nameFilter, QChar sep = 0) + { + if (sep == 0) + sep = getFilterSepChar(nameFilter); + QStringList ret = nameFilter.split(sep); + for (int i = 0; i < ret.count(); ++i) + ret[i] = ret[i].trimmed(); + return ret; + } + + static void detach(QDirPrivate::Data *&data, bool createFileEngine = true); + + inline void setPath(QString p) + { + if ((p.endsWith(QLatin1Char('/')) || p.endsWith(QLatin1Char('\\'))) + && p.length() > 1) { +#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) + if (!(p.length() == 3 && p.at(1) == QLatin1Char(':'))) +#endif + p.truncate(p.length() - 1); + } + + delete fileEngine; + fileEngine = QAbstractFileEngine::create(p); + + // set the path to be the qt friendly version so then we can operate on it using just / + path = fileEngine->fileName(QAbstractFileEngine::DefaultName); + clear(); + } + inline void clear() { listsDirty = 1; files.clear(); fileInfos.clear(); } + mutable QAtomicInt ref; QString path; @@ -136,42 +163,20 @@ public: QDir::SortFlags sort; QDir::Filters filters; +#ifdef QT3_SUPPORT + QChar filterSepChar; + bool matchAllDirs; +#endif mutable QAbstractFileEngine *fileEngine; mutable uint listsDirty : 1; mutable QStringList files; mutable QFileInfoList fileInfos; } *data; - inline void setPath(const QString &p) - { - detach(false); - QString path = p; - if ((path.endsWith(QLatin1Char('/')) || path.endsWith(QLatin1Char('\\'))) - && path.length() > 1) { -#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) - if (!(path.length() == 3 && path.at(1) == QLatin1Char(':'))) -#endif - path.truncate(path.length() - 1); - } - - delete data->fileEngine; - data->fileEngine = QAbstractFileEngine::create(path); - // set the path to be the qt friendly version so then we can operate on it using just / - data->path = data->fileEngine->fileName(QAbstractFileEngine::DefaultName); - data->clear(); - } - inline void reset() { - detach(); - data->clear(); - } - void detach(bool createFileEngine = true); }; QDirPrivate::QDirPrivate(const QDir *copy) -#ifdef QT3_SUPPORT - : filterSepChar(0), matchAllDirs(false) -#endif { if (copy) { copy->d_func()->data->ref.ref(); @@ -268,8 +273,8 @@ bool QDirSortItemComparator::operator()(const QDirSortItem &n1, const QDirSortIt return r < 0; } -inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QFileInfoList &l, - QStringList *names, QFileInfoList *infos) const +inline void QDirPrivate::Data::sortFileList(QDir::SortFlags sort, QFileInfoList &l, + QStringList *names, QFileInfoList *infos) { // names and infos are always empty lists or 0 here int n = l.size(); @@ -299,21 +304,21 @@ inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QFileInfoList &l, } } -inline void QDirPrivate::updateFileLists() const +inline void QDirPrivate::Data::updateFileLists() const { - if (data->listsDirty) { + if (listsDirty) { QFileInfoList l; - QDirIterator it(data->path, data->nameFilters, data->filters); + QDirIterator it(path, nameFilters, filters); while (it.hasNext()) { it.next(); l.append(it.fileInfo()); } - sortFileList(data->sort, l, &data->files, &data->fileInfos); - data->listsDirty = 0; + sortFileList(sort, l, &files, &fileInfos); + listsDirty = 0; } } -void QDirPrivate::detach(bool createFileEngine) +void QDirPrivate::Data::detach(QDirPrivate::Data *&data, bool createFileEngine) { qAtomicDetach(data); if (createFileEngine) { @@ -507,7 +512,8 @@ void QDirPrivate::detach(bool createFileEngine) QDir::QDir(const QString &path) : d_ptr(new QDirPrivate) { Q_D(QDir); - d->setPath(path.isEmpty() ? QString::fromLatin1(".") : path); + QDirPrivate::Data::detach(d->data, false); + d->data->setPath(path.isEmpty() ? QString::fromLatin1(".") : path); d->data->nameFilters = QStringList(QString::fromLatin1("*")); d->data->filters = AllEntries; d->data->sort = SortFlags(Name | IgnoreCase); @@ -535,7 +541,8 @@ QDir::QDir(const QString &path, const QString &nameFilter, SortFlags sort, Filters filters) : d_ptr(new QDirPrivate) { Q_D(QDir); - d->setPath(path.isEmpty() ? QString::fromLatin1(".") : path); + QDirPrivate::Data::detach(d->data, false); + d->data->setPath(path.isEmpty() ? QString::fromLatin1(".") : path); d->data->nameFilters = QDir::nameFiltersFromString(nameFilter); bool empty = d->data->nameFilters.isEmpty(); if (!empty) { @@ -590,7 +597,8 @@ QDir::~QDir() void QDir::setPath(const QString &path) { Q_D(QDir); - d->setPath(path); + QDirPrivate::Data::detach(d->data, false); + d->data->setPath(path); } /*! @@ -954,7 +962,8 @@ void QDir::setNameFilters(const QStringList &nameFilters) { Q_D(QDir); - d->reset(); + QDirPrivate::Data::detach(d->data); + d->data->clear(); d->data->nameFilters = nameFilters; } @@ -1143,7 +1152,8 @@ void QDir::setFilter(Filters filters) { Q_D(QDir); - d->reset(); + QDirPrivate::Data::detach(d->data); + d->data->clear(); d->data->filters = filters; } @@ -1201,7 +1211,8 @@ void QDir::setSorting(SortFlags sort) { Q_D(QDir); - d->reset(); + QDirPrivate::Data::detach(d->data); + d->data->clear(); d->data->sort = sort; } @@ -1216,7 +1227,7 @@ uint QDir::count() const { Q_D(const QDir); - d->updateFileLists(); + d->data->updateFileLists(); return d->data->files.count(); } @@ -1231,7 +1242,7 @@ QString QDir::operator[](int pos) const { Q_D(const QDir); - d->updateFileLists(); + d->data->updateFileLists(); return d->data->files[pos]; } @@ -1309,14 +1320,14 @@ QStringList QDir::entryList(const QStringList &nameFilters, Filters filters, if (filters == NoFilter) filters = d->data->filters; #ifdef QT3_SUPPORT - if (d->matchAllDirs) + if (d->data->matchAllDirs) filters |= AllDirs; #endif if (sort == NoSort) sort = d->data->sort; if (filters == d->data->filters && sort == d->data->sort && nameFilters == d->data->nameFilters) { - d->updateFileLists(); + d->data->updateFileLists(); return d->data->files; } @@ -1327,7 +1338,7 @@ QStringList QDir::entryList(const QStringList &nameFilters, Filters filters, l.append(it.fileInfo()); } QStringList ret; - d->sortFileList(sort, l, &ret, 0); + d->data->sortFileList(sort, l, &ret, 0); return ret; } @@ -1355,14 +1366,14 @@ QFileInfoList QDir::entryInfoList(const QStringList &nameFilters, Filters filter if (filters == NoFilter) filters = d->data->filters; #ifdef QT3_SUPPORT - if (d->matchAllDirs) + if (d->data->matchAllDirs) filters |= AllDirs; #endif if (sort == NoSort) sort = d->data->sort; if (filters == d->data->filters && sort == d->data->sort && nameFilters == d->data->nameFilters) { - d->updateFileLists(); + d->data->updateFileLists(); return d->data->fileInfos; } @@ -1373,7 +1384,7 @@ QFileInfoList QDir::entryInfoList(const QStringList &nameFilters, Filters filter l.append(it.fileInfo()); } QFileInfoList ret; - d->sortFileList(sort, l, 0, &ret); + d->data->sortFileList(sort, l, 0, &ret); return ret; } @@ -1595,7 +1606,7 @@ bool QDir::makeAbsolute() // ### What do the return values signify? QString absolutePath = d->data->fileEngine->fileName(QAbstractFileEngine::AbsoluteName); if (QDir::isRelativePath(absolutePath)) return false; - d->detach(); + QDirPrivate::Data::detach(d->data); d->data->path = absolutePath; d->data->fileEngine->setFileName(absolutePath); if (!(d->data->fileEngine->fileFlags(QAbstractFileEngine::TypesMask) & QAbstractFileEngine::DirectoryType)) @@ -1661,7 +1672,8 @@ QDir &QDir::operator=(const QString &path) { Q_D(QDir); - d->setPath(path); + QDirPrivate::Data::detach(d->data, false); + d->data->setPath(path); return *this; } @@ -2152,7 +2164,8 @@ void QDir::refresh() const { Q_D(const QDir); - const_cast(d)->reset(); + QDirPrivate::Data::detach(const_cast(d)->data); + d->data->clear(); } /*! @@ -2164,7 +2177,7 @@ void QDir::refresh() const */ QStringList QDir::nameFiltersFromString(const QString &nameFilter) { - return QDirPrivate::splitFilters(nameFilter); + return QDirPrivate::Data::splitFilters(nameFilter); } /*! @@ -2229,7 +2242,7 @@ QStringList QDir::nameFiltersFromString(const QString &nameFilter) bool QDir::matchAllDirs() const { Q_D(const QDir); - return d->matchAllDirs; + return d->data->matchAllDirs; } @@ -2242,8 +2255,9 @@ void QDir::setMatchAllDirs(bool on) { Q_D(QDir); - d->reset(); - d->matchAllDirs = on; + QDirPrivate::Data::detach(d->data); + d->data->clear(); + d->data->matchAllDirs = on; } /*! @@ -2253,7 +2267,7 @@ QString QDir::nameFilter() const { Q_D(const QDir); - return nameFilters().join(QString(d->filterSepChar)); + return nameFilters().join(QString(d->data->filterSepChar)); } /*! @@ -2280,8 +2294,8 @@ void QDir::setNameFilter(const QString &nameFilter) { Q_D(QDir); - d->filterSepChar = QDirPrivate::getFilterSepChar(nameFilter); - setNameFilters(QDirPrivate::splitFilters(nameFilter, d->filterSepChar)); + d->data->filterSepChar = QDirPrivate::Data::getFilterSepChar(nameFilter); + setNameFilters(QDirPrivate::Data::splitFilters(nameFilter, d->data->filterSepChar)); } /*! -- cgit v0.12 From f3c3b63764f50151f373ff280bd4b77093b371db Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Wed, 25 Aug 2010 14:35:10 +0200 Subject: Refactor QFileInfoPrivate::Data (Round 2) The QFileInfoPrivate::Data member class is removed now. All the methods moved to QFileInfoPrivate. QFileInfoPrivate becomes a QSharedData type. Reviewed-by: Joao --- src/corelib/io/qfileinfo.cpp | 223 ++++++++++++++------------------- src/corelib/io/qfileinfo.h | 16 ++- src/corelib/io/qfileinfo_p.h | 100 ++++++++------- tests/auto/qfileinfo/tst_qfileinfo.cpp | 17 +-- 4 files changed, 170 insertions(+), 186 deletions(-) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 4671d8c..fe557d0 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -47,24 +47,7 @@ QT_BEGIN_NAMESPACE -QFileInfoPrivate::QFileInfoPrivate(const QFileInfo *copy) -{ - if (copy) { - copy->d_func()->data->ref.ref(); - data = copy->d_func()->data; - } else { - data = new QFileInfoPrivate::Data; - } -} - -QFileInfoPrivate::~QFileInfoPrivate() -{ - if (!data->ref.deref()) - delete data; - data = 0; -} - -void QFileInfoPrivate::Data::initFileEngine(const QString &file) +void QFileInfoPrivate::initFileEngine(const QString &file) { delete fileEngine; fileEngine = 0; @@ -73,12 +56,7 @@ void QFileInfoPrivate::Data::initFileEngine(const QString &file) fileName = file; } -void QFileInfoPrivate::Data::detach(QFileInfoPrivate::Data *&data) -{ - qAtomicDetach(data); -} - -QString QFileInfoPrivate::Data::getFileName(QAbstractFileEngine::FileName name) const +QString QFileInfoPrivate::getFileName(QAbstractFileEngine::FileName name) const { if (cache_enabled && !fileNames[(int)name].isNull()) return fileNames[(int)name]; @@ -90,7 +68,7 @@ QString QFileInfoPrivate::Data::getFileName(QAbstractFileEngine::FileName name) return ret; } -QString QFileInfoPrivate::Data::getFileOwner(QAbstractFileEngine::FileOwner own) const +QString QFileInfoPrivate::getFileOwner(QAbstractFileEngine::FileOwner own) const { if (cache_enabled && !fileOwners[(int)own].isNull()) return fileOwners[(int)own]; @@ -102,7 +80,7 @@ QString QFileInfoPrivate::Data::getFileOwner(QAbstractFileEngine::FileOwner own) return ret; } -uint QFileInfoPrivate::Data::getFileFlags(QAbstractFileEngine::FileFlags request) const +uint QFileInfoPrivate::getFileFlags(QAbstractFileEngine::FileFlags request) const { // We split the testing into tests for for LinkType, BundleType, PermsMask // and the rest. @@ -162,7 +140,7 @@ uint QFileInfoPrivate::Data::getFileFlags(QAbstractFileEngine::FileFlags request return fileFlags & request; } -QDateTime &QFileInfoPrivate::Data::getFileTime(QAbstractFileEngine::FileTime request) const +QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request) const { if (!cache_enabled) clearFlags(); @@ -284,10 +262,8 @@ QFileInfo::QFileInfo() : d_ptr(new QFileInfoPrivate()) \sa setFile(), isRelative(), QDir::setCurrent(), QDir::isRelativePath() */ -QFileInfo::QFileInfo(const QString &file) : d_ptr(new QFileInfoPrivate()) +QFileInfo::QFileInfo(const QString &file) : d_ptr(new QFileInfoPrivate(file)) { - QFileInfoPrivate::Data::detach(d_ptr->data); - d_ptr->data->initFileEngine(file); } /*! @@ -299,10 +275,8 @@ QFileInfo::QFileInfo(const QString &file) : d_ptr(new QFileInfoPrivate()) \sa isRelative() */ -QFileInfo::QFileInfo(const QFile &file) : d_ptr(new QFileInfoPrivate()) +QFileInfo::QFileInfo(const QFile &file) : d_ptr(new QFileInfoPrivate(file.fileName())) { - QFileInfoPrivate::Data::detach(d_ptr->data); - d_ptr->data->initFileEngine(file.fileName()); } /*! @@ -317,16 +291,16 @@ QFileInfo::QFileInfo(const QFile &file) : d_ptr(new QFileInfoPrivate()) \sa isRelative() */ -QFileInfo::QFileInfo(const QDir &dir, const QString &file) : d_ptr(new QFileInfoPrivate()) +QFileInfo::QFileInfo(const QDir &dir, const QString &file) + : d_ptr(new QFileInfoPrivate(dir.filePath(file))) { - QFileInfoPrivate::Data::detach(d_ptr->data); - d_ptr->data->initFileEngine(dir.filePath(file)); } /*! Constructs a new QFileInfo that is a copy of the given \a fileinfo. */ -QFileInfo::QFileInfo(const QFileInfo &fileinfo) : d_ptr(new QFileInfoPrivate(&fileinfo)) +QFileInfo::QFileInfo(const QFileInfo &fileinfo) + : d_ptr(fileinfo.d_ptr) { } @@ -361,17 +335,17 @@ bool QFileInfo::operator==(const QFileInfo &fileinfo) const Q_D(const QFileInfo); // ### Qt 5: understand long and short file names on Windows // ### (GetFullPathName()). - if (fileinfo.d_func()->data == d->data) + if (fileinfo.d_ptr == d_ptr) return true; - if (!d->data->fileEngine || !fileinfo.d_func()->data->fileEngine) + if (!d->fileEngine || !fileinfo.d_ptr->fileEngine) return false; - if (d->data->fileEngine->caseSensitive() != fileinfo.d_func()->data->fileEngine->caseSensitive()) + if (d->fileEngine->caseSensitive() != fileinfo.d_ptr->fileEngine->caseSensitive()) return false; if (fileinfo.size() == size()) { //if the size isn't the same... QString file1 = canonicalFilePath(), file2 = fileinfo.canonicalFilePath(); if (file1.length() == file2.length()) { - if (!fileinfo.d_func()->data->fileEngine->caseSensitive()) { + if (!fileinfo.d_ptr->fileEngine->caseSensitive()) { for (int i = 0; i < file1.length(); i++) { if (file1.at(i).toLower() != file2.at(i).toLower()) return false; @@ -409,8 +383,7 @@ bool QFileInfo::operator==(const QFileInfo &fileinfo) */ QFileInfo &QFileInfo::operator=(const QFileInfo &fileinfo) { - Q_D(QFileInfo); - qAtomicAssign(d->data, fileinfo.d_func()->data); + d_ptr = fileinfo.d_ptr; return *this; } @@ -490,9 +463,9 @@ void QFileInfo::setFile(const QDir &dir, const QString &file) QString QFileInfo::absoluteFilePath() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QLatin1String(""); - return d->data->getFileName(QAbstractFileEngine::AbsoluteName); + return d->getFileName(QAbstractFileEngine::AbsoluteName); } /*! @@ -507,9 +480,9 @@ QString QFileInfo::absoluteFilePath() const QString QFileInfo::canonicalFilePath() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QLatin1String(""); - return d->data->getFileName(QAbstractFileEngine::CanonicalName); + return d->getFileName(QAbstractFileEngine::CanonicalName); } @@ -534,13 +507,13 @@ QString QFileInfo::absolutePath() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) { + if (!d->fileEngine) { return QLatin1String(""); - } else if (d->data->fileName.isEmpty()) { + } else if (d->fileName.isEmpty()) { qWarning("QFileInfo::absolutePath: Constructed with empty filename"); return QLatin1String(""); } - return d->data->getFileName(QAbstractFileEngine::AbsolutePathName); + return d->getFileName(QAbstractFileEngine::AbsolutePathName); } /*! @@ -554,9 +527,9 @@ QString QFileInfo::absolutePath() const QString QFileInfo::canonicalPath() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QLatin1String(""); - return d->data->getFileName(QAbstractFileEngine::CanonicalPathName); + return d->getFileName(QAbstractFileEngine::CanonicalPathName); } /*! @@ -571,9 +544,9 @@ QString QFileInfo::canonicalPath() const QString QFileInfo::path() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QLatin1String(""); - return d->data->getFileName(QAbstractFileEngine::PathName); + return d->getFileName(QAbstractFileEngine::PathName); } /*! @@ -595,9 +568,9 @@ QString QFileInfo::path() const bool QFileInfo::isRelative() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return true; - return d->data->fileEngine->isRelativePath(); + return d->fileEngine->isRelativePath(); } /*! @@ -609,12 +582,11 @@ bool QFileInfo::isRelative() const */ bool QFileInfo::makeAbsolute() { - Q_D(QFileInfo); - if (!d->data->fileEngine || !d->data->fileEngine->isRelativePath()) + if (!d_ptr.constData()->fileEngine || !d_ptr.constData()->fileEngine->isRelativePath()) return false; - QString absFileName = d->data->getFileName(QAbstractFileEngine::AbsoluteName); - QFileInfoPrivate::Data::detach(d_ptr->data); - d->data->initFileEngine(absFileName); + QString absFileName = d_ptr.constData()->getFileName(QAbstractFileEngine::AbsoluteName); + // QSharedDataPointer::operator->() will detach. + d_ptr->initFileEngine(absFileName); return true; } @@ -627,9 +599,9 @@ bool QFileInfo::makeAbsolute() bool QFileInfo::exists() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return false; - return d->data->getFileFlags(QAbstractFileEngine::ExistsFlag); + return d->getFileFlags(QAbstractFileEngine::ExistsFlag); } /*! @@ -642,8 +614,7 @@ bool QFileInfo::exists() const void QFileInfo::refresh() { Q_D(QFileInfo); - QFileInfoPrivate::Data::detach(d->data); - d->data->clear(); + d->clear(); } /*! @@ -655,9 +626,9 @@ void QFileInfo::refresh() QString QFileInfo::filePath() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QLatin1String(""); - return d->data->getFileName(QAbstractFileEngine::DefaultName); + return d->getFileName(QAbstractFileEngine::DefaultName); } /*! @@ -674,9 +645,9 @@ QString QFileInfo::filePath() const QString QFileInfo::fileName() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QLatin1String(""); - return d->data->getFileName(QAbstractFileEngine::BaseName); + return d->getFileName(QAbstractFileEngine::BaseName); } /*! @@ -694,9 +665,9 @@ QString QFileInfo::fileName() const QString QFileInfo::bundleName() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QLatin1String(""); - return d->data->getFileName(QAbstractFileEngine::BundleName); + return d->getFileName(QAbstractFileEngine::BundleName); } /*! @@ -718,9 +689,9 @@ QString QFileInfo::bundleName() const QString QFileInfo::baseName() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QLatin1String(""); - return d->data->getFileName(QAbstractFileEngine::BaseName).section(QLatin1Char('.'), 0, 0); + return d->getFileName(QAbstractFileEngine::BaseName).section(QLatin1Char('.'), 0, 0); } /*! @@ -737,9 +708,9 @@ QString QFileInfo::baseName() const QString QFileInfo::completeBaseName() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QLatin1String(""); - QString name = d->data->getFileName(QAbstractFileEngine::BaseName); + QString name = d->getFileName(QAbstractFileEngine::BaseName); int index = name.lastIndexOf(QLatin1Char('.')); return (index == -1) ? name : name.left(index); } @@ -758,9 +729,9 @@ QString QFileInfo::completeBaseName() const QString QFileInfo::completeSuffix() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QLatin1String(""); - QString fileName = d->data->getFileName(QAbstractFileEngine::BaseName); + QString fileName = d->getFileName(QAbstractFileEngine::BaseName); int firstDot = fileName.indexOf(QLatin1Char('.')); if (firstDot == -1) return QLatin1String(""); @@ -785,9 +756,9 @@ QString QFileInfo::completeSuffix() const QString QFileInfo::suffix() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QLatin1String(""); - QString fileName = d->data->getFileName(QAbstractFileEngine::BaseName); + QString fileName = d->getFileName(QAbstractFileEngine::BaseName); int lastDot = fileName.lastIndexOf(QLatin1Char('.')); if (lastDot == -1) return QLatin1String(""); @@ -850,9 +821,9 @@ QDir QFileInfo::dir(bool absPath) const bool QFileInfo::isReadable() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return false; - return d->data->getFileFlags(QAbstractFileEngine::ReadUserPerm); + return d->getFileFlags(QAbstractFileEngine::ReadUserPerm); } /*! @@ -863,9 +834,9 @@ bool QFileInfo::isReadable() const bool QFileInfo::isWritable() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return false; - return d->data->getFileFlags(QAbstractFileEngine::WriteUserPerm); + return d->getFileFlags(QAbstractFileEngine::WriteUserPerm); } /*! @@ -876,9 +847,9 @@ bool QFileInfo::isWritable() const bool QFileInfo::isExecutable() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return false; - return d->data->getFileFlags(QAbstractFileEngine::ExeUserPerm); + return d->getFileFlags(QAbstractFileEngine::ExeUserPerm); } /*! @@ -890,9 +861,9 @@ bool QFileInfo::isExecutable() const bool QFileInfo::isHidden() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return false; - return d->data->getFileFlags(QAbstractFileEngine::HiddenFlag); + return d->getFileFlags(QAbstractFileEngine::HiddenFlag); } /*! @@ -905,9 +876,9 @@ bool QFileInfo::isHidden() const bool QFileInfo::isFile() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return false; - return d->data->getFileFlags(QAbstractFileEngine::FileType); + return d->getFileFlags(QAbstractFileEngine::FileType); } /*! @@ -919,9 +890,9 @@ bool QFileInfo::isFile() const bool QFileInfo::isDir() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return false; - return d->data->getFileFlags(QAbstractFileEngine::DirectoryType); + return d->getFileFlags(QAbstractFileEngine::DirectoryType); } @@ -935,9 +906,9 @@ bool QFileInfo::isDir() const bool QFileInfo::isBundle() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return false; - return d->data->getFileFlags(QAbstractFileEngine::BundleType); + return d->getFileFlags(QAbstractFileEngine::BundleType); } /*! @@ -960,9 +931,9 @@ bool QFileInfo::isBundle() const bool QFileInfo::isSymLink() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return false; - return d->data->getFileFlags(QAbstractFileEngine::LinkType); + return d->getFileFlags(QAbstractFileEngine::LinkType); } /*! @@ -973,9 +944,9 @@ bool QFileInfo::isSymLink() const bool QFileInfo::isRoot() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return true; - return d->data->getFileFlags(QAbstractFileEngine::RootFlag); + return d->getFileFlags(QAbstractFileEngine::RootFlag); } /*! @@ -1001,9 +972,9 @@ bool QFileInfo::isRoot() const QString QFileInfo::readLink() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QLatin1String(""); - return d->data->getFileName(QAbstractFileEngine::LinkName); + return d->getFileName(QAbstractFileEngine::LinkName); } /*! @@ -1019,9 +990,9 @@ QString QFileInfo::readLink() const QString QFileInfo::owner() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QLatin1String(""); - return d->data->getFileOwner(QAbstractFileEngine::OwnerUser); + return d->getFileOwner(QAbstractFileEngine::OwnerUser); } /*! @@ -1035,9 +1006,9 @@ QString QFileInfo::owner() const uint QFileInfo::ownerId() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return 0; - return d->data->fileEngine->ownerId(QAbstractFileEngine::OwnerUser); + return d->fileEngine->ownerId(QAbstractFileEngine::OwnerUser); } /*! @@ -1053,9 +1024,9 @@ uint QFileInfo::ownerId() const QString QFileInfo::group() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QLatin1String(""); - return d->data->getFileOwner(QAbstractFileEngine::OwnerGroup); + return d->getFileOwner(QAbstractFileEngine::OwnerGroup); } /*! @@ -1069,9 +1040,9 @@ QString QFileInfo::group() const uint QFileInfo::groupId() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return 0; - return d->data->fileEngine->ownerId(QAbstractFileEngine::OwnerGroup); + return d->fileEngine->ownerId(QAbstractFileEngine::OwnerGroup); } /*! @@ -1090,9 +1061,9 @@ uint QFileInfo::groupId() const bool QFileInfo::permission(QFile::Permissions permissions) const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return false; - return d->data->getFileFlags(QAbstractFileEngine::FileFlags((int)permissions)) == (uint)permissions; + return d->getFileFlags(QAbstractFileEngine::FileFlags((int)permissions)) == (uint)permissions; } /*! @@ -1102,9 +1073,9 @@ bool QFileInfo::permission(QFile::Permissions permissions) const QFile::Permissions QFileInfo::permissions() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return 0; - return QFile::Permissions(d->data->getFileFlags(QAbstractFileEngine::PermsMask) & QAbstractFileEngine::PermsMask); + return QFile::Permissions(d->getFileFlags(QAbstractFileEngine::PermsMask) & QAbstractFileEngine::PermsMask); } @@ -1117,13 +1088,13 @@ QFile::Permissions QFileInfo::permissions() const qint64 QFileInfo::size() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return 0; - if (!d->data->getCachedFlag(QFileInfoPrivate::CachedSize)) { - d->data->setCachedFlag(QFileInfoPrivate::CachedSize); - d->data->fileSize = d->data->fileEngine->size(); + if (!d->getCachedFlag(QFileInfoPrivate::CachedSize)) { + d->setCachedFlag(QFileInfoPrivate::CachedSize); + d->fileSize = d->fileEngine->size(); } - return d->data->fileSize; + return d->fileSize; } /*! @@ -1142,9 +1113,9 @@ qint64 QFileInfo::size() const QDateTime QFileInfo::created() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QDateTime(); - return d->data->getFileTime(QAbstractFileEngine::CreationTime); + return d->getFileTime(QAbstractFileEngine::CreationTime); } /*! @@ -1155,9 +1126,9 @@ QDateTime QFileInfo::created() const QDateTime QFileInfo::lastModified() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QDateTime(); - return d->data->getFileTime(QAbstractFileEngine::ModificationTime); + return d->getFileTime(QAbstractFileEngine::ModificationTime); } /*! @@ -1171,9 +1142,9 @@ QDateTime QFileInfo::lastModified() const QDateTime QFileInfo::lastRead() const { Q_D(const QFileInfo); - if (!d->data->fileEngine) + if (!d->fileEngine) return QDateTime(); - return d->data->getFileTime(QAbstractFileEngine::AccessTime); + return d->getFileTime(QAbstractFileEngine::AccessTime); } /*! \internal @@ -1181,8 +1152,7 @@ QDateTime QFileInfo::lastRead() const */ void QFileInfo::detach() { - Q_D(QFileInfo); - QFileInfoPrivate::Data::detach(d->data); + d_ptr.detach(); } /*! @@ -1193,7 +1163,7 @@ void QFileInfo::detach() bool QFileInfo::caching() const { Q_D(const QFileInfo); - return d->data->cache_enabled; + return d->cache_enabled; } /*! @@ -1211,8 +1181,7 @@ bool QFileInfo::caching() const void QFileInfo::setCaching(bool enable) { Q_D(QFileInfo); - QFileInfoPrivate::Data::detach(d->data); - d->data->cache_enabled = enable; + d->cache_enabled = enable; } /*! diff --git a/src/corelib/io/qfileinfo.h b/src/corelib/io/qfileinfo.h index 7e82aed..f0128b1 100644 --- a/src/corelib/io/qfileinfo.h +++ b/src/corelib/io/qfileinfo.h @@ -44,7 +44,7 @@ #include #include -#include +#include QT_BEGIN_HEADER @@ -166,10 +166,20 @@ public: #endif protected: - QScopedPointer d_ptr; + QSharedDataPointer d_ptr; private: - Q_DECLARE_PRIVATE(QFileInfo) + inline QFileInfoPrivate* d_func() + { + detach(); + return const_cast(d_ptr.constData()); + } + + inline const QFileInfoPrivate* d_func() const + { + return d_ptr.constData(); + } }; + Q_DECLARE_TYPEINFO(QFileInfo, Q_MOVABLE_TYPE); #ifdef QT3_SUPPORT diff --git a/src/corelib/io/qfileinfo_p.h b/src/corelib/io/qfileinfo_p.h index a1f5419..138116e 100644 --- a/src/corelib/io/qfileinfo_p.h +++ b/src/corelib/io/qfileinfo_p.h @@ -57,68 +57,72 @@ #include "qabstractfileengine.h" #include "qdatetime.h" #include "qatomic.h" +#include "qshareddata.h" QT_BEGIN_NAMESPACE -class QFileInfoPrivate +class QFileInfoPrivate : public QSharedData { public: - QFileInfoPrivate(const QFileInfo *copy=0); - ~QFileInfoPrivate(); enum { CachedFileFlags=0x01, CachedLinkTypeFlag=0x02, CachedBundleTypeFlag=0x04, CachedMTime=0x10, CachedCTime=0x20, CachedATime=0x40, CachedSize =0x08, CachedPerms=0x80 }; - struct Data { - inline Data() - : ref(1), fileEngine(0), - cachedFlags(0), cache_enabled(1), fileFlags(0), fileSize(0) - {} - inline Data(const Data ©) - : ref(1), fileEngine(QAbstractFileEngine::create(copy.fileName)), - fileName(copy.fileName), - cachedFlags(0), cache_enabled(copy.cache_enabled), fileFlags(0), fileSize(0) - {} - inline ~Data() { delete fileEngine; } - inline void clearFlags() const { - fileFlags = 0; - cachedFlags = 0; - if (fileEngine) - (void)fileEngine->fileFlags(QAbstractFileEngine::Refresh); - } - inline void clear() { - clearFlags(); - for (int i = QAbstractFileEngine::NFileNames - 1 ; i >= 0 ; --i) - fileNames[i].clear(); - fileOwners[1].clear(); - fileOwners[0].clear(); - } - void initFileEngine(const QString &); - uint getFileFlags(QAbstractFileEngine::FileFlags) const; - QDateTime &getFileTime(QAbstractFileEngine::FileTime) const; - QString getFileName(QAbstractFileEngine::FileName) const; - QString getFileOwner(QAbstractFileEngine::FileOwner own) const; + inline QFileInfoPrivate() + : QSharedData(), fileEngine(0), + cachedFlags(0), cache_enabled(1), fileFlags(0), fileSize(0) + {} + inline QFileInfoPrivate(const QFileInfoPrivate ©) + : QSharedData(copy), fileEngine(QAbstractFileEngine::create(copy.fileName)), + fileName(copy.fileName), + cachedFlags(0), cache_enabled(copy.cache_enabled), fileFlags(0), fileSize(0) + {} + inline QFileInfoPrivate(const QString &file) + : QSharedData(), fileEngine(0), + cachedFlags(0), cache_enabled(1), fileFlags(0), fileSize(0) + { + initFileEngine(file); + } + inline ~QFileInfoPrivate() + { + delete fileEngine; + } + void initFileEngine(const QString &); - static void detach(QFileInfoPrivate::Data *&data); + inline void clearFlags() const { + fileFlags = 0; + cachedFlags = 0; + if (fileEngine) + (void)fileEngine->fileFlags(QAbstractFileEngine::Refresh); + } + inline void clear() { + clearFlags(); + for (int i = QAbstractFileEngine::NFileNames - 1 ; i >= 0 ; --i) + fileNames[i].clear(); + fileOwners[1].clear(); + fileOwners[0].clear(); + } - mutable QAtomicInt ref; + uint getFileFlags(QAbstractFileEngine::FileFlags) const; + QDateTime &getFileTime(QAbstractFileEngine::FileTime) const; + QString getFileName(QAbstractFileEngine::FileName) const; + QString getFileOwner(QAbstractFileEngine::FileOwner own) const; - QAbstractFileEngine *fileEngine; - mutable QString fileName; - mutable QString fileNames[QAbstractFileEngine::NFileNames]; - mutable QString fileOwners[2]; + QAbstractFileEngine *fileEngine; + mutable QString fileName; + mutable QString fileNames[QAbstractFileEngine::NFileNames]; + mutable QString fileOwners[2]; - mutable uint cachedFlags : 31; - mutable uint cache_enabled : 1; - mutable uint fileFlags; - mutable qint64 fileSize; - mutable QDateTime fileTimes[3]; - inline bool getCachedFlag(uint c) const - { return cache_enabled ? (cachedFlags & c) : 0; } - inline void setCachedFlag(uint c) const - { if (cache_enabled) cachedFlags |= c; } - } *data; + mutable uint cachedFlags : 31; + mutable uint cache_enabled : 1; + mutable uint fileFlags; + mutable qint64 fileSize; + mutable QDateTime fileTimes[3]; + inline bool getCachedFlag(uint c) const + { return cache_enabled ? (cachedFlags & c) : 0; } + inline void setCachedFlag(uint c) const + { if (cache_enabled) cachedFlags |= c; } }; QT_END_NAMESPACE diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index 93b1891..540a1cd 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -228,13 +228,13 @@ void tst_QFileInfo::copy() QFileInfo info2(info); QFileInfoPrivate *privateInfo = getPrivate(info); QFileInfoPrivate *privateInfo2 = getPrivate(info2); - QCOMPARE(privateInfo->data, privateInfo2->data); + QCOMPARE(privateInfo, privateInfo2); //operator = QFileInfo info3 = info; QFileInfoPrivate *privateInfo3 = getPrivate(info3); - QCOMPARE(privateInfo->data, privateInfo3->data); - QCOMPARE(privateInfo2->data, privateInfo3->data); + QCOMPARE(privateInfo, privateInfo3); + QCOMPARE(privateInfo2, privateInfo3); //refreshing info3 will detach it QFile file(info.absoluteFilePath()); @@ -256,9 +256,10 @@ void tst_QFileInfo::copy() QTest::qWait(5000); #endif info3.refresh(); - QVERIFY(privateInfo->data != privateInfo3->data); - QVERIFY(privateInfo2->data != privateInfo3->data); - QCOMPARE(privateInfo->data, privateInfo2->data); + privateInfo3 = getPrivate(info3); + QVERIFY(privateInfo != privateInfo3); + QVERIFY(privateInfo2 != privateInfo3); + QCOMPARE(privateInfo, privateInfo2); } void tst_QFileInfo::isFile_data() @@ -1182,8 +1183,8 @@ void tst_QFileInfo::isLocalFs() QFileInfo info(path); QFileInfoPrivate *privateInfo = getPrivate(info); - QVERIFY(privateInfo->data->fileEngine); - QCOMPARE(bool(privateInfo->data->fileEngine->fileFlags(QAbstractFileEngine::LocalDiskFlag) + QVERIFY(privateInfo->fileEngine); + QCOMPARE(bool(privateInfo->fileEngine->fileFlags(QAbstractFileEngine::LocalDiskFlag) & QAbstractFileEngine::LocalDiskFlag), isLocalFs); } -- cgit v0.12 From eddb2264a5f12ea0e6a593ca411fb6be4b8f926d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 25 Aug 2010 13:38:32 +0200 Subject: Removed QDirPrivate layer of indirection Merged QDirPrivate with QDirPrivate::Data, as QDirPrivate served no purpose by itself, only adding an additional layer of indirection to the potentially shared private data, and an unnecessary allocation. Now, QDir holds a QSharedDataPointer to its private data. Private data will be shared among copied instances with COW semantics. Still, this sharing is very limited as plenty of regular use cases will cause the shared data to detach, such as refreshing the file lists. As the use QSharedDataPointer breaks usage of the Q_DECLARE_PRIVATE macro, we manually define the d_func'tions. Non-const d_func detaches on shared data. A detach function was added to the public interface to support this. (On a side note, QFileInfo already exposes a similar detach function). As much as possible, detach is handled implicitly inside the Q_D macro, through the d_func() non-const overload. On the other hand, implicit creation of file engines through detach was made explicit with a call to a new initFileEngine function. Reviewed-by: Thomas Zander --- src/corelib/io/qdir.cpp | 427 +++++++++++++++++++++++------------------------- src/corelib/io/qdir.h | 18 +- 2 files changed, 216 insertions(+), 229 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 0644675..de95a40 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -82,117 +82,105 @@ static QString driveSpec(const QString &path) //************* QDirPrivate class QDirPrivate + : public QSharedData { - friend struct QScopedPointerDeleter; - public: - QDirPrivate(const QDir *copy = 0); - ~QDirPrivate(); - - struct Data { - inline Data() - : ref(1), + QDirPrivate() + : QSharedData() #ifdef QT3_SUPPORT - filterSepChar(0), matchAllDirs(false), + , filterSepChar(0) + , matchAllDirs(false) #endif - fileEngine(0), listsDirty(1) - {} - inline Data(const Data ©) - : ref(1), path(copy.path), nameFilters(copy.nameFilters), sort(copy.sort), - filters(copy.filters), + , fileEngine(0) + , listsDirty(1) + { + } + + QDirPrivate(const QDirPrivate ©) + : QSharedData(copy) + , path(copy.path) + , nameFilters(copy.nameFilters) + , sort(copy.sort) + , filters(copy.filters) #ifdef QT3_SUPPORT - filterSepChar(copy.filterSepChar), matchAllDirs(copy.matchAllDirs), + , filterSepChar(copy.filterSepChar) + , matchAllDirs(copy.matchAllDirs) #endif - fileEngine(0), listsDirty(1) - {} - inline ~Data() - { delete fileEngine; } - - void updateFileLists() const; - static void sortFileList(QDir::SortFlags, QFileInfoList &, QStringList *, QFileInfoList *); - - static inline QChar getFilterSepChar(const QString &nameFilter) - { - QChar sep(QLatin1Char(';')); - int i = nameFilter.indexOf(sep, 0); - if (i == -1 && nameFilter.indexOf(QLatin1Char(' '), 0) != -1) - sep = QChar(QLatin1Char(' ')); - return sep; - } + , fileEngine(0) + , listsDirty(1) + { + } - static inline QStringList splitFilters(const QString &nameFilter, QChar sep = 0) - { - if (sep == 0) - sep = getFilterSepChar(nameFilter); - QStringList ret = nameFilter.split(sep); - for (int i = 0; i < ret.count(); ++i) - ret[i] = ret[i].trimmed(); - return ret; - } + ~QDirPrivate() + { + delete fileEngine; + } - static void detach(QDirPrivate::Data *&data, bool createFileEngine = true); + void initFileEngine(); + void updateFileLists() const; - inline void setPath(QString p) - { - if ((p.endsWith(QLatin1Char('/')) || p.endsWith(QLatin1Char('\\'))) - && p.length() > 1) { -#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) - if (!(p.length() == 3 && p.at(1) == QLatin1Char(':'))) -#endif - p.truncate(p.length() - 1); - } + static void sortFileList(QDir::SortFlags, QFileInfoList &, QStringList *, QFileInfoList *); - delete fileEngine; - fileEngine = QAbstractFileEngine::create(p); + static inline QChar getFilterSepChar(const QString &nameFilter) + { + QChar sep(QLatin1Char(';')); + int i = nameFilter.indexOf(sep, 0); + if (i == -1 && nameFilter.indexOf(QLatin1Char(' '), 0) != -1) + sep = QChar(QLatin1Char(' ')); + return sep; + } - // set the path to be the qt friendly version so then we can operate on it using just / - path = fileEngine->fileName(QAbstractFileEngine::DefaultName); - clear(); - } + static inline QStringList splitFilters(const QString &nameFilter, QChar sep = 0) + { + if (sep == 0) + sep = getFilterSepChar(nameFilter); + QStringList ret = nameFilter.split(sep); + for (int i = 0; i < ret.count(); ++i) + ret[i] = ret[i].trimmed(); + return ret; + } - inline void clear() { - listsDirty = 1; - files.clear(); - fileInfos.clear(); + inline void setPath(QString p) + { + if ((p.endsWith(QLatin1Char('/')) || p.endsWith(QLatin1Char('\\'))) + && p.length() > 1) { +#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) + if (!(p.length() == 3 && p.at(1) == QLatin1Char(':'))) +#endif + p.truncate(p.length() - 1); } - mutable QAtomicInt ref; + delete fileEngine; + fileEngine = QAbstractFileEngine::create(p); + + // set the path to be the qt friendly version so then we can operate on it using just / + path = fileEngine->fileName(QAbstractFileEngine::DefaultName); + clear(); + } - QString path; - QStringList nameFilters; - QDir::SortFlags sort; - QDir::Filters filters; + inline void clear() { + listsDirty = 1; + files.clear(); + fileInfos.clear(); + } + + QString path; + QStringList nameFilters; + QDir::SortFlags sort; + QDir::Filters filters; #ifdef QT3_SUPPORT - QChar filterSepChar; - bool matchAllDirs; + QChar filterSepChar; + bool matchAllDirs; #endif - mutable QAbstractFileEngine *fileEngine; - mutable uint listsDirty : 1; - mutable QStringList files; - mutable QFileInfoList fileInfos; - } *data; + QAbstractFileEngine *fileEngine; + mutable uint listsDirty : 1; + mutable QStringList files; + mutable QFileInfoList fileInfos; }; -QDirPrivate::QDirPrivate(const QDir *copy) -{ - if (copy) { - copy->d_func()->data->ref.ref(); - data = copy->d_func()->data; - } else { - data = new QDirPrivate::Data; - } -} - -QDirPrivate::~QDirPrivate() -{ - if (!data->ref.deref()) - delete data; - data = 0; -} - /* For sorting */ struct QDirSortItem { @@ -273,7 +261,7 @@ bool QDirSortItemComparator::operator()(const QDirSortItem &n1, const QDirSortIt return r < 0; } -inline void QDirPrivate::Data::sortFileList(QDir::SortFlags sort, QFileInfoList &l, +inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QFileInfoList &l, QStringList *names, QFileInfoList *infos) { // names and infos are always empty lists or 0 here @@ -304,7 +292,7 @@ inline void QDirPrivate::Data::sortFileList(QDir::SortFlags sort, QFileInfoList } } -inline void QDirPrivate::Data::updateFileLists() const +inline void QDirPrivate::updateFileLists() const { if (listsDirty) { QFileInfoList l; @@ -318,14 +306,11 @@ inline void QDirPrivate::Data::updateFileLists() const } } -void QDirPrivate::Data::detach(QDirPrivate::Data *&data, bool createFileEngine) +void QDirPrivate::initFileEngine() { - qAtomicDetach(data); - if (createFileEngine) { - QAbstractFileEngine *newFileEngine = QAbstractFileEngine::create(data->path); - delete data->fileEngine; - data->fileEngine = newFileEngine; - } + QAbstractFileEngine *newFileEngine = QAbstractFileEngine::create(path); + delete fileEngine; + fileEngine = newFileEngine; } /*! @@ -512,11 +497,10 @@ void QDirPrivate::Data::detach(QDirPrivate::Data *&data, bool createFileEngine) QDir::QDir(const QString &path) : d_ptr(new QDirPrivate) { Q_D(QDir); - QDirPrivate::Data::detach(d->data, false); - d->data->setPath(path.isEmpty() ? QString::fromLatin1(".") : path); - d->data->nameFilters = QStringList(QString::fromLatin1("*")); - d->data->filters = AllEntries; - d->data->sort = SortFlags(Name | IgnoreCase); + d->setPath(path.isEmpty() ? QString::fromLatin1(".") : path); + d->nameFilters = QStringList(QString::fromLatin1("*")); + d->filters = AllEntries; + d->sort = SortFlags(Name | IgnoreCase); } /*! @@ -541,23 +525,22 @@ QDir::QDir(const QString &path, const QString &nameFilter, SortFlags sort, Filters filters) : d_ptr(new QDirPrivate) { Q_D(QDir); - QDirPrivate::Data::detach(d->data, false); - d->data->setPath(path.isEmpty() ? QString::fromLatin1(".") : path); - d->data->nameFilters = QDir::nameFiltersFromString(nameFilter); - bool empty = d->data->nameFilters.isEmpty(); + d->setPath(path.isEmpty() ? QString::fromLatin1(".") : path); + d->nameFilters = QDir::nameFiltersFromString(nameFilter); + bool empty = d->nameFilters.isEmpty(); if (!empty) { empty = true; - for (int i = 0; i < d->data->nameFilters.size(); ++i) { - if (!d->data->nameFilters.at(i).isEmpty()) { + for (int i = 0; i < d->nameFilters.size(); ++i) { + if (!d->nameFilters.at(i).isEmpty()) { empty = false; break; } } } if (empty) - d->data->nameFilters = QStringList(QString::fromLatin1("*")); - d->data->sort = sort; - d->data->filters = filters; + d->nameFilters = QStringList(QString::fromLatin1("*")); + d->sort = sort; + d->filters = filters; } /*! @@ -566,7 +549,8 @@ QDir::QDir(const QString &path, const QString &nameFilter, \sa operator=() */ -QDir::QDir(const QDir &dir) : d_ptr(new QDirPrivate(&dir)) +QDir::QDir(const QDir &dir) + : d_ptr(dir.d_ptr) { } @@ -578,6 +562,11 @@ QDir::~QDir() { } +void QDir::detach() +{ + d_ptr.detach(); +} + /*! Sets the path of the directory to \a path. The path is cleaned of redundant ".", ".." and of multiple separators. No check is made @@ -596,9 +585,7 @@ QDir::~QDir() */ void QDir::setPath(const QString &path) { - Q_D(QDir); - QDirPrivate::Data::detach(d->data, false); - d->data->setPath(path); + d_ptr->setPath(path); } /*! @@ -614,7 +601,7 @@ void QDir::setPath(const QString &path) QString QDir::path() const { Q_D(const QDir); - return d->data->path; + return d->path; } /*! @@ -628,7 +615,7 @@ QString QDir::path() const QString QDir::absolutePath() const { Q_D(const QDir); - QString ret = d->data->path; + QString ret = d->path; if (QDir::isRelativePath(ret)) ret = absoluteFilePath(QString::fromLatin1("")); return cleanPath(ret); @@ -654,9 +641,9 @@ QString QDir::canonicalPath() const { Q_D(const QDir); - if (!d->data->fileEngine) + if (!d->fileEngine) return QLatin1String(""); - return cleanPath(d->data->fileEngine->fileName(QAbstractFileEngine::CanonicalName)); + return cleanPath(d->fileEngine->fileName(QAbstractFileEngine::CanonicalName)); } /*! @@ -673,10 +660,10 @@ QString QDir::canonicalPath() const QString QDir::dirName() const { Q_D(const QDir); - int pos = d->data->path.lastIndexOf(QLatin1Char('/')); + int pos = d->path.lastIndexOf(QLatin1Char('/')); if (pos == -1) - return d->data->path; - return d->data->path.mid(pos + 1); + return d->path; + return d->path.mid(pos + 1); } /*! @@ -694,7 +681,7 @@ QString QDir::filePath(const QString &fileName) const if (isAbsolutePath(fileName)) return QString(fileName); - QString ret = d->data->path; + QString ret = d->path; if (!fileName.isEmpty()) { if (!ret.isEmpty() && ret[(int)ret.length()-1] != QLatin1Char('/') && fileName[0] != QLatin1Char('/')) ret += QLatin1Char('/'); @@ -716,18 +703,18 @@ QString QDir::absoluteFilePath(const QString &fileName) const Q_D(const QDir); if (isAbsolutePath(fileName)) return fileName; - if (!d->data->fileEngine) + if (!d->fileEngine) return fileName; QString ret; #ifndef QT_NO_FSFILEENGINE - if (isRelativePath(d->data->path)) //get pwd + if (isRelativePath(d->path)) //get pwd ret = QFSFileEngine::currentPath(fileName); #endif - if (!d->data->path.isEmpty() && d->data->path != QLatin1String(".")) { + if (!d->path.isEmpty() && d->path != QLatin1String(".")) { if (!ret.isEmpty() && !ret.endsWith(QLatin1Char('/'))) ret += QLatin1Char('/'); - ret += d->data->path; + ret += d->path; } if (!fileName.isEmpty()) { if (!ret.isEmpty() && !ret.endsWith(QLatin1Char('/'))) @@ -875,11 +862,12 @@ QString QDir::fromNativeSeparators(const QString &pathName) */ bool QDir::cd(const QString &dirName) { - Q_D(QDir); + // Don't detach just yet. + const QDirPrivate * const d = d_ptr.constData(); if (dirName.isEmpty() || dirName == QLatin1String(".")) return true; - QString newPath = d->data->path; + QString newPath = d->path; if (isAbsolutePath(dirName)) { newPath = cleanPath(dirName); } else { @@ -892,7 +880,7 @@ bool QDir::cd(const QString &dirName) newPath += dirName; if (dirName.indexOf(QLatin1Char('/')) >= 0 - || d->data->path == QLatin1String(".") + || d->path == QLatin1String(".") || dirName == QLatin1String("..")) { newPath = cleanPath(newPath); /* @@ -939,8 +927,7 @@ bool QDir::cdUp() QStringList QDir::nameFilters() const { Q_D(const QDir); - - return d->data->nameFilters; + return d->nameFilters; } /*! @@ -961,10 +948,10 @@ QStringList QDir::nameFilters() const void QDir::setNameFilters(const QStringList &nameFilters) { Q_D(QDir); + d->initFileEngine(); + d->clear(); - QDirPrivate::Data::detach(d->data); - d->data->clear(); - d->data->nameFilters = nameFilters; + d->nameFilters = nameFilters; } /*! @@ -1068,8 +1055,7 @@ QStringList QDir::searchPaths(const QString &prefix) QDir::Filters QDir::filter() const { Q_D(const QDir); - - return d->data->filters; + return d->filters; } /*! @@ -1151,10 +1137,10 @@ QDir::Filters QDir::filter() const void QDir::setFilter(Filters filters) { Q_D(QDir); + d->initFileEngine(); + d->clear(); - QDirPrivate::Data::detach(d->data); - d->data->clear(); - d->data->filters = filters; + d->filters = filters; } /*! @@ -1165,8 +1151,7 @@ void QDir::setFilter(Filters filters) QDir::SortFlags QDir::sorting() const { Q_D(const QDir); - - return d->data->sort; + return d->sort; } /*! @@ -1210,10 +1195,10 @@ QDir::SortFlags QDir::sorting() const void QDir::setSorting(SortFlags sort) { Q_D(QDir); + d->initFileEngine(); + d->clear(); - QDirPrivate::Data::detach(d->data); - d->data->clear(); - d->data->sort = sort; + d->sort = sort; } /*! @@ -1226,9 +1211,8 @@ void QDir::setSorting(SortFlags sort) uint QDir::count() const { Q_D(const QDir); - - d->data->updateFileLists(); - return d->data->files.count(); + d->updateFileLists(); + return d->files.count(); } /*! @@ -1241,9 +1225,8 @@ uint QDir::count() const QString QDir::operator[](int pos) const { Q_D(const QDir); - - d->data->updateFileLists(); - return d->data->files[pos]; + d->updateFileLists(); + return d->files[pos]; } /*! @@ -1268,8 +1251,7 @@ QString QDir::operator[](int pos) const QStringList QDir::entryList(Filters filters, SortFlags sort) const { Q_D(const QDir); - - return entryList(d->data->nameFilters, filters, sort); + return entryList(d->nameFilters, filters, sort); } @@ -1292,8 +1274,7 @@ QStringList QDir::entryList(Filters filters, SortFlags sort) const QFileInfoList QDir::entryInfoList(Filters filters, SortFlags sort) const { Q_D(const QDir); - - return entryInfoList(d->data->nameFilters, filters, sort); + return entryInfoList(d->nameFilters, filters, sort); } /*! @@ -1318,27 +1299,27 @@ QStringList QDir::entryList(const QStringList &nameFilters, Filters filters, Q_D(const QDir); if (filters == NoFilter) - filters = d->data->filters; + filters = d->filters; #ifdef QT3_SUPPORT - if (d->data->matchAllDirs) + if (d->matchAllDirs) filters |= AllDirs; #endif if (sort == NoSort) - sort = d->data->sort; + sort = d->sort; - if (filters == d->data->filters && sort == d->data->sort && nameFilters == d->data->nameFilters) { - d->data->updateFileLists(); - return d->data->files; + if (filters == d->filters && sort == d->sort && nameFilters == d->nameFilters) { + d->updateFileLists(); + return d->files; } QFileInfoList l; - QDirIterator it(d->data->path, nameFilters, filters); + QDirIterator it(d->path, nameFilters, filters); while (it.hasNext()) { it.next(); l.append(it.fileInfo()); } QStringList ret; - d->data->sortFileList(sort, l, &ret, 0); + d->sortFileList(sort, l, &ret, 0); return ret; } @@ -1364,27 +1345,27 @@ QFileInfoList QDir::entryInfoList(const QStringList &nameFilters, Filters filter Q_D(const QDir); if (filters == NoFilter) - filters = d->data->filters; + filters = d->filters; #ifdef QT3_SUPPORT - if (d->data->matchAllDirs) + if (d->matchAllDirs) filters |= AllDirs; #endif if (sort == NoSort) - sort = d->data->sort; + sort = d->sort; - if (filters == d->data->filters && sort == d->data->sort && nameFilters == d->data->nameFilters) { - d->data->updateFileLists(); - return d->data->fileInfos; + if (filters == d->filters && sort == d->sort && nameFilters == d->nameFilters) { + d->updateFileLists(); + return d->fileInfos; } QFileInfoList l; - QDirIterator it(d->data->path, nameFilters, filters); + QDirIterator it(d->path, nameFilters, filters); while (it.hasNext()) { it.next(); l.append(it.fileInfo()); } QFileInfoList ret; - d->data->sortFileList(sort, l, 0, &ret); + d->sortFileList(sort, l, 0, &ret); return ret; } @@ -1403,11 +1384,11 @@ bool QDir::mkdir(const QString &dirName) const qWarning("QDir::mkdir: Empty or null file name(s)"); return false; } - if (!d->data->fileEngine) + if (!d->fileEngine) return false; QString fn = filePath(dirName); - return d->data->fileEngine->mkdir(fn, false); + return d->fileEngine->mkdir(fn, false); } /*! @@ -1427,11 +1408,11 @@ bool QDir::rmdir(const QString &dirName) const qWarning("QDir::rmdir: Empty or null file name(s)"); return false; } - if (!d->data->fileEngine) + if (!d->fileEngine) return false; QString fn = filePath(dirName); - return d->data->fileEngine->rmdir(fn, false); + return d->fileEngine->rmdir(fn, false); } /*! @@ -1452,11 +1433,11 @@ bool QDir::mkpath(const QString &dirPath) const qWarning("QDir::mkpath: Empty or null file name(s)"); return false; } - if (!d->data->fileEngine) + if (!d->fileEngine) return false; QString fn = filePath(dirPath); - return d->data->fileEngine->mkdir(fn, true); + return d->fileEngine->mkdir(fn, true); } /*! @@ -1478,11 +1459,11 @@ bool QDir::rmpath(const QString &dirPath) const qWarning("QDir::rmpath: Empty or null file name(s)"); return false; } - if (!d->data->fileEngine) + if (!d->fileEngine) return false; QString fn = filePath(dirPath); - return d->data->fileEngine->rmdir(fn, true); + return d->fileEngine->rmdir(fn, true); } /*! @@ -1498,10 +1479,10 @@ bool QDir::isReadable() const { Q_D(const QDir); - if (!d->data->fileEngine) + if (!d->fileEngine) return false; const QAbstractFileEngine::FileFlags info = - d->data->fileEngine->fileFlags(QAbstractFileEngine::DirectoryType + d->fileEngine->fileFlags(QAbstractFileEngine::DirectoryType | QAbstractFileEngine::PermsMask); if (!(info & QAbstractFileEngine::DirectoryType)) return false; @@ -1523,10 +1504,10 @@ bool QDir::exists() const { Q_D(const QDir); - if (!d->data->fileEngine) + if (!d->fileEngine) return false; const QAbstractFileEngine::FileFlags info = - d->data->fileEngine->fileFlags(QAbstractFileEngine::DirectoryType + d->fileEngine->fileFlags(QAbstractFileEngine::DirectoryType | QAbstractFileEngine::ExistsFlag | QAbstractFileEngine::Refresh); if (!(info & QAbstractFileEngine::DirectoryType)) @@ -1550,9 +1531,9 @@ bool QDir::isRoot() const { Q_D(const QDir); - if (!d->data->fileEngine) + if (!d->fileEngine) return true; - return d->data->fileEngine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::RootFlag; + return d->fileEngine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::RootFlag; } /*! @@ -1584,9 +1565,9 @@ bool QDir::isRelative() const { Q_D(const QDir); - if (!d->data->fileEngine) + if (!d->fileEngine) return false; - return d->data->fileEngine->isRelativePath(); + return d->fileEngine->isRelativePath(); } @@ -1599,17 +1580,19 @@ bool QDir::isRelative() const */ bool QDir::makeAbsolute() // ### What do the return values signify? { - Q_D(QDir); - - if (!d->data->fileEngine) + if (!d_ptr.constData()->fileEngine) return false; - QString absolutePath = d->data->fileEngine->fileName(QAbstractFileEngine::AbsoluteName); + QString absolutePath = d_ptr.constData()->fileEngine->fileName(QAbstractFileEngine::AbsoluteName); if (QDir::isRelativePath(absolutePath)) return false; - QDirPrivate::Data::detach(d->data); - d->data->path = absolutePath; - d->data->fileEngine->setFileName(absolutePath); - if (!(d->data->fileEngine->fileFlags(QAbstractFileEngine::TypesMask) & QAbstractFileEngine::DirectoryType)) + + Q_D(QDir); + + d->path = absolutePath; + d->initFileEngine(); + d->clear(); + + if (!(d->fileEngine->fileFlags(QAbstractFileEngine::TypesMask) & QAbstractFileEngine::DirectoryType)) return false; return true; } @@ -1628,16 +1611,16 @@ bool QDir::operator==(const QDir &dir) const const QDirPrivate *d = d_func(); const QDirPrivate *other = dir.d_func(); - if (d->data == other->data) + if (d == other) return true; - Q_ASSERT(d->data->fileEngine && other->data->fileEngine); - if (d->data->fileEngine->caseSensitive() != other->data->fileEngine->caseSensitive()) + Q_ASSERT(d->fileEngine && other->fileEngine); + if (d->fileEngine->caseSensitive() != other->fileEngine->caseSensitive()) return false; - if (d->data->filters == other->data->filters - && d->data->sort == other->data->sort - && d->data->nameFilters == other->data->nameFilters) { + if (d->filters == other->filters + && d->sort == other->sort + && d->nameFilters == other->nameFilters) { QString dir1 = absolutePath(), dir2 = dir.absolutePath(); - if (!other->data->fileEngine->caseSensitive()) + if (!other->fileEngine->caseSensitive()) return (dir1.toLower() == dir2.toLower()); return (dir1 == dir2); @@ -1655,8 +1638,7 @@ QDir &QDir::operator=(const QDir &dir) if (this == &dir) return *this; - Q_D(QDir); - qAtomicAssign(d->data, dir.d_func()->data); + d_ptr = dir.d_ptr; return *this; } @@ -1670,10 +1652,7 @@ QDir &QDir::operator=(const QDir &dir) */ QDir &QDir::operator=(const QString &path) { - Q_D(QDir); - - QDirPrivate::Data::detach(d->data, false); - d->data->setPath(path); + d_ptr->setPath(path); return *this; } @@ -1717,13 +1696,12 @@ bool QDir::remove(const QString &fileName) */ bool QDir::rename(const QString &oldName, const QString &newName) { - Q_D(QDir); - if (oldName.isEmpty() || newName.isEmpty()) { qWarning("QDir::rename: Empty or null file name(s)"); return false; } - if (!d->data->fileEngine) + + if (!d_ptr.constData()->fileEngine) return false; QFile file(filePath(oldName)); @@ -2162,10 +2140,9 @@ bool QDir::isRelativePath(const QString &path) */ void QDir::refresh() const { - Q_D(const QDir); - - QDirPrivate::Data::detach(const_cast(d)->data); - d->data->clear(); + QDirPrivate *d = const_cast(this)->d_func(); + d->initFileEngine(); + d->clear(); } /*! @@ -2177,7 +2154,7 @@ void QDir::refresh() const */ QStringList QDir::nameFiltersFromString(const QString &nameFilter) { - return QDirPrivate::Data::splitFilters(nameFilter); + return QDirPrivate::splitFilters(nameFilter); } /*! @@ -2242,7 +2219,7 @@ QStringList QDir::nameFiltersFromString(const QString &nameFilter) bool QDir::matchAllDirs() const { Q_D(const QDir); - return d->data->matchAllDirs; + return d->matchAllDirs; } @@ -2254,10 +2231,10 @@ bool QDir::matchAllDirs() const void QDir::setMatchAllDirs(bool on) { Q_D(QDir); + d->initFileEngine(); + d->clear(); - QDirPrivate::Data::detach(d->data); - d->data->clear(); - d->data->matchAllDirs = on; + d->matchAllDirs = on; } /*! @@ -2266,8 +2243,7 @@ void QDir::setMatchAllDirs(bool on) QString QDir::nameFilter() const { Q_D(const QDir); - - return nameFilters().join(QString(d->data->filterSepChar)); + return nameFilters().join(QString(d->filterSepChar)); } /*! @@ -2293,9 +2269,8 @@ QString QDir::nameFilter() const void QDir::setNameFilter(const QString &nameFilter) { Q_D(QDir); - - d->data->filterSepChar = QDirPrivate::Data::getFilterSepChar(nameFilter); - setNameFilters(QDirPrivate::Data::splitFilters(nameFilter, d->data->filterSepChar)); + d->filterSepChar = QDirPrivate::getFilterSepChar(nameFilter); + setNameFilters(QDirPrivate::splitFilters(nameFilter, d->filterSepChar)); } /*! diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h index 28da271..abfe387 100644 --- a/src/corelib/io/qdir.h +++ b/src/corelib/io/qdir.h @@ -45,7 +45,7 @@ #include #include #include -#include +#include QT_BEGIN_HEADER @@ -58,9 +58,19 @@ class QDirPrivate; class Q_CORE_EXPORT QDir { protected: - QScopedPointer d_ptr; + QSharedDataPointer d_ptr; private: - Q_DECLARE_PRIVATE(QDir) + inline QDirPrivate* d_func() + { + detach(); + return const_cast(d_ptr.constData()); + } + + inline const QDirPrivate* d_func() const + { + return d_ptr.constData(); + } + public: enum Filter { Dirs = 0x001, Files = 0x002, @@ -130,6 +140,8 @@ public: QDir &operator=(const QDir &); QDir &operator=(const QString &path); + void detach(); + void setPath(const QString &path); QString path() const; QString absolutePath() const; -- cgit v0.12 From c67fa3efd5a452144dc86717462feacb75eb9d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 25 Aug 2010 14:18:03 +0200 Subject: QDirPrivate refactoring Moved common initialization code from QDir ctor to QDirPrivate. Reviewed-by: Thomas Zander --- src/corelib/io/qdir.cpp | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index de95a40..544f67e 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -85,8 +85,14 @@ class QDirPrivate : public QSharedData { public: - QDirPrivate() + QDirPrivate(const QString &path, + const QStringList &nameFilters_ = QStringList(), + QDir::SortFlags sort_ = QDir::SortFlags(QDir::Name | QDir::IgnoreCase), + QDir::Filters filters_ = QDir::AllEntries) : QSharedData() + , nameFilters(nameFilters_) + , sort(sort_) + , filters(filters_) #ifdef QT3_SUPPORT , filterSepChar(0) , matchAllDirs(false) @@ -94,6 +100,20 @@ public: , fileEngine(0) , listsDirty(1) { + setPath(path.isEmpty() ? QString::fromLatin1(".") : path); + + bool empty = nameFilters.isEmpty(); + if (!empty) { + empty = true; + for (int i = 0; i < nameFilters.size(); ++i) { + if (!nameFilters.at(i).isEmpty()) { + empty = false; + break; + } + } + } + if (empty) + nameFilters = QStringList(QString::fromLatin1("*")); } QDirPrivate(const QDirPrivate ©) @@ -494,13 +514,8 @@ void QDirPrivate::initFileEngine() \sa currentPath() */ -QDir::QDir(const QString &path) : d_ptr(new QDirPrivate) +QDir::QDir(const QString &path) : d_ptr(new QDirPrivate(path)) { - Q_D(QDir); - d->setPath(path.isEmpty() ? QString::fromLatin1(".") : path); - d->nameFilters = QStringList(QString::fromLatin1("*")); - d->filters = AllEntries; - d->sort = SortFlags(Name | IgnoreCase); } /*! @@ -522,25 +537,9 @@ QDir::QDir(const QString &path) : d_ptr(new QDirPrivate) \sa exists(), setPath(), setNameFilter(), setFilter(), setSorting() */ QDir::QDir(const QString &path, const QString &nameFilter, - SortFlags sort, Filters filters) : d_ptr(new QDirPrivate) + SortFlags sort, Filters filters) + : d_ptr(new QDirPrivate(path, QDir::nameFiltersFromString(nameFilter), sort, filters)) { - Q_D(QDir); - d->setPath(path.isEmpty() ? QString::fromLatin1(".") : path); - d->nameFilters = QDir::nameFiltersFromString(nameFilter); - bool empty = d->nameFilters.isEmpty(); - if (!empty) { - empty = true; - for (int i = 0; i < d->nameFilters.size(); ++i) { - if (!d->nameFilters.at(i).isEmpty()) { - empty = false; - break; - } - } - } - if (empty) - d->nameFilters = QStringList(QString::fromLatin1("*")); - d->sort = sort; - d->filters = filters; } /*! -- cgit v0.12 From 148eb83d1468fd3d5a14199e2186c0792a58ed9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 25 Aug 2010 15:16:51 +0200 Subject: QDirPrivate refactoring Some renaming to make intent clearer and improve consistency: listsDirty => listsInitialized (logic inverted) updateFileLists => initFileLists clear => clearFileLists Also note that initializing file lists shouldn't trigger detach, because no previous version of the cached data has been seen. Reviewed-by: Thomas Zander --- src/corelib/io/qdir.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 544f67e..3ab0e08 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -98,7 +98,7 @@ public: , matchAllDirs(false) #endif , fileEngine(0) - , listsDirty(1) + , fileListsInitialized(false) { setPath(path.isEmpty() ? QString::fromLatin1(".") : path); @@ -127,7 +127,7 @@ public: , matchAllDirs(copy.matchAllDirs) #endif , fileEngine(0) - , listsDirty(1) + , fileListsInitialized(false) { } @@ -137,7 +137,7 @@ public: } void initFileEngine(); - void updateFileLists() const; + void initFileLists() const; static void sortFileList(QDir::SortFlags, QFileInfoList &, QStringList *, QFileInfoList *); @@ -175,11 +175,11 @@ public: // set the path to be the qt friendly version so then we can operate on it using just / path = fileEngine->fileName(QAbstractFileEngine::DefaultName); - clear(); + clearFileLists(); } - inline void clear() { - listsDirty = 1; + inline void clearFileLists() { + fileListsInitialized = false; files.clear(); fileInfos.clear(); } @@ -196,7 +196,7 @@ public: QAbstractFileEngine *fileEngine; - mutable uint listsDirty : 1; + mutable bool fileListsInitialized; mutable QStringList files; mutable QFileInfoList fileInfos; }; @@ -312,9 +312,9 @@ inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QFileInfoList &l, } } -inline void QDirPrivate::updateFileLists() const +inline void QDirPrivate::initFileLists() const { - if (listsDirty) { + if (!fileListsInitialized) { QFileInfoList l; QDirIterator it(path, nameFilters, filters); while (it.hasNext()) { @@ -322,7 +322,7 @@ inline void QDirPrivate::updateFileLists() const l.append(it.fileInfo()); } sortFileList(sort, l, &files, &fileInfos); - listsDirty = 0; + fileListsInitialized = true; } } @@ -948,7 +948,7 @@ void QDir::setNameFilters(const QStringList &nameFilters) { Q_D(QDir); d->initFileEngine(); - d->clear(); + d->clearFileLists(); d->nameFilters = nameFilters; } @@ -1137,7 +1137,7 @@ void QDir::setFilter(Filters filters) { Q_D(QDir); d->initFileEngine(); - d->clear(); + d->clearFileLists(); d->filters = filters; } @@ -1195,7 +1195,7 @@ void QDir::setSorting(SortFlags sort) { Q_D(QDir); d->initFileEngine(); - d->clear(); + d->clearFileLists(); d->sort = sort; } @@ -1210,7 +1210,7 @@ void QDir::setSorting(SortFlags sort) uint QDir::count() const { Q_D(const QDir); - d->updateFileLists(); + d->initFileLists(); return d->files.count(); } @@ -1224,7 +1224,7 @@ uint QDir::count() const QString QDir::operator[](int pos) const { Q_D(const QDir); - d->updateFileLists(); + d->initFileLists(); return d->files[pos]; } @@ -1307,7 +1307,7 @@ QStringList QDir::entryList(const QStringList &nameFilters, Filters filters, sort = d->sort; if (filters == d->filters && sort == d->sort && nameFilters == d->nameFilters) { - d->updateFileLists(); + d->initFileLists(); return d->files; } @@ -1353,7 +1353,7 @@ QFileInfoList QDir::entryInfoList(const QStringList &nameFilters, Filters filter sort = d->sort; if (filters == d->filters && sort == d->sort && nameFilters == d->nameFilters) { - d->updateFileLists(); + d->initFileLists(); return d->fileInfos; } @@ -1589,7 +1589,7 @@ bool QDir::makeAbsolute() // ### What do the return values signify? d->path = absolutePath; d->initFileEngine(); - d->clear(); + d->clearFileLists(); if (!(d->fileEngine->fileFlags(QAbstractFileEngine::TypesMask) & QAbstractFileEngine::DirectoryType)) return false; @@ -2141,7 +2141,7 @@ void QDir::refresh() const { QDirPrivate *d = const_cast(this)->d_func(); d->initFileEngine(); - d->clear(); + d->clearFileLists(); } /*! @@ -2231,7 +2231,7 @@ void QDir::setMatchAllDirs(bool on) { Q_D(QDir); d->initFileEngine(); - d->clear(); + d->clearFileLists(); d->matchAllDirs = on; } -- cgit v0.12 From 1885c88c5721f026d3b0c01dbc756857a79cce91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 25 Aug 2010 15:25:22 +0200 Subject: QDirPrivate refactoring While refactoring, a bug was introduced where shared data would be updated before detaching in setNameFilter. Further refactoring turned this into a double-detach, instead. Now the issue is fixed by adding the appropriate initFileEngine and nameFilters assignment, instead of calling setNameFilters to finish the job. Reviewed-by: Thomas Zander --- src/corelib/io/qdir.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 3ab0e08..7c38ecf 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -2268,8 +2268,10 @@ QString QDir::nameFilter() const void QDir::setNameFilter(const QString &nameFilter) { Q_D(QDir); + d->initFileEngine(); + d->filterSepChar = QDirPrivate::getFilterSepChar(nameFilter); - setNameFilters(QDirPrivate::splitFilters(nameFilter, d->filterSepChar)); + d->nameFilters = QDirPrivate::splitFilters(nameFilter, d->filterSepChar); } /*! -- cgit v0.12 From c3c30e16a2bb5ab9236946aa6c48ca02ef2afa08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Thu, 26 Aug 2010 13:47:33 +0200 Subject: QDir::operator= simplification With the recent changes to QDirPrivate and how d_ptr is now a QSharedDataPointer, we no longer need to worry about self-assignment, as that is already handled by the d_ptr. Simplifying code here. Reviewed-by: Prasanth Ullattil --- src/corelib/io/qdir.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 7c38ecf..b35cd2b 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1634,9 +1634,6 @@ bool QDir::operator==(const QDir &dir) const */ QDir &QDir::operator=(const QDir &dir) { - if (this == &dir) - return *this; - d_ptr = dir.d_ptr; return *this; } -- cgit v0.12 From 4c88ffbbf0de319bcb4aef54be3997bb41a08100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Thu, 26 Aug 2010 13:49:31 +0200 Subject: QDir::makeAbsolute could self-destruct on failure makeAbsolute would return false if the newly constructed file engine reported it wasn't referencing a directory. At this point, the private data has already been updated, rendering the instance unusable. Instead, we now create a separate QDir instance and reset our private data only on success. Similarly to what's done in QDir::cd. Reviewed-by: Prasanth Ullattil --- src/corelib/io/qdir.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index b35cd2b..5ae54fc 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1585,14 +1585,11 @@ bool QDir::makeAbsolute() // ### What do the return values signify? if (QDir::isRelativePath(absolutePath)) return false; - Q_D(QDir); - - d->path = absolutePath; - d->initFileEngine(); - d->clearFileLists(); - - if (!(d->fileEngine->fileFlags(QAbstractFileEngine::TypesMask) & QAbstractFileEngine::DirectoryType)) + QDir dir(absolutePath); + if (!(dir.d_ptr.constData()->fileEngine->fileFlags(QAbstractFileEngine::TypesMask) & QAbstractFileEngine::DirectoryType)) return false; + + *this = dir; return true; } -- cgit v0.12 From 659c4d56a075c1f49ece99be38d7e436b2c53581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Thu, 26 Aug 2010 14:03:36 +0200 Subject: Simplify QDir::cd Copy constructing a QDir instance from this and then detaching it in setPath doesn't get us anything so we might as well do it all in one go. Reviewed-by: Prasanth Ullattil --- src/corelib/io/qdir.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 5ae54fc..c797ee8 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -896,8 +896,7 @@ bool QDir::cd(const QString &dirName) } } - QDir dir(*this); - dir.setPath(newPath); + QDir dir(newPath); if (!dir.exists()) return false; -- cgit v0.12 From 7f369fc76079695f00e249e017328fdf6d5e0680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 30 Aug 2010 15:02:29 +0200 Subject: Removed QFileInfoPrivate::initFileEngine As it served no real purpose. Instead, the relevant bits were inlined in the constructor that used it and makeAbsolute was adapted to use operator=. Reviewed-by: Thomas Zander --- src/corelib/io/qfileinfo.cpp | 12 ++---------- src/corelib/io/qfileinfo_p.h | 5 ++--- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index fe557d0..ccfc9c2 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -47,15 +47,6 @@ QT_BEGIN_NAMESPACE -void QFileInfoPrivate::initFileEngine(const QString &file) -{ - delete fileEngine; - fileEngine = 0; - clear(); - fileEngine = QAbstractFileEngine::create(file); - fileName = file; -} - QString QFileInfoPrivate::getFileName(QAbstractFileEngine::FileName name) const { if (cache_enabled && !fileNames[(int)name].isNull()) @@ -586,7 +577,8 @@ bool QFileInfo::makeAbsolute() return false; QString absFileName = d_ptr.constData()->getFileName(QAbstractFileEngine::AbsoluteName); // QSharedDataPointer::operator->() will detach. - d_ptr->initFileEngine(absFileName); + + *this = QFileInfo(absFileName); return true; } diff --git a/src/corelib/io/qfileinfo_p.h b/src/corelib/io/qfileinfo_p.h index 138116e..f23ae53 100644 --- a/src/corelib/io/qfileinfo_p.h +++ b/src/corelib/io/qfileinfo_p.h @@ -79,16 +79,15 @@ public: cachedFlags(0), cache_enabled(copy.cache_enabled), fileFlags(0), fileSize(0) {} inline QFileInfoPrivate(const QString &file) - : QSharedData(), fileEngine(0), + : QSharedData(), fileEngine(QAbstractFileEngine::create(file)), + fileName(file), cachedFlags(0), cache_enabled(1), fileFlags(0), fileSize(0) { - initFileEngine(file); } inline ~QFileInfoPrivate() { delete fileEngine; } - void initFileEngine(const QString &); inline void clearFlags() const { fileFlags = 0; -- cgit v0.12 From 96f8768962c4c8f088bb51af227d069568deaba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 30 Aug 2010 17:40:11 +0200 Subject: QFileInfo: Prepare for engine-less implementation The absence of a file engine was being interpreted as a synonym for a default constructed instance (or failed engine creation with QT_NO_FSFILEENGINE). By having an explicit flag, we open the door for bypassing file engine creation. Reviewed-by: Thomas Zander --- src/corelib/io/qfileinfo.cpp | 73 ++++++++++++++++++++++---------------------- src/corelib/io/qfileinfo_p.h | 32 +++++++++++++------ 2 files changed, 59 insertions(+), 46 deletions(-) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index ccfc9c2..248b83d 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -328,7 +328,7 @@ bool QFileInfo::operator==(const QFileInfo &fileinfo) const // ### (GetFullPathName()). if (fileinfo.d_ptr == d_ptr) return true; - if (!d->fileEngine || !fileinfo.d_ptr->fileEngine) + if (d->isDefaultConstructed || fileinfo.d_ptr->isDefaultConstructed) return false; if (d->fileEngine->caseSensitive() != fileinfo.d_ptr->fileEngine->caseSensitive()) return false; @@ -454,7 +454,7 @@ void QFileInfo::setFile(const QDir &dir, const QString &file) QString QFileInfo::absoluteFilePath() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::AbsoluteName); } @@ -471,7 +471,7 @@ QString QFileInfo::absoluteFilePath() const QString QFileInfo::canonicalFilePath() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::CanonicalName); } @@ -498,7 +498,7 @@ QString QFileInfo::absolutePath() const { Q_D(const QFileInfo); - if (!d->fileEngine) { + if (d->isDefaultConstructed) { return QLatin1String(""); } else if (d->fileName.isEmpty()) { qWarning("QFileInfo::absolutePath: Constructed with empty filename"); @@ -518,7 +518,7 @@ QString QFileInfo::absolutePath() const QString QFileInfo::canonicalPath() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::CanonicalPathName); } @@ -535,7 +535,7 @@ QString QFileInfo::canonicalPath() const QString QFileInfo::path() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::PathName); } @@ -559,7 +559,7 @@ QString QFileInfo::path() const bool QFileInfo::isRelative() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return true; return d->fileEngine->isRelativePath(); } @@ -573,7 +573,8 @@ bool QFileInfo::isRelative() const */ bool QFileInfo::makeAbsolute() { - if (!d_ptr.constData()->fileEngine || !d_ptr.constData()->fileEngine->isRelativePath()) + if (d_ptr.constData()->isDefaultConstructed + || !d_ptr.constData()->fileEngine->isRelativePath()) return false; QString absFileName = d_ptr.constData()->getFileName(QAbstractFileEngine::AbsoluteName); // QSharedDataPointer::operator->() will detach. @@ -591,7 +592,7 @@ bool QFileInfo::makeAbsolute() bool QFileInfo::exists() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return false; return d->getFileFlags(QAbstractFileEngine::ExistsFlag); } @@ -618,7 +619,7 @@ void QFileInfo::refresh() QString QFileInfo::filePath() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::DefaultName); } @@ -637,7 +638,7 @@ QString QFileInfo::filePath() const QString QFileInfo::fileName() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::BaseName); } @@ -657,7 +658,7 @@ QString QFileInfo::fileName() const QString QFileInfo::bundleName() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::BundleName); } @@ -681,7 +682,7 @@ QString QFileInfo::bundleName() const QString QFileInfo::baseName() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::BaseName).section(QLatin1Char('.'), 0, 0); } @@ -700,7 +701,7 @@ QString QFileInfo::baseName() const QString QFileInfo::completeBaseName() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QLatin1String(""); QString name = d->getFileName(QAbstractFileEngine::BaseName); int index = name.lastIndexOf(QLatin1Char('.')); @@ -721,7 +722,7 @@ QString QFileInfo::completeBaseName() const QString QFileInfo::completeSuffix() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QLatin1String(""); QString fileName = d->getFileName(QAbstractFileEngine::BaseName); int firstDot = fileName.indexOf(QLatin1Char('.')); @@ -748,7 +749,7 @@ QString QFileInfo::completeSuffix() const QString QFileInfo::suffix() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QLatin1String(""); QString fileName = d->getFileName(QAbstractFileEngine::BaseName); int lastDot = fileName.lastIndexOf(QLatin1Char('.')); @@ -813,7 +814,7 @@ QDir QFileInfo::dir(bool absPath) const bool QFileInfo::isReadable() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return false; return d->getFileFlags(QAbstractFileEngine::ReadUserPerm); } @@ -826,7 +827,7 @@ bool QFileInfo::isReadable() const bool QFileInfo::isWritable() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return false; return d->getFileFlags(QAbstractFileEngine::WriteUserPerm); } @@ -839,7 +840,7 @@ bool QFileInfo::isWritable() const bool QFileInfo::isExecutable() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return false; return d->getFileFlags(QAbstractFileEngine::ExeUserPerm); } @@ -853,7 +854,7 @@ bool QFileInfo::isExecutable() const bool QFileInfo::isHidden() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return false; return d->getFileFlags(QAbstractFileEngine::HiddenFlag); } @@ -868,7 +869,7 @@ bool QFileInfo::isHidden() const bool QFileInfo::isFile() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return false; return d->getFileFlags(QAbstractFileEngine::FileType); } @@ -882,7 +883,7 @@ bool QFileInfo::isFile() const bool QFileInfo::isDir() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return false; return d->getFileFlags(QAbstractFileEngine::DirectoryType); } @@ -898,7 +899,7 @@ bool QFileInfo::isDir() const bool QFileInfo::isBundle() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return false; return d->getFileFlags(QAbstractFileEngine::BundleType); } @@ -923,7 +924,7 @@ bool QFileInfo::isBundle() const bool QFileInfo::isSymLink() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return false; return d->getFileFlags(QAbstractFileEngine::LinkType); } @@ -936,7 +937,7 @@ bool QFileInfo::isSymLink() const bool QFileInfo::isRoot() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return true; return d->getFileFlags(QAbstractFileEngine::RootFlag); } @@ -964,7 +965,7 @@ bool QFileInfo::isRoot() const QString QFileInfo::readLink() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::LinkName); } @@ -982,7 +983,7 @@ QString QFileInfo::readLink() const QString QFileInfo::owner() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QLatin1String(""); return d->getFileOwner(QAbstractFileEngine::OwnerUser); } @@ -998,7 +999,7 @@ QString QFileInfo::owner() const uint QFileInfo::ownerId() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return 0; return d->fileEngine->ownerId(QAbstractFileEngine::OwnerUser); } @@ -1016,7 +1017,7 @@ uint QFileInfo::ownerId() const QString QFileInfo::group() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QLatin1String(""); return d->getFileOwner(QAbstractFileEngine::OwnerGroup); } @@ -1032,7 +1033,7 @@ QString QFileInfo::group() const uint QFileInfo::groupId() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return 0; return d->fileEngine->ownerId(QAbstractFileEngine::OwnerGroup); } @@ -1053,7 +1054,7 @@ uint QFileInfo::groupId() const bool QFileInfo::permission(QFile::Permissions permissions) const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return false; return d->getFileFlags(QAbstractFileEngine::FileFlags((int)permissions)) == (uint)permissions; } @@ -1065,7 +1066,7 @@ bool QFileInfo::permission(QFile::Permissions permissions) const QFile::Permissions QFileInfo::permissions() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return 0; return QFile::Permissions(d->getFileFlags(QAbstractFileEngine::PermsMask) & QAbstractFileEngine::PermsMask); } @@ -1080,7 +1081,7 @@ QFile::Permissions QFileInfo::permissions() const qint64 QFileInfo::size() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return 0; if (!d->getCachedFlag(QFileInfoPrivate::CachedSize)) { d->setCachedFlag(QFileInfoPrivate::CachedSize); @@ -1105,7 +1106,7 @@ qint64 QFileInfo::size() const QDateTime QFileInfo::created() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QDateTime(); return d->getFileTime(QAbstractFileEngine::CreationTime); } @@ -1118,7 +1119,7 @@ QDateTime QFileInfo::created() const QDateTime QFileInfo::lastModified() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QDateTime(); return d->getFileTime(QAbstractFileEngine::ModificationTime); } @@ -1134,7 +1135,7 @@ QDateTime QFileInfo::lastModified() const QDateTime QFileInfo::lastRead() const { Q_D(const QFileInfo); - if (!d->fileEngine) + if (d->isDefaultConstructed) return QDateTime(); return d->getFileTime(QAbstractFileEngine::AccessTime); } diff --git a/src/corelib/io/qfileinfo_p.h b/src/corelib/io/qfileinfo_p.h index f23ae53..b9b1092 100644 --- a/src/corelib/io/qfileinfo_p.h +++ b/src/corelib/io/qfileinfo_p.h @@ -71,23 +71,33 @@ public: inline QFileInfoPrivate() : QSharedData(), fileEngine(0), - cachedFlags(0), cache_enabled(1), fileFlags(0), fileSize(0) + cachedFlags(0), + isDefaultConstructed(true), + cache_enabled(true), fileFlags(0), fileSize(0) {} inline QFileInfoPrivate(const QFileInfoPrivate ©) : QSharedData(copy), fileEngine(QAbstractFileEngine::create(copy.fileName)), fileName(copy.fileName), - cachedFlags(0), cache_enabled(copy.cache_enabled), fileFlags(0), fileSize(0) + cachedFlags(0), +#ifndef QT_NO_FSFILEENGINE + isDefaultConstructed(false), +#else + isDefaultConstructed(!fileEngine), +#endif + cache_enabled(copy.cache_enabled), fileFlags(0), fileSize(0) {} inline QFileInfoPrivate(const QString &file) : QSharedData(), fileEngine(QAbstractFileEngine::create(file)), fileName(file), - cachedFlags(0), cache_enabled(1), fileFlags(0), fileSize(0) + cachedFlags(0), +#ifndef QT_NO_FSFILEENGINE + isDefaultConstructed(false), +#else + isDefaultConstructed(!fileEngine), +#endif + cache_enabled(true), fileFlags(0), fileSize(0) { } - inline ~QFileInfoPrivate() - { - delete fileEngine; - } inline void clearFlags() const { fileFlags = 0; @@ -108,13 +118,15 @@ public: QString getFileName(QAbstractFileEngine::FileName) const; QString getFileOwner(QAbstractFileEngine::FileOwner own) const; - QAbstractFileEngine *fileEngine; + QScopedPointer const fileEngine; + mutable QString fileName; mutable QString fileNames[QAbstractFileEngine::NFileNames]; mutable QString fileOwners[2]; - mutable uint cachedFlags : 31; - mutable uint cache_enabled : 1; + mutable uint cachedFlags : 30; + bool const isDefaultConstructed : 1; // QFileInfo is a default constructed instance + bool cache_enabled : 1; mutable uint fileFlags; mutable qint64 fileSize; mutable QDateTime fileTimes[3]; -- cgit v0.12 From bde86efc2ad34aa3756ca74e31e3052de5254261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 30 Aug 2010 18:47:13 +0200 Subject: Reverting QDir::detach introduced earlier From the client API it is a broken concept, because it could leave the user with an uninitialized file engine. Fixing to initialize the file engine, would mean it is useless for internal use where file engines are initialized separately. In the end, removing both the QDir::detach introduced earlier and throwing away the private d_func'tions altogether is a binary-compatible change that should allow us to push this change in a patch release (fingers crossed!) Reviewed-by: Thiago Macieira --- src/corelib/io/qdir.cpp | 71 +++++++++++++++++++++++-------------------------- src/corelib/io/qdir.h | 13 --------- 2 files changed, 33 insertions(+), 51 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index c797ee8..e842611 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -561,11 +561,6 @@ QDir::~QDir() { } -void QDir::detach() -{ - d_ptr.detach(); -} - /*! Sets the path of the directory to \a path. The path is cleaned of redundant ".", ".." and of multiple separators. No check is made @@ -599,7 +594,7 @@ void QDir::setPath(const QString &path) */ QString QDir::path() const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); return d->path; } @@ -613,7 +608,7 @@ QString QDir::path() const */ QString QDir::absolutePath() const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); QString ret = d->path; if (QDir::isRelativePath(ret)) ret = absoluteFilePath(QString::fromLatin1("")); @@ -638,7 +633,7 @@ QString QDir::absolutePath() const */ QString QDir::canonicalPath() const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); if (!d->fileEngine) return QLatin1String(""); @@ -658,7 +653,7 @@ QString QDir::canonicalPath() const */ QString QDir::dirName() const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); int pos = d->path.lastIndexOf(QLatin1Char('/')); if (pos == -1) return d->path; @@ -676,7 +671,7 @@ QString QDir::dirName() const */ QString QDir::filePath(const QString &fileName) const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); if (isAbsolutePath(fileName)) return QString(fileName); @@ -699,7 +694,7 @@ QString QDir::filePath(const QString &fileName) const */ QString QDir::absoluteFilePath(const QString &fileName) const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); if (isAbsolutePath(fileName)) return fileName; if (!d->fileEngine) @@ -924,7 +919,7 @@ bool QDir::cdUp() */ QStringList QDir::nameFilters() const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); return d->nameFilters; } @@ -945,7 +940,7 @@ QStringList QDir::nameFilters() const */ void QDir::setNameFilters(const QStringList &nameFilters) { - Q_D(QDir); + QDirPrivate* d = d_ptr.data(); d->initFileEngine(); d->clearFileLists(); @@ -1052,7 +1047,7 @@ QStringList QDir::searchPaths(const QString &prefix) */ QDir::Filters QDir::filter() const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); return d->filters; } @@ -1134,7 +1129,7 @@ QDir::Filters QDir::filter() const */ void QDir::setFilter(Filters filters) { - Q_D(QDir); + QDirPrivate* d = d_ptr.data(); d->initFileEngine(); d->clearFileLists(); @@ -1148,7 +1143,7 @@ void QDir::setFilter(Filters filters) */ QDir::SortFlags QDir::sorting() const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); return d->sort; } @@ -1192,7 +1187,7 @@ QDir::SortFlags QDir::sorting() const */ void QDir::setSorting(SortFlags sort) { - Q_D(QDir); + QDirPrivate* d = d_ptr.data(); d->initFileEngine(); d->clearFileLists(); @@ -1208,7 +1203,7 @@ void QDir::setSorting(SortFlags sort) */ uint QDir::count() const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); d->initFileLists(); return d->files.count(); } @@ -1222,7 +1217,7 @@ uint QDir::count() const */ QString QDir::operator[](int pos) const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); d->initFileLists(); return d->files[pos]; } @@ -1248,7 +1243,7 @@ QString QDir::operator[](int pos) const */ QStringList QDir::entryList(Filters filters, SortFlags sort) const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); return entryList(d->nameFilters, filters, sort); } @@ -1271,7 +1266,7 @@ QStringList QDir::entryList(Filters filters, SortFlags sort) const */ QFileInfoList QDir::entryInfoList(Filters filters, SortFlags sort) const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); return entryInfoList(d->nameFilters, filters, sort); } @@ -1294,7 +1289,7 @@ QFileInfoList QDir::entryInfoList(Filters filters, SortFlags sort) const QStringList QDir::entryList(const QStringList &nameFilters, Filters filters, SortFlags sort) const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); if (filters == NoFilter) filters = d->filters; @@ -1340,7 +1335,7 @@ QStringList QDir::entryList(const QStringList &nameFilters, Filters filters, QFileInfoList QDir::entryInfoList(const QStringList &nameFilters, Filters filters, SortFlags sort) const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); if (filters == NoFilter) filters = d->filters; @@ -1376,7 +1371,7 @@ QFileInfoList QDir::entryInfoList(const QStringList &nameFilters, Filters filter */ bool QDir::mkdir(const QString &dirName) const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); if (dirName.isEmpty()) { qWarning("QDir::mkdir: Empty or null file name(s)"); @@ -1400,7 +1395,7 @@ bool QDir::mkdir(const QString &dirName) const */ bool QDir::rmdir(const QString &dirName) const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); if (dirName.isEmpty()) { qWarning("QDir::rmdir: Empty or null file name(s)"); @@ -1425,7 +1420,7 @@ bool QDir::rmdir(const QString &dirName) const */ bool QDir::mkpath(const QString &dirPath) const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); if (dirPath.isEmpty()) { qWarning("QDir::mkpath: Empty or null file name(s)"); @@ -1451,7 +1446,7 @@ bool QDir::mkpath(const QString &dirPath) const */ bool QDir::rmpath(const QString &dirPath) const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); if (dirPath.isEmpty()) { qWarning("QDir::rmpath: Empty or null file name(s)"); @@ -1475,7 +1470,7 @@ bool QDir::rmpath(const QString &dirPath) const */ bool QDir::isReadable() const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); if (!d->fileEngine) return false; @@ -1500,7 +1495,7 @@ bool QDir::isReadable() const */ bool QDir::exists() const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); if (!d->fileEngine) return false; @@ -1527,7 +1522,7 @@ bool QDir::exists() const */ bool QDir::isRoot() const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); if (!d->fileEngine) return true; @@ -1561,7 +1556,7 @@ bool QDir::isRoot() const */ bool QDir::isRelative() const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); if (!d->fileEngine) return false; @@ -1603,8 +1598,8 @@ bool QDir::makeAbsolute() // ### What do the return values signify? */ bool QDir::operator==(const QDir &dir) const { - const QDirPrivate *d = d_func(); - const QDirPrivate *other = dir.d_func(); + const QDirPrivate *d = d_ptr.constData(); + const QDirPrivate *other = dir.d_ptr.constData(); if (d == other) return true; @@ -2132,7 +2127,7 @@ bool QDir::isRelativePath(const QString &path) */ void QDir::refresh() const { - QDirPrivate *d = const_cast(this)->d_func(); + QDirPrivate *d = const_cast(this)->d_ptr.data(); d->initFileEngine(); d->clearFileLists(); } @@ -2210,7 +2205,7 @@ QStringList QDir::nameFiltersFromString(const QString &nameFilter) */ bool QDir::matchAllDirs() const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); return d->matchAllDirs; } @@ -2222,7 +2217,7 @@ bool QDir::matchAllDirs() const */ void QDir::setMatchAllDirs(bool on) { - Q_D(QDir); + QDirPrivate* d = d_ptr.data(); d->initFileEngine(); d->clearFileLists(); @@ -2234,7 +2229,7 @@ void QDir::setMatchAllDirs(bool on) */ QString QDir::nameFilter() const { - Q_D(const QDir); + const QDirPrivate* d = d_ptr.constData(); return nameFilters().join(QString(d->filterSepChar)); } @@ -2260,7 +2255,7 @@ QString QDir::nameFilter() const */ void QDir::setNameFilter(const QString &nameFilter) { - Q_D(QDir); + QDirPrivate* d = d_ptr.data(); d->initFileEngine(); d->filterSepChar = QDirPrivate::getFilterSepChar(nameFilter); diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h index abfe387..7e5fbac 100644 --- a/src/corelib/io/qdir.h +++ b/src/corelib/io/qdir.h @@ -59,17 +59,6 @@ class Q_CORE_EXPORT QDir { protected: QSharedDataPointer d_ptr; -private: - inline QDirPrivate* d_func() - { - detach(); - return const_cast(d_ptr.constData()); - } - - inline const QDirPrivate* d_func() const - { - return d_ptr.constData(); - } public: enum Filter { Dirs = 0x001, @@ -140,8 +129,6 @@ public: QDir &operator=(const QDir &); QDir &operator=(const QString &path); - void detach(); - void setPath(const QString &path); QString path() const; QString absolutePath() const; -- cgit v0.12 From 8e8743113f642e82bac6ecc055d2d3be8f53d7a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 30 Aug 2010 19:02:26 +0200 Subject: Another bug-o introduced in fixing QDirPrivate refactoring Must clear file lists when changing the name filters. --- src/corelib/io/qdir.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index e842611..b126c6d 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -2257,6 +2257,7 @@ void QDir::setNameFilter(const QString &nameFilter) { QDirPrivate* d = d_ptr.data(); d->initFileEngine(); + d->clearFileLists(); d->filterSepChar = QDirPrivate::getFilterSepChar(nameFilter); d->nameFilters = QDirPrivate::splitFilters(nameFilter, d->filterSepChar); -- cgit v0.12 From b0de175aab06092932077eb1c5fb3f89691b6014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 31 Aug 2010 09:56:27 +0200 Subject: QDir and QFileInfo shouldn't lose properties when detaching For QFileInfo, the caching state was being lost on the different setFile overloads. QDir::cd and ::makeAbsolute were losing filters and sorting flags. QDir issues were introduced with these patches: "Simplify QDir::cd" "QDir::makeAbsolute could self-destruct on failure" Reviewed-by: Prasanth Ullattil --- src/corelib/io/qdir.cpp | 41 ++++++++------ src/corelib/io/qfileinfo.cpp | 8 +-- tests/auto/qdir/tst_qdir.cpp | 99 ++++++++++++++++++++++++++++++++++ tests/auto/qfileinfo/tst_qfileinfo.cpp | 48 +++++++++++++++++ 4 files changed, 176 insertions(+), 20 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index b126c6d..6393509 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -136,6 +136,19 @@ public: delete fileEngine; } + bool exists() const + { + if (!fileEngine) + return false; + const QAbstractFileEngine::FileFlags info = + fileEngine->fileFlags(QAbstractFileEngine::DirectoryType + | QAbstractFileEngine::ExistsFlag + | QAbstractFileEngine::Refresh); + if (!(info & QAbstractFileEngine::DirectoryType)) + return false; + return info & QAbstractFileEngine::ExistsFlag; + } + void initFileEngine(); void initFileLists() const; @@ -891,11 +904,13 @@ bool QDir::cd(const QString &dirName) } } - QDir dir(newPath); - if (!dir.exists()) + QScopedPointer dir(new QDirPrivate(*d_ptr.constData())); + dir->setPath(newPath); + + if (!dir->exists()) return false; - *this = dir; + d_ptr = dir.take(); return true; } @@ -1495,17 +1510,7 @@ bool QDir::isReadable() const */ bool QDir::exists() const { - const QDirPrivate* d = d_ptr.constData(); - - if (!d->fileEngine) - return false; - const QAbstractFileEngine::FileFlags info = - d->fileEngine->fileFlags(QAbstractFileEngine::DirectoryType - | QAbstractFileEngine::ExistsFlag - | QAbstractFileEngine::Refresh); - if (!(info & QAbstractFileEngine::DirectoryType)) - return false; - return info & QAbstractFileEngine::ExistsFlag; + return d_ptr->exists(); } /*! @@ -1579,11 +1584,13 @@ bool QDir::makeAbsolute() // ### What do the return values signify? if (QDir::isRelativePath(absolutePath)) return false; - QDir dir(absolutePath); - if (!(dir.d_ptr.constData()->fileEngine->fileFlags(QAbstractFileEngine::TypesMask) & QAbstractFileEngine::DirectoryType)) + QScopedPointer dir(new QDirPrivate(*d_ptr.constData())); + dir->setPath(absolutePath); + + if (!(dir->fileEngine->fileFlags(QAbstractFileEngine::TypesMask) & QAbstractFileEngine::DirectoryType)) return false; - *this = dir; + d_ptr = dir.take(); return true; } diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 248b83d..7eca212 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -395,7 +395,9 @@ QFileInfo &QFileInfo::operator=(const QFileInfo &fileinfo) */ void QFileInfo::setFile(const QString &file) { + bool caching = d_ptr.constData()->cache_enabled; *this = QFileInfo(file); + d_ptr->cache_enabled = caching; } /*! @@ -411,7 +413,7 @@ void QFileInfo::setFile(const QString &file) */ void QFileInfo::setFile(const QFile &file) { - *this = QFileInfo(file.fileName()); + setFile(file.fileName()); } /*! @@ -427,7 +429,7 @@ void QFileInfo::setFile(const QFile &file) */ void QFileInfo::setFile(const QDir &dir, const QString &file) { - *this = QFileInfo(dir.filePath(file)); + setFile(dir.filePath(file)); } /*! @@ -579,7 +581,7 @@ bool QFileInfo::makeAbsolute() QString absFileName = d_ptr.constData()->getFileName(QAbstractFileEngine::AbsoluteName); // QSharedDataPointer::operator->() will detach. - *this = QFileInfo(absFileName); + setFile(absFileName); return true; } diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp index c8c835f..fb83a5a 100644 --- a/tests/auto/qdir/tst_qdir.cpp +++ b/tests/auto/qdir/tst_qdir.cpp @@ -167,6 +167,8 @@ private slots: void longFileName(); void updateFileLists(); + + void detachingOperations(); }; // Testing get/set functions @@ -1541,6 +1543,103 @@ void tst_QDir::updateFileLists() QCOMPARE(dir.entryList(), QStringList() << "sub-dir1" << "sub-dir2" << "file1.txt"); } +void tst_QDir::detachingOperations() +{ + QString const defaultPath("."); + QStringList const defaultNameFilters = QStringList("*"); + QDir::SortFlags const defaultSorting = QDir::Name | QDir::IgnoreCase; + QDir::Filters const defaultFilter = QDir::AllEntries; + + QString const path1(".."); + QString const path2("./foo"); + QStringList const nameFilters = QStringList(QString("*.txt")); + QDir::SortFlags const sorting = QDir::Name | QDir::DirsLast | QDir::Reversed; + QDir::Filters const filter = QDir::Writable; + + QDir dir1; + + QCOMPARE(dir1.path(), defaultPath); + QCOMPARE(dir1.filter(), defaultFilter); + QCOMPARE(dir1.nameFilters(), defaultNameFilters); + QCOMPARE(dir1.sorting(), defaultSorting); + + dir1.setPath(path1); + QCOMPARE(dir1.path(), path1); + QCOMPARE(dir1.filter(), defaultFilter); + QCOMPARE(dir1.nameFilters(), defaultNameFilters); + QCOMPARE(dir1.sorting(), defaultSorting); + + dir1.setFilter(filter); + QCOMPARE(dir1.path(), path1); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), defaultNameFilters); + QCOMPARE(dir1.sorting(), defaultSorting); + + dir1.setNameFilters(nameFilters); + QCOMPARE(dir1.path(), path1); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), defaultSorting); + + dir1.setSorting(sorting); + QCOMPARE(dir1.path(), path1); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), sorting); + + dir1.setPath(path2); + QCOMPARE(dir1.path(), path2); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), sorting); + + { + QDir dir2(dir1); + QCOMPARE(dir2.path(), path2); + QCOMPARE(dir2.filter(), filter); + QCOMPARE(dir2.nameFilters(), nameFilters); + QCOMPARE(dir2.sorting(), sorting); + } + + { + QDir dir2; + QCOMPARE(dir2.path(), defaultPath); + QCOMPARE(dir2.filter(), defaultFilter); + QCOMPARE(dir2.nameFilters(), defaultNameFilters); + QCOMPARE(dir2.sorting(), defaultSorting); + + dir2 = dir1; + QCOMPARE(dir2.path(), path2); + QCOMPARE(dir2.filter(), filter); + QCOMPARE(dir2.nameFilters(), nameFilters); + QCOMPARE(dir2.sorting(), sorting); + + dir2 = path1; + QCOMPARE(dir2.path(), path1); + QCOMPARE(dir2.filter(), filter); + QCOMPARE(dir2.nameFilters(), nameFilters); + QCOMPARE(dir2.sorting(), sorting); + } + + dir1.refresh(); + QCOMPARE(dir1.path(), path2); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), sorting); + + QString const currentPath = QDir::currentPath(); + QVERIFY(dir1.cd(currentPath)); + QCOMPARE(dir1.path(), currentPath); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), sorting); + + QVERIFY(dir1.cdUp()); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), sorting); +} + QTEST_MAIN(tst_QDir) #include "tst_qdir.moc" diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index 540a1cd..208110a 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -172,6 +172,8 @@ private slots: void equalOperator() const; void equalOperatorWithDifferentSlashes() const; void notEqualOperator() const; + + void detachingOperations(); }; tst_QFileInfo::tst_QFileInfo() @@ -1377,5 +1379,51 @@ void tst_QFileInfo::notEqualOperator() const QVERIFY(QFileInfo() != QFileInfo()); } +void tst_QFileInfo::detachingOperations() +{ + QFileInfo info1; + QVERIFY(info1.caching()); + info1.setCaching(false); + + { + QFileInfo info2 = info1; + + QVERIFY(!info1.caching()); + QVERIFY(!info2.caching()); + + info2.setCaching(true); + QVERIFY(info2.caching()); + + info1.setFile("foo"); + QVERIFY(!info1.caching()); + } + + { + QFile file("foo"); + info1.setFile(file); + QVERIFY(!info1.caching()); + } + + info1.setFile(QDir(), "foo"); + QVERIFY(!info1.caching()); + + { + QFileInfo info3; + QVERIFY(info3.caching()); + + info3 = info1; + QVERIFY(!info3.caching()); + } + + info1.refresh(); + QVERIFY(!info1.caching()); + + QVERIFY(info1.makeAbsolute()); + QVERIFY(!info1.caching()); + + info1.detach(); + QVERIFY(!info1.caching()); +} + QTEST_MAIN(tst_QFileInfo) #include "tst_qfileinfo.moc" -- cgit v0.12 From 3505c6cdcdfac5a6d0f4b94dbdbcc8ad72f8048a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 31 Aug 2010 13:17:15 +0200 Subject: QDir: Removed checks for existance of fileEngine Directly or indirectly, all instances of QDir call QDirPrivate::setPath, which allocates a file engine and dereferences it. Any failures there should already lead to a crash or a bad_alloc exception being thrown in case of failure. Given that, QDir may be (and was) broken when compiling Qt with QT_NO_FSFILEENGINE, if no custom file engine and handler are provided. This being the case, it's pointless to check fileEngine for null all over the place. This simplifies the code and should allow for easier transition to file-engine-less implementation. Reviewed-by: Thomas Zander --- src/corelib/io/qdir.cpp | 57 +++++++------------------------------------------ 1 file changed, 8 insertions(+), 49 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 6393509..fcd17f7 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -97,7 +97,6 @@ public: , filterSepChar(0) , matchAllDirs(false) #endif - , fileEngine(0) , fileListsInitialized(false) { setPath(path.isEmpty() ? QString::fromLatin1(".") : path); @@ -126,20 +125,12 @@ public: , filterSepChar(copy.filterSepChar) , matchAllDirs(copy.matchAllDirs) #endif - , fileEngine(0) , fileListsInitialized(false) { } - ~QDirPrivate() - { - delete fileEngine; - } - bool exists() const { - if (!fileEngine) - return false; const QAbstractFileEngine::FileFlags info = fileEngine->fileFlags(QAbstractFileEngine::DirectoryType | QAbstractFileEngine::ExistsFlag @@ -183,8 +174,8 @@ public: p.truncate(p.length() - 1); } - delete fileEngine; - fileEngine = QAbstractFileEngine::create(p); + path = p; + initFileEngine(); // set the path to be the qt friendly version so then we can operate on it using just / path = fileEngine->fileName(QAbstractFileEngine::DefaultName); @@ -207,7 +198,7 @@ public: bool matchAllDirs; #endif - QAbstractFileEngine *fileEngine; + QScopedPointer fileEngine; mutable bool fileListsInitialized; mutable QStringList files; @@ -339,11 +330,9 @@ inline void QDirPrivate::initFileLists() const } } -void QDirPrivate::initFileEngine() +inline void QDirPrivate::initFileEngine() { - QAbstractFileEngine *newFileEngine = QAbstractFileEngine::create(path); - delete fileEngine; - fileEngine = newFileEngine; + fileEngine.reset(QAbstractFileEngine::create(path)); } /*! @@ -646,11 +635,7 @@ QString QDir::absolutePath() const */ QString QDir::canonicalPath() const { - const QDirPrivate* d = d_ptr.constData(); - - if (!d->fileEngine) - return QLatin1String(""); - return cleanPath(d->fileEngine->fileName(QAbstractFileEngine::CanonicalName)); + return cleanPath(d_ptr->fileEngine->fileName(QAbstractFileEngine::CanonicalName)); } /*! @@ -710,8 +695,6 @@ QString QDir::absoluteFilePath(const QString &fileName) const const QDirPrivate* d = d_ptr.constData(); if (isAbsolutePath(fileName)) return fileName; - if (!d->fileEngine) - return fileName; QString ret; #ifndef QT_NO_FSFILEENGINE @@ -1392,8 +1375,6 @@ bool QDir::mkdir(const QString &dirName) const qWarning("QDir::mkdir: Empty or null file name(s)"); return false; } - if (!d->fileEngine) - return false; QString fn = filePath(dirName); return d->fileEngine->mkdir(fn, false); @@ -1416,8 +1397,6 @@ bool QDir::rmdir(const QString &dirName) const qWarning("QDir::rmdir: Empty or null file name(s)"); return false; } - if (!d->fileEngine) - return false; QString fn = filePath(dirName); return d->fileEngine->rmdir(fn, false); @@ -1441,8 +1420,6 @@ bool QDir::mkpath(const QString &dirPath) const qWarning("QDir::mkpath: Empty or null file name(s)"); return false; } - if (!d->fileEngine) - return false; QString fn = filePath(dirPath); return d->fileEngine->mkdir(fn, true); @@ -1467,8 +1444,6 @@ bool QDir::rmpath(const QString &dirPath) const qWarning("QDir::rmpath: Empty or null file name(s)"); return false; } - if (!d->fileEngine) - return false; QString fn = filePath(dirPath); return d->fileEngine->rmdir(fn, true); @@ -1487,8 +1462,6 @@ bool QDir::isReadable() const { const QDirPrivate* d = d_ptr.constData(); - if (!d->fileEngine) - return false; const QAbstractFileEngine::FileFlags info = d->fileEngine->fileFlags(QAbstractFileEngine::DirectoryType | QAbstractFileEngine::PermsMask); @@ -1527,11 +1500,7 @@ bool QDir::exists() const */ bool QDir::isRoot() const { - const QDirPrivate* d = d_ptr.constData(); - - if (!d->fileEngine) - return true; - return d->fileEngine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::RootFlag; + return d_ptr->fileEngine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::RootFlag; } /*! @@ -1561,11 +1530,7 @@ bool QDir::isRoot() const */ bool QDir::isRelative() const { - const QDirPrivate* d = d_ptr.constData(); - - if (!d->fileEngine) - return false; - return d->fileEngine->isRelativePath(); + return d_ptr->fileEngine->isRelativePath(); } @@ -1578,8 +1543,6 @@ bool QDir::isRelative() const */ bool QDir::makeAbsolute() // ### What do the return values signify? { - if (!d_ptr.constData()->fileEngine) - return false; QString absolutePath = d_ptr.constData()->fileEngine->fileName(QAbstractFileEngine::AbsoluteName); if (QDir::isRelativePath(absolutePath)) return false; @@ -1610,7 +1573,6 @@ bool QDir::operator==(const QDir &dir) const if (d == other) return true; - Q_ASSERT(d->fileEngine && other->fileEngine); if (d->fileEngine->caseSensitive() != other->fileEngine->caseSensitive()) return false; if (d->filters == other->filters @@ -1695,9 +1657,6 @@ bool QDir::rename(const QString &oldName, const QString &newName) return false; } - if (!d_ptr.constData()->fileEngine) - return false; - QFile file(filePath(oldName)); if (!file.exists()) return false; -- cgit v0.12 From b21639304b108de0697553f062eb36ccde6a5bd5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 7 Sep 2010 15:56:34 +0200 Subject: Tools (uic/rcc): Improve warning messages. Output as 'filename: Warning: message' and make some uic warnings more verbose to make Qt Creator parsing easier. Fix resource warning in Qt Designer. Reviewed-by: dt Rubber-stamped-by: Tobias Hunger --- src/tools/rcc/rcc.cpp | 7 ++++-- src/tools/uic/cpp/cppextractimages.cpp | 8 +++--- src/tools/uic/cpp/cppwriteincludes.cpp | 10 +++++--- src/tools/uic/cpp/cppwriteinitialization.cpp | 29 +++++++++++++++------- src/tools/uic/driver.cpp | 5 +++- src/tools/uic/option.h | 8 ++++++ .../src/components/formeditor/formeditor.qrc | 1 - 7 files changed, 48 insertions(+), 20 deletions(-) diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 1f6e58f..0e3167d 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -544,8 +544,11 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file) const QString filename = nodes.at(nodes.size()-1); RCCFileInfo *s = new RCCFileInfo(file); s->m_parent = parent; - if (parent->m_children.contains(filename)) - qWarning("potential duplicate alias detected: '%s'", qPrintable(filename)); + if (parent->m_children.contains(filename)) { + foreach (const QString &fileName, m_fileNames) + qWarning("%s: Warning: potential duplicate alias detected: '%s'", + qPrintable(fileName), qPrintable(filename)); + } parent->m_children.insertMulti(filename, s); return true; } diff --git a/src/tools/uic/cpp/cppextractimages.cpp b/src/tools/uic/cpp/cppextractimages.cpp index 52c1b9d..5809724 100644 --- a/src/tools/uic/cpp/cppextractimages.cpp +++ b/src/tools/uic/cpp/cppextractimages.cpp @@ -76,14 +76,14 @@ void ExtractImages::acceptUI(DomUI *node) if (m_option.qrcOutputFile.size()) { f.setFileName(m_option.qrcOutputFile); if (!f.open(QIODevice::WriteOnly | QFile::Text)) { - fprintf(stderr, "Could not create resource file\n"); + fprintf(stderr, "%s: Error: Could not create resource file\n", qPrintable(m_option.messagePrefix())); return; } QFileInfo fi(m_option.qrcOutputFile); QDir dir = fi.absoluteDir(); if (!dir.exists(QLatin1String("images")) && !dir.mkdir(QLatin1String("images"))) { - fprintf(stderr, "Could not create image dir\n"); + fprintf(stderr, "%s: Error: Could not create image dir\n", qPrintable(m_option.messagePrefix())); return; } dir.cd(QLatin1String("images")); @@ -126,7 +126,9 @@ void ExtractImages::acceptImage(DomImage *image) if (isXPM_GZ) openMode |= QIODevice::Text; if (!f.open(openMode)) { - fprintf(stderr, "Could not create image file %s: %s", qPrintable(fname), qPrintable(f.errorString())); + fprintf(stderr, "%s: Error: Could not create image file %s: %s", + qPrintable(m_option.messagePrefix()), + qPrintable(fname), qPrintable(f.errorString())); return; } diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp index 4e0ee4a..2dded84 100644 --- a/src/tools/uic/cpp/cppwriteincludes.cpp +++ b/src/tools/uic/cpp/cppwriteincludes.cpp @@ -126,8 +126,9 @@ void WriteIncludes::acceptUI(DomUI *node) if (m_uic->hasExternalPixmap() && m_uic->pixmapFunction() == QLatin1String("qPixmapFromMimeSource")) { #ifdef QT_NO_QT3_SUPPORT - qWarning("Warning: The form file has external pixmaps or qPixmapFromMimeSource() set as a pixmap function. " - "This requires Qt 3 support, which is disabled. The resulting code will not compile."); + qWarning("%s: Warning: The form file has external pixmaps or qPixmapFromMimeSource() set as a pixmap function. " + "This requires Qt 3 support, which is disabled. The resulting code will not compile.", + qPrintable(m_uic->option().warningsPrefix())); #endif add(QLatin1String("Q3MimeSourceFactory")); } @@ -212,8 +213,9 @@ void WriteIncludes::insertIncludeForClass(const QString &className, QString head header = lowerClassName; header += QLatin1String(".h"); if (warnHeaderGeneration) { - qWarning("Warning: generated header '%s' for class '%s'.", qPrintable(header), - qPrintable(className)); + qWarning("%s: Warning: generated header '%s' for class '%s'.", + qPrintable(m_uic->option().messagePrefix()), + qPrintable(header), qPrintable(className)); } diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index dc1d181..c62f3d9 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -539,10 +539,14 @@ void WriteInitialization::acceptUI(DomUI *node) const Buddy &b = m_buddies.at(i); if (!m_registeredWidgets.contains(b.objName)) { - fprintf(stderr, "'%s' isn't a valid widget\n", b.objName.toLatin1().data()); + fprintf(stderr, "%s: Warning: Buddy assignment: '%s' is not a valid widget\n", + qPrintable(m_option.messagePrefix()), + b.objName.toLatin1().data()); continue; } else if (!m_registeredWidgets.contains(b.buddy)) { - fprintf(stderr, "'%s' isn't a valid widget\n", b.buddy.toLatin1().data()); + fprintf(stderr, "%s: Warning: Buddy assignment: '%s' is not a valid widget\n", + qPrintable(m_option.messagePrefix()), + b.buddy.toLatin1().data()); continue; } @@ -867,7 +871,7 @@ void WriteInitialization::acceptWidget(DomWidget *node) const QString name = zOrder.at(i); if (!m_registeredWidgets.contains(name)) { - fprintf(stderr, "'%s' isn't a valid widget\n", name.toLatin1().data()); + fprintf(stderr, "'%s' Z-order assignment: is not a valid widget\n", name.toLatin1().data()); continue; } @@ -895,7 +899,9 @@ void WriteInitialization::addButtonGroup(const DomWidget *buttonNode, const QStr DomButtonGroup *newGroup = new DomButtonGroup; newGroup->setAttributeName(attributeName); group = newGroup; - fprintf(stderr, "Warning: Creating button group `%s'\n", attributeName.toLatin1().data()); + fprintf(stderr, "%s: Warning: Creating button group `%s'\n", + qPrintable(m_option.messagePrefix()), + attributeName.toLatin1().data()); } const QString groupName = m_driver->findOrInsertButtonGroup(group); // Create on demand @@ -1163,7 +1169,9 @@ void WriteInitialization::acceptActionRef(DomActionRef *node) return; } } else if (!(m_driver->actionByName(actionName) || isSeparator)) { - fprintf(stderr, "Warning: action `%s' not declared\n", actionName.toLatin1().data()); + fprintf(stderr, "%s: Warning: action `%s' not declared\n", + qPrintable(m_option.messagePrefix()), + actionName.toLatin1().data()); return; } @@ -1853,7 +1861,9 @@ void WriteInitialization::acceptTabStops(DomTabStops *tabStops) const QString name = l.at(i); if (!m_registeredWidgets.contains(name)) { - fprintf(stderr, "'%s' isn't a valid widget\n", name.toLatin1().data()); + fprintf(stderr, "%s: Warning: Tab-stop assignment: '%s' is not a valid widget\n", + qPrintable(m_option.messagePrefix()), + name.toLatin1().data()); continue; } @@ -2083,7 +2093,8 @@ QString WriteInitialization::pixCall(const DomProperty *p) const s = p->elementPixmap()->text(); break; default: - qWarning() << "Warning: Unknown icon format encountered. The ui-file was generated with a too-recent version of Designer."; + qWarning("%s: Warning: Unknown icon format encountered. The ui-file was generated with a too-recent version of Designer.", + qPrintable(m_option.messagePrefix())); return QLatin1String("QIcon()"); break; } @@ -2573,7 +2584,7 @@ void WriteInitialization::initializeQ3SqlDataTable(DomWidget *w) } if (table.isEmpty() || connection.isEmpty()) { - fprintf(stderr, "invalid database connection\n"); + fprintf(stderr, "%s: Warning: Invalid database connection\n", qPrintable(m_option.messagePrefix())); return; } @@ -2613,7 +2624,7 @@ void WriteInitialization::initializeQ3SqlDataBrowser(DomWidget *w) } if (table.isEmpty() || connection.isEmpty()) { - fprintf(stderr, "invalid database connection\n"); + fprintf(stderr, "%s: Warning: Invalid database connection\n", qPrintable(m_option.messagePrefix())); return; } diff --git a/src/tools/uic/driver.cpp b/src/tools/uic/driver.cpp index 676388f..65d63e0 100644 --- a/src/tools/uic/driver.cpp +++ b/src/tools/uic/driver.cpp @@ -178,7 +178,10 @@ QString Driver::unique(const QString &instanceName, const QString &className) } if (alreadyUsed && className.size()) { - fprintf(stderr, "Warning: name %s is already used\n", qPrintable(instanceName)); + fprintf(stderr, "%s: Warning: The name '%s' (%s) is already in use, defaulting to '%s'.\n", + qPrintable(m_option.messagePrefix()), + qPrintable(instanceName), qPrintable(className), + qPrintable(name)); } m_nameRepository.insert(name, true); diff --git a/src/tools/uic/option.h b/src/tools/uic/option.h index 8556728..011a8f8 100644 --- a/src/tools/uic/option.h +++ b/src/tools/uic/option.h @@ -43,6 +43,7 @@ #define OPTION_H #include +#include QT_BEGIN_NAMESPACE @@ -91,6 +92,13 @@ struct Option generator(CppGenerator), prefix(QLatin1String("Ui_")) { indent.fill(QLatin1Char(' '), 4); } + + QString messagePrefix() const + { + return inputFile.isEmpty() ? + QString(QLatin1String("stdin")) : + QDir::toNativeSeparators(inputFile); + } }; QT_END_NAMESPACE diff --git a/tools/designer/src/components/formeditor/formeditor.qrc b/tools/designer/src/components/formeditor/formeditor.qrc index 6510814..42724dd 100644 --- a/tools/designer/src/components/formeditor/formeditor.qrc +++ b/tools/designer/src/components/formeditor/formeditor.qrc @@ -113,7 +113,6 @@ images/widgets/vslider.png images/widgets/vspacer.png images/widgets/widget.png - images/widgets/widget.png images/widgets/widgetstack.png images/widgets/wizard.png images/win/adjustsize.png -- cgit v0.12 From a93243ce81fdc71842bb133e7eadb9476e4648e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 7 Sep 2010 16:21:43 +0200 Subject: Always call QPainter::end() before using the object drawn to. This caused the background pixmap not to draw correctly on some systems. Reviewed-by: Samuel --- tests/arthur/common/paintcommands.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/arthur/common/paintcommands.cpp b/tests/arthur/common/paintcommands.cpp index 70d419e..c4f09a4 100644 --- a/tests/arthur/common/paintcommands.cpp +++ b/tests/arthur/common/paintcommands.cpp @@ -713,7 +713,7 @@ void PaintCommands::runCommands() QPainter pt(&pm); pt.fillRect(0, 0, 10, 10, QColor::fromRgba(0xffdfdfdf)); pt.fillRect(10, 10, 10, 10, QColor::fromRgba(0xffdfdfdf)); - + pt.end(); m_painter->drawTiledPixmap(0, 0, width, height, pm); } else { m_painter->fillRect(0, 0, width, height, Qt::white); -- cgit v0.12 From df362aff04da1e4b4305df36bd4cc5532449dee9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 7 Sep 2010 16:29:14 +0200 Subject: uic: Improve messages. Fix some oversights in b21639304b108de0697553f062eb36ccde6a5bd5. --- src/tools/uic/cpp/cppwriteinitialization.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index c62f3d9..b06eb7a 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -155,7 +155,7 @@ namespace { if (const DomResourceIcon *dri = p->elementIconSet()) { if (!isIconFormat44(dri)) { if (dri->text().isEmpty()) { - const QString msg = QString::fromUtf8("%1: An invalid icon property '%2' was encountered.").arg(fileName).arg(p->attributeName()); + const QString msg = QString::fromUtf8("%1: Warning: An invalid icon property '%2' was encountered.").arg(fileName).arg(p->attributeName()); qWarning("%s", qPrintable(msg)); return false; } @@ -165,7 +165,7 @@ namespace { case DomProperty::Pixmap: if (const DomResourcePixmap *drp = p->elementPixmap()) if (drp->text().isEmpty()) { - const QString msg = QString::fromUtf8("%1: An invalid pixmap property '%2' was encountered.").arg(fileName).arg(p->attributeName()); + const QString msg = QString::fromUtf8("%1: Warning: An invalid pixmap property '%2' was encountered.").arg(fileName).arg(p->attributeName()); qWarning("%s", qPrintable(msg)); return false; } @@ -539,12 +539,12 @@ void WriteInitialization::acceptUI(DomUI *node) const Buddy &b = m_buddies.at(i); if (!m_registeredWidgets.contains(b.objName)) { - fprintf(stderr, "%s: Warning: Buddy assignment: '%s' is not a valid widget\n", + fprintf(stderr, "%s: Warning: Buddy assignment: '%s' is not a valid widget.\n", qPrintable(m_option.messagePrefix()), b.objName.toLatin1().data()); continue; } else if (!m_registeredWidgets.contains(b.buddy)) { - fprintf(stderr, "%s: Warning: Buddy assignment: '%s' is not a valid widget\n", + fprintf(stderr, "%s: Warning: Buddy assignment: '%s' is not a valid widget.\n", qPrintable(m_option.messagePrefix()), b.buddy.toLatin1().data()); continue; @@ -871,7 +871,9 @@ void WriteInitialization::acceptWidget(DomWidget *node) const QString name = zOrder.at(i); if (!m_registeredWidgets.contains(name)) { - fprintf(stderr, "'%s' Z-order assignment: is not a valid widget\n", name.toLatin1().data()); + fprintf(stderr, "%s: Warning: Z-order assignment: '%s' is not a valid widget.\n", + qPrintable(m_option.messagePrefix()), + name.toLatin1().data()); continue; } @@ -1861,7 +1863,7 @@ void WriteInitialization::acceptTabStops(DomTabStops *tabStops) const QString name = l.at(i); if (!m_registeredWidgets.contains(name)) { - fprintf(stderr, "%s: Warning: Tab-stop assignment: '%s' is not a valid widget\n", + fprintf(stderr, "%s: Warning: Tab-stop assignment: '%s' is not a valid widget.\n", qPrintable(m_option.messagePrefix()), name.toLatin1().data()); continue; -- cgit v0.12 From 3c18c2a43260a271f8a13e89053eede15d399005 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 7 Sep 2010 18:34:09 +0200 Subject: Doc: More work on the QML documentation. --- doc/src/declarative/declarativeui.qdoc | 1 + doc/src/declarative/qdeclarativedocument.qdoc | 2 +- doc/src/declarative/qdeclarativemodels.qdoc | 153 ++++++++++++--------- doc/src/declarative/qml-intro.qdoc | 2 +- doc/src/examples/qml-examples.qdoc | 2 +- doc/src/images/qml-listview-snippet.png | Bin 0 -> 2048 bytes doc/src/snippets/declarative/flickable.qml | 50 +++++++ doc/src/snippets/declarative/image.qml | 2 + .../declarative/listview/listview-snippet.qml | 52 +++++++ .../qml-data-models/dynamic-listmodel.qml | 67 +++++++++ .../declarative/qml-data-models/listelements.qml | 77 +++++++++++ .../qml-data-models/listmodel-listview.qml | 64 +++++++++ .../WebKit/qt/declarative/qdeclarativewebview.cpp | 86 ++++++++---- .../graphicsitems/qdeclarativeflickable.cpp | 56 +++++--- .../graphicsitems/qdeclarativeimage.cpp | 2 +- src/declarative/qml/qdeclarativetypeloader.cpp | 2 +- 16 files changed, 502 insertions(+), 116 deletions(-) create mode 100644 doc/src/images/qml-listview-snippet.png create mode 100644 doc/src/snippets/declarative/flickable.qml create mode 100644 doc/src/snippets/declarative/listview/listview-snippet.qml create mode 100644 doc/src/snippets/declarative/qml-data-models/dynamic-listmodel.qml create mode 100644 doc/src/snippets/declarative/qml-data-models/listelements.qml create mode 100644 doc/src/snippets/declarative/qml-data-models/listmodel-listview.qml diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index ae64e2a..2f43682 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -109,6 +109,7 @@ Module. \list \o \l{Using QML Positioner and Repeater Items} \o \l{QML Data Models} +\o \l{Presenting Data with QML} \o \l{Network Transparency} \endlist diff --git a/doc/src/declarative/qdeclarativedocument.qdoc b/doc/src/declarative/qdeclarativedocument.qdoc index 4aed63f..8ca6c11 100644 --- a/doc/src/declarative/qdeclarativedocument.qdoc +++ b/doc/src/declarative/qdeclarativedocument.qdoc @@ -79,7 +79,7 @@ Each instance is created with a different value for its \c text property: \o application.qml \row -\o \snippet doc/src/snippets/declarative/qmldocuments.qml document +\o \snippet doc/src/snippets/declarative/qml-documents/qmldocuments.qml document \o \qml import Qt 4.7 diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index ace0465..7548c96 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -41,30 +41,7 @@ delegate may bind to. Here is a ListModel with two roles, \e type and \e age, and a ListView with a delegate that binds to these roles to display their values: -\qml -import Qt 4.7 - -Item { - width: 200; height: 250 - - ListModel { - id: myModel - ListElement { type: "Dog"; age: 8 } - ListElement { type: "Cat"; age: 5 } - } - - Component { - id: myDelegate - Text { text: type + ", " + age } - } - - ListView { - anchors.fill: parent - model: myModel - delegate: myDelegate - } -} -\endqml +\snippet doc/src/snippets/declarative/qml-data-models/listmodel-listview.qml document If there is a naming clash between the model's properties and the delegate's properties, the roles can be accessed with the qualified \e model name instead. @@ -91,6 +68,10 @@ QML provides several types of data models among the built-in set of QML elements. In addition, models can be created with C++ and then made available to QML components. +The views used to access data models are described in \l{Presenting Data with QML}. +The use of positioner items to arrange items from a model is covered in +\l{Using QML Positioner and Repeater Items}. + \section1 QML Data Models @@ -99,38 +80,12 @@ made available to QML components. ListModel is a simple hierarchy of elements specified in QML. The available roles are specified by the \l ListElement properties. -\code -ListModel { - id: fruitModel - - ListElement { - name: "Apple" - cost: 2.45 - } - ListElement { - name: "Orange" - cost: 3.25 - } - ListElement { - name: "Banana" - cost: 1.95 - } -} -\endcode +\snippet doc/src/snippets/declarative/qml-data-models/listelements.qml model The above model has two roles, \e name and \e cost. These can be bound to by a ListView delegate, for example: -\code -ListView { - width: 200; height: 250 - model: fruitModel - delegate: Row { - Text { text: "Fruit: " + name } - Text { text: "Cost: $" + cost } - } -} -\endcode +\snippet doc/src/snippets/declarative/qml-data-models/listelements.qml view ListModel provides methods to manipulate the ListModel directly via JavaScript. In this case, the first item inserted determines the roles available @@ -138,16 +93,9 @@ to any views that are using the model. For example, if an empty ListModel is created and populated via JavaScript, the roles provided by the first insertion are the only roles that will be shown in the view: -\code -Item { - ListModel { id: fruitModel } - - MouseArea { - anchors.fill: parent - onClicked: fruitModel.append({"cost": 5.95, "name":"Pizza"}) - } -} -\endcode +\snippet doc/src/snippets/declarative/qml-data-models/dynamic-listmodel.qml model +\dots +\snippet doc/src/snippets/declarative/qml-data-models/dynamic-listmodel.qml mouse area When the MouseArea is clicked, \c fruitModel will have two roles, \e cost and \e name. Even if subsequent roles are added, only the first two will be handled by views @@ -515,3 +463,84 @@ a function in the model, e.g.: updated, and that \e{value} holds the new value. */ + +/*! +\page qml-presenting-data.html +\title Presenting Data with QML + +\section1 Introduction + +Qt Quick contains a set of standard items that can be used to present data in a +number of different ways. For simple user interfaces, +\l{Using QML Positioner and Repeater Items#Repeaters}{Repeaters} can be used +in combination with +\l{Using QML Positioner and Repeater Items#Positioners}{Positioners} +to obtain pieces of data and arrange them in a user interface. However, when +large quantities of data are involved, it is often better to use models with +the standard views since these contain many built-in display and navigation +features. + +\section1 Views + +Views are scrolling containers for collections of items. They are feature-rich, +supporting many of the use cases found in typical applications, and can be +customized to meet requirements on style and behavior. + +A set of standard views are provided in the basic set of Qt Quick +graphical elements: + +\list +\o \l{#ListView}{ListView} arranges items in a horizontal or vertical list +\o \l{#GridView}{GridView} arranges items in a grid within the available space +\o \l{#PathView}{PathView} arranges items on a path +\endlist + +Unlike these items, \l WebView is not a fully-featured view item, and needs +to be combined with a \l Flickable item to create a view that performs like +a Web browser. + +\section2 ListView + +\l ListView shows a classic list of items with horizontal or vertical placing +of items. + +\beginfloatright +\inlineimage qml-listview-snippet.png +\endfloat + +The following example shows a minimal ListView displaying a sequence of +numbers (using an \l{QML Data Models#An Integer}{integer as a model}). +A simple delegate is used to define an items for each piece of data in the +model. + +\clearfloat +\snippet doc/src/snippets/declarative/listview/listview-snippet.qml document + + + +\section2 GridView + +\l GridView displays items in a grid like an file manager's icon view. + +\section2 PathView + +\l PathView displays items on a path, where the selection remains in +the same place and the items move around it. + +\section1 Decorating Views + +\section2 Headers and Footers + +\section2 Sections + +\section2 Navigation + +In traditional user interfaces, views can be scrolled using standard +controls, such as scroll bars and arrow buttons. In some situations, it +is also possible to drag the view directly by pressing and holding a +mouse button while moving the cursor. In touch-based user interfaces, +this dragging action is often complemented with a flicking action, where +scrolling continues after the user has stopped touching the view. + +\section1 Further Reading +*/ diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc index d735042..b77611c 100644 --- a/doc/src/declarative/qml-intro.qdoc +++ b/doc/src/declarative/qml-intro.qdoc @@ -583,7 +583,7 @@ rectangle. The \c value attribute of 'dial' is set to a value based on the the rotation of the needle image. Notice this piece of code in Dial where the change in \c value modifies the position of the needle. -\snippet examples/declarative/ui-components/dialcontrol/Dial.qml needle angle +\snippet examples/declarative/ui-components/dialcontrol/content/Dial.qml needle angle This is part of the \c needleRotation that rotates the needle and causes the rotation of its shadow. \l SpringAnimation is an element that modifies the value diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 8752d14..745baa3 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -375,7 +375,7 @@ \title Models and Views: WebView Example \example declarative/modelviews/webview - These examples shows how to use the WebView element. + These examples show how to use the WebView element. \table \row diff --git a/doc/src/images/qml-listview-snippet.png b/doc/src/images/qml-listview-snippet.png new file mode 100644 index 0000000..0ee0ffc Binary files /dev/null and b/doc/src/images/qml-listview-snippet.png differ diff --git a/doc/src/snippets/declarative/flickable.qml b/doc/src/snippets/declarative/flickable.qml new file mode 100644 index 0000000..d7a163b --- /dev/null +++ b/doc/src/snippets/declarative/flickable.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Flickable { + width: 200; height: 200 + contentWidth: image.width; contentHeight: image.height + + Image { id: image; source: "bigImage.png" } +} +//! [document] diff --git a/doc/src/snippets/declarative/image.qml b/doc/src/snippets/declarative/image.qml index b0ae032..42efb8f 100644 --- a/doc/src/snippets/declarative/image.qml +++ b/doc/src/snippets/declarative/image.qml @@ -38,8 +38,10 @@ ** ****************************************************************************/ +//! [document] import Qt 4.7 Image { source: "pics/qtlogo.png" } +//! [document] diff --git a/doc/src/snippets/declarative/listview/listview-snippet.qml b/doc/src/snippets/declarative/listview/listview-snippet.qml new file mode 100644 index 0000000..c510472 --- /dev/null +++ b/doc/src/snippets/declarative/listview/listview-snippet.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +ListView { + width: 50; height: 200 + model: 4 + delegate: Text { + text: index; + font.pixelSize: 40 + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-data-models/dynamic-listmodel.qml b/doc/src/snippets/declarative/qml-data-models/dynamic-listmodel.qml new file mode 100644 index 0000000..72e27f3 --- /dev/null +++ b/doc/src/snippets/declarative/qml-data-models/dynamic-listmodel.qml @@ -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$ +** +****************************************************************************/ + +import Qt 4.7 + +Item { + width: 200; height: 250 + + //! [model] + ListModel { id: fruitModel } + //! [model] + + //! [view] + ListView { + anchors.fill: parent + model: fruitModel + delegate: Row { + Text { text: "Fruit: " + name } + Text { text: "Cost: $" + cost } + } + } + //! [view] + + //! [mouse area] + MouseArea { + anchors.fill: parent + onClicked: fruitModel.append({"cost": 5.95, "name":"Pizza"}) + } + //! [mouse area] +} diff --git a/doc/src/snippets/declarative/qml-data-models/listelements.qml b/doc/src/snippets/declarative/qml-data-models/listelements.qml new file mode 100644 index 0000000..d9cea81 --- /dev/null +++ b/doc/src/snippets/declarative/qml-data-models/listelements.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Item { + width: 200; height: 250 + + //! [model] + ListModel { + id: fruitModel + + ListElement { + name: "Apple" + cost: 2.45 + } + ListElement { + name: "Orange" + cost: 3.25 + } + ListElement { + name: "Banana" + cost: 1.95 + } + } + //! [model] + + //! [view] + ListView { + anchors.fill: parent + model: fruitModel + delegate: Row { + Text { text: "Fruit: " + name } + Text { text: "Cost: $" + cost } + } + } + //! [view] +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-data-models/listmodel-listview.qml b/doc/src/snippets/declarative/qml-data-models/listmodel-listview.qml new file mode 100644 index 0000000..92107f1 --- /dev/null +++ b/doc/src/snippets/declarative/qml-data-models/listmodel-listview.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import Qt 4.7 + +Item { + width: 200; height: 250 + + ListModel { + id: myModel + ListElement { type: "Dog"; age: 8 } + ListElement { type: "Cat"; age: 5 } + } + + Component { + id: myDelegate + Text { text: type + ", " + age } + } + + ListView { + anchors.fill: parent + model: myModel + delegate: myDelegate + } +} +//! [document] diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp index 1538133..67ce708 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -141,46 +141,76 @@ void GraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent* event) \qmlclass WebView QDeclarativeWebView \ingroup qml-view-elements \since 4.7 - \brief The WebView item allows you to add web content to a canvas. + \brief The WebView item allows you to add Web content to a canvas. \inherits Item - A WebView renders web content based on a URL. + A WebView renders Web content based on a URL. This type is made available by importing the \c QtWebKit module: \bold{import QtWebKit 1.0} - If the width and height of the item is not set, they will - dynamically adjust to a size appropriate for the content. - This width may be large for typical online web pages. + The WebView item includes no scrolling, scaling, toolbars, or other common browser + components. These must be implemented around WebView. See the \l{QML Web Browser} + example for a demonstration of this. - If the width or height is explictly set, the rendered website - will be clipped, not scaled, to fit into the set dimensions. + The page to be displayed by the item is specified using the \l url property, + and this can be changed to fetch and display a new page. While the page loads, + the \l progress property is updated to indicate how much of the page has been + loaded. - If the preferredWidth is set, the width will be this amount or larger, - usually laying out the web content to fit the preferredWidth. + \section1 Appearance - \qml - import QtWebKit 1.0 + If the width and height of the item is not set, they will dynamically adjust + to a size appropriate for the content. This width may be large for typical + online web pages, typically greater than 800 by 600 pixels. - WebView { - url: "http://www.nokia.com" - preferredWidth: 490 - preferredHeight: 400 - scale: 0.5 - smooth: false - smoothCache: true - } - \endqml + If the \l{Item::}{width} or \l{Item::}{height} is explictly set, the rendered Web site will be + clipped, not scaled, to fit into the set dimensions. - \image webview.png + If the preferredWidth property is set, the width will be this amount or larger, + usually laying out the Web content to fit the preferredWidth. - The item includes no scrolling, scaling, - toolbars, etc., those must be implemented around WebView. See the WebBrowser example - for a demonstration of this. + The appearance of the content can be controlled to a certain extent by changing + the settings.standardFontFamily property and other settings related to fonts. + + The page can be zoomed by calling the heuristicZoom() method, which performs a + series of tests to determine whether zoomed content will be displayed in an + appropriate way in the space allocated to the item. + + \section1 User Interaction and Navigation + + By default, certain mouse and touch events are delivered to other items in + preference to the Web content. For example, when a scrolling view is created + by placing a WebView in a Flickable, move events are delivered to the Flickable + so that the user can scroll the page. This prevents the user from accidentally + selecting text in a Web page instead of scrolling. + + The pressGrabTime property defines the time the user must touch or press a + mouse button over the WebView before the Web content will receive the move + events it needs to select text and images. + + When this item has keyboard focus, all keyboard input will be sent directly to + the Web page within. + + When the navigates by clicking on links, the item records the pages visited + in its internal history + + Because this item is designed to be used as a component in a browser, it + exposes \l{Action}{actions} for \l back, \l forward, \l reload and \l stop. + These can be triggered to change the current page displayed by the item. + + \section1 Example Usage + + \beginfloatright + \inlineimage webview.png + \endfloat + + The following example displays a scaled down Web page at a fixed size. + + \snippet doc/src/snippets/declarative/webview/webview.qml document - When this item has keyboard focus, all keyboard input will be sent directly to the - web page within. + \clearfloat \sa {declarative/modelviews/webview}{WebView example}, {demos/declarative/webbrowser}{Web Browser demo} */ @@ -555,11 +585,11 @@ bool QDeclarativeWebView::heuristicZoom(int clickX, int clickY, qreal maxZoom) \qmlproperty int WebView::pressGrabTime The number of milliseconds the user must press before the WebView - starts passing move events through to the web engine (rather than + starts passing move events through to the Web engine (rather than letting other QML elements such as a Flickable take them). Defaults to 400ms. Set to 0 to always grab and pass move events to - the web engine. + the Web engine. */ int QDeclarativeWebView::pressGrabTime() const { diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index b302393..062bbfb 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -350,24 +350,34 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd() \brief The Flickable item provides a surface that can be "flicked". \inherits Item - Flickable places its children on a surface that can be dragged and flicked. + The Flickable item places its children on a surface that can be dragged + and flicked, causing the view onto the child items to scroll. This + behavior forms the basis of Items that are designed to show large numbers + of child items, such as \l ListView and \l GridView. - \code - import Qt 4.7 + In traditional user interfaces, views can be scrolled using standard + controls, such as scroll bars and arrow buttons. In some situations, it + is also possible to drag the view directly by pressing and holding a + mouse button while moving the cursor. In touch-based user interfaces, + this dragging action is often complemented with a flicking action, where + scrolling continues after the user has stopped touching the view. - Flickable { - width: 200; height: 200 - contentWidth: image.width; contentHeight: image.height + Flickable does not automatically clip its contents. If it is not used as + a full-screen item, you should consider setting the \l{Item::}{clip} property + to true. - Image { id: image; source: "bigImage.png" } - } - \endcode + \section1 Example Usage + + \beginfloatright + \inlineimage flickable.gif + \endfloat - \image flickable.gif + The following example shows a large - Flickable does not automatically clip its contents. If - it is not full-screen it is likely that \l {Item::clip}{clip} should be set - to \c true. + \clearfloat + \snippet doc/src/snippets/declarative/flickable.qml document + + \section1 Limitations \note Due to an implementation detail, items placed inside a Flickable cannot anchor to it by \c id. Use \c parent instead. @@ -491,12 +501,15 @@ void QDeclarativeFlickable::setContentY(qreal pos) /*! \qmlproperty bool Flickable::interactive - This property holds whether the user can interact with the Flickable. A user - cannot drag or flick a Flickable that is not interactive. + This property describes whether the user can interact with the Flickable. + A user cannot drag or flick a Flickable that is not interactive. + + By default, this property is true. This property is useful for temporarily disabling flicking. This allows - special interaction with Flickable's children: for example, you might want to - freeze a flickable map while scrolling through a pop-up dialog that is a child of the Flickable. + special interaction with Flickable's children; for example, you might want + to freeze a flickable map while scrolling through a pop-up dialog that + is a child of the Flickable. */ bool QDeclarativeFlickable::isInteractive() const { @@ -1333,8 +1346,8 @@ bool QDeclarativeFlickable::isFlicking() const \qmlproperty bool Flickable::flickingHorizontally \qmlproperty bool Flickable::flickingVertically - These properties hold whether the view is currently moving horizontally - or vertically due to the user flicking the view. + These properties describe whether the view is currently moving horizontally, + vertically or in either direction, due to the user flicking the view. */ bool QDeclarativeFlickable::isFlickingHorizontally() const { @@ -1386,8 +1399,9 @@ bool QDeclarativeFlickable::isMoving() const \qmlproperty bool Flickable::movingHorizontally \qmlproperty bool Flickable::movingVertically - These properties hold whether the view is currently moving horizontally - or vertically due to the user either dragging or flicking the view. + These properties describe whether the view is currently moving horizontally, + vertically or in either direction, due to the user either dragging or + flicking the view. */ bool QDeclarativeFlickable::isMovingHorizontally() const { diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 2fab373..9cd9ad6 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE The following example shows the simplest usage of the Image element. - \snippet doc/src/snippets/declarative/image.qml + \snippet doc/src/snippets/declarative/image.qml document \beginfloatleft \image declarative-qtlogo.png diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp index ed41314..9b42065 100644 --- a/src/declarative/qml/qdeclarativetypeloader.cpp +++ b/src/declarative/qml/qdeclarativetypeloader.cpp @@ -224,7 +224,7 @@ void QDeclarativeDataBlob::setError(const QDeclarativeError &errors) } /*! -\override +\overload */ void QDeclarativeDataBlob::setError(const QList &errors) { -- cgit v0.12 From c997a4ff5d83c8f41f5ed7d8c44dfbe61c67b486 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 7 Sep 2010 20:43:00 +0200 Subject: Fix text size issues for high ppi displays Many layout sizes in flickr are specified by the artwork sizes. The heights and widths are defined in static pixel sizes. Therefore the text has to obey the size restrictions, and should not overlap. This patch sets the font sizes in pixels. Otherwise the default font sizes in points may be too big on high ppi displays. (XM5800 has ~230 ppi) --- demos/declarative/flickr/common/Progress.qml | 2 +- demos/declarative/flickr/mobile/Button.qml | 2 +- demos/declarative/flickr/mobile/ImageDetails.qml | 2 +- demos/declarative/flickr/mobile/ListDelegate.qml | 6 +++--- demos/declarative/flickr/mobile/TitleBar.qml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/demos/declarative/flickr/common/Progress.qml b/demos/declarative/flickr/common/Progress.qml index 99e1a7b..23bffb9 100644 --- a/demos/declarative/flickr/common/Progress.qml +++ b/demos/declarative/flickr/common/Progress.qml @@ -68,6 +68,6 @@ Item { text: Math.round(progress * 100) + "%" anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - color: "white"; font.bold: true + color: "white"; font.bold: true; font.pixelSize: 15 } } diff --git a/demos/declarative/flickr/mobile/Button.qml b/demos/declarative/flickr/mobile/Button.qml index 93a6661..6228606 100644 --- a/demos/declarative/flickr/mobile/Button.qml +++ b/demos/declarative/flickr/mobile/Button.qml @@ -66,7 +66,7 @@ Item { } Text { color: "white" - anchors.centerIn: buttonImage; font.bold: true + anchors.centerIn: buttonImage; font.bold: true; font.pixelSize: 15 text: container.text; style: Text.Raised; styleColor: "black" } states: [ diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index 7441ecc..6408fc6 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -96,7 +96,7 @@ Flipable { Rectangle { anchors.fill: parent; color: "black"; opacity: 0.4 } Common.Progress { - anchors.centerIn: parent; width: 200; height: 18 + anchors.centerIn: parent; width: 200; height: 22 progress: bigImage.progress; visible: bigImage.status != Image.Ready } diff --git a/demos/declarative/flickr/mobile/ListDelegate.qml b/demos/declarative/flickr/mobile/ListDelegate.qml index 3dd2868..9ec02e1 100644 --- a/demos/declarative/flickr/mobile/ListDelegate.qml +++ b/demos/declarative/flickr/mobile/ListDelegate.qml @@ -55,9 +55,9 @@ Component { } Column { x: 92; width: wrapper.ListView.view.width - 95; y: 15; spacing: 2 - Text { text: title; color: "white"; width: parent.width; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" } - Text { text: photoAuthor; width: parent.width; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" } - Text { text: photoDate; width: parent.width; elide: Text.ElideRight; color: "#cccccc"; style: Text.Raised; styleColor: "black" } + Text { text: title; color: "white"; width: parent.width; font.pixelSize: 14; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" } + Text { text: photoAuthor; width: parent.width; font.pixelSize: 14; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" } + Text { text: photoDate; width: parent.width; font.pixelSize: 14; elide: Text.ElideRight; color: "#cccccc"; style: Text.Raised; styleColor: "black" } } } } diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml index 335c315..60ca4dc 100644 --- a/demos/declarative/flickr/mobile/TitleBar.qml +++ b/demos/declarative/flickr/mobile/TitleBar.qml @@ -78,7 +78,7 @@ Item { } elide: Text.ElideLeft text: (rssModel.tags=="" ? untaggedString : taggedString + rssModel.tags) - font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black" + font.bold: true; font.pixelSize: 15; color: "White"; style: Text.Raised; styleColor: "Black" } Button { -- cgit v0.12 From 12d8ce6f03db8a577271ac042cd310a25dde0c21 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Tue, 7 Sep 2010 22:37:59 +0300 Subject: Remove unnecessary function declarations from qpixmap_s60_p.h Reviewed-by: TRUSTME --- src/gui/image/qpixmap_s60_p.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h index 12885ec..42cc830 100644 --- a/src/gui/image/qpixmap_s60_p.h +++ b/src/gui/image/qpixmap_s60_p.h @@ -63,11 +63,6 @@ class CFbsBitGc; class QSymbianBitmapDataAccess; -class QS60PixmapData; -void qt_symbian_register_pixmap(QS60PixmapData *pd); -void qt_symbian_unregister_pixmap(QS60PixmapData *pd); -void qt_symbian_release_pixmaps(); - class QSymbianFbsHeapLock { public: -- cgit v0.12 From 2ac7d2691e6c69eedb3b4ae62a47ec2af85612d5 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 30 Aug 2010 13:54:29 +1000 Subject: Fix Worker ListModel to emit the right signal when items change --- src/declarative/util/qdeclarativelistmodelworkeragent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp index 498de6d..d9df169 100644 --- a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp +++ b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp @@ -232,7 +232,7 @@ bool QDeclarativeListModelWorkerAgent::event(QEvent *e) emit m_orig->itemsMoved(change.index, change.to, change.count); break; case Change::Changed: - emit m_orig->itemsMoved(change.index, change.to, change.count); + emit m_orig->itemsChanged(change.index, change.to, orig->m_roles.keys()); break; } } -- cgit v0.12 From ef7ab65e1dd371d62fb8c93c78ac518e11e2810b Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 31 Aug 2010 10:38:35 +1000 Subject: Remove unused object --- src/declarative/util/qdeclarativelistmodel.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 60d8aa9..f290ab2 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -1247,7 +1247,6 @@ void ModelNode::setObjectValue(const QScriptValue& valuemap) { } void ModelNode::setListValue(const QScriptValue& valuelist) { - QScriptValueIterator it(valuelist); values.clear(); int size = valuelist.property(QLatin1String("length")).toInt32(); for (int i=0; i Date: Wed, 1 Sep 2010 15:42:14 +1000 Subject: Document difference between property binding and assignment Task-number: QTBUG-12629 --- doc/src/declarative/javascriptblocks.qdoc | 34 +++++++++++++++++++++++++++++++ doc/src/declarative/propertybinding.qdoc | 33 +++++++++++++++++++++++++----- 2 files changed, 62 insertions(+), 5 deletions(-) diff --git a/doc/src/declarative/javascriptblocks.qdoc b/doc/src/declarative/javascriptblocks.qdoc index 18da3d2..d290690 100644 --- a/doc/src/declarative/javascriptblocks.qdoc +++ b/doc/src/declarative/javascriptblocks.qdoc @@ -173,6 +173,40 @@ handler to execute at startup, they are run sequentially in an undefined order. Likewise, the \l {Component::onDestruction} attached property is triggered on component destruction. + +\section1 Property Assignment vs Property Binding + +When working with both QML and JavaScript, it is important to differentiate between +QML \l {Property Binding} and JavaScript value assignment. In QML, a property +binding is created using the \e {property: value} syntax: + +\code +Rectangle { + width: otherItem.width +} +\endcode + +The \c width of the above \l Rectangle is updated whenever \c otherItem.width changes. On the other +hand, take the following JavaScript code snippet, that runs when the \l Rectangle is created: + +\code +Rectangle { + + Component.onCompleted: { + width = otherItem.width; + } +} +\endcode + +The \c width of this \l Rectangle is \e assigned the value of \c otherItem.width using the +\e {property = value} syntax in JavaScript. Unlike the QML \e {property: value} syntax, this +does not invoke QML property binding; the \c rectangle.width property is set to the value +of \c otherItem.width at the time of the assignment and will not be updated if that value +changes. + +See \l {Property Binding} for more information. + + \section1 QML JavaScript Restrictions QML executes standard JavaScript code, with the following restrictions: diff --git a/doc/src/declarative/propertybinding.qdoc b/doc/src/declarative/propertybinding.qdoc index 552b9e4..314bf67 100644 --- a/doc/src/declarative/propertybinding.qdoc +++ b/doc/src/declarative/propertybinding.qdoc @@ -94,10 +94,29 @@ Rectangle { } \endcode -Imperatively assigning a value directly to a property will also implicitly remove a binding -on a property. A property can only have one value at a time, and if code explicitly sets -this value the binding must be removed. The \l Rectangle in the example below will have -a width of 13, regardless of the otherItem's width. + +\section1 Effects of Property Assignment in JavaScript + +Assigning a property value from JavaScript does \e not create a property binding. +For example: + +\code +Rectangle { + + Component.onCompleted: { + width = otherItem.width; + } +} +\endcode + +Instead of creating a property binding, this simply sets the \c width of the \l Rectangle +to the value of \c other.width at the time the JavaScript code is invoked. See +\l {Property Assignment vs Property Binding} for more details. + +Also note that assigning a value to a property that is currently bound will remove the binding. +A property can only have one value at a time, and if any code explicitly sets +this value, the binding is removed. The \l Rectangle in the example below will have +a width of 13, regardless of the \c otherItem's width. \code Rectangle { @@ -109,7 +128,9 @@ Rectangle { } \endcode -There is no way to create a property binding directly from imperative JavaScript code. +There is no way to create a property binding directly from imperative JavaScript code, +although it is possible to set up a \l Binding object (shown below). + \section1 Binding Element @@ -126,5 +147,7 @@ Binding { value: slider.value } \endqml + + */ -- cgit v0.12 From fb4eb36e78a9d9337fd3decf70a6c13774ba551a Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 8 Sep 2010 14:16:04 +1000 Subject: SpringAnimation velocity animation stop logic was fragile. Rather than stopping the animation when the target was reached, calculate the duration it will take. This eliminates the possibility of rounding errors causing the animation to stop at the wrong time. Task-number: QTBUG-13044 Reviewed-by: Aaron Kennedy --- .../util/qdeclarativespringanimation.cpp | 37 +++++++++++++++------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/declarative/util/qdeclarativespringanimation.cpp b/src/declarative/util/qdeclarativespringanimation.cpp index fce4097..e0fc45d 100644 --- a/src/declarative/util/qdeclarativespringanimation.cpp +++ b/src/declarative/util/qdeclarativespringanimation.cpp @@ -62,10 +62,12 @@ public: struct SpringAnimation { SpringAnimation() - : currentValue(0), to(0), velocity(0){} + : currentValue(0), to(0), velocity(0), start(0), duration(0) {} qreal currentValue; qreal to; qreal velocity; + int start; + int duration; }; QHash activeAnimations; @@ -135,7 +137,6 @@ void QDeclarativeSpringAnimationPrivate::tick(int time) bool QDeclarativeSpringAnimationPrivate::animate(const QDeclarativeProperty &property, SpringAnimation &animation, int elapsed) { - qreal srcVal = animation.to; bool stop = false; @@ -192,18 +193,14 @@ bool QDeclarativeSpringAnimationPrivate::animate(const QDeclarativeProperty &pro animation.currentValue += moveBy; if (haveModulus) animation.currentValue = fmod(animation.currentValue, modulus); - if (animation.currentValue > animation.to) { - animation.currentValue = animation.to; - stop = true; - } } else { animation.currentValue -= moveBy; if (haveModulus && animation.currentValue < 0.0) animation.currentValue = fmod(animation.currentValue, modulus) + modulus; - if (animation.currentValue < animation.to) { - animation.currentValue = animation.to; - stop = true; - } + } + if (lastTime - animation.start >= animation.duration) { + animation.currentValue = animation.to; + stop = true; } } @@ -222,8 +219,18 @@ void QDeclarativeSpringAnimationPrivate::updateMode() mode = Track; else if (spring > 0.) mode = Spring; - else + else { mode = Velocity; + QHash::iterator it; + for (it = activeAnimations.begin(); it != activeAnimations.end(); ++it) { + SpringAnimation &animation = *it; + animation.start = lastTime; + qreal dist = qAbs(animation.currentValue - animation.to); + if (haveModulus && dist > modulus / 2) + dist = modulus - fmod(dist, modulus); + animation.duration = dist / velocityms; + } + } } /*! @@ -378,6 +385,7 @@ void QDeclarativeSpringAnimation::setModulus(qreal modulus) if (d->modulus != modulus) { d->haveModulus = modulus != 0.0; d->modulus = modulus; + d->updateMode(); emit modulusChanged(); } } @@ -429,10 +437,17 @@ void QDeclarativeSpringAnimation::transition(QDeclarativeStateActions &actions, QDeclarativeSpringAnimationPrivate::SpringAnimation &animation = d->activeAnimations[property]; animation.to = d->actions->at(i).toValue.toReal(); + animation.start = d->lastTime; if (d->fromIsDefined) animation.currentValue = d->actions->at(i).fromValue.toReal(); else animation.currentValue = property.read().toReal(); + if (d->mode == QDeclarativeSpringAnimationPrivate::Velocity) { + qreal dist = qAbs(animation.currentValue - animation.to); + if (d->haveModulus && dist > d->modulus / 2) + dist = d->modulus - fmod(dist, d->modulus); + animation.duration = dist / d->velocityms; + } } } } -- cgit v0.12 From f0a7646e0233b5b430b590ed45aeb839746f9998 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 8 Sep 2010 08:24:24 +0200 Subject: uic: Fix compile breakage in case QT_NO_QT3_SUPPORT. --- src/tools/uic/cpp/cppwriteincludes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp index 2dded84..7b9d03a 100644 --- a/src/tools/uic/cpp/cppwriteincludes.cpp +++ b/src/tools/uic/cpp/cppwriteincludes.cpp @@ -128,7 +128,7 @@ void WriteIncludes::acceptUI(DomUI *node) #ifdef QT_NO_QT3_SUPPORT qWarning("%s: Warning: The form file has external pixmaps or qPixmapFromMimeSource() set as a pixmap function. " "This requires Qt 3 support, which is disabled. The resulting code will not compile.", - qPrintable(m_uic->option().warningsPrefix())); + qPrintable(m_uic->option().messagePrefix())); #endif add(QLatin1String("Q3MimeSourceFactory")); } -- cgit v0.12 From b080eccb98ab861d6625b1980b323a62bed3d50a Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 7 Sep 2010 17:05:46 +0200 Subject: QtWebKit: Downstream patch 1 fixing a crash on MSVC 64bit. http://bugreports.qt.nokia.com/browse/QTBUG-13279 Sha1 on qtwebkit.git: 8c902b12f771829cecd22edb7742636c8de816c2 Reviewed-by: Simon Hausmann --- src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp index 73efc0d..9e2e788 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp @@ -3465,16 +3465,16 @@ skip_id_custom_self: goto vm_throw; } ASSERT(!callFrame->callee()->isHostFunction()); - uint32_t expectedParams = callFrame->callee()->jsExecutable()->parameterCount(); - uint32_t inplaceArgs = min(argCount, expectedParams); - uint32_t i = 0; + int32_t expectedParams = callFrame->callee()->jsExecutable()->parameterCount(); + int32_t inplaceArgs = min(static_cast(argCount), expectedParams); + int32_t i = 0; Register* argStore = callFrame->registers() + argsOffset; // First step is to copy the "expected" parameters from their normal location relative to the callframe for (; i < inplaceArgs; i++) argStore[i] = callFrame->registers()[i - RegisterFile::CallFrameHeaderSize - expectedParams]; // Then we copy any additional arguments that may be further up the stack ('-1' to account for 'this') - for (; i < argCount; i++) + for (; i < static_cast(argCount); i++) argStore[i] = callFrame->registers()[i - RegisterFile::CallFrameHeaderSize - expectedParams - argCount - 1]; } else if (!arguments.isUndefinedOrNull()) { if (!arguments.isObject()) { -- cgit v0.12 From d027395181d3e0c5796340ff87f2cddb41b93d29 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 7 Sep 2010 17:07:38 +0200 Subject: QtWebKit: Downstream patch 2 fixing a crash on MSVC 64bit. http://bugreports.qt.nokia.com/browse/QTBUG-13279 Sha1 on qtwebkit.git: 460b651cbe4f6994b492ff08614e57b0e31a24c8 Reviewed-by: Simon Hausmann --- src/3rdparty/webkit/JavaScriptCore/ChangeLog | 12 ++++++++++++ .../webkit/JavaScriptCore/interpreter/Interpreter.cpp | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index c09ad79..2be6f5a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,15 @@ +2010-07-08 Andreas Kling + + Reviewed by Oliver Hunt. + + Interpreter: Crash in op_load_varargs on 64-bit + https://bugs.webkit.org/show_bug.cgi?id=41795 + + Added missing cast of argCount to int32_t in op_load_varargs. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + 2010-07-02 Peter Varga Reviewed by Oliver Hunt. diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp index 9e2e788..a56040c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp @@ -3475,7 +3475,7 @@ skip_id_custom_self: argStore[i] = callFrame->registers()[i - RegisterFile::CallFrameHeaderSize - expectedParams]; // Then we copy any additional arguments that may be further up the stack ('-1' to account for 'this') for (; i < static_cast(argCount); i++) - argStore[i] = callFrame->registers()[i - RegisterFile::CallFrameHeaderSize - expectedParams - argCount - 1]; + argStore[i] = callFrame->registers()[i - RegisterFile::CallFrameHeaderSize - expectedParams - static_cast(argCount) - 1]; } else if (!arguments.isUndefinedOrNull()) { if (!arguments.isObject()) { exceptionValue = createInvalidParamError(callFrame, "Function.prototype.apply", arguments, vPC - callFrame->codeBlock()->instructions().begin(), callFrame->codeBlock()); -- cgit v0.12 From cb23007c0e04e8d23b426ca1a3672f70282012c7 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 7 Sep 2010 17:09:26 +0200 Subject: QtWebKit: Update tag files to match the same content on qtwebkit.git NOTE: Some patches have been made in the 4.7.0 branch for src/3rdparty/webkit that are not available upstream. This shouldn't have happened, however these patches mostly address issues regarding builds of QtWebKit inside the Qt source tree so it doesn't matter so much regarding source packages. Reviewed-by: Simon Hausmann --- src/3rdparty/webkit/.tag | 2 +- src/3rdparty/webkit/VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index d31a2b4..1148320 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -72b1c38579ca1fdb3f242e29cd16e5bfb4925813 +460b651cbe4f6994b492ff08614e57b0e31a24c8 diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 62aa8ce..aff3f2a 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - 72b1c38579ca1fdb3f242e29cd16e5bfb4925813 + 460b651cbe4f6994b492ff08614e57b0e31a24c8 -- cgit v0.12 From a91a9d014adaeaa58640641579e30b5ff2383e99 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 7 Sep 2010 17:52:44 +0200 Subject: Fix handling of braces/no-braces in QUrl::host / setHost. The hostname is supposed to be stored in canonical form, with the braces. However, if you call url.setHost("::1"), then a non-canonical hostname is stored. So make the canonicalisation function correct this. Task-number: QTBUG-13464 Reviewed-by: Markus Goetz --- src/corelib/io/qurl.cpp | 4 ++++ tests/auto/qurl/tst_qurl.cpp | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 56a03c9..74c24b5 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3399,16 +3399,20 @@ QString QUrlPrivate::canonicalHost() const if (host.contains(QLatin1Char(':'))) { // This is an IP Literal, use _IPLiteral to validate QByteArray ba = host.toLatin1(); + bool needsBraces = false; if (!ba.startsWith('[')) { // surround the IP Literal with [ ] if it's not already done so ba.reserve(ba.length() + 2); ba.prepend('['); ba.append(']'); + needsBraces = true; } const char *ptr = ba.constData(); if (!_IPLiteral(&ptr)) that->host.clear(); + else if (needsBraces) + that->host = QString::fromLatin1(ba.toLower()); else that->host = host.toLower(); } else { diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index 370bd13..b5236e5 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -2266,7 +2266,9 @@ void tst_QUrl::ipv6() QCOMPARE(url.isValid(), isValid); if (url.isValid()) { - QCOMPARE(url.toString(), ipv6Auth); + QCOMPARE(url.toString(), ipv6Auth); + url.setHost(url.host()); + QCOMPARE(url.toString(), ipv6Auth); } }; @@ -2290,6 +2292,8 @@ void tst_QUrl::ipv6_2() QUrl url(input); QCOMPARE(url.toString(), output); + url.setHost(url.host()); + QCOMPARE(url.toString(), output); } void tst_QUrl::moreIpv6() -- cgit v0.12