From 5448446a4e02c50d83ad7e8c6c0d8022d0aaa876 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Thu, 10 Mar 2011 14:54:16 +0100 Subject: Doc: Cannot alter SelectionMode of a combobox's view --- src/gui/widgets/qcombobox.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index dbbf49a..8aeef50 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -944,7 +944,10 @@ QComboBox::QComboBox(bool rw, QWidget *parent, const char *name) to set and get item data (e.g., setItemData() and itemText()). You can also set a new model and view (with setModel() and setView()). For the text and icon in the combobox label, the data in the model - that has the Qt::DisplayRole and Qt::DecorationRole is used. + that has the Qt::DisplayRole and Qt::DecorationRole is used. Note + that you cannot alter the \l{QAbstractItemView::}{SelectionMode} + of the view(), e.g., by using + \l{QAbstractItemView::}{setSelectionMode()}. \image qstyle-comboboxes.png Comboboxes in the different built-in styles. -- cgit v0.12 From 504666b545deafa3319ff699eff74eacc8d8559c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Mon, 14 Mar 2011 15:33:46 +0100 Subject: Doc: Fixed snippet documenting QMetaObject::classInfo Can't use Q_OBJECT without inheriting from QObject. Reviewed-by: David Boddie --- doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp b/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp index 7a752b1..86bad5e 100644 --- a/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp +++ b/doc/src/snippets/code/src_corelib_kernel_qmetaobject.cpp @@ -43,7 +43,7 @@ void wrapInFunction() { //! [0] -class MyClass +class MyClass : public QObject { Q_OBJECT Q_CLASSINFO("author", "Sabrina Schweinsteiger") -- cgit v0.12 From d8d117d7691fffc82b4d11b6a87012552f8a7324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Fri, 14 Jan 2011 17:14:40 +0100 Subject: Doc: Typo fixes Reviewed-by: David Boddie --- src/gui/widgets/qabstractscrollarea.cpp | 2 +- src/gui/widgets/qabstractslider.cpp | 2 +- src/gui/widgets/qscrollbar.cpp | 2 +- src/gui/widgets/qsplitter.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index 5104116..2503b99 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -500,7 +500,7 @@ QAbstractScrollArea::QAbstractScrollArea(QAbstractScrollAreaPrivate &dd, QWidget /*! Constructs a viewport. - The \a parent arguments is sent to the QWidget constructor. + The \a parent argument is sent to the QWidget constructor. */ QAbstractScrollArea::QAbstractScrollArea(QWidget *parent) :QFrame(*new QAbstractScrollAreaPrivate, parent) diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index cb36398..2570496 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -265,7 +265,7 @@ void QAbstractSliderPrivate::setSteps(int single, int page) /*! Constructs an abstract slider. - The \a parent arguments is sent to the QWidget constructor. + The \a parent argument is sent to the QWidget constructor. The \l minimum defaults to 0, the \l maximum to 99, with a \l singleStep size of 1 and a \l pageStep size of 10, and an initial diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index c895b1b..87738a0 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -330,7 +330,7 @@ void QScrollBar::initStyleOption(QStyleOptionSlider *option) const /*! Constructs a vertical scroll bar. - The \a parent arguments is sent to the QWidget constructor. + The \a parent argument is sent to the QWidget constructor. The \l {QAbstractSlider::minimum} {minimum} defaults to 0, the \l {QAbstractSlider::maximum} {maximum} to 99, with a diff --git a/src/gui/widgets/qsplitter.cpp b/src/gui/widgets/qsplitter.cpp index 964a6e1..ca8fc37 100644 --- a/src/gui/widgets/qsplitter.cpp +++ b/src/gui/widgets/qsplitter.cpp @@ -1016,7 +1016,7 @@ QSplitterLayoutStruct *QSplitterPrivate::insertWidget(int index, QWidget *w) /*! Constructs a horizontal splitter with the \a parent - arguments is passed on to the QFrame constructor. + argument passed on to the QFrame constructor. \sa setOrientation() */ -- cgit v0.12 From a02369f43851932b820042448a47d024a0086bd8 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 15 Mar 2011 14:58:06 +0100 Subject: qdoc: Changed
structure. There appears to be a design flaw in the DIKT language in that it doesn't allow the element to appear inside a <bodydiv> <sectiondiv>. --- tools/qdoc3/ditaxmlgenerator.cpp | 422 +++++++++++++++++++++------------------ tools/qdoc3/ditaxmlgenerator.h | 43 ++-- tools/qdoc3/doc.cpp | 4 +- 3 files changed, 264 insertions(+), 205 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 2c02892..14f18ec 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -61,10 +61,6 @@ 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; -bool DitaXmlGenerator::inLegaleseText = false; QString DitaXmlGenerator::sinceTitles[] = { @@ -303,6 +299,19 @@ void DitaXmlGenerator::addLink(const QString& href, } /*! + If there are no \c {<bodydiv>} or \c {<sectiondiv>} elements + open, start a \c {<title>} element. Otherwise, start a + \c {<p>} element. + */ +void DitaXmlGenerator::startTitle() +{ + if (divNestingLevel > 0) + writeStartTag(DT_p); + else + writeStartTag(DT_title); +} + +/*! Push \a t onto the dita tag stack and write the appropriate start tag to the DITA XML file. */ @@ -334,22 +343,66 @@ DitaXmlGenerator::DitaTag DitaXmlGenerator::currentTag() } /*! + If the section nesting level is 0, output a \c{<section>} + element with an \e id attribute set to \a idText and + an \e outputclass attribute set to \a outputclass. + If \a idText is null, no \e id attribute is output. + If \a outputclass is empty, no \e outputclass attribute + is output. + + The section level is incremented and then returned. + */ +int DitaXmlGenerator::enterSection(const QString& outputclass, QString* idText) +{ + if (sectionNestingLevel == 0) { + writeStartTag(DT_section); + if (idText) + writeGuidAttribute(*idText); + if (!outputclass.isEmpty()) + xmlWriter().writeAttribute("outputclass",outputclass); + } + return ++sectionNestingLevel; +} + +/*! + If the section nesting level is greater than 0, decrement + it. If it becomes 0, output a \c {</section>}. Return the + decremented section nesting level. + */ +int DitaXmlGenerator::leaveSection() +{ + if (sectionNestingLevel > 0) { + --sectionNestingLevel; + if (sectionNestingLevel == 0) + writeEndTag(); // </section> + } + return sectionNestingLevel; +} + +/*! The default constructor. */ DitaXmlGenerator::DitaXmlGenerator() - : inLink(false), + : inApiDesc(false), inContents(false), + inDetailedDescription(false), + inLegaleseText(false), + inLink(false), + inObsoleteLink(false), inSectionHeading(false), inTableHeader(false), inTableBody(false), - numTableRows(0), - threeColumnEnumValueTable(true), + noLinks(false), + obsoleteLinks(false), offlineDocs(true), + threeColumnEnumValueTable(true), + codeIndent(0), + numTableRows(0), + divNestingLevel(0), + sectionNestingLevel(0), + tableColumnCount(0), funcLeftParen("\\S(\\()"), - myTree(0), - obsoleteLinks(false), - noLinks(false), - tableColumnCount(0) + myTree(0) { // nothing yet. } @@ -644,7 +697,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, //skipAhead = skipAtoms(atom, Atom::BriefRight); //break; //} - if (inApiDesc || inSection) { + if (inApiDesc || inSection()) { writeStartTag(DT_p); xmlWriter().writeAttribute("outputclass","brief"); } @@ -726,10 +779,14 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, { attr = atom->string(); DitaTag t = currentTag(); - if ((t == DT_section) || (t == DT_sectiondiv)) + if ((t == DT_section) || (t == DT_sectiondiv)) { writeStartTag(DT_sectiondiv); - else if ((t == DT_body) || (t == DT_bodydiv)) + divNestingLevel++; + } + else if ((t == DT_body) || (t == DT_bodydiv)) { writeStartTag(DT_bodydiv); + divNestingLevel++; + } if (!attr.isEmpty()) { if (attr.contains('=')) { int index = 0; @@ -756,8 +813,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } break; case Atom::DivRight: - if ((currentTag() == DT_sectiondiv) || (currentTag() == DT_bodydiv)) + if ((currentTag() == DT_sectiondiv) || (currentTag() == DT_bodydiv)) { writeEndTag(); // </sectiondiv>, </bodydiv>, or </p> + if (divNestingLevel > 0) + --divNestingLevel; + } break; case Atom::FootnoteLeft: // ### For now @@ -1364,23 +1424,19 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } break; case Atom::SectionLeft: - if (inSection || inApiDesc) { + if (inApiDesc) { + writeEndTag(); // </apiDesc> inApiDesc = false; - writeEndTag(); // </section> or </apiDesc> } - inSection = true; - writeStartTag(DT_section); - writeGuidAttribute(Doc::canonicalTitle(Text::sectionHeading(atom).toString())); - xmlWriter().writeAttribute("outputclass","details"); + enterSection("details"); + //writeGuidAttribute(Doc::canonicalTitle(Text::sectionHeading(atom).toString())); break; case Atom::SectionRight: - if (inSection) { - inSection = false; - writeEndTag(); // </section> - } + leaveSection(); break; case Atom::SectionHeadingLeft: - writeStartTag(DT_title); + startTitle(); + writeGuidAttribute(Doc::canonicalTitle(Text::sectionHeading(atom).toString())); hx = "h" + QString::number(atom->string().toInt() + hOffset(relative)); xmlWriter().writeAttribute("outputclass",hx); inSectionHeading = true; @@ -1662,46 +1718,43 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark 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 { - QString attr; - if (!s->members.isEmpty()) { - writeStartTag(DT_section); - attr = cleanRef((*s).name).toLower() + " redundant"; - xmlWriter().writeAttribute("outputclass",attr); - writeStartTag(DT_title); - xmlWriter().writeAttribute("outputclass","h2"); - writeCharacters(protectEnc((*s).name)); - writeEndTag(); // - generateSection(s->members, inner, marker, CodeMarker::Summary); - generateSectionInheritedList(*s, inner, marker); - writeEndTag(); //
+ if (!summarySections.isEmpty()) { + enterSection("redundant"); + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { + if (!s->inherited.isEmpty()) + needOtherSection = true; } - if (!s->reimpMembers.isEmpty()) { - QString name = QString("Reimplemented ") + (*s).name; - attr = cleanRef(name).toLower() + " redundant"; - writeStartTag(DT_section); - xmlWriter().writeAttribute("outputclass",attr); - writeStartTag(DT_title); - xmlWriter().writeAttribute("outputclass","h2"); - writeCharacters(protectEnc(name)); - writeEndTag(); // - generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); - generateSectionInheritedList(*s, inner, marker); - writeEndTag(); // + else { + QString attr; + if (!s->members.isEmpty()) { + startTitle(); + attr = cleanRef((*s).name).toLower() + " h2"; + xmlWriter().writeAttribute("outputclass",attr); + writeCharacters(protectEnc((*s).name)); + writeEndTag(); // + generateSection(s->members, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + } + if (!s->reimpMembers.isEmpty()) { + QString name = QString("Reimplemented ") + (*s).name; + attr = cleanRef(name).toLower() + " h2"; + startTitle(); + xmlWriter().writeAttribute("outputclass",attr); + writeCharacters(protectEnc(name)); + writeEndTag(); // + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + } } + ++s; } - ++s; + leaveSection(); } if (needOtherSection) { - writeStartTag(DT_section); - xmlWriter().writeAttribute("outputclass","additional-inherited-members redundant"); - writeStartTag(DT_title); + enterSection("additional-inherited-members redundant"); + startTitle(); xmlWriter().writeAttribute("outputclass","h3"); xmlWriter().writeCharacters("Additional Inherited Members"); writeEndTag(); // @@ -1711,7 +1764,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark generateSectionInheritedList(*s, inner, marker); ++s; } - writeEndTag(); // + leaveSection(); } writeDetailedDescription(nsn, marker, false, QString("Detailed Description")); @@ -1800,46 +1853,43 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark 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()) { - writeStartTag(DT_section); - attr = cleanRef((*s).name).toLower() + " redundant"; - xmlWriter().writeAttribute("outputclass",attr); - writeStartTag(DT_title); - xmlWriter().writeAttribute("outputclass","h2"); - writeCharacters(protectEnc((*s).name)); - writeEndTag(); // - generateSection(s->members, inner, marker, CodeMarker::Summary); - generateSectionInheritedList(*s, inner, marker); - writeEndTag(); //
+ if (!summarySections.isEmpty()) { + enterSection("redundant"); + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { + if (!s->inherited.isEmpty()) + needOtherSection = true; } - if (!s->reimpMembers.isEmpty()) { - QString name = QString("Reimplemented ") + (*s).name; - attr = cleanRef(name).toLower() + " redundant"; - writeStartTag(DT_section); - xmlWriter().writeAttribute("outputclass",attr); - writeStartTag(DT_title); - xmlWriter().writeAttribute("outputclass","h2"); - writeCharacters(protectEnc(name)); - writeEndTag(); // - generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); - generateSectionInheritedList(*s, inner, marker); - writeEndTag(); // + else { + QString attr; + if (!s->members.isEmpty()) { + startTitle(); + attr = cleanRef((*s).name).toLower() + " h2"; + xmlWriter().writeAttribute("outputclass",attr); + writeCharacters(protectEnc((*s).name)); + writeEndTag(); // + generateSection(s->members, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + } + if (!s->reimpMembers.isEmpty()) { + QString name = QString("Reimplemented ") + (*s).name; + attr = cleanRef(name).toLower() + " h2"; + startTitle(); + xmlWriter().writeAttribute("outputclass",attr); + writeCharacters(protectEnc(name)); + writeEndTag(); // + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + } } + ++s; } - ++s; + leaveSection(); } if (needOtherSection) { - writeStartTag(DT_section); - xmlWriter().writeAttribute("outputclass","additional-inherited-members redundant"); - writeStartTag(DT_title); + enterSection("additional-inherited-members redundant"); + startTitle(); xmlWriter().writeAttribute("outputclass","h3"); xmlWriter().writeCharacters("Additional Inherited Members"); writeEndTag(); // @@ -1849,7 +1899,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark generateSectionInheritedList(*s, inner, marker); ++s; } - writeEndTag(); // + leaveSection(); } writeDetailedDescription(cn, marker, false, QString("Detailed Description")); @@ -1922,46 +1972,43 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark 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()) { - writeStartTag(DT_section); - attr = cleanRef((*s).name).toLower() + " redundant"; - xmlWriter().writeAttribute("outputclass",attr); - writeStartTag(DT_title); - xmlWriter().writeAttribute("outputclass","h2"); - writeCharacters(protectEnc((*s).name)); - writeEndTag(); // - generateSection(s->members, inner, marker, CodeMarker::Summary); - generateSectionInheritedList(*s, inner, marker); - writeEndTag(); //
+ if (!summarySections.isEmpty()) { + enterSection("redundant"); + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { + if (!s->inherited.isEmpty()) + needOtherSection = true; } - if (!s->reimpMembers.isEmpty()) { - QString name = QString("Reimplemented ") + (*s).name; - attr = cleanRef(name).toLower() + " redundant"; - writeStartTag(DT_section); - xmlWriter().writeAttribute("outputclass",attr); - writeStartTag(DT_title); - xmlWriter().writeAttribute("outputclass","h2"); - writeCharacters(protectEnc(name)); - writeEndTag(); // - generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); - generateSectionInheritedList(*s, inner, marker); - writeEndTag(); // + else { + QString attr; + if (!s->members.isEmpty()) { + startTitle(); + attr = cleanRef((*s).name).toLower() + " h2"; + xmlWriter().writeAttribute("outputclass",attr); + writeCharacters(protectEnc((*s).name)); + writeEndTag(); // + generateSection(s->members, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + } + if (!s->reimpMembers.isEmpty()) { + QString name = QString("Reimplemented ") + (*s).name; + attr = cleanRef(name).toLower() + " h2"; + startTitle(); + xmlWriter().writeAttribute("outputclass",attr); + writeCharacters(protectEnc(name)); + writeEndTag(); // + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + } } + ++s; } - ++s; + leaveSection(); } if (needOtherSection) { - writeStartTag(DT_section); - xmlWriter().writeAttribute("outputclass","additional-inherited-members redundant"); - writeStartTag(DT_title); + enterSection("additional-inherited-members redundant"); + startTitle(); xmlWriter().writeAttribute("outputclass","h3"); xmlWriter().writeCharacters("Additional Inherited Members"); writeEndTag(); // @@ -1971,7 +2018,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark generateSectionInheritedList(*s, inner, marker); ++s; } - writeEndTag(); // + leaveSection(); } writeDetailedDescription(fn, marker, false, QString("Detailed Description")); @@ -2042,23 +2089,24 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark QList
summarySections; summarySections = marker->qmlSections(qcn,CodeMarker::Summary,0); - s = summarySections.begin(); - while (s != summarySections.end()) { - QString attr; - if (!s->members.isEmpty()) { - writeStartTag(DT_section); - attr = cleanRef((*s).name).toLower() + " redundant"; - xmlWriter().writeAttribute("outputclass",attr); - writeStartTag(DT_title); - xmlWriter().writeAttribute("outputclass","h2"); - writeCharacters(protectEnc((*s).name)); - writeEndTag(); // - generateQmlSummary(*s,qcn,marker); - //generateSection(s->members, inner, marker, CodeMarker::Summary); - //generateSectionInheritedList(*s, inner, marker); - writeEndTag(); //
+ if (!summarySections.isEmpty()) { + enterSection("redundant"); + s = summarySections.begin(); + while (s != summarySections.end()) { + QString attr; + if (!s->members.isEmpty()) { + startTitle(); + attr = cleanRef((*s).name).toLower() + " h2"; + xmlWriter().writeAttribute("outputclass",attr); + writeCharacters(protectEnc((*s).name)); + writeEndTag(); // + generateQmlSummary(*s,qcn,marker); + //generateSection(s->members, inner, marker, CodeMarker::Summary); + //generateSectionInheritedList(*s, inner, marker); + } + ++s; } - ++s; + leaveSection(); } writeDetailedDescription(qcn, marker, false, QString("Detailed Description")); @@ -2067,29 +2115,27 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark QList
detailSections; detailSections = marker->qmlSections(qcn,CodeMarker::Detailed,0); - s = detailSections.begin(); - while (s != detailSections.end()) { - if (!s->members.isEmpty()) { - QString attr; - inSection = true; - writeStartTag(DT_section); - attr = cleanRef((*s).name).toLower(); - xmlWriter().writeAttribute("outputclass",attr); - writeStartTag(DT_title); - xmlWriter().writeAttribute("outputclass","h2"); - writeCharacters(protectEnc((*s).name)); - writeEndTag(); // - NodeList::ConstIterator m = (*s).members.begin(); - while (m != (*s).members.end()) { - generateDetailedQmlMember(*m, qcn, marker); - ++m; + if (!detailSections.isEmpty()) { + enterSection("details"); + s = detailSections.begin(); + while (s != detailSections.end()) { + if (!s->members.isEmpty()) { + QString attr; + startTitle(); + attr = cleanRef((*s).name).toLower() + " h2"; + xmlWriter().writeAttribute("outputclass",attr); + writeCharacters(protectEnc((*s).name)); + writeEndTag(); // + NodeList::ConstIterator m = (*s).members.begin(); + while (m != (*s).members.end()) { + generateDetailedQmlMember(*m, qcn, marker); + ++m; + } } - writeEndTag(); //
- inSection = false; + ++s; } - ++s; + leaveSection(); } - writeEndTag(); // writeEndTag(); // } @@ -2139,24 +2185,22 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode* fake, CodeMarker* marker if (fake->subType() == Node::Module) { generateStatus(fake, marker); if (moduleNamespaceMap.contains(fake->name())) { - writeStartTag(DT_section); - xmlWriter().writeAttribute("outputclass","namespaces"); - writeStartTag(DT_title); + enterSection("namespaces"); + startTitle(); xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeCharacters("Namespaces"); writeEndTag(); // generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]); - writeEndTag(); // + leaveSection(); } if (moduleClassMap.contains(fake->name())) { - writeStartTag(DT_section); - xmlWriter().writeAttribute("outputclass","classes"); - writeStartTag(DT_title); + enterSection("classes"); + startTitle(); xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeCharacters("Classes"); writeEndTag(); // generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); - writeEndTag(); // + leaveSection(); } } @@ -5333,6 +5377,7 @@ void DitaXmlGenerator::beginSubPage(const Location& location, writer->setAutoFormatting(true); writer->setAutoFormattingIndent(4); writer->writeStartDocument(); + clearSectionNesting(); } /*! @@ -5342,6 +5387,8 @@ void DitaXmlGenerator::beginSubPage(const Location& location, */ void DitaXmlGenerator::endSubPage() { + if (inSection()) + qDebug() << "Missing in" << outFileName() << sectionNestingLevel; xmlWriter().writeEndDocument(); delete xmlWriterStack.pop(); PageGenerator::endSubPage(); @@ -5387,19 +5434,17 @@ void DitaXmlGenerator::writeDetailedDescription(const Node* node, xmlWriter().writeAttribute("outputclass","details"); } else { - inSection = true; - writeStartTag(DT_section); - if (!title.isEmpty()) { - writeGuidAttribute(title); - xmlWriter().writeAttribute("outputclass","details"); - writeStartTag(DT_title); + QString t = title; + if (!t.isEmpty()) { + enterSection("details",&t); + startTitle(); xmlWriter().writeAttribute("outputclass","h2"); writeCharacters(title); writeEndTag(); // } else { - writeGuidAttribute("Detailed Description"); - xmlWriter().writeAttribute("outputclass","details"); + t = "Detailed Description"; + enterSection("details",&t); } } generateBody(node, marker); @@ -5407,9 +5452,8 @@ void DitaXmlGenerator::writeDetailedDescription(const Node* node, writeEndTag(); // inApiDesc = false; } - else if (inSection) { - writeEndTag(); // - inSection = false; + else if (inSection()) { + leaveSection(); } } inDetailedDescription = false; diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 3e66318..d35af76 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -438,23 +438,42 @@ class DitaXmlGenerator : public PageGenerator void addLink(const QString& href, const QStringRef& text); void writeDitaMap(); void writeStartTag(DitaTag t); + void startTitle(); void writeEndTag(DitaTag t=DT_NONE); DitaTag currentTag(); + void clearSectionNesting() { sectionNestingLevel = 0; } + int enterSection(const QString& outputclass, QString* idText=0); + int leaveSection(); + bool inSection() const { return (sectionNestingLevel > 0); } + int currentSectionNestingLevel() const { return sectionNestingLevel; } + private: - QMap refMap; - QMap name2guidMap; - GuidMaps guidMaps; - int codeIndent; + /* + These flags indicate which elements the generator + is currently outputting. + */ + bool inApiDesc; + bool inContents; + bool inDetailedDescription; + bool inLegaleseText; bool inLink; bool inObsoleteLink; - bool inContents; bool inSectionHeading; bool inTableHeader; bool inTableBody; - int numTableRows; - bool threeColumnEnumValueTable; + + bool noLinks; + bool obsoleteLinks; bool offlineDocs; + bool threeColumnEnumValueTable; + + int codeIndent; + int numTableRows; + int divNestingLevel; + int sectionNestingLevel; + int tableColumnCount; + QString link; QStringList sectionNumber; QRegExp funcLeftParen; @@ -473,9 +492,9 @@ class DitaXmlGenerator : public PageGenerator QStringList stylesheets; QStringList customHeadElements; const Tree* myTree; - bool obsoleteLinks; - bool noLinks; - int tableColumnCount; + QMap refMap; + QMap name2guidMap; + GuidMaps guidMaps; QMap moduleClassMap; QMap moduleNamespaceMap; NodeMap nonCompatClasses; @@ -494,10 +513,6 @@ class DitaXmlGenerator : public PageGenerator NewClassMaps newClassMaps; NewClassMaps newQmlClassMaps; static int id; - static bool inApiDesc; - static bool inSection; - static bool inDetailedDescription; - static bool inLegaleseText; static QString ditaTags[]; QStack xmlWriterStack; QStack tagStack; diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 346bf95..5f563be 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -646,7 +646,7 @@ void DocParser::parse(const QString& source, } break; case CMD_ENDCHAPTER: - endSection(0, cmd); + endSection(Doc::Chapter, cmd); break; case CMD_ENDCODE: closeCommand(cmd); @@ -1458,7 +1458,7 @@ void DocParser::parse(const QString& source, location().warning(tr("Missing '\\%1'").arg(cmdName(CMD_ENDIF))); } - while (currentSectioningUnit > Doc::Chapter) { + while (currentSectioningUnit >= Doc::Chapter) { int delta = currentSectioningUnit - priv->extra->sectioningUnit; append(Atom::SectionRight, QString::number(delta)); currentSectioningUnit = Doc::SectioningUnit(int(currentSectioningUnit) - 1); -- cgit v0.12 From 868a45e6903077756daa165126b5fbdbdcf6719c Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Thu, 17 Mar 2011 11:24:44 +0100 Subject: Doc: Fixed doc bug in undo framework example Task-number: QTBUG-14580 --- doc/src/examples/undoframework.qdoc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/src/examples/undoframework.qdoc b/doc/src/examples/undoframework.qdoc index c5bc279..65104bd 100644 --- a/doc/src/examples/undoframework.qdoc +++ b/doc/src/examples/undoframework.qdoc @@ -199,8 +199,7 @@ \snippet examples/tools/undoframework/commands.cpp 8 - \c undo() removes the item from the scene. We need to update the - scene as ...(ask Andreas) + \c undo() removes the item from the scene. \snippet examples/tools/undoframework/commands.cpp 9 -- cgit v0.12 From d0c50f3d57b70fee289fe1fbf2f519c3090a9934 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Thu, 17 Mar 2011 11:33:57 +0100 Subject: Doc: Fixed broken links in QIcon::fromTheme() Task-number: QTBUG-9990 --- src/gui/image/qicon.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index d0cc937..59c384a 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -964,12 +964,15 @@ QString QIcon::themeName() Returns the QIcon corresponding to \a name in the current icon theme. If no such icon is found in the current theme - \a fallback is return instead. + \a fallback is returned instead. - The lastest version of the freedesktop icon specification and naming - spesification can be obtained here: - http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html - http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html + The latest version of the freedesktop icon specification and naming + specification can be obtained here: + + \list + \o \l{http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html} + \o \l{http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html} + \endlist To fetch an icon from the current icon theme: -- cgit v0.12 From 86724150c8117dd2fbfa117a642dce57176e5e23 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Thu, 17 Mar 2011 11:52:02 +0100 Subject: Doc: Removed links to obsolete API in QResource Task-number: QTBUG-15583 --- src/corelib/io/qresource.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index d35d68e..207cda3 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -373,7 +373,7 @@ QResourcePrivate::ensureChildren() const Constructs a QResource pointing to \a file. \a locale is used to load a specific localization of a resource data. - \sa QFileInfo, searchPaths(), setFileName(), setLocale() + \sa QFileInfo, QDir::searchPaths(), setFileName(), setLocale() */ QResource::QResource(const QString &file, const QLocale &locale) : d_ptr(new QResourcePrivate(this)) @@ -418,7 +418,7 @@ QLocale QResource::locale() const /*! Sets a QResource to point to \a file. \a file can either be absolute, in which case it is opened directly, if relative then the file will be - tried to be found in searchPaths(). + tried to be found in QDir::searchPaths(). \sa absoluteFilePath() */ @@ -446,7 +446,7 @@ QString QResource::fileName() const /*! Returns the real path that this QResource represents, if the resource - was found via the searchPaths() it will be indicated in the path. + was found via the QDir::searchPaths() it will be indicated in the path. \sa fileName() */ -- cgit v0.12 From a09903cd713f94508b599d7723725295821775a5 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Thu, 17 Mar 2011 13:08:34 +0100 Subject: Doc: Fixed reference to absolete API in exceptionsafety.html Task-number: QTBUG-14445 Reviewed-by: Jerome Pasion --- doc/src/howtos/exceptionsafety.qdoc | 5 +++-- src/gui/image/qimage.cpp | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/src/howtos/exceptionsafety.qdoc b/doc/src/howtos/exceptionsafety.qdoc index c4b5ebc..b3795d6 100644 --- a/doc/src/howtos/exceptionsafety.qdoc +++ b/doc/src/howtos/exceptionsafety.qdoc @@ -100,8 +100,9 @@ if any allocation fails. Allocations can fail if the system runs out of memory or doesn't have enough continuous memory to allocate the requested size. - Exceptions to that rule are documented. As an example, \l QImage::create() - returns false if not enough memory exists instead of throwing an exception. + Exceptions to that rule are documented. As an example, QImage constructors will + create a \l{QImage::isNull()}{null} image if not enough memory exists instead + of throwing an exception. \section1 Recovering from exceptions diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 168c518..441bdb1 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -833,6 +833,8 @@ QImage::QImage() Constructs an image with the given \a width, \a height and \a format. + A \l{isNull()}{null} image will be returned if memory cannot be allocated. + \warning This will create a QImage with uninitialized data. Call fill() to fill the image with an appropriate pixel value before drawing onto it with QPainter. @@ -846,6 +848,8 @@ QImage::QImage(int width, int height, Format format) /*! Constructs an image with the given \a size and \a format. + A \l{isNull()}{null} image is returned if memory cannot be allocated. + \warning This will create a QImage with uninitialized data. Call fill() to fill the image with an appropriate pixel value before drawing onto it with QPainter. -- cgit v0.12 From 95beb3b88fefe754af52c5005de0330139f9d737 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 17 Mar 2011 14:02:00 +0100 Subject: qdoc: Completed changing
structure. There appears to be a design flaw in the DITA language in that it doesn't allow the element to appear inside a <bodydiv> <sectiondiv>. --- tools/qdoc3/ditaxmlgenerator.cpp | 327 ++++++++++++++++++--------------------- tools/qdoc3/ditaxmlgenerator.h | 10 +- 2 files changed, 155 insertions(+), 182 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 14f18ec..cc9b4fa 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -299,19 +299,6 @@ void DitaXmlGenerator::addLink(const QString& href, } /*! - If there are no \c {<bodydiv>} or \c {<sectiondiv>} elements - open, start a \c {<title>} element. Otherwise, start a - \c {<p>} element. - */ -void DitaXmlGenerator::startTitle() -{ - if (divNestingLevel > 0) - writeStartTag(DT_p); - else - writeStartTag(DT_title); -} - -/*! Push \a t onto the dita tag stack and write the appropriate start tag to the DITA XML file. */ @@ -343,23 +330,56 @@ DitaXmlGenerator::DitaTag DitaXmlGenerator::currentTag() } /*! + Write the start tag \c{<apiDesc>}. if \a title is not + empty, generate a GUID from it and write the GUID as the + value of the \e{id} attribute. Then write \a title as + the value of the \e {spectitle} attribute. + + Then if \a outputclass is not empty, write it as the value + of the \a outputclass attribute. + + Fiunally, set the section nesting level to 1 and return 1. + */ +int DitaXmlGenerator::enterApiDesc(const QString& outputclass, const QString& title) +{ + writeStartTag(DT_apiDesc); + if (!title.isEmpty()) { + writeGuidAttribute(title); + xmlWriter().writeAttribute("spectitle",title); + } + if (!outputclass.isEmpty()) + xmlWriter().writeAttribute("outputclass",outputclass); + sectionNestingLevel = 1; + return sectionNestingLevel; +} + +/*! If the section nesting level is 0, output a \c{<section>} - element with an \e id attribute set to \a idText and + element with an \e id attribute generated from \a title and an \e outputclass attribute set to \a outputclass. - If \a idText is null, no \e id attribute is output. + If \a title is null, no \e id attribute is output. If \a outputclass is empty, no \e outputclass attribute is output. - The section level is incremented and then returned. + Finally, increment the section nesting level and return + the new value. */ -int DitaXmlGenerator::enterSection(const QString& outputclass, QString* idText) +int DitaXmlGenerator::enterSection(const QString& outputclass, const QString& title) { if (sectionNestingLevel == 0) { writeStartTag(DT_section); - if (idText) - writeGuidAttribute(*idText); + if (!title.isEmpty()) + writeGuidAttribute(title); + if (!outputclass.isEmpty()) + xmlWriter().writeAttribute("outputclass",outputclass); + } + else if (!title.isEmpty()) { + writeStartTag(DT_p); + writeGuidAttribute(title); if (!outputclass.isEmpty()) xmlWriter().writeAttribute("outputclass",outputclass); + writeCharacters(title); + writeEndTag(); // </p> } return ++sectionNestingLevel; } @@ -374,7 +394,7 @@ int DitaXmlGenerator::leaveSection() if (sectionNestingLevel > 0) { --sectionNestingLevel; if (sectionNestingLevel == 0) - writeEndTag(); // </section> + writeEndTag(); // </section> or </apiDesc> } return sectionNestingLevel; } @@ -383,8 +403,7 @@ int DitaXmlGenerator::leaveSection() The default constructor. */ DitaXmlGenerator::DitaXmlGenerator() - : inApiDesc(false), - inContents(false), + : inContents(false), inDetailedDescription(false), inLegaleseText(false), inLink(false), @@ -697,7 +716,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, //skipAhead = skipAtoms(atom, Atom::BriefRight); //break; //} - if (inApiDesc || inSection()) { + if (inSection()) { writeStartTag(DT_p); xmlWriter().writeAttribute("outputclass","brief"); } @@ -1424,18 +1443,20 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } break; case Atom::SectionLeft: +#if 0 if (inApiDesc) { writeEndTag(); // </apiDesc> inApiDesc = false; } - enterSection("details"); +#endif + enterSection("details",QString()); //writeGuidAttribute(Doc::canonicalTitle(Text::sectionHeading(atom).toString())); break; case Atom::SectionRight: leaveSection(); break; case Atom::SectionHeadingLeft: - startTitle(); + writeStartTag(DT_p); writeGuidAttribute(Doc::canonicalTitle(Text::sectionHeading(atom).toString())); hx = "h" + QString::number(atom->string().toInt() + hOffset(relative)); xmlWriter().writeAttribute("outputclass",hx); @@ -1701,8 +1722,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeLocation(nsn); writeEndTag(); // <cxxClassDefinition> - writeStartTag(DT_apiDesc); - xmlWriter().writeAttribute("spectitle",title); + enterApiDesc(QString(),title); Text brief = nsn->doc().briefText(); // zzz if (!brief.isEmpty()) { writeStartTag(DT_p); @@ -1713,13 +1733,17 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark generateStatus(nsn, marker); generateThreadSafeness(nsn, marker); generateSince(nsn, marker); - writeEndTag(); // </apiDesc> + + enterSection("h2","Detailed Description"); + generateBody(nsn, marker); + leaveSection(); + leaveSection(); // </apiDesc> bool needOtherSection = false; QList<Section> summarySections; summarySections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); if (!summarySections.isEmpty()) { - enterSection("redundant"); + enterSection("redundant",QString()); s = summarySections.begin(); while (s != summarySections.end()) { if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { @@ -1729,7 +1753,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark else { QString attr; if (!s->members.isEmpty()) { - startTitle(); + writeStartTag(DT_p); attr = cleanRef((*s).name).toLower() + " h2"; xmlWriter().writeAttribute("outputclass",attr); writeCharacters(protectEnc((*s).name)); @@ -1740,7 +1764,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark if (!s->reimpMembers.isEmpty()) { QString name = QString("Reimplemented ") + (*s).name; attr = cleanRef(name).toLower() + " h2"; - startTitle(); + writeStartTag(DT_p); xmlWriter().writeAttribute("outputclass",attr); writeCharacters(protectEnc(name)); writeEndTag(); // @@ -1750,24 +1774,21 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } ++s; } - leaveSection(); - } - if (needOtherSection) { - enterSection("additional-inherited-members redundant"); - startTitle(); - xmlWriter().writeAttribute("outputclass","h3"); - xmlWriter().writeCharacters("Additional Inherited Members"); - writeEndTag(); // - s = summarySections.begin(); - while (s != summarySections.end()) { - if (s->members.isEmpty()) - generateSectionInheritedList(*s, inner, marker); - ++s; + if (needOtherSection) { + writeStartTag(DT_p); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeCharacters("Additional Inherited Members"); + writeEndTag(); // + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty()) + generateSectionInheritedList(*s, inner, marker); + ++s; + } } leaveSection(); } - - writeDetailedDescription(nsn, marker, false, QString("Detailed Description")); + writeEndTag(); // // not included: @@ -1834,8 +1855,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeLocation(cn); writeEndTag(); // - writeStartTag(DT_apiDesc); - xmlWriter().writeAttribute("spectitle",title); + enterApiDesc(QString(),title); Text brief = cn->doc().briefText(); // zzz if (!brief.isEmpty()) { writeStartTag(DT_p); @@ -1848,13 +1868,16 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark generateInheritedBy(cn, marker); generateThreadSafeness(cn, marker); generateSince(cn, marker); - writeEndTag(); // + enterSection("h2","Detailed Description"); + generateBody(cn, marker); + leaveSection(); + leaveSection(); // bool needOtherSection = false; QList
summarySections; summarySections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); if (!summarySections.isEmpty()) { - enterSection("redundant"); + enterSection("redundant",QString()); s = summarySections.begin(); while (s != summarySections.end()) { if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { @@ -1864,45 +1887,41 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark else { QString attr; if (!s->members.isEmpty()) { - startTitle(); + writeStartTag(DT_p); attr = cleanRef((*s).name).toLower() + " h2"; xmlWriter().writeAttribute("outputclass",attr); writeCharacters(protectEnc((*s).name)); - writeEndTag(); // + writeEndTag(); //

generateSection(s->members, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); } if (!s->reimpMembers.isEmpty()) { QString name = QString("Reimplemented ") + (*s).name; attr = cleanRef(name).toLower() + " h2"; - startTitle(); + writeStartTag(DT_p); xmlWriter().writeAttribute("outputclass",attr); writeCharacters(protectEnc(name)); - writeEndTag(); // + writeEndTag(); //

generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); } } ++s; } - leaveSection(); - } - if (needOtherSection) { - enterSection("additional-inherited-members redundant"); - startTitle(); - xmlWriter().writeAttribute("outputclass","h3"); - xmlWriter().writeCharacters("Additional Inherited Members"); - writeEndTag(); // - s = summarySections.begin(); - while (s != summarySections.end()) { - if (s->members.isEmpty()) - generateSectionInheritedList(*s, inner, marker); - ++s; + if (needOtherSection) { + writeStartTag(DT_p); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeCharacters("Additional Inherited Members"); + writeEndTag(); //

+ s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty()) + generateSectionInheritedList(*s, inner, marker); + ++s; + } } leaveSection(); } - - writeDetailedDescription(cn, marker, false, QString("Detailed Description")); // not included: or @@ -1955,8 +1974,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeProlog(inner,marker); writeStartTag(DT_cxxClassDetail); - writeStartTag(DT_apiDesc); - xmlWriter().writeAttribute("spectitle",title); + enterApiDesc(QString(),title); Text brief = fn->doc().briefText(); // zzz if (!brief.isEmpty()) { writeStartTag(DT_p); @@ -1967,13 +1985,17 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark generateStatus(fn, marker); generateThreadSafeness(fn, marker); generateSince(fn, marker); - writeEndTag(); // + generateSince(fn, marker); + enterSection("h2","Detailed Description"); + generateBody(fn, marker); + leaveSection(); + leaveSection(); // bool needOtherSection = false; QList
summarySections; summarySections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); if (!summarySections.isEmpty()) { - enterSection("redundant"); + enterSection("redundant",QString()); s = summarySections.begin(); while (s != summarySections.end()) { if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { @@ -1983,45 +2005,43 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark else { QString attr; if (!s->members.isEmpty()) { - startTitle(); + writeStartTag(DT_p); attr = cleanRef((*s).name).toLower() + " h2"; xmlWriter().writeAttribute("outputclass",attr); writeCharacters(protectEnc((*s).name)); - writeEndTag(); // + writeEndTag(); //

generateSection(s->members, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); } if (!s->reimpMembers.isEmpty()) { QString name = QString("Reimplemented ") + (*s).name; attr = cleanRef(name).toLower() + " h2"; - startTitle(); + writeStartTag(DT_p); xmlWriter().writeAttribute("outputclass",attr); writeCharacters(protectEnc(name)); - writeEndTag(); // + writeEndTag(); //

generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); } } ++s; } - leaveSection(); - } - if (needOtherSection) { - enterSection("additional-inherited-members redundant"); - startTitle(); - xmlWriter().writeAttribute("outputclass","h3"); - xmlWriter().writeCharacters("Additional Inherited Members"); - writeEndTag(); // - s = summarySections.begin(); - while (s != summarySections.end()) { - if (s->members.isEmpty()) - generateSectionInheritedList(*s, inner, marker); - ++s; + if (needOtherSection) { + enterSection("additional-inherited-members redundant",QString()); + writeStartTag(DT_p); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeCharacters("Additional Inherited Members"); + writeEndTag(); //

+ s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty()) + generateSectionInheritedList(*s, inner, marker); + ++s; + } } leaveSection(); } - - writeDetailedDescription(fn, marker, false, QString("Detailed Description")); + writeEndTag(); // // not included: @@ -2073,8 +2093,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeProlog(inner,marker); writeStartTag(DT_cxxClassDetail); - writeStartTag(DT_apiDesc); - xmlWriter().writeAttribute("spectitle",title); + enterApiDesc(QString(),title); Text brief = qcn->doc().briefText(); // zzz if (!brief.isEmpty()) { writeStartTag(DT_p); @@ -2085,21 +2104,26 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark generateQmlInherits(qcn, marker); generateQmlInheritedBy(qcn, marker); generateSince(qcn, marker); - writeEndTag(); // + enterSection("h2","Detailed Description"); + generateBody(qcn, marker); + if (cn) + generateQmlText(cn->doc().body(), cn, marker, qcn->name()); + leaveSection(); + leaveSection(); // QList
summarySections; summarySections = marker->qmlSections(qcn,CodeMarker::Summary,0); if (!summarySections.isEmpty()) { - enterSection("redundant"); + enterSection("redundant",QString()); s = summarySections.begin(); while (s != summarySections.end()) { QString attr; if (!s->members.isEmpty()) { - startTitle(); + writeStartTag(DT_p); attr = cleanRef((*s).name).toLower() + " h2"; xmlWriter().writeAttribute("outputclass",attr); writeCharacters(protectEnc((*s).name)); - writeEndTag(); // + writeEndTag(); //

generateQmlSummary(*s,qcn,marker); //generateSection(s->members, inner, marker, CodeMarker::Summary); //generateSectionInheritedList(*s, inner, marker); @@ -2108,24 +2132,20 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } leaveSection(); } - - 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); if (!detailSections.isEmpty()) { - enterSection("details"); + enterSection("details",QString()); s = detailSections.begin(); while (s != detailSections.end()) { if (!s->members.isEmpty()) { QString attr; - startTitle(); + writeStartTag(DT_p); attr = cleanRef((*s).name).toLower() + " h2"; xmlWriter().writeAttribute("outputclass",attr); writeCharacters(protectEnc((*s).name)); - writeEndTag(); // + writeEndTag(); //

NodeList::ConstIterator m = (*s).members.begin(); while (m != (*s).members.end()) { generateDetailedQmlMember(*m, qcn, marker); @@ -2162,19 +2182,12 @@ void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& tex */ void DitaXmlGenerator::generateFakeNode(const FakeNode* fake, CodeMarker* marker) { - SubTitleSize subTitleSize = LargeSubTitle; QList
sections; QList
::const_iterator s; QString fullTitle = fake->fullTitle(); - QString htmlTitle = fullTitle; - if (fake->subType() == Node::File && !fake->subTitle().isEmpty()) { - subTitleSize = SmallSubTitle; - htmlTitle += " (" + fake->subTitle() + ")"; - } - else if (fake->subType() == Node::QmlBasicType) { + if (fake->subType() == Node::QmlBasicType) { fullTitle = "QML Basic Type: " + fullTitle; - htmlTitle = fullTitle; } generateHeader(fake, fullTitle); @@ -2182,23 +2195,16 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode* fake, CodeMarker* marker writeProlog(fake, marker); writeStartTag(DT_body); + enterSection(QString(),QString()); if (fake->subType() == Node::Module) { generateStatus(fake, marker); if (moduleNamespaceMap.contains(fake->name())) { - enterSection("namespaces"); - startTitle(); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters("Namespaces"); - writeEndTag(); // + enterSection("h2","Namespaces"); generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]); leaveSection(); } if (moduleClassMap.contains(fake->name())) { - enterSection("classes"); - startTitle(); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters("Classes"); - writeEndTag(); // + enterSection("h2","Classes"); generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); leaveSection(); } @@ -2222,10 +2228,12 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode* fake, CodeMarker* marker } else { if (fake->subType() == Node::Module) { - writeDetailedDescription(fake, marker, false, QString("Detailed Description")); + enterSection("h2","Detailed Description"); + generateBody(fake, marker); + leaveSection(); } else - writeDetailedDescription(fake, marker, false, QString()); + generateBody(fake, marker); generateAlsoList(fake, marker); if (!fake->groupMembers().isEmpty()) { @@ -2237,6 +2245,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode* fake, CodeMarker* marker generateAnnotatedList(fake, marker, groupMembersMap); } } + leaveSection(); //
writeEndTag(); // writeRelatedLinks(fake, marker); writeEndTag(); // @@ -4062,6 +4071,11 @@ void DitaXmlGenerator::findAllNamespaces(const InnerNode* node) } } +/*! + We're writing an attribute that indicates that the text + data is a heading, hence, h1, h2, h3... etc, and we must + decide which number to use. + */ int DitaXmlGenerator::hOffset(const Node* node) { switch (node->type()) { @@ -4812,7 +4826,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, writeLocation(fn); writeEndTag(); // - writeDetailedDescription(fn, marker, true, QString()); + writeApiDesc(fn, marker, QString()); // generateAlsoList(inner, marker); // not included: or @@ -4970,7 +4984,7 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, writeLocation(en); writeEndTag(); // - writeDetailedDescription(en, marker, true, QString()); + writeApiDesc(en, marker, QString()); // not included: or @@ -5033,7 +5047,7 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, writeLocation(tn); writeEndTag(); // - writeDetailedDescription(tn, marker, true, QString()); + writeApiDesc(tn, marker, QString()); // not included: or @@ -5146,7 +5160,7 @@ void DitaXmlGenerator::writeProperties(const Section& s, writeLocation(pn); writeEndTag(); // - writeDetailedDescription(pn, marker, true, QString()); + writeApiDesc(pn, marker, QString()); // not included: or @@ -5230,7 +5244,7 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, writeLocation(vn); writeEndTag(); // - writeDetailedDescription(vn, marker, true, QString()); + writeApiDesc(vn, marker, QString()); // not included: or @@ -5326,7 +5340,7 @@ void DitaXmlGenerator::writeMacros(const Section& s, writeLocation(fn); writeEndTag(); // - writeDetailedDescription(fn, marker, true, QString()); + writeApiDesc(fn, marker, QString()); // not included: or @@ -5406,55 +5420,18 @@ 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 {<apiDesc>} element for \a node to the current XML + stream using the code \a marker and the \a title. */ -void DitaXmlGenerator::writeDetailedDescription(const Node* node, - CodeMarker* marker, - bool apiDesc, - const QString& title) +void DitaXmlGenerator::writeApiDesc(const Node* node, + CodeMarker* marker, + const QString& title) { if (!node->doc().isEmpty()) { inDetailedDescription = true; - if (apiDesc) { - inApiDesc = true; - writeStartTag(DT_apiDesc); - if (!title.isEmpty()) { - writeGuidAttribute(title); - xmlWriter().writeAttribute("spectitle",title); - } - else - writeGuidAttribute("Detailed Description"); - xmlWriter().writeAttribute("outputclass","details"); - } - else { - QString t = title; - if (!t.isEmpty()) { - enterSection("details",&t); - startTitle(); - xmlWriter().writeAttribute("outputclass","h2"); - writeCharacters(title); - writeEndTag(); // - } - else { - t = "Detailed Description"; - enterSection("details",&t); - } - } + enterApiDesc(QString(),title); generateBody(node, marker); - if (inApiDesc) { - writeEndTag(); // - inApiDesc = false; - } - else if (inSection()) { - leaveSection(); - } + leaveSection(); } inDetailedDescription = false; } diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index d35af76..7793db0 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -431,18 +431,15 @@ class DitaXmlGenerator : public PageGenerator virtual void endSubPage(); virtual void generateInnerNode(const InnerNode* node); QXmlStreamWriter& xmlWriter(); - void writeDetailedDescription(const Node* node, - CodeMarker* marker, - bool apiDesc, - const QString& title); + void writeApiDesc(const Node* node, CodeMarker* marker, const QString& title); void addLink(const QString& href, const QStringRef& text); void writeDitaMap(); void writeStartTag(DitaTag t); - void startTitle(); void writeEndTag(DitaTag t=DT_NONE); DitaTag currentTag(); void clearSectionNesting() { sectionNestingLevel = 0; } - int enterSection(const QString& outputclass, QString* idText=0); + int enterApiDesc(const QString& outputclass, const QString& title); + int enterSection(const QString& outputclass, const QString& title); int leaveSection(); bool inSection() const { return (sectionNestingLevel > 0); } int currentSectionNestingLevel() const { return sectionNestingLevel; } @@ -453,7 +450,6 @@ class DitaXmlGenerator : public PageGenerator These flags indicate which elements the generator is currently outputting. */ - bool inApiDesc; bool inContents; bool inDetailedDescription; bool inLegaleseText; -- cgit v0.12 From 3a764060dab07ef0b51d7027b9606c73c0701d2f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 18 Mar 2011 13:15:12 +0100 Subject: qdoc: Added the element. --- tools/qdoc3/ditaxmlgenerator.cpp | 12 +++++++++++- tools/qdoc3/node.cpp | 15 +++++++++++++++ tools/qdoc3/node.h | 4 ++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index cc9b4fa..5d3e34a 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -5667,9 +5667,19 @@ DitaXmlGenerator::writeProlog(const InnerNode* inner, CodeMarker* marker) if (!component.isEmpty()) { writeStartTag(DT_component); xmlWriter().writeCharacters(component); - writeEndTag(); // + writeEndTag(); // } writeEndTag(); // + if (inner->hasOtherMetadata()) { + const QMap& omd = inner->otherMetadata(); + QMapIterator i(omd); + while (i.hasNext()) { + i.next(); + writeStartTag(DT_othermeta); + xmlWriter().writeAttribute("name",i.key()); + xmlWriter().writeAttribute("content",i.value()); + } + } } writeEndTag(); // writeEndTag(); // diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 3b1f280..0f85d37 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -858,6 +858,21 @@ void InnerNode::removeRelated(Node *pseudoChild) related.removeAll(pseudoChild); } +/*! \fn bool InnerNode::hasOtherMetadata() const + Returns tru if the other metadata map is not empty. + */ + +/*! + Insert the pair \a name and \a content into the other metadata map. + */ +void insertOtherMetadata(const QString& name, const QString& content) +{ +} + +/*! \fn const QMap& InnerNode::otherMetadata() cont + Returns the map containing pairs for output as \c {}. + */ + /*! \class LeafNode */ diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 92a7c9f..2de2b5a 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -274,6 +274,9 @@ class InnerNode : public Node virtual void addPageKeywords(const QString& t) { pageKeywds << t; } virtual bool isAbstract() const { return false; } virtual void setAbstract(bool ) { } + bool hasOtherMetadata() const { return !otherMetadataMap.isEmpty(); } + void insertOtherMetadata(const QString& name, const QString& content); + const QMap& otherMetadata() const { return otherMetadataMap; } protected: InnerNode(Type type, InnerNode* parent, const QString& name); @@ -297,6 +300,7 @@ class InnerNode : public Node QMap childMap; QMap primaryFunctionMap; QMap secondaryFunctionMap; + QMap otherMetadataMap; }; class LeafNode : public Node -- cgit v0.12