From 800b1ad057d97f90555af3c94f08a935526373cf Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 22 Jun 2010 13:12:49 +1000 Subject: Doc --- src/declarative/qml/qdeclarativeinclude.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeinclude.cpp b/src/declarative/qml/qdeclarativeinclude.cpp index 388f252..c29005a 100644 --- a/src/declarative/qml/qdeclarativeinclude.cpp +++ b/src/declarative/qml/qdeclarativeinclude.cpp @@ -172,6 +172,29 @@ void QDeclarativeInclude::callback(QScriptEngine *engine, QScriptValue &callback } } +/*! +\qmlmethod object Qt::include(url, callback) + +Include another JavaScript file. This method can only be used from within JavaScript files, +and not regular QML files. + +Qt.include() returns an object that describes the status of the operation. The object has +a single property, \c {status} that is set to one of the following values: + +\table +\header \o Symbol \o Value \o Description +\row \o result.OK \o 0 \o The include completed successfully. +\row \o result.LOADING \o 1 \o Data is being loaded from the network. +\row \o result.NETWORK_ERROR \o 2 \o A network error occurred while fetching the url. +\row \o result.EXCEPTION \o 3 \o A JavaScript exception occurred while executing the included code. +An additional \c exception property will be set in this case. +\endtable + +The return object's properties will be updated as the operation progresses. + +If provided, \a callback is invoked when the operation completes. The callback is passed +the same object as is returned from the Qt.include() call. +*/ QScriptValue QDeclarativeInclude::include(QScriptContext *ctxt, QScriptEngine *engine) { if (ctxt->argumentCount() == 0) @@ -184,7 +207,7 @@ QScriptValue QDeclarativeInclude::include(QScriptContext *ctxt, QScriptEngine *e return ctxt->throwError(QLatin1String("Qt.include(): Can only be called from JavaScript files")); QString urlString = ctxt->argument(0).toString(); - QUrl url(ctxt->argument(0).toString()); + QUrl url(urlString); if (url.isRelative()) { url = QUrl(contextUrl).resolved(url); urlString = url.toString(); -- cgit v0.12 From 32b871a275983f39093fe8b35c38332772fbf58a Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 22 Jun 2010 16:31:59 +1000 Subject: Add demo thumbnails to Examples/Demos index to make it more interesting --- doc/src/declarative/examples.qdoc | 109 ++++++++++++++++-------- doc/src/images/qml-calculator-example-small.png | Bin 0 -> 16575 bytes doc/src/images/qml-flickr-demo-small.png | Bin 0 -> 40934 bytes doc/src/images/qml-minehunt-demo-small.png | Bin 0 -> 26977 bytes doc/src/images/qml-photoviewer-demo-small.png | Bin 0 -> 35633 bytes doc/src/images/qml-rssnews-demo-small.png | Bin 0 -> 19489 bytes doc/src/images/qml-samegame-demo-small.png | Bin 0 -> 36596 bytes doc/src/images/qml-snake-demo-small.png | Bin 0 -> 17895 bytes doc/src/images/qml-twitter-demo-small.png | Bin 0 -> 19807 bytes doc/src/images/qml-webbrowser-demo-small.png | Bin 0 -> 20924 bytes 10 files changed, 74 insertions(+), 35 deletions(-) create mode 100644 doc/src/images/qml-calculator-example-small.png create mode 100644 doc/src/images/qml-flickr-demo-small.png create mode 100644 doc/src/images/qml-minehunt-demo-small.png create mode 100644 doc/src/images/qml-photoviewer-demo-small.png create mode 100644 doc/src/images/qml-rssnews-demo-small.png create mode 100644 doc/src/images/qml-samegame-demo-small.png create mode 100644 doc/src/images/qml-snake-demo-small.png create mode 100644 doc/src/images/qml-twitter-demo-small.png create mode 100644 doc/src/images/qml-webbrowser-demo-small.png diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index dcd0362..f127ed1 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -45,29 +45,82 @@ \brief Building UI's with QML \ingroup all-examples -\section1 Running the examples -You can find many simple examples in the \c examples/declarative -sub-directory that show how to use various aspects of QML. In addition, the -\c demos/declarative sub-directory contains more sophisticated demos of large -applications. These demos are intended to show integrated functionality -rather than being instructive on specific elements. +Qt includes a set of examples and demos that show how to use various aspects +of QML. The examples are small demonstrations of particular QML components, +while the demos contain more complete and functional applications. To run the examples and demos, you can use Qt Creator or the included \l {Qt Declarative UI Runtime}{qmlviewer} -command-line application. It has some useful options, revealed by: +command-line application. For example, from your build directory, run: \code - bin/qmlviewer -help + bin/qmlviewer $QTDIR/demos/declarative/samegame/samegame.qml \endcode -For example, from your build directory, run: -\code - bin/qmlviewer $QTDIR/demos/declarative/samegame/samegame.qml -\endcode +\section1 Demos + +The QML demos integrate a variety of features to demonstrate how QML +can be used to produce sophisticated interfaces and applications: + + +\table +\row + +\o +\l{demos/declarative/calculator}{Calculator} +\image qml-calculator-example-small.png + +\o +\l{demos/declarative/flickr}{Flickr Mobile} +\image qml-flickr-demo-small.png + +\o +\l{demos/declarative/minehunt}{Minehunt} +\image qml-minehunt-demo-small.png + +\row + +\o +\l{demos/declarative/photoviewer}{Photo Viewer} +\image qml-photoviewer-demo-small.png + +\o +\l{demos/declarative/rssnews}{RSS News Reader} +\image qml-rssnews-demo-small.png + +\o +\l{demos/declarative/samegame}{Same Game} +\image qml-samegame-demo-small.png + +\row + +\o +\l{demos/declarative/snake}{Snake} +\image qml-snake-demo-small.png + +\o +\l{demos/declarative/twitter}{Twitter} +\image qml-twitter-demo-small.png + +\o +\l{demos/declarative/webbrowser}{Web Browser} +\image qml-webbrowser-demo-small.png + +\endtable + +The demos can be found in Qt's \c demos/declarative directory. + \section1 Examples +The QML examples are small, simple applications that show how to use a particular +QML component or feature. If you are new +to QML, you may also find the \l{QML Tutorial}{Hello World} and +\l {QML Advanced Tutorial}{Same Game} tutorials useful. + +The examples can be found in Qt's \c examples/declarative directory. + \section2 Animation \list \o \l{declarative/animation/basics}{Basics} @@ -116,6 +169,15 @@ For example, from your build directory, run: \o \l{declarative/ui-components/tabwidget}{Tab widget} \endlist +\section2 Toys +\list +\o \l{declarative/toys/clocks}{Clocks} +\o \l{declarative/toys/corkboards}{Corkboards} +\o \l{declarative/toys/dynamicscene}{Dynamic Scene} +\o \l{declarative/toys/tic-tac-toe}{Tic Tac Toe} +\o \l{declarative/toys/tvtennis}{TV Tennis} +\endlist + \section2 Models and Views \list \o \l{declarative/modelviews/gridview}{GridView} @@ -128,15 +190,6 @@ For example, from your build directory, run: \o \l{declarative/modelviews/webview}{WebView} \endlist -\section2 Toys -\list -\o \l{declarative/toys/clocks}{Clocks} -\o \l{declarative/toys/corkboards}{Corkboards} -\o \l{declarative/toys/dynamicscene}{Dynamic Scene} -\o \l{declarative/toys/tic-tac-toe}{Tic Tac Toe} -\o \l{declarative/toys/tvtennis}{TV Tennis} -\endlist - \section2 XML \list \o \l{declarative/xml/xmlhttprequest}{XmlHttpRequest} @@ -169,20 +222,6 @@ For example, from your build directory, run: \endlist -\section1 Demos - -\list -\o \l{demos/declarative/calculator}{Calculator} -\o \l{demos/declarative/flickr}{Flickr Mobile} -\o \l{demos/declarative/minehunt}{Minehunt} -\o \l{demos/declarative/photoviewer}{Photo Viewer} -\o \l{demos/declarative/rssnews}{RSS News Reader} -\o \l{demos/declarative/samegame}{Same Game} -\o \l{demos/declarative/snake}{Snake} -\o \l{demos/declarative/twitter}{Twitter} -\o \l{demos/declarative/webbrowser}{Web Browser} -\endlist - \section1 Labs \list diff --git a/doc/src/images/qml-calculator-example-small.png b/doc/src/images/qml-calculator-example-small.png new file mode 100644 index 0000000..9e0370f Binary files /dev/null and b/doc/src/images/qml-calculator-example-small.png differ diff --git a/doc/src/images/qml-flickr-demo-small.png b/doc/src/images/qml-flickr-demo-small.png new file mode 100644 index 0000000..370ffcf Binary files /dev/null and b/doc/src/images/qml-flickr-demo-small.png differ diff --git a/doc/src/images/qml-minehunt-demo-small.png b/doc/src/images/qml-minehunt-demo-small.png new file mode 100644 index 0000000..e5badac Binary files /dev/null and b/doc/src/images/qml-minehunt-demo-small.png differ diff --git a/doc/src/images/qml-photoviewer-demo-small.png b/doc/src/images/qml-photoviewer-demo-small.png new file mode 100644 index 0000000..b16fb4e Binary files /dev/null and b/doc/src/images/qml-photoviewer-demo-small.png differ diff --git a/doc/src/images/qml-rssnews-demo-small.png b/doc/src/images/qml-rssnews-demo-small.png new file mode 100644 index 0000000..451a420 Binary files /dev/null and b/doc/src/images/qml-rssnews-demo-small.png differ diff --git a/doc/src/images/qml-samegame-demo-small.png b/doc/src/images/qml-samegame-demo-small.png new file mode 100644 index 0000000..ec9ad76 Binary files /dev/null and b/doc/src/images/qml-samegame-demo-small.png differ diff --git a/doc/src/images/qml-snake-demo-small.png b/doc/src/images/qml-snake-demo-small.png new file mode 100644 index 0000000..23a7b3b Binary files /dev/null and b/doc/src/images/qml-snake-demo-small.png differ diff --git a/doc/src/images/qml-twitter-demo-small.png b/doc/src/images/qml-twitter-demo-small.png new file mode 100644 index 0000000..b55ceba Binary files /dev/null and b/doc/src/images/qml-twitter-demo-small.png differ diff --git a/doc/src/images/qml-webbrowser-demo-small.png b/doc/src/images/qml-webbrowser-demo-small.png new file mode 100644 index 0000000..6c5d57d Binary files /dev/null and b/doc/src/images/qml-webbrowser-demo-small.png differ -- cgit v0.12 From ff956977c4236c33062e3246ac254fcc7b98e779 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 22 Jun 2010 16:47:21 +1000 Subject: qmldir no longer necessary --- examples/declarative/keyinteraction/focus/Core/qmldir | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 examples/declarative/keyinteraction/focus/Core/qmldir diff --git a/examples/declarative/keyinteraction/focus/Core/qmldir b/examples/declarative/keyinteraction/focus/Core/qmldir deleted file mode 100644 index e25d63c..0000000 --- a/examples/declarative/keyinteraction/focus/Core/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -ContextMenu ContextMenu.qml -GridMenu GridMenu.qml -ListViews ListViews.qml -ListViewDelegate ListViewDelegate.qml -- cgit v0.12 From f07c1a7a2bf1065760db5197b835fd5e67cd1f1e Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 22 Jun 2010 16:49:34 +1000 Subject: Remove transparent.qml example for now, until QTBUG-11591 is fixed --- .../declarative/modelviews/webview/transparent.qml | 55 ---------------------- 1 file changed, 55 deletions(-) delete mode 100644 examples/declarative/modelviews/webview/transparent.qml diff --git a/examples/declarative/modelviews/webview/transparent.qml b/examples/declarative/modelviews/webview/transparent.qml deleted file mode 100644 index 92c1578..0000000 --- a/examples/declarative/modelviews/webview/transparent.qml +++ /dev/null @@ -1,55 +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 -import org.webkit 1.0 - -// The WebView background is transparent -// if the HTML does not specify a background -Rectangle { - color: "green" - width: web.width - height: web.height - - WebView { - id: web - html: "Hello World!" - } -} -- cgit v0.12