From e29e8d3b162d15b66b1cfd698e75fb37a40f8ce0 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Thu, 14 Feb 2013 11:35:42 +0100 Subject: [PATCH] Doc: put QML snippets back to text A workaround for problems in handling QML snippets. Remove the snippet files. Change-Id: Id0f445c031e740eafffd8098b44672c771634eab Reviewed-by: Thomas Hartmann --- doc/snippets/qml/datamodel.qml | 15 --------- doc/snippets/qml/dummydata.qml | 8 ----- doc/snippets/qml/dummydatacontext.qml | 11 ------ doc/snippets/qml/quick-scalable-image.qml | 12 ------- doc/src/qtquick/qtquick-buttons.qdoc | 12 ++++++- doc/src/qtquick/qtquick-designer.qdoc | 41 ++++++++++++++++++++--- 6 files changed, 47 insertions(+), 52 deletions(-) delete mode 100644 doc/snippets/qml/datamodel.qml delete mode 100644 doc/snippets/qml/dummydata.qml delete mode 100644 doc/snippets/qml/dummydatacontext.qml delete mode 100644 doc/snippets/qml/quick-scalable-image.qml diff --git a/doc/snippets/qml/datamodel.qml b/doc/snippets/qml/datamodel.qml deleted file mode 100644 index 90db4aacd80..00000000000 --- a/doc/snippets/qml/datamodel.qml +++ /dev/null @@ -1,15 +0,0 @@ -//! [0] -import QtQuick 1.0 - -ListModel { - ListElement { - name: "Ariane" - } - ListElement { - name: "Bella" - } - ListElement { - name: "Corinna" - } -} -//! [0] diff --git a/doc/snippets/qml/dummydata.qml b/doc/snippets/qml/dummydata.qml deleted file mode 100644 index 5128de62e9a..00000000000 --- a/doc/snippets/qml/dummydata.qml +++ /dev/null @@ -1,8 +0,0 @@ -//! [0] -ListView { - model: dataModel - delegate: ContactDelegate { - name: name - } -} -//! [0] diff --git a/doc/snippets/qml/dummydatacontext.qml b/doc/snippets/qml/dummydatacontext.qml deleted file mode 100644 index 1027a7a9323..00000000000 --- a/doc/snippets/qml/dummydatacontext.qml +++ /dev/null @@ -1,11 +0,0 @@ -//! [0] -import QtQuick 1.0 -import QmlDesigner 1.0 - -DummyContextObject { - parent: Item { - width: 640 - height: 300 - } -} -//! [0] diff --git a/doc/snippets/qml/quick-scalable-image.qml b/doc/snippets/qml/quick-scalable-image.qml deleted file mode 100644 index e4691738768..00000000000 --- a/doc/snippets/qml/quick-scalable-image.qml +++ /dev/null @@ -1,12 +0,0 @@ -Item { - //! [properties and signal definitions] - property string text: "" - property int fontSize: 10 - - signal clicked - - width: 60 - height: 40 - - //! [properties and signal definitions] -} diff --git a/doc/src/qtquick/qtquick-buttons.qdoc b/doc/src/qtquick/qtquick-buttons.qdoc index d184d509c78..c5f84c0ee90 100644 --- a/doc/src/qtquick/qtquick-buttons.qdoc +++ b/doc/src/qtquick/qtquick-buttons.qdoc @@ -148,7 +148,17 @@ \li Specify properties and set expressions for the \gui Item, as illustrated by the following code snippet: - \snippet snippets/qml/quick-scalable-image.qml properties and signal definitions + \qml + Item { + property string text: "" + property int fontSize: 10 + + signal clicked + + width: 60 + height: 40 + } + \endqml You will point to the properties and expression later. diff --git a/doc/src/qtquick/qtquick-designer.qdoc b/doc/src/qtquick/qtquick-designer.qdoc index 8873f09dc1a..a3cc23481a8 100644 --- a/doc/src/qtquick/qtquick-designer.qdoc +++ b/doc/src/qtquick/qtquick-designer.qdoc @@ -289,7 +289,14 @@ For example, the following code snippet describes the file example.qml that contains a ListView that in turn specifies a C++ model: - \snippet snippets/qml/dummydata.qml 0 + \qml + ListView { + model: dataModel + delegate: ContactDelegate { + name: name + } + } + \endqml Create a directory named \e dummydata in the root directory of the project, so that it is not deployed to the device. In the \c dummydata directory, @@ -302,18 +309,32 @@ Then create the dataModel.qml file that contains the dummy data: - \snippet snippets/qml/datamodel.qml 0 + \qml + import QtQuick 1.0 + + ListModel { + ListElement { + name: "Ariane" + } + ListElement { + name: "Bella" + } + ListElement { + name: "Corinna" + } + } + \endqml \section3 Creating Dummy Context The following example presents a common pattern in QML: - \code + \qml Item { width: parent.width height: parent.height } - \endcode + \endqml This works nicely for applications but \QMLD displays a zero-sized item. A parent for the opened file does not exist, because the context is @@ -322,7 +343,17 @@ application (here, example.qml) in the \c {dummydata/context} directory, you can fake a parent context: - \snippet snippets/qml/dummydatacontext.qml 0 + \qml + import QtQuick 1.0 + import QmlDesigner 1.0 + + DummyContextObject { + parent: Item { + width: 640 + height: 300 + } + } + \endqml \section2 Setting Anchors and Margins